@karmaniverous/get-dotenv 6.2.2 → 6.2.4
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/chunks/AwsRestJsonProtocol-Bq1HE-Ln.mjs +932 -0
- package/dist/chunks/createCli-BY6_cfZr.mjs +439 -0
- package/dist/chunks/externalDataInterceptor-CbsdEYa-.mjs +19 -0
- package/dist/chunks/getSSOTokenFromFile-hUSpR7Wf.mjs +22 -0
- package/dist/chunks/helpConfig-CGejgwWW.mjs +12 -0
- package/dist/chunks/index-B5JKTBOL.mjs +443 -0
- package/dist/chunks/index-BEJFiHMX.mjs +522 -0
- package/dist/chunks/index-BPYF6K_G.mjs +82 -0
- package/dist/chunks/index-Bc3h0a95.mjs +374 -0
- package/dist/chunks/index-BpCF5UKx.mjs +272 -0
- package/dist/chunks/index-C_wqbTwI.mjs +187 -0
- package/dist/chunks/index-CeCufHlm.mjs +9374 -0
- package/dist/chunks/index-Cu7rdyqN.mjs +102 -0
- package/dist/chunks/index-DWAtHEA-.mjs +379 -0
- package/dist/chunks/index-Dp1Ip6Ra.mjs +354 -0
- package/dist/chunks/index-DyU5pKKi.mjs +24 -0
- package/dist/chunks/index-c7zKtEuy.mjs +578 -0
- package/dist/chunks/index-cIunyiUQ.mjs +702 -0
- package/dist/chunks/invoke-DuRPU1oC.mjs +60 -0
- package/dist/chunks/loadModuleDefault-Dj8B3Stt.mjs +123 -0
- package/dist/chunks/loadSso-w1eTVg0O.mjs +412 -0
- package/dist/chunks/loader-DnhPeGfq.mjs +346 -0
- package/dist/chunks/overlayEnv-Bs2kVayG.mjs +234 -0
- package/dist/chunks/package-boo9EyYs.mjs +5 -0
- package/dist/chunks/parseKnownFiles-B9cDK21V.mjs +23 -0
- package/dist/chunks/readMergedOptions-Nt0TR7dX.mjs +1626 -0
- package/dist/chunks/resolveCliOptions-TFRzhB2c.mjs +138 -0
- package/dist/chunks/sdk-stream-mixin-BZoJ5jy9.mjs +167 -0
- package/dist/chunks/spawnEnv-CN8a7cNR.mjs +306 -0
- package/dist/chunks/types-DJ-BGABd.mjs +59 -0
- package/dist/chunks/validate-CDl0rE6k.mjs +61 -0
- package/dist/cli.mjs +39 -19307
- package/dist/cliHost.mjs +20 -2800
- package/dist/config.mjs +10 -509
- package/dist/env-overlay.mjs +6 -337
- package/dist/getdotenv.cli.mjs +39 -19305
- package/dist/index.mjs +39 -19396
- package/dist/plugins-aws.d.ts +1 -4
- package/dist/plugins-aws.mjs +65 -2568
- package/dist/plugins-batch.mjs +16 -2573
- package/dist/plugins-cmd.mjs +19 -3094
- package/dist/plugins-init.d.ts +8 -0
- package/dist/plugins-init.mjs +85 -2297
- package/dist/plugins.mjs +36 -18817
- package/package.json +1 -2
- package/dist/templates/cli/index.ts +0 -25
- package/dist/templates/cli/plugins/hello/defaultAction.ts +0 -27
- package/dist/templates/cli/plugins/hello/index.ts +0 -26
- package/dist/templates/cli/plugins/hello/options.ts +0 -31
- package/dist/templates/cli/plugins/hello/strangerAction.ts +0 -20
- package/dist/templates/cli/plugins/hello/types.ts +0 -13
- package/dist/templates/config/js/getdotenv.config.js +0 -20
- package/dist/templates/config/json/local/getdotenv.config.local.json +0 -7
- package/dist/templates/config/json/public/getdotenv.config.json +0 -9
- package/dist/templates/config/public/getdotenv.config.json +0 -8
- package/dist/templates/config/ts/getdotenv.config.ts +0 -28
- package/dist/templates/config/yaml/local/getdotenv.config.local.yaml +0 -7
- package/dist/templates/config/yaml/public/getdotenv.config.yaml +0 -7
- package/dist/templates/defaultAction.ts +0 -27
- package/dist/templates/getdotenv.config.js +0 -20
- package/dist/templates/getdotenv.config.json +0 -9
- package/dist/templates/getdotenv.config.local.json +0 -7
- package/dist/templates/getdotenv.config.local.yaml +0 -7
- package/dist/templates/getdotenv.config.ts +0 -28
- package/dist/templates/getdotenv.config.yaml +0 -7
- package/dist/templates/hello/defaultAction.ts +0 -27
- package/dist/templates/hello/index.ts +0 -26
- package/dist/templates/hello/options.ts +0 -31
- package/dist/templates/hello/strangerAction.ts +0 -20
- package/dist/templates/hello/types.ts +0 -13
- package/dist/templates/index.ts +0 -26
- package/dist/templates/js/getdotenv.config.js +0 -20
- package/dist/templates/json/local/getdotenv.config.local.json +0 -7
- package/dist/templates/json/public/getdotenv.config.json +0 -9
- package/dist/templates/local/getdotenv.config.local.json +0 -7
- package/dist/templates/local/getdotenv.config.local.yaml +0 -7
- package/dist/templates/options.ts +0 -31
- package/dist/templates/plugins/hello/defaultAction.ts +0 -27
- package/dist/templates/plugins/hello/index.ts +0 -26
- package/dist/templates/plugins/hello/options.ts +0 -31
- package/dist/templates/plugins/hello/strangerAction.ts +0 -20
- package/dist/templates/plugins/hello/types.ts +0 -13
- package/dist/templates/public/getdotenv.config.json +0 -9
- package/dist/templates/public/getdotenv.config.yaml +0 -7
- package/dist/templates/strangerAction.ts +0 -20
- package/dist/templates/ts/getdotenv.config.ts +0 -28
- package/dist/templates/types.ts +0 -13
- package/dist/templates/yaml/local/getdotenv.config.local.yaml +0 -7
- package/dist/templates/yaml/public/getdotenv.config.yaml +0 -7
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
import { O as loadConfig, X as NODE_REGION_CONFIG_FILE_OPTIONS, Y as NODE_REGION_CONFIG_OPTIONS, w as resolveAwsSdkSigV4Config, x as normalizeProvider, y as getSmithyContext, z as EndpointCache, A as resolveEndpoint, B as awsEndpointFunctions, D as customEndpointFunctions, t as toUtf8, i as fromUtf8, F as parseUrl, aP as AwsQueryProtocol, G as NoOpLogger, I as AwsSdkSigV4Signer, J as NoAuthSigner, n as toBase64, m as fromBase64, K as emitWarningIfUnsupportedVersion, L as resolveDefaultsModeConfig, M as emitWarningIfUnsupportedVersion$1, r as streamCollector, P as Hash, N as NodeHttpHandler, Q as createDefaultUserAgentProvider, R as calculateBodyLength, S as NODE_APP_ID_CONFIG_OPTIONS, T as NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, U as NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, V as NODE_RETRY_MODE_CONFIG_OPTIONS, W as DEFAULT_RETRY_MODE, Z as NODE_MAX_ATTEMPT_CONFIG_OPTIONS, _ as NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, $ as loadConfigsForDefaultMode, a0 as getAwsRegionExtensionConfiguration, a1 as getDefaultExtensionConfiguration, a2 as getHttpHandlerExtensionConfiguration, a3 as resolveAwsRegionExtensionConfiguration, a4 as resolveDefaultRuntimeConfig, a5 as resolveHttpHandlerRuntimeConfig, a6 as Client, a7 as resolveUserAgentConfig, a8 as resolveRetryConfig, a9 as resolveRegionConfig, aa as resolveEndpointConfig, ab as resolveHostHeaderConfig, ac as getSchemaSerdePlugin, ad as getUserAgentPlugin, ae as getRetryPlugin, af as getContentLengthPlugin, ag as getHostHeaderPlugin, ah as getLoggerPlugin, ai as getRecursionDetectionPlugin, aj as getHttpAuthSchemeEndpointRuleSetPlugin, ak as DefaultIdentityProviderConfig, al as getHttpSigningPlugin, am as ServiceException, an as TypeRegistry, ao as Command, ap as getEndpointPlugin, s as setCredentialFeature } from './index-CeCufHlm.mjs';
|
|
2
|
+
import { p as packageInfo } from './package-boo9EyYs.mjs';
|
|
3
|
+
import './readMergedOptions-Nt0TR7dX.mjs';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import '@commander-js/extra-typings';
|
|
6
|
+
import './overlayEnv-Bs2kVayG.mjs';
|
|
7
|
+
import 'fs-extra';
|
|
8
|
+
import './loadModuleDefault-Dj8B3Stt.mjs';
|
|
9
|
+
import 'crypto';
|
|
10
|
+
import 'path';
|
|
11
|
+
import 'url';
|
|
12
|
+
import 'nanoid';
|
|
13
|
+
import 'dotenv';
|
|
14
|
+
import './loader-DnhPeGfq.mjs';
|
|
15
|
+
import 'package-directory';
|
|
16
|
+
import 'yaml';
|
|
17
|
+
import 'execa';
|
|
18
|
+
import 'buffer';
|
|
19
|
+
import 'os';
|
|
20
|
+
import 'node:fs/promises';
|
|
21
|
+
import 'http';
|
|
22
|
+
import 'https';
|
|
23
|
+
import 'stream';
|
|
24
|
+
import 'process';
|
|
25
|
+
import 'node:fs';
|
|
26
|
+
|
|
27
|
+
function stsRegionDefaultResolver(loaderConfig = {}) {
|
|
28
|
+
return loadConfig({
|
|
29
|
+
...NODE_REGION_CONFIG_OPTIONS,
|
|
30
|
+
async default() {
|
|
31
|
+
{
|
|
32
|
+
console.warn("@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly.");
|
|
33
|
+
}
|
|
34
|
+
return "us-east-1";
|
|
35
|
+
},
|
|
36
|
+
}, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
|
40
|
+
return {
|
|
41
|
+
operation: getSmithyContext(context).operation,
|
|
42
|
+
region: (await normalizeProvider(config.region)()) ||
|
|
43
|
+
(() => {
|
|
44
|
+
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
|
45
|
+
})(),
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
|
49
|
+
return {
|
|
50
|
+
schemeId: "aws.auth#sigv4",
|
|
51
|
+
signingProperties: {
|
|
52
|
+
name: "sts",
|
|
53
|
+
region: authParameters.region,
|
|
54
|
+
},
|
|
55
|
+
propertiesExtractor: (config, context) => ({
|
|
56
|
+
signingProperties: {
|
|
57
|
+
config,
|
|
58
|
+
context,
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
|
64
|
+
return {
|
|
65
|
+
schemeId: "smithy.api#noAuth",
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const defaultSTSHttpAuthSchemeProvider = (authParameters) => {
|
|
69
|
+
const options = [];
|
|
70
|
+
switch (authParameters.operation) {
|
|
71
|
+
case "AssumeRoleWithWebIdentity": {
|
|
72
|
+
options.push(createSmithyApiNoAuthHttpAuthOption());
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
default: {
|
|
76
|
+
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return options;
|
|
80
|
+
};
|
|
81
|
+
const resolveStsAuthConfig = (input) => Object.assign(input, {
|
|
82
|
+
stsClientCtor: STSClient,
|
|
83
|
+
});
|
|
84
|
+
const resolveHttpAuthSchemeConfig = (config) => {
|
|
85
|
+
const config_0 = resolveStsAuthConfig(config);
|
|
86
|
+
const config_1 = resolveAwsSdkSigV4Config(config_0);
|
|
87
|
+
return Object.assign(config_1, {
|
|
88
|
+
authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const resolveClientEndpointParameters = (options) => {
|
|
93
|
+
return Object.assign(options, {
|
|
94
|
+
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
|
|
95
|
+
useFipsEndpoint: options.useFipsEndpoint ?? false,
|
|
96
|
+
useGlobalEndpoint: options.useGlobalEndpoint ?? false,
|
|
97
|
+
defaultSigningName: "sts",
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const commonParams = {
|
|
101
|
+
UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" },
|
|
102
|
+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
|
103
|
+
Endpoint: { type: "builtInParams", name: "endpoint" },
|
|
104
|
+
Region: { type: "builtInParams", name: "region" },
|
|
105
|
+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const F = "required", G = "type", H = "fn", I = "argv", J = "ref";
|
|
109
|
+
const a = false, b = true, c = "booleanEquals", d = "stringEquals", e = "sigv4", f = "sts", g = "us-east-1", h = "endpoint", i = "https://sts.{Region}.{PartitionResult#dnsSuffix}", j = "tree", k = "error", l = "getAttr", m = { [F]: false, [G]: "string" }, n = { [F]: true, "default": false, [G]: "boolean" }, o = { [J]: "Endpoint" }, p = { [H]: "isSet", [I]: [{ [J]: "Region" }] }, q = { [J]: "Region" }, r = { [H]: "aws.partition", [I]: [q], "assign": "PartitionResult" }, s = { [J]: "UseFIPS" }, t = { [J]: "UseDualStack" }, u = { "url": "https://sts.amazonaws.com", "properties": { "authSchemes": [{ "name": e, "signingName": f, "signingRegion": g }] }, "headers": {} }, v = {}, w = { "conditions": [{ [H]: d, [I]: [q, "aws-global"] }], [h]: u, [G]: h }, x = { [H]: c, [I]: [s, true] }, y = { [H]: c, [I]: [t, true] }, z = { [H]: l, [I]: [{ [J]: "PartitionResult" }, "supportsFIPS"] }, A = { [J]: "PartitionResult" }, B = { [H]: c, [I]: [true, { [H]: l, [I]: [A, "supportsDualStack"] }] }, C = [{ [H]: "isSet", [I]: [o] }], D = [x], E = [y];
|
|
110
|
+
const _data = { parameters: { Region: m, UseDualStack: n, UseFIPS: n, Endpoint: m, UseGlobalEndpoint: n }, rules: [{ conditions: [{ [H]: c, [I]: [{ [J]: "UseGlobalEndpoint" }, b] }, { [H]: "not", [I]: C }, p, r, { [H]: c, [I]: [s, a] }, { [H]: c, [I]: [t, a] }], rules: [{ conditions: [{ [H]: d, [I]: [q, "ap-northeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-south-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-2"] }], endpoint: u, [G]: h }, w, { conditions: [{ [H]: d, [I]: [q, "ca-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-north-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-3"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "sa-east-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, g] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-east-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-2"] }], endpoint: u, [G]: h }, { endpoint: { url: i, properties: { authSchemes: [{ name: e, signingName: f, signingRegion: "{Region}" }] }, headers: v }, [G]: h }], [G]: j }, { conditions: C, rules: [{ conditions: D, error: "Invalid Configuration: FIPS and custom endpoint are not supported", [G]: k }, { conditions: E, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", [G]: k }, { endpoint: { url: o, properties: v, headers: v }, [G]: h }], [G]: j }, { conditions: [p], rules: [{ conditions: [r], rules: [{ conditions: [x, y], rules: [{ conditions: [{ [H]: c, [I]: [b, z] }, B], rules: [{ endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", [G]: k }], [G]: j }, { conditions: D, rules: [{ conditions: [{ [H]: c, [I]: [z, b] }], rules: [{ conditions: [{ [H]: d, [I]: [{ [H]: l, [I]: [A, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://sts.{Region}.amazonaws.com", properties: v, headers: v }, [G]: h }, { endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS is enabled but this partition does not support FIPS", [G]: k }], [G]: j }, { conditions: E, rules: [{ conditions: [B], rules: [{ endpoint: { url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "DualStack is enabled but this partition does not support DualStack", [G]: k }], [G]: j }, w, { endpoint: { url: i, properties: v, headers: v }, [G]: h }], [G]: j }], [G]: j }, { error: "Invalid Configuration: Missing Region", [G]: k }] };
|
|
111
|
+
const ruleSet = _data;
|
|
112
|
+
|
|
113
|
+
const cache = new EndpointCache({
|
|
114
|
+
size: 50,
|
|
115
|
+
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS", "UseGlobalEndpoint"],
|
|
116
|
+
});
|
|
117
|
+
const defaultEndpointResolver = (endpointParams, context = {}) => {
|
|
118
|
+
return cache.get(endpointParams, () => resolveEndpoint(ruleSet, {
|
|
119
|
+
endpointParams: endpointParams,
|
|
120
|
+
logger: context.logger,
|
|
121
|
+
}));
|
|
122
|
+
};
|
|
123
|
+
customEndpointFunctions.aws = awsEndpointFunctions;
|
|
124
|
+
|
|
125
|
+
const getRuntimeConfig$1 = (config) => {
|
|
126
|
+
return {
|
|
127
|
+
apiVersion: "2011-06-15",
|
|
128
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
129
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
130
|
+
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
131
|
+
endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
|
|
132
|
+
extensions: config?.extensions ?? [],
|
|
133
|
+
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSTSHttpAuthSchemeProvider,
|
|
134
|
+
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
|
135
|
+
{
|
|
136
|
+
schemeId: "aws.auth#sigv4",
|
|
137
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
|
138
|
+
signer: new AwsSdkSigV4Signer(),
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
schemeId: "smithy.api#noAuth",
|
|
142
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
|
143
|
+
signer: new NoAuthSigner(),
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
logger: config?.logger ?? new NoOpLogger(),
|
|
147
|
+
protocol: config?.protocol ??
|
|
148
|
+
new AwsQueryProtocol({
|
|
149
|
+
defaultNamespace: "com.amazonaws.sts",
|
|
150
|
+
xmlNamespace: "https://sts.amazonaws.com/doc/2011-06-15/",
|
|
151
|
+
version: "2011-06-15",
|
|
152
|
+
}),
|
|
153
|
+
serviceId: config?.serviceId ?? "STS",
|
|
154
|
+
urlParser: config?.urlParser ?? parseUrl,
|
|
155
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
156
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const getRuntimeConfig = (config) => {
|
|
161
|
+
emitWarningIfUnsupportedVersion(process.version);
|
|
162
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
163
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
164
|
+
const clientSharedValues = getRuntimeConfig$1(config);
|
|
165
|
+
emitWarningIfUnsupportedVersion$1(process.version);
|
|
166
|
+
const loaderConfig = {
|
|
167
|
+
profile: config?.profile,
|
|
168
|
+
logger: clientSharedValues.logger,
|
|
169
|
+
};
|
|
170
|
+
return {
|
|
171
|
+
...clientSharedValues,
|
|
172
|
+
...config,
|
|
173
|
+
runtime: "node",
|
|
174
|
+
defaultsMode,
|
|
175
|
+
authSchemePreference: config?.authSchemePreference ?? loadConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
|
176
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
177
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
178
|
+
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
179
|
+
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
|
180
|
+
{
|
|
181
|
+
schemeId: "aws.auth#sigv4",
|
|
182
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4") ||
|
|
183
|
+
(async (idProps) => await config.credentialDefaultProvider(idProps?.__config || {})()),
|
|
184
|
+
signer: new AwsSdkSigV4Signer(),
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
schemeId: "smithy.api#noAuth",
|
|
188
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
|
189
|
+
signer: new NoAuthSigner(),
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
maxAttempts: config?.maxAttempts ?? loadConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
|
193
|
+
region: config?.region ??
|
|
194
|
+
loadConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
|
195
|
+
requestHandler: NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
|
196
|
+
retryMode: config?.retryMode ??
|
|
197
|
+
loadConfig({
|
|
198
|
+
...NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
199
|
+
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
|
|
200
|
+
}, config),
|
|
201
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
202
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
203
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
204
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? loadConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
205
|
+
userAgentAppId: config?.userAgentAppId ?? loadConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
|
210
|
+
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
|
211
|
+
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
|
212
|
+
let _credentials = runtimeConfig.credentials;
|
|
213
|
+
return {
|
|
214
|
+
setHttpAuthScheme(httpAuthScheme) {
|
|
215
|
+
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
|
216
|
+
if (index === -1) {
|
|
217
|
+
_httpAuthSchemes.push(httpAuthScheme);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
httpAuthSchemes() {
|
|
224
|
+
return _httpAuthSchemes;
|
|
225
|
+
},
|
|
226
|
+
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
|
227
|
+
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
|
228
|
+
},
|
|
229
|
+
httpAuthSchemeProvider() {
|
|
230
|
+
return _httpAuthSchemeProvider;
|
|
231
|
+
},
|
|
232
|
+
setCredentials(credentials) {
|
|
233
|
+
_credentials = credentials;
|
|
234
|
+
},
|
|
235
|
+
credentials() {
|
|
236
|
+
return _credentials;
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
const resolveHttpAuthRuntimeConfig = (config) => {
|
|
241
|
+
return {
|
|
242
|
+
httpAuthSchemes: config.httpAuthSchemes(),
|
|
243
|
+
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
|
244
|
+
credentials: config.credentials(),
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
|
249
|
+
const extensionConfiguration = Object.assign(getAwsRegionExtensionConfiguration(runtimeConfig), getDefaultExtensionConfiguration(runtimeConfig), getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
|
|
250
|
+
extensions.forEach((extension) => extension.configure(extensionConfiguration));
|
|
251
|
+
return Object.assign(runtimeConfig, resolveAwsRegionExtensionConfiguration(extensionConfiguration), resolveDefaultRuntimeConfig(extensionConfiguration), resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
class STSClient extends Client {
|
|
255
|
+
config;
|
|
256
|
+
constructor(...[configuration]) {
|
|
257
|
+
const _config_0 = getRuntimeConfig(configuration || {});
|
|
258
|
+
super(_config_0);
|
|
259
|
+
this.initConfig = _config_0;
|
|
260
|
+
const _config_1 = resolveClientEndpointParameters(_config_0);
|
|
261
|
+
const _config_2 = resolveUserAgentConfig(_config_1);
|
|
262
|
+
const _config_3 = resolveRetryConfig(_config_2);
|
|
263
|
+
const _config_4 = resolveRegionConfig(_config_3);
|
|
264
|
+
const _config_5 = resolveHostHeaderConfig(_config_4);
|
|
265
|
+
const _config_6 = resolveEndpointConfig(_config_5);
|
|
266
|
+
const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
|
|
267
|
+
const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
|
|
268
|
+
this.config = _config_8;
|
|
269
|
+
this.middlewareStack.use(getSchemaSerdePlugin(this.config));
|
|
270
|
+
this.middlewareStack.use(getUserAgentPlugin(this.config));
|
|
271
|
+
this.middlewareStack.use(getRetryPlugin(this.config));
|
|
272
|
+
this.middlewareStack.use(getContentLengthPlugin(this.config));
|
|
273
|
+
this.middlewareStack.use(getHostHeaderPlugin(this.config));
|
|
274
|
+
this.middlewareStack.use(getLoggerPlugin(this.config));
|
|
275
|
+
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
|
|
276
|
+
this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
|
|
277
|
+
httpAuthSchemeParametersProvider: defaultSTSHttpAuthSchemeParametersProvider,
|
|
278
|
+
identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({
|
|
279
|
+
"aws.auth#sigv4": config.credentials,
|
|
280
|
+
}),
|
|
281
|
+
}));
|
|
282
|
+
this.middlewareStack.use(getHttpSigningPlugin(this.config));
|
|
283
|
+
}
|
|
284
|
+
destroy() {
|
|
285
|
+
super.destroy();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
let STSServiceException$1 = class STSServiceException extends ServiceException {
|
|
290
|
+
constructor(options) {
|
|
291
|
+
super(options);
|
|
292
|
+
Object.setPrototypeOf(this, STSServiceException.prototype);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
let ExpiredTokenException$1 = class ExpiredTokenException extends STSServiceException$1 {
|
|
297
|
+
name = "ExpiredTokenException";
|
|
298
|
+
$fault = "client";
|
|
299
|
+
constructor(opts) {
|
|
300
|
+
super({
|
|
301
|
+
name: "ExpiredTokenException",
|
|
302
|
+
$fault: "client",
|
|
303
|
+
...opts,
|
|
304
|
+
});
|
|
305
|
+
Object.setPrototypeOf(this, ExpiredTokenException.prototype);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
let MalformedPolicyDocumentException$1 = class MalformedPolicyDocumentException extends STSServiceException$1 {
|
|
309
|
+
name = "MalformedPolicyDocumentException";
|
|
310
|
+
$fault = "client";
|
|
311
|
+
constructor(opts) {
|
|
312
|
+
super({
|
|
313
|
+
name: "MalformedPolicyDocumentException",
|
|
314
|
+
$fault: "client",
|
|
315
|
+
...opts,
|
|
316
|
+
});
|
|
317
|
+
Object.setPrototypeOf(this, MalformedPolicyDocumentException.prototype);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
let PackedPolicyTooLargeException$1 = class PackedPolicyTooLargeException extends STSServiceException$1 {
|
|
321
|
+
name = "PackedPolicyTooLargeException";
|
|
322
|
+
$fault = "client";
|
|
323
|
+
constructor(opts) {
|
|
324
|
+
super({
|
|
325
|
+
name: "PackedPolicyTooLargeException",
|
|
326
|
+
$fault: "client",
|
|
327
|
+
...opts,
|
|
328
|
+
});
|
|
329
|
+
Object.setPrototypeOf(this, PackedPolicyTooLargeException.prototype);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
let RegionDisabledException$1 = class RegionDisabledException extends STSServiceException$1 {
|
|
333
|
+
name = "RegionDisabledException";
|
|
334
|
+
$fault = "client";
|
|
335
|
+
constructor(opts) {
|
|
336
|
+
super({
|
|
337
|
+
name: "RegionDisabledException",
|
|
338
|
+
$fault: "client",
|
|
339
|
+
...opts,
|
|
340
|
+
});
|
|
341
|
+
Object.setPrototypeOf(this, RegionDisabledException.prototype);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
let IDPRejectedClaimException$1 = class IDPRejectedClaimException extends STSServiceException$1 {
|
|
345
|
+
name = "IDPRejectedClaimException";
|
|
346
|
+
$fault = "client";
|
|
347
|
+
constructor(opts) {
|
|
348
|
+
super({
|
|
349
|
+
name: "IDPRejectedClaimException",
|
|
350
|
+
$fault: "client",
|
|
351
|
+
...opts,
|
|
352
|
+
});
|
|
353
|
+
Object.setPrototypeOf(this, IDPRejectedClaimException.prototype);
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
let InvalidIdentityTokenException$1 = class InvalidIdentityTokenException extends STSServiceException$1 {
|
|
357
|
+
name = "InvalidIdentityTokenException";
|
|
358
|
+
$fault = "client";
|
|
359
|
+
constructor(opts) {
|
|
360
|
+
super({
|
|
361
|
+
name: "InvalidIdentityTokenException",
|
|
362
|
+
$fault: "client",
|
|
363
|
+
...opts,
|
|
364
|
+
});
|
|
365
|
+
Object.setPrototypeOf(this, InvalidIdentityTokenException.prototype);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
let IDPCommunicationErrorException$1 = class IDPCommunicationErrorException extends STSServiceException$1 {
|
|
369
|
+
name = "IDPCommunicationErrorException";
|
|
370
|
+
$fault = "client";
|
|
371
|
+
constructor(opts) {
|
|
372
|
+
super({
|
|
373
|
+
name: "IDPCommunicationErrorException",
|
|
374
|
+
$fault: "client",
|
|
375
|
+
...opts,
|
|
376
|
+
});
|
|
377
|
+
Object.setPrototypeOf(this, IDPCommunicationErrorException.prototype);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
const _A = "Arn";
|
|
382
|
+
const _AKI = "AccessKeyId";
|
|
383
|
+
const _AR = "AssumeRole";
|
|
384
|
+
const _ARI = "AssumedRoleId";
|
|
385
|
+
const _ARR = "AssumeRoleRequest";
|
|
386
|
+
const _ARRs = "AssumeRoleResponse";
|
|
387
|
+
const _ARU = "AssumedRoleUser";
|
|
388
|
+
const _ARWWI = "AssumeRoleWithWebIdentity";
|
|
389
|
+
const _ARWWIR = "AssumeRoleWithWebIdentityRequest";
|
|
390
|
+
const _ARWWIRs = "AssumeRoleWithWebIdentityResponse";
|
|
391
|
+
const _Au = "Audience";
|
|
392
|
+
const _C = "Credentials";
|
|
393
|
+
const _CA = "ContextAssertion";
|
|
394
|
+
const _DS = "DurationSeconds";
|
|
395
|
+
const _E = "Expiration";
|
|
396
|
+
const _EI = "ExternalId";
|
|
397
|
+
const _ETE = "ExpiredTokenException";
|
|
398
|
+
const _IDPCEE = "IDPCommunicationErrorException";
|
|
399
|
+
const _IDPRCE = "IDPRejectedClaimException";
|
|
400
|
+
const _IITE = "InvalidIdentityTokenException";
|
|
401
|
+
const _K = "Key";
|
|
402
|
+
const _MPDE = "MalformedPolicyDocumentException";
|
|
403
|
+
const _P = "Policy";
|
|
404
|
+
const _PA = "PolicyArns";
|
|
405
|
+
const _PAr = "ProviderArn";
|
|
406
|
+
const _PC = "ProvidedContexts";
|
|
407
|
+
const _PCLT = "ProvidedContextsListType";
|
|
408
|
+
const _PCr = "ProvidedContext";
|
|
409
|
+
const _PDT = "PolicyDescriptorType";
|
|
410
|
+
const _PI = "ProviderId";
|
|
411
|
+
const _PPS = "PackedPolicySize";
|
|
412
|
+
const _PPTLE = "PackedPolicyTooLargeException";
|
|
413
|
+
const _Pr = "Provider";
|
|
414
|
+
const _RA = "RoleArn";
|
|
415
|
+
const _RDE = "RegionDisabledException";
|
|
416
|
+
const _RSN = "RoleSessionName";
|
|
417
|
+
const _SAK = "SecretAccessKey";
|
|
418
|
+
const _SFWIT = "SubjectFromWebIdentityToken";
|
|
419
|
+
const _SI = "SourceIdentity";
|
|
420
|
+
const _SN = "SerialNumber";
|
|
421
|
+
const _ST = "SessionToken";
|
|
422
|
+
const _T = "Tags";
|
|
423
|
+
const _TC = "TokenCode";
|
|
424
|
+
const _TTK = "TransitiveTagKeys";
|
|
425
|
+
const _Ta = "Tag";
|
|
426
|
+
const _V = "Value";
|
|
427
|
+
const _WIT = "WebIdentityToken";
|
|
428
|
+
const _a = "arn";
|
|
429
|
+
const _aKST = "accessKeySecretType";
|
|
430
|
+
const _aQE = "awsQueryError";
|
|
431
|
+
const _c = "client";
|
|
432
|
+
const _cTT = "clientTokenType";
|
|
433
|
+
const _e = "error";
|
|
434
|
+
const _hE = "httpError";
|
|
435
|
+
const _m = "message";
|
|
436
|
+
const _pDLT = "policyDescriptorListType";
|
|
437
|
+
const _s = "smithy.ts.sdk.synthetic.com.amazonaws.sts";
|
|
438
|
+
const _tLT = "tagListType";
|
|
439
|
+
const n0 = "com.amazonaws.sts";
|
|
440
|
+
var accessKeySecretType = [0, n0, _aKST, 8, 0];
|
|
441
|
+
var clientTokenType = [0, n0, _cTT, 8, 0];
|
|
442
|
+
var AssumedRoleUser = [3, n0, _ARU, 0, [_ARI, _A], [0, 0]];
|
|
443
|
+
var AssumeRoleRequest = [
|
|
444
|
+
3,
|
|
445
|
+
n0,
|
|
446
|
+
_ARR,
|
|
447
|
+
0,
|
|
448
|
+
[_RA, _RSN, _PA, _P, _DS, _T, _TTK, _EI, _SN, _TC, _SI, _PC],
|
|
449
|
+
[0, 0, () => policyDescriptorListType, 0, 1, () => tagListType, 64 | 0, 0, 0, 0, 0, () => ProvidedContextsListType],
|
|
450
|
+
];
|
|
451
|
+
var AssumeRoleResponse = [
|
|
452
|
+
3,
|
|
453
|
+
n0,
|
|
454
|
+
_ARRs,
|
|
455
|
+
0,
|
|
456
|
+
[_C, _ARU, _PPS, _SI],
|
|
457
|
+
[[() => Credentials, 0], () => AssumedRoleUser, 1, 0],
|
|
458
|
+
];
|
|
459
|
+
var AssumeRoleWithWebIdentityRequest = [
|
|
460
|
+
3,
|
|
461
|
+
n0,
|
|
462
|
+
_ARWWIR,
|
|
463
|
+
0,
|
|
464
|
+
[_RA, _RSN, _WIT, _PI, _PA, _P, _DS],
|
|
465
|
+
[0, 0, [() => clientTokenType, 0], 0, () => policyDescriptorListType, 0, 1],
|
|
466
|
+
];
|
|
467
|
+
var AssumeRoleWithWebIdentityResponse = [
|
|
468
|
+
3,
|
|
469
|
+
n0,
|
|
470
|
+
_ARWWIRs,
|
|
471
|
+
0,
|
|
472
|
+
[_C, _SFWIT, _ARU, _PPS, _Pr, _Au, _SI],
|
|
473
|
+
[[() => Credentials, 0], 0, () => AssumedRoleUser, 1, 0, 0, 0],
|
|
474
|
+
];
|
|
475
|
+
var Credentials = [
|
|
476
|
+
3,
|
|
477
|
+
n0,
|
|
478
|
+
_C,
|
|
479
|
+
0,
|
|
480
|
+
[_AKI, _SAK, _ST, _E],
|
|
481
|
+
[0, [() => accessKeySecretType, 0], 0, 4],
|
|
482
|
+
];
|
|
483
|
+
var ExpiredTokenException = [
|
|
484
|
+
-3,
|
|
485
|
+
n0,
|
|
486
|
+
_ETE,
|
|
487
|
+
{ [_e]: _c, [_hE]: 400, [_aQE]: [`ExpiredTokenException`, 400] },
|
|
488
|
+
[_m],
|
|
489
|
+
[0],
|
|
490
|
+
];
|
|
491
|
+
TypeRegistry.for(n0).registerError(ExpiredTokenException, ExpiredTokenException$1);
|
|
492
|
+
var IDPCommunicationErrorException = [
|
|
493
|
+
-3,
|
|
494
|
+
n0,
|
|
495
|
+
_IDPCEE,
|
|
496
|
+
{ [_e]: _c, [_hE]: 400, [_aQE]: [`IDPCommunicationError`, 400] },
|
|
497
|
+
[_m],
|
|
498
|
+
[0],
|
|
499
|
+
];
|
|
500
|
+
TypeRegistry.for(n0).registerError(IDPCommunicationErrorException, IDPCommunicationErrorException$1);
|
|
501
|
+
var IDPRejectedClaimException = [
|
|
502
|
+
-3,
|
|
503
|
+
n0,
|
|
504
|
+
_IDPRCE,
|
|
505
|
+
{ [_e]: _c, [_hE]: 403, [_aQE]: [`IDPRejectedClaim`, 403] },
|
|
506
|
+
[_m],
|
|
507
|
+
[0],
|
|
508
|
+
];
|
|
509
|
+
TypeRegistry.for(n0).registerError(IDPRejectedClaimException, IDPRejectedClaimException$1);
|
|
510
|
+
var InvalidIdentityTokenException = [
|
|
511
|
+
-3,
|
|
512
|
+
n0,
|
|
513
|
+
_IITE,
|
|
514
|
+
{ [_e]: _c, [_hE]: 400, [_aQE]: [`InvalidIdentityToken`, 400] },
|
|
515
|
+
[_m],
|
|
516
|
+
[0],
|
|
517
|
+
];
|
|
518
|
+
TypeRegistry.for(n0).registerError(InvalidIdentityTokenException, InvalidIdentityTokenException$1);
|
|
519
|
+
var MalformedPolicyDocumentException = [
|
|
520
|
+
-3,
|
|
521
|
+
n0,
|
|
522
|
+
_MPDE,
|
|
523
|
+
{ [_e]: _c, [_hE]: 400, [_aQE]: [`MalformedPolicyDocument`, 400] },
|
|
524
|
+
[_m],
|
|
525
|
+
[0],
|
|
526
|
+
];
|
|
527
|
+
TypeRegistry.for(n0).registerError(MalformedPolicyDocumentException, MalformedPolicyDocumentException$1);
|
|
528
|
+
var PackedPolicyTooLargeException = [
|
|
529
|
+
-3,
|
|
530
|
+
n0,
|
|
531
|
+
_PPTLE,
|
|
532
|
+
{ [_e]: _c, [_hE]: 400, [_aQE]: [`PackedPolicyTooLarge`, 400] },
|
|
533
|
+
[_m],
|
|
534
|
+
[0],
|
|
535
|
+
];
|
|
536
|
+
TypeRegistry.for(n0).registerError(PackedPolicyTooLargeException, PackedPolicyTooLargeException$1);
|
|
537
|
+
var PolicyDescriptorType = [3, n0, _PDT, 0, [_a], [0]];
|
|
538
|
+
var ProvidedContext = [3, n0, _PCr, 0, [_PAr, _CA], [0, 0]];
|
|
539
|
+
var RegionDisabledException = [
|
|
540
|
+
-3,
|
|
541
|
+
n0,
|
|
542
|
+
_RDE,
|
|
543
|
+
{ [_e]: _c, [_hE]: 403, [_aQE]: [`RegionDisabledException`, 403] },
|
|
544
|
+
[_m],
|
|
545
|
+
[0],
|
|
546
|
+
];
|
|
547
|
+
TypeRegistry.for(n0).registerError(RegionDisabledException, RegionDisabledException$1);
|
|
548
|
+
var Tag = [3, n0, _Ta, 0, [_K, _V], [0, 0]];
|
|
549
|
+
var STSServiceException = [-3, _s, "STSServiceException", 0, [], []];
|
|
550
|
+
TypeRegistry.for(_s).registerError(STSServiceException, STSServiceException$1);
|
|
551
|
+
var policyDescriptorListType = [1, n0, _pDLT, 0, () => PolicyDescriptorType];
|
|
552
|
+
var ProvidedContextsListType = [1, n0, _PCLT, 0, () => ProvidedContext];
|
|
553
|
+
var tagListType = [1, n0, _tLT, 0, () => Tag];
|
|
554
|
+
var AssumeRole = [9, n0, _AR, 0, () => AssumeRoleRequest, () => AssumeRoleResponse];
|
|
555
|
+
var AssumeRoleWithWebIdentity = [
|
|
556
|
+
9,
|
|
557
|
+
n0,
|
|
558
|
+
_ARWWI,
|
|
559
|
+
0,
|
|
560
|
+
() => AssumeRoleWithWebIdentityRequest,
|
|
561
|
+
() => AssumeRoleWithWebIdentityResponse,
|
|
562
|
+
];
|
|
563
|
+
|
|
564
|
+
class AssumeRoleCommand extends Command
|
|
565
|
+
.classBuilder()
|
|
566
|
+
.ep(commonParams)
|
|
567
|
+
.m(function (Command, cs, config, o) {
|
|
568
|
+
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
|
|
569
|
+
})
|
|
570
|
+
.s("AWSSecurityTokenServiceV20110615", "AssumeRole", {})
|
|
571
|
+
.n("STSClient", "AssumeRoleCommand")
|
|
572
|
+
.sc(AssumeRole)
|
|
573
|
+
.build() {
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
class AssumeRoleWithWebIdentityCommand extends Command
|
|
577
|
+
.classBuilder()
|
|
578
|
+
.ep(commonParams)
|
|
579
|
+
.m(function (Command, cs, config, o) {
|
|
580
|
+
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
|
|
581
|
+
})
|
|
582
|
+
.s("AWSSecurityTokenServiceV20110615", "AssumeRoleWithWebIdentity", {})
|
|
583
|
+
.n("STSClient", "AssumeRoleWithWebIdentityCommand")
|
|
584
|
+
.sc(AssumeRoleWithWebIdentity)
|
|
585
|
+
.build() {
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const getAccountIdFromAssumedRoleUser = (assumedRoleUser) => {
|
|
589
|
+
if (typeof assumedRoleUser?.Arn === "string") {
|
|
590
|
+
const arnComponents = assumedRoleUser.Arn.split(":");
|
|
591
|
+
if (arnComponents.length > 4 && arnComponents[4] !== "") {
|
|
592
|
+
return arnComponents[4];
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return undefined;
|
|
596
|
+
};
|
|
597
|
+
const resolveRegion = async (_region, _parentRegion, credentialProviderLogger, loaderConfig = {}) => {
|
|
598
|
+
const region = typeof _region === "function" ? await _region() : _region;
|
|
599
|
+
const parentRegion = typeof _parentRegion === "function" ? await _parentRegion() : _parentRegion;
|
|
600
|
+
const stsDefaultRegion = await stsRegionDefaultResolver(loaderConfig)();
|
|
601
|
+
credentialProviderLogger?.debug?.("@aws-sdk/client-sts::resolveRegion", "accepting first of:", `${region} (credential provider clientConfig)`, `${parentRegion} (contextual client)`, `${stsDefaultRegion} (STS default: AWS_REGION, profile region, or us-east-1)`);
|
|
602
|
+
return region ?? parentRegion ?? stsDefaultRegion;
|
|
603
|
+
};
|
|
604
|
+
const getDefaultRoleAssumer$1 = (stsOptions, STSClient) => {
|
|
605
|
+
let stsClient;
|
|
606
|
+
let closureSourceCreds;
|
|
607
|
+
return async (sourceCreds, params) => {
|
|
608
|
+
closureSourceCreds = sourceCreds;
|
|
609
|
+
if (!stsClient) {
|
|
610
|
+
const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId, } = stsOptions;
|
|
611
|
+
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
|
|
612
|
+
logger,
|
|
613
|
+
profile,
|
|
614
|
+
});
|
|
615
|
+
const isCompatibleRequestHandler = !isH2(requestHandler);
|
|
616
|
+
stsClient = new STSClient({
|
|
617
|
+
...stsOptions,
|
|
618
|
+
userAgentAppId,
|
|
619
|
+
profile,
|
|
620
|
+
credentialDefaultProvider: () => async () => closureSourceCreds,
|
|
621
|
+
region: resolvedRegion,
|
|
622
|
+
requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
|
|
623
|
+
logger: logger,
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
const { Credentials, AssumedRoleUser } = await stsClient.send(new AssumeRoleCommand(params));
|
|
627
|
+
if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
|
|
628
|
+
throw new Error(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`);
|
|
629
|
+
}
|
|
630
|
+
const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser);
|
|
631
|
+
const credentials = {
|
|
632
|
+
accessKeyId: Credentials.AccessKeyId,
|
|
633
|
+
secretAccessKey: Credentials.SecretAccessKey,
|
|
634
|
+
sessionToken: Credentials.SessionToken,
|
|
635
|
+
expiration: Credentials.Expiration,
|
|
636
|
+
...(Credentials.CredentialScope && { credentialScope: Credentials.CredentialScope }),
|
|
637
|
+
...(accountId && { accountId }),
|
|
638
|
+
};
|
|
639
|
+
setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE", "i");
|
|
640
|
+
return credentials;
|
|
641
|
+
};
|
|
642
|
+
};
|
|
643
|
+
const getDefaultRoleAssumerWithWebIdentity$1 = (stsOptions, STSClient) => {
|
|
644
|
+
let stsClient;
|
|
645
|
+
return async (params) => {
|
|
646
|
+
if (!stsClient) {
|
|
647
|
+
const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId, } = stsOptions;
|
|
648
|
+
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
|
|
649
|
+
logger,
|
|
650
|
+
profile,
|
|
651
|
+
});
|
|
652
|
+
const isCompatibleRequestHandler = !isH2(requestHandler);
|
|
653
|
+
stsClient = new STSClient({
|
|
654
|
+
...stsOptions,
|
|
655
|
+
userAgentAppId,
|
|
656
|
+
profile,
|
|
657
|
+
region: resolvedRegion,
|
|
658
|
+
requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
|
|
659
|
+
logger: logger,
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
const { Credentials, AssumedRoleUser } = await stsClient.send(new AssumeRoleWithWebIdentityCommand(params));
|
|
663
|
+
if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
|
|
664
|
+
throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${params.RoleArn}`);
|
|
665
|
+
}
|
|
666
|
+
const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser);
|
|
667
|
+
const credentials = {
|
|
668
|
+
accessKeyId: Credentials.AccessKeyId,
|
|
669
|
+
secretAccessKey: Credentials.SecretAccessKey,
|
|
670
|
+
sessionToken: Credentials.SessionToken,
|
|
671
|
+
expiration: Credentials.Expiration,
|
|
672
|
+
...(Credentials.CredentialScope && { credentialScope: Credentials.CredentialScope }),
|
|
673
|
+
...(accountId && { accountId }),
|
|
674
|
+
};
|
|
675
|
+
if (accountId) {
|
|
676
|
+
setCredentialFeature(credentials, "RESOLVED_ACCOUNT_ID", "T");
|
|
677
|
+
}
|
|
678
|
+
setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE_WEB_ID", "k");
|
|
679
|
+
return credentials;
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
const isH2 = (requestHandler) => {
|
|
683
|
+
return requestHandler?.metadata?.handlerProtocol === "h2";
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
const getCustomizableStsClientCtor = (baseCtor, customizations) => {
|
|
687
|
+
if (!customizations)
|
|
688
|
+
return baseCtor;
|
|
689
|
+
else
|
|
690
|
+
return class CustomizableSTSClient extends baseCtor {
|
|
691
|
+
constructor(config) {
|
|
692
|
+
super(config);
|
|
693
|
+
for (const customization of customizations) {
|
|
694
|
+
this.middlewareStack.use(customization);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
};
|
|
699
|
+
const getDefaultRoleAssumer = (stsOptions = {}, stsPlugins) => getDefaultRoleAssumer$1(stsOptions, getCustomizableStsClientCtor(STSClient, stsPlugins));
|
|
700
|
+
const getDefaultRoleAssumerWithWebIdentity = (stsOptions = {}, stsPlugins) => getDefaultRoleAssumerWithWebIdentity$1(stsOptions, getCustomizableStsClientCtor(STSClient, stsPlugins));
|
|
701
|
+
|
|
702
|
+
export { Command as $Command, AssumeRoleCommand, AssumeRoleWithWebIdentityCommand, ExpiredTokenException$1 as ExpiredTokenException, IDPCommunicationErrorException$1 as IDPCommunicationErrorException, IDPRejectedClaimException$1 as IDPRejectedClaimException, InvalidIdentityTokenException$1 as InvalidIdentityTokenException, MalformedPolicyDocumentException$1 as MalformedPolicyDocumentException, PackedPolicyTooLargeException$1 as PackedPolicyTooLargeException, RegionDisabledException$1 as RegionDisabledException, STSClient, STSServiceException$1 as STSServiceException, Client as __Client, getDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity };
|