Class: AWSCDK::APIGateway::RestAPIBaseProps

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

Overview

Represents the props that all Rest APIs share.

Direct Known Subclasses

SpecRestAPIProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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) ⇒ RestAPIBaseProps

Returns a new instance of RestAPIBaseProps.

Parameters:

  • cloud_watch_role (Boolean, nil) (defaults to: nil)

    Automatically configure an AWS CloudWatch role for API Gateway.

  • cloud_watch_role_removal_policy (AWSCDK::RemovalPolicy, nil) (defaults to: nil)

    The removal policy applied to the AWS CloudWatch role when this resource is removed from the application.

  • deploy (Boolean, nil) (defaults to: nil)

    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, nil) (defaults to: nil)

    Options for the API Gateway stage that will always point to the latest deployment when deploy is enabled.

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

    A description of the RestApi construct.

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

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

  • domain_name (AWSCDK::APIGateway::DomainNameOptions, nil) (defaults to: nil)

    Configure a custom domain name and map it to this API.

  • endpoint_configuration (AWSCDK::APIGateway::EndpointConfiguration, nil) (defaults to: nil)

    The EndpointConfiguration property type specifies the endpoint types of a REST API.

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

    Export name for the CfnOutput containing the API endpoint.

  • endpoint_types (Array<AWSCDK::APIGateway::EndpointType>, nil) (defaults to: nil)

    A list of the endpoint types of the API.

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

    Indicates whether to roll back the resource if a warning occurs while API Gateway is creating the RestApi resource.

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

    Custom header parameters for the request.

  • policy (AWSCDK::IAM::PolicyDocument, nil) (defaults to: nil)

    A policy document that contains the permissions for this RestApi.

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

    A name for the API Gateway RestApi resource.

  • retain_deployments (Boolean, nil) (defaults to: nil)

    Retains old deployment resources when the API changes.



22
23
24
25
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
# File 'api_gateway/rest_api_base_props.rb', line 22

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)
  @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 = deploy_options.is_a?(Hash) ? ::AWSCDK::APIGateway::StageOptions.new(**deploy_options.transform_keys(&:to_sym)) : deploy_options
  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?
end

Instance Attribute Details

#cloud_watch_roleBoolean? (readonly)

Note:

Default: - false if @aws-cdk/aws-apigateway:disableCloudWatchRole is enabled, true otherwise

Automatically configure an AWS CloudWatch role for API Gateway.

Returns:

  • (Boolean, nil)


59
60
61
# File 'api_gateway/rest_api_base_props.rb', line 59

def cloud_watch_role
  @cloud_watch_role
end

#cloud_watch_role_removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

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.

Returns:



66
67
68
# File 'api_gateway/rest_api_base_props.rb', line 66

def cloud_watch_role_removal_policy
  @cloud_watch_role_removal_policy
end

#deployBoolean? (readonly)

Note:

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.

Returns:

  • (Boolean, nil)


86
87
88
# File 'api_gateway/rest_api_base_props.rb', line 86

def deploy
  @deploy
end

#deploy_optionsAWSCDK::APIGateway::StageOptions? (readonly)

Note:

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.



94
95
96
# File 'api_gateway/rest_api_base_props.rb', line 94

def deploy_options
  @deploy_options
end

#descriptionString? (readonly)

Note:

Default: - 'Automatically created by the RestApi construct'

A description of the RestApi construct.

Returns:

  • (String, nil)


99
100
101
# File 'api_gateway/rest_api_base_props.rb', line 99

def description
  @description
end

#disable_execute_api_endpointBoolean? (readonly)

Note:

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.



108
109
110
# File 'api_gateway/rest_api_base_props.rb', line 108

def disable_execute_api_endpoint
  @disable_execute_api_endpoint
end

#domain_nameAWSCDK::APIGateway::DomainNameOptions? (readonly)

Note:

Default: - no domain name is defined, use addDomainName or directly define a DomainName.

Configure a custom domain name and map it to this API.



113
114
115
# File 'api_gateway/rest_api_base_props.rb', line 113

def domain_name
  @domain_name
end

#endpoint_configurationAWSCDK::APIGateway::EndpointConfiguration? (readonly)

Note:

Default: EndpointType.EDGE

The EndpointConfiguration property type specifies the endpoint types of a REST API.



119
120
121
# File 'api_gateway/rest_api_base_props.rb', line 119

def endpoint_configuration
  @endpoint_configuration
end

#endpoint_export_nameString? (readonly)

Note:

Default: - when no export name is given, output will be created without export

Export name for the CfnOutput containing the API endpoint.

Returns:

  • (String, nil)


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

def endpoint_export_name
  @endpoint_export_name
end

#endpoint_typesArray<AWSCDK::APIGateway::EndpointType>? (readonly)

Note:

Default: EndpointType.EDGE

A list of the endpoint types of the API.

Use this property when creating an API.

Returns:



132
133
134
# File 'api_gateway/rest_api_base_props.rb', line 132

def endpoint_types
  @endpoint_types
end

#fail_on_warningsBoolean? (readonly)

Note:

Default: false

Indicates whether to roll back the resource if a warning occurs while API Gateway is creating the RestApi resource.

Returns:

  • (Boolean, nil)


137
138
139
# File 'api_gateway/rest_api_base_props.rb', line 137

def fail_on_warnings
  @fail_on_warnings
end

#parametersHash{String => String}? (readonly)

Note:

Default: - No parameters.

Custom header parameters for the request.



143
144
145
# File 'api_gateway/rest_api_base_props.rb', line 143

def parameters
  @parameters
end

#policyAWSCDK::IAM::PolicyDocument? (readonly)

Note:

Default: - No policy.

A policy document that contains the permissions for this RestApi.

Returns:



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

def policy
  @policy
end

#rest_api_nameString? (readonly)

Note:

Default: - ID of the RestApi construct.

A name for the API Gateway RestApi resource.

Returns:

  • (String, nil)


153
154
155
# File 'api_gateway/rest_api_base_props.rb', line 153

def rest_api_name
  @rest_api_name
end

#retain_deploymentsBoolean? (readonly)

Note:

Default: false

Retains old deployment resources when the API changes.

This allows manually reverting stages to point to old deployments via the AWS Console.

Returns:

  • (Boolean, nil)


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

def retain_deployments
  @retain_deployments
end

Class Method Details

.jsii_propertiesObject



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'api_gateway/rest_api_base_props.rb', line 164

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",
  }
end

Instance Method Details

#to_jsiiObject



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

def to_jsii
  result = {}
  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,
  })
  result.compact
end