UNPKG

1.36 kBTypeScriptView Raw
1import type { AwsCredentialIdentityProvider } from '@smithy/types';
2import { Mode } from '../plugin/mode';
3import { PluginHost } from '../plugin/plugin';
4/**
5 * Cache for credential providers.
6 *
7 * Given an account and an operating mode (read or write) will return an
8 * appropriate credential provider for credentials for the given account. The
9 * credential provider will be cached so that multiple AWS clients for the same
10 * environment will not make multiple network calls to obtain credentials.
11 *
12 * Will use default credentials if they are for the right account; otherwise,
13 * all loaded credential provider plugins will be tried to obtain credentials
14 * for the given account.
15 */
16export declare class CredentialPlugins {
17 private readonly cache;
18 private readonly host;
19 constructor(host?: PluginHost);
20 fetchCredentialsFor(awsAccountId: string, mode: Mode): Promise<PluginCredentialsFetchResult | undefined>;
21 get availablePluginNames(): string[];
22 private lookupCredentials;
23}
24/**
25 * Result from trying to fetch credentials from the Plugin host
26 */
27export interface PluginCredentialsFetchResult {
28 /**
29 * SDK-v3 compatible credential provider
30 */
31 readonly credentials: AwsCredentialIdentityProvider;
32 /**
33 * Name of plugin that successfully provided credentials
34 */
35 readonly pluginName: string;
36}