|
120 | 120 | SnsPublishContext, |
121 | 121 | ) |
122 | 122 | from localstack.services.sns.utils import ( |
| 123 | + create_default_topic_policy, |
123 | 124 | create_platform_endpoint_arn, |
124 | 125 | create_subscription_arn, |
125 | 126 | encode_subscription_token_with_region, |
@@ -1304,7 +1305,7 @@ def _default_attributes(topic: Topic, context: RequestContext) -> TopicAttribute |
1304 | 1305 | default_attributes = { |
1305 | 1306 | "DisplayName": "", |
1306 | 1307 | "Owner": context.account_id, |
1307 | | - "Policy": _create_default_topic_policy(topic["arn"]), |
| 1308 | + "Policy": create_default_topic_policy(topic["arn"]), |
1308 | 1309 | "SubscriptionsConfirmed": "0", |
1309 | 1310 | "SubscriptionsDeleted": "0", |
1310 | 1311 | "SubscriptionsPending": "0", |
@@ -1340,36 +1341,6 @@ def _create_default_effective_delivery_policy(): |
1340 | 1341 | ) |
1341 | 1342 |
|
1342 | 1343 |
|
1343 | | -def _create_default_topic_policy(topic_arn: str) -> str: |
1344 | | - return json.dumps( |
1345 | | - { |
1346 | | - "Version": "2008-10-17", |
1347 | | - "Id": "__default_policy_ID", |
1348 | | - "Statement": [ |
1349 | | - { |
1350 | | - "Effect": "Allow", |
1351 | | - "Sid": "__default_statement_ID", |
1352 | | - "Principal": {"AWS": "*"}, |
1353 | | - "Action": [ |
1354 | | - "SNS:GetTopicAttributes", |
1355 | | - "SNS:SetTopicAttributes", |
1356 | | - "SNS:AddPermission", |
1357 | | - "SNS:RemovePermission", |
1358 | | - "SNS:DeleteTopic", |
1359 | | - "SNS:Subscribe", |
1360 | | - "SNS:ListSubscriptionsByTopic", |
1361 | | - "SNS:Publish", |
1362 | | - ], |
1363 | | - "Resource": topic_arn, |
1364 | | - "Condition": { |
1365 | | - "StringEquals": {"AWS:SourceOwner": parse_arn(topic_arn)["account"]} |
1366 | | - }, |
1367 | | - } |
1368 | | - ], |
1369 | | - } |
1370 | | - ) |
1371 | | - |
1372 | | - |
1373 | 1344 | def _validate_message_attributes( |
1374 | 1345 | message_attributes: MessageAttributeMap, position: int | None = None |
1375 | 1346 | ) -> None: |
|
0 commit comments