Class: AWSCDK::APIGateway::ModelOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
api_gateway/model_options.rb

Direct Known Subclasses

ModelProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema:, content_type: nil, description: nil, model_name: nil) ⇒ ModelOptions

Returns a new instance of ModelOptions.

Parameters:

  • schema (AWSCDK::APIGateway::JsonSchema)

    The schema to use to transform data to one or more output formats.

  • content_type (String, nil) (defaults to: nil)

    The content type for the model.

  • description (String, nil) (defaults to: nil)

    A description that identifies this model.

  • model_name (String, nil) (defaults to: nil)

    A name for the model.



10
11
12
13
14
15
16
17
18
19
# File 'api_gateway/model_options.rb', line 10

def initialize(schema:, content_type: nil, description: nil, model_name: nil)
  @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?
end

Instance Attribute Details

#content_typeString? (readonly)

Note:

Default: 'application/json'

The content type for the model.

You can also force a content type in the request or response model mapping.

Returns:

  • (String, nil)


34
35
36
# File 'api_gateway/model_options.rb', line 34

def content_type
  @content_type
end

#descriptionString? (readonly)

Note:

Default: None

A description that identifies this model.

Returns:

  • (String, nil)


39
40
41
# File 'api_gateway/model_options.rb', line 39

def description
  @description
end

#model_nameString? (readonly)

Note:

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.

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.

Returns:

  • (String, nil)


50
51
52
# File 'api_gateway/model_options.rb', line 50

def model_name
  @model_name
end

#schemaAWSCDK::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.



26
27
28
# File 'api_gateway/model_options.rb', line 26

def schema
  @schema
end

Class Method Details

.jsii_propertiesObject



52
53
54
55
56
57
58
59
# File 'api_gateway/model_options.rb', line 52

def self.jsii_properties
  {
    :schema => "schema",
    :content_type => "contentType",
    :description => "description",
    :model_name => "modelName",
  }
end

Instance Method Details

#to_jsiiObject



61
62
63
64
65
66
67
68
69
70
# File 'api_gateway/model_options.rb', line 61

def to_jsii
  result = {}
  result.merge!({
    "schema" => @schema,
    "contentType" => @content_type,
    "description" => @description,
    "modelName" => @model_name,
  })
  result.compact
end