@aws-sdk/client-sts 3.183.0 → 3.186.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,34 +1,41 @@
1
+ import { __extends } from "tslib";
1
2
  import { getSerdePlugin } from "@aws-sdk/middleware-serde";
2
3
  import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
3
4
  import { Command as $Command } from "@aws-sdk/smithy-client";
4
5
  import { GetFederationTokenRequestFilterSensitiveLog, GetFederationTokenResponseFilterSensitiveLog, } from "../models/models_0";
5
6
  import { deserializeAws_queryGetFederationTokenCommand, serializeAws_queryGetFederationTokenCommand, } from "../protocols/Aws_query";
6
- export class GetFederationTokenCommand extends $Command {
7
- constructor(input) {
8
- super();
9
- this.input = input;
7
+ var GetFederationTokenCommand = (function (_super) {
8
+ __extends(GetFederationTokenCommand, _super);
9
+ function GetFederationTokenCommand(input) {
10
+ var _this = _super.call(this) || this;
11
+ _this.input = input;
12
+ return _this;
10
13
  }
11
- resolveMiddleware(clientStack, configuration, options) {
14
+ GetFederationTokenCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
12
15
  this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
13
16
  this.middlewareStack.use(getAwsAuthPlugin(configuration));
14
- const stack = clientStack.concat(this.middlewareStack);
15
- const { logger } = configuration;
16
- const clientName = "STSClient";
17
- const commandName = "GetFederationTokenCommand";
18
- const handlerExecutionContext = {
19
- logger,
20
- clientName,
21
- commandName,
17
+ var stack = clientStack.concat(this.middlewareStack);
18
+ var logger = configuration.logger;
19
+ var clientName = "STSClient";
20
+ var commandName = "GetFederationTokenCommand";
21
+ var handlerExecutionContext = {
22
+ logger: logger,
23
+ clientName: clientName,
24
+ commandName: commandName,
22
25
  inputFilterSensitiveLog: GetFederationTokenRequestFilterSensitiveLog,
23
26
  outputFilterSensitiveLog: GetFederationTokenResponseFilterSensitiveLog,
24
27
  };
25
- const { requestHandler } = configuration;
26
- return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
27
- }
28
- serialize(input, context) {
28
+ var requestHandler = configuration.requestHandler;
29
+ return stack.resolve(function (request) {
30
+ return requestHandler.handle(request.request, options || {});
31
+ }, handlerExecutionContext);
32
+ };
33
+ GetFederationTokenCommand.prototype.serialize = function (input, context) {
29
34
  return serializeAws_queryGetFederationTokenCommand(input, context);
30
- }
31
- deserialize(output, context) {
35
+ };
36
+ GetFederationTokenCommand.prototype.deserialize = function (output, context) {
32
37
  return deserializeAws_queryGetFederationTokenCommand(output, context);
33
- }
34
- }
38
+ };
39
+ return GetFederationTokenCommand;
40
+ }($Command));
41
+ export { GetFederationTokenCommand };
@@ -1,34 +1,41 @@
1
+ import { __extends } from "tslib";
1
2
  import { getSerdePlugin } from "@aws-sdk/middleware-serde";
2
3
  import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
3
4
  import { Command as $Command } from "@aws-sdk/smithy-client";
4
5
  import { GetSessionTokenRequestFilterSensitiveLog, GetSessionTokenResponseFilterSensitiveLog, } from "../models/models_0";
5
6
  import { deserializeAws_queryGetSessionTokenCommand, serializeAws_queryGetSessionTokenCommand, } from "../protocols/Aws_query";
6
- export class GetSessionTokenCommand extends $Command {
7
- constructor(input) {
8
- super();
9
- this.input = input;
7
+ var GetSessionTokenCommand = (function (_super) {
8
+ __extends(GetSessionTokenCommand, _super);
9
+ function GetSessionTokenCommand(input) {
10
+ var _this = _super.call(this) || this;
11
+ _this.input = input;
12
+ return _this;
10
13
  }
11
- resolveMiddleware(clientStack, configuration, options) {
14
+ GetSessionTokenCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
12
15
  this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
13
16
  this.middlewareStack.use(getAwsAuthPlugin(configuration));
14
- const stack = clientStack.concat(this.middlewareStack);
15
- const { logger } = configuration;
16
- const clientName = "STSClient";
17
- const commandName = "GetSessionTokenCommand";
18
- const handlerExecutionContext = {
19
- logger,
20
- clientName,
21
- commandName,
17
+ var stack = clientStack.concat(this.middlewareStack);
18
+ var logger = configuration.logger;
19
+ var clientName = "STSClient";
20
+ var commandName = "GetSessionTokenCommand";
21
+ var handlerExecutionContext = {
22
+ logger: logger,
23
+ clientName: clientName,
24
+ commandName: commandName,
22
25
  inputFilterSensitiveLog: GetSessionTokenRequestFilterSensitiveLog,
23
26
  outputFilterSensitiveLog: GetSessionTokenResponseFilterSensitiveLog,
24
27
  };
25
- const { requestHandler } = configuration;
26
- return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
27
- }
28
- serialize(input, context) {
28
+ var requestHandler = configuration.requestHandler;
29
+ return stack.resolve(function (request) {
30
+ return requestHandler.handle(request.request, options || {});
31
+ }, handlerExecutionContext);
32
+ };
33
+ GetSessionTokenCommand.prototype.serialize = function (input, context) {
29
34
  return serializeAws_queryGetSessionTokenCommand(input, context);
30
- }
31
- deserialize(output, context) {
35
+ };
36
+ GetSessionTokenCommand.prototype.deserialize = function (output, context) {
32
37
  return deserializeAws_queryGetSessionTokenCommand(output, context);
33
- }
34
- }
38
+ };
39
+ return GetSessionTokenCommand;
40
+ }($Command));
41
+ export { GetSessionTokenCommand };
@@ -1,22 +1,43 @@
1
+ import { __assign, __extends, __values } from "tslib";
1
2
  import { getDefaultRoleAssumer as StsGetDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity as StsGetDefaultRoleAssumerWithWebIdentity, } from "./defaultStsRoleAssumers";
2
3
  import { STSClient } from "./STSClient";
3
- const getCustomizableStsClientCtor = (baseCtor, customizations) => {
4
+ var getCustomizableStsClientCtor = function (baseCtor, customizations) {
4
5
  if (!customizations)
5
6
  return baseCtor;
6
7
  else
7
- return class CustomizableSTSClient extends baseCtor {
8
- constructor(config) {
9
- super(config);
10
- for (const customization of customizations) {
11
- this.middlewareStack.use(customization);
8
+ return (function (_super) {
9
+ __extends(CustomizableSTSClient, _super);
10
+ function CustomizableSTSClient(config) {
11
+ var e_1, _a;
12
+ var _this = _super.call(this, config) || this;
13
+ try {
14
+ for (var _b = __values(customizations), _c = _b.next(); !_c.done; _c = _b.next()) {
15
+ var customization = _c.value;
16
+ _this.middlewareStack.use(customization);
17
+ }
12
18
  }
19
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
20
+ finally {
21
+ try {
22
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
23
+ }
24
+ finally { if (e_1) throw e_1.error; }
25
+ }
26
+ return _this;
13
27
  }
14
- };
28
+ return CustomizableSTSClient;
29
+ }(baseCtor));
30
+ };
31
+ export var getDefaultRoleAssumer = function (stsOptions, stsPlugins) {
32
+ if (stsOptions === void 0) { stsOptions = {}; }
33
+ return StsGetDefaultRoleAssumer(stsOptions, getCustomizableStsClientCtor(STSClient, stsPlugins));
34
+ };
35
+ export var getDefaultRoleAssumerWithWebIdentity = function (stsOptions, stsPlugins) {
36
+ if (stsOptions === void 0) { stsOptions = {}; }
37
+ return StsGetDefaultRoleAssumerWithWebIdentity(stsOptions, getCustomizableStsClientCtor(STSClient, stsPlugins));
38
+ };
39
+ export var decorateDefaultCredentialProvider = function (provider) {
40
+ return function (input) {
41
+ return provider(__assign({ roleAssumer: getDefaultRoleAssumer(input), roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input) }, input));
42
+ };
15
43
  };
16
- export const getDefaultRoleAssumer = (stsOptions = {}, stsPlugins) => StsGetDefaultRoleAssumer(stsOptions, getCustomizableStsClientCtor(STSClient, stsPlugins));
17
- export const getDefaultRoleAssumerWithWebIdentity = (stsOptions = {}, stsPlugins) => StsGetDefaultRoleAssumerWithWebIdentity(stsOptions, getCustomizableStsClientCtor(STSClient, stsPlugins));
18
- export const decorateDefaultCredentialProvider = (provider) => (input) => provider({
19
- roleAssumer: getDefaultRoleAssumer(input),
20
- roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input),
21
- ...input,
22
- });
@@ -1,70 +1,87 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import { AssumeRoleCommand } from "./commands/AssumeRoleCommand";
2
3
  import { AssumeRoleWithWebIdentityCommand, } from "./commands/AssumeRoleWithWebIdentityCommand";
3
- const ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
4
- const decorateDefaultRegion = (region) => {
4
+ var ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
5
+ var decorateDefaultRegion = function (region) {
5
6
  if (typeof region !== "function") {
6
7
  return region === undefined ? ASSUME_ROLE_DEFAULT_REGION : region;
7
8
  }
8
- return async () => {
9
- try {
10
- return await region();
11
- }
12
- catch (e) {
13
- return ASSUME_ROLE_DEFAULT_REGION;
14
- }
15
- };
9
+ return function () { return __awaiter(void 0, void 0, void 0, function () {
10
+ var e_1;
11
+ return __generator(this, function (_a) {
12
+ switch (_a.label) {
13
+ case 0:
14
+ _a.trys.push([0, 2, , 3]);
15
+ return [4, region()];
16
+ case 1: return [2, _a.sent()];
17
+ case 2:
18
+ e_1 = _a.sent();
19
+ return [2, ASSUME_ROLE_DEFAULT_REGION];
20
+ case 3: return [2];
21
+ }
22
+ });
23
+ }); };
16
24
  };
17
- export const getDefaultRoleAssumer = (stsOptions, stsClientCtor) => {
18
- let stsClient;
19
- let closureSourceCreds;
20
- return async (sourceCreds, params) => {
21
- closureSourceCreds = sourceCreds;
22
- if (!stsClient) {
23
- const { logger, region, requestHandler } = stsOptions;
24
- stsClient = new stsClientCtor({
25
- logger,
26
- credentialDefaultProvider: () => async () => closureSourceCreds,
27
- region: decorateDefaultRegion(region || stsOptions.region),
28
- ...(requestHandler ? { requestHandler } : {}),
29
- });
30
- }
31
- const { Credentials } = await stsClient.send(new AssumeRoleCommand(params));
32
- if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
33
- throw new Error(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`);
34
- }
35
- return {
36
- accessKeyId: Credentials.AccessKeyId,
37
- secretAccessKey: Credentials.SecretAccessKey,
38
- sessionToken: Credentials.SessionToken,
39
- expiration: Credentials.Expiration,
40
- };
41
- };
25
+ export var getDefaultRoleAssumer = function (stsOptions, stsClientCtor) {
26
+ var stsClient;
27
+ var closureSourceCreds;
28
+ return function (sourceCreds, params) { return __awaiter(void 0, void 0, void 0, function () {
29
+ var logger, region, requestHandler, Credentials;
30
+ return __generator(this, function (_a) {
31
+ switch (_a.label) {
32
+ case 0:
33
+ closureSourceCreds = sourceCreds;
34
+ if (!stsClient) {
35
+ logger = stsOptions.logger, region = stsOptions.region, requestHandler = stsOptions.requestHandler;
36
+ stsClient = new stsClientCtor(__assign({ logger: logger, credentialDefaultProvider: function () { return function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
37
+ return [2, closureSourceCreds];
38
+ }); }); }; }, region: decorateDefaultRegion(region || stsOptions.region) }, (requestHandler ? { requestHandler: requestHandler } : {})));
39
+ }
40
+ return [4, stsClient.send(new AssumeRoleCommand(params))];
41
+ case 1:
42
+ Credentials = (_a.sent()).Credentials;
43
+ if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
44
+ throw new Error("Invalid response from STS.assumeRole call with role ".concat(params.RoleArn));
45
+ }
46
+ return [2, {
47
+ accessKeyId: Credentials.AccessKeyId,
48
+ secretAccessKey: Credentials.SecretAccessKey,
49
+ sessionToken: Credentials.SessionToken,
50
+ expiration: Credentials.Expiration,
51
+ }];
52
+ }
53
+ });
54
+ }); };
55
+ };
56
+ export var getDefaultRoleAssumerWithWebIdentity = function (stsOptions, stsClientCtor) {
57
+ var stsClient;
58
+ return function (params) { return __awaiter(void 0, void 0, void 0, function () {
59
+ var logger, region, requestHandler, Credentials;
60
+ return __generator(this, function (_a) {
61
+ switch (_a.label) {
62
+ case 0:
63
+ if (!stsClient) {
64
+ logger = stsOptions.logger, region = stsOptions.region, requestHandler = stsOptions.requestHandler;
65
+ stsClient = new stsClientCtor(__assign({ logger: logger, region: decorateDefaultRegion(region || stsOptions.region) }, (requestHandler ? { requestHandler: requestHandler } : {})));
66
+ }
67
+ return [4, stsClient.send(new AssumeRoleWithWebIdentityCommand(params))];
68
+ case 1:
69
+ Credentials = (_a.sent()).Credentials;
70
+ if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
71
+ throw new Error("Invalid response from STS.assumeRoleWithWebIdentity call with role ".concat(params.RoleArn));
72
+ }
73
+ return [2, {
74
+ accessKeyId: Credentials.AccessKeyId,
75
+ secretAccessKey: Credentials.SecretAccessKey,
76
+ sessionToken: Credentials.SessionToken,
77
+ expiration: Credentials.Expiration,
78
+ }];
79
+ }
80
+ });
81
+ }); };
42
82
  };
43
- export const getDefaultRoleAssumerWithWebIdentity = (stsOptions, stsClientCtor) => {
44
- let stsClient;
45
- return async (params) => {
46
- if (!stsClient) {
47
- const { logger, region, requestHandler } = stsOptions;
48
- stsClient = new stsClientCtor({
49
- logger,
50
- region: decorateDefaultRegion(region || stsOptions.region),
51
- ...(requestHandler ? { requestHandler } : {}),
52
- });
53
- }
54
- const { Credentials } = await stsClient.send(new AssumeRoleWithWebIdentityCommand(params));
55
- if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
56
- throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${params.RoleArn}`);
57
- }
58
- return {
59
- accessKeyId: Credentials.AccessKeyId,
60
- secretAccessKey: Credentials.SecretAccessKey,
61
- sessionToken: Credentials.SessionToken,
62
- expiration: Credentials.Expiration,
63
- };
83
+ export var decorateDefaultCredentialProvider = function (provider) {
84
+ return function (input) {
85
+ return provider(__assign({ roleAssumer: getDefaultRoleAssumer(input, input.stsClientCtor), roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input, input.stsClientCtor) }, input));
64
86
  };
65
87
  };
66
- export const decorateDefaultCredentialProvider = (provider) => (input) => provider({
67
- roleAssumer: getDefaultRoleAssumer(input, input.stsClientCtor),
68
- roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input, input.stsClientCtor),
69
- ...input,
70
- });
@@ -1,5 +1,6 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import { getRegionInfo } from "@aws-sdk/config-resolver";
2
- const regionHash = {
3
+ var regionHash = {
3
4
  "aws-global": {
4
5
  variants: [
5
6
  {
@@ -58,7 +59,7 @@ const regionHash = {
58
59
  ],
59
60
  },
60
61
  };
61
- const partitionHash = {
62
+ var partitionHash = {
62
63
  aws: {
63
64
  regions: [
64
65
  "af-south-1",
@@ -183,9 +184,8 @@ const partitionHash = {
183
184
  ],
184
185
  },
185
186
  };
186
- export const defaultRegionInfoProvider = async (region, options) => getRegionInfo(region, {
187
- ...options,
188
- signingService: "sts",
189
- regionHash,
190
- partitionHash,
191
- });
187
+ export var defaultRegionInfoProvider = function (region, options) { return __awaiter(void 0, void 0, void 0, function () {
188
+ return __generator(this, function (_a) {
189
+ return [2, getRegionInfo(region, __assign(__assign({}, options), { signingService: "sts", regionHash: regionHash, partitionHash: partitionHash }))];
190
+ });
191
+ }); };
@@ -1,7 +1,12 @@
1
+ import { __extends } from "tslib";
1
2
  import { ServiceException as __ServiceException, } from "@aws-sdk/smithy-client";
2
- export class STSServiceException extends __ServiceException {
3
- constructor(options) {
4
- super(options);
5
- Object.setPrototypeOf(this, STSServiceException.prototype);
3
+ var STSServiceException = (function (_super) {
4
+ __extends(STSServiceException, _super);
5
+ function STSServiceException(options) {
6
+ var _this = _super.call(this, options) || this;
7
+ Object.setPrototypeOf(_this, STSServiceException.prototype);
8
+ return _this;
6
9
  }
7
- }
10
+ return STSServiceException;
11
+ }(__ServiceException));
12
+ export { STSServiceException };