# HttpStageOptions

The options to create a new Stage for an HTTP API.

Extends: [StageOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.StageOptions.html)
Used as argument in: [HttpApi.addStage](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.HttpApi.html#addstage)

- Source: [`aws-apigatewayv2/lib/http/stage.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigatewayv2/lib/http/stage.ts#L95)
- Type last changed: v2.112.0 · 1 Dec 2023

## Example

TypeScript:

```ts
declare const api: apigwv2.HttpApi;
declare const dn: apigwv2.DomainName;

api.addStage('beta', {
  stageName: 'beta',
  autoDeploy: true,
  // https://${dn.domainName}/bar goes to the beta stage
  domainMapping: {
    domainName: dn,
    mappingKey: 'bar',
  },
});
```

Python:

```python
# api: apigwv2.HttpApi
# dn: apigwv2.DomainName

api.add_stage("beta",
    stage_name="beta",
    auto_deploy=True,
    # https://${dn.domainName}/bar goes to the beta stage
    domain_mapping=apigwv2.DomainMappingOptions(
        domain_name=dn,
        mapping_key="bar"
    )
)
```

Java:

```java
HttpApi api;
DomainName dn;

api.addStage("beta", HttpStageOptions.builder()
        .stageName("beta")
        .autoDeploy(true)
        // https://${dn.domainName}/bar goes to the beta stage
        .domainMapping(DomainMappingOptions.builder()
                .domainName(dn)
                .mappingKey("bar")
                .build())
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
HttpApi api;
DomainName dn;

api.AddStage("beta", new HttpStageOptions {
    StageName = "beta",
    AutoDeploy = true,
    // https://${dn.domainName}/bar goes to the beta stage
    DomainMapping = new DomainMappingOptions {
        DomainName = dn,
        MappingKey = "bar"
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var api HttpApi
var dn DomainName

api.AddStage(jsii.String("beta"), &HttpStageOptions{
	StageName: jsii.String("beta"),
	AutoDeploy: jsii.Boolean(true),
	// https://${dn.domainName}/bar goes to the beta stage
	DomainMapping: &DomainMappingOptions{
		DomainName: dn,
		MappingKey: jsii.String("bar"),
	},
})
```

## Properties

- `accessLogSettings`: [IAccessLogSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.IAccessLogSettings.html) — Settings for access logging.

  **Default:** No access logging

- `autoDeploy`: boolean = false — Whether updates to an API automatically trigger a new deployment.

- `description`: string — The description for the API stage.

  **Default:** no description

- `detailedMetricsEnabled`: boolean = false — Specifies whether detailed metrics are enabled.

- `domainMapping`: [DomainMappingOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.DomainMappingOptions.html) — The options for custom domain and api mapping.

  **Default:** no custom domain and api mapping configuration

- `stageName`: string — The name of the stage.

  **Default:** '$default' the default stage of the API. This stage will have the URL at the root of the API endpoint.

  See `StageName` class for more details.

- `stageVariables`: { [key: string]: string } — Stage variables for the stage. These are key-value pairs that you can define and use in your API routes.

  **Default:** No stage variables

  The allowed characters for variable names and the required pattern for variable values are specified here: https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-apigateway-stage.html#cfn-apigateway-stage-variables

- `throttle`: [ThrottleSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.ThrottleSettings.html) — Throttle settings for the routes of this stage.

  **Default:** no throttling configuration
