UNPKG

aws-cdk

Version:

CDK Toolkit, the command line tool for CDK apps

107 lines (106 loc) 4.34 kB
import * as cfn_diff from '@aws-cdk/cloudformation-diff'; import { ISDK } 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: ISDK) => 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: cfn_diff.Resource; /** * The value the resource is being updated to */ readonly newValue: cfn_diff.Resource; /** * The changes made to the resource properties */ readonly propertyUpdates: PropDiffs; constructor(logicalId: string, oldValue: cfn_diff.Resource, newValue: cfn_diff.Resource, propertyUpdates: PropDiffs); } type Exclude = { [key: string]: Exclude | true; }; /** * 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, cfn_diff.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 {};