Skip to content

Commit e7ab742

Browse files
aaythapagithub-actions[bot]github-actionsdependabot[bot]jfuss
authoredMay 6, 2024
Release 1.88.0 (to main) (#3588)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com> Co-authored-by: Xia Zhao <xazhao@amazon.com> Co-authored-by: aws-sam-cli-bot <46753707+aws-sam-cli-bot@users.noreply.github.com>
1 parent 8fb8f6c commit e7ab742

32 files changed

+10965
-1562
lines changed
 

‎bin/_file_formatter.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Formatter base class for JSONFormatter and YamlFormatter."""
2+
23
import argparse
34
import os
45
import sys

‎bin/public_interface.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,15 @@ def _print(signature: Dict[str, inspect.Signature], variables: Set[str]) -> None
101101
result: Dict[str, Any] = {"routines": {}, "variables": sorted(variables)}
102102
for key, value in signature.items():
103103
result["routines"][key] = [
104-
{
105-
"name": parameter.name,
106-
"kind": parameter.kind.name,
107-
"default": parameter.default,
108-
}
109-
if parameter.default != inspect.Parameter.empty
110-
else {"name": parameter.name, "kind": parameter.kind.name}
104+
(
105+
{
106+
"name": parameter.name,
107+
"kind": parameter.kind.name,
108+
"default": parameter.default,
109+
}
110+
if parameter.default != inspect.Parameter.empty
111+
else {"name": parameter.name, "kind": parameter.kind.name}
112+
)
111113
for parameter in value.parameters.values()
112114
]
113115
print(json.dumps(result, indent=2, sort_keys=True))

‎integration/combination/test_function_with_all_event_types.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from unittest.case import skipIf
22

3-
from integration.config.service_names import IOT, SCHEDULE_EVENT
3+
from integration.config.service_names import IOT, LOGS, SCHEDULE_EVENT
44
from integration.helpers.base_test import BaseTest
55
from integration.helpers.resource import current_region_does_not_support, generate_suffix
66

77

88
@skipIf(
9-
current_region_does_not_support([IOT, SCHEDULE_EVENT]),
10-
"IoT, ScheduleEvent is not supported in this testing region",
9+
current_region_does_not_support([IOT, SCHEDULE_EVENT, LOGS]),
10+
"IoT, ScheduleEvent or a Logs resource is not supported in this testing region",
1111
)
1212
class TestFunctionWithAllEventTypes(BaseTest):
1313
def test_function_with_all_event_types(self):

‎integration/combination/test_function_with_cloudwatch_log.py

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
from unittest.case import skipIf
2+
3+
from integration.config.service_names import LOGS
14
from integration.helpers.base_test import BaseTest
5+
from integration.helpers.resource import current_region_does_not_support
26

37

8+
@skipIf(
9+
current_region_does_not_support([LOGS]),
10+
"A Logs resource that is a part of this test is not supported in this testing region",
11+
)
412
class TestFunctionWithCloudWatchLog(BaseTest):
513
def test_function_with_cloudwatch_log(self):
614
self.create_and_verify_stack("combination/function_with_cloudwatch_log")

‎integration/config/service_names.py

+1
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@
3535
API_KEY = "ApiKey"
3636
APP_SYNC = "AppSync"
3737
SNS_FILTER_POLICY_SCOPE = "SnsFilterPolicyScope"
38+
LOGS = "Logs"

‎integration/helpers/deployer/deployer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ def describe_changeset(self, change_set_id, stack_name, **kwargs):
208208
{
209209
"LogicalResourceId": resource_props.get("LogicalResourceId"),
210210
"ResourceType": resource_props.get("ResourceType"),
211-
"Replacement": "N/A"
212-
if resource_props.get("Replacement") is None
213-
else resource_props.get("Replacement"),
211+
"Replacement": (
212+
"N/A" if resource_props.get("Replacement") is None else resource_props.get("Replacement")
213+
),
214214
}
215215
)
216216

‎integration/helpers/deployer/utils/colors.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Wrapper to generated colored messages for printing in Terminal
33
This was ported over from the sam-cli repo
44
"""
5+
56
from typing import Dict, Literal
67

78
SupportedColor = Literal["red", "green", "yellow"]

‎integration/helpers/deployer/utils/retry.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Retry decorator to retry decorated function based on Exception with exponential backoff and number of attempts built-in.
33
"""
4+
45
import math
56
import random
67
import time

‎integration/helpers/deployer/utils/table_print.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Utilities for table pretty printing
33
This was ported over from the sam-cli repo
44
"""
5+
56
import shutil
67
import textwrap
78
from functools import wraps

‎integration/helpers/s3_uploader.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Client for uploading files to s3
33
"""
4+
45
import logging
56
from typing import Any
67

‎requirements/dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tenacity~=8.0
1919
requests~=2.28
2020

2121
# formatter
22-
black==23.10.1
22+
black==24.3.0
2323
ruamel.yaml==0.17.21 # It can parse yaml while perserving comments
2424

2525
# type check

‎samtranslator/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.87.0"
1+
__version__ = "1.88.0"

‎samtranslator/internal/deprecation_control.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
If external packages import deprecated interfaces,
1010
it is their responsibility to detect and remove them.
1111
"""
12+
1213
import warnings
1314
from functools import wraps
1415
from typing import Callable, Optional, TypeVar

‎samtranslator/metrics/method_decorator.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Method decorator for execution latency collection
33
"""
4+
45
import functools
56
import logging
67
from datetime import datetime
@@ -84,13 +85,13 @@ def _send_cw_metric(prefix, name, execution_time_ms, func, args): # type: ignor
8485
@overload
8586
def cw_timer(
8687
*, name: Optional[str] = None, prefix: Optional[str] = None
87-
) -> Callable[[Callable[_PT, _RT]], Callable[_PT, _RT]]:
88-
...
88+
) -> Callable[[Callable[_PT, _RT]], Callable[_PT, _RT]]: ...
8989

9090

9191
@overload
92-
def cw_timer(_func: Callable[_PT, _RT], name: Optional[str] = None, prefix: Optional[str] = None) -> Callable[_PT, _RT]:
93-
...
92+
def cw_timer(
93+
_func: Callable[_PT, _RT], name: Optional[str] = None, prefix: Optional[str] = None
94+
) -> Callable[_PT, _RT]: ...
9495

9596

9697
def cw_timer(

‎samtranslator/model/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
""" CloudFormation Resource serialization, deserialization, and validation """
2+
23
import inspect
34
import re
45
from abc import ABC, ABCMeta, abstractmethod

‎samtranslator/model/api/http_api_generator.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -777,9 +777,7 @@ def _add_title(self) -> None:
777777
self.definition_body = open_api_editor.openapi
778778

779779
@cw_timer(prefix="Generator", name="HttpApi")
780-
def to_cloudformation(
781-
self, route53_record_set_groups: Dict[str, Route53RecordSetGroup]
782-
) -> Tuple[
780+
def to_cloudformation(self, route53_record_set_groups: Dict[str, Route53RecordSetGroup]) -> Tuple[
783781
ApiGatewayV2HttpApi,
784782
Optional[ApiGatewayV2Stage],
785783
Optional[ApiGatewayV2DomainName],

‎samtranslator/model/apigatewayv2.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ def __init__( # type: ignore[no-untyped-def] # noqa: PLR0913
129129
self.api_logical_id = api_logical_id
130130
self.name = name
131131
self.authorization_scopes = authorization_scopes
132-
self.jwt_configuration: Optional[JwtConfiguration] = self._get_jwt_configuration(jwt_configuration)
132+
self.jwt_configuration: Optional[JwtConfiguration] = self._get_jwt_configuration(
133+
jwt_configuration, api_logical_id
134+
)
133135
self.id_source = id_source
134136
self.function_arn = function_arn
135137
self.function_invoke_role = function_invoke_role
@@ -344,7 +346,9 @@ def _get_identity_source(self, auth_identity: Dict[str, Any]) -> List[str]:
344346
return identity_source
345347

346348
@staticmethod
347-
def _get_jwt_configuration(props: Optional[Dict[str, Union[str, List[str]]]]) -> Optional[JwtConfiguration]:
349+
def _get_jwt_configuration(
350+
props: Optional[Dict[str, Union[str, List[str]]]], api_logical_id: str
351+
) -> Optional[JwtConfiguration]:
348352
"""Make sure that JWT configuration dict keys are lower case.
349353
350354
ApiGatewayV2Authorizer doesn't create `AWS::ApiGatewayV2::Authorizer` but generates
@@ -359,13 +363,14 @@ def _get_jwt_configuration(props: Optional[Dict[str, Union[str, List[str]]]]) ->
359363
360364
Parameters
361365
----------
362-
props
363-
jwt configuration dict with the keys either lower case or capitalized
366+
props: jwt configuration dict with the keys either lower case or capitalized
367+
api_logical_id: logical id of the Serverless Api resource with the jwt configuration
364368
365369
Returns
366370
-------
367371
jwt configuration dict with low case keys
368372
"""
369373
if not props:
370374
return None
375+
sam_expect(props, api_logical_id, "JwtConfiguration").to_be_a_map()
371376
return {k.lower(): v for k, v in props.items()}

‎samtranslator/model/architecture.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""
22
Enum for determining type of architectures for Lambda Function.
33
"""
4+
45
ARM64 = "arm64"
56
X86_64 = "x86_64"

‎samtranslator/model/sam_resources.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
""" SAM macro definitions """
2+
23
import copy
34
from contextlib import suppress
45
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union, cast

‎samtranslator/model/types.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
the Permissions property is an ARN or list of ARNs. In this situation, we validate that the Permissions property is
99
either a string or a list of strings, but do not validate whether the string(s) are valid IAM policy ARNs.
1010
"""
11+
1112
from typing import Any, Callable, Type, Union
1213

1314
import samtranslator.model.exceptions

‎samtranslator/open_api/base_editor.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Base class for OpenApiEditor and SwaggerEditor."""
2+
23
import re
34
from typing import Any, Dict, Iterator, List, Optional, Union
45

0 commit comments

Comments
 (0)
Failed to load comments.