小编Jos*_*bal的帖子

如何使用 aws cdk 将 SQS 队列订阅到 SNS 主题?

我首先创建一个队列:

const notificationQueue: sqs.IQueue = new sqs.Queue(this, `${domain}-notificationsQueue`, {
  queueName: `${domain}-notificationsQueue.fifo`,
  fifo: true,
  contentBasedDeduplication: false
});
Run Code Online (Sandbox Code Playgroud)

现在我需要将此队列订阅到 SNS 主题(类似这样,但我需要传入一个 Igrantable 对象 - 我不知道该怎么做)

queue.grantConsumeMessages(grantee: iam.IGrantable)
Run Code Online (Sandbox Code Playgroud)

那么如何创建引用特定 SNS 主题的 Igrantable 对象呢?

amazon-sqs amazon-sns amazon-iam typescript aws-cdk

4
推荐指数
1
解决办法
3859
查看次数

如何用"*"替换下面出现的第一个字母?

我被困在这上面,我不知道该怎么做.

# returns a string that changes all occurrences of its first char have been changed to '*'


def fix_start(str):
    results = []
    str.startswith(str[1])
    results = 
Run Code Online (Sandbox Code Playgroud)

例如:给定string ='bubble'它应该返回:bu**le

python string methods replace

-4
推荐指数
1
解决办法
43
查看次数