@moonset/util
Version:
54 lines (53 loc) • 1.43 kB
TypeScript
import * as AWS from 'aws-sdk';
export interface ISDK {
readonly currentRegion: string;
currentAccount(): Promise<Account>;
getSession(): Promise<string>;
s3(): AWS.S3;
ec2(): AWS.EC2;
emr(): AWS.EMR;
iam(): AWS.IAM;
stepfunctions(): AWS.StepFunctions;
sts(): AWS.STS;
cfn(): AWS.CloudFormation;
tagApi(): AWS.ResourceGroupsTaggingAPI;
}
export declare class SDK implements ISDK {
private readonly credentials;
readonly currentRegion: string;
private readonly config;
/**
* Default retry options for SDK clients.
*/
private readonly retryOptions;
constructor(credentials: AWS.Credentials, region: string);
s3(): AWS.S3;
ec2(): AWS.EC2;
emr(): AWS.EMR;
iam(): AWS.IAM;
stepfunctions(): AWS.StepFunctions;
cfn(): AWS.CloudFormation;
sts(): AWS.STS;
tagApi(): AWS.ResourceGroupsTaggingAPI;
currentAccount(): Promise<Account>;
getSession(): Promise<string>;
}
export declare class SDKProvider {
static forWorkingAccount(): Promise<ISDK>;
}
/**
* An AWS account
*
* An AWS account always exists in only one partition. Usually we don't care
* about the partition, but when we need to form ARNs we do.
*/
export interface Account {
/**
* The account number
*/
readonly accountId: string;
/**
* The partition ('aws' or 'aws-cn' or otherwise)
*/
readonly partition: string;
}