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*.
Idaws.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.

Methods

NameAccessible byRequired Params
create_resourceINSERTApiId, Schema, Name, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all models in a region.

SELECT
region,
model_id,
description,
content_type,
schema,
api_id,
name
FROM aws.apigatewayv2.models
WHERE region = 'us-east-1';

Gets all properties from an individual model.

SELECT
region,
model_id,
description,
content_type,
schema,
api_id,
name
FROM aws.apigatewayv2.models
WHERE region = 'us-east-1' AND data__Identifier = '<ApiId>|<ModelId>';

INSERT example

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

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

DELETE example

/*+ delete */
DELETE FROM aws.apigatewayv2.models
WHERE data__Identifier = '<ApiId|ModelId>'
AND region = 'us-east-1';

Permissions

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

Create

apigateway:POST

Update

apigateway:PATCH,
apigateway:GET,
apigateway:PUT

Read

apigateway:GET

Delete

apigateway:GET,
apigateway:DELETE

List

apigateway:GET