Skip to content

Commit

Permalink
Release 1.88.0 (to main) (#3588)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jacob Fuss <[email protected]>
Co-authored-by: Xia Zhao <[email protected]>
Co-authored-by: aws-sam-cli-bot <[email protected]>
  • Loading branch information
7 people authored May 6, 2024
1 parent 8fb8f6c commit e7ab742
Show file tree
Hide file tree
Showing 32 changed files with 10,965 additions and 1,562 deletions.
1 change: 1 addition & 0 deletions bin/_file_formatter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Formatter base class for JSONFormatter and YamlFormatter."""

import argparse
import os
import sys
Expand Down
16 changes: 9 additions & 7 deletions bin/public_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ def _print(signature: Dict[str, inspect.Signature], variables: Set[str]) -> None
result: Dict[str, Any] = {"routines": {}, "variables": sorted(variables)}
for key, value in signature.items():
result["routines"][key] = [
{
"name": parameter.name,
"kind": parameter.kind.name,
"default": parameter.default,
}
if parameter.default != inspect.Parameter.empty
else {"name": parameter.name, "kind": parameter.kind.name}
(
{
"name": parameter.name,
"kind": parameter.kind.name,
"default": parameter.default,
}
if parameter.default != inspect.Parameter.empty
else {"name": parameter.name, "kind": parameter.kind.name}
)
for parameter in value.parameters.values()
]
print(json.dumps(result, indent=2, sort_keys=True))
Expand Down
6 changes: 3 additions & 3 deletions integration/combination/test_function_with_all_event_types.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from unittest.case import skipIf

from integration.config.service_names import IOT, SCHEDULE_EVENT
from integration.config.service_names import IOT, LOGS, SCHEDULE_EVENT
from integration.helpers.base_test import BaseTest
from integration.helpers.resource import current_region_does_not_support, generate_suffix


@skipIf(
current_region_does_not_support([IOT, SCHEDULE_EVENT]),
"IoT, ScheduleEvent is not supported in this testing region",
current_region_does_not_support([IOT, SCHEDULE_EVENT, LOGS]),
"IoT, ScheduleEvent or a Logs resource is not supported in this testing region",
)
class TestFunctionWithAllEventTypes(BaseTest):
def test_function_with_all_event_types(self):
Expand Down
8 changes: 8 additions & 0 deletions integration/combination/test_function_with_cloudwatch_log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
from unittest.case import skipIf

from integration.config.service_names import LOGS
from integration.helpers.base_test import BaseTest
from integration.helpers.resource import current_region_does_not_support


@skipIf(
current_region_does_not_support([LOGS]),
"A Logs resource that is a part of this test is not supported in this testing region",
)
class TestFunctionWithCloudWatchLog(BaseTest):
def test_function_with_cloudwatch_log(self):
self.create_and_verify_stack("combination/function_with_cloudwatch_log")
Expand Down
1 change: 1 addition & 0 deletions integration/config/service_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
API_KEY = "ApiKey"
APP_SYNC = "AppSync"
SNS_FILTER_POLICY_SCOPE = "SnsFilterPolicyScope"
LOGS = "Logs"
6 changes: 3 additions & 3 deletions integration/helpers/deployer/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ def describe_changeset(self, change_set_id, stack_name, **kwargs):
{
"LogicalResourceId": resource_props.get("LogicalResourceId"),
"ResourceType": resource_props.get("ResourceType"),
"Replacement": "N/A"
if resource_props.get("Replacement") is None
else resource_props.get("Replacement"),
"Replacement": (
"N/A" if resource_props.get("Replacement") is None else resource_props.get("Replacement")
),
}
)

Expand Down
1 change: 1 addition & 0 deletions integration/helpers/deployer/utils/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Wrapper to generated colored messages for printing in Terminal
This was ported over from the sam-cli repo
"""

from typing import Dict, Literal

SupportedColor = Literal["red", "green", "yellow"]
Expand Down
1 change: 1 addition & 0 deletions integration/helpers/deployer/utils/retry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Retry decorator to retry decorated function based on Exception with exponential backoff and number of attempts built-in.
"""

import math
import random
import time
Expand Down
1 change: 1 addition & 0 deletions integration/helpers/deployer/utils/table_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Utilities for table pretty printing
This was ported over from the sam-cli repo
"""

import shutil
import textwrap
from functools import wraps
Expand Down
1 change: 1 addition & 0 deletions integration/helpers/s3_uploader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Client for uploading files to s3
"""

import logging
from typing import Any

Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tenacity~=8.0
requests~=2.28

# formatter
black==23.10.1
black==24.3.0
ruamel.yaml==0.17.21 # It can parse yaml while perserving comments

# type check
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.87.0"
__version__ = "1.88.0"
1 change: 1 addition & 0 deletions samtranslator/internal/deprecation_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
If external packages import deprecated interfaces,
it is their responsibility to detect and remove them.
"""

import warnings
from functools import wraps
from typing import Callable, Optional, TypeVar
Expand Down
9 changes: 5 additions & 4 deletions samtranslator/metrics/method_decorator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Method decorator for execution latency collection
"""

import functools
import logging
from datetime import datetime
Expand Down Expand Up @@ -84,13 +85,13 @@ def _send_cw_metric(prefix, name, execution_time_ms, func, args): # type: ignor
@overload
def cw_timer(
*, name: Optional[str] = None, prefix: Optional[str] = None
) -> Callable[[Callable[_PT, _RT]], Callable[_PT, _RT]]:
...
) -> Callable[[Callable[_PT, _RT]], Callable[_PT, _RT]]: ...


@overload
def cw_timer(_func: Callable[_PT, _RT], name: Optional[str] = None, prefix: Optional[str] = None) -> Callable[_PT, _RT]:
...
def cw_timer(
_func: Callable[_PT, _RT], name: Optional[str] = None, prefix: Optional[str] = None
) -> Callable[_PT, _RT]: ...


def cw_timer(
Expand Down
1 change: 1 addition & 0 deletions samtranslator/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" CloudFormation Resource serialization, deserialization, and validation """

import inspect
import re
from abc import ABC, ABCMeta, abstractmethod
Expand Down
4 changes: 1 addition & 3 deletions samtranslator/model/api/http_api_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,7 @@ def _add_title(self) -> None:
self.definition_body = open_api_editor.openapi

@cw_timer(prefix="Generator", name="HttpApi")
def to_cloudformation(
self, route53_record_set_groups: Dict[str, Route53RecordSetGroup]
) -> Tuple[
def to_cloudformation(self, route53_record_set_groups: Dict[str, Route53RecordSetGroup]) -> Tuple[
ApiGatewayV2HttpApi,
Optional[ApiGatewayV2Stage],
Optional[ApiGatewayV2DomainName],
Expand Down
13 changes: 9 additions & 4 deletions samtranslator/model/apigatewayv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ def __init__( # type: ignore[no-untyped-def] # noqa: PLR0913
self.api_logical_id = api_logical_id
self.name = name
self.authorization_scopes = authorization_scopes
self.jwt_configuration: Optional[JwtConfiguration] = self._get_jwt_configuration(jwt_configuration)
self.jwt_configuration: Optional[JwtConfiguration] = self._get_jwt_configuration(
jwt_configuration, api_logical_id
)
self.id_source = id_source
self.function_arn = function_arn
self.function_invoke_role = function_invoke_role
Expand Down Expand Up @@ -344,7 +346,9 @@ def _get_identity_source(self, auth_identity: Dict[str, Any]) -> List[str]:
return identity_source

@staticmethod
def _get_jwt_configuration(props: Optional[Dict[str, Union[str, List[str]]]]) -> Optional[JwtConfiguration]:
def _get_jwt_configuration(
props: Optional[Dict[str, Union[str, List[str]]]], api_logical_id: str
) -> Optional[JwtConfiguration]:
"""Make sure that JWT configuration dict keys are lower case.
ApiGatewayV2Authorizer doesn't create `AWS::ApiGatewayV2::Authorizer` but generates
Expand All @@ -359,13 +363,14 @@ def _get_jwt_configuration(props: Optional[Dict[str, Union[str, List[str]]]]) ->
Parameters
----------
props
jwt configuration dict with the keys either lower case or capitalized
props: jwt configuration dict with the keys either lower case or capitalized
api_logical_id: logical id of the Serverless Api resource with the jwt configuration
Returns
-------
jwt configuration dict with low case keys
"""
if not props:
return None
sam_expect(props, api_logical_id, "JwtConfiguration").to_be_a_map()
return {k.lower(): v for k, v in props.items()}
1 change: 1 addition & 0 deletions samtranslator/model/architecture.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Enum for determining type of architectures for Lambda Function.
"""

ARM64 = "arm64"
X86_64 = "x86_64"
1 change: 1 addition & 0 deletions samtranslator/model/sam_resources.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" SAM macro definitions """

import copy
from contextlib import suppress
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union, cast
Expand Down
1 change: 1 addition & 0 deletions samtranslator/model/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
the Permissions property is an ARN or list of ARNs. In this situation, we validate that the Permissions property is
either a string or a list of strings, but do not validate whether the string(s) are valid IAM policy ARNs.
"""

from typing import Any, Callable, Type, Union

import samtranslator.model.exceptions
Expand Down
1 change: 1 addition & 0 deletions samtranslator/open_api/base_editor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for OpenApiEditor and SwaggerEditor."""

import re
from typing import Any, Dict, Iterator, List, Optional, Union

Expand Down
Loading

0 comments on commit e7ab742

Please sign in to comment.