///
import * as cxapi from '@aws-cdk/cx-api';
import * as AWS from 'aws-sdk';
import { Account, ISDK, SdkProvider, ToolkitInfo } from '../../lib';
import { CloudFormationStack } from '../../lib/api/util/cloudformation';
export interface MockSdkProviderOptions {
/**
* Whether the mock provider should produce a real SDK
*
* Some tests require a real SDK because they use `AWS-mock` to replace
* the underlying calls. Other tests do their work completely using jest-mocks.
*
* @default true
*/
readonly realSdk?: boolean;
}
/**
* An SDK that allows replacing (some of) the clients
*
* Its the responsibility of the consumer to replace all calls that
* actually will be called.
*/
export declare class MockSdkProvider extends SdkProvider {
private readonly sdk;
constructor(options?: MockSdkProviderOptions);
defaultAccount(): Promise;
forEnvironment(): Promise;
/**
* Replace the CloudFormation client with the given object
*/
stubCloudFormation(stubs: SyncHandlerSubsetOf): void;
/**
* Replace the ECR client with the given object
*/
stubEcr(stubs: SyncHandlerSubsetOf): void;
/**
* Replace the S3 client with the given object
*/
stubS3(stubs: SyncHandlerSubsetOf): void;
/**
* Replace the STS client with the given object
*/
stubSTS(stubs: SyncHandlerSubsetOf): void;
}
export declare class MockSdk implements ISDK {
readonly currentRegion: string;
readonly cloudFormation: jest.Mock;
readonly ec2: jest.Mock;
readonly ssm: jest.Mock;
readonly s3: jest.Mock;
readonly route53: jest.Mock;
readonly ecr: jest.Mock;
currentAccount(): Promise;
/**
* Replace the CloudFormation client with the given object
*/
stubCloudFormation(stubs: SyncHandlerSubsetOf): void;
/**
* Replace the ECR client with the given object
*/
stubEcr(stubs: SyncHandlerSubsetOf): void;
}
declare type AwsCallInputOutput = T extends {
(args: infer INPUT, callback?: ((err: AWS.AWSError, data: any) => void) | undefined): AWS.Request;
(callback?: ((err: AWS.AWSError, data: {}) => void) | undefined): AWS.Request;
} ? [INPUT, OUTPUT] : T;
declare type MockHandlerType = AI extends [any, any] ? (input: AI[0]) => AI[1] : AI;
export declare type SyncHandlerSubsetOf = {
[K in keyof S]?: MockHandlerType>;
};
export declare function mockBootstrapStack(sdk: ISDK | undefined, stack?: Partial): CloudFormationStack;
export declare function mockToolkitInfo(stack?: Partial): ToolkitInfo;
export declare function mockResolvedEnvironment(): cxapi.Environment;
export declare type MockedObject = {
[K in keyof S]: MockedFunction[K]>;
};
declare type MockedFunction = T extends (...args: any[]) => any ? jest.MockInstance, jest.ArgsType> : T;
export declare function errorWithCode(code: string, message: string): Error;
export {};