Skip to content
v2.277.0

DestroyCommand Struct ​

Represents a cdk destroy command.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cloud_assembly_schema } from 'aws-cdk-lib';
const destroyCommand: cloud_assembly_schema.DestroyCommand = {
  args: {
    all: false,
    app: 'app',
    assetMetadata: false,
    caBundlePath: 'caBundlePath',
    color: false,
    context: {
      contextKey: 'context',
    },
    debug: false,
    ec2Creds: false,
    exclusively: false,
    force: false,
    ignoreErrors: false,
    json: false,
    lookups: false,
    notices: false,
    output: 'output',
    pathMetadata: false,
    profile: 'profile',
    proxy: 'proxy',
    roleArn: 'roleArn',
    stacks: ['stacks'],
    staging: false,
    strict: false,
    trace: false,
    verbose: false,
    versionReporting: false,
  },
  enabled: false,
  expectedMessage: 'expectedMessage',
  expectError: false,
};
python
from aws_cdk.cloud_assembly_schema import DestroyCommand, DestroyOptions
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import cloud_assembly_schema

destroy_command = DestroyCommand(
    args=DestroyOptions(
        all=False,
        app="app",
        asset_metadata=False,
        ca_bundle_path="caBundlePath",
        color=False,
        context={
            "context_key": "context"
        },
        debug=False,
        ec2_creds=False,
        exclusively=False,
        force=False,
        ignore_errors=False,
        json=False,
        lookups=False,
        notices=False,
        output="output",
        path_metadata=False,
        profile="profile",
        proxy="proxy",
        role_arn="roleArn",
        stacks=["stacks"],
        staging=False,
        strict=False,
        trace=False,
        verbose=False,
        version_reporting=False
    ),
    enabled=False,
    expected_message="expectedMessage",
    expect_error=False
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.cloud_assembly_schema.*;

DestroyCommand destroyCommand = DestroyCommand.builder()
        .args(DestroyOptions.builder()
                .all(false)
                .app("app")
                .assetMetadata(false)
                .caBundlePath("caBundlePath")
                .color(false)
                .context(Map.of(
                        "contextKey", "context"))
                .debug(false)
                .ec2Creds(false)
                .exclusively(false)
                .force(false)
                .ignoreErrors(false)
                .json(false)
                .lookups(false)
                .notices(false)
                .output("output")
                .pathMetadata(false)
                .profile("profile")
                .proxy("proxy")
                .roleArn("roleArn")
                .stacks(List.of("stacks"))
                .staging(false)
                .strict(false)
                .trace(false)
                .verbose(false)
                .versionReporting(false)
                .build())
        .enabled(false)
        .expectedMessage("expectedMessage")
        .expectError(false)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.Cloud_assembly_schema;

var destroyCommand = new DestroyCommand {
    Args = new DestroyOptions {
        All = false,
        App = "app",
        AssetMetadata = false,
        CaBundlePath = "caBundlePath",
        Color = false,
        Context = new Dictionary<string, string> {
            { "contextKey", "context" }
        },
        Debug = false,
        Ec2Creds = false,
        Exclusively = false,
        Force = false,
        IgnoreErrors = false,
        Json = false,
        Lookups = false,
        Notices = false,
        Output = "output",
        PathMetadata = false,
        Profile = "profile",
        Proxy = "proxy",
        RoleArn = "roleArn",
        Stacks = new [] { "stacks" },
        Staging = false,
        Strict = false,
        Trace = false,
        Verbose = false,
        VersionReporting = false
    },
    Enabled = false,
    ExpectedMessage = "expectedMessage",
    ExpectError = false
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

destroyCommand := &DestroyCommand{
	Args: &DestroyOptions{
		All: jsii.Boolean(false),
		App: jsii.String("app"),
		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),
		Exclusively: jsii.Boolean(false),
		Force: jsii.Boolean(false),
		IgnoreErrors: jsii.Boolean(false),
		Json: jsii.Boolean(false),
		Lookups: jsii.Boolean(false),
		Notices: jsii.Boolean(false),
		Output: jsii.String("output"),
		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),
	},
	Enabled: jsii.Boolean(false),
	ExpectedMessage: jsii.String("expectedMessage"),
	ExpectError: jsii.Boolean(false),
}

Properties ​

argsoptionalDestroyOptionsargsoptionalDestroyOptionsargsoptionalDestroyOptionsArgsoptionalDestroyOptionsArgsoptionalDestroyOptions#
Additional arguments to pass to the command This can be used to test specific CLI functionality.

Default: only default args are used

enabledoptionalbooleanenabledoptionalboolenabledoptionalBooleanEnabledoptionalboolEnabledoptional*bool= true#
Whether or not to run this command as part of the workflow This can be used if you only want to test some of the workflow for example enable `synth` and disable `deploy` & `destroy` in order to limit the test to synthesis.
expectedMessageoptionalstringexpected_messageoptionalstrexpectedMessageoptionalStringExpectedMessageoptionalstringExpectedMessageoptional*string#
This can be used in combination with `expectedError` to validate that a specific message is returned.

Default: do not validate message

expectErroroptionalbooleanexpect_erroroptionalboolexpectErroroptionalBooleanExpectErroroptionalboolExpectErroroptional*bool= false#
If the runner should expect this command to fail.