class HttpStage (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Apigatewayv2.HttpStage |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsapigatewayv2#HttpStage |
Java | software.amazon.awscdk.services.apigatewayv2.HttpStage |
Python | aws_cdk.aws_apigatewayv2.HttpStage |
TypeScript (source) | aws-cdk-lib » aws_apigatewayv2 » HttpStage |
Implements
IConstruct
, IDependable
, IResource
, IHttp
, IStage
Represents a stage where an instance of the API is deployed.
Example
declare const api: apigwv2.HttpApi;
new apigwv2.HttpStage(this, 'Stage', {
httpApi: api,
stageName: 'beta',
description: 'My Stage',
});
Initializer
new HttpStage(scope: Construct, id: string, props: HttpStageProps)
Parameters
- scope
Construct
- id
string
- props
Http
Stage Props
Construct Props
Name | Type | Description |
---|---|---|
http | IHttp | The HTTP API to which this stage is associated. |
auto | boolean | Whether updates to an API automatically trigger a new deployment. |
description? | string | The description for the API stage. |
domain | Domain | The options for custom domain and api mapping. |
stage | string | The name of the stage. |
throttle? | Throttle | Throttle settings for the routes of this stage. |
httpApi
Type:
IHttp
The HTTP API to which this stage is associated.
autoDeploy?
Type:
boolean
(optional, default: false)
Whether updates to an API automatically trigger a new deployment.
description?
Type:
string
(optional, default: no description)
The description for the API stage.
domainMapping?
Type:
Domain
(optional, default: no custom domain and api mapping configuration)
The options for custom domain and api mapping.
stageName?
Type:
string
(optional, default: '$default' the default stage of the API. This stage will have the URL at the root of the API endpoint.)
The name of the stage.
See StageName
class for more details.
throttle?
Type:
Throttle
(optional, default: no throttling configuration)
Throttle settings for the routes of this stage.
Properties
Name | Type | Description |
---|---|---|
api | IHttp | The API this stage is associated to. |
base | IApi | |
domain | string | The custom domain URL to this stage. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
stage | string | The name of the stage; |
url | string | The URL to this stage. |
api
Type:
IHttp
The API this stage is associated to.
baseApi
Type:
IApi
domainUrl
Type:
string
The custom domain URL to this stage.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
stageName
Type:
string
The name of the stage;
its primary identifier.
url
Type:
string
The URL to this stage.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
metric(metricName, props?) | Return the given named metric for this HTTP Api Gateway Stage. |
metric | Metric for the number of client-side errors captured in a given period. |
metric | Metric for the total number API requests in a given period. |
metric | Metric for the amount of data processed in bytes. |
metric | Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend. |
metric | The time between when API Gateway receives a request from a client and when it returns a response to the client. |
metric | Metric for the number of server-side errors captured in a given period. |
to | Returns a string representation of this construct. |
static from | Import an existing stage into this CDK app. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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
).
metric(metricName, props?)
public metric(metricName: string, props?: MetricOptions): Metric
Parameters
- metricName
string
- props
Metric
Options
Returns
Return the given named metric for this HTTP Api Gateway Stage.
ClientError(props?)
metricpublic metricClientError(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of client-side errors captured in a given period.
Count(props?)
metricpublic metricCount(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the total number API requests in a given period.
DataProcessed(props?)
metricpublic metricDataProcessed(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the amount of data processed in bytes.
IntegrationLatency(props?)
metricpublic metricIntegrationLatency(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.
Latency(props?)
metricpublic metricLatency(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
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.
ServerError(props?)
metricpublic metricServerError(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of server-side errors captured in a given period.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
HttpStageAttributes(scope, id, attrs)
static frompublic static fromHttpStageAttributes(scope: Construct, id: string, attrs: HttpStageAttributes): IHttpStage
Parameters
- scope
Construct
- id
string
- attrs
Http
Stage Attributes
Returns
Import an existing stage into this CDK app.