Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit a494e53

Browse files
committed
also fix connectionId for UpdateIntegration
1 parent b578528 commit a494e53

4 files changed

Lines changed: 64 additions & 8 deletions

File tree

localstack-core/localstack/services/apigateway/legacy/provider.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,6 +2158,7 @@ def update_integration(
21582158
raise NotFoundException("Invalid Integration identifier specified")
21592159

21602160
integration = method.method_integration
2161+
# TODO: validate the patch operations
21612162
patch_api_gateway_entity(integration, patch_operations)
21622163

21632164
# fix data types
@@ -2166,8 +2167,12 @@ def update_integration(
21662167
if skip_verification := (integration.tls_config or {}).get("insecureSkipVerification"):
21672168
integration.tls_config["insecureSkipVerification"] = str_to_bool(skip_verification)
21682169

2169-
integration_dict: Integration = integration.to_json()
2170-
return integration_dict
2170+
response: Integration = integration.to_json()
2171+
2172+
if connection_id := getattr(integration, "connection_id", None):
2173+
response["connectionId"] = connection_id
2174+
2175+
return response
21712176

21722177
def delete_integration(
21732178
self,

tests/aws/services/apigateway/test_apigateway_api.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4137,3 +4137,24 @@ def test_create_integration_with_vpc_link(
41374137
httpMethod="GET",
41384138
)
41394139
snapshot.match("get-integration-vpc-link", get_integration)
4140+
4141+
update_integration = aws_client.apigateway.update_integration(
4142+
restApiId=rest_api_id,
4143+
resourceId=root_resource_id,
4144+
httpMethod="GET",
4145+
patchOperations=[
4146+
{
4147+
"op": "replace",
4148+
"path": "/connectionId",
4149+
"value": "${stageVariables.vpcLinkIdBeta}",
4150+
}
4151+
],
4152+
)
4153+
snapshot.match("update-integration-vpc-link", update_integration)
4154+
4155+
get_integration_update = aws_client.apigateway.get_integration(
4156+
restApiId=rest_api_id,
4157+
resourceId=root_resource_id,
4158+
httpMethod="GET",
4159+
)
4160+
snapshot.match("get-integration-update-vpc-link", get_integration_update)

tests/aws/services/apigateway/test_apigateway_api.snapshot.json

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4910,7 +4910,7 @@
49104910
}
49114911
},
49124912
"tests/aws/services/apigateway/test_apigateway_api.py::TestApigatewayIntegration::test_create_integration_with_vpc_link": {
4913-
"recorded-date": "06-10-2025, 18:07:40",
4913+
"recorded-date": "08-10-2025, 09:05:56",
49144914
"recorded-content": {
49154915
"put-integration-vpc-link": {
49164916
"cacheKeyParameters": [],
@@ -4941,6 +4941,36 @@
49414941
"HTTPHeaders": {},
49424942
"HTTPStatusCode": 200
49434943
}
4944+
},
4945+
"update-integration-vpc-link": {
4946+
"cacheKeyParameters": [],
4947+
"cacheNamespace": "<cache-namespace:1>",
4948+
"connectionId": "${stageVariables.vpcLinkIdBeta}",
4949+
"connectionType": "VPC_LINK",
4950+
"httpMethod": "GET",
4951+
"passthroughBehavior": "WHEN_NO_MATCH",
4952+
"timeoutInMillis": 29000,
4953+
"type": "HTTP_PROXY",
4954+
"uri": "http://my-vpclink-test-nlb-1234567890abcdef.<region>.amazonaws.com",
4955+
"ResponseMetadata": {
4956+
"HTTPHeaders": {},
4957+
"HTTPStatusCode": 200
4958+
}
4959+
},
4960+
"get-integration-update-vpc-link": {
4961+
"cacheKeyParameters": [],
4962+
"cacheNamespace": "<cache-namespace:1>",
4963+
"connectionId": "${stageVariables.vpcLinkIdBeta}",
4964+
"connectionType": "VPC_LINK",
4965+
"httpMethod": "GET",
4966+
"passthroughBehavior": "WHEN_NO_MATCH",
4967+
"timeoutInMillis": 29000,
4968+
"type": "HTTP_PROXY",
4969+
"uri": "http://my-vpclink-test-nlb-1234567890abcdef.<region>.amazonaws.com",
4970+
"ResponseMetadata": {
4971+
"HTTPHeaders": {},
4972+
"HTTPStatusCode": 200
4973+
}
49444974
}
49454975
}
49464976
}

tests/aws/services/apigateway/test_apigateway_api.validation.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,12 @@
246246
"last_validated_date": "2024-04-15T20:47:11+00:00"
247247
},
248248
"tests/aws/services/apigateway/test_apigateway_api.py::TestApigatewayIntegration::test_create_integration_with_vpc_link": {
249-
"last_validated_date": "2025-10-06T18:07:40+00:00",
249+
"last_validated_date": "2025-10-08T09:05:56+00:00",
250250
"durations_in_seconds": {
251-
"setup": 0.82,
252-
"call": 1.1,
253-
"teardown": 0.68,
254-
"total": 2.6
251+
"setup": 0.84,
252+
"call": 1.59,
253+
"teardown": 0.63,
254+
"total": 3.06
255255
}
256256
},
257257
"tests/aws/services/apigateway/test_apigateway_api.py::TestApigatewayIntegration::test_delete_integration_response_errors": {

0 commit comments

Comments
 (0)