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 | aws.apigateway.models |
Fields
Name | Datatype | Description |
---|---|---|
content_type | string | The content-type for the model. |
description | string | The description of the model. |
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](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html). 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 | The string identifier of the associated RestApi. |
schema | object | 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. |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | RestApiId, 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,
content_type,
description,
name,
rest_api_id,
schema
FROM aws.apigateway.models
WHERE region = 'us-east-1';
Gets all properties from an individual model
.
SELECT
region,
content_type,
description,
name,
rest_api_id,
schema
FROM aws.apigateway.models
WHERE region = 'us-east-1' AND data__Identifier = '<RestApiId>|<Name>';
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.apigateway.models (
RestApiId,
region
)
SELECT
'{{ RestApiId }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.apigateway.models (
ContentType,
Description,
Name,
RestApiId,
Schema,
region
)
SELECT
'{{ ContentType }}',
'{{ Description }}',
'{{ Name }}',
'{{ RestApiId }}',
'{{ Schema }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: model
props:
- name: ContentType
value: '{{ ContentType }}'
- name: Description
value: '{{ Description }}'
- name: Name
value: '{{ Name }}'
- name: RestApiId
value: '{{ RestApiId }}'
- name: Schema
value: {}
DELETE
example
/*+ delete */
DELETE FROM aws.apigateway.models
WHERE data__Identifier = '<RestApiId|Name>'
AND region = 'us-east-1';
Permissions
To operate on the models
resource, the following permissions are required:
Create
apigateway:POST,
apigateway:GET
Read
apigateway:GET
Update
apigateway:PATCH,
apigateway:GET
Delete
apigateway:GET,
apigateway:DELETE
List
apigateway:GET