localstack-core 4.10.1.dev42__py3-none-any.whl → 4.11.2.dev14__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. localstack/aws/api/apigateway/__init__.py +42 -0
  2. localstack/aws/api/cloudformation/__init__.py +161 -0
  3. localstack/aws/api/ec2/__init__.py +1165 -12
  4. localstack/aws/api/iam/__init__.py +227 -0
  5. localstack/aws/api/kms/__init__.py +1 -0
  6. localstack/aws/api/lambda_/__init__.py +418 -66
  7. localstack/aws/api/logs/__init__.py +312 -0
  8. localstack/aws/api/opensearch/__init__.py +89 -0
  9. localstack/aws/api/redshift/__init__.py +69 -0
  10. localstack/aws/api/resourcegroupstaggingapi/__init__.py +36 -0
  11. localstack/aws/api/route53/__init__.py +42 -0
  12. localstack/aws/api/route53resolver/__init__.py +1 -0
  13. localstack/aws/api/s3/__init__.py +62 -0
  14. localstack/aws/api/secretsmanager/__init__.py +28 -23
  15. localstack/aws/api/stepfunctions/__init__.py +52 -10
  16. localstack/aws/api/sts/__init__.py +52 -0
  17. localstack/aws/handlers/logging.py +8 -4
  18. localstack/aws/handlers/service.py +11 -2
  19. localstack/aws/protocol/serializer.py +1 -1
  20. localstack/deprecations.py +0 -6
  21. localstack/services/acm/provider.py +4 -0
  22. localstack/services/apigateway/legacy/provider.py +28 -15
  23. localstack/services/cloudformation/engine/template_preparer.py +6 -2
  24. localstack/services/cloudformation/engine/v2/change_set_model_preproc.py +12 -0
  25. localstack/services/cloudwatch/provider.py +10 -3
  26. localstack/services/cloudwatch/provider_v2.py +6 -3
  27. localstack/services/configservice/provider.py +5 -1
  28. localstack/services/dynamodb/provider.py +1 -0
  29. localstack/services/dynamodb/v2/provider.py +1 -0
  30. localstack/services/dynamodbstreams/provider.py +6 -0
  31. localstack/services/dynamodbstreams/v2/provider.py +6 -0
  32. localstack/services/ec2/provider.py +6 -0
  33. localstack/services/es/provider.py +6 -0
  34. localstack/services/events/provider.py +4 -0
  35. localstack/services/events/v1/provider.py +9 -0
  36. localstack/services/firehose/provider.py +5 -0
  37. localstack/services/iam/provider.py +4 -0
  38. localstack/services/kms/models.py +10 -20
  39. localstack/services/kms/provider.py +4 -0
  40. localstack/services/lambda_/api_utils.py +37 -20
  41. localstack/services/lambda_/event_source_mapping/pollers/stream_poller.py +1 -1
  42. localstack/services/lambda_/invocation/assignment.py +4 -1
  43. localstack/services/lambda_/invocation/execution_environment.py +21 -2
  44. localstack/services/lambda_/invocation/lambda_models.py +27 -2
  45. localstack/services/lambda_/invocation/lambda_service.py +51 -3
  46. localstack/services/lambda_/invocation/models.py +9 -1
  47. localstack/services/lambda_/invocation/version_manager.py +18 -3
  48. localstack/services/lambda_/provider.py +239 -95
  49. localstack/services/lambda_/resource_providers/aws_lambda_function.py +33 -1
  50. localstack/services/lambda_/runtimes.py +3 -1
  51. localstack/services/logs/provider.py +9 -0
  52. localstack/services/opensearch/provider.py +53 -3
  53. localstack/services/resource_groups/provider.py +5 -1
  54. localstack/services/resourcegroupstaggingapi/provider.py +6 -1
  55. localstack/services/s3/provider.py +28 -15
  56. localstack/services/s3/utils.py +35 -14
  57. localstack/services/s3control/provider.py +101 -2
  58. localstack/services/s3control/validation.py +50 -0
  59. localstack/services/sns/constants.py +3 -1
  60. localstack/services/sns/publisher.py +15 -6
  61. localstack/services/sns/v2/models.py +6 -0
  62. localstack/services/sns/v2/provider.py +650 -19
  63. localstack/services/sns/v2/utils.py +12 -0
  64. localstack/services/stepfunctions/asl/component/common/path/result_path.py +1 -1
  65. localstack/services/stepfunctions/asl/component/state/state_execution/execute_state.py +0 -1
  66. localstack/services/stepfunctions/asl/component/state/state_execution/state_map/state_map.py +0 -1
  67. localstack/services/stepfunctions/asl/component/state/state_execution/state_task/lambda_eval_utils.py +8 -8
  68. localstack/services/stepfunctions/asl/component/state/state_execution/state_task/{mock_eval_utils.py → local_mock_eval_utils.py} +13 -9
  69. localstack/services/stepfunctions/asl/component/state/state_execution/state_task/service/state_task_service.py +6 -6
  70. localstack/services/stepfunctions/asl/component/state/state_execution/state_task/service/state_task_service_callback.py +1 -1
  71. localstack/services/stepfunctions/asl/component/state/state_fail/state_fail.py +4 -0
  72. localstack/services/stepfunctions/asl/component/test_state/state/base_mock.py +118 -0
  73. localstack/services/stepfunctions/asl/component/test_state/state/common.py +82 -0
  74. localstack/services/stepfunctions/asl/component/test_state/state/execution.py +139 -0
  75. localstack/services/stepfunctions/asl/component/test_state/state/map.py +77 -0
  76. localstack/services/stepfunctions/asl/component/test_state/state/task.py +44 -0
  77. localstack/services/stepfunctions/asl/eval/environment.py +30 -22
  78. localstack/services/stepfunctions/asl/eval/states.py +1 -1
  79. localstack/services/stepfunctions/asl/eval/test_state/environment.py +49 -9
  80. localstack/services/stepfunctions/asl/eval/test_state/program_state.py +22 -0
  81. localstack/services/stepfunctions/asl/jsonata/jsonata.py +5 -1
  82. localstack/services/stepfunctions/asl/parse/preprocessor.py +67 -24
  83. localstack/services/stepfunctions/asl/parse/test_state/asl_parser.py +5 -4
  84. localstack/services/stepfunctions/asl/parse/test_state/preprocessor.py +222 -31
  85. localstack/services/stepfunctions/asl/static_analyser/test_state/test_state_analyser.py +170 -22
  86. localstack/services/stepfunctions/backend/execution.py +6 -6
  87. localstack/services/stepfunctions/backend/execution_worker.py +5 -5
  88. localstack/services/stepfunctions/backend/test_state/execution.py +36 -0
  89. localstack/services/stepfunctions/backend/test_state/execution_worker.py +33 -1
  90. localstack/services/stepfunctions/backend/test_state/test_state_mock.py +127 -0
  91. localstack/services/stepfunctions/local_mocking/__init__.py +9 -0
  92. localstack/services/stepfunctions/{mocking → local_mocking}/mock_config.py +24 -17
  93. localstack/services/stepfunctions/provider.py +78 -27
  94. localstack/services/stepfunctions/test_state/mock_config.py +47 -0
  95. localstack/testing/pytest/fixtures.py +28 -0
  96. localstack/testing/snapshots/transformer_utility.py +5 -0
  97. localstack/utils/analytics/publisher.py +37 -155
  98. localstack/utils/analytics/service_request_aggregator.py +6 -4
  99. localstack/utils/aws/arns.py +7 -0
  100. localstack/utils/batching.py +258 -0
  101. localstack/utils/collections.py +23 -11
  102. localstack/version.py +2 -2
  103. {localstack_core-4.10.1.dev42.dist-info → localstack_core-4.11.2.dev14.dist-info}/METADATA +5 -5
  104. {localstack_core-4.10.1.dev42.dist-info → localstack_core-4.11.2.dev14.dist-info}/RECORD +113 -105
  105. localstack_core-4.11.2.dev14.dist-info/plux.json +1 -0
  106. localstack/services/stepfunctions/mocking/__init__.py +0 -0
  107. localstack/utils/batch_policy.py +0 -124
  108. localstack_core-4.10.1.dev42.dist-info/plux.json +0 -1
  109. /localstack/services/stepfunctions/{mocking → local_mocking}/mock_config_file.py +0 -0
  110. {localstack_core-4.10.1.dev42.data → localstack_core-4.11.2.dev14.data}/scripts/localstack +0 -0
  111. {localstack_core-4.10.1.dev42.data → localstack_core-4.11.2.dev14.data}/scripts/localstack-supervisor +0 -0
  112. {localstack_core-4.10.1.dev42.data → localstack_core-4.11.2.dev14.data}/scripts/localstack.bat +0 -0
  113. {localstack_core-4.10.1.dev42.dist-info → localstack_core-4.11.2.dev14.dist-info}/WHEEL +0 -0
  114. {localstack_core-4.10.1.dev42.dist-info → localstack_core-4.11.2.dev14.dist-info}/entry_points.txt +0 -0
  115. {localstack_core-4.10.1.dev42.dist-info → localstack_core-4.11.2.dev14.dist-info}/licenses/LICENSE.txt +0 -0
  116. {localstack_core-4.10.1.dev42.dist-info → localstack_core-4.11.2.dev14.dist-info}/top_level.txt +0 -0
@@ -28,6 +28,7 @@ VALID_SUBSCRIPTION_ATTR_NAME: list[str] = [
28
28
  MSG_ATTR_NAME_REGEX = re.compile(r"^(?!\.)(?!.*\.$)(?!.*\.\.)[a-zA-Z0-9_\-.]+$")
29
29
  ATTR_TYPE_REGEX = re.compile(r"^(String|Number|Binary)\..+$")
30
30
  VALID_MSG_ATTR_NAME_CHARS = set(ascii_letters + digits + "." + "-" + "_")
31
+ E164_REGEX = re.compile(r"^\+?[1-9]\d{1,14}$")
31
32
 
32
33
 
33
34
  GCM_URL = "https://fcm.googleapis.com/fcm/send"
@@ -42,6 +43,7 @@ SUBSCRIPTION_TOKENS_ENDPOINT = "/_aws/sns/subscription-tokens"
42
43
  SNS_CERT_ENDPOINT = "/_aws/sns/SimpleNotificationService-6c6f63616c737461636b69736e696365.pem"
43
44
 
44
45
  DUMMY_SUBSCRIPTION_PRINCIPAL = "arn:{partition}:iam::{account_id}:user/DummySNSPrincipal"
45
- E164_REGEX = re.compile(r"^\+?[1-9]\d{1,14}$")
46
46
 
47
47
  VALID_APPLICATION_PLATFORMS = list(get_args(SnsApplicationPlatforms))
48
+
49
+ MAXIMUM_MESSAGE_LENGTH = 262144
@@ -30,6 +30,7 @@ from localstack.services.sns.models import (
30
30
  SnsStore,
31
31
  SnsSubscription,
32
32
  )
33
+ from localstack.services.sns.v2.utils import get_topic_subscriptions
33
34
  from localstack.utils.aws.arns import (
34
35
  PARTITION_NAMES,
35
36
  extract_account_id_from_arn,
@@ -254,9 +255,11 @@ class LambdaTopicPublisher(TopicPublisher):
254
255
  "UnsubscribeUrl": unsubscribe_url,
255
256
  "MessageAttributes": message_attributes,
256
257
  }
257
-
258
+ # TODO: remove v1 "signature_version" access once v1 is retired
258
259
  signature_version = (
259
- topic_attributes.get("signature_version", "1") if topic_attributes else "1"
260
+ topic_attributes.get("signature_version", topic_attributes.get("SignatureVersion", "1"))
261
+ if topic_attributes
262
+ else "1"
260
263
  )
261
264
  canonical_string = compute_canonical_string(event_payload, message_context.type)
262
265
  signature = get_message_signature(canonical_string, signature_version=signature_version)
@@ -558,7 +561,10 @@ class HttpTopicPublisher(TopicPublisher):
558
561
  ):
559
562
  return sub_content_type
560
563
 
561
- if json_topic_delivery_policy := topic_attributes.get("delivery_policy"):
564
+ # TODO: remove lower case access once legacy v1 provider is removed
565
+ if json_topic_delivery_policy := topic_attributes.get(
566
+ "delivery_policy", topic_attributes.get("DeliveryPolicy")
567
+ ):
562
568
  topic_delivery_policy = json.loads(json_topic_delivery_policy)
563
569
  if not (
564
570
  topic_content_type := topic_delivery_policy.get(subscriber["Protocol"].lower())
@@ -1009,7 +1015,10 @@ def create_sns_message_body(
1009
1015
  # FIFO topics do not add the signature in the message
1010
1016
  if not subscriber.get("TopicArn", "").endswith(".fifo"):
1011
1017
  signature_version = (
1012
- topic_attributes.get("signature_version", "1") if topic_attributes else "1"
1018
+ # we allow for both casings, depending on v1 or v2 provider
1019
+ topic_attributes.get("signature_version", topic_attributes.get("SignatureVersion", "1"))
1020
+ if topic_attributes
1021
+ else "1"
1013
1022
  )
1014
1023
  canonical_string = compute_canonical_string(data, message_type)
1015
1024
  signature = get_message_signature(canonical_string, signature_version=signature_version)
@@ -1234,7 +1243,7 @@ class PublishDispatcher:
1234
1243
  )
1235
1244
 
1236
1245
  def publish_to_topic(self, ctx: SnsPublishContext, topic_arn: str) -> None:
1237
- subscriptions = ctx.store.get_topic_subscriptions(topic_arn)
1246
+ subscriptions = get_topic_subscriptions(ctx.store, topic_arn)
1238
1247
  for subscriber in subscriptions:
1239
1248
  if self._should_publish(ctx.store.subscription_filter_policy, ctx.message, subscriber):
1240
1249
  notifier = self.topic_notifiers[subscriber["Protocol"]]
@@ -1249,7 +1258,7 @@ class PublishDispatcher:
1249
1258
  self._submit_notification(notifier, ctx, subscriber)
1250
1259
 
1251
1260
  def publish_batch_to_topic(self, ctx: SnsBatchPublishContext, topic_arn: str) -> None:
1252
- subscriptions = ctx.store.get_topic_subscriptions(topic_arn)
1261
+ subscriptions = get_topic_subscriptions(ctx.store, topic_arn)
1253
1262
  for subscriber in subscriptions:
1254
1263
  protocol = subscriber["Protocol"]
1255
1264
  notifier = self.batch_topic_notifiers.get(protocol)
@@ -181,9 +181,15 @@ class SnsStore(BaseStore):
181
181
  # maps endpoint arns to platform endpoints
182
182
  platform_endpoints: dict[str, PlatformEndpoint] = LocalAttribute(default=dict)
183
183
 
184
+ # cache of topic ARN to platform endpoint messages (used primarily for testing)
185
+ platform_endpoint_messages: dict[str, list[dict]] = LocalAttribute(default=dict)
186
+
184
187
  # topic/subscription independent default values for sending sms messages
185
188
  sms_attributes: dict[str, str] = LocalAttribute(default=dict)
186
189
 
190
+ # list of sent SMS messages
191
+ sms_messages: list[dict] = LocalAttribute(default=list)
192
+
187
193
  TAGS: TaggingService = CrossRegionAttribute(default=TaggingService)
188
194
 
189
195