aws-cdk
Version:
CDK Toolkit, the command line tool for CDK apps
127 lines (126 loc) • 5.01 kB
TypeScript
import type { PropertyDifference, Resource } from '@aws-cdk/cloudformation-diff';
import type { SDK } from '../aws-auth';
export declare const ICON = "\u2728";
export interface HotswappableChange {
readonly hotswappable: true;
readonly resourceType: string;
readonly propsChanged: Array<string>;
/**
* The name of the service being hotswapped.
* Used to set a custom User-Agent for SDK calls.
*/
readonly service: string;
/**
* The names of the resources being hotswapped.
*/
readonly resourceNames: string[];
readonly apply: (sdk: SDK) => Promise<void>;
}
export interface NonHotswappableChange {
readonly hotswappable: false;
readonly resourceType: string;
readonly rejectedChanges: Array<string>;
readonly logicalId: string;
/**
* Tells the user exactly why this change was deemed non-hotswappable and what its logical ID is.
* If not specified, `reason` will be autofilled to state that the properties listed in `rejectedChanges` are not hotswappable.
*/
readonly reason?: string;
/**
* Whether or not to show this change when listing non-hotswappable changes in HOTSWAP_ONLY mode. Does not affect
* listing in FALL_BACK mode.
*
* @default true
*/
readonly hotswapOnlyVisible?: boolean;
}
export type ChangeHotswapResult = Array<HotswappableChange | NonHotswappableChange>;
export interface ClassifiedResourceChanges {
hotswappableChanges: HotswappableChange[];
nonHotswappableChanges: NonHotswappableChange[];
}
export declare enum HotswapMode {
/**
* Will fall back to CloudFormation when a non-hotswappable change is detected
*/
FALL_BACK = "fall-back",
/**
* Will not fall back to CloudFormation when a non-hotswappable change is detected
*/
HOTSWAP_ONLY = "hotswap-only",
/**
* Will not attempt to hotswap anything and instead go straight to CloudFormation
*/
FULL_DEPLOYMENT = "full-deployment"
}
/**
* Represents a change that can be hotswapped.
*/
export declare class HotswappableChangeCandidate {
/**
* The logical ID of the resource which is being changed
*/
readonly logicalId: string;
/**
* The value the resource is being updated from
*/
readonly oldValue: Resource;
/**
* The value the resource is being updated to
*/
readonly newValue: Resource;
/**
* The changes made to the resource properties
*/
readonly propertyUpdates: PropDiffs;
constructor(logicalId: string, oldValue: Resource, newValue: Resource, propertyUpdates: PropDiffs);
}
type Exclude = {
[key: string]: Exclude | true;
};
/**
* Represents configuration property overrides for hotswap deployments
*/
export declare class HotswapPropertyOverrides {
ecsHotswapProperties?: EcsHotswapProperties;
constructor(ecsHotswapProperties?: EcsHotswapProperties);
}
/**
* Represents configuration properties for ECS hotswap deployments
*/
export declare class EcsHotswapProperties {
readonly minimumHealthyPercent?: number;
readonly maximumHealthyPercent?: number;
constructor(minimumHealthyPercent?: number, maximumHealthyPercent?: number);
/**
* Check if any hotswap properties are defined
* @returns true if all properties are undefined, false otherwise
*/
isEmpty(): boolean;
}
/**
* This function transforms all keys (recursively) in the provided `val` object.
*
* @param val The object whose keys need to be transformed.
* @param transform The function that will be applied to each key.
* @param exclude The keys that will not be transformed and copied to output directly
* @returns A new object with the same values as `val`, but with all keys transformed according to `transform`.
*/
export declare function transformObjectKeys(val: any, transform: (str: string) => string, exclude?: Exclude): any;
/**
* This function lower cases the first character of the string provided.
*/
export declare function lowerCaseFirstCharacter(str: string): string;
export type PropDiffs = Record<string, PropertyDifference<any>>;
export declare class ClassifiedChanges {
readonly change: HotswappableChangeCandidate;
readonly hotswappableProps: PropDiffs;
readonly nonHotswappableProps: PropDiffs;
constructor(change: HotswappableChangeCandidate, hotswappableProps: PropDiffs, nonHotswappableProps: PropDiffs);
reportNonHotswappablePropertyChanges(ret: ChangeHotswapResult): void;
get namesOfHotswappableProps(): string[];
}
export declare function classifyChanges(xs: HotswappableChangeCandidate, hotswappablePropNames: string[]): ClassifiedChanges;
export declare function reportNonHotswappableChange(ret: ChangeHotswapResult, change: HotswappableChangeCandidate, nonHotswappableProps?: PropDiffs, reason?: string, hotswapOnlyVisible?: boolean): void;
export declare function reportNonHotswappableResource(change: HotswappableChangeCandidate, reason?: string): ChangeHotswapResult;
export {};