-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: add support for IpAddressType #3840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
integration/resources/expected/single/api_with_domain_ipaddresstype.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| [ | ||
| { | ||
| "LogicalResourceId": "MyApi", | ||
| "ResourceType": "AWS::ApiGateway::RestApi" | ||
| }, | ||
| { | ||
| "LogicalResourceId": "MyApiDeployment", | ||
| "ResourceType": "AWS::ApiGateway::Deployment" | ||
| }, | ||
| { | ||
| "LogicalResourceId": "MyApiProdStage", | ||
| "ResourceType": "AWS::ApiGateway::Stage" | ||
| }, | ||
| { | ||
| "LogicalResourceId": "ApiGatewayDomainName", | ||
| "ResourceType": "AWS::ApiGateway::DomainName" | ||
| }, | ||
| { | ||
| "LogicalResourceId": "MyApiBasePathMapping", | ||
| "ResourceType": "AWS::ApiGateway::BasePathMapping" | ||
| } | ||
| ] |
14 changes: 14 additions & 0 deletions
14
integration/resources/expected/single/api_with_ipaddresstype.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [ | ||
| { | ||
| "LogicalResourceId": "MyApi", | ||
| "ResourceType": "AWS::ApiGateway::RestApi" | ||
| }, | ||
| { | ||
| "LogicalResourceId": "MyApiDeployment", | ||
| "ResourceType": "AWS::ApiGateway::Deployment" | ||
| }, | ||
| { | ||
| "LogicalResourceId": "MyApiProdStage", | ||
| "ResourceType": "AWS::ApiGateway::Stage" | ||
| } | ||
| ] |
23 changes: 23 additions & 0 deletions
23
integration/resources/templates/single/api_with_domain_ipaddresstype.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| Parameters: | ||
| IpAddressType: | ||
| Type: String | ||
| Default: dualstack | ||
| DomainName: | ||
| Type: String | ||
| CertificateArn: | ||
| Type: String | ||
|
|
||
| Resources: | ||
| MyApi: | ||
| Type: AWS::Serverless::Api | ||
| Properties: | ||
| StageName: Prod | ||
| DefinitionUri: ${definitionuri} | ||
| Domain: | ||
| DomainName: !Ref DomainName | ||
| CertificateArn: !Ref CertificateArn | ||
| EndpointConfiguration: REGIONAL | ||
| IpAddressType: !Ref IpAddressType | ||
|
|
||
| Metadata: | ||
| SamTransformTest: true | ||
16 changes: 16 additions & 0 deletions
16
integration/resources/templates/single/api_with_ipaddresstype.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Parameters: | ||
| IpAddressType: | ||
| Type: String | ||
| Default: ipv4 | ||
|
|
||
| Resources: | ||
| MyApi: | ||
| Type: AWS::Serverless::Api | ||
| Properties: | ||
| StageName: Prod | ||
| DefinitionUri: ${definitionuri} | ||
| EndpointConfiguration: | ||
| Type: REGIONAL | ||
| IpAddressType: !Ref IpAddressType | ||
| Metadata: | ||
| SamTransformTest: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| from unittest.case import skipIf | ||
|
|
||
| from integration.config.service_names import CUSTOM_DOMAIN | ||
| from integration.helpers.base_internal_test import BaseInternalTest | ||
| from integration.helpers.base_test import nonblocking | ||
| from integration.helpers.resource import current_region_not_included | ||
|
|
||
|
|
||
| @skipIf( | ||
| current_region_not_included([CUSTOM_DOMAIN]), | ||
| "Custom domain is not supported in this testing region", | ||
| ) | ||
| @nonblocking | ||
| class TestApiWithDomainIpAddressType(BaseInternalTest): | ||
valerena marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
| Test AWS::Serverless::Api with IpAddressType in Domain configuration | ||
| """ | ||
|
|
||
| def test_api_with_domain_ipaddresstype(self): | ||
| """ | ||
| Creates an API with custom domain and IpAddressType set to dualstack | ||
| """ | ||
| self.create_and_verify_stack("single/api_with_domain_ipaddresstype") | ||
|
|
||
| # Verify the domain name resource | ||
| domain_name_id = self.get_physical_id_by_type("AWS::ApiGateway::DomainName") | ||
| api_gateway_client = self.client_provider.api_client | ||
| result = api_gateway_client.get_domain_name(domainName=domain_name_id) | ||
|
|
||
| # Verify endpoint configuration | ||
| end_point_config = result["endpointConfiguration"] | ||
| end_point_types = end_point_config["types"] | ||
| self.assertEqual(1, len(end_point_types)) | ||
| self.assertEqual("REGIONAL", end_point_types[0]) | ||
|
|
||
| # Verify IpAddressType is set correctly | ||
| self.assertEqual("dualstack", end_point_config["ipAddressType"]) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from unittest.case import skipIf | ||
|
|
||
| from integration.config.service_names import REST_API | ||
| from integration.helpers.base_test import BaseTest | ||
| from integration.helpers.resource import current_region_does_not_support | ||
|
|
||
|
|
||
| @skipIf(current_region_does_not_support([REST_API]), "Rest API is not supported in this testing region") | ||
| class TestApiWithIpAddressType(BaseTest): | ||
| """ | ||
| Test AWS::Serverless::Api with IpAddressType in EndpointConfiguration | ||
| """ | ||
|
|
||
| def test_api_with_ipaddresstype(self): | ||
| """ | ||
| Creates an API with IpAddressType set to ipv4 | ||
| """ | ||
| parameters = [{"ParameterKey": "IpAddressType", "ParameterValue": "ipv4"}] | ||
| self.create_and_verify_stack("single/api_with_ipaddresstype", parameters) | ||
|
|
||
| rest_api_id = self.get_physical_id_by_type("AWS::ApiGateway::RestApi") | ||
| rest_api = self.client_provider.api_client.get_rest_api(restApiId=rest_api_id) | ||
|
|
||
| self.assertEqual(rest_api["endpointConfiguration"]["types"], ["REGIONAL"]) | ||
| self.assertEqual(rest_api["endpointConfiguration"]["ipAddressType"], "ipv4") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.