@aws-sdk/client-redshift-data 3.181.0 → 3.183.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist-es/RedshiftData.js +42 -49
  3. package/dist-es/RedshiftDataClient.js +22 -28
  4. package/dist-es/commands/BatchExecuteStatementCommand.js +21 -28
  5. package/dist-es/commands/CancelStatementCommand.js +21 -28
  6. package/dist-es/commands/DescribeStatementCommand.js +21 -28
  7. package/dist-es/commands/DescribeTableCommand.js +21 -28
  8. package/dist-es/commands/ExecuteStatementCommand.js +21 -28
  9. package/dist-es/commands/GetStatementResultCommand.js +21 -28
  10. package/dist-es/commands/ListDatabasesCommand.js +21 -28
  11. package/dist-es/commands/ListSchemasCommand.js +21 -28
  12. package/dist-es/commands/ListStatementsCommand.js +21 -28
  13. package/dist-es/commands/ListTablesCommand.js +21 -28
  14. package/dist-es/endpoints.js +8 -8
  15. package/dist-es/models/RedshiftDataServiceException.js +5 -10
  16. package/dist-es/models/models_0.js +166 -117
  17. package/dist-es/pagination/DescribeTablePaginator.js +25 -68
  18. package/dist-es/pagination/GetStatementResultPaginator.js +24 -67
  19. package/dist-es/pagination/ListDatabasesPaginator.js +25 -68
  20. package/dist-es/pagination/ListSchemasPaginator.js +25 -68
  21. package/dist-es/pagination/ListStatementsPaginator.js +25 -68
  22. package/dist-es/pagination/ListTablesPaginator.js +25 -68
  23. package/dist-es/protocols/Aws_json1_1.js +747 -916
  24. package/dist-es/runtimeConfig.browser.js +26 -12
  25. package/dist-es/runtimeConfig.js +30 -12
  26. package/dist-es/runtimeConfig.native.js +8 -5
  27. package/dist-es/runtimeConfig.shared.js +8 -11
  28. package/package.json +33 -33
@@ -1,85 +1,84 @@
1
- import { __assign, __extends } from "tslib";
2
1
  import { RedshiftDataServiceException as __BaseException } from "./RedshiftDataServiceException";
3
- var ActiveStatementsExceededException = (function (_super) {
4
- __extends(ActiveStatementsExceededException, _super);
5
- function ActiveStatementsExceededException(opts) {
6
- var _this = _super.call(this, __assign({ name: "ActiveStatementsExceededException", $fault: "client" }, opts)) || this;
7
- _this.name = "ActiveStatementsExceededException";
8
- _this.$fault = "client";
9
- Object.setPrototypeOf(_this, ActiveStatementsExceededException.prototype);
10
- _this.Message = opts.Message;
11
- return _this;
2
+ export class ActiveStatementsExceededException extends __BaseException {
3
+ constructor(opts) {
4
+ super({
5
+ name: "ActiveStatementsExceededException",
6
+ $fault: "client",
7
+ ...opts,
8
+ });
9
+ this.name = "ActiveStatementsExceededException";
10
+ this.$fault = "client";
11
+ Object.setPrototypeOf(this, ActiveStatementsExceededException.prototype);
12
+ this.Message = opts.Message;
12
13
  }
13
- return ActiveStatementsExceededException;
14
- }(__BaseException));
15
- export { ActiveStatementsExceededException };
16
- var BatchExecuteStatementException = (function (_super) {
17
- __extends(BatchExecuteStatementException, _super);
18
- function BatchExecuteStatementException(opts) {
19
- var _this = _super.call(this, __assign({ name: "BatchExecuteStatementException", $fault: "server" }, opts)) || this;
20
- _this.name = "BatchExecuteStatementException";
21
- _this.$fault = "server";
22
- Object.setPrototypeOf(_this, BatchExecuteStatementException.prototype);
23
- _this.Message = opts.Message;
24
- _this.StatementId = opts.StatementId;
25
- return _this;
14
+ }
15
+ export class BatchExecuteStatementException extends __BaseException {
16
+ constructor(opts) {
17
+ super({
18
+ name: "BatchExecuteStatementException",
19
+ $fault: "server",
20
+ ...opts,
21
+ });
22
+ this.name = "BatchExecuteStatementException";
23
+ this.$fault = "server";
24
+ Object.setPrototypeOf(this, BatchExecuteStatementException.prototype);
25
+ this.Message = opts.Message;
26
+ this.StatementId = opts.StatementId;
26
27
  }
27
- return BatchExecuteStatementException;
28
- }(__BaseException));
29
- export { BatchExecuteStatementException };
30
- var ValidationException = (function (_super) {
31
- __extends(ValidationException, _super);
32
- function ValidationException(opts) {
33
- var _this = _super.call(this, __assign({ name: "ValidationException", $fault: "client" }, opts)) || this;
34
- _this.name = "ValidationException";
35
- _this.$fault = "client";
36
- Object.setPrototypeOf(_this, ValidationException.prototype);
37
- _this.Message = opts.Message;
38
- return _this;
28
+ }
29
+ export class ValidationException extends __BaseException {
30
+ constructor(opts) {
31
+ super({
32
+ name: "ValidationException",
33
+ $fault: "client",
34
+ ...opts,
35
+ });
36
+ this.name = "ValidationException";
37
+ this.$fault = "client";
38
+ Object.setPrototypeOf(this, ValidationException.prototype);
39
+ this.Message = opts.Message;
39
40
  }
40
- return ValidationException;
41
- }(__BaseException));
42
- export { ValidationException };
43
- var DatabaseConnectionException = (function (_super) {
44
- __extends(DatabaseConnectionException, _super);
45
- function DatabaseConnectionException(opts) {
46
- var _this = _super.call(this, __assign({ name: "DatabaseConnectionException", $fault: "server" }, opts)) || this;
47
- _this.name = "DatabaseConnectionException";
48
- _this.$fault = "server";
49
- Object.setPrototypeOf(_this, DatabaseConnectionException.prototype);
50
- _this.Message = opts.Message;
51
- return _this;
41
+ }
42
+ export class DatabaseConnectionException extends __BaseException {
43
+ constructor(opts) {
44
+ super({
45
+ name: "DatabaseConnectionException",
46
+ $fault: "server",
47
+ ...opts,
48
+ });
49
+ this.name = "DatabaseConnectionException";
50
+ this.$fault = "server";
51
+ Object.setPrototypeOf(this, DatabaseConnectionException.prototype);
52
+ this.Message = opts.Message;
52
53
  }
53
- return DatabaseConnectionException;
54
- }(__BaseException));
55
- export { DatabaseConnectionException };
56
- var InternalServerException = (function (_super) {
57
- __extends(InternalServerException, _super);
58
- function InternalServerException(opts) {
59
- var _this = _super.call(this, __assign({ name: "InternalServerException", $fault: "server" }, opts)) || this;
60
- _this.name = "InternalServerException";
61
- _this.$fault = "server";
62
- Object.setPrototypeOf(_this, InternalServerException.prototype);
63
- _this.Message = opts.Message;
64
- return _this;
54
+ }
55
+ export class InternalServerException extends __BaseException {
56
+ constructor(opts) {
57
+ super({
58
+ name: "InternalServerException",
59
+ $fault: "server",
60
+ ...opts,
61
+ });
62
+ this.name = "InternalServerException";
63
+ this.$fault = "server";
64
+ Object.setPrototypeOf(this, InternalServerException.prototype);
65
+ this.Message = opts.Message;
65
66
  }
66
- return InternalServerException;
67
- }(__BaseException));
68
- export { InternalServerException };
69
- var ResourceNotFoundException = (function (_super) {
70
- __extends(ResourceNotFoundException, _super);
71
- function ResourceNotFoundException(opts) {
72
- var _this = _super.call(this, __assign({ name: "ResourceNotFoundException", $fault: "client" }, opts)) || this;
73
- _this.name = "ResourceNotFoundException";
74
- _this.$fault = "client";
75
- Object.setPrototypeOf(_this, ResourceNotFoundException.prototype);
76
- _this.Message = opts.Message;
77
- _this.ResourceId = opts.ResourceId;
78
- return _this;
67
+ }
68
+ export class ResourceNotFoundException extends __BaseException {
69
+ constructor(opts) {
70
+ super({
71
+ name: "ResourceNotFoundException",
72
+ $fault: "client",
73
+ ...opts,
74
+ });
75
+ this.name = "ResourceNotFoundException";
76
+ this.$fault = "client";
77
+ Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
78
+ this.Message = opts.Message;
79
+ this.ResourceId = opts.ResourceId;
79
80
  }
80
- return ResourceNotFoundException;
81
- }(__BaseException));
82
- export { ResourceNotFoundException };
81
+ }
83
82
  export var StatusString;
84
83
  (function (StatusString) {
85
84
  StatusString["ABORTED"] = "ABORTED";
@@ -99,23 +98,23 @@ export var StatementStatusString;
99
98
  StatementStatusString["STARTED"] = "STARTED";
100
99
  StatementStatusString["SUBMITTED"] = "SUBMITTED";
101
100
  })(StatementStatusString || (StatementStatusString = {}));
102
- var ExecuteStatementException = (function (_super) {
103
- __extends(ExecuteStatementException, _super);
104
- function ExecuteStatementException(opts) {
105
- var _this = _super.call(this, __assign({ name: "ExecuteStatementException", $fault: "server" }, opts)) || this;
106
- _this.name = "ExecuteStatementException";
107
- _this.$fault = "server";
108
- Object.setPrototypeOf(_this, ExecuteStatementException.prototype);
109
- _this.Message = opts.Message;
110
- _this.StatementId = opts.StatementId;
111
- return _this;
101
+ export class ExecuteStatementException extends __BaseException {
102
+ constructor(opts) {
103
+ super({
104
+ name: "ExecuteStatementException",
105
+ $fault: "server",
106
+ ...opts,
107
+ });
108
+ this.name = "ExecuteStatementException";
109
+ this.$fault = "server";
110
+ Object.setPrototypeOf(this, ExecuteStatementException.prototype);
111
+ this.Message = opts.Message;
112
+ this.StatementId = opts.StatementId;
112
113
  }
113
- return ExecuteStatementException;
114
- }(__BaseException));
115
- export { ExecuteStatementException };
114
+ }
116
115
  export var Field;
117
116
  (function (Field) {
118
- Field.visit = function (value, visitor) {
117
+ Field.visit = (value, visitor) => {
119
118
  if (value.isNull !== undefined)
120
119
  return visitor.isNull(value.isNull);
121
120
  if (value.booleanValue !== undefined)
@@ -131,21 +130,46 @@ export var Field;
131
130
  return visitor._(value.$unknown[0], value.$unknown[1]);
132
131
  };
133
132
  })(Field || (Field = {}));
134
- export var BatchExecuteStatementInputFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
135
- export var BatchExecuteStatementOutputFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
136
- export var CancelStatementRequestFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
137
- export var CancelStatementResponseFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
138
- export var ColumnMetadataFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
139
- export var DescribeStatementRequestFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
140
- export var SqlParameterFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
141
- export var SubStatementDataFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
142
- export var DescribeStatementResponseFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
143
- export var DescribeTableRequestFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
144
- export var DescribeTableResponseFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
145
- export var ExecuteStatementInputFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
146
- export var ExecuteStatementOutputFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
147
- export var FieldFilterSensitiveLog = function (obj) {
148
- var _a;
133
+ export const BatchExecuteStatementInputFilterSensitiveLog = (obj) => ({
134
+ ...obj,
135
+ });
136
+ export const BatchExecuteStatementOutputFilterSensitiveLog = (obj) => ({
137
+ ...obj,
138
+ });
139
+ export const CancelStatementRequestFilterSensitiveLog = (obj) => ({
140
+ ...obj,
141
+ });
142
+ export const CancelStatementResponseFilterSensitiveLog = (obj) => ({
143
+ ...obj,
144
+ });
145
+ export const ColumnMetadataFilterSensitiveLog = (obj) => ({
146
+ ...obj,
147
+ });
148
+ export const DescribeStatementRequestFilterSensitiveLog = (obj) => ({
149
+ ...obj,
150
+ });
151
+ export const SqlParameterFilterSensitiveLog = (obj) => ({
152
+ ...obj,
153
+ });
154
+ export const SubStatementDataFilterSensitiveLog = (obj) => ({
155
+ ...obj,
156
+ });
157
+ export const DescribeStatementResponseFilterSensitiveLog = (obj) => ({
158
+ ...obj,
159
+ });
160
+ export const DescribeTableRequestFilterSensitiveLog = (obj) => ({
161
+ ...obj,
162
+ });
163
+ export const DescribeTableResponseFilterSensitiveLog = (obj) => ({
164
+ ...obj,
165
+ });
166
+ export const ExecuteStatementInputFilterSensitiveLog = (obj) => ({
167
+ ...obj,
168
+ });
169
+ export const ExecuteStatementOutputFilterSensitiveLog = (obj) => ({
170
+ ...obj,
171
+ });
172
+ export const FieldFilterSensitiveLog = (obj) => {
149
173
  if (obj.isNull !== undefined)
150
174
  return { isNull: obj.isNull };
151
175
  if (obj.booleanValue !== undefined)
@@ -159,17 +183,42 @@ export var FieldFilterSensitiveLog = function (obj) {
159
183
  if (obj.blobValue !== undefined)
160
184
  return { blobValue: obj.blobValue };
161
185
  if (obj.$unknown !== undefined)
162
- return _a = {}, _a[obj.$unknown[0]] = "UNKNOWN", _a;
186
+ return { [obj.$unknown[0]]: "UNKNOWN" };
163
187
  };
164
- export var GetStatementResultRequestFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
165
- export var GetStatementResultResponseFilterSensitiveLog = function (obj) { return (__assign(__assign({}, obj), (obj.Records && { Records: obj.Records.map(function (item) { return item.map(function (item) { return FieldFilterSensitiveLog(item); }); }) }))); };
166
- export var ListDatabasesRequestFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
167
- export var ListDatabasesResponseFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
168
- export var ListSchemasRequestFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
169
- export var ListSchemasResponseFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
170
- export var ListStatementsRequestFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
171
- export var StatementDataFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
172
- export var ListStatementsResponseFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
173
- export var ListTablesRequestFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
174
- export var TableMemberFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
175
- export var ListTablesResponseFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
188
+ export const GetStatementResultRequestFilterSensitiveLog = (obj) => ({
189
+ ...obj,
190
+ });
191
+ export const GetStatementResultResponseFilterSensitiveLog = (obj) => ({
192
+ ...obj,
193
+ ...(obj.Records && { Records: obj.Records.map((item) => item.map((item) => FieldFilterSensitiveLog(item))) }),
194
+ });
195
+ export const ListDatabasesRequestFilterSensitiveLog = (obj) => ({
196
+ ...obj,
197
+ });
198
+ export const ListDatabasesResponseFilterSensitiveLog = (obj) => ({
199
+ ...obj,
200
+ });
201
+ export const ListSchemasRequestFilterSensitiveLog = (obj) => ({
202
+ ...obj,
203
+ });
204
+ export const ListSchemasResponseFilterSensitiveLog = (obj) => ({
205
+ ...obj,
206
+ });
207
+ export const ListStatementsRequestFilterSensitiveLog = (obj) => ({
208
+ ...obj,
209
+ });
210
+ export const StatementDataFilterSensitiveLog = (obj) => ({
211
+ ...obj,
212
+ });
213
+ export const ListStatementsResponseFilterSensitiveLog = (obj) => ({
214
+ ...obj,
215
+ });
216
+ export const ListTablesRequestFilterSensitiveLog = (obj) => ({
217
+ ...obj,
218
+ });
219
+ export const TableMemberFilterSensitiveLog = (obj) => ({
220
+ ...obj,
221
+ });
222
+ export const ListTablesResponseFilterSensitiveLog = (obj) => ({
223
+ ...obj,
224
+ });
@@ -1,75 +1,32 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { DescribeTableCommand, } from "../commands/DescribeTableCommand";
3
2
  import { RedshiftData } from "../RedshiftData";
4
3
  import { RedshiftDataClient } from "../RedshiftDataClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new DescribeTableCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new DescribeTableCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.describeTable.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.describeTable(input, ...args);
32
9
  };
33
- export function paginateDescribeTable(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateDescribeTable(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.NextToken = token;
16
+ input["MaxResults"] = config.pageSize;
17
+ if (config.client instanceof RedshiftData) {
18
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
19
+ }
20
+ else if (config.client instanceof RedshiftDataClient) {
21
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
22
+ }
23
+ else {
24
+ throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient");
25
+ }
26
+ yield page;
27
+ const prevToken = token;
28
+ token = page.NextToken;
29
+ hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
37
30
  }
38
- return __asyncGenerator(this, arguments, function paginateDescribeTable_1() {
39
- var token, hasNext, page, prevToken;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.NextToken = token;
49
- input["MaxResults"] = config.pageSize;
50
- if (!(config.client instanceof RedshiftData)) return [3, 3];
51
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
52
- case 2:
53
- page = _a.sent();
54
- return [3, 6];
55
- case 3:
56
- if (!(config.client instanceof RedshiftDataClient)) return [3, 5];
57
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
58
- case 4:
59
- page = _a.sent();
60
- return [3, 6];
61
- case 5: throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient");
62
- case 6: return [4, __await(page)];
63
- case 7: return [4, _a.sent()];
64
- case 8:
65
- _a.sent();
66
- prevToken = token;
67
- token = page.NextToken;
68
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
69
- return [3, 1];
70
- case 9: return [4, __await(undefined)];
71
- case 10: return [2, _a.sent()];
72
- }
73
- });
74
- });
31
+ return undefined;
75
32
  }
@@ -1,74 +1,31 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { GetStatementResultCommand, } from "../commands/GetStatementResultCommand";
3
2
  import { RedshiftData } from "../RedshiftData";
4
3
  import { RedshiftDataClient } from "../RedshiftDataClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new GetStatementResultCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new GetStatementResultCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.getStatementResult.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.getStatementResult(input, ...args);
32
9
  };
33
- export function paginateGetStatementResult(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateGetStatementResult(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.NextToken = token;
16
+ if (config.client instanceof RedshiftData) {
17
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
18
+ }
19
+ else if (config.client instanceof RedshiftDataClient) {
20
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
21
+ }
22
+ else {
23
+ throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient");
24
+ }
25
+ yield page;
26
+ const prevToken = token;
27
+ token = page.NextToken;
28
+ hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
37
29
  }
38
- return __asyncGenerator(this, arguments, function paginateGetStatementResult_1() {
39
- var token, hasNext, page, prevToken;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.NextToken = token;
49
- if (!(config.client instanceof RedshiftData)) return [3, 3];
50
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
51
- case 2:
52
- page = _a.sent();
53
- return [3, 6];
54
- case 3:
55
- if (!(config.client instanceof RedshiftDataClient)) return [3, 5];
56
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
57
- case 4:
58
- page = _a.sent();
59
- return [3, 6];
60
- case 5: throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient");
61
- case 6: return [4, __await(page)];
62
- case 7: return [4, _a.sent()];
63
- case 8:
64
- _a.sent();
65
- prevToken = token;
66
- token = page.NextToken;
67
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
68
- return [3, 1];
69
- case 9: return [4, __await(undefined)];
70
- case 10: return [2, _a.sent()];
71
- }
72
- });
73
- });
30
+ return undefined;
74
31
  }
@@ -1,75 +1,32 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { ListDatabasesCommand, } from "../commands/ListDatabasesCommand";
3
2
  import { RedshiftData } from "../RedshiftData";
4
3
  import { RedshiftDataClient } from "../RedshiftDataClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new ListDatabasesCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new ListDatabasesCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.listDatabases.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.listDatabases(input, ...args);
32
9
  };
33
- export function paginateListDatabases(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateListDatabases(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.NextToken = token;
16
+ input["MaxResults"] = config.pageSize;
17
+ if (config.client instanceof RedshiftData) {
18
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
19
+ }
20
+ else if (config.client instanceof RedshiftDataClient) {
21
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
22
+ }
23
+ else {
24
+ throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient");
25
+ }
26
+ yield page;
27
+ const prevToken = token;
28
+ token = page.NextToken;
29
+ hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
37
30
  }
38
- return __asyncGenerator(this, arguments, function paginateListDatabases_1() {
39
- var token, hasNext, page, prevToken;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.NextToken = token;
49
- input["MaxResults"] = config.pageSize;
50
- if (!(config.client instanceof RedshiftData)) return [3, 3];
51
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
52
- case 2:
53
- page = _a.sent();
54
- return [3, 6];
55
- case 3:
56
- if (!(config.client instanceof RedshiftDataClient)) return [3, 5];
57
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
58
- case 4:
59
- page = _a.sent();
60
- return [3, 6];
61
- case 5: throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient");
62
- case 6: return [4, __await(page)];
63
- case 7: return [4, _a.sent()];
64
- case 8:
65
- _a.sent();
66
- prevToken = token;
67
- token = page.NextToken;
68
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
69
- return [3, 1];
70
- case 9: return [4, __await(undefined)];
71
- case 10: return [2, _a.sent()];
72
- }
73
- });
74
- });
31
+ return undefined;
75
32
  }