Table of Contents

Class StageProps

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll
public class StageProps : IStageProps, IStageOptions, IMethodDeploymentOptions
Inheritance
StageProps
Implements
Inherited Members

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

StageProps()

public StageProps()

Properties

AccessLogDestination

The CloudWatch Logs log group.

public IAccessLogDestination? AccessLogDestination { get; set; }

Property Value

IAccessLogDestination

Remarks

Default: - No destination

AccessLogFormat

A single line format of access logs of data, as specified by selected $content variables.

public AccessLogFormat? AccessLogFormat { get; set; }

Property Value

AccessLogFormat

Remarks

The format must include at least AccessLogFormat.contextRequestId().

Default: - Common Log Format

See: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference

CacheClusterEnabled

Indicates whether cache clustering is enabled for the stage.

public bool? CacheClusterEnabled { get; set; }

Property Value

bool?

Remarks

Default: - Disabled for the stage.

CacheClusterSize

The stage's cache cluster size.

public string? CacheClusterSize { get; set; }

Property Value

string

Remarks

Default: 0.5

CacheDataEncrypted

Indicates whether the cached responses are encrypted.

public bool? CacheDataEncrypted { get; set; }

Property Value

bool?

Remarks

Default: false

CacheTtl

Specifies the time to live (TTL), in seconds, for cached responses.

public Duration? CacheTtl { get; set; }

Property Value

Duration

Remarks

The higher the TTL, the longer the response will be cached.

Default: Duration.minutes(5)

See: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html

CachingEnabled

Specifies whether responses should be cached and returned for requests.

public bool? CachingEnabled { get; set; }

Property Value

bool?

Remarks

A cache cluster must be enabled on the stage for responses to be cached.

Default: - Caching is Disabled.

ClientCertificateId

The identifier of the client certificate that API Gateway uses to call your integration endpoints in the stage.

public string? ClientCertificateId { get; set; }

Property Value

string

Remarks

Default: - None.

DataTraceEnabled

Specifies whether data trace logging is enabled for this method.

public bool? DataTraceEnabled { get; set; }

Property Value

bool?

Remarks

When enabled, API gateway will log the full API requests and responses. This can be useful to troubleshoot APIs, but can result in logging sensitive data. We recommend that you don't enable this feature for production APIs.

Default: false

Deployment

The deployment that this stage points to [disable-awslint:ref-via-interface].

public Deployment Deployment { get; set; }

Property Value

Deployment

Description

A description of the purpose of the stage.

public string? Description { get; set; }

Property Value

string

Remarks

Default: - No description.

DocumentationVersion

The version identifier of the API documentation snapshot.

public string? DocumentationVersion { get; set; }

Property Value

string

Remarks

Default: - No documentation version.

LoggingLevel

Specifies the logging level for this method, which effects the log entries pushed to Amazon CloudWatch Logs.

public MethodLoggingLevel? LoggingLevel { get; set; }

Property Value

MethodLoggingLevel?

Remarks

Default: - Off

MethodOptions

Method deployment options for specific resources/methods.

public IDictionary<string, IMethodDeploymentOptions>? MethodOptions { get; set; }

Property Value

IDictionary<string, IMethodDeploymentOptions>

Remarks

These will override common options defined in StageOptions#methodOptions.

Default: - Common options will be used.

MetricsEnabled

Specifies whether Amazon CloudWatch metrics are enabled for this method.

public bool? MetricsEnabled { get; set; }

Property Value

bool?

Remarks

Default: false

StageName

The name of the stage, which API Gateway uses as the first path segment in the invoked Uniform Resource Identifier (URI).

public string? StageName { get; set; }

Property Value

string

Remarks

Default: - "prod"

ThrottlingBurstLimit

Specifies the throttling burst limit.

public double? ThrottlingBurstLimit { get; set; }

Property Value

double?

Remarks

The total rate of all requests in your AWS account is limited to 5,000 requests.

Default: - No additional restriction.

See: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html

ThrottlingRateLimit

Specifies the throttling rate limit.

public double? ThrottlingRateLimit { get; set; }

Property Value

double?

Remarks

The total rate of all requests in your AWS account is limited to 10,000 requests per second (rps).

Default: - No additional restriction.

See: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html

TracingEnabled

Specifies whether Amazon X-Ray tracing is enabled for this method.

public bool? TracingEnabled { get; set; }

Property Value

bool?

Remarks

Default: false

Variables

A map that defines the stage variables.

public IDictionary<string, string>? Variables { get; set; }

Property Value

IDictionary<string, string>

Remarks

Variable names must consist of alphanumeric characters, and the values must match the following regular expression: [A-Za-z0-9-._~:/?#&=,]+.

Default: - No stage variables.