models
Creates, updates, deletes or gets a model resource or lists models in a region
Overview
| Name | models |
| Type | Resource |
| Description | The AWS::ApiGateway::Model resource defines the structure of a request or response payload for an API method. |
| Id | awscc.apigateway.models |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
content_type | string | |
description | string | |
name | string | A name for the model. If you don't specify a name, CFN generates a unique physical ID and uses that ID for the model name. For more information, see Name Type.If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name. |
rest_api_id | string | |
schema | object | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
name | string | A name for the model. If you don't specify a name, CFN generates a unique physical ID and uses that ID for the model name. For more information, see Name Type.If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name. |
rest_api_id | string | |
region | string | AWS region. |
For more information, see AWS::ApiGateway::Model.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | models | INSERT | RestApiId, region |
delete_resource | models | DELETE | Identifier, region |
update_resource | models | UPDATE | Identifier, PatchDocument, region |
list_resources | models_list_only | SELECT | region |
get_resource | models | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual model.
SELECT
region,
content_type,
description,
name,
rest_api_id,
schema
FROM awscc.apigateway.models
WHERE
region = '{{ region }}' AND
Identifier = '{{ rest_api_id }}|{{ name }}';
Lists all models in a region.
SELECT
region,
rest_api_id,
name
FROM awscc.apigateway.models_list_only
WHERE
region = '{{ region }}';
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 awscc.apigateway.models (
RestApiId,
region
)
SELECT
'{{ rest_api_id }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.apigateway.models (
ContentType,
Description,
Name,
RestApiId,
Schema,
region
)
SELECT
'{{ content_type }}',
'{{ description }}',
'{{ name }}',
'{{ rest_api_id }}',
'{{ schema }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: model
props:
- name: content_type
value: '{{ content_type }}'
- name: description
value: '{{ description }}'
- name: name
value: '{{ name }}'
- name: rest_api_id
value: '{{ rest_api_id }}'
- name: schema
value: {}
UPDATE example
Use the following StackQL query and manifest file to update a model resource, using stack-deploy.
/*+ update */
UPDATE awscc.apigateway.models
SET PatchDocument = string('{{ {
"Description": description,
"Schema": schema
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ rest_api_id }}|{{ name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.apigateway.models
WHERE
Identifier = '{{ rest_api_id }}|{{ name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the models resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
apigateway:POST,
apigateway:GET
apigateway:GET
apigateway:PATCH,
apigateway:GET
apigateway:GET,
apigateway:DELETE
apigateway:GET