AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

Model

Import

import { Model } from 'aws-cdk-lib/aws-apigateway';

Or use the module namespace:

import * as apigateway from 'aws-cdk-lib/aws-apigateway';
// apigateway.Model

Properties

Configuration passed to the constructor as ModelProps.

restApiRequired
IRestApi

The rest API that this model is part of. The reason we need the RestApi object itself and not just the ID is because the model is being tracked by the top-level RestApi object for the purpose of calculating its hash to determine the ID of the deployment. This allows us to automatically update the deployment when the model of the REST API changes.

4 properties inherited from ModelOptions
schemaRequiredinherited from ModelOptions
JsonSchema

The schema to use to transform data to one or more output formats. Specify null ({}) if you don't want to specify a schema.

contentTypeOptionalinherited from ModelOptions
string

The content type for the model. You can also force a content type in the request or response model mapping.

Default: 'application/json'

descriptionOptionalinherited from ModelOptions
string

A description that identifies this model.

Default: None

modelNameOptionalinherited from ModelOptions
string

A name for the model. Important 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.

Default: <auto> If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the model name. For more information, see Name Type.

Get the Amazon API Gateway Cheat Sheet

Everything you need to know about Amazon API Gateway on one page. HD quality, print-friendly.

Download Free Infographic