Skip to main content

models

Creates, updates, deletes or gets a model resource or lists models in a region

Overview

Namemodels
TypeResource
DescriptionThe ``AWS::ApiGateway::Model`` resource defines the structure of a request or response payload for an API method.
Idawscc.apigateway.models

Fields

NameDatatypeDescription
content_typestring
descriptionstring
namestringA name for the model. If you don't specify a name, CFN generates a unique physical ID and uses that ID for the model name. For more information, see &#91;Name Type&#93;(https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html).<br />If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
rest_api_idstring
schemaobject
regionstringAWS region.

For more information, see AWS::ApiGateway::Model.

Methods

NameResourceAccessible byRequired Params
create_resourcemodelsINSERTRestApiId, region
delete_resourcemodelsDELETEIdentifier, region
update_resourcemodelsUPDATEIdentifier, PatchDocument, region
list_resourcesmodels_list_onlySELECTregion
get_resourcemodelsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual model.

SELECT
region,
content_type,
description,
name,
rest_api_id,
schema
FROM awscc.apigateway.models
WHERE
region = 'us-east-1' AND
Identifier = '{{ rest_api_id }}|{{ name }}';

INSERT example

Use the following StackQL query and manifest file to create a new model resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.apigateway.models (
RestApiId,
region
)
SELECT
'{{ rest_api_id }}',
'{{ region }}';

UPDATE example

Use the following StackQL query and manifest file to update a model resource, using stack-deploy.

/*+ update */
UPDATE awscc.apigateway.models
SET PatchDocument = string('{{ {
"Description": description,
"Schema": schema
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ rest_api_id }}|{{ name }}';

DELETE example

/*+ delete */
DELETE FROM awscc.apigateway.models
WHERE
Identifier = '{{ rest_api_id }}|{{ name }}' AND
region = 'us-east-1';

Permissions

To operate on the models resource, the following permissions are required:

apigateway:POST,
apigateway:GET