Class WebSocketStage

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.apigatewayv2.WebSocketStage
All Implemented Interfaces:
IResource, IStage, IWebSocketStage, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:12.114Z") @Stability(Stable) public class WebSocketStage extends Resource implements IWebSocketStage, IStage
Represents a stage where an instance of the API is deployed.

Example:

 import software.amazon.awscdk.aws_apigatewayv2_integrations.WebSocketLambdaIntegration;
 Function connectHandler;
 Function disconnectHandler;
 Function defaultHandler;
 WebSocketApi webSocketApi = WebSocketApi.Builder.create(this, "mywsapi")
         .connectRouteOptions(WebSocketRouteOptions.builder().integration(new WebSocketLambdaIntegration("ConnectIntegration", connectHandler)).build())
         .disconnectRouteOptions(WebSocketRouteOptions.builder().integration(new WebSocketLambdaIntegration("DisconnectIntegration", disconnectHandler)).build())
         .defaultRouteOptions(WebSocketRouteOptions.builder().integration(new WebSocketLambdaIntegration("DefaultIntegration", defaultHandler)).build())
         .build();
 WebSocketStage.Builder.create(this, "mystage")
         .webSocketApi(webSocketApi)
         .stageName("dev")
         .autoDeploy(true)
         .build();
 
  • Constructor Details

    • WebSocketStage

      protected WebSocketStage(software.amazon.jsii.JsiiObjectRef objRef)
    • WebSocketStage

      protected WebSocketStage(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • WebSocketStage

      @Stability(Stable) public WebSocketStage(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull WebSocketStageProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromWebSocketStageAttributes

      @Stability(Stable) @NotNull public static IWebSocketStage fromWebSocketStageAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull WebSocketStageAttributes attrs)
      Import an existing stage into this CDK app.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • grantManagementApiAccess

      @Stability(Stable) @NotNull public Grant grantManagementApiAccess(@NotNull IGrantable identity)
      Grant access to the API Gateway management API for this WebSocket API Stage to an IAM principal (Role/Group/User).

      Parameters:
      identity - The principal. This parameter is required.
    • metric

      @Stability(Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props)
      Return the given named metric for this HTTP Api Gateway Stage.

      Specified by:
      metric in interface IStage
      Parameters:
      metricName - This parameter is required.
      props -
    • metric

      @Stability(Stable) @NotNull public Metric metric(@NotNull String metricName)
      Return the given named metric for this HTTP Api Gateway Stage.

      Specified by:
      metric in interface IStage
      Parameters:
      metricName - This parameter is required.
    • getApi

      @Stability(Stable) @NotNull public IWebSocketApi getApi()
      The API this stage is associated to.
      Specified by:
      getApi in interface IWebSocketStage
    • getBaseApi

      @Stability(Stable) @NotNull protected IApi getBaseApi()
    • getCallbackUrl

      @Stability(Stable) @NotNull public String getCallbackUrl()
      The callback URL to this stage.
      Specified by:
      getCallbackUrl in interface IWebSocketStage
    • getStageName

      @Stability(Stable) @NotNull public String getStageName()
      The name of the stage;

      its primary identifier.

      Specified by:
      getStageName in interface IStage
    • getUrl

      @Stability(Stable) @NotNull public String getUrl()
      The websocket URL to this stage.
      Specified by:
      getUrl in interface IStage