ModelProps Struct
| Source | aws-apigateway/lib/model.ts |
|---|
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigateway as apigateway } from 'aws-cdk-lib';
declare const default_: any;
declare const enum_: any;
declare const jsonSchema_: apigateway.JsonSchema;
declare const restApi: apigateway.RestApi;
const modelProps: apigateway.ModelProps = {
restApi: restApi,
schema: {
additionalItems: false,
additionalProperties: false,
allOf: [jsonSchema_],
anyOf: [jsonSchema_],
contains: jsonSchema_,
default: default_,
definitions: {
definitionsKey: jsonSchema_,
},
dependencies: {
dependenciesKey: ['dependencies'],
},
description: 'description',
enum: [enum_],
exclusiveMaximum: false,
exclusiveMinimum: false,
format: 'format',
id: 'id',
items: jsonSchema_,
maximum: 123,
maxItems: 123,
maxLength: 123,
maxProperties: 123,
minimum: 123,
minItems: 123,
minLength: 123,
minProperties: 123,
multipleOf: 123,
not: jsonSchema_,
oneOf: [jsonSchema_],
pattern: 'pattern',
patternProperties: {
patternPropertiesKey: jsonSchema_,
},
properties: {
propertiesKey: jsonSchema_,
},
propertyNames: jsonSchema_,
ref: 'ref',
required: ['required'],
schema: apigateway.JsonSchemaVersion.DRAFT4,
title: 'title',
type: apigateway.JsonSchemaType.NULL,
uniqueItems: false,
},
// the properties below are optional
contentType: 'contentType',
description: 'description',
modelName: 'modelName',
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_apigateway as apigateway
# default_: Any
# enum_: Any
# json_schema_: apigateway.JsonSchema
# rest_api: apigateway.RestApi
model_props = apigateway.ModelProps(
rest_api=rest_api,
schema=apigateway.JsonSchema(
additional_items=False,
additional_properties=False,
all_of=[json_schema_],
any_of=[json_schema_],
contains=json_schema_,
default=default_,
definitions={
"definitions_key": json_schema_
},
dependencies={
"dependencies_key": ["dependencies"]
},
description="description",
enum=[enum_],
exclusive_maximum=False,
exclusive_minimum=False,
format="format",
id="id",
items=json_schema_,
maximum=123,
max_items=123,
max_length=123,
max_properties=123,
minimum=123,
min_items=123,
min_length=123,
min_properties=123,
multiple_of=123,
not=json_schema_,
one_of=[json_schema_],
pattern="pattern",
pattern_properties={
"pattern_properties_key": json_schema_
},
properties={
"properties_key": json_schema_
},
property_names=json_schema_,
ref="ref",
required=["required"],
schema=apigateway.JsonSchemaVersion.DRAFT4,
title="title",
type=apigateway.JsonSchemaType.NULL,
unique_items=False
),
# the properties below are optional
content_type="contentType",
description="description",
model_name="modelName"
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apigateway.*;
Object default_;
Object enum_;
JsonSchema jsonSchema_;
RestApi restApi;
ModelProps modelProps = ModelProps.builder()
.restApi(restApi)
.schema(JsonSchema.builder()
.additionalItems(false)
.additionalProperties(false)
.allOf(List.of(jsonSchema_))
.anyOf(List.of(jsonSchema_))
.contains(jsonSchema_)
.default(default_)
.definitions(Map.of(
"definitionsKey", jsonSchema_))
.dependencies(Map.of(
"dependenciesKey", List.of("dependencies")))
.description("description")
.enum(List.of(enum_))
.exclusiveMaximum(false)
.exclusiveMinimum(false)
.format("format")
.id("id")
.items(jsonSchema_)
.maximum(123)
.maxItems(123)
.maxLength(123)
.maxProperties(123)
.minimum(123)
.minItems(123)
.minLength(123)
.minProperties(123)
.multipleOf(123)
.not(jsonSchema_)
.oneOf(List.of(jsonSchema_))
.pattern("pattern")
.patternProperties(Map.of(
"patternPropertiesKey", jsonSchema_))
.properties(Map.of(
"propertiesKey", jsonSchema_))
.propertyNames(jsonSchema_)
.ref("ref")
.required(List.of("required"))
.schema(JsonSchemaVersion.DRAFT4)
.title("title")
.type(JsonSchemaType.NULL)
.uniqueItems(false)
.build())
// the properties below are optional
.contentType("contentType")
.description("description")
.modelName("modelName")
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.APIGateway;
var default_;
var enum_;
JsonSchema jsonSchema_;
RestApi restApi;
var modelProps = new ModelProps {
RestApi = restApi,
Schema = new JsonSchema {
AdditionalItems = false,
AdditionalProperties = false,
AllOf = new [] { jsonSchema_ },
AnyOf = new [] { jsonSchema_ },
Contains = jsonSchema_,
Default = default_,
Definitions = new Dictionary<string, JsonSchema> {
{ "definitionsKey", jsonSchema_ }
},
Dependencies = new Dictionary<string, object> {
{ "dependenciesKey", new [] { "dependencies" } }
},
Description = "description",
Enum = new [] { enum_ },
ExclusiveMaximum = false,
ExclusiveMinimum = false,
Format = "format",
Id = "id",
Items = jsonSchema_,
Maximum = 123,
MaxItems = 123,
MaxLength = 123,
MaxProperties = 123,
Minimum = 123,
MinItems = 123,
MinLength = 123,
MinProperties = 123,
MultipleOf = 123,
Not = jsonSchema_,
OneOf = new [] { jsonSchema_ },
Pattern = "pattern",
PatternProperties = new Dictionary<string, JsonSchema> {
{ "patternPropertiesKey", jsonSchema_ }
},
Properties = new Dictionary<string, JsonSchema> {
{ "propertiesKey", jsonSchema_ }
},
PropertyNames = jsonSchema_,
Ref = "ref",
Required = new [] { "required" },
Schema = JsonSchemaVersion.DRAFT4,
Title = "title",
Type = JsonSchemaType.NULL,
UniqueItems = false
},
// the properties below are optional
ContentType = "contentType",
Description = "description",
ModelName = "modelName"
};
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
var default_ interface{}
var enum_ interface{}
var jsonSchema_ JsonSchema
var restApi RestApi
modelProps := &ModelProps{
RestApi: restApi,
Schema: &JsonSchema{
AdditionalItems: jsii.Boolean(false),
AdditionalProperties: jsii.Boolean(false),
AllOf: []JsonSchema{
jsonSchema_,
},
AnyOf: []JsonSchema{
jsonSchema_,
},
Contains: jsonSchema_,
Default: default_,
Definitions: map[string]JsonSchema{
"definitionsKey": jsonSchema_,
},
Dependencies: map[string]interface{}{
"dependenciesKey": []interface{}{
jsii.String("dependencies"),
},
},
Description: jsii.String("description"),
Enum: []interface{}{
enum_,
},
ExclusiveMaximum: jsii.Boolean(false),
ExclusiveMinimum: jsii.Boolean(false),
Format: jsii.String("format"),
Id: jsii.String("id"),
Items: jsonSchema_,
Maximum: jsii.Number(123),
MaxItems: jsii.Number(123),
MaxLength: jsii.Number(123),
MaxProperties: jsii.Number(123),
Minimum: jsii.Number(123),
MinItems: jsii.Number(123),
MinLength: jsii.Number(123),
MinProperties: jsii.Number(123),
MultipleOf: jsii.Number(123),
Not: jsonSchema_,
OneOf: []JsonSchema{
jsonSchema_,
},
Pattern: jsii.String("pattern"),
PatternProperties: map[string]JsonSchema{
"patternPropertiesKey": jsonSchema_,
},
Properties: map[string]JsonSchema{
"propertiesKey": jsonSchema_,
},
PropertyNames: jsonSchema_,
Ref: jsii.String("ref"),
Required: []*string{
jsii.String("required"),
},
Schema: awscdk.Aws_apigateway.JsonSchemaVersion_DRAFT4,
Title: jsii.String("title"),
Type: awscdk.*Aws_apigateway.JsonSchemaType_NULL,
UniqueItems: jsii.Boolean(false),
},
// the properties below are optional
ContentType: jsii.String("contentType"),
Description: jsii.String("description"),
ModelName: jsii.String("modelName"),
}
Properties
contentTypeoptionalstringcontent_typeoptionalstrcontentTypeoptionalStringContentTypeoptionalstringContentTypeoptional*string = 'application/json' #You can also force a content type in the request or response model mapping.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string = None #modelNameoptionalstringmodel_nameoptionalstrmodelNameoptionalStringModelNameoptionalstringModelNameoptional*string #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.
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.
notes
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.
Specify null ({}) if you don't want to specify a schema.