diff --git a/moto/apigateway/models.py b/moto/apigateway/models.py index e0fa232d5b89..93fd225f6385 100644 --- a/moto/apigateway/models.py +++ b/moto/apigateway/models.py @@ -161,6 +161,7 @@ def __init__( request_parameters: Optional[Dict[str, Any]] = None, content_handling: Optional[str] = None, credentials: Optional[str] = None, + connection_type: Optional[str] = None, ): self.integration_type = integration_type self.uri = uri @@ -174,6 +175,7 @@ def __init__( self.request_parameters = request_parameters self.content_handling = content_handling self.credentials = credentials + self.connection_type = connection_type self.integration_responses: Optional[Dict[str, IntegrationResponse]] = None def to_json(self) -> Dict[str, Any]: @@ -196,6 +198,7 @@ def to_json(self) -> Dict[str, Any]: "requestParameters": self.request_parameters, "contentHandling": self.content_handling, "credentials": self.credentials, + "connectionType": self.connection_type, } def create_integration_response( @@ -502,6 +505,7 @@ def add_integration( request_parameters: Optional[Dict[str, Any]] = None, content_handling: Optional[str] = None, credentials: Optional[str] = None, + connection_type: Optional[str] = None, ) -> Integration: integration_method = integration_method or method_type integration = Integration( @@ -516,6 +520,7 @@ def add_integration( request_parameters=request_parameters, content_handling=content_handling, credentials=credentials, + connection_type=connection_type, ) self.resource_methods[method_type].method_integration = integration return integration @@ -1911,6 +1916,7 @@ def put_integration( timeout_in_millis: Optional[str] = None, request_parameters: Optional[Dict[str, Any]] = None, content_handling: Optional[str] = None, + connection_type: Optional[str] = None, ) -> Integration: resource = self.get_resource(function_id, resource_id) if credentials and not re.match( @@ -1955,6 +1961,7 @@ def put_integration( request_parameters=request_parameters, content_handling=content_handling, credentials=credentials, + connection_type=connection_type, ) return integration diff --git a/moto/apigateway/responses.py b/moto/apigateway/responses.py index 13b96d4f9a8c..86e04a869b54 100644 --- a/moto/apigateway/responses.py +++ b/moto/apigateway/responses.py @@ -470,6 +470,7 @@ def integrations(self, request: Any, full_url: str, headers: Dict[str, str]) -> timeout_in_millis = self._get_param("timeoutInMillis") request_parameters = self._get_param("requestParameters") content_handling = self._get_param("contentHandling") + connection_type = self._get_param("connectionType") self.backend.get_method(function_id, resource_id, method_type) integration_http_method = self._get_param( @@ -491,6 +492,7 @@ def integrations(self, request: Any, full_url: str, headers: Dict[str, str]) -> timeout_in_millis=timeout_in_millis, request_parameters=request_parameters, content_handling=content_handling, + connection_type=connection_type, ) return 201, {}, json.dumps(integration_response.to_json()) elif self.method == "DELETE": diff --git a/tests/test_apigateway/test_apigateway.py b/tests/test_apigateway/test_apigateway.py index 46656353ff4f..60b409499db6 100644 --- a/tests/test_apigateway/test_apigateway.py +++ b/tests/test_apigateway/test_apigateway.py @@ -533,6 +533,7 @@ def test_integrations(): contentHandling="CONVERT_TO_TEXT", credentials=f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role", tlsConfig={"insecureSkipVerification": True}, + connectionType="INTERNET", ) # this is hard to match against, so remove it @@ -550,6 +551,7 @@ def test_integrations(): "contentHandling": "CONVERT_TO_TEXT", "credentials": f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role", "tlsConfig": {"insecureSkipVerification": True}, + "connectionType": "INTERNET", } ) @@ -571,6 +573,7 @@ def test_integrations(): "contentHandling": "CONVERT_TO_TEXT", "credentials": f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role", "tlsConfig": {"insecureSkipVerification": True}, + "connectionType": "INTERNET", } ) @@ -591,6 +594,7 @@ def test_integrations(): "contentHandling": "CONVERT_TO_TEXT", "credentials": f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role", "tlsConfig": {"insecureSkipVerification": True}, + "connectionType": "INTERNET", } )