@aws-cdk-testing/cli-integ
Version:
Integration tests for the AWS CDK CLI
88 lines (87 loc) • 4.14 kB
TypeScript
import { CloudFormationClient, type Stack } from '@aws-sdk/client-cloudformation';
import { ECRClient } from '@aws-sdk/client-ecr';
import { ECRPUBLICClient } from '@aws-sdk/client-ecr-public';
import { ECSClient } from '@aws-sdk/client-ecs';
import { IAMClient } from '@aws-sdk/client-iam';
import { LambdaClient } from '@aws-sdk/client-lambda';
import { S3Client } from '@aws-sdk/client-s3';
import { SecretsManagerClient } from '@aws-sdk/client-secrets-manager';
import { SNSClient } from '@aws-sdk/client-sns';
import { SSOClient } from '@aws-sdk/client-sso';
import { STSClient } from '@aws-sdk/client-sts';
import type { AwsCredentialIdentity } from '@smithy/types';
export declare class AwsClients {
/** A random string to use for temporary resources, like roles (should preferably match unique test-specific randomString) */
private readonly randomString;
readonly region: string;
private readonly output;
readonly identity?: AwsCredentialIdentity | undefined;
static forIdentity(randomString: string, region: string, identity: AwsCredentialIdentity, output: NodeJS.WritableStream): Promise<AwsClients>;
static forRegion(randomString: string, region: string, output: NodeJS.WritableStream): Promise<AwsClients>;
private readonly cleanup;
private readonly config;
readonly cloudFormation: CloudFormationClient;
readonly s3: S3Client;
readonly ecr: ECRClient;
readonly ecrPublic: ECRPUBLICClient;
readonly ecs: ECSClient;
readonly sso: SSOClient;
readonly sns: SNSClient;
readonly iam: IAMClient;
readonly lambda: LambdaClient;
readonly sts: STSClient;
readonly secretsManager: SecretsManagerClient;
private constructor();
addCleanup(cleanup: () => Promise<any>): void;
dispose(): Promise<void>;
account(): Promise<string>;
/**
* If the clients already has an established identity (via atmosphere for example),
* return an environment variable map activating it.
*
* Otherwise, returns undefined.
*/
identityEnv(): Record<string, string> | undefined;
/**
* Resolve the current identity or identity provider to credentials
*/
credentials(): Promise<AwsCredentialIdentity>;
deleteStacks(...stackNames: string[]): Promise<void>;
stackStatus(stackName: string): Promise<string | undefined>;
emptyBucket(bucketName: string, options?: {
bypassGovernance?: boolean;
}): Promise<void | import("@aws-sdk/client-s3").DeleteObjectsCommandOutput>;
deleteImageRepository(repositoryName: string): Promise<void>;
deleteBucket(bucketName: string): Promise<void>;
/**
* Create a role that will be cleaned up when the AwsClients object is cleaned up
*/
temporaryRole(namePrefix: string, assumeRolePolicyStatements: any[], policyStatements: any[]): Promise<string>;
waitForAssumeRole(roleArn: string): Promise<void>;
deleteRole(name: string): Promise<void>;
}
export declare function isStackMissingError(e: Error): boolean;
export declare function isBucketMissingError(e: Error): boolean;
/**
* Retry an async operation until a deadline is hit.
*
* Use `retry.forSeconds()` to construct a deadline relative to right now.
*
* Exceptions will cause the operation to retry. Use `retry.abort` to annotate an exception
* to stop the retry and end in a failure.
*/
export declare function retry<A>(output: NodeJS.WritableStream, operation: string, deadline: Date, block: () => Promise<A>): Promise<A>;
export declare namespace retry {
var forSeconds: (seconds: number) => Date;
var abort: (e: Error) => Error;
}
export declare function outputFromStack(key: string, stack: Stack): string | undefined;
export declare function sleep(ms: number): Promise<unknown>;
/**
* Retry an async operation with error filtering until a deadline is hit.
*
* Use `retry.forSeconds()` to construct a deadline relative to right now.
*
* Only retries on errors with matching names in errorNames array.
*/
export declare function retryOnMatchingErrors<T>(operation: () => Promise<T>, errorNames: string[], deadline: Date, interval?: number): Promise<T>;