Enhancement - Add policy to update rest api for apigateway (#5951)

This commit is contained in:
Julian Charlot 2023-02-22 17:42:13 -05:00 committed by GitHub
parent 11e2120046
commit c875e7aa0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -1070,6 +1070,8 @@ class RestAPI(CloudFormationModel):
self.binaryMediaTypes = [value]
if to_path(self.PROP_DISABLE_EXECUTE_API_ENDPOINT) in path:
self.disableExecuteApiEndpoint = bool(value)
if to_path(self.PROP_POLICY) in path:
self.policy = value
elif operaton == self.OPERATION_ADD:
if to_path(self.PROP_BINARY_MEDIA_TYPES) in path:
self.binaryMediaTypes.append(value)

View File

@ -52,6 +52,12 @@ def test_update_rest_api():
{"op": "replace", "path": "/apiKeySource", "value": "AUTHORIZER"},
{"op": "replace", "path": "/binaryMediaTypes", "value": "image/jpeg"},
{"op": "replace", "path": "/disableExecuteApiEndpoint", "value": "True"},
{
"op": "replace",
"path": "/policy",
"value": '{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Principal": "*", "Action": '
'"execute-api:Invoke", "Resource": ["execute-api:/*"]}]}',
},
]
response = client.update_rest_api(restApiId=api_id, patchOperations=patchOperations)
@ -65,6 +71,8 @@ def test_update_rest_api():
"version": "V1",
"description": "new-description",
"apiKeySource": "AUTHORIZER",
"policy": '{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Principal": "*", "Action": '
'"execute-api:Invoke", "Resource": ["execute-api:/*"]}]}',
"endpointConfiguration": {"types": ["EDGE"]},
"tags": {},
"disableExecuteApiEndpoint": True,