java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.apigateway.Model
All Implemented Interfaces:
IResource, IModel, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:11.912Z") @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
    Modifier and Type
    Class
    Description
    static final class 
    A fluent builder for Model.

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode

    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.IResource

    IResource.Jsii$Default
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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

    Constructors
    Modifier
    Constructor
    Description
    protected
    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 Type
    Method
    Description
    static IModel
    fromModelName(software.constructs.Construct scope, String id, String modelName)
     
    Returns the model name, such as 'myModel'.

    Methods inherited from class software.constructs.Construct

    getNode, isConstruct, 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.constructs.IConstruct

    getNode

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Field Details

    • EMPTY_MODEL

      @Stability(Stable) public static final IModel 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

      @Stability(Stable) public static final IModel 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

      @Stability(Stable) @NotNull public String getModelId()
      Returns the model name, such as 'myModel'.
      Specified by:
      getModelId in interface IModel