-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(clients): waiter code generation (#1784)
- Loading branch information
1 parent
3d6eb2d
commit c78d705
Showing
190 changed files
with
6,633 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
clients/client-acm-pca/waiters/waitForAuditReportCreated.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
33 changes: 33 additions & 0 deletions
33
clients/client-acm-pca/waiters/waitForCertificateAuthorityCSRCreated.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
27
clients/client-acm-pca/waiters/waitForCertificateIssued.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.