Skip to content
v2.278.0

WebSocketStageProps Struct ​

Properties to initialize an instance of WebSocketStage.

Example ​

ts
import * as logs from 'aws-cdk-lib/aws-logs';

declare const httpApi: apigwv2.HttpApi;
declare const webSocketApi : apigwv2.WebSocketApi;
declare const logGroup: logs.LogGroup;

new apigwv2.HttpStage(this, 'HttpStage', {
  httpApi,
  accessLogSettings: {
    destination: new apigwv2.LogGroupLogDestination(logGroup),
  },
});

new apigwv2.WebSocketStage(this, 'WebSocketStage', {
  webSocketApi,
  stageName: 'dev',
  accessLogSettings: {
    destination: new apigwv2.LogGroupLogDestination(logGroup),
  },
});
python
import aws_cdk.aws_logs as logs

# http_api: apigwv2.HttpApi
# web_socket_api: apigwv2.WebSocketApi
# log_group: logs.LogGroup


apigwv2.HttpStage(self, "HttpStage",
    http_api=http_api,
    access_log_settings={
        "destination": apigwv2.LogGroupLogDestination(log_group)
    }
)

apigwv2.WebSocketStage(self, "WebSocketStage",
    web_socket_api=web_socket_api,
    stage_name="dev",
    access_log_settings={
        "destination": apigwv2.LogGroupLogDestination(log_group)
    }
)
java
import software.amazon.awscdk.services.logs.*;

HttpApi httpApi;
WebSocketApi webSocketApi;
LogGroup logGroup;


HttpStage.Builder.create(this, "HttpStage")
        .httpApi(httpApi)
        .accessLogSettings(Map.of(
                "destination", new LogGroupLogDestination(logGroup)))
        .build();

WebSocketStage.Builder.create(this, "WebSocketStage")
        .webSocketApi(webSocketApi)
        .stageName("dev")
        .accessLogSettings(Map.of(
                "destination", new LogGroupLogDestination(logGroup)))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.Logs;

HttpApi httpApi;
WebSocketApi webSocketApi;
LogGroup logGroup;


new HttpStage(this, "HttpStage", new HttpStageProps {
    HttpApi = httpApi,
    AccessLogSettings = new Dictionary<string, IAccessLogDestination> {
        { "destination", new LogGroupLogDestination(logGroup) }
    }
});

new WebSocketStage(this, "WebSocketStage", new WebSocketStageProps {
    WebSocketApi = webSocketApi,
    StageName = "dev",
    AccessLogSettings = new Dictionary<string, IAccessLogDestination> {
        { "destination", new LogGroupLogDestination(logGroup) }
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import logs "github.com/aws/aws-cdk-go/awscdk"

var httpApi HttpApi
var webSocketApi WebSocketApi
var logGroup LogGroup


apigwv2.NewHttpStage(this, jsii.String("HttpStage"), &HttpStageProps{
	HttpApi: HttpApi,
	AccessLogSettings: map[string]IAccessLogDestination{
		"destination": apigwv2.NewLogGroupLogDestination(logGroup),
	},
})

apigwv2.NewWebSocketStage(this, jsii.String("WebSocketStage"), &WebSocketStageProps{
	WebSocketApi: WebSocketApi,
	StageName: jsii.String("dev"),
	AccessLogSettings: map[string]IAccessLogDestination{
		"destination": apigwv2.NewLogGroupLogDestination(logGroup),
	},
})

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

stageNamestringstage_namestrstageNameStringStageNamestringStageName*string required #
The name of the stage.
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

webSocketApiIWebSocketApiweb_socket_apiIWebSocketApiwebSocketApiIWebSocketApiWebSocketApiIWebSocketApiWebSocketApiIWebSocketApi required #
The WebSocket API to which this stage is associated.