Class: AWSCDK::APIGateway::RestAPIProps
- Inherits:
-
ResourceOptions
- Object
- ResourceOptions
- AWSCDK::APIGateway::RestAPIProps
- Defined in:
- api_gateway/rest_api_props.rb
Overview
Props to create a new instance of RestApi.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_key_source_type ⇒ AWSCDK::APIGateway::APIKeySourceType?
readonly
The source of the API key for metering requests according to a usage plan.
-
#binary_media_types ⇒ Array<String>?
readonly
The list of binary media mime-types that are supported by the RestApi resource, such as "image/png" or "application/octet-stream".
-
#clone_from ⇒ AWSCDK::APIGateway::IRestAPI?
readonly
The ID of the API Gateway RestApi resource that you want to clone.
-
#cloud_watch_role ⇒ Boolean?
readonly
Automatically configure an AWS CloudWatch role for API Gateway.
-
#cloud_watch_role_removal_policy ⇒ AWSCDK::RemovalPolicy?
readonly
The removal policy applied to the AWS CloudWatch role when this resource is removed from the application.
-
#default_cors_preflight_options ⇒ AWSCDK::APIGateway::CorsOptions?
readonly
Adds a CORS preflight OPTIONS method to this resource and all child resources.
-
#default_integration ⇒ AWSCDK::APIGateway::Integration?
readonly
An integration to use as a default for all methods created within this API unless an integration is specified.
-
#default_method_options ⇒ AWSCDK::APIGateway::MethodOptions?
readonly
Method options to use as a default for all methods created within this API unless custom options are specified.
-
#deploy ⇒ Boolean?
readonly
Indicates if a Deployment should be automatically created for this API, and recreated when the API model (resources, methods) changes.
-
#deploy_options ⇒ AWSCDK::APIGateway::StageOptions?
readonly
Options for the API Gateway stage that will always point to the latest deployment when
deployis enabled. -
#description ⇒ String?
readonly
A description of the RestApi construct.
-
#disable_execute_api_endpoint ⇒ Boolean?
readonly
Specifies whether clients can invoke the API using the default execute-api endpoint.
-
#domain_name ⇒ AWSCDK::APIGateway::DomainNameOptions?
readonly
Configure a custom domain name and map it to this API.
-
#endpoint_configuration ⇒ AWSCDK::APIGateway::EndpointConfiguration?
readonly
The EndpointConfiguration property type specifies the endpoint types of a REST API.
-
#endpoint_export_name ⇒ String?
readonly
Export name for the CfnOutput containing the API endpoint.
-
#endpoint_types ⇒ Array<AWSCDK::APIGateway::EndpointType>?
readonly
A list of the endpoint types of the API.
-
#fail_on_warnings ⇒ Boolean?
readonly
Indicates whether to roll back the resource if a warning occurs while API Gateway is creating the RestApi resource.
-
#min_compression_size ⇒ AWSCDK::Size?
readonly
A Size(in bytes, kibibytes, mebibytes etc) that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (when undefined) on an API.
-
#minimum_compression_size ⇒ Numeric?
readonly
deprecated
Deprecated.
- superseded by
minCompressionSize
- superseded by
-
#parameters ⇒ Hash{String => String}?
readonly
Custom header parameters for the request.
-
#policy ⇒ AWSCDK::IAM::PolicyDocument?
readonly
A policy document that contains the permissions for this RestApi.
-
#rest_api_name ⇒ String?
readonly
A name for the API Gateway RestApi resource.
-
#retain_deployments ⇒ Boolean?
readonly
Retains old deployment resources when the API changes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(default_cors_preflight_options: nil, default_integration: nil, default_method_options: nil, cloud_watch_role: nil, cloud_watch_role_removal_policy: nil, deploy: nil, deploy_options: nil, description: nil, disable_execute_api_endpoint: nil, domain_name: nil, endpoint_configuration: nil, endpoint_export_name: nil, endpoint_types: nil, fail_on_warnings: nil, parameters: nil, policy: nil, rest_api_name: nil, retain_deployments: nil, api_key_source_type: nil, binary_media_types: nil, clone_from: nil, min_compression_size: nil, minimum_compression_size: nil) ⇒ RestAPIProps
constructor
A new instance of RestAPIProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(default_cors_preflight_options: nil, default_integration: nil, default_method_options: nil, cloud_watch_role: nil, cloud_watch_role_removal_policy: nil, deploy: nil, deploy_options: nil, description: nil, disable_execute_api_endpoint: nil, domain_name: nil, endpoint_configuration: nil, endpoint_export_name: nil, endpoint_types: nil, fail_on_warnings: nil, parameters: nil, policy: nil, rest_api_name: nil, retain_deployments: nil, api_key_source_type: nil, binary_media_types: nil, clone_from: nil, min_compression_size: nil, minimum_compression_size: nil) ⇒ RestAPIProps
Returns a new instance of RestAPIProps.
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'api_gateway/rest_api_props.rb', line 31 def initialize(default_cors_preflight_options: nil, default_integration: nil, default_method_options: nil, cloud_watch_role: nil, cloud_watch_role_removal_policy: nil, deploy: nil, deploy_options: nil, description: nil, disable_execute_api_endpoint: nil, domain_name: nil, endpoint_configuration: nil, endpoint_export_name: nil, endpoint_types: nil, fail_on_warnings: nil, parameters: nil, policy: nil, rest_api_name: nil, retain_deployments: nil, api_key_source_type: nil, binary_media_types: nil, clone_from: nil, min_compression_size: nil, minimum_compression_size: nil) @default_cors_preflight_options = .is_a?(Hash) ? ::AWSCDK::APIGateway::CorsOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(@default_cors_preflight_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5Db3JzT3B0aW9ucyJ9")), "defaultCorsPreflightOptions") unless @default_cors_preflight_options.nil? @default_integration = default_integration Jsii::Type.check_type(@default_integration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5JbnRlZ3JhdGlvbiJ9")), "defaultIntegration") unless @default_integration.nil? @default_method_options = .is_a?(Hash) ? ::AWSCDK::APIGateway::MethodOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(@default_method_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5NZXRob2RPcHRpb25zIn0=")), "defaultMethodOptions") unless @default_method_options.nil? @cloud_watch_role = cloud_watch_role Jsii::Type.check_type(@cloud_watch_role, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "cloudWatchRole") unless @cloud_watch_role.nil? @cloud_watch_role_removal_policy = cloud_watch_role_removal_policy Jsii::Type.check_type(@cloud_watch_role_removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "cloudWatchRoleRemovalPolicy") unless @cloud_watch_role_removal_policy.nil? @deploy = deploy Jsii::Type.check_type(@deploy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "deploy") unless @deploy.nil? @deploy_options = .is_a?(Hash) ? ::AWSCDK::APIGateway::StageOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(@deploy_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5TdGFnZU9wdGlvbnMifQ==")), "deployOptions") unless @deploy_options.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("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "disableExecuteApiEndpoint") unless @disable_execute_api_endpoint.nil? @domain_name = domain_name.is_a?(Hash) ? ::AWSCDK::APIGateway::DomainNameOptions.new(**domain_name.transform_keys(&:to_sym)) : domain_name Jsii::Type.check_type(@domain_name, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5Eb21haW5OYW1lT3B0aW9ucyJ9")), "domainName") unless @domain_name.nil? @endpoint_configuration = endpoint_configuration.is_a?(Hash) ? ::AWSCDK::APIGateway::EndpointConfiguration.new(**endpoint_configuration.transform_keys(&:to_sym)) : endpoint_configuration Jsii::Type.check_type(@endpoint_configuration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5FbmRwb2ludENvbmZpZ3VyYXRpb24ifQ==")), "endpointConfiguration") unless @endpoint_configuration.nil? @endpoint_export_name = endpoint_export_name Jsii::Type.check_type(@endpoint_export_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "endpointExportName") unless @endpoint_export_name.nil? @endpoint_types = endpoint_types Jsii::Type.check_type(@endpoint_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcGlnYXRld2F5LkVuZHBvaW50VHlwZSJ9LCJraW5kIjoiYXJyYXkifX0=")), "endpointTypes") unless @endpoint_types.nil? @fail_on_warnings = fail_on_warnings Jsii::Type.check_type(@fail_on_warnings, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "failOnWarnings") unless @fail_on_warnings.nil? @parameters = parameters Jsii::Type.check_type(@parameters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "parameters") unless @parameters.nil? @policy = policy Jsii::Type.check_type(@policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeURvY3VtZW50In0=")), "policy") unless @policy.nil? @rest_api_name = rest_api_name Jsii::Type.check_type(@rest_api_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "restApiName") unless @rest_api_name.nil? @retain_deployments = retain_deployments Jsii::Type.check_type(@retain_deployments, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "retainDeployments") unless @retain_deployments.nil? @api_key_source_type = api_key_source_type Jsii::Type.check_type(@api_key_source_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5BcGlLZXlTb3VyY2VUeXBlIn0=")), "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? @clone_from = clone_from Jsii::Type.check_type(@clone_from, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5JUmVzdEFwaSJ9")), "cloneFrom") unless @clone_from.nil? @min_compression_size = min_compression_size Jsii::Type.check_type(@min_compression_size, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "minCompressionSize") unless @min_compression_size.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? end |
Instance Attribute Details
#api_key_source_type ⇒ AWSCDK::APIGateway::APIKeySourceType? (readonly)
Default: - Metering is disabled.
The source of the API key for metering requests according to a usage plan.
209 210 211 |
# File 'api_gateway/rest_api_props.rb', line 209 def api_key_source_type @api_key_source_type end |
#binary_media_types ⇒ Array<String>? (readonly)
Default: - RestApi supports only UTF-8-encoded text payloads.
The list of binary media mime-types that are supported by the RestApi resource, such as "image/png" or "application/octet-stream".
214 215 216 |
# File 'api_gateway/rest_api_props.rb', line 214 def binary_media_types @binary_media_types end |
#clone_from ⇒ AWSCDK::APIGateway::IRestAPI? (readonly)
Default: - None.
The ID of the API Gateway RestApi resource that you want to clone.
219 220 221 |
# File 'api_gateway/rest_api_props.rb', line 219 def clone_from @clone_from end |
#cloud_watch_role ⇒ Boolean? (readonly)
Default: - false if @aws-cdk/aws-apigateway:disableCloudWatchRole is enabled, true otherwise
Automatically configure an AWS CloudWatch role for API Gateway.
101 102 103 |
# File 'api_gateway/rest_api_props.rb', line 101 def cloud_watch_role @cloud_watch_role end |
#cloud_watch_role_removal_policy ⇒ AWSCDK::RemovalPolicy? (readonly)
Default: - RemovalPolicy.RETAIN
The removal policy applied to the AWS CloudWatch role when this resource is removed from the application.
Requires cloud_watch_role to be enabled.
108 109 110 |
# File 'api_gateway/rest_api_props.rb', line 108 def cloud_watch_role_removal_policy @cloud_watch_role_removal_policy end |
#default_cors_preflight_options ⇒ AWSCDK::APIGateway::CorsOptions? (readonly)
Default: - CORS is disabled
Adds a CORS preflight OPTIONS method to this resource and all child resources.
You can add CORS at the resource-level using add_cors_preflight.
86 87 88 |
# File 'api_gateway/rest_api_props.rb', line 86 def @default_cors_preflight_options end |
#default_integration ⇒ AWSCDK::APIGateway::Integration? (readonly)
Default: - Inherited from parent.
An integration to use as a default for all methods created within this API unless an integration is specified.
91 92 93 |
# File 'api_gateway/rest_api_props.rb', line 91 def default_integration @default_integration end |
#default_method_options ⇒ AWSCDK::APIGateway::MethodOptions? (readonly)
Default: - Inherited from parent.
Method options to use as a default for all methods created within this API unless custom options are specified.
96 97 98 |
# File 'api_gateway/rest_api_props.rb', line 96 def @default_method_options end |
#deploy ⇒ Boolean? (readonly)
Default: true
Indicates if a Deployment should be automatically created for this API, and recreated when the API model (resources, methods) changes.
Since API Gateway deployments are immutable, When this option is enabled (by default), an AWS::ApiGateway::Deployment resource will automatically created with a logical ID that hashes the API model (methods, resources and options). This means that when the model changes, the logical ID of this CloudFormation resource will change, and a new deployment will be created.
If this is set, latest_deployment will refer to the Deployment object
and deployment_stage will refer to a Stage that points to this
deployment. To customize the stage options, use the deploy_options
property.
A CloudFormation Output will also be defined with the root URL endpoint of this REST API.
128 129 130 |
# File 'api_gateway/rest_api_props.rb', line 128 def deploy @deploy end |
#deploy_options ⇒ AWSCDK::APIGateway::StageOptions? (readonly)
Default: - Based on defaults of StageOptions.
Options for the API Gateway stage that will always point to the latest deployment when deploy is enabled.
If deploy is disabled,
this value cannot be set.
136 137 138 |
# File 'api_gateway/rest_api_props.rb', line 136 def @deploy_options end |
#description ⇒ String? (readonly)
Default: - 'Automatically created by the RestApi construct'
A description of the RestApi construct.
141 142 143 |
# File 'api_gateway/rest_api_props.rb', line 141 def description @description end |
#disable_execute_api_endpoint ⇒ Boolean? (readonly)
Default: false
Specifies whether clients can invoke the API using the default execute-api endpoint.
To require that clients use a custom domain name to invoke the API, disable the default endpoint.
150 151 152 |
# File 'api_gateway/rest_api_props.rb', line 150 def disable_execute_api_endpoint @disable_execute_api_endpoint end |
#domain_name ⇒ AWSCDK::APIGateway::DomainNameOptions? (readonly)
Default: - no domain name is defined, use addDomainName or directly define a DomainName.
Configure a custom domain name and map it to this API.
155 156 157 |
# File 'api_gateway/rest_api_props.rb', line 155 def domain_name @domain_name end |
#endpoint_configuration ⇒ AWSCDK::APIGateway::EndpointConfiguration? (readonly)
Default: EndpointType.EDGE
The EndpointConfiguration property type specifies the endpoint types of a REST API.
161 162 163 |
# File 'api_gateway/rest_api_props.rb', line 161 def endpoint_configuration @endpoint_configuration end |
#endpoint_export_name ⇒ String? (readonly)
Default: - when no export name is given, output will be created without export
Export name for the CfnOutput containing the API endpoint.
166 167 168 |
# File 'api_gateway/rest_api_props.rb', line 166 def endpoint_export_name @endpoint_export_name end |
#endpoint_types ⇒ Array<AWSCDK::APIGateway::EndpointType>? (readonly)
Default: EndpointType.EDGE
A list of the endpoint types of the API.
Use this property when creating an API.
174 175 176 |
# File 'api_gateway/rest_api_props.rb', line 174 def endpoint_types @endpoint_types end |
#fail_on_warnings ⇒ Boolean? (readonly)
Default: false
Indicates whether to roll back the resource if a warning occurs while API Gateway is creating the RestApi resource.
179 180 181 |
# File 'api_gateway/rest_api_props.rb', line 179 def fail_on_warnings @fail_on_warnings end |
#min_compression_size ⇒ AWSCDK::Size? (readonly)
Default: - Compression is disabled.
A Size(in bytes, kibibytes, mebibytes etc) that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (when undefined) 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.
229 230 231 |
# File 'api_gateway/rest_api_props.rb', line 229 def min_compression_size @min_compression_size end |
#minimum_compression_size ⇒ Numeric? (readonly)
- superseded by
minCompressionSize
Default: - Compression is disabled.
A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (when undefined) 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.
240 241 242 |
# File 'api_gateway/rest_api_props.rb', line 240 def minimum_compression_size @minimum_compression_size end |
#parameters ⇒ Hash{String => String}? (readonly)
Default: - No parameters.
Custom header parameters for the request.
185 186 187 |
# File 'api_gateway/rest_api_props.rb', line 185 def parameters @parameters end |
#policy ⇒ AWSCDK::IAM::PolicyDocument? (readonly)
Default: - No policy.
A policy document that contains the permissions for this RestApi.
190 191 192 |
# File 'api_gateway/rest_api_props.rb', line 190 def policy @policy end |
#rest_api_name ⇒ String? (readonly)
Default: - ID of the RestApi construct.
A name for the API Gateway RestApi resource.
195 196 197 |
# File 'api_gateway/rest_api_props.rb', line 195 def rest_api_name @rest_api_name end |
#retain_deployments ⇒ Boolean? (readonly)
Default: false
Retains old deployment resources when the API changes.
This allows manually reverting stages to point to old deployments via the AWS Console.
204 205 206 |
# File 'api_gateway/rest_api_props.rb', line 204 def retain_deployments @retain_deployments end |
Class Method Details
.jsii_properties ⇒ Object
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'api_gateway/rest_api_props.rb', line 242 def self.jsii_properties { :default_cors_preflight_options => "defaultCorsPreflightOptions", :default_integration => "defaultIntegration", :default_method_options => "defaultMethodOptions", :cloud_watch_role => "cloudWatchRole", :cloud_watch_role_removal_policy => "cloudWatchRoleRemovalPolicy", :deploy => "deploy", :deploy_options => "deployOptions", :description => "description", :disable_execute_api_endpoint => "disableExecuteApiEndpoint", :domain_name => "domainName", :endpoint_configuration => "endpointConfiguration", :endpoint_export_name => "endpointExportName", :endpoint_types => "endpointTypes", :fail_on_warnings => "failOnWarnings", :parameters => "parameters", :policy => "policy", :rest_api_name => "restApiName", :retain_deployments => "retainDeployments", :api_key_source_type => "apiKeySourceType", :binary_media_types => "binaryMediaTypes", :clone_from => "cloneFrom", :min_compression_size => "minCompressionSize", :minimum_compression_size => "minimumCompressionSize", } end |
Instance Method Details
#to_jsii ⇒ Object
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'api_gateway/rest_api_props.rb', line 270 def to_jsii result = {} result.merge!(super) result.merge!({ "defaultCorsPreflightOptions" => @default_cors_preflight_options, "defaultIntegration" => @default_integration, "defaultMethodOptions" => @default_method_options, "cloudWatchRole" => @cloud_watch_role, "cloudWatchRoleRemovalPolicy" => @cloud_watch_role_removal_policy, "deploy" => @deploy, "deployOptions" => @deploy_options, "description" => @description, "disableExecuteApiEndpoint" => @disable_execute_api_endpoint, "domainName" => @domain_name, "endpointConfiguration" => @endpoint_configuration, "endpointExportName" => @endpoint_export_name, "endpointTypes" => @endpoint_types, "failOnWarnings" => @fail_on_warnings, "parameters" => @parameters, "policy" => @policy, "restApiName" => @rest_api_name, "retainDeployments" => @retain_deployments, "apiKeySourceType" => @api_key_source_type, "binaryMediaTypes" => @binary_media_types, "cloneFrom" => @clone_from, "minCompressionSize" => @min_compression_size, "minimumCompressionSize" => @minimum_compression_size, }) result.compact end |