UNPKG

1.81 kBTypeScriptView Raw
1import type { NodeHttpHandlerOptions } from '@smithy/node-http-handler';
2import { AwsCredentialIdentityProvider, Logger } from '@smithy/types';
3import { ProxyAgent } from 'proxy-agent';
4import type { SdkHttpOptions } from './sdk-provider';
5/**
6 * Behaviors to match AWS CLI
7 *
8 * See these links:
9 *
10 * https://docs.aws.amazon.com/cli/latest/topic/config-vars.html
11 * https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
12 */
13export declare class AwsCliCompatible {
14 /**
15 * Build an AWS CLI-compatible credential chain provider
16 *
17 * The credential chain returned by this function is always caching.
18 */
19 static credentialChainBuilder(options?: CredentialChainOptions): Promise<AwsCredentialIdentityProvider>;
20 static requestHandlerBuilder(options?: SdkHttpOptions): NodeHttpHandlerOptions;
21 static proxyAgent(options: SdkHttpOptions): ProxyAgent;
22 /**
23 * Attempts to get the region from a number of sources and falls back to us-east-1 if no region can be found,
24 * as is done in the AWS CLI.
25 *
26 * The order of priority is the following:
27 *
28 * 1. Environment variables specifying region, with both an AWS prefix and AMAZON prefix
29 * to maintain backwards compatibility, and without `DEFAULT` in the name because
30 * Lambda and CodeBuild set the $AWS_REGION variable.
31 * 2. Regions listed in the Shared Ini Files - First checking for the profile provided
32 * and then checking for the default profile.
33 * 3. IMDS instance identity region from the Metadata Service.
34 * 4. us-east-1
35 */
36 static region(maybeProfile?: string): Promise<string>;
37}
38export interface CredentialChainOptions {
39 readonly profile?: string;
40 readonly httpOptions?: SdkHttpOptions;
41 readonly logger?: Logger;
42}