Module: AWSCDK::APIGatewayv2::IHttpAPI

Includes:
IAPI, IHttpAPIRef
Included in:
HttpAPI
Defined in:
api_gatewayv2/i_http_api.rb

Overview

Represents an HTTP API.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'api_gatewayv2/i_http_api.rb', line 233

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :api_ref => { kind: :property, name: "apiRef", is_optional: false },
    :api_endpoint => { kind: :property, name: "apiEndpoint", is_optional: false },
    :api_id => { kind: :property, name: "apiId", is_optional: false },
    :is_http_api => { kind: :property, name: "isHttpApi", is_optional: false },
    :default_authorization_scopes => { kind: :property, name: "defaultAuthorizationScopes", is_optional: true },
    :default_authorizer => { kind: :property, name: "defaultAuthorizer", is_optional: true },
    :default_stage => { kind: :property, name: "defaultStage", is_optional: true },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :metric => { kind: :method, name: "metric", is_optional: false },
    :add_vpc_link => { kind: :method, name: "addVpcLink", is_optional: false },
    :arn_for_execute_api => { kind: :method, name: "arnForExecuteApi", is_optional: false },
    :metric_client_error => { kind: :method, name: "metricClientError", is_optional: false },
    :metric_count => { kind: :method, name: "metricCount", is_optional: false },
    :metric_data_processed => { kind: :method, name: "metricDataProcessed", is_optional: false },
    :metric_integration_latency => { kind: :method, name: "metricIntegrationLatency", is_optional: false },
    :metric_latency => { kind: :method, name: "metricLatency", is_optional: false },
    :metric_server_error => { kind: :method, name: "metricServerError", is_optional: false },
  }
end

Instance Method Details

Add a new VpcLink.



143
144
145
146
147
# File 'api_gatewayv2/i_http_api.rb', line 143

def add_vpc_link(options)
  options = options.is_a?(Hash) ? ::AWSCDK::APIGatewayv2::VPCLinkProps.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheXYyLlZwY0xpbmtQcm9wcyJ9")), "options")
  jsii_call_method("addVpcLink", [options])
end

#api_endpointString

The default endpoint for an API.

Returns:

  • (String)


48
49
50
# File 'api_gatewayv2/i_http_api.rb', line 48

def api_endpoint()
  jsii_get_property("apiEndpoint")
end

#api_idString

The identifier of this API Gateway API.

Returns:

  • (String)


55
56
57
# File 'api_gatewayv2/i_http_api.rb', line 55

def api_id()
  jsii_get_property("apiId")
end

#api_refAWSCDK::Interfaces::AWSApigatewayv2::APIReference

A reference to a Api resource.



41
42
43
# File 'api_gatewayv2/i_http_api.rb', line 41

def api_ref()
  jsii_get_property("apiRef")
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



121
122
123
124
# File 'api_gatewayv2/i_http_api.rb', line 121

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#arn_for_execute_api(method = nil, path = nil, stage = nil) ⇒ String

Note:

Default: - The default behavior applies when no specific method, path, or stage is provided. In this case, the ARN will cover all methods, all resources, and all stages of this API. Specifically, if 'method' is not specified, it defaults to '', representing all methods. If 'path' is not specified, it defaults to '/', representing all paths. If 'stage' is not specified, it also defaults to '*', representing all stages.

Get the "execute-api" ARN.

When 'ANY' is passed to the method, an ARN with the method set to '*' is obtained.

Parameters:

  • method (String, nil) (defaults to: nil)
  • path (String, nil) (defaults to: nil)
  • stage (String, nil) (defaults to: nil)

Returns:

  • (String)


158
159
160
161
162
163
# File 'api_gatewayv2/i_http_api.rb', line 158

def arn_for_execute_api(method = nil, path = nil, stage = nil)
  Jsii::Type.check_type(method, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "method") unless method.nil?
  Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path") unless path.nil?
  Jsii::Type.check_type(stage, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stage") unless stage.nil?
  jsii_call_method("arnForExecuteApi", [method, path, stage])
end

#default_authorization_scopesArray<String>?

Note:

Default: - no default authorization scopes

Default OIDC scopes attached to all routes in the gateway, unless explicitly configured on the route.

The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation.

Returns:

  • (Array<String>, nil)


75
76
77
# File 'api_gatewayv2/i_http_api.rb', line 75

def default_authorization_scopes()
  jsii_get_property("defaultAuthorizationScopes")
end

#default_authorizerAWSCDK::APIGatewayv2::IHttpRouteAuthorizer?

Note:

Default: - no default authorizer

Default Authorizer applied to all routes in the gateway.



83
84
85
# File 'api_gatewayv2/i_http_api.rb', line 83

def default_authorizer()
  jsii_get_property("defaultAuthorizer")
end

#default_stageAWSCDK::APIGatewayv2::IHttpStage?

Note:

Default: - a stage will be created

The default stage of this API.



91
92
93
# File 'api_gatewayv2/i_http_api.rb', line 91

def default_stage()
  jsii_get_property("defaultStage")
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



27
28
29
# File 'api_gatewayv2/i_http_api.rb', line 27

def env()
  jsii_get_property("env")
end

#is_http_apiBoolean

Indicates that this is an HTTP API.

Will always return true, but is necessary to prevent accidental structural equality in TypeScript.

Returns:

  • (Boolean)


65
66
67
# File 'api_gatewayv2/i_http_api.rb', line 65

def is_http_api()
  jsii_get_property("isHttpApi")
end

#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric

Note:

Default: - average over 5 minutes

Return the given named metric for this Api Gateway.

Parameters:

Returns:



132
133
134
135
136
137
# File 'api_gatewayv2/i_http_api.rb', line 132

def metric(metric_name, props = nil)
  Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metric", [metric_name, props])
end

#metric_client_error(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Note:

Default: - sum over 5 minutes

Metric for the number of client-side errors captured in a given period.

Parameters:

Returns:



170
171
172
173
174
# File 'api_gatewayv2/i_http_api.rb', line 170

def metric_client_error(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricClientError", [props])
end

#metric_count(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Note:

Default: - SampleCount over 5 minutes

Metric for the total number API requests in a given period.

Parameters:

Returns:



181
182
183
184
185
# File 'api_gatewayv2/i_http_api.rb', line 181

def metric_count(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricCount", [props])
end

#metric_data_processed(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Note:

Default: - sum over 5 minutes

Metric for the amount of data processed in bytes.

Parameters:

Returns:



192
193
194
195
196
# File 'api_gatewayv2/i_http_api.rb', line 192

def metric_data_processed(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricDataProcessed", [props])
end

#metric_integration_latency(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Note:

Default: - no statistic

Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.

Parameters:

Returns:



203
204
205
206
207
# File 'api_gatewayv2/i_http_api.rb', line 203

def metric_integration_latency(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricIntegrationLatency", [props])
end

#metric_latency(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Note:

Default: - no statistic

The time between when API Gateway receives a request from a client and when it returns a response to the client.

The latency includes the integration latency and other API Gateway overhead.

Parameters:

Returns:



216
217
218
219
220
# File 'api_gatewayv2/i_http_api.rb', line 216

def metric_latency(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricLatency", [props])
end

#metric_server_error(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Note:

Default: - sum over 5 minutes

Metric for the number of server-side errors captured in a given period.

Parameters:

Returns:



227
228
229
230
231
# File 'api_gatewayv2/i_http_api.rb', line 227

def metric_server_error(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricServerError", [props])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


12
13
14
# File 'api_gatewayv2/i_http_api.rb', line 12

def node()
  jsii_get_property("node")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



34
35
36
# File 'api_gatewayv2/i_http_api.rb', line 34

def stack()
  jsii_get_property("stack")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



102
103
104
105
106
107
# File 'api_gatewayv2/i_http_api.rb', line 102

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end