///
import * as cxschema from '@aws-cdk/cloud-assembly-schema';
import * as cxapi from '@aws-cdk/cx-api';
import { SdkProvider } from './api/aws-auth';
import { BootstrappingParameters } from './api/bootstrap';
import { CloudFormationDeployments } from './api/cloudformation-deployments';
import { CloudExecutable } from './api/cxapp/cloud-executable';
import { RequireApproval } from './diff';
import { Configuration } from './settings';
export interface CdkToolkitProps {
/**
* The Cloud Executable
*/
cloudExecutable: CloudExecutable;
/**
* The provisioning engine used to apply changes to the cloud
*/
cloudFormation: CloudFormationDeployments;
/**
* Whether to be verbose
*
* @default false
*/
verbose?: boolean;
/**
* Don't stop on error metadata
*
* @default false
*/
ignoreErrors?: boolean;
/**
* Treat warnings in metadata as errors
*
* @default false
*/
strict?: boolean;
/**
* Application configuration (settings and context)
*/
configuration: Configuration;
/**
* AWS object (used by synthesizer and contextprovider)
*/
sdkProvider: SdkProvider;
}
/**
* Toolkit logic
*
* The toolkit runs the `cloudExecutable` to obtain a cloud assembly and
* deploys applies them to `cloudFormation`.
*/
export declare class CdkToolkit {
private readonly props;
constructor(props: CdkToolkitProps);
metadata(stackName: string): Promise<{
[path: string]: cxschema.MetadataEntry[];
}>;
env(): Promise<{
environment: {
account: string | undefined;
region: string;
};
}>;
diff(options: DiffOptions): Promise;
deploy(options: DeployOptions): Promise;
parallelDeploy(options: DeployOptions, prevStackStates?: StackState[]): Promise;
destroy(options: DestroyOptions): Promise;
list(selectors: string[], options?: {
long?: boolean;
sst?: boolean;
outputPath?: string;
}): Promise<0 | {
id: string;
name: string;
environment: cxapi.Environment;
}[] | {
stacks: {
id: string;
name: string;
dependencies: string[];
}[];
}>;
destroyStatus(outputPath: string, options: DeployOptions): Promise<{
status: string;
}>;
/**
* Synthesize the given set of stacks (called when the user runs 'cdk synth')
*
* INPUT: Stack names can be supplied using a glob filter. If no stacks are
* given, all stacks from the application are implictly selected.
*
* OUTPUT: If more than one stack ends up being selected, an output directory
* should be supplied, where the templates will be written.
*/
synth(stackNames: string[], exclusively: boolean, options?: {
sst?: boolean;
}): Promise;
/**
* Bootstrap the CDK Toolkit stack in the accounts used by the specified stack(s).
*
* @param environmentSpecs environment names that need to have toolkit support
* provisioned, as a glob filter. If none is provided,
* all stacks are implicitly selected.
* @param toolkitStackName the name to be used for the CDK Toolkit stack.
*/
bootstrap(environmentSpecs: string[], toolkitStackName: string | undefined, roleArn: string | undefined, useNewBootstrapping: boolean, force: boolean | undefined, props: BootstrappingParameters, sst?: boolean, outputPath?: string): Promise;
private selectStacksForList;
private selectStacksForDeploy;
private selectStacksForDeployAll;
private selectStacksForDiff;
private selectStacksForDestroy;
private selectStacksForDestroyAll;
/**
* Validate the stacks for errors and warnings according to the CLI's current settings
*/
private validateStacks;
/**
* Select a single stack by its name
*/
private selectSingleStackByName;
private assembly;
}
export interface DiffOptions {
/**
* Stack names to diff
*/
stackNames: string[];
/**
* Only select the given stack
*
* @default false
*/
exclusively?: boolean;
/**
* Used a template from disk instead of from the server
*
* @default Use from the server
*/
templatePath?: string;
/**
* Strict diff mode
*
* @default false
*/
strict?: boolean;
/**
* How many lines of context to show in the diff
*
* @default 3
*/
contextLines?: number;
/**
* Where to write the default
*
* @default stderr
*/
stream?: NodeJS.WritableStream;
/**
* Whether to fail with exit code 1 in case of diff
*
* @default false
*/
fail?: boolean;
}
export interface DeployOptions {
/**
* Stack names to deploy
*/
stackNames: string[];
/**
* Only select the given stack
*
* @default false
*/
exclusively?: boolean;
/**
* Name of the toolkit stack to use/deploy
*
* @default CDKToolkit
*/
toolkitStackName?: string;
/**
* Role to pass to CloudFormation for deployment
*/
roleArn?: string;
/**
* ARNs of SNS topics that CloudFormation will notify with stack related events
*/
notificationArns?: string[];
/**
* What kind of security changes require approval
*
* @default RequireApproval.Broadening
*/
requireApproval?: RequireApproval;
/**
* Reuse the assets with the given asset IDs
*/
reuseAssets?: string[];
/**
* Tags to pass to CloudFormation for deployment
*/
tags?: Tag[];
/**
* Whether to execute the ChangeSet
* Not providing `execute` parameter will result in execution of ChangeSet
* @default true
*/
execute?: boolean;
/**
* Always deploy, even if templates are identical.
* @default false
*/
force?: boolean;
/**
* Additional parameters for CloudFormation at deploy time
* @default {}
*/
parameters?: {
[name: string]: string | undefined;
};
/**
* Use previous values for unspecified parameters
*
* If not set, all parameters must be specified for every deployment.
*
* @default true
*/
usePreviousParameters?: boolean;
/**
* Whether we are on a CI system
*
* @default false
*/
readonly ci?: boolean;
/**
* Path to file where stack outputs will be written after a successful deploy as JSON
* @default - Outputs are not written to any file
*/
outputsFile?: string;
/**
* Path to pre-existing cdk.out
* @default - cdk.out is auto-generated
*/
outputPath?: string;
/**
* Start dpeloying and returns right away.
* @default false
*/
async?: boolean;
/**
* Whether called from sst cli.
* @default false
*/
sst?: boolean;
}
export interface DestroyOptions {
/**
* The names of the stacks to delete
*/
stackNames: string[];
/**
* Whether to exclude stacks that depend on the stacks to be deleted
*/
exclusively: boolean;
/**
* Whether to skip prompting for confirmation
*/
force: boolean;
/**
* The arn of the IAM role to use
*/
roleArn?: string;
/**
* Whether the destroy request came from a deploy.
*/
fromDeploy?: boolean;
/**
* Path to pre-existing cdk.out
* @default - cdk.out is auto-generated
*/
outputPath?: string;
/**
* Start dpeloying and returns right away.
* @default false
*/
async?: boolean;
/**
* Whether called from sst cli.
* @default false
*/
sst?: boolean;
}
export interface Tag {
readonly Key: string;
readonly Value: string;
}
export interface ProgressState {
isCompleted: boolean;
stackStates: StackState[];
}
export interface StackState {
stack: cxapi.CloudFormationStackArtifact;
name: string;
status: string;
dependencies: any[];
account?: string;
region?: string;
startedAt?: number;
endedAt?: number;
events?: StackEvent[];
eventsLatestErrorMessage?: string;
eventsFirstEventAt?: Date;
resourceCount?: number;
resourceDoneCount?: number;
errorMessage?: string;
stackArn?: string;
outputs?: Record;
}
interface StackEvent {
eventId: string;
timestamp: Date;
resourceType?: string;
resourceStatus?: string;
resourceStatusReason?: string;
logicalResourceId?: string;
}
export {};