@cdk8s/awscdk-resolver 0.0.600 → 0.0.601
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/.jsii +3 -3
- package/lib/resolve.js +1 -1
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/auth/httpAuthSchemeProvider.js +9 -15
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/endpoint/bdd.js +2 -5
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/endpoint/endpointResolver.js +7 -11
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js +449 -469
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/models/CloudFormationServiceException.js +4 -8
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/models/errors.js +59 -91
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/runtimeConfig.browser.js +22 -26
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/runtimeConfig.js +30 -34
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/runtimeConfig.native.js +4 -7
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/runtimeConfig.shared.js +20 -24
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/schemas/schemas_0.js +814 -533
- package/node_modules/@aws-sdk/client-cloudformation/package.json +8 -8
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +45 -50
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js +2 -4
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.browser.js +21 -22
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +51 -51
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.native.js +21 -22
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +19 -21
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +107 -109
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +2 -4
- package/node_modules/@aws-sdk/core/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +4 -6
- package/node_modules/@aws-sdk/credential-provider-env/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js +3 -7
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.browser.js +12 -16
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +16 -21
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js +14 -18
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js +1 -5
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.browser.js +2 -5
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js +2 -7
- package/node_modules/@aws-sdk/credential-provider-http/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +47 -41
- package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProcessCredentials.js +8 -4
- package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveWebIdentityCredentials.js +14 -10
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +13 -13
- package/node_modules/@aws-sdk/credential-provider-login/dist-cjs/index.js +31 -33
- package/node_modules/@aws-sdk/credential-provider-login/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +16 -18
- package/node_modules/@aws-sdk/credential-provider-node/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +11 -13
- package/node_modules/@aws-sdk/credential-provider-process/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +22 -24
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BGYXHf8s.js +3 -0
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js +10 -14
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js +2 -6
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +3 -27
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +7 -7
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/index.js +0 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +82 -84
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +158 -119
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +80 -82
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +80 -82
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +99 -101
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/commands/CreateOAuth2TokenCommand.js +4 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/bdd.js +70 -35
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/endpointResolver.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/enums.js +3 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/endpoint/EndpointParameters.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/enums.d.ts +12 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/endpoint/EndpointParameters.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/models/enums.d.ts +3 -0
- package/node_modules/@aws-sdk/nested-clients/package.json +9 -8
- package/node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js +4 -6
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +5 -5
- package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +26 -28
- package/node_modules/@aws-sdk/token-providers/package.json +7 -7
- package/node_modules/@aws-sdk/types/dist-cjs/index.js +7 -8
- package/node_modules/@aws-sdk/types/package.json +4 -4
- package/node_modules/@aws-sdk/util-locate-window/dist-cjs/index.js +0 -2
- package/node_modules/@aws-sdk/util-locate-window/package.json +4 -4
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +2 -4
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-external/nodable_entities.js +4 -7
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.browser.js +2 -5
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +7 -10
- package/node_modules/@aws-sdk/xml-builder/package.json +4 -4
- package/node_modules/@smithy/core/dist-cjs/index.js +13 -15
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +29 -31
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.browser.js +2 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js +7 -9
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.native.js +3 -5
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +22 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +10 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +38 -39
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +10 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +14 -17
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +20 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +9 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +11 -13
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +59 -60
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +23 -24
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +25 -26
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +5 -7
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +4 -6
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +23 -25
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +4 -6
- package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +2 -4
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-signing/httpSigningMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +1 -1
- package/node_modules/@smithy/core/package.json +7 -6
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +23 -24
- package/node_modules/@smithy/credential-provider-imds/package.json +6 -6
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +6 -8
- package/node_modules/@smithy/fetch-http-handler/package.json +7 -7
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -13
- package/node_modules/@smithy/node-http-handler/package.json +7 -7
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +27 -29
- package/node_modules/@smithy/signature-v4/package.json +6 -6
- package/node_modules/@smithy/types/dist-cjs/index.js +23 -18
- package/node_modules/@smithy/types/package.json +4 -4
- package/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BKDNrsal.js +0 -8
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
const { Readable } = require("node:stream");
|
|
2
|
+
const { NoOpLogger, normalizeProvider } = require("@smithy/core/client");
|
|
3
|
+
const { HttpResponse, HttpRequest } = require("@smithy/core/protocols");
|
|
4
|
+
const { parseRfc7231DateTime, v4 } = require("@smithy/core/serde");
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
var client = require('@smithy/core/client');
|
|
5
|
-
var protocols = require('@smithy/core/protocols');
|
|
6
|
-
var serde = require('@smithy/core/serde');
|
|
7
|
-
|
|
8
|
-
const isStreamingPayload = (request) => request?.body instanceof node_stream.Readable ||
|
|
6
|
+
const isStreamingPayload = (request) => request?.body instanceof Readable ||
|
|
9
7
|
(typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream);
|
|
10
8
|
|
|
11
9
|
const CLOCK_SKEW_ERROR_CODES = [
|
|
@@ -92,7 +90,7 @@ const INVOCATION_ID_HEADER = "amz-sdk-invocation-id";
|
|
|
92
90
|
const REQUEST_HEADER = "amz-sdk-request";
|
|
93
91
|
|
|
94
92
|
function parseRetryAfterHeader(response, logger) {
|
|
95
|
-
if (!
|
|
93
|
+
if (!HttpResponse.isInstance(response)) {
|
|
96
94
|
return;
|
|
97
95
|
}
|
|
98
96
|
for (const header of Object.keys(response.headers)) {
|
|
@@ -102,7 +100,7 @@ function parseRetryAfterHeader(response, logger) {
|
|
|
102
100
|
let retryAfterSeconds = NaN;
|
|
103
101
|
if (retryAfter.endsWith("GMT")) {
|
|
104
102
|
try {
|
|
105
|
-
const date =
|
|
103
|
+
const date = parseRfc7231DateTime(retryAfter);
|
|
106
104
|
retryAfterSeconds = (date.getTime() - Date.now()) / 1000;
|
|
107
105
|
}
|
|
108
106
|
catch (e) {
|
|
@@ -160,9 +158,9 @@ function bindRetryMiddleware(isStreamingPayload) {
|
|
|
160
158
|
let attempts = 0;
|
|
161
159
|
let totalRetryDelay = 0;
|
|
162
160
|
const { request } = args;
|
|
163
|
-
const isRequest =
|
|
161
|
+
const isRequest = HttpRequest.isInstance(request);
|
|
164
162
|
if (isRequest) {
|
|
165
|
-
request.headers[INVOCATION_ID_HEADER] =
|
|
163
|
+
request.headers[INVOCATION_ID_HEADER] = v4();
|
|
166
164
|
}
|
|
167
165
|
while (true) {
|
|
168
166
|
try {
|
|
@@ -179,7 +177,7 @@ function bindRetryMiddleware(isStreamingPayload) {
|
|
|
179
177
|
const retryErrorInfo = getRetryErrorInfo(e, options.logger);
|
|
180
178
|
lastError = asSdkError(e);
|
|
181
179
|
if (isRequest && isStreamingPayload(request)) {
|
|
182
|
-
(context.logger instanceof
|
|
180
|
+
(context.logger instanceof NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request.");
|
|
183
181
|
throw lastError;
|
|
184
182
|
}
|
|
185
183
|
try {
|
|
@@ -422,13 +420,13 @@ class DefaultRetryToken {
|
|
|
422
420
|
}
|
|
423
421
|
}
|
|
424
422
|
|
|
425
|
-
|
|
423
|
+
var RETRY_MODES;
|
|
426
424
|
(function (RETRY_MODES) {
|
|
427
425
|
RETRY_MODES["STANDARD"] = "standard";
|
|
428
426
|
RETRY_MODES["ADAPTIVE"] = "adaptive";
|
|
429
|
-
})(
|
|
427
|
+
})(RETRY_MODES || (RETRY_MODES = {}));
|
|
430
428
|
const DEFAULT_MAX_ATTEMPTS = 3;
|
|
431
|
-
const DEFAULT_RETRY_MODE =
|
|
429
|
+
const DEFAULT_RETRY_MODE = RETRY_MODES.STANDARD;
|
|
432
430
|
|
|
433
431
|
const refusal = {
|
|
434
432
|
incompatible: 1,
|
|
@@ -436,7 +434,7 @@ const refusal = {
|
|
|
436
434
|
capacity: 3,
|
|
437
435
|
};
|
|
438
436
|
let StandardRetryStrategy$1 = class StandardRetryStrategy {
|
|
439
|
-
mode =
|
|
437
|
+
mode = RETRY_MODES.STANDARD;
|
|
440
438
|
retryBackoffStrategy;
|
|
441
439
|
capacity = INITIAL_RETRY_TOKENS;
|
|
442
440
|
maxAttemptsProvider;
|
|
@@ -524,7 +522,7 @@ let StandardRetryStrategy$1 = class StandardRetryStrategy {
|
|
|
524
522
|
};
|
|
525
523
|
|
|
526
524
|
let AdaptiveRetryStrategy$1 = class AdaptiveRetryStrategy {
|
|
527
|
-
mode =
|
|
525
|
+
mode = RETRY_MODES.ADAPTIVE;
|
|
528
526
|
rateLimiter;
|
|
529
527
|
standardRetryStrategy;
|
|
530
528
|
constructor(maxAttemptsProvider, options) {
|
|
@@ -615,7 +613,7 @@ class StandardRetryStrategy {
|
|
|
615
613
|
retryDecider;
|
|
616
614
|
delayDecider;
|
|
617
615
|
retryQuota;
|
|
618
|
-
mode =
|
|
616
|
+
mode = RETRY_MODES.STANDARD;
|
|
619
617
|
constructor(maxAttemptsProvider, options) {
|
|
620
618
|
this.maxAttemptsProvider = maxAttemptsProvider;
|
|
621
619
|
this.retryDecider = options?.retryDecider ?? defaultRetryDecider;
|
|
@@ -641,12 +639,12 @@ class StandardRetryStrategy {
|
|
|
641
639
|
let totalDelay = 0;
|
|
642
640
|
const maxAttempts = await this.getMaxAttempts();
|
|
643
641
|
const { request } = args;
|
|
644
|
-
if (
|
|
645
|
-
request.headers[INVOCATION_ID_HEADER] =
|
|
642
|
+
if (HttpRequest.isInstance(request)) {
|
|
643
|
+
request.headers[INVOCATION_ID_HEADER] = v4();
|
|
646
644
|
}
|
|
647
645
|
while (true) {
|
|
648
646
|
try {
|
|
649
|
-
if (
|
|
647
|
+
if (HttpRequest.isInstance(request)) {
|
|
650
648
|
request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;
|
|
651
649
|
}
|
|
652
650
|
if (options?.beforeRequest) {
|
|
@@ -684,7 +682,7 @@ class StandardRetryStrategy {
|
|
|
684
682
|
}
|
|
685
683
|
}
|
|
686
684
|
const getDelayFromRetryAfterHeader = (response) => {
|
|
687
|
-
if (!
|
|
685
|
+
if (!HttpResponse.isInstance(response))
|
|
688
686
|
return;
|
|
689
687
|
const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after");
|
|
690
688
|
if (!retryAfterHeaderName)
|
|
@@ -703,7 +701,7 @@ class AdaptiveRetryStrategy extends StandardRetryStrategy {
|
|
|
703
701
|
const { rateLimiter, ...superOptions } = options ?? {};
|
|
704
702
|
super(maxAttemptsProvider, superOptions);
|
|
705
703
|
this.rateLimiter = rateLimiter ?? new DefaultRateLimiter();
|
|
706
|
-
this.mode =
|
|
704
|
+
this.mode = RETRY_MODES.ADAPTIVE;
|
|
707
705
|
}
|
|
708
706
|
async retry(next, args) {
|
|
709
707
|
return super.retry(next, args, {
|
|
@@ -745,13 +743,13 @@ const NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
|
|
|
745
743
|
const resolveRetryConfig = (input, defaults) => {
|
|
746
744
|
const { retryStrategy, retryMode } = input;
|
|
747
745
|
const { defaultMaxAttempts = DEFAULT_MAX_ATTEMPTS, defaultBaseDelay = Retry.delay() } = defaults ?? {};
|
|
748
|
-
const maxAttemptsProvider =
|
|
746
|
+
const maxAttemptsProvider = normalizeProvider(input.maxAttempts ?? defaultMaxAttempts);
|
|
749
747
|
let controller = retryStrategy
|
|
750
748
|
? Promise.resolve(retryStrategy)
|
|
751
749
|
: undefined;
|
|
752
750
|
const getDefault = async () => {
|
|
753
751
|
const maxAttempts = await maxAttemptsProvider();
|
|
754
|
-
const adaptive = (await
|
|
752
|
+
const adaptive = (await normalizeProvider(retryMode)()) === RETRY_MODES.ADAPTIVE;
|
|
755
753
|
if (adaptive) {
|
|
756
754
|
return new AdaptiveRetryStrategy$1(maxAttemptsProvider, {
|
|
757
755
|
maxAttempts,
|
|
@@ -778,7 +776,7 @@ const NODE_RETRY_MODE_CONFIG_OPTIONS = {
|
|
|
778
776
|
|
|
779
777
|
const omitRetryHeadersMiddleware = () => (next) => async (args) => {
|
|
780
778
|
const { request } = args;
|
|
781
|
-
if (
|
|
779
|
+
if (HttpRequest.isInstance(request)) {
|
|
782
780
|
delete request.headers[INVOCATION_ID_HEADER];
|
|
783
781
|
delete request.headers[REQUEST_HEADER];
|
|
784
782
|
}
|
|
@@ -820,6 +818,7 @@ exports.NODE_RETRY_MODE_CONFIG_OPTIONS = NODE_RETRY_MODE_CONFIG_OPTIONS;
|
|
|
820
818
|
exports.NO_RETRY_INCREMENT = NO_RETRY_INCREMENT;
|
|
821
819
|
exports.REQUEST_HEADER = REQUEST_HEADER;
|
|
822
820
|
exports.RETRY_COST = RETRY_COST;
|
|
821
|
+
exports.RETRY_MODES = RETRY_MODES;
|
|
823
822
|
exports.Retry = Retry;
|
|
824
823
|
exports.StandardRetryStrategy = StandardRetryStrategy$1;
|
|
825
824
|
exports.THROTTLING_RETRY_DELAY_BASE = THROTTLING_RETRY_DELAY_BASE;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var transport = require('@smithy/core/transport');
|
|
1
|
+
const { getSmithyContext, HttpResponse, toEndpointV1 } = require("@smithy/core/transport");
|
|
4
2
|
|
|
5
3
|
const deref = (schemaRef) => {
|
|
6
4
|
if (typeof schemaRef === "function") {
|
|
@@ -19,7 +17,7 @@ const operation = (namespace, name, traits, input, output) => ({
|
|
|
19
17
|
|
|
20
18
|
const schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
|
|
21
19
|
const { response } = await next(args);
|
|
22
|
-
const { operationSchema } =
|
|
20
|
+
const { operationSchema } = getSmithyContext(context);
|
|
23
21
|
const [, ns, n, t, i, o] = operationSchema ?? [];
|
|
24
22
|
try {
|
|
25
23
|
const parsed = await config.protocol.deserializeResponse(operation(ns, n, t, i, o), {
|
|
@@ -57,7 +55,7 @@ const schemaDeserializationMiddleware = (config) => (next, context) => async (ar
|
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
57
|
try {
|
|
60
|
-
if (
|
|
58
|
+
if (HttpResponse.isInstance(response)) {
|
|
61
59
|
const { headers = {}, statusCode } = response;
|
|
62
60
|
const headerEntries = Object.entries(headers);
|
|
63
61
|
error.$metadata = {
|
|
@@ -81,10 +79,10 @@ const findHeader = (pattern, headers) => {
|
|
|
81
79
|
};
|
|
82
80
|
|
|
83
81
|
const schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
|
|
84
|
-
const { operationSchema } =
|
|
82
|
+
const { operationSchema } = getSmithyContext(context);
|
|
85
83
|
const [, ns, n, t, i, o] = operationSchema ?? [];
|
|
86
84
|
const endpoint = context.endpointV2
|
|
87
|
-
? async () =>
|
|
85
|
+
? async () => toEndpointV1(context.endpointV2)
|
|
88
86
|
: config.endpoint;
|
|
89
87
|
const request = await config.protocol.serializeRequest(operation(ns, n, t, i, o), args.input, {
|
|
90
88
|
...config,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var transport = require('@smithy/core/transport');
|
|
4
|
-
var endpoints = require('@smithy/core/endpoints');
|
|
1
|
+
const { HttpResponse } = require("@smithy/core/transport");
|
|
2
|
+
const { toEndpointV1 } = require("@smithy/core/endpoints");
|
|
5
3
|
|
|
6
4
|
const chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;
|
|
7
5
|
const alphabetByEncoding = Object.entries(chars).reduce((acc, [i, c]) => {
|
|
@@ -912,7 +910,7 @@ const deserializerMiddleware = (options, deserializer) => (next, context) => asy
|
|
|
912
910
|
}
|
|
913
911
|
}
|
|
914
912
|
try {
|
|
915
|
-
if (
|
|
913
|
+
if (HttpResponse.isInstance(response)) {
|
|
916
914
|
const { headers = {} } = response;
|
|
917
915
|
const headerEntries = Object.entries(headers);
|
|
918
916
|
error.$metadata = {
|
|
@@ -938,7 +936,7 @@ const findHeader = (pattern, headers) => {
|
|
|
938
936
|
const serializerMiddleware = (options, serializer) => (next, context) => async (args) => {
|
|
939
937
|
const endpointConfig = options;
|
|
940
938
|
const endpoint = context.endpointV2
|
|
941
|
-
? async () =>
|
|
939
|
+
? async () => toEndpointV1(context.endpointV2)
|
|
942
940
|
: endpointConfig.endpoint;
|
|
943
941
|
if (!endpoint) {
|
|
944
942
|
throw new Error("No valid endpoint provider available.");
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var endpoints = require('@smithy/core/endpoints');
|
|
7
|
-
var node_stream = require('node:stream');
|
|
1
|
+
const { createHmac, createHash, getRandomValues } = require("node:crypto");
|
|
2
|
+
const { ReadStream, lstatSync, fstatSync } = require("node:fs");
|
|
3
|
+
const { HttpResponse } = require("@smithy/core/transport");
|
|
4
|
+
const { toEndpointV1 } = require("@smithy/core/endpoints");
|
|
5
|
+
const { Duplex, Readable, Writable, PassThrough } = require("node:stream");
|
|
8
6
|
|
|
9
7
|
const isArrayBuffer = (arg) => (typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer) ||
|
|
10
8
|
Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
|
|
@@ -821,12 +819,12 @@ const calculateBodyLength = (body) => {
|
|
|
821
819
|
else if (typeof body.start === "number" && typeof body.end === "number") {
|
|
822
820
|
return body.end + 1 - body.start;
|
|
823
821
|
}
|
|
824
|
-
else if (body instanceof
|
|
822
|
+
else if (body instanceof ReadStream) {
|
|
825
823
|
if (body.path != null) {
|
|
826
|
-
return
|
|
824
|
+
return lstatSync(body.path).size;
|
|
827
825
|
}
|
|
828
826
|
else if (typeof body.fd === "number") {
|
|
829
|
-
return
|
|
827
|
+
return fstatSync(body.fd).size;
|
|
830
828
|
}
|
|
831
829
|
}
|
|
832
830
|
throw new Error(`Body Length computation failed for ${body}`);
|
|
@@ -877,7 +875,7 @@ const deserializerMiddleware = (options, deserializer) => (next, context) => asy
|
|
|
877
875
|
}
|
|
878
876
|
}
|
|
879
877
|
try {
|
|
880
|
-
if (
|
|
878
|
+
if (HttpResponse.isInstance(response)) {
|
|
881
879
|
const { headers = {} } = response;
|
|
882
880
|
const headerEntries = Object.entries(headers);
|
|
883
881
|
error.$metadata = {
|
|
@@ -903,7 +901,7 @@ const findHeader = (pattern, headers) => {
|
|
|
903
901
|
const serializerMiddleware = (options, serializer) => (next, context) => async (args) => {
|
|
904
902
|
const endpointConfig = options;
|
|
905
903
|
const endpoint = context.endpointV2
|
|
906
|
-
? async () =>
|
|
904
|
+
? async () => toEndpointV1(context.endpointV2)
|
|
907
905
|
: endpointConfig.endpoint;
|
|
908
906
|
if (!endpoint) {
|
|
909
907
|
throw new Error("No valid endpoint provider available.");
|
|
@@ -953,8 +951,8 @@ class Hash {
|
|
|
953
951
|
}
|
|
954
952
|
reset() {
|
|
955
953
|
this.hash = this.secret
|
|
956
|
-
?
|
|
957
|
-
:
|
|
954
|
+
? createHmac(this.algorithmIdentifier, castSourceData(this.secret))
|
|
955
|
+
: createHash(this.algorithmIdentifier);
|
|
958
956
|
}
|
|
959
957
|
}
|
|
960
958
|
function castSourceData(toCast, encoding) {
|
|
@@ -970,7 +968,7 @@ function castSourceData(toCast, encoding) {
|
|
|
970
968
|
return fromArrayBuffer(toCast);
|
|
971
969
|
}
|
|
972
970
|
|
|
973
|
-
let ChecksumStream$1 = class ChecksumStream extends
|
|
971
|
+
let ChecksumStream$1 = class ChecksumStream extends Duplex {
|
|
974
972
|
expectedChecksum;
|
|
975
973
|
checksumSourceLocation;
|
|
976
974
|
checksum;
|
|
@@ -1256,7 +1254,7 @@ function createBufferedReadable(upstream, size, logger) {
|
|
|
1256
1254
|
if (isReadableStream(upstream)) {
|
|
1257
1255
|
return createBufferedReadableStream(upstream, size, logger);
|
|
1258
1256
|
}
|
|
1259
|
-
const downstream = new
|
|
1257
|
+
const downstream = new Readable({ read() { } });
|
|
1260
1258
|
let streamBufferingLoggedWarning = false;
|
|
1261
1259
|
let bytesSeen = 0;
|
|
1262
1260
|
const buffers = [
|
|
@@ -1346,7 +1344,7 @@ function getAwsChunkedEncodingStream(stream, options) {
|
|
|
1346
1344
|
checksumLocationName !== undefined &&
|
|
1347
1345
|
streamHasher !== undefined;
|
|
1348
1346
|
const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readable) : undefined;
|
|
1349
|
-
const awsChunkedEncodingStream = new
|
|
1347
|
+
const awsChunkedEncodingStream = new Readable({
|
|
1350
1348
|
read: () => { },
|
|
1351
1349
|
});
|
|
1352
1350
|
readable.on("data", (data) => {
|
|
@@ -1421,7 +1419,7 @@ const headStream = (stream, bytes) => {
|
|
|
1421
1419
|
});
|
|
1422
1420
|
});
|
|
1423
1421
|
};
|
|
1424
|
-
let Collector$1 = class Collector extends
|
|
1422
|
+
let Collector$1 = class Collector extends Writable {
|
|
1425
1423
|
buffers = [];
|
|
1426
1424
|
limit = Infinity;
|
|
1427
1425
|
bytesBuffered = 0;
|
|
@@ -1597,7 +1595,7 @@ const sdkStreamMixin$1 = (stream) => {
|
|
|
1597
1595
|
};
|
|
1598
1596
|
const isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob;
|
|
1599
1597
|
|
|
1600
|
-
class Collector extends
|
|
1598
|
+
class Collector extends Writable {
|
|
1601
1599
|
bufferedBytes = [];
|
|
1602
1600
|
_write(chunk, encoding, callback) {
|
|
1603
1601
|
this.bufferedBytes.push(chunk);
|
|
@@ -1647,7 +1645,7 @@ const streamCollector = (stream) => {
|
|
|
1647
1645
|
|
|
1648
1646
|
const ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed.";
|
|
1649
1647
|
const sdkStreamMixin = (stream) => {
|
|
1650
|
-
if (!(stream instanceof
|
|
1648
|
+
if (!(stream instanceof Readable)) {
|
|
1651
1649
|
try {
|
|
1652
1650
|
return sdkStreamMixin$1(stream);
|
|
1653
1651
|
}
|
|
@@ -1683,11 +1681,11 @@ const sdkStreamMixin = (stream) => {
|
|
|
1683
1681
|
if (stream.readableFlowing !== null) {
|
|
1684
1682
|
throw new Error("The stream has been consumed by other callbacks.");
|
|
1685
1683
|
}
|
|
1686
|
-
if (typeof
|
|
1684
|
+
if (typeof Readable.toWeb !== "function") {
|
|
1687
1685
|
throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");
|
|
1688
1686
|
}
|
|
1689
1687
|
transformed = true;
|
|
1690
|
-
return
|
|
1688
|
+
return Readable.toWeb(stream);
|
|
1691
1689
|
},
|
|
1692
1690
|
});
|
|
1693
1691
|
};
|
|
@@ -1704,8 +1702,8 @@ async function splitStream(stream) {
|
|
|
1704
1702
|
if (isReadableStream(stream) || isBlob(stream)) {
|
|
1705
1703
|
return splitStream$1(stream);
|
|
1706
1704
|
}
|
|
1707
|
-
const stream1 = new
|
|
1708
|
-
const stream2 = new
|
|
1705
|
+
const stream1 = new PassThrough();
|
|
1706
|
+
const stream2 = new PassThrough();
|
|
1709
1707
|
stream.pipe(stream1);
|
|
1710
1708
|
stream.pipe(stream2);
|
|
1711
1709
|
return [stream1, stream2];
|
|
@@ -1713,7 +1711,7 @@ async function splitStream(stream) {
|
|
|
1713
1711
|
|
|
1714
1712
|
class Uint8ArrayBlobAdapter extends bindUint8ArrayBlobAdapter(toUtf8$1, fromUtf8$1, toBase64$1, fromBase64$1) {
|
|
1715
1713
|
}
|
|
1716
|
-
const _getRandomValues =
|
|
1714
|
+
const _getRandomValues = getRandomValues;
|
|
1717
1715
|
const v4 = bindV4(_getRandomValues);
|
|
1718
1716
|
const generateIdempotencyToken = v4;
|
|
1719
1717
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var transport = require('@smithy/core/transport');
|
|
4
|
-
var endpoints = require('@smithy/core/endpoints');
|
|
1
|
+
const { HttpResponse } = require("@smithy/core/transport");
|
|
2
|
+
const { toEndpointV1 } = require("@smithy/core/endpoints");
|
|
5
3
|
|
|
6
4
|
const chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;
|
|
7
5
|
const alphabetByEncoding = Object.entries(chars).reduce((acc, [i, c]) => {
|
|
@@ -912,7 +910,7 @@ const deserializerMiddleware = (options, deserializer) => (next, context) => asy
|
|
|
912
910
|
}
|
|
913
911
|
}
|
|
914
912
|
try {
|
|
915
|
-
if (
|
|
913
|
+
if (HttpResponse.isInstance(response)) {
|
|
916
914
|
const { headers = {} } = response;
|
|
917
915
|
const headerEntries = Object.entries(headers);
|
|
918
916
|
error.$metadata = {
|
|
@@ -938,7 +936,7 @@ const findHeader = (pattern, headers) => {
|
|
|
938
936
|
const serializerMiddleware = (options, serializer) => (next, context) => async (args) => {
|
|
939
937
|
const endpointConfig = options;
|
|
940
938
|
const endpoint = context.endpointV2
|
|
941
|
-
? async () =>
|
|
939
|
+
? async () => toEndpointV1(context.endpointV2)
|
|
942
940
|
: endpointConfig.endpoint;
|
|
943
941
|
if (!endpoint) {
|
|
944
942
|
throw new Error("No valid endpoint provider available.");
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const { SMITHY_CONTEXT_KEY } = require("@smithy/types");
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const getSmithyContext = (context) => context[types.SMITHY_CONTEXT_KEY] || (context[types.SMITHY_CONTEXT_KEY] = {});
|
|
3
|
+
const getSmithyContext = (context) => context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {});
|
|
6
4
|
|
|
7
5
|
class HttpRequest {
|
|
8
6
|
method;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getSmithyContext } from "@smithy/core/client";
|
|
2
1
|
import { RpcProtocol } from "@smithy/core/protocols";
|
|
3
2
|
import { NormalizedSchema, TypeRegistry, deref } from "@smithy/core/schema";
|
|
3
|
+
import { getSmithyContext } from "@smithy/core/transport";
|
|
4
4
|
import { CborCodec } from "./CborCodec";
|
|
5
5
|
import { loadSmithyRpcV2CborErrorCode } from "./parseCborBody";
|
|
6
6
|
export class SmithyRpcV2CborProtocol extends RpcProtocol {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSmithyContext } from "@smithy/core/
|
|
1
|
+
import { getSmithyContext } from "@smithy/core/transport";
|
|
2
2
|
import { bindGetEndpointFromInstructions } from "./adaptors/getEndpointFromInstructions";
|
|
3
3
|
function setFeature(context, feature, value) {
|
|
4
4
|
if (!context.__smithy_context) {
|
|
@@ -62,7 +62,7 @@ export declare class TypeRegistry {
|
|
|
62
62
|
* @param predicate - criterion.
|
|
63
63
|
* @returns a schema in this registry matching the predicate.
|
|
64
64
|
*/
|
|
65
|
-
find(predicate: (schema: ISchema) => boolean): number | import("@smithy/types").StaticSimpleSchema | import("@smithy/types").StaticListSchema | import("@smithy/types").StaticMapSchema | import("@smithy/types").StaticStructureSchema | import("@smithy/types").StaticUnionSchema | StaticErrorSchema | import("@smithy/types").StaticOperationSchema |
|
|
65
|
+
find(predicate: (schema: ISchema) => boolean): number | "unit" | import("@smithy/types").StaticSimpleSchema | import("@smithy/types").StaticListSchema | import("@smithy/types").StaticMapSchema | import("@smithy/types").StaticStructureSchema | import("@smithy/types").StaticUnionSchema | StaticErrorSchema | import("@smithy/types").StaticOperationSchema | import("@smithy/types").NormalizedSchema | import("@smithy/types").TraitsSchema | import("@smithy/types").MemberSchema | undefined;
|
|
66
66
|
/**
|
|
67
67
|
* Unloads the current TypeRegistry.
|
|
68
68
|
*/
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.25.0",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"build": "
|
|
6
|
-
"build:es:cjs": "yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline",
|
|
7
|
-
"build:types": "yarn g:tsc -p tsconfig.types.json",
|
|
5
|
+
"build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
|
|
6
|
+
"build:es:cjs": "premove dist-es && yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline",
|
|
7
|
+
"build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json",
|
|
8
8
|
"build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
|
|
9
|
-
"clean": "premove dist-cjs dist-es dist-types
|
|
9
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
10
10
|
"extract:docs": "api-extractor run --local",
|
|
11
11
|
"format": "prettier --config ../../prettier.config.js --ignore-path ../../.prettierignore --write \"**/*.{ts,md,json}\"",
|
|
12
12
|
"lint": "node ../../scripts/validation/submodules-linter.js",
|
|
13
|
+
"prebuild": "yarn lint",
|
|
13
14
|
"stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
|
|
14
15
|
"test": "yarn g:vitest run",
|
|
15
16
|
"test:watch": "yarn g:vitest watch",
|
|
@@ -169,7 +170,7 @@
|
|
|
169
170
|
"sideEffects": false,
|
|
170
171
|
"dependencies": {
|
|
171
172
|
"@aws-crypto/crc32": "5.2.0",
|
|
172
|
-
"@smithy/types": "^4.
|
|
173
|
+
"@smithy/types": "^4.15.0",
|
|
173
174
|
"tslib": "^2.6.2"
|
|
174
175
|
},
|
|
175
176
|
"devDependencies": {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var node_http = require('node:http');
|
|
5
|
-
var protocols = require('@smithy/core/protocols');
|
|
1
|
+
const { ProviderError, CredentialsProviderError, loadConfig } = require("@smithy/core/config");
|
|
2
|
+
const node_http = require("node:http");
|
|
3
|
+
const { parseUrl } = require("@smithy/core/protocols");
|
|
6
4
|
|
|
7
5
|
const isImdsCredentials = (arg) => Boolean(arg) &&
|
|
8
6
|
typeof arg === "object" &&
|
|
@@ -30,17 +28,17 @@ function httpRequest(options) {
|
|
|
30
28
|
hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1"),
|
|
31
29
|
});
|
|
32
30
|
req.on("error", (err) => {
|
|
33
|
-
reject(Object.assign(new
|
|
31
|
+
reject(Object.assign(new ProviderError("Unable to connect to instance metadata service"), err));
|
|
34
32
|
req.destroy();
|
|
35
33
|
});
|
|
36
34
|
req.on("timeout", () => {
|
|
37
|
-
reject(new
|
|
35
|
+
reject(new ProviderError("TimeoutError from instance metadata service"));
|
|
38
36
|
req.destroy();
|
|
39
37
|
});
|
|
40
38
|
req.on("response", (res) => {
|
|
41
39
|
const { statusCode = 400 } = res;
|
|
42
40
|
if (statusCode < 200 || 300 <= statusCode) {
|
|
43
|
-
reject(Object.assign(new
|
|
41
|
+
reject(Object.assign(new ProviderError("Error response received from instance metadata service"), { statusCode }));
|
|
44
42
|
req.destroy();
|
|
45
43
|
}
|
|
46
44
|
const chunks = [];
|
|
@@ -73,7 +71,7 @@ const fromContainerMetadata = (init = {}) => {
|
|
|
73
71
|
const requestOptions = await getCmdsUri({ logger: init.logger });
|
|
74
72
|
const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions));
|
|
75
73
|
if (!isImdsCredentials(credsResponse)) {
|
|
76
|
-
throw new
|
|
74
|
+
throw new CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
77
75
|
logger: init.logger,
|
|
78
76
|
});
|
|
79
77
|
}
|
|
@@ -109,16 +107,16 @@ const getCmdsUri = async ({ logger }) => {
|
|
|
109
107
|
parsed = new URL(process.env[ENV_CMDS_FULL_URI]);
|
|
110
108
|
}
|
|
111
109
|
catch {
|
|
112
|
-
throw new
|
|
110
|
+
throw new CredentialsProviderError(`${process.env[ENV_CMDS_FULL_URI]} is not a valid container metadata service URL`, { tryNextLink: false, logger });
|
|
113
111
|
}
|
|
114
112
|
if (!parsed.hostname || !GREENGRASS_HOSTS.has(parsed.hostname)) {
|
|
115
|
-
throw new
|
|
113
|
+
throw new CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
|
116
114
|
tryNextLink: false,
|
|
117
115
|
logger,
|
|
118
116
|
});
|
|
119
117
|
}
|
|
120
118
|
if (!parsed.protocol || !GREENGRASS_PROTOCOLS.has(parsed.protocol)) {
|
|
121
|
-
throw new
|
|
119
|
+
throw new CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
|
122
120
|
tryNextLink: false,
|
|
123
121
|
logger,
|
|
124
122
|
});
|
|
@@ -130,7 +128,7 @@ const getCmdsUri = async ({ logger }) => {
|
|
|
130
128
|
port: parsed.port ? parseInt(parsed.port, 10) : undefined,
|
|
131
129
|
};
|
|
132
130
|
}
|
|
133
|
-
throw new
|
|
131
|
+
throw new CredentialsProviderError("The container metadata credential provider cannot be used unless" +
|
|
134
132
|
` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` +
|
|
135
133
|
" variable is set", {
|
|
136
134
|
tryNextLink: false,
|
|
@@ -138,7 +136,7 @@ const getCmdsUri = async ({ logger }) => {
|
|
|
138
136
|
});
|
|
139
137
|
};
|
|
140
138
|
|
|
141
|
-
class InstanceMetadataV1FallbackError extends
|
|
139
|
+
class InstanceMetadataV1FallbackError extends CredentialsProviderError {
|
|
142
140
|
tryNextLink;
|
|
143
141
|
name = "InstanceMetadataV1FallbackError";
|
|
144
142
|
constructor(message, tryNextLink = true) {
|
|
@@ -148,11 +146,11 @@ class InstanceMetadataV1FallbackError extends config.CredentialsProviderError {
|
|
|
148
146
|
}
|
|
149
147
|
}
|
|
150
148
|
|
|
151
|
-
|
|
149
|
+
var Endpoint;
|
|
152
150
|
(function (Endpoint) {
|
|
153
151
|
Endpoint["IPv4"] = "http://169.254.169.254";
|
|
154
152
|
Endpoint["IPv6"] = "http://[fd00:ec2::254]";
|
|
155
|
-
})(
|
|
153
|
+
})(Endpoint || (Endpoint = {}));
|
|
156
154
|
|
|
157
155
|
const ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT";
|
|
158
156
|
const CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint";
|
|
@@ -176,15 +174,15 @@ const ENDPOINT_MODE_CONFIG_OPTIONS = {
|
|
|
176
174
|
default: EndpointMode.IPv4,
|
|
177
175
|
};
|
|
178
176
|
|
|
179
|
-
const getInstanceMetadataEndpoint = async () =>
|
|
180
|
-
const getFromEndpointConfig = async () =>
|
|
177
|
+
const getInstanceMetadataEndpoint = async () => parseUrl((await getFromEndpointConfig()) || (await getFromEndpointModeConfig()));
|
|
178
|
+
const getFromEndpointConfig = async () => loadConfig(ENDPOINT_CONFIG_OPTIONS)();
|
|
181
179
|
const getFromEndpointModeConfig = async () => {
|
|
182
|
-
const endpointMode = await
|
|
180
|
+
const endpointMode = await loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS)();
|
|
183
181
|
switch (endpointMode) {
|
|
184
182
|
case EndpointMode.IPv4:
|
|
185
|
-
return
|
|
183
|
+
return Endpoint.IPv4;
|
|
186
184
|
case EndpointMode.IPv6:
|
|
187
|
-
return
|
|
185
|
+
return Endpoint.IPv6;
|
|
188
186
|
default:
|
|
189
187
|
throw new Error(`Unsupported endpoint mode: ${endpointMode}.` + ` Select from ${Object.values(EndpointMode)}`);
|
|
190
188
|
}
|
|
@@ -248,12 +246,12 @@ const getInstanceMetadataProvider = (init = {}) => {
|
|
|
248
246
|
if (isImdsV1Fallback) {
|
|
249
247
|
let fallbackBlockedFromProfile = false;
|
|
250
248
|
let fallbackBlockedFromProcessEnv = false;
|
|
251
|
-
const configValue = await
|
|
249
|
+
const configValue = await loadConfig({
|
|
252
250
|
environmentVariableSelector: (env) => {
|
|
253
251
|
const envValue = env[AWS_EC2_METADATA_V1_DISABLED];
|
|
254
252
|
fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
|
|
255
253
|
if (envValue === undefined) {
|
|
256
|
-
throw new
|
|
254
|
+
throw new CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
|
|
257
255
|
}
|
|
258
256
|
return fallbackBlockedFromProcessEnv;
|
|
259
257
|
},
|
|
@@ -352,7 +350,7 @@ const getCredentialsFromProfile = async (profile, options, init) => {
|
|
|
352
350
|
path: IMDS_PATH + profile,
|
|
353
351
|
})).toString());
|
|
354
352
|
if (!isImdsCredentials(credentialsResponse)) {
|
|
355
|
-
throw new
|
|
353
|
+
throw new CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
356
354
|
logger: init.logger,
|
|
357
355
|
});
|
|
358
356
|
}
|
|
@@ -364,6 +362,7 @@ exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT;
|
|
|
364
362
|
exports.ENV_CMDS_AUTH_TOKEN = ENV_CMDS_AUTH_TOKEN;
|
|
365
363
|
exports.ENV_CMDS_FULL_URI = ENV_CMDS_FULL_URI;
|
|
366
364
|
exports.ENV_CMDS_RELATIVE_URI = ENV_CMDS_RELATIVE_URI;
|
|
365
|
+
exports.Endpoint = Endpoint;
|
|
367
366
|
exports.fromContainerMetadata = fromContainerMetadata;
|
|
368
367
|
exports.fromInstanceMetadata = fromInstanceMetadata;
|
|
369
368
|
exports.getInstanceMetadataEndpoint = getInstanceMetadataEndpoint;
|