@aws-sdk/client-sts 3.185.0 → 3.188.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,41 +1,34 @@
1
- import { __extends } from "tslib";
2
1
  import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3
2
  import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
4
3
  import { Command as $Command } from "@aws-sdk/smithy-client";
5
4
  import { GetCallerIdentityRequestFilterSensitiveLog, GetCallerIdentityResponseFilterSensitiveLog, } from "../models/models_0";
6
5
  import { deserializeAws_queryGetCallerIdentityCommand, serializeAws_queryGetCallerIdentityCommand, } from "../protocols/Aws_query";
7
- var GetCallerIdentityCommand = (function (_super) {
8
- __extends(GetCallerIdentityCommand, _super);
9
- function GetCallerIdentityCommand(input) {
10
- var _this = _super.call(this) || this;
11
- _this.input = input;
12
- return _this;
6
+ export class GetCallerIdentityCommand extends $Command {
7
+ constructor(input) {
8
+ super();
9
+ this.input = input;
13
10
  }
14
- GetCallerIdentityCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
11
+ resolveMiddleware(clientStack, configuration, options) {
15
12
  this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
16
13
  this.middlewareStack.use(getAwsAuthPlugin(configuration));
17
- var stack = clientStack.concat(this.middlewareStack);
18
- var logger = configuration.logger;
19
- var clientName = "STSClient";
20
- var commandName = "GetCallerIdentityCommand";
21
- var handlerExecutionContext = {
22
- logger: logger,
23
- clientName: clientName,
24
- commandName: commandName,
14
+ const stack = clientStack.concat(this.middlewareStack);
15
+ const { logger } = configuration;
16
+ const clientName = "STSClient";
17
+ const commandName = "GetCallerIdentityCommand";
18
+ const handlerExecutionContext = {
19
+ logger,
20
+ clientName,
21
+ commandName,
25
22
  inputFilterSensitiveLog: GetCallerIdentityRequestFilterSensitiveLog,
26
23
  outputFilterSensitiveLog: GetCallerIdentityResponseFilterSensitiveLog,
27
24
  };
28
- var requestHandler = configuration.requestHandler;
29
- return stack.resolve(function (request) {
30
- return requestHandler.handle(request.request, options || {});
31
- }, handlerExecutionContext);
32
- };
33
- GetCallerIdentityCommand.prototype.serialize = function (input, context) {
25
+ const { requestHandler } = configuration;
26
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
27
+ }
28
+ serialize(input, context) {
34
29
  return serializeAws_queryGetCallerIdentityCommand(input, context);
35
- };
36
- GetCallerIdentityCommand.prototype.deserialize = function (output, context) {
30
+ }
31
+ deserialize(output, context) {
37
32
  return deserializeAws_queryGetCallerIdentityCommand(output, context);
38
- };
39
- return GetCallerIdentityCommand;
40
- }($Command));
41
- export { GetCallerIdentityCommand };
33
+ }
34
+ }
@@ -1,41 +1,34 @@
1
- import { __extends } from "tslib";
2
1
  import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3
2
  import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
4
3
  import { Command as $Command } from "@aws-sdk/smithy-client";
5
4
  import { GetFederationTokenRequestFilterSensitiveLog, GetFederationTokenResponseFilterSensitiveLog, } from "../models/models_0";
6
5
  import { deserializeAws_queryGetFederationTokenCommand, serializeAws_queryGetFederationTokenCommand, } from "../protocols/Aws_query";
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;
6
+ export class GetFederationTokenCommand extends $Command {
7
+ constructor(input) {
8
+ super();
9
+ this.input = input;
13
10
  }
14
- GetFederationTokenCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
11
+ resolveMiddleware(clientStack, configuration, options) {
15
12
  this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
16
13
  this.middlewareStack.use(getAwsAuthPlugin(configuration));
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,
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,
25
22
  inputFilterSensitiveLog: GetFederationTokenRequestFilterSensitiveLog,
26
23
  outputFilterSensitiveLog: GetFederationTokenResponseFilterSensitiveLog,
27
24
  };
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) {
25
+ const { requestHandler } = configuration;
26
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
27
+ }
28
+ serialize(input, context) {
34
29
  return serializeAws_queryGetFederationTokenCommand(input, context);
35
- };
36
- GetFederationTokenCommand.prototype.deserialize = function (output, context) {
30
+ }
31
+ deserialize(output, context) {
37
32
  return deserializeAws_queryGetFederationTokenCommand(output, context);
38
- };
39
- return GetFederationTokenCommand;
40
- }($Command));
41
- export { GetFederationTokenCommand };
33
+ }
34
+ }
@@ -1,41 +1,34 @@
1
- import { __extends } from "tslib";
2
1
  import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3
2
  import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
4
3
  import { Command as $Command } from "@aws-sdk/smithy-client";
5
4
  import { GetSessionTokenRequestFilterSensitiveLog, GetSessionTokenResponseFilterSensitiveLog, } from "../models/models_0";
6
5
  import { deserializeAws_queryGetSessionTokenCommand, serializeAws_queryGetSessionTokenCommand, } from "../protocols/Aws_query";
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;
6
+ export class GetSessionTokenCommand extends $Command {
7
+ constructor(input) {
8
+ super();
9
+ this.input = input;
13
10
  }
14
- GetSessionTokenCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
11
+ resolveMiddleware(clientStack, configuration, options) {
15
12
  this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
16
13
  this.middlewareStack.use(getAwsAuthPlugin(configuration));
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,
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,
25
22
  inputFilterSensitiveLog: GetSessionTokenRequestFilterSensitiveLog,
26
23
  outputFilterSensitiveLog: GetSessionTokenResponseFilterSensitiveLog,
27
24
  };
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) {
25
+ const { requestHandler } = configuration;
26
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
27
+ }
28
+ serialize(input, context) {
34
29
  return serializeAws_queryGetSessionTokenCommand(input, context);
35
- };
36
- GetSessionTokenCommand.prototype.deserialize = function (output, context) {
30
+ }
31
+ deserialize(output, context) {
37
32
  return deserializeAws_queryGetSessionTokenCommand(output, context);
38
- };
39
- return GetSessionTokenCommand;
40
- }($Command));
41
- export { GetSessionTokenCommand };
33
+ }
34
+ }
@@ -1,43 +1,22 @@
1
- import { __assign, __extends, __values } from "tslib";
2
1
  import { getDefaultRoleAssumer as StsGetDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity as StsGetDefaultRoleAssumerWithWebIdentity, } from "./defaultStsRoleAssumers";
3
2
  import { STSClient } from "./STSClient";
4
- var getCustomizableStsClientCtor = function (baseCtor, customizations) {
3
+ const getCustomizableStsClientCtor = (baseCtor, customizations) => {
5
4
  if (!customizations)
6
5
  return baseCtor;
7
6
  else
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
- }
7
+ return class CustomizableSTSClient extends baseCtor {
8
+ constructor(config) {
9
+ super(config);
10
+ for (const customization of customizations) {
11
+ this.middlewareStack.use(customization);
18
12
  }
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;
27
13
  }
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
- };
14
+ };
43
15
  };
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,87 +1,70 @@
1
- import { __assign, __awaiter, __generator } from "tslib";
2
1
  import { AssumeRoleCommand } from "./commands/AssumeRoleCommand";
3
2
  import { AssumeRoleWithWebIdentityCommand, } from "./commands/AssumeRoleWithWebIdentityCommand";
4
- var ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
5
- var decorateDefaultRegion = function (region) {
3
+ const ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
4
+ const decorateDefaultRegion = (region) => {
6
5
  if (typeof region !== "function") {
7
6
  return region === undefined ? ASSUME_ROLE_DEFAULT_REGION : region;
8
7
  }
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
- }); };
24
- };
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
- }); };
8
+ return async () => {
9
+ try {
10
+ return await region();
11
+ }
12
+ catch (e) {
13
+ return ASSUME_ROLE_DEFAULT_REGION;
14
+ }
15
+ };
55
16
  };
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
- }); };
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
+ };
82
42
  };
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));
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
+ };
86
64
  };
87
65
  };
66
+ export const decorateDefaultCredentialProvider = (provider) => (input) => provider({
67
+ roleAssumer: getDefaultRoleAssumer(input, input.stsClientCtor),
68
+ roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input, input.stsClientCtor),
69
+ ...input,
70
+ });
@@ -1,6 +1,5 @@
1
- import { __assign, __awaiter, __generator } from "tslib";
2
1
  import { getRegionInfo } from "@aws-sdk/config-resolver";
3
- var regionHash = {
2
+ const regionHash = {
4
3
  "aws-global": {
5
4
  variants: [
6
5
  {
@@ -59,7 +58,7 @@ var regionHash = {
59
58
  ],
60
59
  },
61
60
  };
62
- var partitionHash = {
61
+ const partitionHash = {
63
62
  aws: {
64
63
  regions: [
65
64
  "af-south-1",
@@ -184,8 +183,9 @@ var partitionHash = {
184
183
  ],
185
184
  },
186
185
  };
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
- }); };
186
+ export const defaultRegionInfoProvider = async (region, options) => getRegionInfo(region, {
187
+ ...options,
188
+ signingService: "sts",
189
+ regionHash,
190
+ partitionHash,
191
+ });
@@ -1,12 +1,7 @@
1
- import { __extends } from "tslib";
2
1
  import { ServiceException as __ServiceException, } from "@aws-sdk/smithy-client";
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;
2
+ export class STSServiceException extends __ServiceException {
3
+ constructor(options) {
4
+ super(options);
5
+ Object.setPrototypeOf(this, STSServiceException.prototype);
9
6
  }
10
- return STSServiceException;
11
- }(__ServiceException));
12
- export { STSServiceException };
7
+ }