models
Creates, updates, deletes, gets or lists a models resource.
Overview
| Name | models |
| Type | Resource |
| Id | aws.apigateway.models |
Fields
The following fields are returned by SELECT queries:
- get_model
- get_models
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier for the model resource. |
name | string | The name of the model. Must be an alphanumeric string. |
content_type | string | The content-type for the model. |
description | string | The description of the model. |
schema | string | The schema for the model. For application/json models, this should be JSON schema draft 4 model. Do not include "*/" characters in the description of any properties because such "*/" characters may be interpreted as the closing marker for comments in some languages, such as Java or JavaScript, causing the installation of your API's SDK generated by API Gateway to fail. |
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier for the model resource. |
name | string | The name of the model. Must be an alphanumeric string. |
content_type | string | The content-type for the model. |
description | string | The description of the model. |
schema | string | The schema for the model. For application/json models, this should be JSON schema draft 4 model. Do not include "*/" characters in the description of any properties because such "*/" characters may be interpreted as the closing marker for comments in some languages, such as Java or JavaScript, causing the installation of your API's SDK generated by API Gateway to fail. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_model | select | restapi_id, model_name, region | flatten | Describes an existing model defined for a RestApi resource. |
get_models | select | restapi_id, region | position, limit | Describes existing Models defined for a RestApi resource. |
create_model | insert | restapi_id, region, name, contentType | Adds a new Model resource to an existing RestApi resource. | |
update_model | update | restapi_id, model_name, region | Changes information about a model. The maximum size of the model is 400 KB. | |
delete_model | delete | restapi_id, model_name, region | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
model_name | string | The name of the model to delete. |
region | string | AWS region (default: us-east-1) |
restapi_id | string | The string identifier of the associated RestApi. |
flatten | boolean | A query parameter of a Boolean value to resolve (true) all external model references and returns a flattened model schema or not (false) The default is false. |
limit | integer | The maximum number of returned results per page. The default value is 25 and the maximum value is 500. |
position | string | The current pagination position in the paged result set. |
SELECT examples
- get_model
- get_models
Describes an existing model defined for a RestApi resource.
SELECT
id,
name,
content_type,
description,
schema
FROM aws.apigateway.models
WHERE restapi_id = '{{ restapi_id }}' -- required
AND model_name = '{{ model_name }}' -- required
AND region = '{{ region }}' -- required
AND flatten = '{{ flatten }}'
;
Describes existing Models defined for a RestApi resource.
SELECT
id,
name,
content_type,
description,
schema
FROM aws.apigateway.models
WHERE restapi_id = '{{ restapi_id }}' -- required
AND region = '{{ region }}' -- required
AND position = '{{ position }}'
AND limit = '{{ limit }}'
;
INSERT examples
- create_model
- Manifest
Adds a new Model resource to an existing RestApi resource.
INSERT INTO aws.apigateway.models (
name,
description,
schema,
contentType,
restapi_id,
region
)
SELECT
'{{ name }}' /* required */,
'{{ description }}',
'{{ schema }}',
'{{ contentType }}' /* required */,
'{{ restapi_id }}',
'{{ region }}'
RETURNING
id,
name,
content_type,
description,
schema
;
# Description fields are for documentation purposes
- name: models
props:
- name: restapi_id
value: "{{ restapi_id }}"
description: Required parameter for the models resource.
- name: region
value: "{{ region }}"
description: Required parameter for the models resource.
- name: name
value: "{{ name }}"
- name: description
value: "{{ description }}"
- name: schema
value: "{{ schema }}"
- name: contentType
value: "{{ contentType }}"
UPDATE examples
- update_model
Changes information about a model. The maximum size of the model is 400 KB.
UPDATE aws.apigateway.models
SET
patchOperations = '{{ patchOperations }}'
WHERE
restapi_id = '{{ restapi_id }}' --required
AND model_name = '{{ model_name }}' --required
AND region = '{{ region }}' --required
RETURNING
id,
name,
content_type,
description,
schema;
DELETE examples
- delete_model
Deletes a model.
DELETE FROM aws.apigateway.models
WHERE restapi_id = '{{ restapi_id }}' --required
AND model_name = '{{ model_name }}' --required
AND region = '{{ region }}' --required
;