Table of Contents

Class Stage

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll
public class Stage : Resource, IStage, IResource, IConstruct, IConstruct, IDependable
Inheritance
Stage
Implements
IResource
IConstruct
IConstruct
IDependable

Examples

// production stage
            var prdLogGroup = new LogGroup(this, "PrdLogs");
            var api = new RestApi(this, "books", new RestApiProps {
                DeployOptions = new StageOptions {
                    AccessLogDestination = new LogGroupLogDestination(prdLogGroup),
                    AccessLogFormat = AccessLogFormat.JsonWithStandardFields()
                }
            });
            var deployment = new Deployment(this, "Deployment", new DeploymentProps { Api = api });

            // development stage
            var devLogGroup = new LogGroup(this, "DevLogs");
            new Stage(this, "dev", new StageProps {
                Deployment = deployment,
                AccessLogDestination = new LogGroupLogDestination(devLogGroup),
                AccessLogFormat = AccessLogFormat.JsonWithStandardFields(new JsonWithStandardFieldProps {
                    Caller = false,
                    HttpMethod = true,
                    Ip = true,
                    Protocol = true,
                    RequestTime = true,
                    ResourcePath = true,
                    ResponseLength = true,
                    Status = true,
                    User = true
                })
            });

Remarks

ExampleMetadata: infused

Constructors

Stage(Construct, string, IStageProps)

public Stage(Construct scope, string id, IStageProps props)

Parameters

scope Construct
id string
props IStageProps

Properties

RestApi

RestApi to which this stage is associated.

public virtual IRestApi RestApi { get; }

Property Value

IRestApi

StageArn

Returns the resource ARN for this stage:.

public virtual string StageArn { get; }

Property Value

string

Remarks

arn:aws:apigateway:{region}::/restapis/{restApiId}/stages/{stageName}

Note that this is separate from the execute-api ARN for methods and resources within this stage.

Attribute: true

StageName

Name of this stage.

public virtual string StageName { get; }

Property Value

string

Methods

UrlForPath(string?)

Returns the invoke URL for a certain path.

public virtual string UrlForPath(string? path = null)

Parameters

path string

The resource path.

Returns

string