Skip to main content

models

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

Overview

Namemodels
TypeResource
DescriptionThe ``AWS::ApiGatewayV2::Model`` resource updates data model for a WebSocket API. For more information, see [Model Selection Expressions](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-model-selection-expressions) in the *API Gateway Developer Guide*.
Idawscc.apigatewayv2.models

Fields

NameDatatypeDescription
model_idstring
descriptionstringThe description of the model.
content_typestringThe content-type for the model, for example, "application/json".
schemaobjectThe schema for the model. For application/json models, this should be JSON schema draft 4 model.
api_idstringThe API identifier.
namestringThe name of the model.
regionstringAWS region.

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

Methods

NameResourceAccessible byRequired Params
create_resourcemodelsINSERTApiId, Schema, Name, 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,
model_id,
description,
content_type,
schema,
api_id,
name
FROM awscc.apigatewayv2.models
WHERE
region = 'us-east-1' AND
Identifier = '{{ api_id }}|{{ model_id }}';

INSERT example

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

/*+ create */
INSERT INTO awscc.apigatewayv2.models (
Schema,
ApiId,
Name,
region
)
SELECT
'{{ schema }}',
'{{ api_id }}',
'{{ name }}',
'{{ region }}';

UPDATE example

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

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

DELETE example

/*+ delete */
DELETE FROM awscc.apigatewayv2.models
WHERE
Identifier = '{{ api_id }}|{{ model_id }}' AND
region = 'us-east-1';

Permissions

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

apigateway:POST