Skip to content

Commit c78d705

Browse files
authored
feat(clients): waiter code generation (#1784)
1 parent 3d6eb2d commit c78d705

File tree

190 files changed

+6633
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+6633
-0
lines changed

Diff for: clients/client-acm-pca/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ export * from "./commands/DeletePermissionCommand";
88
export * from "./commands/DeletePolicyCommand";
99
export * from "./commands/DescribeCertificateAuthorityCommand";
1010
export * from "./commands/DescribeCertificateAuthorityAuditReportCommand";
11+
export * from "./waiters/waitForAuditReportCreated";
1112
export * from "./commands/GetCertificateCommand";
13+
export * from "./waiters/waitForCertificateIssued";
1214
export * from "./commands/GetCertificateAuthorityCertificateCommand";
1315
export * from "./commands/GetCertificateAuthorityCsrCommand";
16+
export * from "./waiters/waitForCertificateAuthorityCSRCreated";
1417
export * from "./commands/GetPolicyCommand";
1518
export * from "./commands/ImportCertificateAuthorityCertificateCommand";
1619
export * from "./commands/IssueCertificateCommand";

Diff for: clients/client-acm-pca/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@aws-sdk/util-user-agent-node": "1.0.0-rc.8",
5656
"@aws-sdk/util-utf8-browser": "1.0.0-rc.8",
5757
"@aws-sdk/util-utf8-node": "1.0.0-rc.8",
58+
"@aws-sdk/util-waiter": "1.0.0-rc.9",
5859
"tslib": "^2.0.0"
5960
},
6061
"devDependencies": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { ACMPCAClient } from "../ACMPCAClient";
2+
import {
3+
DescribeCertificateAuthorityAuditReportCommand,
4+
DescribeCertificateAuthorityAuditReportCommandInput,
5+
} from "../commands/DescribeCertificateAuthorityAuditReportCommand";
6+
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";
7+
8+
const checkState = async (
9+
client: ACMPCAClient,
10+
input: DescribeCertificateAuthorityAuditReportCommandInput
11+
): Promise<WaiterResult> => {
12+
try {
13+
let result: any = await client.send(new DescribeCertificateAuthorityAuditReportCommand(input));
14+
try {
15+
let returnComparator = () => {
16+
return result.AuditReportStatus;
17+
};
18+
if (returnComparator() === "SUCCESS") {
19+
return { state: WaiterState.SUCCESS };
20+
}
21+
} catch (e) {}
22+
try {
23+
let returnComparator = () => {
24+
return result.AuditReportStatus;
25+
};
26+
if (returnComparator() === "FAILED") {
27+
return { state: WaiterState.FAILURE };
28+
}
29+
} catch (e) {}
30+
} catch (exception) {}
31+
return { state: WaiterState.RETRY };
32+
};
33+
/**
34+
* Wait until a Audit Report is created
35+
* @param params : Waiter configuration options.
36+
* @param input : the input to DescribeCertificateAuthorityAuditReportCommand for polling.
37+
*/
38+
export const waitForAuditReportCreated = async (
39+
params: WaiterConfiguration<ACMPCAClient>,
40+
input: DescribeCertificateAuthorityAuditReportCommandInput
41+
): Promise<WaiterResult> => {
42+
const serviceDefaults = { minDelay: 3, maxDelay: 120 };
43+
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
44+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { ACMPCAClient } from "../ACMPCAClient";
2+
import {
3+
GetCertificateAuthorityCsrCommand,
4+
GetCertificateAuthorityCsrCommandInput,
5+
} from "../commands/GetCertificateAuthorityCsrCommand";
6+
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";
7+
8+
const checkState = async (
9+
client: ACMPCAClient,
10+
input: GetCertificateAuthorityCsrCommandInput
11+
): Promise<WaiterResult> => {
12+
try {
13+
let result: any = await client.send(new GetCertificateAuthorityCsrCommand(input));
14+
return { state: WaiterState.SUCCESS };
15+
} catch (exception) {
16+
if (exception.name && exception.name == "RequestInProgressException") {
17+
return { state: WaiterState.RETRY };
18+
}
19+
}
20+
return { state: WaiterState.RETRY };
21+
};
22+
/**
23+
* Wait until a Certificate Authority CSR is created
24+
* @param params : Waiter configuration options.
25+
* @param input : the input to GetCertificateAuthorityCsrCommand for polling.
26+
*/
27+
export const waitForCertificateAuthorityCSRCreated = async (
28+
params: WaiterConfiguration<ACMPCAClient>,
29+
input: GetCertificateAuthorityCsrCommandInput
30+
): Promise<WaiterResult> => {
31+
const serviceDefaults = { minDelay: 3, maxDelay: 120 };
32+
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
33+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { ACMPCAClient } from "../ACMPCAClient";
2+
import { GetCertificateCommand, GetCertificateCommandInput } from "../commands/GetCertificateCommand";
3+
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";
4+
5+
const checkState = async (client: ACMPCAClient, input: GetCertificateCommandInput): Promise<WaiterResult> => {
6+
try {
7+
let result: any = await client.send(new GetCertificateCommand(input));
8+
return { state: WaiterState.SUCCESS };
9+
} catch (exception) {
10+
if (exception.name && exception.name == "RequestInProgressException") {
11+
return { state: WaiterState.RETRY };
12+
}
13+
}
14+
return { state: WaiterState.RETRY };
15+
};
16+
/**
17+
* Wait until a certificate is issued
18+
* @param params : Waiter configuration options.
19+
* @param input : the input to GetCertificateCommand for polling.
20+
*/
21+
export const waitForCertificateIssued = async (
22+
params: WaiterConfiguration<ACMPCAClient>,
23+
input: GetCertificateCommandInput
24+
): Promise<WaiterResult> => {
25+
const serviceDefaults = { minDelay: 3, maxDelay: 120 };
26+
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
27+
};

Diff for: clients/client-acm/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export * from "./ACM";
33
export * from "./commands/AddTagsToCertificateCommand";
44
export * from "./commands/DeleteCertificateCommand";
55
export * from "./commands/DescribeCertificateCommand";
6+
export * from "./waiters/waitForCertificateValidated";
67
export * from "./commands/ExportCertificateCommand";
78
export * from "./commands/GetCertificateCommand";
89
export * from "./commands/ImportCertificateCommand";

Diff for: clients/client-acm/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@aws-sdk/util-user-agent-node": "1.0.0-rc.8",
5656
"@aws-sdk/util-utf8-browser": "1.0.0-rc.8",
5757
"@aws-sdk/util-utf8-node": "1.0.0-rc.8",
58+
"@aws-sdk/util-waiter": "1.0.0-rc.9",
5859
"tslib": "^2.0.0"
5960
},
6061
"devDependencies": {
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { ACMClient } from "../ACMClient";
2+
import { DescribeCertificateCommand, DescribeCertificateCommandInput } from "../commands/DescribeCertificateCommand";
3+
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";
4+
5+
const checkState = async (client: ACMClient, input: DescribeCertificateCommandInput): Promise<WaiterResult> => {
6+
try {
7+
let result: any = await client.send(new DescribeCertificateCommand(input));
8+
try {
9+
let returnComparator = () => {
10+
let flat_1: any[] = [].concat(...result.Certificate.DomainValidationOptions);
11+
let projection_3 = flat_1.map((element_2: any) => {
12+
return element_2.ValidationStatus;
13+
});
14+
return projection_3;
15+
};
16+
let allStringEq_5 = returnComparator().length > 0;
17+
for (let element_4 of returnComparator()) {
18+
allStringEq_5 = allStringEq_5 && element_4 == "SUCCESS";
19+
}
20+
if (allStringEq_5) {
21+
return { state: WaiterState.SUCCESS };
22+
}
23+
} catch (e) {}
24+
try {
25+
let returnComparator = () => {
26+
let flat_1: any[] = [].concat(...result.Certificate.DomainValidationOptions);
27+
let projection_3 = flat_1.map((element_2: any) => {
28+
return element_2.ValidationStatus;
29+
});
30+
return projection_3;
31+
};
32+
for (let anyStringEq_4 of returnComparator()) {
33+
if (anyStringEq_4 == "PENDING_VALIDATION") {
34+
return { state: WaiterState.RETRY };
35+
}
36+
}
37+
} catch (e) {}
38+
try {
39+
let returnComparator = () => {
40+
return result.Certificate.Status;
41+
};
42+
if (returnComparator() === "FAILED") {
43+
return { state: WaiterState.FAILURE };
44+
}
45+
} catch (e) {}
46+
} catch (exception) {
47+
if (exception.name && exception.name == "ResourceNotFoundException") {
48+
return { state: WaiterState.FAILURE };
49+
}
50+
}
51+
return { state: WaiterState.RETRY };
52+
};
53+
/**
54+
*
55+
* @param params : Waiter configuration options.
56+
* @param input : the input to DescribeCertificateCommand for polling.
57+
*/
58+
export const waitForCertificateValidated = async (
59+
params: WaiterConfiguration<ACMClient>,
60+
input: DescribeCertificateCommandInput
61+
): Promise<WaiterResult> => {
62+
const serviceDefaults = { minDelay: 60, maxDelay: 120 };
63+
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
64+
};

Diff for: clients/client-appstream/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export * from "./commands/DeleteUsageReportSubscriptionCommand";
2222
export * from "./commands/DeleteUserCommand";
2323
export * from "./commands/DescribeDirectoryConfigsCommand";
2424
export * from "./commands/DescribeFleetsCommand";
25+
export * from "./waiters/waitForFleetStarted";
26+
export * from "./waiters/waitForFleetStopped";
2527
export * from "./commands/DescribeImageBuildersCommand";
2628
export * from "./commands/DescribeImagePermissionsCommand";
2729
export * from "./pagination/DescribeImagePermissionsPaginator";

Diff for: clients/client-appstream/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@aws-sdk/util-user-agent-node": "1.0.0-rc.8",
5656
"@aws-sdk/util-utf8-browser": "1.0.0-rc.8",
5757
"@aws-sdk/util-utf8-node": "1.0.0-rc.8",
58+
"@aws-sdk/util-waiter": "1.0.0-rc.9",
5859
"tslib": "^2.0.0"
5960
},
6061
"devDependencies": {
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { AppStreamClient } from "../AppStreamClient";
2+
import { DescribeFleetsCommand, DescribeFleetsCommandInput } from "../commands/DescribeFleetsCommand";
3+
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";
4+
5+
const checkState = async (client: AppStreamClient, input: DescribeFleetsCommandInput): Promise<WaiterResult> => {
6+
try {
7+
let result: any = await client.send(new DescribeFleetsCommand(input));
8+
try {
9+
let returnComparator = () => {
10+
let flat_1: any[] = [].concat(...result.Fleets);
11+
let projection_3 = flat_1.map((element_2: any) => {
12+
return element_2.State;
13+
});
14+
return projection_3;
15+
};
16+
let allStringEq_5 = returnComparator().length > 0;
17+
for (let element_4 of returnComparator()) {
18+
allStringEq_5 = allStringEq_5 && element_4 == "ACTIVE";
19+
}
20+
if (allStringEq_5) {
21+
return { state: WaiterState.SUCCESS };
22+
}
23+
} catch (e) {}
24+
try {
25+
let returnComparator = () => {
26+
let flat_1: any[] = [].concat(...result.Fleets);
27+
let projection_3 = flat_1.map((element_2: any) => {
28+
return element_2.State;
29+
});
30+
return projection_3;
31+
};
32+
for (let anyStringEq_4 of returnComparator()) {
33+
if (anyStringEq_4 == "PENDING_DEACTIVATE") {
34+
return { state: WaiterState.FAILURE };
35+
}
36+
}
37+
} catch (e) {}
38+
try {
39+
let returnComparator = () => {
40+
let flat_1: any[] = [].concat(...result.Fleets);
41+
let projection_3 = flat_1.map((element_2: any) => {
42+
return element_2.State;
43+
});
44+
return projection_3;
45+
};
46+
for (let anyStringEq_4 of returnComparator()) {
47+
if (anyStringEq_4 == "INACTIVE") {
48+
return { state: WaiterState.FAILURE };
49+
}
50+
}
51+
} catch (e) {}
52+
} catch (exception) {}
53+
return { state: WaiterState.RETRY };
54+
};
55+
/**
56+
*
57+
* @param params : Waiter configuration options.
58+
* @param input : the input to DescribeFleetsCommand for polling.
59+
*/
60+
export const waitForFleetStarted = async (
61+
params: WaiterConfiguration<AppStreamClient>,
62+
input: DescribeFleetsCommandInput
63+
): Promise<WaiterResult> => {
64+
const serviceDefaults = { minDelay: 30, maxDelay: 120 };
65+
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
66+
};
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { AppStreamClient } from "../AppStreamClient";
2+
import { DescribeFleetsCommand, DescribeFleetsCommandInput } from "../commands/DescribeFleetsCommand";
3+
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";
4+
5+
const checkState = async (client: AppStreamClient, input: DescribeFleetsCommandInput): Promise<WaiterResult> => {
6+
try {
7+
let result: any = await client.send(new DescribeFleetsCommand(input));
8+
try {
9+
let returnComparator = () => {
10+
let flat_1: any[] = [].concat(...result.Fleets);
11+
let projection_3 = flat_1.map((element_2: any) => {
12+
return element_2.State;
13+
});
14+
return projection_3;
15+
};
16+
let allStringEq_5 = returnComparator().length > 0;
17+
for (let element_4 of returnComparator()) {
18+
allStringEq_5 = allStringEq_5 && element_4 == "INACTIVE";
19+
}
20+
if (allStringEq_5) {
21+
return { state: WaiterState.SUCCESS };
22+
}
23+
} catch (e) {}
24+
try {
25+
let returnComparator = () => {
26+
let flat_1: any[] = [].concat(...result.Fleets);
27+
let projection_3 = flat_1.map((element_2: any) => {
28+
return element_2.State;
29+
});
30+
return projection_3;
31+
};
32+
for (let anyStringEq_4 of returnComparator()) {
33+
if (anyStringEq_4 == "PENDING_ACTIVATE") {
34+
return { state: WaiterState.FAILURE };
35+
}
36+
}
37+
} catch (e) {}
38+
try {
39+
let returnComparator = () => {
40+
let flat_1: any[] = [].concat(...result.Fleets);
41+
let projection_3 = flat_1.map((element_2: any) => {
42+
return element_2.State;
43+
});
44+
return projection_3;
45+
};
46+
for (let anyStringEq_4 of returnComparator()) {
47+
if (anyStringEq_4 == "ACTIVE") {
48+
return { state: WaiterState.FAILURE };
49+
}
50+
}
51+
} catch (e) {}
52+
} catch (exception) {}
53+
return { state: WaiterState.RETRY };
54+
};
55+
/**
56+
*
57+
* @param params : Waiter configuration options.
58+
* @param input : the input to DescribeFleetsCommand for polling.
59+
*/
60+
export const waitForFleetStopped = async (
61+
params: WaiterConfiguration<AppStreamClient>,
62+
input: DescribeFleetsCommandInput
63+
): Promise<WaiterResult> => {
64+
const serviceDefaults = { minDelay: 30, maxDelay: 120 };
65+
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
66+
};

Diff for: clients/client-auto-scaling/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export * from "./commands/DescribeAccountLimitsCommand";
2121
export * from "./commands/DescribeAdjustmentTypesCommand";
2222
export * from "./commands/DescribeAutoScalingGroupsCommand";
2323
export * from "./pagination/DescribeAutoScalingGroupsPaginator";
24+
export * from "./waiters/waitForGroupExists";
25+
export * from "./waiters/waitForGroupInService";
26+
export * from "./waiters/waitForGroupNotExists";
2427
export * from "./commands/DescribeAutoScalingInstancesCommand";
2528
export * from "./pagination/DescribeAutoScalingInstancesPaginator";
2629
export * from "./commands/DescribeAutoScalingNotificationTypesCommand";

Diff for: clients/client-auto-scaling/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@aws-sdk/util-user-agent-node": "1.0.0-rc.8",
5656
"@aws-sdk/util-utf8-browser": "1.0.0-rc.8",
5757
"@aws-sdk/util-utf8-node": "1.0.0-rc.8",
58+
"@aws-sdk/util-waiter": "1.0.0-rc.9",
5859
"fast-xml-parser": "^3.16.0",
5960
"tslib": "^2.0.0"
6061
},

0 commit comments

Comments
 (0)