Show / Hide Table of Contents

Class Deployment

A Deployment of a REST API.

Inheritance
object
Resource
Deployment
Implements
IResource
IConstruct
IDependable
IEnvironmentAware
Inherited Members
Resource.IsOwnedResource(IConstruct)
Resource.IsResource(IConstruct)
Resource.ApplyRemovalPolicy(RemovalPolicy)
Resource.GeneratePhysicalName()
Resource.GetResourceArnAttribute(string, IArnComponents)
Resource.GetResourceNameAttribute(string)
Resource.Env
Resource.PhysicalName
Resource.Stack
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Deployment : Resource, IResource, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class Deployment Inherits Resource Implements IResource, IConstruct, IDependable, IEnvironmentAware
Remarks

An immutable representation of a RestApi resource that can be called by users using Stages. A deployment must be associated with a Stage for it to be callable over the Internet.

Normally, you don't need to define deployments manually. The RestApi construct manages a Deployment resource that represents the latest model. It can be accessed through restApi.latestDeployment (unless deploy: false is set when defining the RestApi).

If you manually define this resource, you will need to know that since deployments are immutable, as long as the resource's logical ID doesn't change, the deployment will represent the snapshot in time in which the resource was created. This means that if you modify the RestApi model (i.e. add methods or resources), these changes will not be reflected unless a new deployment resource is created.

To achieve this behavior, the method addToLogicalId(data) can be used to augment the logical ID generated for the deployment resource such that it will include arbitrary data. This is done automatically for the restApi.latestDeployment deployment.

Furthermore, since a deployment does not reference any of the REST API resources and methods, CloudFormation will likely provision it before these resources are created, which means that it will represent a "half-baked" model. Use the node.addDependency(dep) method to circumvent that. This is done automatically for the restApi.latestDeployment deployment.

ExampleMetadata: infused

Examples
// production stage
             var prodLogGroup = new LogGroup(this, "PrdLogs");
             var api = new RestApi(this, "books", new RestApiProps {
                 DeployOptions = new StageOptions {
                     AccessLogDestination = new LogGroupLogDestination(prodLogGroup),
                     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
                 })
             });

Synopsis

Constructors

Deployment(Construct, string, IDeploymentProps)

A Deployment of a REST API.

Properties

Api

A Deployment of a REST API.

DeploymentId

A Deployment of a REST API.

PROPERTY_INJECTION_ID

Uniquely identifies this class.

StageName

The stage of the API gateway deployment.

Methods

AddToLogicalId(object)

Adds a component to the hash that determines this Deployment resource's logical ID.

Constructors

Deployment(Construct, string, IDeploymentProps)

A Deployment of a REST API.

public Deployment(Construct scope, string id, IDeploymentProps props)
Parameters
scope Construct
id string
props IDeploymentProps
Remarks

An immutable representation of a RestApi resource that can be called by users using Stages. A deployment must be associated with a Stage for it to be callable over the Internet.

Normally, you don't need to define deployments manually. The RestApi construct manages a Deployment resource that represents the latest model. It can be accessed through restApi.latestDeployment (unless deploy: false is set when defining the RestApi).

If you manually define this resource, you will need to know that since deployments are immutable, as long as the resource's logical ID doesn't change, the deployment will represent the snapshot in time in which the resource was created. This means that if you modify the RestApi model (i.e. add methods or resources), these changes will not be reflected unless a new deployment resource is created.

To achieve this behavior, the method addToLogicalId(data) can be used to augment the logical ID generated for the deployment resource such that it will include arbitrary data. This is done automatically for the restApi.latestDeployment deployment.

Furthermore, since a deployment does not reference any of the REST API resources and methods, CloudFormation will likely provision it before these resources are created, which means that it will represent a "half-baked" model. Use the node.addDependency(dep) method to circumvent that. This is done automatically for the restApi.latestDeployment deployment.

ExampleMetadata: infused

Examples
// production stage
             var prodLogGroup = new LogGroup(this, "PrdLogs");
             var api = new RestApi(this, "books", new RestApiProps {
                 DeployOptions = new StageOptions {
                     AccessLogDestination = new LogGroupLogDestination(prodLogGroup),
                     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
                 })
             });

Properties

Api

A Deployment of a REST API.

public virtual IRestApi Api { get; }
Property Value

IRestApi

Remarks

An immutable representation of a RestApi resource that can be called by users using Stages. A deployment must be associated with a Stage for it to be callable over the Internet.

Normally, you don't need to define deployments manually. The RestApi construct manages a Deployment resource that represents the latest model. It can be accessed through restApi.latestDeployment (unless deploy: false is set when defining the RestApi).

If you manually define this resource, you will need to know that since deployments are immutable, as long as the resource's logical ID doesn't change, the deployment will represent the snapshot in time in which the resource was created. This means that if you modify the RestApi model (i.e. add methods or resources), these changes will not be reflected unless a new deployment resource is created.

To achieve this behavior, the method addToLogicalId(data) can be used to augment the logical ID generated for the deployment resource such that it will include arbitrary data. This is done automatically for the restApi.latestDeployment deployment.

Furthermore, since a deployment does not reference any of the REST API resources and methods, CloudFormation will likely provision it before these resources are created, which means that it will represent a "half-baked" model. Use the node.addDependency(dep) method to circumvent that. This is done automatically for the restApi.latestDeployment deployment.

ExampleMetadata: infused

Examples
// production stage
             var prodLogGroup = new LogGroup(this, "PrdLogs");
             var api = new RestApi(this, "books", new RestApiProps {
                 DeployOptions = new StageOptions {
                     AccessLogDestination = new LogGroupLogDestination(prodLogGroup),
                     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
                 })
             });

DeploymentId

A Deployment of a REST API.

public virtual string DeploymentId { get; }
Property Value

string

Remarks

Attribute: true

PROPERTY_INJECTION_ID

Uniquely identifies this class.

public static string PROPERTY_INJECTION_ID { get; }
Property Value

string

Remarks

An immutable representation of a RestApi resource that can be called by users using Stages. A deployment must be associated with a Stage for it to be callable over the Internet.

Normally, you don't need to define deployments manually. The RestApi construct manages a Deployment resource that represents the latest model. It can be accessed through restApi.latestDeployment (unless deploy: false is set when defining the RestApi).

If you manually define this resource, you will need to know that since deployments are immutable, as long as the resource's logical ID doesn't change, the deployment will represent the snapshot in time in which the resource was created. This means that if you modify the RestApi model (i.e. add methods or resources), these changes will not be reflected unless a new deployment resource is created.

To achieve this behavior, the method addToLogicalId(data) can be used to augment the logical ID generated for the deployment resource such that it will include arbitrary data. This is done automatically for the restApi.latestDeployment deployment.

Furthermore, since a deployment does not reference any of the REST API resources and methods, CloudFormation will likely provision it before these resources are created, which means that it will represent a "half-baked" model. Use the node.addDependency(dep) method to circumvent that. This is done automatically for the restApi.latestDeployment deployment.

ExampleMetadata: infused

StageName

The stage of the API gateway deployment.

public virtual string? StageName { get; }
Property Value

string

Remarks

An immutable representation of a RestApi resource that can be called by users using Stages. A deployment must be associated with a Stage for it to be callable over the Internet.

Normally, you don't need to define deployments manually. The RestApi construct manages a Deployment resource that represents the latest model. It can be accessed through restApi.latestDeployment (unless deploy: false is set when defining the RestApi).

If you manually define this resource, you will need to know that since deployments are immutable, as long as the resource's logical ID doesn't change, the deployment will represent the snapshot in time in which the resource was created. This means that if you modify the RestApi model (i.e. add methods or resources), these changes will not be reflected unless a new deployment resource is created.

To achieve this behavior, the method addToLogicalId(data) can be used to augment the logical ID generated for the deployment resource such that it will include arbitrary data. This is done automatically for the restApi.latestDeployment deployment.

Furthermore, since a deployment does not reference any of the REST API resources and methods, CloudFormation will likely provision it before these resources are created, which means that it will represent a "half-baked" model. Use the node.addDependency(dep) method to circumvent that. This is done automatically for the restApi.latestDeployment deployment.

ExampleMetadata: infused

Methods

AddToLogicalId(object)

Adds a component to the hash that determines this Deployment resource's logical ID.

public virtual void AddToLogicalId(object data)
Parameters
data object
Remarks

This should be called by constructs of the API Gateway model that want to invalidate the deployment when their settings change. The component will be resolved during synthesis so tokens are welcome.

Implements

IResource
Constructs.IConstruct
Constructs.IDependable
IEnvironmentAware
Back to top Generated by DocFX