Class: AWSCDK::APIGateway::CfnRestAPIProps

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

Overview

Properties for defining a CfnRestApi.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key_source_type: nil, binary_media_types: nil, body: nil, body_s3_location: nil, clone_from: nil, description: nil, disable_execute_api_endpoint: nil, endpoint_access_mode: nil, endpoint_configuration: nil, fail_on_warnings: nil, minimum_compression_size: nil, mode: nil, name: nil, parameters: nil, policy: nil, security_policy: nil, tags: nil) ⇒ CfnRestAPIProps

Returns a new instance of CfnRestAPIProps.

Parameters:

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

    The source of the API key for metering requests according to a usage plan.

  • binary_media_types (Array<String>, nil) (defaults to: nil)

    The list of binary media types supported by the RestApi.

  • body (Object, nil) (defaults to: nil)

    An OpenAPI specification that defines a set of RESTful APIs in JSON format.

  • body_s3_location (AWSCDK::IResolvable, AWSCDK::APIGateway::CfnRestAPI::S3LocationProperty, nil) (defaults to: nil)

    The Amazon Simple Storage Service (Amazon S3) location that points to an OpenAPI file, which defines a set of RESTful APIs in JSON or YAML format.

  • clone_from (String, AWSCDK::Interfaces::AWSApigateway::IRestAPIRef, nil) (defaults to: nil)

    The ID of the RestApi that you want to clone from.

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

    The description of the RestApi.

  • disable_execute_api_endpoint (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether clients can invoke your API by using the default execute-api endpoint.

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

    The endpoint access mode for your RestApi.

  • endpoint_configuration (AWSCDK::IResolvable, AWSCDK::APIGateway::CfnRestAPI::EndpointConfigurationProperty, nil) (defaults to: nil)

    A list of the endpoint types and IP address types of the API.

  • fail_on_warnings (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    A query parameter to indicate whether to rollback the API update ( true ) or not ( false ) when a warning is encountered.

  • minimum_compression_size (Numeric, nil) (defaults to: nil)

    A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API.

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

    This property applies only when you use OpenAPI to define your REST API.

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

    The name of the RestApi.

  • parameters (AWSCDK::IResolvable, Hash{String => String}, nil) (defaults to: nil)

    Custom header parameters as part of the request.

  • policy (Object, nil) (defaults to: nil)

    A policy document that contains the permissions for the RestApi resource.

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

    The Transport Layer Security (TLS) version + cipher suite for this RestApi.

  • tags (Array<AWSCDK::CfnTag>, nil) (defaults to: nil)

    The key-value map of strings.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'api_gateway/cfn_rest_api_props.rb', line 26

def initialize(api_key_source_type: nil, binary_media_types: nil, body: nil, body_s3_location: nil, clone_from: nil, description: nil, disable_execute_api_endpoint: nil, endpoint_access_mode: nil, endpoint_configuration: nil, fail_on_warnings: nil, minimum_compression_size: nil, mode: nil, name: nil, parameters: nil, policy: nil, security_policy: nil, tags: nil)
  @api_key_source_type = api_key_source_type
  Jsii::Type.check_type(@api_key_source_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "apiKeySourceType") unless @api_key_source_type.nil?
  @binary_media_types = binary_media_types
  Jsii::Type.check_type(@binary_media_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "binaryMediaTypes") unless @binary_media_types.nil?
  @body = body
  Jsii::Type.check_type(@body, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "body") unless @body.nil?
  @body_s3_location = body_s3_location.is_a?(Hash) ? ::AWSCDK::APIGateway::CfnRestAPI::S3LocationProperty.new(**body_s3_location.transform_keys(&:to_sym)) : body_s3_location
  Jsii::Type.check_type(@body_s3_location, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcGlnYXRld2F5LkNmblJlc3RBcGkuUzNMb2NhdGlvblByb3BlcnR5In1dfX0=")), "bodyS3Location") unless @body_s3_location.nil?
  @clone_from = clone_from
  Jsii::Type.check_type(@clone_from, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hcGlnYXRld2F5LklSZXN0QXBpUmVmIn1dfX0=")), "cloneFrom") unless @clone_from.nil?
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @disable_execute_api_endpoint = disable_execute_api_endpoint
  Jsii::Type.check_type(@disable_execute_api_endpoint, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "disableExecuteApiEndpoint") unless @disable_execute_api_endpoint.nil?
  @endpoint_access_mode = endpoint_access_mode
  Jsii::Type.check_type(@endpoint_access_mode, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "endpointAccessMode") unless @endpoint_access_mode.nil?
  @endpoint_configuration = endpoint_configuration.is_a?(Hash) ? ::AWSCDK::APIGateway::CfnRestAPI::EndpointConfigurationProperty.new(**endpoint_configuration.transform_keys(&:to_sym)) : endpoint_configuration
  Jsii::Type.check_type(@endpoint_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcGlnYXRld2F5LkNmblJlc3RBcGkuRW5kcG9pbnRDb25maWd1cmF0aW9uUHJvcGVydHkifV19fQ==")), "endpointConfiguration") unless @endpoint_configuration.nil?
  @fail_on_warnings = fail_on_warnings
  Jsii::Type.check_type(@fail_on_warnings, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "failOnWarnings") unless @fail_on_warnings.nil?
  @minimum_compression_size = minimum_compression_size
  Jsii::Type.check_type(@minimum_compression_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minimumCompressionSize") unless @minimum_compression_size.nil?
  @mode = mode
  Jsii::Type.check_type(@mode, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "mode") unless @mode.nil?
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless @name.nil?
  @parameters = parameters
  Jsii::Type.check_type(@parameters, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsicHJpbWl0aXZlIjoic3RyaW5nIn0sImtpbmQiOiJtYXAifX1dfX0=")), "parameters") unless @parameters.nil?
  @policy = policy
  Jsii::Type.check_type(@policy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "policy") unless @policy.nil?
  @security_policy = security_policy
  Jsii::Type.check_type(@security_policy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "securityPolicy") unless @security_policy.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
end

Instance Attribute Details

#api_key_source_typeString? (readonly)

The source of the API key for metering requests according to a usage plan.

Valid values are: HEADER to read the API key from the X-API-Key header of a request. AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.



69
70
71
# File 'api_gateway/cfn_rest_api_props.rb', line 69

def api_key_source_type
  @api_key_source_type
end

#binary_media_typesArray<String>? (readonly)

The list of binary media types supported by the RestApi.

By default, the RestApi supports only UTF-8-encoded text payloads.



76
77
78
# File 'api_gateway/cfn_rest_api_props.rb', line 76

def binary_media_types
  @binary_media_types
end

#bodyObject? (readonly)

An OpenAPI specification that defines a set of RESTful APIs in JSON format.

For YAML templates, you can also provide the specification in YAML format.



83
84
85
# File 'api_gateway/cfn_rest_api_props.rb', line 83

def body
  @body
end

#body_s3_locationAWSCDK::IResolvable, ... (readonly)

The Amazon Simple Storage Service (Amazon S3) location that points to an OpenAPI file, which defines a set of RESTful APIs in JSON or YAML format.



88
89
90
# File 'api_gateway/cfn_rest_api_props.rb', line 88

def body_s3_location
  @body_s3_location
end

#clone_fromString, ... (readonly)

The ID of the RestApi that you want to clone from.



93
94
95
# File 'api_gateway/cfn_rest_api_props.rb', line 93

def clone_from
  @clone_from
end

#descriptionString? (readonly)

The description of the RestApi.



98
99
100
# File 'api_gateway/cfn_rest_api_props.rb', line 98

def description
  @description
end

#disable_execute_api_endpointBoolean, ... (readonly)

Specifies whether clients can invoke your API by using the default execute-api endpoint.

By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint



105
106
107
# File 'api_gateway/cfn_rest_api_props.rb', line 105

def disable_execute_api_endpoint
  @disable_execute_api_endpoint
end

#endpoint_access_modeString? (readonly)

The endpoint access mode for your RestApi.



110
111
112
# File 'api_gateway/cfn_rest_api_props.rb', line 110

def endpoint_access_mode
  @endpoint_access_mode
end

#endpoint_configurationAWSCDK::IResolvable, ... (readonly)

A list of the endpoint types and IP address types of the API.

Use this property when creating an API. When importing an existing API, specify the endpoint configuration types using the Parameters property.



117
118
119
# File 'api_gateway/cfn_rest_api_props.rb', line 117

def endpoint_configuration
  @endpoint_configuration
end

#fail_on_warningsBoolean, ... (readonly)

A query parameter to indicate whether to rollback the API update ( true ) or not ( false ) when a warning is encountered.

The default value is false .



124
125
126
# File 'api_gateway/cfn_rest_api_props.rb', line 124

def fail_on_warnings
  @fail_on_warnings
end

#minimum_compression_sizeNumeric? (readonly)

A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API.

When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.



131
132
133
# File 'api_gateway/cfn_rest_api_props.rb', line 131

def minimum_compression_size
  @minimum_compression_size
end

#modeString? (readonly)

This property applies only when you use OpenAPI to define your REST API.

The Mode determines how API Gateway handles resource updates.

Valid values are overwrite or merge .

For overwrite , the new API definition replaces the existing one. The existing API identifier remains unchanged.

For merge , the new API definition is merged with the existing API.

If you don't specify this property, a default value is chosen. For REST APIs created before March 29, 2021, the default is overwrite . For REST APIs created after March 29, 2021, the new API definition takes precedence, but any container types such as endpoint configurations and binary media types are merged with the existing API.

Use the default mode to define top-level RestApi properties in addition to using OpenAPI. Generally, it's preferred to use API Gateway's OpenAPI extensions to model these properties.



148
149
150
# File 'api_gateway/cfn_rest_api_props.rb', line 148

def mode
  @mode
end

#nameString? (readonly)

The name of the RestApi.

A name is required if the REST API is not based on an OpenAPI specification.



155
156
157
# File 'api_gateway/cfn_rest_api_props.rb', line 155

def name
  @name
end

#parametersAWSCDK::IResolvable, ... (readonly)

Custom header parameters as part of the request.

For example, to exclude DocumentationParts from an imported API, set ignore=documentation as a parameters value, as in the AWS CLI command of aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json' .



162
163
164
# File 'api_gateway/cfn_rest_api_props.rb', line 162

def parameters
  @parameters
end

#policyObject? (readonly)

A policy document that contains the permissions for the RestApi resource.

To set the ARN for the policy, use the !Join intrinsic function with "" as delimiter and values of "execute-api:/" and "*" .



169
170
171
# File 'api_gateway/cfn_rest_api_props.rb', line 169

def policy
  @policy
end

#security_policyString? (readonly)

The Transport Layer Security (TLS) version + cipher suite for this RestApi.



174
175
176
# File 'api_gateway/cfn_rest_api_props.rb', line 174

def security_policy
  @security_policy
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

The key-value map of strings.

The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with aws: . The tag value can be up to 256 characters.



181
182
183
# File 'api_gateway/cfn_rest_api_props.rb', line 181

def tags
  @tags
end

Class Method Details

.jsii_propertiesObject



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'api_gateway/cfn_rest_api_props.rb', line 183

def self.jsii_properties
  {
    :api_key_source_type => "apiKeySourceType",
    :binary_media_types => "binaryMediaTypes",
    :body => "body",
    :body_s3_location => "bodyS3Location",
    :clone_from => "cloneFrom",
    :description => "description",
    :disable_execute_api_endpoint => "disableExecuteApiEndpoint",
    :endpoint_access_mode => "endpointAccessMode",
    :endpoint_configuration => "endpointConfiguration",
    :fail_on_warnings => "failOnWarnings",
    :minimum_compression_size => "minimumCompressionSize",
    :mode => "mode",
    :name => "name",
    :parameters => "parameters",
    :policy => "policy",
    :security_policy => "securityPolicy",
    :tags => "tags",
  }
end

Instance Method Details

#to_jsiiObject



205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'api_gateway/cfn_rest_api_props.rb', line 205

def to_jsii
  result = {}
  result.merge!({
    "apiKeySourceType" => @api_key_source_type,
    "binaryMediaTypes" => @binary_media_types,
    "body" => @body,
    "bodyS3Location" => @body_s3_location,
    "cloneFrom" => @clone_from,
    "description" => @description,
    "disableExecuteApiEndpoint" => @disable_execute_api_endpoint,
    "endpointAccessMode" => @endpoint_access_mode,
    "endpointConfiguration" => @endpoint_configuration,
    "failOnWarnings" => @fail_on_warnings,
    "minimumCompressionSize" => @minimum_compression_size,
    "mode" => @mode,
    "name" => @name,
    "parameters" => @parameters,
    "policy" => @policy,
    "securityPolicy" => @security_policy,
    "tags" => @tags,
  })
  result.compact
end