Skip to content

Commit

Permalink
Merge pull request #3639 from aws/release-v1.91.0
Browse files Browse the repository at this point in the history
Release 1.91.0 (to main)
  • Loading branch information
aaythapa authored Aug 19, 2024
2 parents 690bfff + ed46c9e commit 0388e20
Show file tree
Hide file tree
Showing 20 changed files with 571 additions and 119 deletions.
1 change: 1 addition & 0 deletions .cfnlintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ ignore_templates:
- tests/translator/output/**/managed_policies_minimal.json # Intentionally has non-existent managed policy name
- tests/translator/output/**/function_with_mq.json # Property "EventSourceArn" can Fn::GetAtt to a resource of types [AWS::DynamoDB::GlobalTable, AWS::DynamoDB::Table, AWS::Kinesis::Stream, AWS::Kinesis::StreamConsumer, AWS::SQS::Queue]
- tests/translator/output/**/function_with_mq_using_autogen_role.json # Property "EventSourceArn" can Fn::GetAtt to a resource of types [AWS::DynamoDB::GlobalTable, AWS::DynamoDB::Table, AWS::Kinesis::Stream, AWS::Kinesis::StreamConsumer, AWS::SQS::Queue]
- tests/translator/output/**/function_with_recursive_loop.json # Invalid Property Resources/RecursiveLoopParameterFunction/Properties/RecursiveLoop
- tests/translator/output/**/function_with_tracing.json # Obsolete DependsOn on resource
- tests/translator/output/**/api_with_propagate_tags.json # TODO: Intentional error transform tests. Will be updated.
- tests/translator/output/**/function_with_intrinsics_resource_attribute.json # CFN now supports intrinsics in DeletionPolicy
Expand Down
7 changes: 7 additions & 0 deletions integration/helpers/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,13 @@ def verify_options_request(self, url, expected_status_code, headers=None):
)
return response

@retry(
stop=stop_after_attempt(5),
wait=wait_exponential(multiplier=1, min=16, max=64) + wait_random(0, 1),
retry=retry_if_exception_type(StatusCodeError),
after=after_log(LOG, logging.WARNING),
reraise=True,
)
def verify_post_request(self, url: str, body_obj, expected_status_code: int, headers=None):
"""Return response to POST request and verify matches expected status code."""
response = self.do_post_request_with_logging(url, body_obj, headers)
Expand Down
7 changes: 7 additions & 0 deletions integration/single/test_basic_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import time
from unittest.case import skipIf

from tenacity import after_log, retry_if_exception_type, stop_after_attempt, wait_exponential, wait_random
Expand Down Expand Up @@ -129,8 +130,14 @@ def test_state_machine_with_api_single_quotes_input(self):
api_endpoint = stack_output.get("ApiEndpoint")

input_json = {"f'oo": {"hello": "'wor'l'd'''"}}

# This will be the wait time before triggering the APIGW request
time.sleep(10)

response = self.verify_post_request(api_endpoint, input_json, 200)

LOG.log(msg=f"retry times {self.verify_get_request_response.retry.statistics}", level=logging.WARNING)

execution_arn = response.json()["executionArn"]
execution = self.client_provider.sfn_client.describe_execution(executionArn=execution_arn)
execution_input = json.loads(execution["input"])
Expand Down
2 changes: 1 addition & 1 deletion samtranslator/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.90.0"
__version__ = "1.91.0"
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ class ScheduleV2Event(BaseModel):
SnapStart = Optional[PassThroughProp] # TODO: check the type
RuntimeManagementConfig = Optional[PassThroughProp] # TODO: check the type
LoggingConfig = Optional[PassThroughProp] # TODO: add documentation
RecursiveLoop = Optional[PassThroughProp]


class Properties(BaseModel):
Expand Down Expand Up @@ -638,6 +639,7 @@ class Properties(BaseModel):
VersionDescription: Optional[PassThroughProp] = prop("VersionDescription")
VpcConfig: Optional[VpcConfig] = prop("VpcConfig")
LoggingConfig: Optional[PassThroughProp] # TODO: add documentation
RecursiveLoop: Optional[PassThroughProp] # TODO: add documentation


class Globals(BaseModel):
Expand Down Expand Up @@ -696,6 +698,7 @@ class Globals(BaseModel):
SnapStart: Optional[SnapStart] = prop("SnapStart")
RuntimeManagementConfig: Optional[RuntimeManagementConfig] = prop("RuntimeManagementConfig")
LoggingConfig: Optional[PassThroughProp] # TODO: add documentation
RecursiveLoop: Optional[PassThroughProp] # TODO: add documentation


class Resource(ResourceAttributes):
Expand Down
2 changes: 2 additions & 0 deletions samtranslator/model/lambda_.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class LambdaFunction(Resource):
"EphemeralStorage": GeneratedProperty(),
"RuntimeManagementConfig": GeneratedProperty(),
"LoggingConfig": GeneratedProperty(),
"RecursiveLoop": GeneratedProperty(),
}

Code: Dict[str, Any]
Expand Down Expand Up @@ -62,6 +63,7 @@ class LambdaFunction(Resource):
EphemeralStorage: Optional[Dict[str, Any]]
RuntimeManagementConfig: Optional[Dict[str, Any]]
LoggingConfig: Optional[Dict[str, Any]]
RecursiveLoop: Optional[str]

runtime_attrs = {"name": lambda self: ref(self.logical_id), "arn": lambda self: fnGetAtt(self.logical_id, "Arn")}

Expand Down
3 changes: 3 additions & 0 deletions samtranslator/model/sam_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class SamFunction(SamResourceMacro):
"FunctionUrlConfig": PropertyType(False, IS_DICT),
"RuntimeManagementConfig": PassThroughProperty(False),
"LoggingConfig": PassThroughProperty(False),
"RecursiveLoop": PassThroughProperty(False),
}

FunctionName: Optional[Intrinsicable[str]]
Expand Down Expand Up @@ -221,6 +222,7 @@ class SamFunction(SamResourceMacro):
SnapStart: Optional[Dict[str, Any]]
FunctionUrlConfig: Optional[Dict[str, Any]]
LoggingConfig: Optional[Dict[str, Any]]
RecursiveLoop: Optional[str]

event_resolver = ResourceTypeResolver(
samtranslator.model.eventsources,
Expand Down Expand Up @@ -605,6 +607,7 @@ def _construct_lambda_function(self, intrinsics_resolver: IntrinsicsResolver) ->

lambda_function.RuntimeManagementConfig = self.RuntimeManagementConfig # type: ignore[attr-defined]
lambda_function.LoggingConfig = self.LoggingConfig
lambda_function.RecursiveLoop = self.RecursiveLoop
self._validate_package_type(lambda_function)
return lambda_function

Expand Down
3 changes: 2 additions & 1 deletion samtranslator/plugins/globals/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Globals:
"FunctionUrlConfig",
"RuntimeManagementConfig",
"LoggingConfig",
"RecursiveLoop",
],
# Everything except
# DefinitionBody: because its hard to reason about merge of Swagger dictionaries
Expand Down Expand Up @@ -98,7 +99,7 @@ class Globals:
}
# unreleased_properties *must be* part of supported_properties too
unreleased_properties: Dict[str, List[str]] = {
SamResourceType.Function.value: ["RuntimeManagementConfig"],
SamResourceType.Function.value: ["RuntimeManagementConfig", "RecursiveLoop"],
}

def __init__(self, template: Dict[str, Any]) -> None:
Expand Down
Loading

0 comments on commit 0388e20

Please sign in to comment.