in boto3_sample/s3_event_notifications_crawler_setup.py [0:0]
def set_sqs_policy(queue_url, queue_arn, client, topic_arn):
try:
response = client.set_queue_attributes(
QueueUrl=queue_url,
Attributes={
'Policy': '''{
"Version": "2012-10-17",
"Id": "AllowSNSPublish",
"Statement": [
{
"Sid": "AllowSNSPublish01",
"Effect": "Allow",
"Principal": { "AWS": "%s" },
"Action": "SQS:SendMessage",
"Resource": "%s",
"Condition": {
"ArnEquals": {
"aws:SourceArn": "%s"
}
}
}
]