APIGateway: add connection type field to integration model (#5867)
This commit is contained in:
parent
00ad788975
commit
931bb6d960
@ -161,6 +161,7 @@ class Integration(BaseModel):
|
|||||||
request_parameters: Optional[Dict[str, Any]] = None,
|
request_parameters: Optional[Dict[str, Any]] = None,
|
||||||
content_handling: Optional[str] = None,
|
content_handling: Optional[str] = None,
|
||||||
credentials: Optional[str] = None,
|
credentials: Optional[str] = None,
|
||||||
|
connection_type: Optional[str] = None,
|
||||||
):
|
):
|
||||||
self.integration_type = integration_type
|
self.integration_type = integration_type
|
||||||
self.uri = uri
|
self.uri = uri
|
||||||
@ -174,6 +175,7 @@ class Integration(BaseModel):
|
|||||||
self.request_parameters = request_parameters
|
self.request_parameters = request_parameters
|
||||||
self.content_handling = content_handling
|
self.content_handling = content_handling
|
||||||
self.credentials = credentials
|
self.credentials = credentials
|
||||||
|
self.connection_type = connection_type
|
||||||
self.integration_responses: Optional[Dict[str, IntegrationResponse]] = None
|
self.integration_responses: Optional[Dict[str, IntegrationResponse]] = None
|
||||||
|
|
||||||
def to_json(self) -> Dict[str, Any]:
|
def to_json(self) -> Dict[str, Any]:
|
||||||
@ -196,6 +198,7 @@ class Integration(BaseModel):
|
|||||||
"requestParameters": self.request_parameters,
|
"requestParameters": self.request_parameters,
|
||||||
"contentHandling": self.content_handling,
|
"contentHandling": self.content_handling,
|
||||||
"credentials": self.credentials,
|
"credentials": self.credentials,
|
||||||
|
"connectionType": self.connection_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
def create_integration_response(
|
def create_integration_response(
|
||||||
@ -502,6 +505,7 @@ class Resource(CloudFormationModel):
|
|||||||
request_parameters: Optional[Dict[str, Any]] = None,
|
request_parameters: Optional[Dict[str, Any]] = None,
|
||||||
content_handling: Optional[str] = None,
|
content_handling: Optional[str] = None,
|
||||||
credentials: Optional[str] = None,
|
credentials: Optional[str] = None,
|
||||||
|
connection_type: Optional[str] = None,
|
||||||
) -> Integration:
|
) -> Integration:
|
||||||
integration_method = integration_method or method_type
|
integration_method = integration_method or method_type
|
||||||
integration = Integration(
|
integration = Integration(
|
||||||
@ -516,6 +520,7 @@ class Resource(CloudFormationModel):
|
|||||||
request_parameters=request_parameters,
|
request_parameters=request_parameters,
|
||||||
content_handling=content_handling,
|
content_handling=content_handling,
|
||||||
credentials=credentials,
|
credentials=credentials,
|
||||||
|
connection_type=connection_type,
|
||||||
)
|
)
|
||||||
self.resource_methods[method_type].method_integration = integration
|
self.resource_methods[method_type].method_integration = integration
|
||||||
return integration
|
return integration
|
||||||
@ -1911,6 +1916,7 @@ class APIGatewayBackend(BaseBackend):
|
|||||||
timeout_in_millis: Optional[str] = None,
|
timeout_in_millis: Optional[str] = None,
|
||||||
request_parameters: Optional[Dict[str, Any]] = None,
|
request_parameters: Optional[Dict[str, Any]] = None,
|
||||||
content_handling: Optional[str] = None,
|
content_handling: Optional[str] = None,
|
||||||
|
connection_type: Optional[str] = None,
|
||||||
) -> Integration:
|
) -> Integration:
|
||||||
resource = self.get_resource(function_id, resource_id)
|
resource = self.get_resource(function_id, resource_id)
|
||||||
if credentials and not re.match(
|
if credentials and not re.match(
|
||||||
@ -1955,6 +1961,7 @@ class APIGatewayBackend(BaseBackend):
|
|||||||
request_parameters=request_parameters,
|
request_parameters=request_parameters,
|
||||||
content_handling=content_handling,
|
content_handling=content_handling,
|
||||||
credentials=credentials,
|
credentials=credentials,
|
||||||
|
connection_type=connection_type,
|
||||||
)
|
)
|
||||||
return integration
|
return integration
|
||||||
|
|
||||||
|
@ -470,6 +470,7 @@ class APIGatewayResponse(BaseResponse):
|
|||||||
timeout_in_millis = self._get_param("timeoutInMillis")
|
timeout_in_millis = self._get_param("timeoutInMillis")
|
||||||
request_parameters = self._get_param("requestParameters")
|
request_parameters = self._get_param("requestParameters")
|
||||||
content_handling = self._get_param("contentHandling")
|
content_handling = self._get_param("contentHandling")
|
||||||
|
connection_type = self._get_param("connectionType")
|
||||||
self.backend.get_method(function_id, resource_id, method_type)
|
self.backend.get_method(function_id, resource_id, method_type)
|
||||||
|
|
||||||
integration_http_method = self._get_param(
|
integration_http_method = self._get_param(
|
||||||
@ -491,6 +492,7 @@ class APIGatewayResponse(BaseResponse):
|
|||||||
timeout_in_millis=timeout_in_millis,
|
timeout_in_millis=timeout_in_millis,
|
||||||
request_parameters=request_parameters,
|
request_parameters=request_parameters,
|
||||||
content_handling=content_handling,
|
content_handling=content_handling,
|
||||||
|
connection_type=connection_type,
|
||||||
)
|
)
|
||||||
return 201, {}, json.dumps(integration_response.to_json())
|
return 201, {}, json.dumps(integration_response.to_json())
|
||||||
elif self.method == "DELETE":
|
elif self.method == "DELETE":
|
||||||
|
@ -533,6 +533,7 @@ def test_integrations():
|
|||||||
contentHandling="CONVERT_TO_TEXT",
|
contentHandling="CONVERT_TO_TEXT",
|
||||||
credentials=f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role",
|
credentials=f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role",
|
||||||
tlsConfig={"insecureSkipVerification": True},
|
tlsConfig={"insecureSkipVerification": True},
|
||||||
|
connectionType="INTERNET",
|
||||||
)
|
)
|
||||||
|
|
||||||
# this is hard to match against, so remove it
|
# this is hard to match against, so remove it
|
||||||
@ -550,6 +551,7 @@ def test_integrations():
|
|||||||
"contentHandling": "CONVERT_TO_TEXT",
|
"contentHandling": "CONVERT_TO_TEXT",
|
||||||
"credentials": f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role",
|
"credentials": f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role",
|
||||||
"tlsConfig": {"insecureSkipVerification": True},
|
"tlsConfig": {"insecureSkipVerification": True},
|
||||||
|
"connectionType": "INTERNET",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -571,6 +573,7 @@ def test_integrations():
|
|||||||
"contentHandling": "CONVERT_TO_TEXT",
|
"contentHandling": "CONVERT_TO_TEXT",
|
||||||
"credentials": f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role",
|
"credentials": f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role",
|
||||||
"tlsConfig": {"insecureSkipVerification": True},
|
"tlsConfig": {"insecureSkipVerification": True},
|
||||||
|
"connectionType": "INTERNET",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -591,6 +594,7 @@ def test_integrations():
|
|||||||
"contentHandling": "CONVERT_TO_TEXT",
|
"contentHandling": "CONVERT_TO_TEXT",
|
||||||
"credentials": f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role",
|
"credentials": f"arn:aws:iam::{DEFAULT_ACCOUNT_ID}:role/apigateway-invoke-lambda-exec-role",
|
||||||
"tlsConfig": {"insecureSkipVerification": True},
|
"tlsConfig": {"insecureSkipVerification": True},
|
||||||
|
"connectionType": "INTERNET",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user