awscli-compatible.d.ts
1 import * as AWS from 'aws-sdk'; 2 /** 3 * Behaviors to match AWS CLI 4 * 5 * See these links: 6 * 7 * https://docs.aws.amazon.com/cli/latest/topic/config-vars.html 8 * https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html 9 */ 10 export declare class AwsCliCompatible { 11 /** 12 * Build an AWS CLI-compatible credential chain provider 13 * 14 * This is similar to the default credential provider chain created by the SDK 15 * except: 16 * 17 * 1. Accepts profile argument in the constructor (the SDK must have it prepopulated 18 * in the environment). 19 * 2. Conditionally checks EC2 credentials, because checking for EC2 20 * credentials on a non-EC2 machine may lead to long delays (in the best case) 21 * or an exception (in the worst case). 22 * 3. Respects $AWS_SHARED_CREDENTIALS_FILE. 23 * 4. Respects $AWS_DEFAULT_PROFILE in addition to $AWS_PROFILE. 24 */ 25 static credentialChain(options?: CredentialChainOptions): Promise<AWS.CredentialProviderChain>; 26 /** 27 * Return the default region in a CLI-compatible way 28 * 29 * Mostly copied from node_loader.js, but with the following differences to make it 30 * AWS CLI compatible: 31 * 32 * 1. Takes a profile name as an argument (instead of forcing it to be taken from $AWS_PROFILE). 33 * This requires having made a copy of the SDK's `SharedIniFile` (the original 34 * does not take an argument). 35 * 2. $AWS_DEFAULT_PROFILE and $AWS_DEFAULT_REGION are also respected. 36 * 37 * Lambda and CodeBuild set the $AWS_REGION variable. 38 */ 39 static region(options?: RegionOptions): Promise<string>; 40 } 41 export interface CredentialChainOptions { 42 readonly profile?: string; 43 readonly ec2instance?: boolean; 44 readonly containerCreds?: boolean; 45 readonly httpOptions?: AWS.HTTPOptions; 46 } 47 export interface RegionOptions { 48 readonly profile?: string; 49 readonly ec2instance?: boolean; 50 }