UNPKG

5.01 kBTypeScriptView Raw
1import type { PropertyDifference, Resource } from '@aws-cdk/cloudformation-diff';
2import type { SDK } from '../aws-auth';
3export declare const ICON = "\u2728";
4export interface HotswappableChange {
5 readonly hotswappable: true;
6 readonly resourceType: string;
7 readonly propsChanged: Array<string>;
8 /**
9 * The name of the service being hotswapped.
10 * Used to set a custom User-Agent for SDK calls.
11 */
12 readonly service: string;
13 /**
14 * The names of the resources being hotswapped.
15 */
16 readonly resourceNames: string[];
17 readonly apply: (sdk: SDK) => Promise<void>;
18}
19export interface NonHotswappableChange {
20 readonly hotswappable: false;
21 readonly resourceType: string;
22 readonly rejectedChanges: Array<string>;
23 readonly logicalId: string;
24 /**
25 * Tells the user exactly why this change was deemed non-hotswappable and what its logical ID is.
26 * If not specified, `reason` will be autofilled to state that the properties listed in `rejectedChanges` are not hotswappable.
27 */
28 readonly reason?: string;
29 /**
30 * Whether or not to show this change when listing non-hotswappable changes in HOTSWAP_ONLY mode. Does not affect
31 * listing in FALL_BACK mode.
32 *
33 * @default true
34 */
35 readonly hotswapOnlyVisible?: boolean;
36}
37export type ChangeHotswapResult = Array<HotswappableChange | NonHotswappableChange>;
38export interface ClassifiedResourceChanges {
39 hotswappableChanges: HotswappableChange[];
40 nonHotswappableChanges: NonHotswappableChange[];
41}
42export declare enum HotswapMode {
43 /**
44 * Will fall back to CloudFormation when a non-hotswappable change is detected
45 */
46 FALL_BACK = "fall-back",
47 /**
48 * Will not fall back to CloudFormation when a non-hotswappable change is detected
49 */
50 HOTSWAP_ONLY = "hotswap-only",
51 /**
52 * Will not attempt to hotswap anything and instead go straight to CloudFormation
53 */
54 FULL_DEPLOYMENT = "full-deployment"
55}
56/**
57 * Represents a change that can be hotswapped.
58 */
59export declare class HotswappableChangeCandidate {
60 /**
61 * The logical ID of the resource which is being changed
62 */
63 readonly logicalId: string;
64 /**
65 * The value the resource is being updated from
66 */
67 readonly oldValue: Resource;
68 /**
69 * The value the resource is being updated to
70 */
71 readonly newValue: Resource;
72 /**
73 * The changes made to the resource properties
74 */
75 readonly propertyUpdates: PropDiffs;
76 constructor(logicalId: string, oldValue: Resource, newValue: Resource, propertyUpdates: PropDiffs);
77}
78type Exclude = {
79 [key: string]: Exclude | true;
80};
81/**
82 * Represents configuration property overrides for hotswap deployments
83 */
84export declare class HotswapPropertyOverrides {
85 ecsHotswapProperties?: EcsHotswapProperties;
86 constructor(ecsHotswapProperties?: EcsHotswapProperties);
87}
88/**
89 * Represents configuration properties for ECS hotswap deployments
90 */
91export declare class EcsHotswapProperties {
92 readonly minimumHealthyPercent?: number;
93 readonly maximumHealthyPercent?: number;
94 constructor(minimumHealthyPercent?: number, maximumHealthyPercent?: number);
95 /**
96 * Check if any hotswap properties are defined
97 * @returns true if all properties are undefined, false otherwise
98 */
99 isEmpty(): boolean;
100}
101/**
102 * This function transforms all keys (recursively) in the provided `val` object.
103 *
104 * @param val The object whose keys need to be transformed.
105 * @param transform The function that will be applied to each key.
106 * @param exclude The keys that will not be transformed and copied to output directly
107 * @returns A new object with the same values as `val`, but with all keys transformed according to `transform`.
108 */
109export declare function transformObjectKeys(val: any, transform: (str: string) => string, exclude?: Exclude): any;
110/**
111 * This function lower cases the first character of the string provided.
112 */
113export declare function lowerCaseFirstCharacter(str: string): string;
114export type PropDiffs = Record<string, PropertyDifference<any>>;
115export declare class ClassifiedChanges {
116 readonly change: HotswappableChangeCandidate;
117 readonly hotswappableProps: PropDiffs;
118 readonly nonHotswappableProps: PropDiffs;
119 constructor(change: HotswappableChangeCandidate, hotswappableProps: PropDiffs, nonHotswappableProps: PropDiffs);
120 reportNonHotswappablePropertyChanges(ret: ChangeHotswapResult): void;
121 get namesOfHotswappableProps(): string[];
122}
123export declare function classifyChanges(xs: HotswappableChangeCandidate, hotswappablePropNames: string[]): ClassifiedChanges;
124export declare function reportNonHotswappableChange(ret: ChangeHotswapResult, change: HotswappableChangeCandidate, nonHotswappableProps?: PropDiffs, reason?: string, hotswapOnlyVisible?: boolean): void;
125export declare function reportNonHotswappableResource(change: HotswappableChangeCandidate, reason?: string): ChangeHotswapResult;
126export {};