Backend half
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
import { createAggregatedClient } from "@smithy/smithy-client";
|
||||
import { CreateTokenCommand } from "./commands/CreateTokenCommand";
|
||||
import { SSOOIDCClient } from "./SSOOIDCClient";
|
||||
const commands = {
|
||||
CreateTokenCommand,
|
||||
};
|
||||
export class SSOOIDC extends SSOOIDCClient {
|
||||
}
|
||||
createAggregatedClient(commands, SSOOIDC);
|
||||
Generated
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
|
||||
import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
|
||||
import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
|
||||
import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
|
||||
import { resolveRegionConfig } from "@smithy/config-resolver";
|
||||
import { DefaultIdentityProviderConfig, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, } from "@smithy/core";
|
||||
import { getContentLengthPlugin } from "@smithy/middleware-content-length";
|
||||
import { resolveEndpointConfig } from "@smithy/middleware-endpoint";
|
||||
import { getRetryPlugin, resolveRetryConfig } from "@smithy/middleware-retry";
|
||||
import { Client as __Client, } from "@smithy/smithy-client";
|
||||
import { defaultSSOOIDCHttpAuthSchemeParametersProvider, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider";
|
||||
import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
|
||||
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
|
||||
import { resolveRuntimeExtensions } from "./runtimeExtensions";
|
||||
export { __Client };
|
||||
export class SSOOIDCClient extends __Client {
|
||||
config;
|
||||
constructor(...[configuration]) {
|
||||
const _config_0 = __getRuntimeConfig(configuration || {});
|
||||
super(_config_0);
|
||||
this.initConfig = _config_0;
|
||||
const _config_1 = resolveClientEndpointParameters(_config_0);
|
||||
const _config_2 = resolveUserAgentConfig(_config_1);
|
||||
const _config_3 = resolveRetryConfig(_config_2);
|
||||
const _config_4 = resolveRegionConfig(_config_3);
|
||||
const _config_5 = resolveHostHeaderConfig(_config_4);
|
||||
const _config_6 = resolveEndpointConfig(_config_5);
|
||||
const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
|
||||
const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
|
||||
this.config = _config_8;
|
||||
this.middlewareStack.use(getUserAgentPlugin(this.config));
|
||||
this.middlewareStack.use(getRetryPlugin(this.config));
|
||||
this.middlewareStack.use(getContentLengthPlugin(this.config));
|
||||
this.middlewareStack.use(getHostHeaderPlugin(this.config));
|
||||
this.middlewareStack.use(getLoggerPlugin(this.config));
|
||||
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
|
||||
this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
|
||||
httpAuthSchemeParametersProvider: defaultSSOOIDCHttpAuthSchemeParametersProvider,
|
||||
identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({
|
||||
"aws.auth#sigv4": config.credentials,
|
||||
}),
|
||||
}));
|
||||
this.middlewareStack.use(getHttpSigningPlugin(this.config));
|
||||
}
|
||||
destroy() {
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
||||
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
||||
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
||||
let _credentials = runtimeConfig.credentials;
|
||||
return {
|
||||
setHttpAuthScheme(httpAuthScheme) {
|
||||
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
||||
if (index === -1) {
|
||||
_httpAuthSchemes.push(httpAuthScheme);
|
||||
}
|
||||
else {
|
||||
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
||||
}
|
||||
},
|
||||
httpAuthSchemes() {
|
||||
return _httpAuthSchemes;
|
||||
},
|
||||
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
||||
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
||||
},
|
||||
httpAuthSchemeProvider() {
|
||||
return _httpAuthSchemeProvider;
|
||||
},
|
||||
setCredentials(credentials) {
|
||||
_credentials = credentials;
|
||||
},
|
||||
credentials() {
|
||||
return _credentials;
|
||||
},
|
||||
};
|
||||
};
|
||||
export const resolveHttpAuthRuntimeConfig = (config) => {
|
||||
return {
|
||||
httpAuthSchemes: config.httpAuthSchemes(),
|
||||
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
||||
credentials: config.credentials(),
|
||||
};
|
||||
};
|
||||
Generated
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
import { resolveAwsSdkSigV4Config, } from "@aws-sdk/core";
|
||||
import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
|
||||
export const defaultSSOOIDCHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
||||
return {
|
||||
operation: getSmithyContext(context).operation,
|
||||
region: (await normalizeProvider(config.region)()) ||
|
||||
(() => {
|
||||
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
||||
})(),
|
||||
};
|
||||
};
|
||||
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "aws.auth#sigv4",
|
||||
signingProperties: {
|
||||
name: "sso-oauth",
|
||||
region: authParameters.region,
|
||||
},
|
||||
propertiesExtractor: (config, context) => ({
|
||||
signingProperties: {
|
||||
config,
|
||||
context,
|
||||
},
|
||||
}),
|
||||
};
|
||||
}
|
||||
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "smithy.api#noAuth",
|
||||
};
|
||||
}
|
||||
export const defaultSSOOIDCHttpAuthSchemeProvider = (authParameters) => {
|
||||
const options = [];
|
||||
switch (authParameters.operation) {
|
||||
case "CreateToken": {
|
||||
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
||||
export const resolveHttpAuthSchemeConfig = (config) => {
|
||||
const config_0 = resolveAwsSdkSigV4Config(config);
|
||||
return Object.assign(config_0, {
|
||||
authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),
|
||||
});
|
||||
};
|
||||
Generated
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
||||
import { getSerdePlugin } from "@smithy/middleware-serde";
|
||||
import { Command as $Command } from "@smithy/smithy-client";
|
||||
import { commonParams } from "../endpoint/EndpointParameters";
|
||||
import { CreateTokenRequestFilterSensitiveLog, CreateTokenResponseFilterSensitiveLog, } from "../models/models_0";
|
||||
import { de_CreateTokenCommand, se_CreateTokenCommand } from "../protocols/Aws_restJson1";
|
||||
export { $Command };
|
||||
export class CreateTokenCommand extends $Command
|
||||
.classBuilder()
|
||||
.ep(commonParams)
|
||||
.m(function (Command, cs, config, o) {
|
||||
return [
|
||||
getSerdePlugin(config, this.serialize, this.deserialize),
|
||||
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
|
||||
];
|
||||
})
|
||||
.s("AWSSSOOIDCService", "CreateToken", {})
|
||||
.n("SSOOIDCClient", "CreateTokenCommand")
|
||||
.f(CreateTokenRequestFilterSensitiveLog, CreateTokenResponseFilterSensitiveLog)
|
||||
.ser(se_CreateTokenCommand)
|
||||
.de(de_CreateTokenCommand)
|
||||
.build() {
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export * from "./CreateTokenCommand";
|
||||
Generated
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
export const resolveClientEndpointParameters = (options) => {
|
||||
return Object.assign(options, {
|
||||
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
|
||||
useFipsEndpoint: options.useFipsEndpoint ?? false,
|
||||
defaultSigningName: "sso-oauth",
|
||||
});
|
||||
};
|
||||
export const commonParams = {
|
||||
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
||||
Endpoint: { type: "builtInParams", name: "endpoint" },
|
||||
Region: { type: "builtInParams", name: "region" },
|
||||
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
||||
};
|
||||
Generated
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
import { awsEndpointFunctions } from "@aws-sdk/util-endpoints";
|
||||
import { customEndpointFunctions, EndpointCache, resolveEndpoint } from "@smithy/util-endpoints";
|
||||
import { ruleSet } from "./ruleset";
|
||||
const cache = new EndpointCache({
|
||||
size: 50,
|
||||
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
|
||||
});
|
||||
export const defaultEndpointResolver = (endpointParams, context = {}) => {
|
||||
return cache.get(endpointParams, () => resolveEndpoint(ruleSet, {
|
||||
endpointParams: endpointParams,
|
||||
logger: context.logger,
|
||||
}));
|
||||
};
|
||||
customEndpointFunctions.aws = awsEndpointFunctions;
|
||||
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
const u = "required", v = "fn", w = "argv", x = "ref";
|
||||
const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = "getAttr", i = { [u]: false, "type": "String" }, j = { [u]: true, "default": false, "type": "Boolean" }, k = { [x]: "Endpoint" }, l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }, m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }, n = {}, o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }, p = { [x]: g }, q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }, r = [l], s = [m], t = [{ [x]: "Region" }];
|
||||
const _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b, [w]: [k] }], rules: [{ conditions: r, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: s, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }, { conditions: [{ [v]: b, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [l, m], rules: [{ conditions: [{ [v]: c, [w]: [a, o] }, q], rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: r, rules: [{ conditions: [{ [v]: c, [w]: [o, a] }], rules: [{ conditions: [{ [v]: "stringEquals", [w]: [{ [v]: h, [w]: [p, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://oidc.{Region}.amazonaws.com", properties: n, headers: n }, type: e }, { endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: s, rules: [{ conditions: [q], rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] };
|
||||
export const ruleSet = _data;
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export * from "./SSOOIDCClient";
|
||||
export * from "./SSOOIDC";
|
||||
export * from "./commands";
|
||||
export * from "./models";
|
||||
export { SSOOIDCServiceException } from "./models/SSOOIDCServiceException";
|
||||
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import { ServiceException as __ServiceException, } from "@smithy/smithy-client";
|
||||
export { __ServiceException };
|
||||
export class SSOOIDCServiceException extends __ServiceException {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
Object.setPrototypeOf(this, SSOOIDCServiceException.prototype);
|
||||
}
|
||||
}
|
||||
SerpentRace_Backend/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/models/index.js
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export * from "./models_0";
|
||||
Generated
Vendored
+190
@@ -0,0 +1,190 @@
|
||||
import { SENSITIVE_STRING } from "@smithy/smithy-client";
|
||||
import { SSOOIDCServiceException as __BaseException } from "./SSOOIDCServiceException";
|
||||
export class AccessDeniedException extends __BaseException {
|
||||
name = "AccessDeniedException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "AccessDeniedException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, AccessDeniedException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
export class AuthorizationPendingException extends __BaseException {
|
||||
name = "AuthorizationPendingException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "AuthorizationPendingException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, AuthorizationPendingException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
export const CreateTokenRequestFilterSensitiveLog = (obj) => ({
|
||||
...obj,
|
||||
...(obj.clientSecret && { clientSecret: SENSITIVE_STRING }),
|
||||
...(obj.refreshToken && { refreshToken: SENSITIVE_STRING }),
|
||||
...(obj.codeVerifier && { codeVerifier: SENSITIVE_STRING }),
|
||||
});
|
||||
export const CreateTokenResponseFilterSensitiveLog = (obj) => ({
|
||||
...obj,
|
||||
...(obj.accessToken && { accessToken: SENSITIVE_STRING }),
|
||||
...(obj.refreshToken && { refreshToken: SENSITIVE_STRING }),
|
||||
...(obj.idToken && { idToken: SENSITIVE_STRING }),
|
||||
});
|
||||
export class ExpiredTokenException extends __BaseException {
|
||||
name = "ExpiredTokenException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "ExpiredTokenException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, ExpiredTokenException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
export class InternalServerException extends __BaseException {
|
||||
name = "InternalServerException";
|
||||
$fault = "server";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InternalServerException",
|
||||
$fault: "server",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InternalServerException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
export class InvalidClientException extends __BaseException {
|
||||
name = "InvalidClientException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidClientException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidClientException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
export class InvalidGrantException extends __BaseException {
|
||||
name = "InvalidGrantException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidGrantException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidGrantException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
export class InvalidRequestException extends __BaseException {
|
||||
name = "InvalidRequestException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidRequestException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidRequestException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
export class InvalidScopeException extends __BaseException {
|
||||
name = "InvalidScopeException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidScopeException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidScopeException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
export class SlowDownException extends __BaseException {
|
||||
name = "SlowDownException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "SlowDownException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, SlowDownException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
export class UnauthorizedClientException extends __BaseException {
|
||||
name = "UnauthorizedClientException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "UnauthorizedClientException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, UnauthorizedClientException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
export class UnsupportedGrantTypeException extends __BaseException {
|
||||
name = "UnsupportedGrantTypeException";
|
||||
$fault = "client";
|
||||
error;
|
||||
error_description;
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "UnsupportedGrantTypeException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, UnsupportedGrantTypeException.prototype);
|
||||
this.error = opts.error;
|
||||
this.error_description = opts.error_description;
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+255
@@ -0,0 +1,255 @@
|
||||
import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
|
||||
import { requestBuilder as rb } from "@smithy/core";
|
||||
import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, take, withBaseException, } from "@smithy/smithy-client";
|
||||
import { AccessDeniedException, AuthorizationPendingException, ExpiredTokenException, InternalServerException, InvalidClientException, InvalidGrantException, InvalidRequestException, InvalidScopeException, SlowDownException, UnauthorizedClientException, UnsupportedGrantTypeException, } from "../models/models_0";
|
||||
import { SSOOIDCServiceException as __BaseException } from "../models/SSOOIDCServiceException";
|
||||
export const se_CreateTokenCommand = async (input, context) => {
|
||||
const b = rb(input, context);
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
};
|
||||
b.bp("/token");
|
||||
let body;
|
||||
body = JSON.stringify(take(input, {
|
||||
clientId: [],
|
||||
clientSecret: [],
|
||||
code: [],
|
||||
codeVerifier: [],
|
||||
deviceCode: [],
|
||||
grantType: [],
|
||||
redirectUri: [],
|
||||
refreshToken: [],
|
||||
scope: (_) => _json(_),
|
||||
}));
|
||||
b.m("POST").h(headers).b(body);
|
||||
return b.build();
|
||||
};
|
||||
export const de_CreateTokenCommand = async (output, context) => {
|
||||
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
||||
return de_CommandError(output, context);
|
||||
}
|
||||
const contents = map({
|
||||
$metadata: deserializeMetadata(output),
|
||||
});
|
||||
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
||||
const doc = take(data, {
|
||||
accessToken: __expectString,
|
||||
expiresIn: __expectInt32,
|
||||
idToken: __expectString,
|
||||
refreshToken: __expectString,
|
||||
tokenType: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
return contents;
|
||||
};
|
||||
const de_CommandError = async (output, context) => {
|
||||
const parsedOutput = {
|
||||
...output,
|
||||
body: await parseErrorBody(output.body, context),
|
||||
};
|
||||
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
||||
switch (errorCode) {
|
||||
case "AccessDeniedException":
|
||||
case "com.amazonaws.ssooidc#AccessDeniedException":
|
||||
throw await de_AccessDeniedExceptionRes(parsedOutput, context);
|
||||
case "AuthorizationPendingException":
|
||||
case "com.amazonaws.ssooidc#AuthorizationPendingException":
|
||||
throw await de_AuthorizationPendingExceptionRes(parsedOutput, context);
|
||||
case "ExpiredTokenException":
|
||||
case "com.amazonaws.ssooidc#ExpiredTokenException":
|
||||
throw await de_ExpiredTokenExceptionRes(parsedOutput, context);
|
||||
case "InternalServerException":
|
||||
case "com.amazonaws.ssooidc#InternalServerException":
|
||||
throw await de_InternalServerExceptionRes(parsedOutput, context);
|
||||
case "InvalidClientException":
|
||||
case "com.amazonaws.ssooidc#InvalidClientException":
|
||||
throw await de_InvalidClientExceptionRes(parsedOutput, context);
|
||||
case "InvalidGrantException":
|
||||
case "com.amazonaws.ssooidc#InvalidGrantException":
|
||||
throw await de_InvalidGrantExceptionRes(parsedOutput, context);
|
||||
case "InvalidRequestException":
|
||||
case "com.amazonaws.ssooidc#InvalidRequestException":
|
||||
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
|
||||
case "InvalidScopeException":
|
||||
case "com.amazonaws.ssooidc#InvalidScopeException":
|
||||
throw await de_InvalidScopeExceptionRes(parsedOutput, context);
|
||||
case "SlowDownException":
|
||||
case "com.amazonaws.ssooidc#SlowDownException":
|
||||
throw await de_SlowDownExceptionRes(parsedOutput, context);
|
||||
case "UnauthorizedClientException":
|
||||
case "com.amazonaws.ssooidc#UnauthorizedClientException":
|
||||
throw await de_UnauthorizedClientExceptionRes(parsedOutput, context);
|
||||
case "UnsupportedGrantTypeException":
|
||||
case "com.amazonaws.ssooidc#UnsupportedGrantTypeException":
|
||||
throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context);
|
||||
default:
|
||||
const parsedBody = parsedOutput.body;
|
||||
return throwDefaultError({
|
||||
output,
|
||||
parsedBody,
|
||||
errorCode,
|
||||
});
|
||||
}
|
||||
};
|
||||
const throwDefaultError = withBaseException(__BaseException);
|
||||
const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new AccessDeniedException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new AuthorizationPendingException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new ExpiredTokenException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const de_InternalServerExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new InternalServerException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const de_InvalidClientExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new InvalidClientException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const de_InvalidGrantExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new InvalidGrantException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new InvalidRequestException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const de_InvalidScopeExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new InvalidScopeException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const de_SlowDownExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new SlowDownException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new UnauthorizedClientException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const de_UnsupportedGrantTypeExceptionRes = async (parsedOutput, context) => {
|
||||
const contents = map({});
|
||||
const data = parsedOutput.body;
|
||||
const doc = take(data, {
|
||||
error: __expectString,
|
||||
error_description: __expectString,
|
||||
});
|
||||
Object.assign(contents, doc);
|
||||
const exception = new UnsupportedGrantTypeException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...contents,
|
||||
});
|
||||
return __decorateServiceException(exception, parsedOutput.body);
|
||||
};
|
||||
const deserializeMetadata = (output) => ({
|
||||
httpStatusCode: output.statusCode,
|
||||
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
||||
extendedRequestId: output.headers["x-amz-id-2"],
|
||||
cfId: output.headers["x-amz-cf-id"],
|
||||
});
|
||||
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
||||
Generated
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
import packageInfo from "../../../package.json";
|
||||
import { Sha256 } from "@aws-crypto/sha256-browser";
|
||||
import { createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-browser";
|
||||
import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver";
|
||||
import { FetchHttpHandler as RequestHandler, streamCollector } from "@smithy/fetch-http-handler";
|
||||
import { invalidProvider } from "@smithy/invalid-dependency";
|
||||
import { calculateBodyLength } from "@smithy/util-body-length-browser";
|
||||
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@smithy/util-retry";
|
||||
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
||||
import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
|
||||
import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-browser";
|
||||
export const getRuntimeConfig = (config) => {
|
||||
const defaultsMode = resolveDefaultsModeConfig(config);
|
||||
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
||||
const clientSharedValues = getSharedRuntimeConfig(config);
|
||||
return {
|
||||
...clientSharedValues,
|
||||
...config,
|
||||
runtime: "browser",
|
||||
defaultsMode,
|
||||
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
||||
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
||||
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
||||
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
||||
region: config?.region ?? invalidProvider("Region is missing"),
|
||||
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
||||
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
|
||||
sha256: config?.sha256 ?? Sha256,
|
||||
streamCollector: config?.streamCollector ?? streamCollector,
|
||||
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
||||
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
|
||||
};
|
||||
};
|
||||
Generated
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
import packageInfo from "../../../package.json";
|
||||
import { NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
|
||||
import { NODE_APP_ID_CONFIG_OPTIONS, createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-node";
|
||||
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@smithy/config-resolver";
|
||||
import { Hash } from "@smithy/hash-node";
|
||||
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@smithy/middleware-retry";
|
||||
import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
|
||||
import { NodeHttpHandler as RequestHandler, streamCollector } from "@smithy/node-http-handler";
|
||||
import { calculateBodyLength } from "@smithy/util-body-length-node";
|
||||
import { DEFAULT_RETRY_MODE } from "@smithy/util-retry";
|
||||
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
||||
import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
|
||||
import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-node";
|
||||
import { emitWarningIfUnsupportedVersion } from "@smithy/smithy-client";
|
||||
export const getRuntimeConfig = (config) => {
|
||||
emitWarningIfUnsupportedVersion(process.version);
|
||||
const defaultsMode = resolveDefaultsModeConfig(config);
|
||||
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
||||
const clientSharedValues = getSharedRuntimeConfig(config);
|
||||
awsCheckVersion(process.version);
|
||||
const loaderConfig = {
|
||||
profile: config?.profile,
|
||||
logger: clientSharedValues.logger,
|
||||
};
|
||||
return {
|
||||
...clientSharedValues,
|
||||
...config,
|
||||
runtime: "node",
|
||||
defaultsMode,
|
||||
authSchemePreference: config?.authSchemePreference ?? loadNodeConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
||||
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
||||
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
||||
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
||||
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
||||
region: config?.region ??
|
||||
loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
||||
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
||||
retryMode: config?.retryMode ??
|
||||
loadNodeConfig({
|
||||
...NODE_RETRY_MODE_CONFIG_OPTIONS,
|
||||
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
|
||||
}, config),
|
||||
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
||||
streamCollector: config?.streamCollector ?? streamCollector,
|
||||
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
|
||||
};
|
||||
};
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
import { Sha256 } from "@aws-crypto/sha256-js";
|
||||
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
|
||||
export const getRuntimeConfig = (config) => {
|
||||
const browserDefaults = getBrowserRuntimeConfig(config);
|
||||
return {
|
||||
...browserDefaults,
|
||||
...config,
|
||||
runtime: "react-native",
|
||||
sha256: config?.sha256 ?? Sha256,
|
||||
};
|
||||
};
|
||||
Generated
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
import { AwsSdkSigV4Signer } from "@aws-sdk/core";
|
||||
import { NoAuthSigner } from "@smithy/core";
|
||||
import { NoOpLogger } from "@smithy/smithy-client";
|
||||
import { parseUrl } from "@smithy/url-parser";
|
||||
import { fromBase64, toBase64 } from "@smithy/util-base64";
|
||||
import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
|
||||
import { defaultSSOOIDCHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider";
|
||||
import { defaultEndpointResolver } from "./endpoint/endpointResolver";
|
||||
export const getRuntimeConfig = (config) => {
|
||||
return {
|
||||
apiVersion: "2019-06-10",
|
||||
base64Decoder: config?.base64Decoder ?? fromBase64,
|
||||
base64Encoder: config?.base64Encoder ?? toBase64,
|
||||
disableHostPrefix: config?.disableHostPrefix ?? false,
|
||||
endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
|
||||
extensions: config?.extensions ?? [],
|
||||
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSSOOIDCHttpAuthSchemeProvider,
|
||||
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
||||
{
|
||||
schemeId: "aws.auth#sigv4",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
||||
signer: new AwsSdkSigV4Signer(),
|
||||
},
|
||||
{
|
||||
schemeId: "smithy.api#noAuth",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
||||
signer: new NoAuthSigner(),
|
||||
},
|
||||
],
|
||||
logger: config?.logger ?? new NoOpLogger(),
|
||||
serviceId: config?.serviceId ?? "SSO OIDC",
|
||||
urlParser: config?.urlParser ?? parseUrl,
|
||||
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
||||
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
||||
};
|
||||
};
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
import { getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, } from "@aws-sdk/region-config-resolver";
|
||||
import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http";
|
||||
import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client";
|
||||
import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration";
|
||||
export const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
||||
const extensionConfiguration = Object.assign(getAwsRegionExtensionConfiguration(runtimeConfig), getDefaultExtensionConfiguration(runtimeConfig), getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
|
||||
extensions.forEach((extension) => extension.configure(extensionConfiguration));
|
||||
return Object.assign(runtimeConfig, resolveAwsRegionExtensionConfiguration(extensionConfiguration), resolveDefaultRuntimeConfig(extensionConfiguration), resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
|
||||
};
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
import { createAggregatedClient } from "@smithy/smithy-client";
|
||||
import { AssumeRoleCommand } from "./commands/AssumeRoleCommand";
|
||||
import { AssumeRoleWithWebIdentityCommand, } from "./commands/AssumeRoleWithWebIdentityCommand";
|
||||
import { STSClient } from "./STSClient";
|
||||
const commands = {
|
||||
AssumeRoleCommand,
|
||||
AssumeRoleWithWebIdentityCommand,
|
||||
};
|
||||
export class STS extends STSClient {
|
||||
}
|
||||
createAggregatedClient(commands, STS);
|
||||
Generated
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
|
||||
import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
|
||||
import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
|
||||
import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
|
||||
import { resolveRegionConfig } from "@smithy/config-resolver";
|
||||
import { DefaultIdentityProviderConfig, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, } from "@smithy/core";
|
||||
import { getContentLengthPlugin } from "@smithy/middleware-content-length";
|
||||
import { resolveEndpointConfig } from "@smithy/middleware-endpoint";
|
||||
import { getRetryPlugin, resolveRetryConfig } from "@smithy/middleware-retry";
|
||||
import { Client as __Client, } from "@smithy/smithy-client";
|
||||
import { defaultSTSHttpAuthSchemeParametersProvider, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider";
|
||||
import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
|
||||
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
|
||||
import { resolveRuntimeExtensions } from "./runtimeExtensions";
|
||||
export { __Client };
|
||||
export class STSClient extends __Client {
|
||||
config;
|
||||
constructor(...[configuration]) {
|
||||
const _config_0 = __getRuntimeConfig(configuration || {});
|
||||
super(_config_0);
|
||||
this.initConfig = _config_0;
|
||||
const _config_1 = resolveClientEndpointParameters(_config_0);
|
||||
const _config_2 = resolveUserAgentConfig(_config_1);
|
||||
const _config_3 = resolveRetryConfig(_config_2);
|
||||
const _config_4 = resolveRegionConfig(_config_3);
|
||||
const _config_5 = resolveHostHeaderConfig(_config_4);
|
||||
const _config_6 = resolveEndpointConfig(_config_5);
|
||||
const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
|
||||
const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
|
||||
this.config = _config_8;
|
||||
this.middlewareStack.use(getUserAgentPlugin(this.config));
|
||||
this.middlewareStack.use(getRetryPlugin(this.config));
|
||||
this.middlewareStack.use(getContentLengthPlugin(this.config));
|
||||
this.middlewareStack.use(getHostHeaderPlugin(this.config));
|
||||
this.middlewareStack.use(getLoggerPlugin(this.config));
|
||||
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
|
||||
this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
|
||||
httpAuthSchemeParametersProvider: defaultSTSHttpAuthSchemeParametersProvider,
|
||||
identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({
|
||||
"aws.auth#sigv4": config.credentials,
|
||||
}),
|
||||
}));
|
||||
this.middlewareStack.use(getHttpSigningPlugin(this.config));
|
||||
}
|
||||
destroy() {
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
||||
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
||||
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
||||
let _credentials = runtimeConfig.credentials;
|
||||
return {
|
||||
setHttpAuthScheme(httpAuthScheme) {
|
||||
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
||||
if (index === -1) {
|
||||
_httpAuthSchemes.push(httpAuthScheme);
|
||||
}
|
||||
else {
|
||||
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
||||
}
|
||||
},
|
||||
httpAuthSchemes() {
|
||||
return _httpAuthSchemes;
|
||||
},
|
||||
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
||||
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
||||
},
|
||||
httpAuthSchemeProvider() {
|
||||
return _httpAuthSchemeProvider;
|
||||
},
|
||||
setCredentials(credentials) {
|
||||
_credentials = credentials;
|
||||
},
|
||||
credentials() {
|
||||
return _credentials;
|
||||
},
|
||||
};
|
||||
};
|
||||
export const resolveHttpAuthRuntimeConfig = (config) => {
|
||||
return {
|
||||
httpAuthSchemes: config.httpAuthSchemes(),
|
||||
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
||||
credentials: config.credentials(),
|
||||
};
|
||||
};
|
||||
Generated
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
import { resolveAwsSdkSigV4Config, } from "@aws-sdk/core";
|
||||
import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
|
||||
import { STSClient } from "../STSClient";
|
||||
export const defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
||||
return {
|
||||
operation: getSmithyContext(context).operation,
|
||||
region: (await normalizeProvider(config.region)()) ||
|
||||
(() => {
|
||||
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
||||
})(),
|
||||
};
|
||||
};
|
||||
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "aws.auth#sigv4",
|
||||
signingProperties: {
|
||||
name: "sts",
|
||||
region: authParameters.region,
|
||||
},
|
||||
propertiesExtractor: (config, context) => ({
|
||||
signingProperties: {
|
||||
config,
|
||||
context,
|
||||
},
|
||||
}),
|
||||
};
|
||||
}
|
||||
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "smithy.api#noAuth",
|
||||
};
|
||||
}
|
||||
export const defaultSTSHttpAuthSchemeProvider = (authParameters) => {
|
||||
const options = [];
|
||||
switch (authParameters.operation) {
|
||||
case "AssumeRoleWithWebIdentity": {
|
||||
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
||||
export const resolveStsAuthConfig = (input) => Object.assign(input, {
|
||||
stsClientCtor: STSClient,
|
||||
});
|
||||
export const resolveHttpAuthSchemeConfig = (config) => {
|
||||
const config_0 = resolveStsAuthConfig(config);
|
||||
const config_1 = resolveAwsSdkSigV4Config(config_0);
|
||||
return Object.assign(config_1, {
|
||||
authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),
|
||||
});
|
||||
};
|
||||
Generated
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
||||
import { getSerdePlugin } from "@smithy/middleware-serde";
|
||||
import { Command as $Command } from "@smithy/smithy-client";
|
||||
import { commonParams } from "../endpoint/EndpointParameters";
|
||||
import { AssumeRoleResponseFilterSensitiveLog } from "../models/models_0";
|
||||
import { de_AssumeRoleCommand, se_AssumeRoleCommand } from "../protocols/Aws_query";
|
||||
export { $Command };
|
||||
export class AssumeRoleCommand extends $Command
|
||||
.classBuilder()
|
||||
.ep(commonParams)
|
||||
.m(function (Command, cs, config, o) {
|
||||
return [
|
||||
getSerdePlugin(config, this.serialize, this.deserialize),
|
||||
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
|
||||
];
|
||||
})
|
||||
.s("AWSSecurityTokenServiceV20110615", "AssumeRole", {})
|
||||
.n("STSClient", "AssumeRoleCommand")
|
||||
.f(void 0, AssumeRoleResponseFilterSensitiveLog)
|
||||
.ser(se_AssumeRoleCommand)
|
||||
.de(de_AssumeRoleCommand)
|
||||
.build() {
|
||||
}
|
||||
Generated
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
||||
import { getSerdePlugin } from "@smithy/middleware-serde";
|
||||
import { Command as $Command } from "@smithy/smithy-client";
|
||||
import { commonParams } from "../endpoint/EndpointParameters";
|
||||
import { AssumeRoleWithWebIdentityRequestFilterSensitiveLog, AssumeRoleWithWebIdentityResponseFilterSensitiveLog, } from "../models/models_0";
|
||||
import { de_AssumeRoleWithWebIdentityCommand, se_AssumeRoleWithWebIdentityCommand } from "../protocols/Aws_query";
|
||||
export { $Command };
|
||||
export class AssumeRoleWithWebIdentityCommand extends $Command
|
||||
.classBuilder()
|
||||
.ep(commonParams)
|
||||
.m(function (Command, cs, config, o) {
|
||||
return [
|
||||
getSerdePlugin(config, this.serialize, this.deserialize),
|
||||
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
|
||||
];
|
||||
})
|
||||
.s("AWSSecurityTokenServiceV20110615", "AssumeRoleWithWebIdentity", {})
|
||||
.n("STSClient", "AssumeRoleWithWebIdentityCommand")
|
||||
.f(AssumeRoleWithWebIdentityRequestFilterSensitiveLog, AssumeRoleWithWebIdentityResponseFilterSensitiveLog)
|
||||
.ser(se_AssumeRoleWithWebIdentityCommand)
|
||||
.de(de_AssumeRoleWithWebIdentityCommand)
|
||||
.build() {
|
||||
}
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
export * from "./AssumeRoleCommand";
|
||||
export * from "./AssumeRoleWithWebIdentityCommand";
|
||||
Generated
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
import { getDefaultRoleAssumer as StsGetDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity as StsGetDefaultRoleAssumerWithWebIdentity, } from "./defaultStsRoleAssumers";
|
||||
import { STSClient } from "./STSClient";
|
||||
const getCustomizableStsClientCtor = (baseCtor, customizations) => {
|
||||
if (!customizations)
|
||||
return baseCtor;
|
||||
else
|
||||
return class CustomizableSTSClient extends baseCtor {
|
||||
constructor(config) {
|
||||
super(config);
|
||||
for (const customization of customizations) {
|
||||
this.middlewareStack.use(customization);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
export const getDefaultRoleAssumer = (stsOptions = {}, stsPlugins) => StsGetDefaultRoleAssumer(stsOptions, getCustomizableStsClientCtor(STSClient, stsPlugins));
|
||||
export const getDefaultRoleAssumerWithWebIdentity = (stsOptions = {}, stsPlugins) => StsGetDefaultRoleAssumerWithWebIdentity(stsOptions, getCustomizableStsClientCtor(STSClient, stsPlugins));
|
||||
export const decorateDefaultCredentialProvider = (provider) => (input) => provider({
|
||||
roleAssumer: getDefaultRoleAssumer(input),
|
||||
roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input),
|
||||
...input,
|
||||
});
|
||||
Generated
Vendored
+95
@@ -0,0 +1,95 @@
|
||||
import { setCredentialFeature } from "@aws-sdk/core/client";
|
||||
import { AssumeRoleCommand } from "./commands/AssumeRoleCommand";
|
||||
import { AssumeRoleWithWebIdentityCommand, } from "./commands/AssumeRoleWithWebIdentityCommand";
|
||||
const ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
|
||||
const getAccountIdFromAssumedRoleUser = (assumedRoleUser) => {
|
||||
if (typeof assumedRoleUser?.Arn === "string") {
|
||||
const arnComponents = assumedRoleUser.Arn.split(":");
|
||||
if (arnComponents.length > 4 && arnComponents[4] !== "") {
|
||||
return arnComponents[4];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
const resolveRegion = async (_region, _parentRegion, credentialProviderLogger) => {
|
||||
const region = typeof _region === "function" ? await _region() : _region;
|
||||
const parentRegion = typeof _parentRegion === "function" ? await _parentRegion() : _parentRegion;
|
||||
credentialProviderLogger?.debug?.("@aws-sdk/client-sts::resolveRegion", "accepting first of:", `${region} (provider)`, `${parentRegion} (parent client)`, `${ASSUME_ROLE_DEFAULT_REGION} (STS default)`);
|
||||
return region ?? parentRegion ?? ASSUME_ROLE_DEFAULT_REGION;
|
||||
};
|
||||
export const getDefaultRoleAssumer = (stsOptions, STSClient) => {
|
||||
let stsClient;
|
||||
let closureSourceCreds;
|
||||
return async (sourceCreds, params) => {
|
||||
closureSourceCreds = sourceCreds;
|
||||
if (!stsClient) {
|
||||
const { logger = stsOptions?.parentClientConfig?.logger, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, } = stsOptions;
|
||||
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger);
|
||||
const isCompatibleRequestHandler = !isH2(requestHandler);
|
||||
stsClient = new STSClient({
|
||||
profile: stsOptions?.parentClientConfig?.profile,
|
||||
credentialDefaultProvider: () => async () => closureSourceCreds,
|
||||
region: resolvedRegion,
|
||||
requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
|
||||
logger: logger,
|
||||
});
|
||||
}
|
||||
const { Credentials, AssumedRoleUser } = await stsClient.send(new AssumeRoleCommand(params));
|
||||
if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
|
||||
throw new Error(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`);
|
||||
}
|
||||
const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser);
|
||||
const credentials = {
|
||||
accessKeyId: Credentials.AccessKeyId,
|
||||
secretAccessKey: Credentials.SecretAccessKey,
|
||||
sessionToken: Credentials.SessionToken,
|
||||
expiration: Credentials.Expiration,
|
||||
...(Credentials.CredentialScope && { credentialScope: Credentials.CredentialScope }),
|
||||
...(accountId && { accountId }),
|
||||
};
|
||||
setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE", "i");
|
||||
return credentials;
|
||||
};
|
||||
};
|
||||
export const getDefaultRoleAssumerWithWebIdentity = (stsOptions, STSClient) => {
|
||||
let stsClient;
|
||||
return async (params) => {
|
||||
if (!stsClient) {
|
||||
const { logger = stsOptions?.parentClientConfig?.logger, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, } = stsOptions;
|
||||
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger);
|
||||
const isCompatibleRequestHandler = !isH2(requestHandler);
|
||||
stsClient = new STSClient({
|
||||
profile: stsOptions?.parentClientConfig?.profile,
|
||||
region: resolvedRegion,
|
||||
requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
|
||||
logger: logger,
|
||||
});
|
||||
}
|
||||
const { Credentials, AssumedRoleUser } = await stsClient.send(new AssumeRoleWithWebIdentityCommand(params));
|
||||
if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
|
||||
throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${params.RoleArn}`);
|
||||
}
|
||||
const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser);
|
||||
const credentials = {
|
||||
accessKeyId: Credentials.AccessKeyId,
|
||||
secretAccessKey: Credentials.SecretAccessKey,
|
||||
sessionToken: Credentials.SessionToken,
|
||||
expiration: Credentials.Expiration,
|
||||
...(Credentials.CredentialScope && { credentialScope: Credentials.CredentialScope }),
|
||||
...(accountId && { accountId }),
|
||||
};
|
||||
if (accountId) {
|
||||
setCredentialFeature(credentials, "RESOLVED_ACCOUNT_ID", "T");
|
||||
}
|
||||
setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE_WEB_ID", "k");
|
||||
return credentials;
|
||||
};
|
||||
};
|
||||
export const decorateDefaultCredentialProvider = (provider) => (input) => provider({
|
||||
roleAssumer: getDefaultRoleAssumer(input, input.stsClientCtor),
|
||||
roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input, input.stsClientCtor),
|
||||
...input,
|
||||
});
|
||||
const isH2 = (requestHandler) => {
|
||||
return requestHandler?.metadata?.handlerProtocol === "h2";
|
||||
};
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
export const resolveClientEndpointParameters = (options) => {
|
||||
return Object.assign(options, {
|
||||
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
|
||||
useFipsEndpoint: options.useFipsEndpoint ?? false,
|
||||
useGlobalEndpoint: options.useGlobalEndpoint ?? false,
|
||||
defaultSigningName: "sts",
|
||||
});
|
||||
};
|
||||
export const commonParams = {
|
||||
UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" },
|
||||
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
||||
Endpoint: { type: "builtInParams", name: "endpoint" },
|
||||
Region: { type: "builtInParams", name: "region" },
|
||||
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
||||
};
|
||||
Generated
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
import { awsEndpointFunctions } from "@aws-sdk/util-endpoints";
|
||||
import { customEndpointFunctions, EndpointCache, resolveEndpoint } from "@smithy/util-endpoints";
|
||||
import { ruleSet } from "./ruleset";
|
||||
const cache = new EndpointCache({
|
||||
size: 50,
|
||||
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS", "UseGlobalEndpoint"],
|
||||
});
|
||||
export const defaultEndpointResolver = (endpointParams, context = {}) => {
|
||||
return cache.get(endpointParams, () => resolveEndpoint(ruleSet, {
|
||||
endpointParams: endpointParams,
|
||||
logger: context.logger,
|
||||
}));
|
||||
};
|
||||
customEndpointFunctions.aws = awsEndpointFunctions;
|
||||
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
const F = "required", G = "type", H = "fn", I = "argv", J = "ref";
|
||||
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];
|
||||
const _data = { version: "1.0", 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 }] };
|
||||
export const ruleSet = _data;
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
export * from "./STSClient";
|
||||
export * from "./STS";
|
||||
export * from "./commands";
|
||||
export * from "./models";
|
||||
export * from "./defaultRoleAssumers";
|
||||
export { STSServiceException } from "./models/STSServiceException";
|
||||
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import { ServiceException as __ServiceException, } from "@smithy/smithy-client";
|
||||
export { __ServiceException };
|
||||
export class STSServiceException extends __ServiceException {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
Object.setPrototypeOf(this, STSServiceException.prototype);
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export * from "./models_0";
|
||||
Generated
Vendored
+102
@@ -0,0 +1,102 @@
|
||||
import { SENSITIVE_STRING } from "@smithy/smithy-client";
|
||||
import { STSServiceException as __BaseException } from "./STSServiceException";
|
||||
export const CredentialsFilterSensitiveLog = (obj) => ({
|
||||
...obj,
|
||||
...(obj.SecretAccessKey && { SecretAccessKey: SENSITIVE_STRING }),
|
||||
});
|
||||
export const AssumeRoleResponseFilterSensitiveLog = (obj) => ({
|
||||
...obj,
|
||||
...(obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) }),
|
||||
});
|
||||
export class ExpiredTokenException extends __BaseException {
|
||||
name = "ExpiredTokenException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "ExpiredTokenException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, ExpiredTokenException.prototype);
|
||||
}
|
||||
}
|
||||
export class MalformedPolicyDocumentException extends __BaseException {
|
||||
name = "MalformedPolicyDocumentException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "MalformedPolicyDocumentException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, MalformedPolicyDocumentException.prototype);
|
||||
}
|
||||
}
|
||||
export class PackedPolicyTooLargeException extends __BaseException {
|
||||
name = "PackedPolicyTooLargeException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "PackedPolicyTooLargeException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, PackedPolicyTooLargeException.prototype);
|
||||
}
|
||||
}
|
||||
export class RegionDisabledException extends __BaseException {
|
||||
name = "RegionDisabledException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "RegionDisabledException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, RegionDisabledException.prototype);
|
||||
}
|
||||
}
|
||||
export class IDPRejectedClaimException extends __BaseException {
|
||||
name = "IDPRejectedClaimException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "IDPRejectedClaimException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, IDPRejectedClaimException.prototype);
|
||||
}
|
||||
}
|
||||
export class InvalidIdentityTokenException extends __BaseException {
|
||||
name = "InvalidIdentityTokenException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "InvalidIdentityTokenException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, InvalidIdentityTokenException.prototype);
|
||||
}
|
||||
}
|
||||
export const AssumeRoleWithWebIdentityRequestFilterSensitiveLog = (obj) => ({
|
||||
...obj,
|
||||
...(obj.WebIdentityToken && { WebIdentityToken: SENSITIVE_STRING }),
|
||||
});
|
||||
export const AssumeRoleWithWebIdentityResponseFilterSensitiveLog = (obj) => ({
|
||||
...obj,
|
||||
...(obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) }),
|
||||
});
|
||||
export class IDPCommunicationErrorException extends __BaseException {
|
||||
name = "IDPCommunicationErrorException";
|
||||
$fault = "client";
|
||||
constructor(opts) {
|
||||
super({
|
||||
name: "IDPCommunicationErrorException",
|
||||
$fault: "client",
|
||||
...opts,
|
||||
});
|
||||
Object.setPrototypeOf(this, IDPCommunicationErrorException.prototype);
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+528
@@ -0,0 +1,528 @@
|
||||
import { parseXmlBody as parseBody, parseXmlErrorBody as parseErrorBody } from "@aws-sdk/core";
|
||||
import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
|
||||
import { collectBody, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectString as __expectString, extendedEncodeURIComponent as __extendedEncodeURIComponent, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, strictParseInt32 as __strictParseInt32, withBaseException, } from "@smithy/smithy-client";
|
||||
import { ExpiredTokenException, IDPCommunicationErrorException, IDPRejectedClaimException, InvalidIdentityTokenException, MalformedPolicyDocumentException, PackedPolicyTooLargeException, RegionDisabledException, } from "../models/models_0";
|
||||
import { STSServiceException as __BaseException } from "../models/STSServiceException";
|
||||
export const se_AssumeRoleCommand = async (input, context) => {
|
||||
const headers = SHARED_HEADERS;
|
||||
let body;
|
||||
body = buildFormUrlencodedString({
|
||||
...se_AssumeRoleRequest(input, context),
|
||||
[_A]: _AR,
|
||||
[_V]: _,
|
||||
});
|
||||
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
||||
};
|
||||
export const se_AssumeRoleWithWebIdentityCommand = async (input, context) => {
|
||||
const headers = SHARED_HEADERS;
|
||||
let body;
|
||||
body = buildFormUrlencodedString({
|
||||
...se_AssumeRoleWithWebIdentityRequest(input, context),
|
||||
[_A]: _ARWWI,
|
||||
[_V]: _,
|
||||
});
|
||||
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
||||
};
|
||||
export const de_AssumeRoleCommand = async (output, context) => {
|
||||
if (output.statusCode >= 300) {
|
||||
return de_CommandError(output, context);
|
||||
}
|
||||
const data = await parseBody(output.body, context);
|
||||
let contents = {};
|
||||
contents = de_AssumeRoleResponse(data.AssumeRoleResult, context);
|
||||
const response = {
|
||||
$metadata: deserializeMetadata(output),
|
||||
...contents,
|
||||
};
|
||||
return response;
|
||||
};
|
||||
export const de_AssumeRoleWithWebIdentityCommand = async (output, context) => {
|
||||
if (output.statusCode >= 300) {
|
||||
return de_CommandError(output, context);
|
||||
}
|
||||
const data = await parseBody(output.body, context);
|
||||
let contents = {};
|
||||
contents = de_AssumeRoleWithWebIdentityResponse(data.AssumeRoleWithWebIdentityResult, context);
|
||||
const response = {
|
||||
$metadata: deserializeMetadata(output),
|
||||
...contents,
|
||||
};
|
||||
return response;
|
||||
};
|
||||
const de_CommandError = async (output, context) => {
|
||||
const parsedOutput = {
|
||||
...output,
|
||||
body: await parseErrorBody(output.body, context),
|
||||
};
|
||||
const errorCode = loadQueryErrorCode(output, parsedOutput.body);
|
||||
switch (errorCode) {
|
||||
case "ExpiredTokenException":
|
||||
case "com.amazonaws.sts#ExpiredTokenException":
|
||||
throw await de_ExpiredTokenExceptionRes(parsedOutput, context);
|
||||
case "MalformedPolicyDocument":
|
||||
case "com.amazonaws.sts#MalformedPolicyDocumentException":
|
||||
throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context);
|
||||
case "PackedPolicyTooLarge":
|
||||
case "com.amazonaws.sts#PackedPolicyTooLargeException":
|
||||
throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context);
|
||||
case "RegionDisabledException":
|
||||
case "com.amazonaws.sts#RegionDisabledException":
|
||||
throw await de_RegionDisabledExceptionRes(parsedOutput, context);
|
||||
case "IDPCommunicationError":
|
||||
case "com.amazonaws.sts#IDPCommunicationErrorException":
|
||||
throw await de_IDPCommunicationErrorExceptionRes(parsedOutput, context);
|
||||
case "IDPRejectedClaim":
|
||||
case "com.amazonaws.sts#IDPRejectedClaimException":
|
||||
throw await de_IDPRejectedClaimExceptionRes(parsedOutput, context);
|
||||
case "InvalidIdentityToken":
|
||||
case "com.amazonaws.sts#InvalidIdentityTokenException":
|
||||
throw await de_InvalidIdentityTokenExceptionRes(parsedOutput, context);
|
||||
default:
|
||||
const parsedBody = parsedOutput.body;
|
||||
return throwDefaultError({
|
||||
output,
|
||||
parsedBody: parsedBody.Error,
|
||||
errorCode,
|
||||
});
|
||||
}
|
||||
};
|
||||
const de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
|
||||
const body = parsedOutput.body;
|
||||
const deserialized = de_ExpiredTokenException(body.Error, context);
|
||||
const exception = new ExpiredTokenException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...deserialized,
|
||||
});
|
||||
return __decorateServiceException(exception, body);
|
||||
};
|
||||
const de_IDPCommunicationErrorExceptionRes = async (parsedOutput, context) => {
|
||||
const body = parsedOutput.body;
|
||||
const deserialized = de_IDPCommunicationErrorException(body.Error, context);
|
||||
const exception = new IDPCommunicationErrorException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...deserialized,
|
||||
});
|
||||
return __decorateServiceException(exception, body);
|
||||
};
|
||||
const de_IDPRejectedClaimExceptionRes = async (parsedOutput, context) => {
|
||||
const body = parsedOutput.body;
|
||||
const deserialized = de_IDPRejectedClaimException(body.Error, context);
|
||||
const exception = new IDPRejectedClaimException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...deserialized,
|
||||
});
|
||||
return __decorateServiceException(exception, body);
|
||||
};
|
||||
const de_InvalidIdentityTokenExceptionRes = async (parsedOutput, context) => {
|
||||
const body = parsedOutput.body;
|
||||
const deserialized = de_InvalidIdentityTokenException(body.Error, context);
|
||||
const exception = new InvalidIdentityTokenException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...deserialized,
|
||||
});
|
||||
return __decorateServiceException(exception, body);
|
||||
};
|
||||
const de_MalformedPolicyDocumentExceptionRes = async (parsedOutput, context) => {
|
||||
const body = parsedOutput.body;
|
||||
const deserialized = de_MalformedPolicyDocumentException(body.Error, context);
|
||||
const exception = new MalformedPolicyDocumentException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...deserialized,
|
||||
});
|
||||
return __decorateServiceException(exception, body);
|
||||
};
|
||||
const de_PackedPolicyTooLargeExceptionRes = async (parsedOutput, context) => {
|
||||
const body = parsedOutput.body;
|
||||
const deserialized = de_PackedPolicyTooLargeException(body.Error, context);
|
||||
const exception = new PackedPolicyTooLargeException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...deserialized,
|
||||
});
|
||||
return __decorateServiceException(exception, body);
|
||||
};
|
||||
const de_RegionDisabledExceptionRes = async (parsedOutput, context) => {
|
||||
const body = parsedOutput.body;
|
||||
const deserialized = de_RegionDisabledException(body.Error, context);
|
||||
const exception = new RegionDisabledException({
|
||||
$metadata: deserializeMetadata(parsedOutput),
|
||||
...deserialized,
|
||||
});
|
||||
return __decorateServiceException(exception, body);
|
||||
};
|
||||
const se_AssumeRoleRequest = (input, context) => {
|
||||
const entries = {};
|
||||
if (input[_RA] != null) {
|
||||
entries[_RA] = input[_RA];
|
||||
}
|
||||
if (input[_RSN] != null) {
|
||||
entries[_RSN] = input[_RSN];
|
||||
}
|
||||
if (input[_PA] != null) {
|
||||
const memberEntries = se_policyDescriptorListType(input[_PA], context);
|
||||
if (input[_PA]?.length === 0) {
|
||||
entries.PolicyArns = [];
|
||||
}
|
||||
Object.entries(memberEntries).forEach(([key, value]) => {
|
||||
const loc = `PolicyArns.${key}`;
|
||||
entries[loc] = value;
|
||||
});
|
||||
}
|
||||
if (input[_P] != null) {
|
||||
entries[_P] = input[_P];
|
||||
}
|
||||
if (input[_DS] != null) {
|
||||
entries[_DS] = input[_DS];
|
||||
}
|
||||
if (input[_T] != null) {
|
||||
const memberEntries = se_tagListType(input[_T], context);
|
||||
if (input[_T]?.length === 0) {
|
||||
entries.Tags = [];
|
||||
}
|
||||
Object.entries(memberEntries).forEach(([key, value]) => {
|
||||
const loc = `Tags.${key}`;
|
||||
entries[loc] = value;
|
||||
});
|
||||
}
|
||||
if (input[_TTK] != null) {
|
||||
const memberEntries = se_tagKeyListType(input[_TTK], context);
|
||||
if (input[_TTK]?.length === 0) {
|
||||
entries.TransitiveTagKeys = [];
|
||||
}
|
||||
Object.entries(memberEntries).forEach(([key, value]) => {
|
||||
const loc = `TransitiveTagKeys.${key}`;
|
||||
entries[loc] = value;
|
||||
});
|
||||
}
|
||||
if (input[_EI] != null) {
|
||||
entries[_EI] = input[_EI];
|
||||
}
|
||||
if (input[_SN] != null) {
|
||||
entries[_SN] = input[_SN];
|
||||
}
|
||||
if (input[_TC] != null) {
|
||||
entries[_TC] = input[_TC];
|
||||
}
|
||||
if (input[_SI] != null) {
|
||||
entries[_SI] = input[_SI];
|
||||
}
|
||||
if (input[_PC] != null) {
|
||||
const memberEntries = se_ProvidedContextsListType(input[_PC], context);
|
||||
if (input[_PC]?.length === 0) {
|
||||
entries.ProvidedContexts = [];
|
||||
}
|
||||
Object.entries(memberEntries).forEach(([key, value]) => {
|
||||
const loc = `ProvidedContexts.${key}`;
|
||||
entries[loc] = value;
|
||||
});
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
const se_AssumeRoleWithWebIdentityRequest = (input, context) => {
|
||||
const entries = {};
|
||||
if (input[_RA] != null) {
|
||||
entries[_RA] = input[_RA];
|
||||
}
|
||||
if (input[_RSN] != null) {
|
||||
entries[_RSN] = input[_RSN];
|
||||
}
|
||||
if (input[_WIT] != null) {
|
||||
entries[_WIT] = input[_WIT];
|
||||
}
|
||||
if (input[_PI] != null) {
|
||||
entries[_PI] = input[_PI];
|
||||
}
|
||||
if (input[_PA] != null) {
|
||||
const memberEntries = se_policyDescriptorListType(input[_PA], context);
|
||||
if (input[_PA]?.length === 0) {
|
||||
entries.PolicyArns = [];
|
||||
}
|
||||
Object.entries(memberEntries).forEach(([key, value]) => {
|
||||
const loc = `PolicyArns.${key}`;
|
||||
entries[loc] = value;
|
||||
});
|
||||
}
|
||||
if (input[_P] != null) {
|
||||
entries[_P] = input[_P];
|
||||
}
|
||||
if (input[_DS] != null) {
|
||||
entries[_DS] = input[_DS];
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
const se_policyDescriptorListType = (input, context) => {
|
||||
const entries = {};
|
||||
let counter = 1;
|
||||
for (const entry of input) {
|
||||
if (entry === null) {
|
||||
continue;
|
||||
}
|
||||
const memberEntries = se_PolicyDescriptorType(entry, context);
|
||||
Object.entries(memberEntries).forEach(([key, value]) => {
|
||||
entries[`member.${counter}.${key}`] = value;
|
||||
});
|
||||
counter++;
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
const se_PolicyDescriptorType = (input, context) => {
|
||||
const entries = {};
|
||||
if (input[_a] != null) {
|
||||
entries[_a] = input[_a];
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
const se_ProvidedContext = (input, context) => {
|
||||
const entries = {};
|
||||
if (input[_PAr] != null) {
|
||||
entries[_PAr] = input[_PAr];
|
||||
}
|
||||
if (input[_CA] != null) {
|
||||
entries[_CA] = input[_CA];
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
const se_ProvidedContextsListType = (input, context) => {
|
||||
const entries = {};
|
||||
let counter = 1;
|
||||
for (const entry of input) {
|
||||
if (entry === null) {
|
||||
continue;
|
||||
}
|
||||
const memberEntries = se_ProvidedContext(entry, context);
|
||||
Object.entries(memberEntries).forEach(([key, value]) => {
|
||||
entries[`member.${counter}.${key}`] = value;
|
||||
});
|
||||
counter++;
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
const se_Tag = (input, context) => {
|
||||
const entries = {};
|
||||
if (input[_K] != null) {
|
||||
entries[_K] = input[_K];
|
||||
}
|
||||
if (input[_Va] != null) {
|
||||
entries[_Va] = input[_Va];
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
const se_tagKeyListType = (input, context) => {
|
||||
const entries = {};
|
||||
let counter = 1;
|
||||
for (const entry of input) {
|
||||
if (entry === null) {
|
||||
continue;
|
||||
}
|
||||
entries[`member.${counter}`] = entry;
|
||||
counter++;
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
const se_tagListType = (input, context) => {
|
||||
const entries = {};
|
||||
let counter = 1;
|
||||
for (const entry of input) {
|
||||
if (entry === null) {
|
||||
continue;
|
||||
}
|
||||
const memberEntries = se_Tag(entry, context);
|
||||
Object.entries(memberEntries).forEach(([key, value]) => {
|
||||
entries[`member.${counter}.${key}`] = value;
|
||||
});
|
||||
counter++;
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
const de_AssumedRoleUser = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_ARI] != null) {
|
||||
contents[_ARI] = __expectString(output[_ARI]);
|
||||
}
|
||||
if (output[_Ar] != null) {
|
||||
contents[_Ar] = __expectString(output[_Ar]);
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const de_AssumeRoleResponse = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_C] != null) {
|
||||
contents[_C] = de_Credentials(output[_C], context);
|
||||
}
|
||||
if (output[_ARU] != null) {
|
||||
contents[_ARU] = de_AssumedRoleUser(output[_ARU], context);
|
||||
}
|
||||
if (output[_PPS] != null) {
|
||||
contents[_PPS] = __strictParseInt32(output[_PPS]);
|
||||
}
|
||||
if (output[_SI] != null) {
|
||||
contents[_SI] = __expectString(output[_SI]);
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const de_AssumeRoleWithWebIdentityResponse = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_C] != null) {
|
||||
contents[_C] = de_Credentials(output[_C], context);
|
||||
}
|
||||
if (output[_SFWIT] != null) {
|
||||
contents[_SFWIT] = __expectString(output[_SFWIT]);
|
||||
}
|
||||
if (output[_ARU] != null) {
|
||||
contents[_ARU] = de_AssumedRoleUser(output[_ARU], context);
|
||||
}
|
||||
if (output[_PPS] != null) {
|
||||
contents[_PPS] = __strictParseInt32(output[_PPS]);
|
||||
}
|
||||
if (output[_Pr] != null) {
|
||||
contents[_Pr] = __expectString(output[_Pr]);
|
||||
}
|
||||
if (output[_Au] != null) {
|
||||
contents[_Au] = __expectString(output[_Au]);
|
||||
}
|
||||
if (output[_SI] != null) {
|
||||
contents[_SI] = __expectString(output[_SI]);
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const de_Credentials = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_AKI] != null) {
|
||||
contents[_AKI] = __expectString(output[_AKI]);
|
||||
}
|
||||
if (output[_SAK] != null) {
|
||||
contents[_SAK] = __expectString(output[_SAK]);
|
||||
}
|
||||
if (output[_ST] != null) {
|
||||
contents[_ST] = __expectString(output[_ST]);
|
||||
}
|
||||
if (output[_E] != null) {
|
||||
contents[_E] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_E]));
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const de_ExpiredTokenException = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_m] != null) {
|
||||
contents[_m] = __expectString(output[_m]);
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const de_IDPCommunicationErrorException = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_m] != null) {
|
||||
contents[_m] = __expectString(output[_m]);
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const de_IDPRejectedClaimException = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_m] != null) {
|
||||
contents[_m] = __expectString(output[_m]);
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const de_InvalidIdentityTokenException = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_m] != null) {
|
||||
contents[_m] = __expectString(output[_m]);
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const de_MalformedPolicyDocumentException = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_m] != null) {
|
||||
contents[_m] = __expectString(output[_m]);
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const de_PackedPolicyTooLargeException = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_m] != null) {
|
||||
contents[_m] = __expectString(output[_m]);
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const de_RegionDisabledException = (output, context) => {
|
||||
const contents = {};
|
||||
if (output[_m] != null) {
|
||||
contents[_m] = __expectString(output[_m]);
|
||||
}
|
||||
return contents;
|
||||
};
|
||||
const deserializeMetadata = (output) => ({
|
||||
httpStatusCode: output.statusCode,
|
||||
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
||||
extendedRequestId: output.headers["x-amz-id-2"],
|
||||
cfId: output.headers["x-amz-cf-id"],
|
||||
});
|
||||
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
||||
const throwDefaultError = withBaseException(__BaseException);
|
||||
const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
|
||||
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
||||
const contents = {
|
||||
protocol,
|
||||
hostname,
|
||||
port,
|
||||
method: "POST",
|
||||
path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
|
||||
headers,
|
||||
};
|
||||
if (resolvedHostname !== undefined) {
|
||||
contents.hostname = resolvedHostname;
|
||||
}
|
||||
if (body !== undefined) {
|
||||
contents.body = body;
|
||||
}
|
||||
return new __HttpRequest(contents);
|
||||
};
|
||||
const SHARED_HEADERS = {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
};
|
||||
const _ = "2011-06-15";
|
||||
const _A = "Action";
|
||||
const _AKI = "AccessKeyId";
|
||||
const _AR = "AssumeRole";
|
||||
const _ARI = "AssumedRoleId";
|
||||
const _ARU = "AssumedRoleUser";
|
||||
const _ARWWI = "AssumeRoleWithWebIdentity";
|
||||
const _Ar = "Arn";
|
||||
const _Au = "Audience";
|
||||
const _C = "Credentials";
|
||||
const _CA = "ContextAssertion";
|
||||
const _DS = "DurationSeconds";
|
||||
const _E = "Expiration";
|
||||
const _EI = "ExternalId";
|
||||
const _K = "Key";
|
||||
const _P = "Policy";
|
||||
const _PA = "PolicyArns";
|
||||
const _PAr = "ProviderArn";
|
||||
const _PC = "ProvidedContexts";
|
||||
const _PI = "ProviderId";
|
||||
const _PPS = "PackedPolicySize";
|
||||
const _Pr = "Provider";
|
||||
const _RA = "RoleArn";
|
||||
const _RSN = "RoleSessionName";
|
||||
const _SAK = "SecretAccessKey";
|
||||
const _SFWIT = "SubjectFromWebIdentityToken";
|
||||
const _SI = "SourceIdentity";
|
||||
const _SN = "SerialNumber";
|
||||
const _ST = "SessionToken";
|
||||
const _T = "Tags";
|
||||
const _TC = "TokenCode";
|
||||
const _TTK = "TransitiveTagKeys";
|
||||
const _V = "Version";
|
||||
const _Va = "Value";
|
||||
const _WIT = "WebIdentityToken";
|
||||
const _a = "arn";
|
||||
const _m = "message";
|
||||
const buildFormUrlencodedString = (formEntries) => Object.entries(formEntries)
|
||||
.map(([key, value]) => __extendedEncodeURIComponent(key) + "=" + __extendedEncodeURIComponent(value))
|
||||
.join("&");
|
||||
const loadQueryErrorCode = (output, data) => {
|
||||
if (data.Error?.Code !== undefined) {
|
||||
return data.Error.Code;
|
||||
}
|
||||
if (output.statusCode == 404) {
|
||||
return "NotFound";
|
||||
}
|
||||
};
|
||||
Generated
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
import packageInfo from "../../../package.json";
|
||||
import { Sha256 } from "@aws-crypto/sha256-browser";
|
||||
import { createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-browser";
|
||||
import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver";
|
||||
import { FetchHttpHandler as RequestHandler, streamCollector } from "@smithy/fetch-http-handler";
|
||||
import { invalidProvider } from "@smithy/invalid-dependency";
|
||||
import { calculateBodyLength } from "@smithy/util-body-length-browser";
|
||||
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@smithy/util-retry";
|
||||
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
||||
import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
|
||||
import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-browser";
|
||||
export const getRuntimeConfig = (config) => {
|
||||
const defaultsMode = resolveDefaultsModeConfig(config);
|
||||
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
||||
const clientSharedValues = getSharedRuntimeConfig(config);
|
||||
return {
|
||||
...clientSharedValues,
|
||||
...config,
|
||||
runtime: "browser",
|
||||
defaultsMode,
|
||||
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
||||
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
|
||||
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
||||
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
||||
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
||||
region: config?.region ?? invalidProvider("Region is missing"),
|
||||
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
||||
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
|
||||
sha256: config?.sha256 ?? Sha256,
|
||||
streamCollector: config?.streamCollector ?? streamCollector,
|
||||
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
||||
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
|
||||
};
|
||||
};
|
||||
Generated
Vendored
+63
@@ -0,0 +1,63 @@
|
||||
import packageInfo from "../../../package.json";
|
||||
import { AwsSdkSigV4Signer, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, emitWarningIfUnsupportedVersion as awsCheckVersion, } from "@aws-sdk/core";
|
||||
import { NODE_APP_ID_CONFIG_OPTIONS, createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-node";
|
||||
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@smithy/config-resolver";
|
||||
import { NoAuthSigner } from "@smithy/core";
|
||||
import { Hash } from "@smithy/hash-node";
|
||||
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@smithy/middleware-retry";
|
||||
import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
|
||||
import { NodeHttpHandler as RequestHandler, streamCollector } from "@smithy/node-http-handler";
|
||||
import { calculateBodyLength } from "@smithy/util-body-length-node";
|
||||
import { DEFAULT_RETRY_MODE } from "@smithy/util-retry";
|
||||
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
||||
import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
|
||||
import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-node";
|
||||
import { emitWarningIfUnsupportedVersion } from "@smithy/smithy-client";
|
||||
export const getRuntimeConfig = (config) => {
|
||||
emitWarningIfUnsupportedVersion(process.version);
|
||||
const defaultsMode = resolveDefaultsModeConfig(config);
|
||||
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
||||
const clientSharedValues = getSharedRuntimeConfig(config);
|
||||
awsCheckVersion(process.version);
|
||||
const loaderConfig = {
|
||||
profile: config?.profile,
|
||||
logger: clientSharedValues.logger,
|
||||
};
|
||||
return {
|
||||
...clientSharedValues,
|
||||
...config,
|
||||
runtime: "node",
|
||||
defaultsMode,
|
||||
authSchemePreference: config?.authSchemePreference ?? loadNodeConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
||||
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
||||
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
||||
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
||||
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
||||
{
|
||||
schemeId: "aws.auth#sigv4",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4") ||
|
||||
(async (idProps) => await config.credentialDefaultProvider(idProps?.__config || {})()),
|
||||
signer: new AwsSdkSigV4Signer(),
|
||||
},
|
||||
{
|
||||
schemeId: "smithy.api#noAuth",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
||||
signer: new NoAuthSigner(),
|
||||
},
|
||||
],
|
||||
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
||||
region: config?.region ??
|
||||
loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
||||
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
||||
retryMode: config?.retryMode ??
|
||||
loadNodeConfig({
|
||||
...NODE_RETRY_MODE_CONFIG_OPTIONS,
|
||||
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
|
||||
}, config),
|
||||
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
||||
streamCollector: config?.streamCollector ?? streamCollector,
|
||||
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
||||
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
|
||||
};
|
||||
};
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
import { Sha256 } from "@aws-crypto/sha256-js";
|
||||
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
|
||||
export const getRuntimeConfig = (config) => {
|
||||
const browserDefaults = getBrowserRuntimeConfig(config);
|
||||
return {
|
||||
...browserDefaults,
|
||||
...config,
|
||||
runtime: "react-native",
|
||||
sha256: config?.sha256 ?? Sha256,
|
||||
};
|
||||
};
|
||||
Generated
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
import { AwsSdkSigV4Signer } from "@aws-sdk/core";
|
||||
import { NoAuthSigner } from "@smithy/core";
|
||||
import { NoOpLogger } from "@smithy/smithy-client";
|
||||
import { parseUrl } from "@smithy/url-parser";
|
||||
import { fromBase64, toBase64 } from "@smithy/util-base64";
|
||||
import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
|
||||
import { defaultSTSHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider";
|
||||
import { defaultEndpointResolver } from "./endpoint/endpointResolver";
|
||||
export const getRuntimeConfig = (config) => {
|
||||
return {
|
||||
apiVersion: "2011-06-15",
|
||||
base64Decoder: config?.base64Decoder ?? fromBase64,
|
||||
base64Encoder: config?.base64Encoder ?? toBase64,
|
||||
disableHostPrefix: config?.disableHostPrefix ?? false,
|
||||
endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
|
||||
extensions: config?.extensions ?? [],
|
||||
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSTSHttpAuthSchemeProvider,
|
||||
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
||||
{
|
||||
schemeId: "aws.auth#sigv4",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
||||
signer: new AwsSdkSigV4Signer(),
|
||||
},
|
||||
{
|
||||
schemeId: "smithy.api#noAuth",
|
||||
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
||||
signer: new NoAuthSigner(),
|
||||
},
|
||||
],
|
||||
logger: config?.logger ?? new NoOpLogger(),
|
||||
serviceId: config?.serviceId ?? "STS",
|
||||
urlParser: config?.urlParser ?? parseUrl,
|
||||
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
||||
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
||||
};
|
||||
};
|
||||
SerpentRace_Backend/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeExtensions.js
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
import { getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, } from "@aws-sdk/region-config-resolver";
|
||||
import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http";
|
||||
import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client";
|
||||
import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration";
|
||||
export const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
||||
const extensionConfiguration = Object.assign(getAwsRegionExtensionConfiguration(runtimeConfig), getDefaultExtensionConfiguration(runtimeConfig), getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
|
||||
extensions.forEach((extension) => extension.configure(extensionConfiguration));
|
||||
return Object.assign(runtimeConfig, resolveAwsRegionExtensionConfiguration(extensionConfiguration), resolveDefaultRuntimeConfig(extensionConfiguration), resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
|
||||
};
|
||||
Reference in New Issue
Block a user