Class Model
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.apigateway.Model
- All Implemented Interfaces:
IConstruct
,IDependable
,IResource
,IModel
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:45.018Z")
@Stability(Stable)
public class Model
extends Resource
implements IModel
Example:
RestApi api; // We define the JSON Schema for the transformed valid response Model responseModel = api.addModel("ResponseModel", ModelOptions.builder() .contentType("application/json") .modelName("ResponseModel") .schema(JsonSchema.builder() .schema(JsonSchemaVersion.DRAFT4) .title("pollResponse") .type(JsonSchemaType.OBJECT) .properties(Map.of( "state", JsonSchema.builder().type(JsonSchemaType.STRING).build(), "greeting", JsonSchema.builder().type(JsonSchemaType.STRING).build())) .build()) .build()); // We define the JSON Schema for the transformed error response Model errorResponseModel = api.addModel("ErrorResponseModel", ModelOptions.builder() .contentType("application/json") .modelName("ErrorResponseModel") .schema(JsonSchema.builder() .schema(JsonSchemaVersion.DRAFT4) .title("errorResponse") .type(JsonSchemaType.OBJECT) .properties(Map.of( "state", JsonSchema.builder().type(JsonSchemaType.STRING).build(), "message", JsonSchema.builder().type(JsonSchemaType.STRING).build())) .build()) .build());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.apigateway.IModel
IModel.Jsii$Default, IModel.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$Default
-
Field Summary
Modifier and TypeFieldDescriptionstatic final IModel
Represents a reference to a REST API's Empty model, which is available as part of the model collection by default.static final IModel
Represents a reference to a REST API's Error model, which is available as part of the model collection by default. -
Constructor Summary
ModifierConstructorDescriptionprotected
Model
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
Model
(software.amazon.jsii.JsiiObjectRef objRef) Model
(software.constructs.Construct scope, String id, ModelProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IModel
fromModelName
(software.constructs.Construct scope, String id, String modelName) Returns the model name, such as 'myModel'.Methods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.constructs.Construct
toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.awscdk.core.IConstruct
getNode
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
EMPTY_MODEL
Represents a reference to a REST API's Empty model, which is available as part of the model collection by default.This can be used for mapping JSON responses from an integration to what is returned to a client, where strong typing is not required. In the absence of any defined model, the Empty model will be used to return the response payload unmapped.
Definition { "$schema" : "http://json-schema.org/draft-04/schema#", "title" : "Empty Schema", "type" : "object" }
- See Also:
-
ERROR_MODEL
Represents a reference to a REST API's Error model, which is available as part of the model collection by default.This can be used for mapping error JSON responses from an integration to a client, where a simple generic message field is sufficient to map and return an error payload.
Definition { "$schema" : "http://json-schema.org/draft-04/schema#", "title" : "Error Schema", "type" : "object", "properties" : { "message" : { "type" : "string" } } }
-
-
Constructor Details
-
Model
protected Model(software.amazon.jsii.JsiiObjectRef objRef) -
Model
protected Model(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Model
@Stability(Stable) public Model(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ModelProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
fromModelName
@Stability(Stable) @NotNull public static IModel fromModelName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String modelName) - Parameters:
scope
- This parameter is required.id
- This parameter is required.modelName
- This parameter is required.
-
getModelId
Returns the model name, such as 'myModel'.- Specified by:
getModelId
in interfaceIModel
-