@smithy/credential-provider-imds 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-types/ts3.4/config/Endpoint.d.ts +7 -0
- package/dist-types/ts3.4/config/EndpointConfigOptions.d.ts +13 -0
- package/dist-types/ts3.4/config/EndpointMode.d.ts +7 -0
- package/dist-types/ts3.4/config/EndpointModeConfigOptions.d.ts +13 -0
- package/dist-types/ts3.4/fromContainerMetadata.d.ts +21 -0
- package/dist-types/ts3.4/fromInstanceMetadata.d.ts +10 -0
- package/dist-types/ts3.4/index.d.ts +24 -0
- package/dist-types/ts3.4/remoteProvider/ImdsCredentials.d.ts +18 -0
- package/dist-types/ts3.4/remoteProvider/RemoteProviderInit.d.ts +32 -0
- package/dist-types/ts3.4/remoteProvider/httpRequest.d.ts +6 -0
- package/dist-types/ts3.4/remoteProvider/index.d.ts +8 -0
- package/dist-types/ts3.4/remoteProvider/retry.d.ts +10 -0
- package/dist-types/ts3.4/types.d.ts +7 -0
- package/dist-types/ts3.4/utils/getExtendedInstanceMetadataCredentials.d.ts +6 -0
- package/dist-types/ts3.4/utils/getInstanceMetadataEndpoint.d.ts +21 -0
- package/dist-types/ts3.4/utils/staticStabilityProvider.d.ts +16 -0
- package/package.json +6 -6
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LoadedConfigSelectors } from "@smithy/node-config-provider";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare const ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT";
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint";
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const ENDPOINT_CONFIG_OPTIONS: LoadedConfigSelectors<string | undefined>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LoadedConfigSelectors } from "@smithy/node-config-provider";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare const ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE";
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode";
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const ENDPOINT_MODE_CONFIG_OPTIONS: LoadedConfigSelectors<string | undefined>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AwsCredentialIdentityProvider } from "@smithy/types";
|
|
2
|
+
import { RemoteProviderInit } from "./remoteProvider/RemoteProviderInit";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare const ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*
|
|
18
|
+
* Creates a credential provider that will source credentials from the ECS
|
|
19
|
+
* Container Metadata Service
|
|
20
|
+
*/
|
|
21
|
+
export declare const fromContainerMetadata: (init?: RemoteProviderInit) => AwsCredentialIdentityProvider;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Provider } from "@smithy/types";
|
|
2
|
+
import { RemoteProviderInit } from "./remoteProvider/RemoteProviderInit";
|
|
3
|
+
import { InstanceMetadataCredentials } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*
|
|
7
|
+
* Creates a credential provider that will source credentials from the EC2
|
|
8
|
+
* Instance Metadata Service
|
|
9
|
+
*/
|
|
10
|
+
export declare const fromInstanceMetadata: (init?: RemoteProviderInit) => Provider<InstanceMetadataCredentials>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
export * from "./fromContainerMetadata";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export * from "./fromInstanceMetadata";
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export * from "./remoteProvider/RemoteProviderInit";
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export * from "./types";
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export { httpRequest } from "./remoteProvider/httpRequest";
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export { getInstanceMetadataEndpoint } from "./utils/getInstanceMetadataEndpoint";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AwsCredentialIdentity } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export interface ImdsCredentials {
|
|
6
|
+
AccessKeyId: string;
|
|
7
|
+
SecretAccessKey: string;
|
|
8
|
+
Token: string;
|
|
9
|
+
Expiration: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const isImdsCredentials: (arg: any) => arg is ImdsCredentials;
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare const fromImdsCredentials: (creds: ImdsCredentials) => AwsCredentialIdentity;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Logger } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_TIMEOUT = 1000;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_MAX_RETRIES = 0;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export interface RemoteProviderConfig {
|
|
14
|
+
/**
|
|
15
|
+
* The connection timeout (in milliseconds)
|
|
16
|
+
*/
|
|
17
|
+
timeout: number;
|
|
18
|
+
/**
|
|
19
|
+
* The maximum number of times the HTTP connection should be retried
|
|
20
|
+
*/
|
|
21
|
+
maxRetries: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export interface RemoteProviderInit extends Partial<RemoteProviderConfig> {
|
|
27
|
+
logger?: Logger;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare const providerConfigFromInit: ({ maxRetries, timeout, }: RemoteProviderInit) => RemoteProviderConfig;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Logger } from "@smithy/types";
|
|
2
|
+
import { InstanceMetadataCredentials } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare const getExtendedInstanceMetadataCredentials: (credentials: InstanceMetadataCredentials, logger: Logger) => InstanceMetadataCredentials;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Endpoint } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the host to use for instance metadata service call.
|
|
4
|
+
*
|
|
5
|
+
* The host is read from endpoint which can be set either in
|
|
6
|
+
* {@link ENV_ENDPOINT_NAME} environment variable or {@link CONFIG_ENDPOINT_NAME}
|
|
7
|
+
* configuration property.
|
|
8
|
+
*
|
|
9
|
+
* If endpoint is not set, then endpoint mode is read either from
|
|
10
|
+
* {@link ENV_ENDPOINT_MODE_NAME} environment variable or {@link CONFIG_ENDPOINT_MODE_NAME}
|
|
11
|
+
* configuration property. If endpoint mode is not set, then default endpoint mode
|
|
12
|
+
* {@link EndpointMode.IPv4} is used.
|
|
13
|
+
*
|
|
14
|
+
* If endpoint mode is set to {@link EndpointMode.IPv4}, then the host is {@link Endpoint.IPv4}.
|
|
15
|
+
* If endpoint mode is set to {@link EndpointMode.IPv6}, then the host is {@link Endpoint.IPv6}.
|
|
16
|
+
*
|
|
17
|
+
* @returns Host to use for instance metadata service call.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare const getInstanceMetadataEndpoint: () => Promise<Endpoint>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Logger, Provider } from "@smithy/types";
|
|
2
|
+
import { InstanceMetadataCredentials } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* IMDS credential supports static stability feature. When used, the expiration
|
|
7
|
+
* of recently issued credentials is extended. The server side allows using
|
|
8
|
+
* the recently expired credentials. This mitigates impact when clients using
|
|
9
|
+
* refreshable credentials are unable to retrieve updates.
|
|
10
|
+
*
|
|
11
|
+
* @param provider Credential provider
|
|
12
|
+
* @returns A credential provider that supports static stability
|
|
13
|
+
*/
|
|
14
|
+
export declare const staticStabilityProvider: (provider: Provider<InstanceMetadataCredentials>, options?: {
|
|
15
|
+
logger?: Logger | undefined;
|
|
16
|
+
}) => Provider<InstanceMetadataCredentials>;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/credential-provider-imds",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "AWS credential provider that sources credentials from the EC2 instance metadata service and ECS container metadata service",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
8
|
+
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
|
9
9
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
10
10
|
"build:es": "tsc -p tsconfig.es.json",
|
|
11
11
|
"build:types": "tsc -p tsconfig.types.json",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
},
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@smithy/node-config-provider": "^1.0.
|
|
30
|
-
"@smithy/property-provider": "^1.0
|
|
31
|
-
"@smithy/types": "^
|
|
32
|
-
"@smithy/url-parser": "^1.0.
|
|
29
|
+
"@smithy/node-config-provider": "^1.0.3",
|
|
30
|
+
"@smithy/property-provider": "^1.1.0",
|
|
31
|
+
"@smithy/types": "^2.0.0",
|
|
32
|
+
"@smithy/url-parser": "^1.0.3",
|
|
33
33
|
"tslib": "^2.5.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|