Skip to main content

models

Creates, updates, deletes, gets or lists a models resource.

Overview

Namemodels
TypeResource
Idaws.apigatewayv2.models

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
content_typestringA string with a length between [1-256].
descriptionstringA string with a length between [0-1024].
model_idstringThe identifier.
namestringA string with a length between [1-128].
schemastringA string with a length between [0-32768].

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_modelselectapi_id, model_id, regionGets a Model.
get_modelsselectapi_id, regionmaxResults, nextTokenGets the Models for an API.
create_modelinsertapi_id, regionCreates a Model for an API.
update_modelupdateapi_id, model_id, regionUpdates a Model.
delete_modeldeleteapi_id, model_id, regionDeletes a Model.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_idstringThe API identifier.
model_idstringThe model ID.
regionstringAWS region (default: us-east-1)
maxResultsstringThe maximum number of elements to be returned for this resource.
nextTokenstringThe next page of elements from this collection. Not valid for the last element of the collection.

SELECT examples

Gets a Model.

SELECT
content_type,
description,
model_id,
name,
schema
FROM aws.apigatewayv2.models
WHERE api_id = '{{ api_id }}' -- required
AND model_id = '{{ model_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a Model for an API.

INSERT INTO aws.apigatewayv2.models (
ContentType,
Description,
Name,
Schema,
api_id,
region
)
SELECT
'{{ ContentType }}',
'{{ Description }}',
'{{ Name }}',
'{{ Schema }}',
'{{ api_id }}',
'{{ region }}'
RETURNING
content_type,
description,
model_id,
name,
schema
;

UPDATE examples

Updates a Model.

UPDATE aws.apigatewayv2.models
SET
ContentType = '{{ ContentType }}',
Description = '{{ Description }}',
Name = '{{ Name }}',
Schema = '{{ Schema }}'
WHERE
api_id = '{{ api_id }}' --required
AND model_id = '{{ model_id }}' --required
AND region = '{{ region }}' --required
RETURNING
content_type,
description,
model_id,
name,
schema;

DELETE examples

Deletes a Model.

DELETE FROM aws.apigatewayv2.models
WHERE api_id = '{{ api_id }}' --required
AND model_id = '{{ model_id }}' --required
AND region = '{{ region }}' --required
;