Class: AWSCDK::APIGateway::SpecRestAPIProps
- Inherits:
-
RestAPIBaseProps
- Object
- RestAPIBaseProps
- AWSCDK::APIGateway::SpecRestAPIProps
- Defined in:
- api_gateway/spec_rest_api_props.rb
Overview
Props to instantiate a new SpecRestApi.
Instance Attribute Summary collapse
-
#api_definition ⇒ AWSCDK::APIGateway::APIDefinition
readonly
An OpenAPI definition compatible with API Gateway.
-
#binary_media_types ⇒ Array<String>?
readonly
The list of binary media mime-types that are supported by the SpecRestApi resource, such as "image/png" or "application/octet-stream".
-
#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.
-
#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.
-
#mode ⇒ AWSCDK::APIGateway::RestAPIMode?
readonly
The Mode that determines how API Gateway handles resource updates.
-
#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(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_definition:, binary_media_types: nil, min_compression_size: nil, mode: nil) ⇒ SpecRestAPIProps
constructor
A new instance of SpecRestAPIProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(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_definition:, binary_media_types: nil, min_compression_size: nil, mode: nil) ⇒ SpecRestAPIProps
Returns a new instance of SpecRestAPIProps.
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 62 63 64 65 |
# File 'api_gateway/spec_rest_api_props.rb', line 26 def initialize(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_definition:, binary_media_types: nil, min_compression_size: nil, mode: 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_definition = api_definition Jsii::Type.check_type(@api_definition, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5BcGlEZWZpbml0aW9uIn0=")), "apiDefinition") @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? @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? @mode = mode Jsii::Type.check_type(@mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5SZXN0QXBpTW9kZSJ9")), "mode") unless @mode.nil? end |
Instance Attribute Details
#api_definition ⇒ AWSCDK::APIGateway::APIDefinition (readonly)
An OpenAPI definition compatible with API Gateway.
179 180 181 |
# File 'api_gateway/spec_rest_api_props.rb', line 179 def api_definition @api_definition end |
#binary_media_types ⇒ Array<String>? (readonly)
Default: - SpecRestApi supports only UTF-8-encoded text payloads.
The list of binary media mime-types that are supported by the SpecRestApi resource, such as "image/png" or "application/octet-stream".
184 185 186 |
# File 'api_gateway/spec_rest_api_props.rb', line 184 def binary_media_types @binary_media_types 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.
71 72 73 |
# File 'api_gateway/spec_rest_api_props.rb', line 71 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.
78 79 80 |
# File 'api_gateway/spec_rest_api_props.rb', line 78 def cloud_watch_role_removal_policy @cloud_watch_role_removal_policy 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.
98 99 100 |
# File 'api_gateway/spec_rest_api_props.rb', line 98 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.
106 107 108 |
# File 'api_gateway/spec_rest_api_props.rb', line 106 def @deploy_options end |
#description ⇒ String? (readonly)
Default: - 'Automatically created by the RestApi construct'
A description of the RestApi construct.
111 112 113 |
# File 'api_gateway/spec_rest_api_props.rb', line 111 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.
120 121 122 |
# File 'api_gateway/spec_rest_api_props.rb', line 120 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.
125 126 127 |
# File 'api_gateway/spec_rest_api_props.rb', line 125 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.
131 132 133 |
# File 'api_gateway/spec_rest_api_props.rb', line 131 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.
136 137 138 |
# File 'api_gateway/spec_rest_api_props.rb', line 136 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.
144 145 146 |
# File 'api_gateway/spec_rest_api_props.rb', line 144 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.
149 150 151 |
# File 'api_gateway/spec_rest_api_props.rb', line 149 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.
194 195 196 |
# File 'api_gateway/spec_rest_api_props.rb', line 194 def min_compression_size @min_compression_size end |
#mode ⇒ AWSCDK::APIGateway::RestAPIMode? (readonly)
Default: - merge for REST APIs created after March 29, 2021, otherwise overwrite
The Mode that 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.
214 215 216 |
# File 'api_gateway/spec_rest_api_props.rb', line 214 def mode @mode end |
#parameters ⇒ Hash{String => String}? (readonly)
Default: - No parameters.
Custom header parameters for the request.
155 156 157 |
# File 'api_gateway/spec_rest_api_props.rb', line 155 def parameters @parameters end |
#policy ⇒ AWSCDK::IAM::PolicyDocument? (readonly)
Default: - No policy.
A policy document that contains the permissions for this RestApi.
160 161 162 |
# File 'api_gateway/spec_rest_api_props.rb', line 160 def policy @policy end |
#rest_api_name ⇒ String? (readonly)
Default: - ID of the RestApi construct.
A name for the API Gateway RestApi resource.
165 166 167 |
# File 'api_gateway/spec_rest_api_props.rb', line 165 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.
174 175 176 |
# File 'api_gateway/spec_rest_api_props.rb', line 174 def retain_deployments @retain_deployments end |
Class Method Details
.jsii_properties ⇒ Object
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'api_gateway/spec_rest_api_props.rb', line 216 def self.jsii_properties { :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_definition => "apiDefinition", :binary_media_types => "binaryMediaTypes", :min_compression_size => "minCompressionSize", :mode => "mode", } end |
Instance Method Details
#to_jsii ⇒ Object
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'api_gateway/spec_rest_api_props.rb', line 240 def to_jsii result = {} result.merge!(super) result.merge!({ "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, "apiDefinition" => @api_definition, "binaryMediaTypes" => @binary_media_types, "minCompressionSize" => @min_compression_size, "mode" => @mode, }) result.compact end |