Skip to content

Commit

Permalink
feat(clients): waiter code generation (#1784)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexforsyth committed Dec 14, 2020
1 parent 3d6eb2d commit c78d705
Show file tree
Hide file tree
Showing 190 changed files with 6,633 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clients/client-acm-pca/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ export * from "./commands/DeletePermissionCommand";
export * from "./commands/DeletePolicyCommand";
export * from "./commands/DescribeCertificateAuthorityCommand";
export * from "./commands/DescribeCertificateAuthorityAuditReportCommand";
export * from "./waiters/waitForAuditReportCreated";
export * from "./commands/GetCertificateCommand";
export * from "./waiters/waitForCertificateIssued";
export * from "./commands/GetCertificateAuthorityCertificateCommand";
export * from "./commands/GetCertificateAuthorityCsrCommand";
export * from "./waiters/waitForCertificateAuthorityCSRCreated";
export * from "./commands/GetPolicyCommand";
export * from "./commands/ImportCertificateAuthorityCertificateCommand";
export * from "./commands/IssueCertificateCommand";
Expand Down
1 change: 1 addition & 0 deletions clients/client-acm-pca/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@aws-sdk/util-user-agent-node": "1.0.0-rc.8",
"@aws-sdk/util-utf8-browser": "1.0.0-rc.8",
"@aws-sdk/util-utf8-node": "1.0.0-rc.8",
"@aws-sdk/util-waiter": "1.0.0-rc.9",
"tslib": "^2.0.0"
},
"devDependencies": {
Expand Down
44 changes: 44 additions & 0 deletions clients/client-acm-pca/waiters/waitForAuditReportCreated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { ACMPCAClient } from "../ACMPCAClient";
import {
DescribeCertificateAuthorityAuditReportCommand,
DescribeCertificateAuthorityAuditReportCommandInput,
} from "../commands/DescribeCertificateAuthorityAuditReportCommand";
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";

const checkState = async (
client: ACMPCAClient,
input: DescribeCertificateAuthorityAuditReportCommandInput
): Promise<WaiterResult> => {
try {
let result: any = await client.send(new DescribeCertificateAuthorityAuditReportCommand(input));
try {
let returnComparator = () => {
return result.AuditReportStatus;
};
if (returnComparator() === "SUCCESS") {
return { state: WaiterState.SUCCESS };
}
} catch (e) {}
try {
let returnComparator = () => {
return result.AuditReportStatus;
};
if (returnComparator() === "FAILED") {
return { state: WaiterState.FAILURE };
}
} catch (e) {}
} catch (exception) {}
return { state: WaiterState.RETRY };
};
/**
* Wait until a Audit Report is created
* @param params : Waiter configuration options.
* @param input : the input to DescribeCertificateAuthorityAuditReportCommand for polling.
*/
export const waitForAuditReportCreated = async (
params: WaiterConfiguration<ACMPCAClient>,
input: DescribeCertificateAuthorityAuditReportCommandInput
): Promise<WaiterResult> => {
const serviceDefaults = { minDelay: 3, maxDelay: 120 };
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ACMPCAClient } from "../ACMPCAClient";
import {
GetCertificateAuthorityCsrCommand,
GetCertificateAuthorityCsrCommandInput,
} from "../commands/GetCertificateAuthorityCsrCommand";
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";

const checkState = async (
client: ACMPCAClient,
input: GetCertificateAuthorityCsrCommandInput
): Promise<WaiterResult> => {
try {
let result: any = await client.send(new GetCertificateAuthorityCsrCommand(input));
return { state: WaiterState.SUCCESS };
} catch (exception) {
if (exception.name && exception.name == "RequestInProgressException") {
return { state: WaiterState.RETRY };
}
}
return { state: WaiterState.RETRY };
};
/**
* Wait until a Certificate Authority CSR is created
* @param params : Waiter configuration options.
* @param input : the input to GetCertificateAuthorityCsrCommand for polling.
*/
export const waitForCertificateAuthorityCSRCreated = async (
params: WaiterConfiguration<ACMPCAClient>,
input: GetCertificateAuthorityCsrCommandInput
): Promise<WaiterResult> => {
const serviceDefaults = { minDelay: 3, maxDelay: 120 };
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
};
27 changes: 27 additions & 0 deletions clients/client-acm-pca/waiters/waitForCertificateIssued.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { ACMPCAClient } from "../ACMPCAClient";
import { GetCertificateCommand, GetCertificateCommandInput } from "../commands/GetCertificateCommand";
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";

const checkState = async (client: ACMPCAClient, input: GetCertificateCommandInput): Promise<WaiterResult> => {
try {
let result: any = await client.send(new GetCertificateCommand(input));
return { state: WaiterState.SUCCESS };
} catch (exception) {
if (exception.name && exception.name == "RequestInProgressException") {
return { state: WaiterState.RETRY };
}
}
return { state: WaiterState.RETRY };
};
/**
* Wait until a certificate is issued
* @param params : Waiter configuration options.
* @param input : the input to GetCertificateCommand for polling.
*/
export const waitForCertificateIssued = async (
params: WaiterConfiguration<ACMPCAClient>,
input: GetCertificateCommandInput
): Promise<WaiterResult> => {
const serviceDefaults = { minDelay: 3, maxDelay: 120 };
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
};
1 change: 1 addition & 0 deletions clients/client-acm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from "./ACM";
export * from "./commands/AddTagsToCertificateCommand";
export * from "./commands/DeleteCertificateCommand";
export * from "./commands/DescribeCertificateCommand";
export * from "./waiters/waitForCertificateValidated";
export * from "./commands/ExportCertificateCommand";
export * from "./commands/GetCertificateCommand";
export * from "./commands/ImportCertificateCommand";
Expand Down
1 change: 1 addition & 0 deletions clients/client-acm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@aws-sdk/util-user-agent-node": "1.0.0-rc.8",
"@aws-sdk/util-utf8-browser": "1.0.0-rc.8",
"@aws-sdk/util-utf8-node": "1.0.0-rc.8",
"@aws-sdk/util-waiter": "1.0.0-rc.9",
"tslib": "^2.0.0"
},
"devDependencies": {
Expand Down
64 changes: 64 additions & 0 deletions clients/client-acm/waiters/waitForCertificateValidated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { ACMClient } from "../ACMClient";
import { DescribeCertificateCommand, DescribeCertificateCommandInput } from "../commands/DescribeCertificateCommand";
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";

const checkState = async (client: ACMClient, input: DescribeCertificateCommandInput): Promise<WaiterResult> => {
try {
let result: any = await client.send(new DescribeCertificateCommand(input));
try {
let returnComparator = () => {
let flat_1: any[] = [].concat(...result.Certificate.DomainValidationOptions);
let projection_3 = flat_1.map((element_2: any) => {
return element_2.ValidationStatus;
});
return projection_3;
};
let allStringEq_5 = returnComparator().length > 0;
for (let element_4 of returnComparator()) {
allStringEq_5 = allStringEq_5 && element_4 == "SUCCESS";
}
if (allStringEq_5) {
return { state: WaiterState.SUCCESS };
}
} catch (e) {}
try {
let returnComparator = () => {
let flat_1: any[] = [].concat(...result.Certificate.DomainValidationOptions);
let projection_3 = flat_1.map((element_2: any) => {
return element_2.ValidationStatus;
});
return projection_3;
};
for (let anyStringEq_4 of returnComparator()) {
if (anyStringEq_4 == "PENDING_VALIDATION") {
return { state: WaiterState.RETRY };
}
}
} catch (e) {}
try {
let returnComparator = () => {
return result.Certificate.Status;
};
if (returnComparator() === "FAILED") {
return { state: WaiterState.FAILURE };
}
} catch (e) {}
} catch (exception) {
if (exception.name && exception.name == "ResourceNotFoundException") {
return { state: WaiterState.FAILURE };
}
}
return { state: WaiterState.RETRY };
};
/**
*
* @param params : Waiter configuration options.
* @param input : the input to DescribeCertificateCommand for polling.
*/
export const waitForCertificateValidated = async (
params: WaiterConfiguration<ACMClient>,
input: DescribeCertificateCommandInput
): Promise<WaiterResult> => {
const serviceDefaults = { minDelay: 60, maxDelay: 120 };
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
};
2 changes: 2 additions & 0 deletions clients/client-appstream/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export * from "./commands/DeleteUsageReportSubscriptionCommand";
export * from "./commands/DeleteUserCommand";
export * from "./commands/DescribeDirectoryConfigsCommand";
export * from "./commands/DescribeFleetsCommand";
export * from "./waiters/waitForFleetStarted";
export * from "./waiters/waitForFleetStopped";
export * from "./commands/DescribeImageBuildersCommand";
export * from "./commands/DescribeImagePermissionsCommand";
export * from "./pagination/DescribeImagePermissionsPaginator";
Expand Down
1 change: 1 addition & 0 deletions clients/client-appstream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@aws-sdk/util-user-agent-node": "1.0.0-rc.8",
"@aws-sdk/util-utf8-browser": "1.0.0-rc.8",
"@aws-sdk/util-utf8-node": "1.0.0-rc.8",
"@aws-sdk/util-waiter": "1.0.0-rc.9",
"tslib": "^2.0.0"
},
"devDependencies": {
Expand Down
66 changes: 66 additions & 0 deletions clients/client-appstream/waiters/waitForFleetStarted.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { AppStreamClient } from "../AppStreamClient";
import { DescribeFleetsCommand, DescribeFleetsCommandInput } from "../commands/DescribeFleetsCommand";
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";

const checkState = async (client: AppStreamClient, input: DescribeFleetsCommandInput): Promise<WaiterResult> => {
try {
let result: any = await client.send(new DescribeFleetsCommand(input));
try {
let returnComparator = () => {
let flat_1: any[] = [].concat(...result.Fleets);
let projection_3 = flat_1.map((element_2: any) => {
return element_2.State;
});
return projection_3;
};
let allStringEq_5 = returnComparator().length > 0;
for (let element_4 of returnComparator()) {
allStringEq_5 = allStringEq_5 && element_4 == "ACTIVE";
}
if (allStringEq_5) {
return { state: WaiterState.SUCCESS };
}
} catch (e) {}
try {
let returnComparator = () => {
let flat_1: any[] = [].concat(...result.Fleets);
let projection_3 = flat_1.map((element_2: any) => {
return element_2.State;
});
return projection_3;
};
for (let anyStringEq_4 of returnComparator()) {
if (anyStringEq_4 == "PENDING_DEACTIVATE") {
return { state: WaiterState.FAILURE };
}
}
} catch (e) {}
try {
let returnComparator = () => {
let flat_1: any[] = [].concat(...result.Fleets);
let projection_3 = flat_1.map((element_2: any) => {
return element_2.State;
});
return projection_3;
};
for (let anyStringEq_4 of returnComparator()) {
if (anyStringEq_4 == "INACTIVE") {
return { state: WaiterState.FAILURE };
}
}
} catch (e) {}
} catch (exception) {}
return { state: WaiterState.RETRY };
};
/**
*
* @param params : Waiter configuration options.
* @param input : the input to DescribeFleetsCommand for polling.
*/
export const waitForFleetStarted = async (
params: WaiterConfiguration<AppStreamClient>,
input: DescribeFleetsCommandInput
): Promise<WaiterResult> => {
const serviceDefaults = { minDelay: 30, maxDelay: 120 };
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
};
66 changes: 66 additions & 0 deletions clients/client-appstream/waiters/waitForFleetStopped.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { AppStreamClient } from "../AppStreamClient";
import { DescribeFleetsCommand, DescribeFleetsCommandInput } from "../commands/DescribeFleetsCommand";
import { WaiterConfiguration, WaiterResult, WaiterState, createWaiter } from "@aws-sdk/util-waiter";

const checkState = async (client: AppStreamClient, input: DescribeFleetsCommandInput): Promise<WaiterResult> => {
try {
let result: any = await client.send(new DescribeFleetsCommand(input));
try {
let returnComparator = () => {
let flat_1: any[] = [].concat(...result.Fleets);
let projection_3 = flat_1.map((element_2: any) => {
return element_2.State;
});
return projection_3;
};
let allStringEq_5 = returnComparator().length > 0;
for (let element_4 of returnComparator()) {
allStringEq_5 = allStringEq_5 && element_4 == "INACTIVE";
}
if (allStringEq_5) {
return { state: WaiterState.SUCCESS };
}
} catch (e) {}
try {
let returnComparator = () => {
let flat_1: any[] = [].concat(...result.Fleets);
let projection_3 = flat_1.map((element_2: any) => {
return element_2.State;
});
return projection_3;
};
for (let anyStringEq_4 of returnComparator()) {
if (anyStringEq_4 == "PENDING_ACTIVATE") {
return { state: WaiterState.FAILURE };
}
}
} catch (e) {}
try {
let returnComparator = () => {
let flat_1: any[] = [].concat(...result.Fleets);
let projection_3 = flat_1.map((element_2: any) => {
return element_2.State;
});
return projection_3;
};
for (let anyStringEq_4 of returnComparator()) {
if (anyStringEq_4 == "ACTIVE") {
return { state: WaiterState.FAILURE };
}
}
} catch (e) {}
} catch (exception) {}
return { state: WaiterState.RETRY };
};
/**
*
* @param params : Waiter configuration options.
* @param input : the input to DescribeFleetsCommand for polling.
*/
export const waitForFleetStopped = async (
params: WaiterConfiguration<AppStreamClient>,
input: DescribeFleetsCommandInput
): Promise<WaiterResult> => {
const serviceDefaults = { minDelay: 30, maxDelay: 120 };
return createWaiter({ ...serviceDefaults, ...params }, input, checkState);
};
3 changes: 3 additions & 0 deletions clients/client-auto-scaling/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export * from "./commands/DescribeAccountLimitsCommand";
export * from "./commands/DescribeAdjustmentTypesCommand";
export * from "./commands/DescribeAutoScalingGroupsCommand";
export * from "./pagination/DescribeAutoScalingGroupsPaginator";
export * from "./waiters/waitForGroupExists";
export * from "./waiters/waitForGroupInService";
export * from "./waiters/waitForGroupNotExists";
export * from "./commands/DescribeAutoScalingInstancesCommand";
export * from "./pagination/DescribeAutoScalingInstancesPaginator";
export * from "./commands/DescribeAutoScalingNotificationTypesCommand";
Expand Down
1 change: 1 addition & 0 deletions clients/client-auto-scaling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@aws-sdk/util-user-agent-node": "1.0.0-rc.8",
"@aws-sdk/util-utf8-browser": "1.0.0-rc.8",
"@aws-sdk/util-utf8-node": "1.0.0-rc.8",
"@aws-sdk/util-waiter": "1.0.0-rc.9",
"fast-xml-parser": "^3.16.0",
"tslib": "^2.0.0"
},
Expand Down
Loading

0 comments on commit c78d705

Please sign in to comment.