awscdkclilibalpha

package module
v2.177.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

README

AWS CDK CLI Library

---

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


⚠️ Experimental module

This package is highly experimental. Expect frequent API changes and incomplete features. Known issues include:

  • JavaScript/TypeScript only
    The jsii packages are currently not in a working state.
  • No useful return values
    All output is currently printed to stdout/stderr
  • Missing or Broken options
    Some CLI options might not be available in this package or broken

Overview

Provides a library to interact with the AWS CDK CLI programmatically from jsii supported languages. Currently the package includes implementations for:

  • cdk deploy
  • cdk synth
  • cdk bootstrap
  • cdk destroy
  • cdk list

Setup

AWS CDK app directory

Obtain an AwsCdkCli class from an AWS CDK app directory (containing a cdk.json file):

cli := awscdkclilibalpha.AwsCdkCli_FromCdkAppDirectory(jsii.String("/path/to/cdk/app"))
Cloud Assembly Directory Producer

You can also create AwsCdkCli from a class implementing ICloudAssemblyDirectoryProducer. AWS CDK apps might need to be synthesized multiple times with additional context values before they are ready.

The produce() method of the ICloudAssemblyDirectoryProducer interface provides this multi-pass ability. It is invoked with the context values of the current iteration and should use these values to synthesize a Cloud Assembly. The return value is the path to the assembly directory.

A basic implementation would look like this:

type myProducer struct {
}

func (this *myProducer) produce(context map[string]interface{}) promise {
	app := cdk.NewApp(&AppProps{
		Context: Context,
	})
	stack := cdk.NewStack(app)
	return app.Synth().Directory
}

For all features (e.g. lookups) to work correctly, cdk.App() must be instantiated with the received context values. Since it is not possible to update the context of an app, it must be created as part of the produce() method.

The producer can than be used like this:

cli := awscdkclilibalpha.AwsCdkCli_FromCloudAssemblyDirectoryProducer(NewMyProducer())

Commands

list
// await this asynchronous method call using a language feature
cli.List()
synth
// await this asynchronous method call using a language feature
cli.Synth(&SynthOptions{
	Stacks: []*string{
		jsii.String("MyTestStack"),
	},
})
bootstrap
// await this asynchronous method call using a language feature
cli.Bootstrap()
deploy
// await this asynchronous method call using a language feature
cli.Deploy(&DeployOptions{
	Stacks: []*string{
		jsii.String("MyTestStack"),
	},
})
destroy
// await this asynchronous method call using a language feature
cli.Destroy(&DestroyOptions{
	Stacks: []*string{
		jsii.String("MyTestStack"),
	},
})

Documentation

Overview

AWS CDK Programmatic CLI library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsCdkCli

type AwsCdkCli interface {
	IAwsCdkCli
	// cdk bootstrap.
	// Experimental.
	Bootstrap(options *BootstrapOptions)
	// cdk deploy.
	// Experimental.
	Deploy(options *DeployOptions)
	// cdk destroy.
	// Experimental.
	Destroy(options *DestroyOptions)
	// cdk list.
	// Experimental.
	List(options *ListOptions)
	// cdk synth.
	// Experimental.
	Synth(options *SynthOptions)
}

Provides a programmatic interface for interacting with the AWS CDK CLI.

Example:

cli := awscdkclilibalpha.AwsCdkCli_FromCdkAppDirectory(jsii.String("/path/to/cdk/app"))

Experimental.

func AwsCdkCli_FromCdkAppDirectory

func AwsCdkCli_FromCdkAppDirectory(directory *string, props *CdkAppDirectoryProps) AwsCdkCli

Create the CLI from a directory containing an AWS CDK app.

Returns: an instance of `AwsCdkCli`. Experimental.

func AwsCdkCli_FromCloudAssemblyDirectoryProducer

func AwsCdkCli_FromCloudAssemblyDirectoryProducer(producer ICloudAssemblyDirectoryProducer) AwsCdkCli

Create the CLI from a CloudAssemblyDirectoryProducer. Experimental.

type BootstrapOptions

type BootstrapOptions struct {
	// Include "aws:asset:*" CloudFormation metadata for resources that use assets.
	// Default: true.
	//
	// Experimental.
	AssetMetadata *bool `field:"optional" json:"assetMetadata" yaml:"assetMetadata"`
	// Path to CA certificate to use when validating HTTPS requests.
	// Default: - read from AWS_CA_BUNDLE environment variable.
	//
	// Experimental.
	CaBundlePath *string `field:"optional" json:"caBundlePath" yaml:"caBundlePath"`
	// Show colors and other style from console output.
	// Default: - `true` unless the environment variable `NO_COLOR` is set.
	//
	// Experimental.
	Color *bool `field:"optional" json:"color" yaml:"color"`
	// Additional context.
	// Default: - no additional context.
	//
	// Experimental.
	Context *map[string]*string `field:"optional" json:"context" yaml:"context"`
	// enable emission of additional debugging information, such as creation stack traces of tokens.
	// Default: false.
	//
	// Experimental.
	Debug *bool `field:"optional" json:"debug" yaml:"debug"`
	// Force trying to fetch EC2 instance credentials.
	// Default: - guess EC2 instance status.
	//
	// Experimental.
	Ec2Creds *bool `field:"optional" json:"ec2Creds" yaml:"ec2Creds"`
	// Ignores synthesis errors, which will likely produce an invalid output.
	// Default: false.
	//
	// Experimental.
	IgnoreErrors *bool `field:"optional" json:"ignoreErrors" yaml:"ignoreErrors"`
	// Use JSON output instead of YAML when templates are printed to STDOUT.
	// Default: false.
	//
	// Experimental.
	Json *bool `field:"optional" json:"json" yaml:"json"`
	// Perform context lookups.
	//
	// Synthesis fails if this is disabled and context lookups need
	// to be performed.
	// Default: true.
	//
	// Experimental.
	Lookups *bool `field:"optional" json:"lookups" yaml:"lookups"`
	// Show relevant notices.
	// Default: true.
	//
	// Experimental.
	Notices *bool `field:"optional" json:"notices" yaml:"notices"`
	// Include "aws:cdk:path" CloudFormation metadata for each resource.
	// Default: true.
	//
	// Experimental.
	PathMetadata *bool `field:"optional" json:"pathMetadata" yaml:"pathMetadata"`
	// Use the indicated AWS profile as the default environment.
	// Default: - no profile is used.
	//
	// Experimental.
	Profile *string `field:"optional" json:"profile" yaml:"profile"`
	// Use the indicated proxy.
	//
	// Will read from
	// HTTPS_PROXY environment if specified.
	// Default: - no proxy.
	//
	// Experimental.
	Proxy *string `field:"optional" json:"proxy" yaml:"proxy"`
	// Role to pass to CloudFormation for deployment.
	// Default: - use the bootstrap cfn-exec role.
	//
	// Experimental.
	RoleArn *string `field:"optional" json:"roleArn" yaml:"roleArn"`
	// List of stacks to deploy.
	// Default: - all stacks.
	//
	// Experimental.
	Stacks *[]*string `field:"optional" json:"stacks" yaml:"stacks"`
	// Copy assets to the output directory.
	//
	// Needed for local debugging the source files with SAM CLI.
	// Default: false.
	//
	// Experimental.
	Staging *bool `field:"optional" json:"staging" yaml:"staging"`
	// Do not construct stacks with warnings.
	// Default: false.
	//
	// Experimental.
	Strict *bool `field:"optional" json:"strict" yaml:"strict"`
	// Print trace for stack warnings.
	// Default: false.
	//
	// Experimental.
	Trace *bool `field:"optional" json:"trace" yaml:"trace"`
	// show debug logs.
	// Default: false.
	//
	// Experimental.
	Verbose *bool `field:"optional" json:"verbose" yaml:"verbose"`
	// Include "AWS::CDK::Metadata" resource in synthesized templates.
	// Default: true.
	//
	// Experimental.
	VersionReporting *bool `field:"optional" json:"versionReporting" yaml:"versionReporting"`
	// The name of the CDK toolkit bucket;
	//
	// bucket will be created and
	// must not exist.
	// Default: - auto-generated CloudFormation name.
	//
	// Experimental.
	BootstrapBucketName *string `field:"optional" json:"bootstrapBucketName" yaml:"bootstrapBucketName"`
	// Create a Customer Master Key (CMK) for the bootstrap bucket (you will be charged but can customize permissions, modern bootstrapping only).
	// Default: undefined.
	//
	// Experimental.
	BootstrapCustomerKey *string `field:"optional" json:"bootstrapCustomerKey" yaml:"bootstrapCustomerKey"`
	// AWS KMS master key ID used for the SSE-KMS encryption.
	// Default: undefined.
	//
	// Experimental.
	BootstrapKmsKeyId *string `field:"optional" json:"bootstrapKmsKeyId" yaml:"bootstrapKmsKeyId"`
	// The Managed Policy ARNs that should be attached to the role performing deployments into this environment (may be repeated, modern bootstrapping only).
	// Default: - none.
	//
	// Experimental.
	CfnExecutionPolicy *string `field:"optional" json:"cfnExecutionPolicy" yaml:"cfnExecutionPolicy"`
	// Use the permissions boundary specified by name.
	// Default: undefined.
	//
	// Experimental.
	CustomPermissionsBoundary *string `field:"optional" json:"customPermissionsBoundary" yaml:"customPermissionsBoundary"`
	// The target AWS environments to deploy the bootstrap stack to.
	//
	// Uses the following format: `aws://<account-id>/<region>`.
	//
	// Example:
	//   "aws://123456789012/us-east-1"
	//
	// Default: - Bootstrap all environments referenced in the CDK app or determine an environment from local configuration.
	//
	// Experimental.
	Environments *[]*string `field:"optional" json:"environments" yaml:"environments"`
	// Use the example permissions boundary.
	// Default: undefined.
	//
	// Experimental.
	ExamplePermissionsBoundary *bool `field:"optional" json:"examplePermissionsBoundary" yaml:"examplePermissionsBoundary"`
	// Whether to execute ChangeSet (--no-execute will NOT execute the ChangeSet).
	// Default: true.
	//
	// Experimental.
	Execute *bool `field:"optional" json:"execute" yaml:"execute"`
	// Always bootstrap even if it would downgrade template version.
	// Default: false.
	//
	// Experimental.
	Force *bool `field:"optional" json:"force" yaml:"force"`
	// Block public access configuration on CDK toolkit bucket (enabled by default).
	// Default: undefined.
	//
	// Experimental.
	PublicAccessBlockConfiguration *string `field:"optional" json:"publicAccessBlockConfiguration" yaml:"publicAccessBlockConfiguration"`
	// String which must be unique for each bootstrap stack.
	//
	// You
	// must configure it on your CDK app if you change this
	// from the default.
	// Default: undefined.
	//
	// Experimental.
	Qualifier *string `field:"optional" json:"qualifier" yaml:"qualifier"`
	// Instead of actual bootstrapping, print the current CLI\'s bootstrapping template to stdout for customization.
	// Default: false.
	//
	// Experimental.
	ShowTemplate *bool `field:"optional" json:"showTemplate" yaml:"showTemplate"`
	// Use the template from the given file instead of the built-in one (use --show-template to obtain an example).
	// Experimental.
	Template *string `field:"optional" json:"template" yaml:"template"`
	// Toggle CloudFormation termination protection on the bootstrap stacks.
	// Default: false.
	//
	// Experimental.
	TerminationProtection *bool `field:"optional" json:"terminationProtection" yaml:"terminationProtection"`
	// The name of the CDK toolkit stack to create.
	// Experimental.
	ToolkitStackName *string `field:"optional" json:"toolkitStackName" yaml:"toolkitStackName"`
	// The AWS account IDs that should be trusted to perform deployments into this environment (may be repeated, modern bootstrapping only).
	// Default: undefined.
	//
	// Experimental.
	Trust *string `field:"optional" json:"trust" yaml:"trust"`
	// The AWS account IDs that should be trusted to look up values in this environment (may be repeated, modern bootstrapping only).
	// Default: undefined.
	//
	// Experimental.
	TrustForLookup *string `field:"optional" json:"trustForLookup" yaml:"trustForLookup"`
	// Use previous values for existing parameters (you must specify all parameters on every deployment if this is disabled).
	// Default: true.
	//
	// Experimental.
	UsePreviousParameters *bool `field:"optional" json:"usePreviousParameters" yaml:"usePreviousParameters"`
}

Options to use with cdk bootstrap.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cli_lib_alpha "github.com/aws/aws-cdk-go/awscdkclilibalpha"

bootstrapOptions := &BootstrapOptions{
	AssetMetadata: jsii.Boolean(false),
	BootstrapBucketName: jsii.String("bootstrapBucketName"),
	BootstrapCustomerKey: jsii.String("bootstrapCustomerKey"),
	BootstrapKmsKeyId: jsii.String("bootstrapKmsKeyId"),
	CaBundlePath: jsii.String("caBundlePath"),
	CfnExecutionPolicy: jsii.String("cfnExecutionPolicy"),
	Color: jsii.Boolean(false),
	Context: map[string]*string{
		"contextKey": jsii.String("context"),
	},
	CustomPermissionsBoundary: jsii.String("customPermissionsBoundary"),
	Debug: jsii.Boolean(false),
	Ec2Creds: jsii.Boolean(false),
	Environments: []*string{
		jsii.String("environments"),
	},
	ExamplePermissionsBoundary: jsii.Boolean(false),
	Execute: jsii.Boolean(false),
	Force: jsii.Boolean(false),
	IgnoreErrors: jsii.Boolean(false),
	Json: jsii.Boolean(false),
	Lookups: jsii.Boolean(false),
	Notices: jsii.Boolean(false),
	PathMetadata: jsii.Boolean(false),
	Profile: jsii.String("profile"),
	Proxy: jsii.String("proxy"),
	PublicAccessBlockConfiguration: jsii.String("publicAccessBlockConfiguration"),
	Qualifier: jsii.String("qualifier"),
	RoleArn: jsii.String("roleArn"),
	ShowTemplate: jsii.Boolean(false),
	Stacks: []*string{
		jsii.String("stacks"),
	},
	Staging: jsii.Boolean(false),
	Strict: jsii.Boolean(false),
	Template: jsii.String("template"),
	TerminationProtection: jsii.Boolean(false),
	ToolkitStackName: jsii.String("toolkitStackName"),
	Trace: jsii.Boolean(false),
	Trust: jsii.String("trust"),
	TrustForLookup: jsii.String("trustForLookup"),
	UsePreviousParameters: jsii.Boolean(false),
	Verbose: jsii.Boolean(false),
	VersionReporting: jsii.Boolean(false),
}

Experimental.

type CdkAppDirectoryProps

type CdkAppDirectoryProps struct {
	// Command-line for executing your app or a cloud assembly directory e.g. "node bin/my-app.js" or "cdk.out".
	// Default: - read from cdk.json
	//
	// Experimental.
	App *string `field:"optional" json:"app" yaml:"app"`
	// Emits the synthesized cloud assembly into a directory.
	// Default: cdk.out
	//
	// Experimental.
	Output *string `field:"optional" json:"output" yaml:"output"`
}

Configuration for creating a CLI from an AWS CDK App directory.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cli_lib_alpha "github.com/aws/aws-cdk-go/awscdkclilibalpha"

cdkAppDirectoryProps := &CdkAppDirectoryProps{
	App: jsii.String("app"),
	Output: jsii.String("output"),
}

Experimental.

type DeployOptions

type DeployOptions struct {
	// Include "aws:asset:*" CloudFormation metadata for resources that use assets.
	// Default: true.
	//
	// Experimental.
	AssetMetadata *bool `field:"optional" json:"assetMetadata" yaml:"assetMetadata"`
	// Path to CA certificate to use when validating HTTPS requests.
	// Default: - read from AWS_CA_BUNDLE environment variable.
	//
	// Experimental.
	CaBundlePath *string `field:"optional" json:"caBundlePath" yaml:"caBundlePath"`
	// Show colors and other style from console output.
	// Default: - `true` unless the environment variable `NO_COLOR` is set.
	//
	// Experimental.
	Color *bool `field:"optional" json:"color" yaml:"color"`
	// Additional context.
	// Default: - no additional context.
	//
	// Experimental.
	Context *map[string]*string `field:"optional" json:"context" yaml:"context"`
	// enable emission of additional debugging information, such as creation stack traces of tokens.
	// Default: false.
	//
	// Experimental.
	Debug *bool `field:"optional" json:"debug" yaml:"debug"`
	// Force trying to fetch EC2 instance credentials.
	// Default: - guess EC2 instance status.
	//
	// Experimental.
	Ec2Creds *bool `field:"optional" json:"ec2Creds" yaml:"ec2Creds"`
	// Ignores synthesis errors, which will likely produce an invalid output.
	// Default: false.
	//
	// Experimental.
	IgnoreErrors *bool `field:"optional" json:"ignoreErrors" yaml:"ignoreErrors"`
	// Use JSON output instead of YAML when templates are printed to STDOUT.
	// Default: false.
	//
	// Experimental.
	Json *bool `field:"optional" json:"json" yaml:"json"`
	// Perform context lookups.
	//
	// Synthesis fails if this is disabled and context lookups need
	// to be performed.
	// Default: true.
	//
	// Experimental.
	Lookups *bool `field:"optional" json:"lookups" yaml:"lookups"`
	// Show relevant notices.
	// Default: true.
	//
	// Experimental.
	Notices *bool `field:"optional" json:"notices" yaml:"notices"`
	// Include "aws:cdk:path" CloudFormation metadata for each resource.
	// Default: true.
	//
	// Experimental.
	PathMetadata *bool `field:"optional" json:"pathMetadata" yaml:"pathMetadata"`
	// Use the indicated AWS profile as the default environment.
	// Default: - no profile is used.
	//
	// Experimental.
	Profile *string `field:"optional" json:"profile" yaml:"profile"`
	// Use the indicated proxy.
	//
	// Will read from
	// HTTPS_PROXY environment if specified.
	// Default: - no proxy.
	//
	// Experimental.
	Proxy *string `field:"optional" json:"proxy" yaml:"proxy"`
	// Role to pass to CloudFormation for deployment.
	// Default: - use the bootstrap cfn-exec role.
	//
	// Experimental.
	RoleArn *string `field:"optional" json:"roleArn" yaml:"roleArn"`
	// List of stacks to deploy.
	// Default: - all stacks.
	//
	// Experimental.
	Stacks *[]*string `field:"optional" json:"stacks" yaml:"stacks"`
	// Copy assets to the output directory.
	//
	// Needed for local debugging the source files with SAM CLI.
	// Default: false.
	//
	// Experimental.
	Staging *bool `field:"optional" json:"staging" yaml:"staging"`
	// Do not construct stacks with warnings.
	// Default: false.
	//
	// Experimental.
	Strict *bool `field:"optional" json:"strict" yaml:"strict"`
	// Print trace for stack warnings.
	// Default: false.
	//
	// Experimental.
	Trace *bool `field:"optional" json:"trace" yaml:"trace"`
	// show debug logs.
	// Default: false.
	//
	// Experimental.
	Verbose *bool `field:"optional" json:"verbose" yaml:"verbose"`
	// Include "AWS::CDK::Metadata" resource in synthesized templates.
	// Default: true.
	//
	// Experimental.
	VersionReporting *bool `field:"optional" json:"versionReporting" yaml:"versionReporting"`
	// Whether to build/publish assets in parallel.
	// Default: false.
	//
	// Experimental.
	AssetParallelism *bool `field:"optional" json:"assetParallelism" yaml:"assetParallelism"`
	// Whether to build all assets before deploying the first stack (useful for failing Docker builds).
	// Default: true.
	//
	// Experimental.
	AssetPrebuild *bool `field:"optional" json:"assetPrebuild" yaml:"assetPrebuild"`
	// Optional name to use for the CloudFormation change set.
	//
	// If not provided, a name will be generated automatically.
	// Default: - auto generate a name.
	//
	// Experimental.
	ChangeSetName *string `field:"optional" json:"changeSetName" yaml:"changeSetName"`
	// Whether we are on a CI system.
	// Default: - `false` unless the environment variable `CI` is set.
	//
	// Experimental.
	Ci *bool `field:"optional" json:"ci" yaml:"ci"`
	// Maximum number of simultaneous deployments (dependency permitting) to execute.
	// Default: 1.
	//
	// Experimental.
	Concurrency *float64 `field:"optional" json:"concurrency" yaml:"concurrency"`
	// Only perform action on the given stack.
	// Default: false.
	//
	// Experimental.
	Exclusively *bool `field:"optional" json:"exclusively" yaml:"exclusively"`
	// Whether to execute the ChangeSet Not providing `execute` parameter will result in execution of ChangeSet.
	// Default: true.
	//
	// Experimental.
	Execute *bool `field:"optional" json:"execute" yaml:"execute"`
	// Always deploy, even if templates are identical.
	// Default: false.
	//
	// Experimental.
	Force *bool `field:"optional" json:"force" yaml:"force"`
	// Experimental.
	Hotswap HotswapMode `field:"optional" json:"hotswap" yaml:"hotswap"`
	// ARNs of SNS topics that CloudFormation will notify with stack related events.
	// Default: - no notifications.
	//
	// Experimental.
	NotificationArns *[]*string `field:"optional" json:"notificationArns" yaml:"notificationArns"`
	// Path to file where stack outputs will be written after a successful deploy as JSON.
	// Default: - Outputs are not written to any file.
	//
	// Experimental.
	OutputsFile *string `field:"optional" json:"outputsFile" yaml:"outputsFile"`
	// Additional parameters for CloudFormation at deploy time.
	// Default: {}.
	//
	// Experimental.
	Parameters *map[string]*string `field:"optional" json:"parameters" yaml:"parameters"`
	// Display mode for stack activity events.
	//
	// The default in the CLI is StackActivityProgress.BAR. But since this is an API
	// it makes more sense to set the default to StackActivityProgress.EVENTS
	// Default: StackActivityProgress.EVENTS
	//
	// Experimental.
	Progress StackActivityProgress `field:"optional" json:"progress" yaml:"progress"`
	// What kind of security changes require approval.
	// Default: RequireApproval.Never
	//
	// Experimental.
	RequireApproval RequireApproval `field:"optional" json:"requireApproval" yaml:"requireApproval"`
	// Reuse the assets with the given asset IDs.
	// Default: - do not reuse assets.
	//
	// Experimental.
	ReuseAssets *[]*string `field:"optional" json:"reuseAssets" yaml:"reuseAssets"`
	// Rollback failed deployments.
	// Default: true.
	//
	// Experimental.
	Rollback *bool `field:"optional" json:"rollback" yaml:"rollback"`
	// Name of the toolkit stack to use/deploy.
	// Default: CDKToolkit.
	//
	// Experimental.
	ToolkitStackName *string `field:"optional" json:"toolkitStackName" yaml:"toolkitStackName"`
	// Use previous values for unspecified parameters.
	//
	// If not set, all parameters must be specified for every deployment.
	// Default: true.
	//
	// Experimental.
	UsePreviousParameters *bool `field:"optional" json:"usePreviousParameters" yaml:"usePreviousParameters"`
}

Options to use with cdk deploy.

Example:

// await this asynchronous method call using a language feature
cli.Deploy(&DeployOptions{
	Stacks: []*string{
		jsii.String("MyTestStack"),
	},
})

Experimental.

type DestroyOptions

type DestroyOptions struct {
	// Include "aws:asset:*" CloudFormation metadata for resources that use assets.
	// Default: true.
	//
	// Experimental.
	AssetMetadata *bool `field:"optional" json:"assetMetadata" yaml:"assetMetadata"`
	// Path to CA certificate to use when validating HTTPS requests.
	// Default: - read from AWS_CA_BUNDLE environment variable.
	//
	// Experimental.
	CaBundlePath *string `field:"optional" json:"caBundlePath" yaml:"caBundlePath"`
	// Show colors and other style from console output.
	// Default: - `true` unless the environment variable `NO_COLOR` is set.
	//
	// Experimental.
	Color *bool `field:"optional" json:"color" yaml:"color"`
	// Additional context.
	// Default: - no additional context.
	//
	// Experimental.
	Context *map[string]*string `field:"optional" json:"context" yaml:"context"`
	// enable emission of additional debugging information, such as creation stack traces of tokens.
	// Default: false.
	//
	// Experimental.
	Debug *bool `field:"optional" json:"debug" yaml:"debug"`
	// Force trying to fetch EC2 instance credentials.
	// Default: - guess EC2 instance status.
	//
	// Experimental.
	Ec2Creds *bool `field:"optional" json:"ec2Creds" yaml:"ec2Creds"`
	// Ignores synthesis errors, which will likely produce an invalid output.
	// Default: false.
	//
	// Experimental.
	IgnoreErrors *bool `field:"optional" json:"ignoreErrors" yaml:"ignoreErrors"`
	// Use JSON output instead of YAML when templates are printed to STDOUT.
	// Default: false.
	//
	// Experimental.
	Json *bool `field:"optional" json:"json" yaml:"json"`
	// Perform context lookups.
	//
	// Synthesis fails if this is disabled and context lookups need
	// to be performed.
	// Default: true.
	//
	// Experimental.
	Lookups *bool `field:"optional" json:"lookups" yaml:"lookups"`
	// Show relevant notices.
	// Default: true.
	//
	// Experimental.
	Notices *bool `field:"optional" json:"notices" yaml:"notices"`
	// Include "aws:cdk:path" CloudFormation metadata for each resource.
	// Default: true.
	//
	// Experimental.
	PathMetadata *bool `field:"optional" json:"pathMetadata" yaml:"pathMetadata"`
	// Use the indicated AWS profile as the default environment.
	// Default: - no profile is used.
	//
	// Experimental.
	Profile *string `field:"optional" json:"profile" yaml:"profile"`
	// Use the indicated proxy.
	//
	// Will read from
	// HTTPS_PROXY environment if specified.
	// Default: - no proxy.
	//
	// Experimental.
	Proxy *string `field:"optional" json:"proxy" yaml:"proxy"`
	// Role to pass to CloudFormation for deployment.
	// Default: - use the bootstrap cfn-exec role.
	//
	// Experimental.
	RoleArn *string `field:"optional" json:"roleArn" yaml:"roleArn"`
	// List of stacks to deploy.
	// Default: - all stacks.
	//
	// Experimental.
	Stacks *[]*string `field:"optional" json:"stacks" yaml:"stacks"`
	// Copy assets to the output directory.
	//
	// Needed for local debugging the source files with SAM CLI.
	// Default: false.
	//
	// Experimental.
	Staging *bool `field:"optional" json:"staging" yaml:"staging"`
	// Do not construct stacks with warnings.
	// Default: false.
	//
	// Experimental.
	Strict *bool `field:"optional" json:"strict" yaml:"strict"`
	// Print trace for stack warnings.
	// Default: false.
	//
	// Experimental.
	Trace *bool `field:"optional" json:"trace" yaml:"trace"`
	// show debug logs.
	// Default: false.
	//
	// Experimental.
	Verbose *bool `field:"optional" json:"verbose" yaml:"verbose"`
	// Include "AWS::CDK::Metadata" resource in synthesized templates.
	// Default: true.
	//
	// Experimental.
	VersionReporting *bool `field:"optional" json:"versionReporting" yaml:"versionReporting"`
	// Only destroy the given stack.
	// Default: false.
	//
	// Experimental.
	Exclusively *bool `field:"optional" json:"exclusively" yaml:"exclusively"`
	// Should the script prompt for approval before destroying stacks.
	// Default: false.
	//
	// Experimental.
	RequireApproval *bool `field:"optional" json:"requireApproval" yaml:"requireApproval"`
}

Options to use with cdk destroy.

Example:

// await this asynchronous method call using a language feature
cli.Destroy(&DestroyOptions{
	Stacks: []*string{
		jsii.String("MyTestStack"),
	},
})

Experimental.

type HotswapMode

type HotswapMode string

Experimental.

const (
	// Will fall back to CloudFormation when a non-hotswappable change is detected.
	// Experimental.
	HotswapMode_FALL_BACK HotswapMode = "FALL_BACK"
	// Will not fall back to CloudFormation when a non-hotswappable change is detected.
	// Experimental.
	HotswapMode_HOTSWAP_ONLY HotswapMode = "HOTSWAP_ONLY"
	// Will not attempt to hotswap anything and instead go straight to CloudFormation.
	// Experimental.
	HotswapMode_FULL_DEPLOYMENT HotswapMode = "FULL_DEPLOYMENT"
)

type IAwsCdkCli

type IAwsCdkCli interface {
	// cdk bootstrap.
	// Experimental.
	Bootstrap(options *BootstrapOptions)
	// cdk deploy.
	// Experimental.
	Deploy(options *DeployOptions)
	// cdk destroy.
	// Experimental.
	Destroy(options *DestroyOptions)
	// cdk list.
	// Experimental.
	List(options *ListOptions)
	// cdk synth.
	// Experimental.
	Synth(options *SynthOptions)
}

AWS CDK CLI operations. Experimental.

type ICloudAssemblyDirectoryProducer

type ICloudAssemblyDirectoryProducer interface {
	// Synthesize a Cloud Assembly directory for a given context.
	//
	// For all features to work correctly, `cdk.App()` must be instantiated with the received context values in the method body.
	// Usually obtained similar to this:
	// “`ts fixture=imports
	// class MyProducer implements ICloudAssemblyDirectoryProducer {
	//   async produce(context: Record<string, any>) {
	//     const app = new cdk.App({ context });
	//     // create stacks here
	//     return app.synth().directory;
	//   }
	// }
	// “`.
	// Experimental.
	Produce(context *map[string]interface{}) *string
	// The working directory used to run the Cloud Assembly from.
	//
	// This is were a `cdk.context.json` files will be written.
	// Default: - current working directory.
	//
	// Experimental.
	WorkingDirectory() *string
	// Experimental.
	SetWorkingDirectory(w *string)
}

A class returning the path to a Cloud Assembly Directory when its `produce` method is invoked with the current context AWS CDK apps might need to be synthesized multiple times with additional context values before they are ready.

When running the CLI from inside a directory, this is implemented by invoking the app multiple times. Here the `produce()` method provides this multi-pass ability. Experimental.

type ListOptions

type ListOptions struct {
	// Include "aws:asset:*" CloudFormation metadata for resources that use assets.
	// Default: true.
	//
	// Experimental.
	AssetMetadata *bool `field:"optional" json:"assetMetadata" yaml:"assetMetadata"`
	// Path to CA certificate to use when validating HTTPS requests.
	// Default: - read from AWS_CA_BUNDLE environment variable.
	//
	// Experimental.
	CaBundlePath *string `field:"optional" json:"caBundlePath" yaml:"caBundlePath"`
	// Show colors and other style from console output.
	// Default: - `true` unless the environment variable `NO_COLOR` is set.
	//
	// Experimental.
	Color *bool `field:"optional" json:"color" yaml:"color"`
	// Additional context.
	// Default: - no additional context.
	//
	// Experimental.
	Context *map[string]*string `field:"optional" json:"context" yaml:"context"`
	// enable emission of additional debugging information, such as creation stack traces of tokens.
	// Default: false.
	//
	// Experimental.
	Debug *bool `field:"optional" json:"debug" yaml:"debug"`
	// Force trying to fetch EC2 instance credentials.
	// Default: - guess EC2 instance status.
	//
	// Experimental.
	Ec2Creds *bool `field:"optional" json:"ec2Creds" yaml:"ec2Creds"`
	// Ignores synthesis errors, which will likely produce an invalid output.
	// Default: false.
	//
	// Experimental.
	IgnoreErrors *bool `field:"optional" json:"ignoreErrors" yaml:"ignoreErrors"`
	// Use JSON output instead of YAML when templates are printed to STDOUT.
	// Default: false.
	//
	// Experimental.
	Json *bool `field:"optional" json:"json" yaml:"json"`
	// Perform context lookups.
	//
	// Synthesis fails if this is disabled and context lookups need
	// to be performed.
	// Default: true.
	//
	// Experimental.
	Lookups *bool `field:"optional" json:"lookups" yaml:"lookups"`
	// Show relevant notices.
	// Default: true.
	//
	// Experimental.
	Notices *bool `field:"optional" json:"notices" yaml:"notices"`
	// Include "aws:cdk:path" CloudFormation metadata for each resource.
	// Default: true.
	//
	// Experimental.
	PathMetadata *bool `field:"optional" json:"pathMetadata" yaml:"pathMetadata"`
	// Use the indicated AWS profile as the default environment.
	// Default: - no profile is used.
	//
	// Experimental.
	Profile *string `field:"optional" json:"profile" yaml:"profile"`
	// Use the indicated proxy.
	//
	// Will read from
	// HTTPS_PROXY environment if specified.
	// Default: - no proxy.
	//
	// Experimental.
	Proxy *string `field:"optional" json:"proxy" yaml:"proxy"`
	// Role to pass to CloudFormation for deployment.
	// Default: - use the bootstrap cfn-exec role.
	//
	// Experimental.
	RoleArn *string `field:"optional" json:"roleArn" yaml:"roleArn"`
	// List of stacks to deploy.
	// Default: - all stacks.
	//
	// Experimental.
	Stacks *[]*string `field:"optional" json:"stacks" yaml:"stacks"`
	// Copy assets to the output directory.
	//
	// Needed for local debugging the source files with SAM CLI.
	// Default: false.
	//
	// Experimental.
	Staging *bool `field:"optional" json:"staging" yaml:"staging"`
	// Do not construct stacks with warnings.
	// Default: false.
	//
	// Experimental.
	Strict *bool `field:"optional" json:"strict" yaml:"strict"`
	// Print trace for stack warnings.
	// Default: false.
	//
	// Experimental.
	Trace *bool `field:"optional" json:"trace" yaml:"trace"`
	// show debug logs.
	// Default: false.
	//
	// Experimental.
	Verbose *bool `field:"optional" json:"verbose" yaml:"verbose"`
	// Include "AWS::CDK::Metadata" resource in synthesized templates.
	// Default: true.
	//
	// Experimental.
	VersionReporting *bool `field:"optional" json:"versionReporting" yaml:"versionReporting"`
	// Display environment information for each stack.
	// Default: false.
	//
	// Experimental.
	Long *bool `field:"optional" json:"long" yaml:"long"`
}

Options for cdk list.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cli_lib_alpha "github.com/aws/aws-cdk-go/awscdkclilibalpha"

listOptions := &ListOptions{
	AssetMetadata: jsii.Boolean(false),
	CaBundlePath: jsii.String("caBundlePath"),
	Color: jsii.Boolean(false),
	Context: map[string]*string{
		"contextKey": jsii.String("context"),
	},
	Debug: jsii.Boolean(false),
	Ec2Creds: jsii.Boolean(false),
	IgnoreErrors: jsii.Boolean(false),
	Json: jsii.Boolean(false),
	Long: jsii.Boolean(false),
	Lookups: jsii.Boolean(false),
	Notices: jsii.Boolean(false),
	PathMetadata: jsii.Boolean(false),
	Profile: jsii.String("profile"),
	Proxy: jsii.String("proxy"),
	RoleArn: jsii.String("roleArn"),
	Stacks: []*string{
		jsii.String("stacks"),
	},
	Staging: jsii.Boolean(false),
	Strict: jsii.Boolean(false),
	Trace: jsii.Boolean(false),
	Verbose: jsii.Boolean(false),
	VersionReporting: jsii.Boolean(false),
}

Experimental.

type RequireApproval

type RequireApproval string

In what scenarios should the CLI ask for approval. Experimental.

const (
	// Never ask for approval.
	// Experimental.
	RequireApproval_NEVER RequireApproval = "NEVER"
	// Prompt for approval for any type  of change to the stack.
	// Experimental.
	RequireApproval_ANYCHANGE RequireApproval = "ANYCHANGE"
	// Only prompt for approval if there are security related changes.
	// Experimental.
	RequireApproval_BROADENING RequireApproval = "BROADENING"
)

type SharedOptions

type SharedOptions struct {
	// Include "aws:asset:*" CloudFormation metadata for resources that use assets.
	// Default: true.
	//
	// Experimental.
	AssetMetadata *bool `field:"optional" json:"assetMetadata" yaml:"assetMetadata"`
	// Path to CA certificate to use when validating HTTPS requests.
	// Default: - read from AWS_CA_BUNDLE environment variable.
	//
	// Experimental.
	CaBundlePath *string `field:"optional" json:"caBundlePath" yaml:"caBundlePath"`
	// Show colors and other style from console output.
	// Default: - `true` unless the environment variable `NO_COLOR` is set.
	//
	// Experimental.
	Color *bool `field:"optional" json:"color" yaml:"color"`
	// Additional context.
	// Default: - no additional context.
	//
	// Experimental.
	Context *map[string]*string `field:"optional" json:"context" yaml:"context"`
	// enable emission of additional debugging information, such as creation stack traces of tokens.
	// Default: false.
	//
	// Experimental.
	Debug *bool `field:"optional" json:"debug" yaml:"debug"`
	// Force trying to fetch EC2 instance credentials.
	// Default: - guess EC2 instance status.
	//
	// Experimental.
	Ec2Creds *bool `field:"optional" json:"ec2Creds" yaml:"ec2Creds"`
	// Ignores synthesis errors, which will likely produce an invalid output.
	// Default: false.
	//
	// Experimental.
	IgnoreErrors *bool `field:"optional" json:"ignoreErrors" yaml:"ignoreErrors"`
	// Use JSON output instead of YAML when templates are printed to STDOUT.
	// Default: false.
	//
	// Experimental.
	Json *bool `field:"optional" json:"json" yaml:"json"`
	// Perform context lookups.
	//
	// Synthesis fails if this is disabled and context lookups need
	// to be performed.
	// Default: true.
	//
	// Experimental.
	Lookups *bool `field:"optional" json:"lookups" yaml:"lookups"`
	// Show relevant notices.
	// Default: true.
	//
	// Experimental.
	Notices *bool `field:"optional" json:"notices" yaml:"notices"`
	// Include "aws:cdk:path" CloudFormation metadata for each resource.
	// Default: true.
	//
	// Experimental.
	PathMetadata *bool `field:"optional" json:"pathMetadata" yaml:"pathMetadata"`
	// Use the indicated AWS profile as the default environment.
	// Default: - no profile is used.
	//
	// Experimental.
	Profile *string `field:"optional" json:"profile" yaml:"profile"`
	// Use the indicated proxy.
	//
	// Will read from
	// HTTPS_PROXY environment if specified.
	// Default: - no proxy.
	//
	// Experimental.
	Proxy *string `field:"optional" json:"proxy" yaml:"proxy"`
	// Role to pass to CloudFormation for deployment.
	// Default: - use the bootstrap cfn-exec role.
	//
	// Experimental.
	RoleArn *string `field:"optional" json:"roleArn" yaml:"roleArn"`
	// List of stacks to deploy.
	// Default: - all stacks.
	//
	// Experimental.
	Stacks *[]*string `field:"optional" json:"stacks" yaml:"stacks"`
	// Copy assets to the output directory.
	//
	// Needed for local debugging the source files with SAM CLI.
	// Default: false.
	//
	// Experimental.
	Staging *bool `field:"optional" json:"staging" yaml:"staging"`
	// Do not construct stacks with warnings.
	// Default: false.
	//
	// Experimental.
	Strict *bool `field:"optional" json:"strict" yaml:"strict"`
	// Print trace for stack warnings.
	// Default: false.
	//
	// Experimental.
	Trace *bool `field:"optional" json:"trace" yaml:"trace"`
	// show debug logs.
	// Default: false.
	//
	// Experimental.
	Verbose *bool `field:"optional" json:"verbose" yaml:"verbose"`
	// Include "AWS::CDK::Metadata" resource in synthesized templates.
	// Default: true.
	//
	// Experimental.
	VersionReporting *bool `field:"optional" json:"versionReporting" yaml:"versionReporting"`
}

AWS CDK CLI options that apply to all commands.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cli_lib_alpha "github.com/aws/aws-cdk-go/awscdkclilibalpha"

sharedOptions := &SharedOptions{
	AssetMetadata: jsii.Boolean(false),
	CaBundlePath: jsii.String("caBundlePath"),
	Color: jsii.Boolean(false),
	Context: map[string]*string{
		"contextKey": jsii.String("context"),
	},
	Debug: jsii.Boolean(false),
	Ec2Creds: jsii.Boolean(false),
	IgnoreErrors: jsii.Boolean(false),
	Json: jsii.Boolean(false),
	Lookups: jsii.Boolean(false),
	Notices: jsii.Boolean(false),
	PathMetadata: jsii.Boolean(false),
	Profile: jsii.String("profile"),
	Proxy: jsii.String("proxy"),
	RoleArn: jsii.String("roleArn"),
	Stacks: []*string{
		jsii.String("stacks"),
	},
	Staging: jsii.Boolean(false),
	Strict: jsii.Boolean(false),
	Trace: jsii.Boolean(false),
	Verbose: jsii.Boolean(false),
	VersionReporting: jsii.Boolean(false),
}

Experimental.

type StackActivityProgress

type StackActivityProgress string

Supported display modes for stack deployment activity. Experimental.

const (
	// Displays a progress bar with only the events for the resource currently being deployed.
	// Experimental.
	StackActivityProgress_BAR StackActivityProgress = "BAR"
	// Displays complete history with all CloudFormation stack events.
	// Experimental.
	StackActivityProgress_EVENTS StackActivityProgress = "EVENTS"
)

type SynthOptions

type SynthOptions struct {
	// Include "aws:asset:*" CloudFormation metadata for resources that use assets.
	// Default: true.
	//
	// Experimental.
	AssetMetadata *bool `field:"optional" json:"assetMetadata" yaml:"assetMetadata"`
	// Path to CA certificate to use when validating HTTPS requests.
	// Default: - read from AWS_CA_BUNDLE environment variable.
	//
	// Experimental.
	CaBundlePath *string `field:"optional" json:"caBundlePath" yaml:"caBundlePath"`
	// Show colors and other style from console output.
	// Default: - `true` unless the environment variable `NO_COLOR` is set.
	//
	// Experimental.
	Color *bool `field:"optional" json:"color" yaml:"color"`
	// Additional context.
	// Default: - no additional context.
	//
	// Experimental.
	Context *map[string]*string `field:"optional" json:"context" yaml:"context"`
	// enable emission of additional debugging information, such as creation stack traces of tokens.
	// Default: false.
	//
	// Experimental.
	Debug *bool `field:"optional" json:"debug" yaml:"debug"`
	// Force trying to fetch EC2 instance credentials.
	// Default: - guess EC2 instance status.
	//
	// Experimental.
	Ec2Creds *bool `field:"optional" json:"ec2Creds" yaml:"ec2Creds"`
	// Ignores synthesis errors, which will likely produce an invalid output.
	// Default: false.
	//
	// Experimental.
	IgnoreErrors *bool `field:"optional" json:"ignoreErrors" yaml:"ignoreErrors"`
	// Use JSON output instead of YAML when templates are printed to STDOUT.
	// Default: false.
	//
	// Experimental.
	Json *bool `field:"optional" json:"json" yaml:"json"`
	// Perform context lookups.
	//
	// Synthesis fails if this is disabled and context lookups need
	// to be performed.
	// Default: true.
	//
	// Experimental.
	Lookups *bool `field:"optional" json:"lookups" yaml:"lookups"`
	// Show relevant notices.
	// Default: true.
	//
	// Experimental.
	Notices *bool `field:"optional" json:"notices" yaml:"notices"`
	// Include "aws:cdk:path" CloudFormation metadata for each resource.
	// Default: true.
	//
	// Experimental.
	PathMetadata *bool `field:"optional" json:"pathMetadata" yaml:"pathMetadata"`
	// Use the indicated AWS profile as the default environment.
	// Default: - no profile is used.
	//
	// Experimental.
	Profile *string `field:"optional" json:"profile" yaml:"profile"`
	// Use the indicated proxy.
	//
	// Will read from
	// HTTPS_PROXY environment if specified.
	// Default: - no proxy.
	//
	// Experimental.
	Proxy *string `field:"optional" json:"proxy" yaml:"proxy"`
	// Role to pass to CloudFormation for deployment.
	// Default: - use the bootstrap cfn-exec role.
	//
	// Experimental.
	RoleArn *string `field:"optional" json:"roleArn" yaml:"roleArn"`
	// List of stacks to deploy.
	// Default: - all stacks.
	//
	// Experimental.
	Stacks *[]*string `field:"optional" json:"stacks" yaml:"stacks"`
	// Copy assets to the output directory.
	//
	// Needed for local debugging the source files with SAM CLI.
	// Default: false.
	//
	// Experimental.
	Staging *bool `field:"optional" json:"staging" yaml:"staging"`
	// Do not construct stacks with warnings.
	// Default: false.
	//
	// Experimental.
	Strict *bool `field:"optional" json:"strict" yaml:"strict"`
	// Print trace for stack warnings.
	// Default: false.
	//
	// Experimental.
	Trace *bool `field:"optional" json:"trace" yaml:"trace"`
	// show debug logs.
	// Default: false.
	//
	// Experimental.
	Verbose *bool `field:"optional" json:"verbose" yaml:"verbose"`
	// Include "AWS::CDK::Metadata" resource in synthesized templates.
	// Default: true.
	//
	// Experimental.
	VersionReporting *bool `field:"optional" json:"versionReporting" yaml:"versionReporting"`
	// Only synthesize the given stack.
	// Default: false.
	//
	// Experimental.
	Exclusively *bool `field:"optional" json:"exclusively" yaml:"exclusively"`
	// Do not output CloudFormation Template to stdout.
	// Default: false;.
	//
	// Experimental.
	Quiet *bool `field:"optional" json:"quiet" yaml:"quiet"`
	// After synthesis, validate stacks with the "validateOnSynth" attribute set (can also be controlled with CDK_VALIDATION).
	// Default: true;.
	//
	// Experimental.
	Validation *bool `field:"optional" json:"validation" yaml:"validation"`
}

Options to use with cdk synth.

Example:

// await this asynchronous method call using a language feature
cli.Synth(&SynthOptions{
	Stacks: []*string{
		jsii.String("MyTestStack"),
	},
})

Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL