@@ -170,6 +170,7 @@ def __init__(
170170 method_settings = None ,
171171 binary_media = None ,
172172 minimum_compression_size = None ,
173+ disable_execute_api_endpoint = None ,
173174 cors = None ,
174175 auth = None ,
175176 gateway_responses = None ,
@@ -218,6 +219,7 @@ def __init__(
218219 self .method_settings = method_settings
219220 self .binary_media = binary_media
220221 self .minimum_compression_size = minimum_compression_size
222+ self .disable_execute_api_endpoint = disable_execute_api_endpoint
221223 self .cors = cors
222224 self .auth = auth
223225 self .gateway_responses = gateway_responses
@@ -290,8 +292,27 @@ def _construct_rest_api(self):
290292 if self .mode :
291293 rest_api .Mode = self .mode
292294
295+ if self .disable_execute_api_endpoint is not None :
296+ self ._add_endpoint_extension ()
297+
293298 return rest_api
294299
300+ def _add_endpoint_extension (self ):
301+ """Add disableExecuteApiEndpoint if it is set in SAM
302+ Note:
303+ If neither DefinitionUri nor DefinitionBody are specified,
304+ SAM will generate a openapi definition body based on template configuration.
305+ https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-api.html#sam-api-definitionbody
306+ For this reason, we always put DisableExecuteApiEndpoint into openapi object irrespective of origin of DefinitionBody.
307+ """
308+ if self .disable_execute_api_endpoint and not self .definition_body :
309+ raise InvalidResourceException (
310+ self .logical_id , "DisableExecuteApiEndpoint works only within 'DefinitionBody' property."
311+ )
312+ editor = SwaggerEditor (self .definition_body )
313+ editor .add_disable_execute_api_endpoint_extension (self .disable_execute_api_endpoint )
314+ self .definition_body = editor .swagger
315+
295316 def _construct_body_s3_dict (self ):
296317 """Constructs the RestApi's `BodyS3Location property`_, from the SAM Api's DefinitionUri property.
297318
@@ -444,6 +465,9 @@ def _construct_api_domain(self, rest_api):
444465 if self .domain .get ("SecurityPolicy" , None ):
445466 domain .SecurityPolicy = self .domain ["SecurityPolicy" ]
446467
468+ if self .domain .get ("OwnershipVerificationCertificateArn" , None ):
469+ domain .OwnershipVerificationCertificateArn = self .domain ["OwnershipVerificationCertificateArn" ]
470+
447471 # Create BasepathMappings
448472 if self .domain .get ("BasePath" ) and isinstance (self .domain .get ("BasePath" ), string_types ):
449473 basepaths = [self .domain .get ("BasePath" )]
0 commit comments