models
Creates, updates, deletes or gets a model
resource or lists models
in a region
Overview
Name | models |
Type | Resource |
Description | The 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*. |
Id | aws.apigatewayv2.models |
Fields
Name | Datatype | Description |
---|---|---|
model_id | string | |
description | string | The description of the model. |
content_type | string | The content-type for the model, for example, "application/json". |
schema | object | The schema for the model. For application/json models, this should be JSON schema draft 4 model. |
api_id | string | The API identifier. |
name | string | The name of the model. |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | ApiId, Schema, Name, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__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
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.apigatewayv2.models (
Schema,
ApiId,
Name,
region
)
SELECT
'{{ Schema }}',
'{{ ApiId }}',
'{{ Name }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.apigatewayv2.models (
Description,
ContentType,
Schema,
ApiId,
Name,
region
)
SELECT
'{{ Description }}',
'{{ ContentType }}',
'{{ Schema }}',
'{{ ApiId }}',
'{{ Name }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: model
props:
- name: Description
value: '{{ Description }}'
- name: ContentType
value: '{{ ContentType }}'
- name: Schema
value: {}
- name: ApiId
value: '{{ ApiId }}'
- name: Name
value: '{{ Name }}'
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