Interface ModelOptions
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Subinterfaces:
ModelProps
- All Known Implementing Classes:
ModelOptions.Jsii$Proxy,ModelProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:45.020Z")
@Stability(Stable)
public interface ModelOptions
extends software.amazon.jsii.JsiiSerializable
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 ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forModelOptionsstatic final classAn implementation forModelOptions -
Method Summary
Modifier and TypeMethodDescriptionstatic ModelOptions.Builderbuilder()default StringThe content type for the model.default StringA description that identifies this model.default StringA name for the model.The schema to use to transform data to one or more output formats.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getSchema
The schema to use to transform data to one or more output formats.Specify null ({}) if you don't want to specify a schema.
-
getContentType
The content type for the model.You can also force a content type in the request or response model mapping.
Default: 'application/json'
-
getDescription
A description that identifies this model.Default: None
-
getModelName
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:
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. -
builder
- Returns:
- a
ModelOptions.BuilderofModelOptions
-