Class: AWSCDK::APIGateway::ModelProps
- Inherits:
-
ModelOptions
- Object
- ModelOptions
- AWSCDK::APIGateway::ModelProps
- Defined in:
- api_gateway/model_props.rb
Instance Attribute Summary collapse
-
#content_type ⇒ String?
readonly
The content type for the model.
-
#description ⇒ String?
readonly
A description that identifies this model.
-
#model_name ⇒ String?
readonly
A name for the model.
-
#rest_api ⇒ AWSCDK::APIGateway::IRestAPI
readonly
The rest API that this model is part of.
-
#schema ⇒ AWSCDK::APIGateway::JsonSchema
readonly
The schema to use to transform data to one or more output formats.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(schema:, content_type: nil, description: nil, model_name: nil, rest_api:) ⇒ ModelProps
constructor
A new instance of ModelProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(schema:, content_type: nil, description: nil, model_name: nil, rest_api:) ⇒ ModelProps
Returns a new instance of ModelProps.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'api_gateway/model_props.rb', line 11 def initialize(schema:, content_type: nil, description: nil, model_name: nil, rest_api:) @schema = schema.is_a?(Hash) ? ::AWSCDK::APIGateway::JsonSchema.new(**schema.transform_keys(&:to_sym)) : schema Jsii::Type.check_type(@schema, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5Kc29uU2NoZW1hIn0=")), "schema") @content_type = content_type Jsii::Type.check_type(@content_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "contentType") unless @content_type.nil? @description = description Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil? @model_name = model_name Jsii::Type.check_type(@model_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "modelName") unless @model_name.nil? @rest_api = rest_api Jsii::Type.check_type(@rest_api, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5JUmVzdEFwaSJ9")), "restApi") end |
Instance Attribute Details
#content_type ⇒ String? (readonly)
Default: 'application/json'
The content type for the model.
You can also force a content type in the request or response model mapping.
37 38 39 |
# File 'api_gateway/model_props.rb', line 37 def content_type @content_type end |
#description ⇒ String? (readonly)
Default: None
A description that identifies this model.
42 43 44 |
# File 'api_gateway/model_props.rb', line 42 def description @description end |
#model_name ⇒ String? (readonly)
Default:
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.
53 54 55 |
# File 'api_gateway/model_props.rb', line 53 def model_name @model_name end |
#rest_api ⇒ AWSCDK::APIGateway::IRestAPI (readonly)
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.
62 63 64 |
# File 'api_gateway/model_props.rb', line 62 def rest_api @rest_api end |
#schema ⇒ AWSCDK::APIGateway::JsonSchema (readonly)
The schema to use to transform data to one or more output formats.
Specify null ({}) if you don't want to specify a schema.
29 30 31 |
# File 'api_gateway/model_props.rb', line 29 def schema @schema end |
Class Method Details
.jsii_properties ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'api_gateway/model_props.rb', line 64 def self.jsii_properties { :schema => "schema", :content_type => "contentType", :description => "description", :model_name => "modelName", :rest_api => "restApi", } end |
Instance Method Details
#to_jsii ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'api_gateway/model_props.rb', line 74 def to_jsii result = {} result.merge!(super) result.merge!({ "schema" => @schema, "contentType" => @content_type, "description" => @description, "modelName" => @model_name, "restApi" => @rest_api, }) result.compact end |