Table of Contents

Class AssetApiDefinition

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll

OpenAPI specification from a local file.

public class AssetApiDefinition : ApiDefinition
Inheritance
AssetApiDefinition
Inherited Members

Examples

// The code below shows an example of how to instantiate this type.
            // The values are placeholders you should change.
            using Amazon.CDK.Assets;
            using Amazon.CDK.AWS.APIGateway;
            using Amazon.CDK.AWS.IAM;
            using Amazon.CDK;

            DockerImage dockerImage;
            IGrantable grantable;
            ILocalBundling localBundling;
            var assetApiDefinition = new AssetApiDefinition("path", new AssetOptions {
                AssetHash = "assetHash",
                AssetHashType = AssetHashType.SOURCE,
                Bundling = new BundlingOptions {
                    Image = dockerImage,

                    // the properties below are optional
                    Command = new [] { "command" },
                    Entrypoint = new [] { "entrypoint" },
                    Environment = new Dictionary<string, string> {
                        { "environmentKey", "environment" }
                    },
                    Local = localBundling,
                    OutputType = BundlingOutput.ARCHIVED,
                    SecurityOpt = "securityOpt",
                    User = "user",
                    Volumes = new [] { new DockerVolume {
                        ContainerPath = "containerPath",
                        HostPath = "hostPath",

                        // the properties below are optional
                        Consistency = DockerVolumeConsistency.CONSISTENT
                    } },
                    WorkingDirectory = "workingDirectory"
                },
                Exclude = new [] { "exclude" },
                Follow = FollowMode.NEVER,
                FollowSymlinks = SymlinkFollowMode.NEVER,
                IgnoreMode = IgnoreMode.GLOB,
                Readers = new [] { grantable },
                SourceHash = "sourceHash"
            });

Remarks

ExampleMetadata: fixture=_generated

Constructors

AssetApiDefinition(string, IAssetOptions?)

public AssetApiDefinition(string path, IAssetOptions? options = null)

Parameters

path string
options IAssetOptions

Methods

Bind(Construct)

Called when the specification is initialized to allow this object to bind to the stack, add resources and have fun.

public override IApiDefinitionConfig Bind(Construct scope)

Parameters

scope Construct

Returns

IApiDefinitionConfig

BindAfterCreate(Construct, IRestApi)

Called after the CFN RestApi resource has been created to allow the Api Definition to bind to it.

public override void BindAfterCreate(Construct scope, IRestApi restApi)

Parameters

scope Construct
restApi IRestApi

Remarks

Specifically it's required to allow assets to add metadata for tooling like SAM CLI to be able to find their origins.