From 1852cffafb1b3eca6ce71f44d942918991de7a43 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 May 2022 13:06:22 +0000 Subject: [PATCH 1/5] Update pip requirement from <22.1,>=9 to >=9,<22.2 Updates the requirements on [pip](https://github.com/pypa/pip) to permit the latest version. - [Release notes](https://github.com/pypa/pip/releases) - [Changelog](https://github.com/pypa/pip/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/pip/compare/9.0.0...22.1) --- updated-dependencies: - dependency-name: pip dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8cd3f48a8..825da09fe 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ def recursive_include(relative_dir): 'typing==3.6.4;python_version<"3.7"', 'mypy-extensions==0.4.3', 'six>=1.10.0,<2.0.0', - 'pip>=9,<22.1', + 'pip>=9,<22.2', 'attrs>=19.3.0,<21.5.0', 'jmespath>=0.9.3,<2.0.0', 'pyyaml>=5.3.1,<7.0.0', From 1a15e031b9273eeb518d098c90b9b47279864474 Mon Sep 17 00:00:00 2001 From: James Saryerwinnie Date: Tue, 17 May 2022 13:27:41 -0400 Subject: [PATCH 2/5] Add changelog entry for pip version bump --- .changes/next-release/35786244445-enhancement-Pip-39203.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/next-release/35786244445-enhancement-Pip-39203.json diff --git a/.changes/next-release/35786244445-enhancement-Pip-39203.json b/.changes/next-release/35786244445-enhancement-Pip-39203.json new file mode 100644 index 000000000..32a6e9def --- /dev/null +++ b/.changes/next-release/35786244445-enhancement-Pip-39203.json @@ -0,0 +1,5 @@ +{ + "type": "enhancement", + "category": "Pip", + "description": "Bump pip version range to latest version <22.2 (#1924)" +} From 5e55f3cbfa8027be3f822d8c5f586210d3f7731c Mon Sep 17 00:00:00 2001 From: James Saryerwinnie Date: Tue, 17 May 2022 15:00:27 -0400 Subject: [PATCH 3/5] Use function name as output for handler names Matches parity with the outputs of SAM template outputs for websocket APIs. --- chalice/package.py | 10 +++++++--- tests/unit/test_package.py | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/chalice/package.py b/chalice/package.py index b8ed67741..5089b2c7f 100644 --- a/chalice/package.py +++ b/chalice/package.py @@ -970,17 +970,21 @@ def _inject_websocketapi_outputs(self, websocket_api_id, template): output['WebsocketConnectHandlerArn'] = { "value": "${aws_lambda_function.websocket_connect.arn}"} output['WebsocketConnectHandlerName'] = { - "value": "${aws_lambda_function.websocket_connect}"} + "value": ( + "${aws_lambda_function.websocket_connect.function_name}")} if 'websocket_message' in aws_lambda_functions: output['WebsocketMessageHandlerArn'] = { "value": "${aws_lambda_function.websocket_message.arn}"} output['WebsocketMessageHandlerName'] = { - "value": "${aws_lambda_function.websocket_message}"} + "value": ( + "${aws_lambda_function.websocket_message.function_name}")} if 'websocket_disconnect' in aws_lambda_functions: output['WebsocketDisconnectHandlerArn'] = { "value": "${aws_lambda_function.websocket_disconnect.arn}"} output['WebsocketDisconnectHandlerName'] = { - "value": "${aws_lambda_function.websocket_disconnect}"} + "value": ( + "${aws_lambda_function.websocket_disconnect" + ".function_name}")} output['WebsocketConnectEndpointURL'] = { "value": ( diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py index 42a0d1fea..73b331b6f 100644 --- a/tests/unit/test_package.py +++ b/tests/unit/test_package.py @@ -816,19 +816,23 @@ def test_can_generate_websockets_api(self, sample_websocket_app): 'value': '${aws_lambda_function.websocket_connect.arn}' }, 'WebsocketConnectHandlerName': { - 'value': '${aws_lambda_function.websocket_connect}' + 'value': ( + '${aws_lambda_function.websocket_connect.function_name}') }, 'WebsocketMessageHandlerArn': { 'value': '${aws_lambda_function.websocket_message.arn}' }, 'WebsocketMessageHandlerName': { - 'value': '${aws_lambda_function.websocket_message}' + 'value': ( + '${aws_lambda_function.websocket_message.function_name}') }, 'WebsocketDisconnectHandlerArn': { 'value': '${aws_lambda_function.websocket_disconnect.arn}' }, 'WebsocketDisconnectHandlerName': { - 'value': '${aws_lambda_function.websocket_disconnect}' + 'value': ( + '${aws_lambda_function.websocket_disconnect' + '.function_name}') }, 'WebsocketConnectEndpointURL': { 'value': 'wss://${aws_apigatewayv2_api.websocket_api.id}' From 727d1358b691b0115b86c138a9382ffa7fa8354f Mon Sep 17 00:00:00 2001 From: James Saryerwinnie Date: Tue, 17 May 2022 14:48:02 -0400 Subject: [PATCH 4/5] Revert formating changes AFAICT, prcheck passes without these changes. --- chalice/package.py | 15 ++++++------- tests/unit/test_package.py | 44 +++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/chalice/package.py b/chalice/package.py index 5089b2c7f..8bc358c87 100644 --- a/chalice/package.py +++ b/chalice/package.py @@ -101,8 +101,8 @@ def service_principal(self, service): class ResourceBuilder(object): def __init__(self, application_builder, # type: ApplicationGraphBuilder - deps_builder, # type: DependencyBuilder - build_stage, # type: BuildStage + deps_builder, # type: DependencyBuilder + build_stage, # type: BuildStage ): # type: (...) -> None self._application_builder = application_builder @@ -1209,10 +1209,10 @@ def _generate_lambdalayer(self, resource, template): # type: (models.LambdaLayer, Dict[str, Any]) -> None template['resource'].setdefault( "aws_lambda_layer_version", {})[ - resource.resource_name] = { - 'layer_name': resource.layer_name, - 'compatible_runtimes': [resource.runtime], - 'filename': resource.deployment_package.filename, + resource.resource_name] = { + 'layer_name': resource.layer_name, + 'compatible_runtimes': [resource.runtime], + 'filename': resource.deployment_package.filename, } self._chalice_layer = resource.resource_name @@ -1341,8 +1341,7 @@ def _generate_restapi(self, resource, template): 'principal': self._options.service_principal('apigateway'), 'source_arn': ( "${aws_api_gateway_rest_api.%s.execution_arn}" % ( - resource.resource_name - ) + "/*" + resource.resource_name) + "/*" ) } self._add_domain_name(resource, template) diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py index 73b331b6f..5a87185a0 100644 --- a/tests/unit/test_package.py +++ b/tests/unit/test_package.py @@ -988,19 +988,19 @@ def test_can_generate_custom_domain_name(self, sample_app): ) template = self.generate_template(config) assert template['resource']['aws_api_gateway_domain_name'][ - 'api_gateway_custom_domain'] == { - 'domain_name': 'example.com', - 'certificate_arn': 'my_cert_arn', - 'security_policy': 'TLS_1_2', - 'endpoint_configuration': {'types': ['EDGE']}, - 'tags': {'foo': 'bar'}, - } + 'api_gateway_custom_domain'] == { + 'domain_name': 'example.com', + 'certificate_arn': 'my_cert_arn', + 'security_policy': 'TLS_1_2', + 'endpoint_configuration': {'types': ['EDGE']}, + 'tags': {'foo': 'bar'}, + } assert template['resource']['aws_api_gateway_base_path_mapping'][ - 'api_gateway_custom_domain_mapping'] == { - 'api_id': '${aws_api_gateway_rest_api.rest_api.id}', - 'stage_name': 'api', - 'domain_name': 'example.com', - } + 'api_gateway_custom_domain_mapping'] == { + 'api_id': '${aws_api_gateway_rest_api.rest_api.id}', + 'stage_name': 'api', + 'domain_name': 'example.com', + } outputs = template['output'] assert outputs['AliasDomainName']['value'] == ( '${aws_api_gateway_domain_name.api_gateway_custom_domain' @@ -1024,17 +1024,17 @@ def test_can_generate_domain_for_regional_endpoint(self, sample_app): ) template = self.generate_template(config) assert template['resource']['aws_api_gateway_domain_name'][ - 'api_gateway_custom_domain'] == { - 'domain_name': 'example.com', - 'regional_certificate_arn': 'my_cert_arn', - 'endpoint_configuration': {'types': ['REGIONAL']}, - } + 'api_gateway_custom_domain'] == { + 'domain_name': 'example.com', + 'regional_certificate_arn': 'my_cert_arn', + 'endpoint_configuration': {'types': ['REGIONAL']}, + } assert template['resource']['aws_api_gateway_base_path_mapping'][ - 'api_gateway_custom_domain_mapping'] == { - 'api_id': '${aws_api_gateway_rest_api.rest_api.id}', - 'stage_name': 'api', - 'domain_name': 'example.com', - } + 'api_gateway_custom_domain_mapping'] == { + 'api_id': '${aws_api_gateway_rest_api.rest_api.id}', + 'stage_name': 'api', + 'domain_name': 'example.com', + } outputs = template['output'] assert outputs['AliasDomainName']['value'] == ( '${aws_api_gateway_domain_name.api_gateway_custom_domain' From 896f1aacec9c16e6cedb8851f1127d5d10885346 Mon Sep 17 00:00:00 2001 From: James Saryerwinnie Date: Tue, 17 May 2022 14:50:54 -0400 Subject: [PATCH 5/5] Add changelog for tf websocket support --- .../35837336042-enhancement-Websockets-73475.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/next-release/35837336042-enhancement-Websockets-73475.json diff --git a/.changes/next-release/35837336042-enhancement-Websockets-73475.json b/.changes/next-release/35837336042-enhancement-Websockets-73475.json new file mode 100644 index 000000000..b3f87bdcb --- /dev/null +++ b/.changes/next-release/35837336042-enhancement-Websockets-73475.json @@ -0,0 +1,5 @@ +{ + "type": "enhancement", + "category": "Websockets", + "description": "Add support for WebSockets API Terraform packaging (#1670)" +}