HttpStageProps Struct
Properties to initialize an instance of HttpStage.
| Source | aws-apigatewayv2/lib/http/stage.ts |
|---|---|
| Type last changed |
Example
ts
import * as apigw from 'aws-cdk-lib/aws-apigateway';
import * as logs from 'aws-cdk-lib/aws-logs';
declare const api: apigwv2.HttpApi;
declare const logGroup: logs.LogGroup;
const stage = new apigwv2.HttpStage(this, 'Stage', {
httpApi: api,
accessLogSettings: {
destination: new apigwv2.LogGroupLogDestination(logGroup),
format: apigw.AccessLogFormat.clf(),
},
});
python
import aws_cdk.aws_apigateway as apigw
import aws_cdk.aws_logs as logs
# api: apigwv2.HttpApi
# log_group: logs.LogGroup
stage = apigwv2.HttpStage(self, "Stage",
http_api=api,
access_log_settings={
"destination": apigwv2.LogGroupLogDestination(log_group),
"format": apigw.AccessLogFormat.clf()
}
)
java
import software.amazon.awscdk.services.apigateway.*;
import software.amazon.awscdk.services.logs.*;
HttpApi api;
LogGroup logGroup;
HttpStage stage = HttpStage.Builder.create(this, "Stage")
.httpApi(api)
.accessLogSettings(Map.of(
"destination", new LogGroupLogDestination(logGroup),
"format", AccessLogFormat.clf()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.APIGateway;
using Amazon.CDK.AWS.Logs;
HttpApi api;
LogGroup logGroup;
var stage = new HttpStage(this, "Stage", new HttpStageProps {
HttpApi = api,
AccessLogSettings = new Dictionary<string, object> {
{ "destination", new LogGroupLogDestination(logGroup) },
{ "format", AccessLogFormat.Clf() }
}
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import apigw "github.com/aws/aws-cdk-go/awscdk"
import logs "github.com/aws/aws-cdk-go/awscdk"
var api HttpApi
var logGroup LogGroup
stage := apigwv2.NewHttpStage(this, jsii.String("Stage"), &HttpStageProps{
HttpApi: api,
AccessLogSettings: map[string]interface{}{
"destination": apigwv2.NewLogGroupLogDestination(logGroup),
"format": apigw.AccessLogFormat_clf(),
},
})
Properties
accessLogSettingsoptionalIAccessLogSettingsaccess_log_settingsoptionalIAccessLogSettingsaccessLogSettingsoptionalIAccessLogSettingsAccessLogSettingsoptionalIAccessLogSettingsAccessLogSettingsoptionalIAccessLogSettings #Settings for access logging.
Default: No access logging
autoDeployoptionalbooleanauto_deployoptionalboolautoDeployoptionalBooleanAutoDeployoptionalboolAutoDeployoptional*bool = false #Whether updates to an API automatically trigger a new deployment.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #The description for the API stage.
Default: no description
detailedMetricsEnabledoptionalbooleandetailed_metrics_enabledoptionalbooldetailedMetricsEnabledoptionalBooleanDetailedMetricsEnabledoptionalboolDetailedMetricsEnabledoptional*bool = false #Specifies whether detailed metrics are enabled.
domainMappingoptionalDomainMappingOptionsdomain_mappingoptionalDomainMappingOptionsdomainMappingoptionalDomainMappingOptionsDomainMappingoptionalDomainMappingOptionsDomainMappingoptionalDomainMappingOptions #The options for custom domain and api mapping.
Default: no custom domain and api mapping configuration
httpApiIHttpApiRefhttp_apiIHttpApiRefhttpApiIHttpApiRefHttpApiIHttpApiRefHttpApiIHttpApiRef required #The HTTP API to which this stage is associated.
stageNameoptionalstringstage_nameoptionalstrstageNameoptionalStringStageNameoptionalstringStageNameoptional*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.
stageVariablesoptional{ [key: string]: string }stage_variablesoptionaltyping.Mapping[str, str]stageVariablesoptionalMap<String, String>StageVariablesoptionalIDictionary<string, string>StageVariablesoptional*map[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
notes
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
throttleoptionalThrottleSettingsthrottleoptionalThrottleSettingsthrottleoptionalThrottleSettingsThrottleoptionalThrottleSettingsThrottleoptionalThrottleSettings #Throttle settings for the routes of this stage.
Default: no throttling configuration