@aws-sdk/client-sso 3.32.0 → 3.36.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 (134) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/{dist/cjs → dist-cjs}/SSO.js +1 -2
  3. package/{dist/cjs → dist-cjs}/SSOClient.js +7 -8
  4. package/{dist/cjs → dist-cjs}/commands/GetRoleCredentialsCommand.js +2 -3
  5. package/{dist/cjs → dist-cjs}/commands/ListAccountRolesCommand.js +2 -3
  6. package/{dist/cjs → dist-cjs}/commands/ListAccountsCommand.js +2 -3
  7. package/{dist/cjs → dist-cjs}/commands/LogoutCommand.js +2 -3
  8. package/{dist/cjs → dist-cjs}/endpoints.js +0 -1
  9. package/{dist/cjs → dist-cjs}/index.js +0 -1
  10. package/{dist/cjs → dist-cjs}/models/index.js +0 -1
  11. package/{dist/cjs → dist-cjs}/models/models_0.js +0 -1
  12. package/{dist/cjs → dist-cjs}/pagination/Interfaces.js +0 -1
  13. package/{dist/cjs → dist-cjs}/pagination/ListAccountRolesPaginator.js +1 -2
  14. package/{dist/cjs → dist-cjs}/pagination/ListAccountsPaginator.js +1 -2
  15. package/{dist/cjs → dist-cjs}/protocols/Aws_restJson1.js +4 -5
  16. package/{dist/cjs → dist-cjs}/runtimeConfig.browser.js +2 -2
  17. package/{dist/cjs → dist-cjs}/runtimeConfig.js +2 -2
  18. package/{dist/cjs → dist-cjs}/runtimeConfig.native.js +0 -1
  19. package/{dist/cjs → dist-cjs}/runtimeConfig.shared.js +1 -2
  20. package/{dist/es → dist-es}/SSO.js +2 -21
  21. package/{dist/es → dist-es}/SSOClient.js +2 -26
  22. package/{dist/es → dist-es}/commands/GetRoleCredentialsCommand.js +4 -31
  23. package/{dist/es → dist-es}/commands/ListAccountRolesCommand.js +4 -30
  24. package/{dist/es → dist-es}/commands/ListAccountsCommand.js +4 -32
  25. package/{dist/es → dist-es}/commands/LogoutCommand.js +4 -30
  26. package/{dist/es → dist-es}/endpoints.js +1 -2
  27. package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
  28. package/{dist/types/models/index.d.ts → dist-es/models/index.js} +0 -0
  29. package/{dist/es → dist-es}/models/models_0.js +0 -43
  30. package/dist-es/pagination/Interfaces.js +1 -0
  31. package/{dist/es → dist-es}/pagination/ListAccountRolesPaginator.js +17 -30
  32. package/{dist/es → dist-es}/pagination/ListAccountsPaginator.js +17 -30
  33. package/{dist/es → dist-es}/protocols/Aws_restJson1.js +96 -102
  34. package/{dist/es → dist-es}/runtimeConfig.browser.js +1 -5
  35. package/{dist/es → dist-es}/runtimeConfig.js +1 -5
  36. package/{dist/es → dist-es}/runtimeConfig.native.js +0 -4
  37. package/{dist/es → dist-es}/runtimeConfig.shared.js +1 -5
  38. package/{dist/types → dist-types}/SSO.d.ts +2 -2
  39. package/{dist/types → dist-types}/SSOClient.d.ts +5 -5
  40. package/{dist/types → dist-types}/commands/GetRoleCredentialsCommand.d.ts +3 -3
  41. package/{dist/types → dist-types}/commands/ListAccountRolesCommand.d.ts +3 -3
  42. package/{dist/types → dist-types}/commands/ListAccountsCommand.d.ts +3 -3
  43. package/{dist/types → dist-types}/commands/LogoutCommand.d.ts +3 -3
  44. package/{dist/types → dist-types}/endpoints.d.ts +0 -0
  45. package/{index.ts → dist-types/index.d.ts} +0 -0
  46. package/{models/index.ts → dist-types/models/index.d.ts} +0 -0
  47. package/{dist/types → dist-types}/models/models_0.d.ts +0 -0
  48. package/{dist/types → dist-types}/pagination/Interfaces.d.ts +1 -1
  49. package/{dist/types → dist-types}/pagination/ListAccountRolesPaginator.d.ts +1 -1
  50. package/{dist/types → dist-types}/pagination/ListAccountsPaginator.d.ts +1 -1
  51. package/{dist/types → dist-types}/protocols/Aws_restJson1.d.ts +2 -2
  52. package/{dist/types → dist-types}/runtimeConfig.browser.d.ts +0 -0
  53. package/{dist/types → dist-types}/runtimeConfig.d.ts +0 -0
  54. package/{dist/types → dist-types}/runtimeConfig.native.d.ts +0 -0
  55. package/{dist/types → dist-types}/runtimeConfig.shared.d.ts +0 -0
  56. package/{dist/types → dist-types}/ts3.4/SSO.d.ts +2 -2
  57. package/{dist/types → dist-types}/ts3.4/SSOClient.d.ts +5 -5
  58. package/{dist/types → dist-types}/ts3.4/commands/GetRoleCredentialsCommand.d.ts +3 -3
  59. package/{dist/types → dist-types}/ts3.4/commands/ListAccountRolesCommand.d.ts +3 -3
  60. package/{dist/types → dist-types}/ts3.4/commands/ListAccountsCommand.d.ts +3 -3
  61. package/{dist/types → dist-types}/ts3.4/commands/LogoutCommand.d.ts +3 -3
  62. package/{dist/types → dist-types}/ts3.4/endpoints.d.ts +0 -0
  63. package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
  64. package/{dist/types → dist-types}/ts3.4/models/index.d.ts +0 -0
  65. package/{dist/types → dist-types}/ts3.4/models/models_0.d.ts +0 -0
  66. package/{dist/types → dist-types}/ts3.4/pagination/Interfaces.d.ts +1 -1
  67. package/{dist/types → dist-types}/ts3.4/pagination/ListAccountRolesPaginator.d.ts +1 -1
  68. package/{dist/types → dist-types}/ts3.4/pagination/ListAccountsPaginator.d.ts +1 -1
  69. package/{dist/types → dist-types}/ts3.4/protocols/Aws_restJson1.d.ts +2 -2
  70. package/{dist/types → dist-types}/ts3.4/runtimeConfig.browser.d.ts +0 -0
  71. package/{dist/types → dist-types}/ts3.4/runtimeConfig.d.ts +0 -0
  72. package/{dist/types → dist-types}/ts3.4/runtimeConfig.native.d.ts +0 -0
  73. package/{dist/types → dist-types}/ts3.4/runtimeConfig.shared.d.ts +0 -0
  74. package/package.json +49 -46
  75. package/SSO.ts +0 -160
  76. package/SSOClient.ts +0 -245
  77. package/commands/GetRoleCredentialsCommand.ts +0 -95
  78. package/commands/ListAccountRolesCommand.ts +0 -94
  79. package/commands/ListAccountsCommand.ts +0 -96
  80. package/commands/LogoutCommand.ts +0 -87
  81. package/dist/cjs/SSO.js.map +0 -1
  82. package/dist/cjs/SSOClient.js.map +0 -1
  83. package/dist/cjs/commands/GetRoleCredentialsCommand.js.map +0 -1
  84. package/dist/cjs/commands/ListAccountRolesCommand.js.map +0 -1
  85. package/dist/cjs/commands/ListAccountsCommand.js.map +0 -1
  86. package/dist/cjs/commands/LogoutCommand.js.map +0 -1
  87. package/dist/cjs/endpoints.js.map +0 -1
  88. package/dist/cjs/index.js.map +0 -1
  89. package/dist/cjs/models/index.js.map +0 -1
  90. package/dist/cjs/models/models_0.js.map +0 -1
  91. package/dist/cjs/package.json +0 -88
  92. package/dist/cjs/pagination/Interfaces.js.map +0 -1
  93. package/dist/cjs/pagination/ListAccountRolesPaginator.js.map +0 -1
  94. package/dist/cjs/pagination/ListAccountsPaginator.js.map +0 -1
  95. package/dist/cjs/protocols/Aws_restJson1.js.map +0 -1
  96. package/dist/cjs/runtimeConfig.browser.js.map +0 -1
  97. package/dist/cjs/runtimeConfig.js.map +0 -1
  98. package/dist/cjs/runtimeConfig.native.js.map +0 -1
  99. package/dist/cjs/runtimeConfig.shared.js.map +0 -1
  100. package/dist/es/SSO.js.map +0 -1
  101. package/dist/es/SSOClient.js.map +0 -1
  102. package/dist/es/commands/GetRoleCredentialsCommand.js.map +0 -1
  103. package/dist/es/commands/ListAccountRolesCommand.js.map +0 -1
  104. package/dist/es/commands/ListAccountsCommand.js.map +0 -1
  105. package/dist/es/commands/LogoutCommand.js.map +0 -1
  106. package/dist/es/endpoints.js.map +0 -1
  107. package/dist/es/index.js +0 -11
  108. package/dist/es/index.js.map +0 -1
  109. package/dist/es/models/index.js +0 -2
  110. package/dist/es/models/index.js.map +0 -1
  111. package/dist/es/models/models_0.js.map +0 -1
  112. package/dist/es/package.json +0 -88
  113. package/dist/es/pagination/Interfaces.js +0 -2
  114. package/dist/es/pagination/Interfaces.js.map +0 -1
  115. package/dist/es/pagination/ListAccountRolesPaginator.js.map +0 -1
  116. package/dist/es/pagination/ListAccountsPaginator.js.map +0 -1
  117. package/dist/es/protocols/Aws_restJson1.js.map +0 -1
  118. package/dist/es/runtimeConfig.browser.js.map +0 -1
  119. package/dist/es/runtimeConfig.js.map +0 -1
  120. package/dist/es/runtimeConfig.native.js.map +0 -1
  121. package/dist/es/runtimeConfig.shared.js.map +0 -1
  122. package/endpoints.ts +0 -94
  123. package/jest.config.js +0 -4
  124. package/models/models_0.ts +0 -334
  125. package/pagination/Interfaces.ts +0 -7
  126. package/pagination/ListAccountRolesPaginator.ts +0 -58
  127. package/pagination/ListAccountsPaginator.ts +0 -58
  128. package/protocols/Aws_restJson1.ts +0 -621
  129. package/runtimeConfig.browser.ts +0 -38
  130. package/runtimeConfig.native.ts +0 -16
  131. package/runtimeConfig.shared.ts +0 -16
  132. package/runtimeConfig.ts +0 -41
  133. package/tsconfig.es.json +0 -12
  134. package/tsconfig.json +0 -32
@@ -1,334 +0,0 @@
1
- import { SENSITIVE_STRING } from "@aws-sdk/smithy-client";
2
- import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types";
3
-
4
- /**
5
- * <p>Provides information about your AWS account.</p>
6
- */
7
- export interface AccountInfo {
8
- /**
9
- * <p>The identifier of the AWS account that is assigned to the user.</p>
10
- */
11
- accountId?: string;
12
-
13
- /**
14
- * <p>The display name of the AWS account that is assigned to the user.</p>
15
- */
16
- accountName?: string;
17
-
18
- /**
19
- * <p>The email address of the AWS account that is assigned to the user.</p>
20
- */
21
- emailAddress?: string;
22
- }
23
-
24
- export namespace AccountInfo {
25
- /**
26
- * @internal
27
- */
28
- export const filterSensitiveLog = (obj: AccountInfo): any => ({
29
- ...obj,
30
- });
31
- }
32
-
33
- export interface GetRoleCredentialsRequest {
34
- /**
35
- * <p>The friendly name of the role that is assigned to the user.</p>
36
- */
37
- roleName: string | undefined;
38
-
39
- /**
40
- * <p>The identifier for the AWS account that is assigned to the user.</p>
41
- */
42
- accountId: string | undefined;
43
-
44
- /**
45
- * <p>The token issued by the <code>CreateToken</code> API call. For more information, see
46
- * <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html">CreateToken</a> in the <i>AWS SSO OIDC API Reference Guide</i>.</p>
47
- */
48
- accessToken: string | undefined;
49
- }
50
-
51
- export namespace GetRoleCredentialsRequest {
52
- /**
53
- * @internal
54
- */
55
- export const filterSensitiveLog = (obj: GetRoleCredentialsRequest): any => ({
56
- ...obj,
57
- ...(obj.accessToken && { accessToken: SENSITIVE_STRING }),
58
- });
59
- }
60
-
61
- /**
62
- * <p>Provides information about the role credentials that are assigned to the user.</p>
63
- */
64
- export interface RoleCredentials {
65
- /**
66
- * <p>The identifier used for the temporary security credentials. For more information, see
67
- * <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html">Using Temporary Security Credentials to Request Access to AWS Resources</a> in the
68
- * <i>AWS IAM User Guide</i>.</p>
69
- */
70
- accessKeyId?: string;
71
-
72
- /**
73
- * <p>The key that is used to sign the request. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html">Using Temporary Security Credentials to Request Access to AWS Resources</a> in the
74
- * <i>AWS IAM User Guide</i>.</p>
75
- */
76
- secretAccessKey?: string;
77
-
78
- /**
79
- * <p>The token used for temporary credentials. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html">Using Temporary Security Credentials to Request Access to AWS Resources</a> in the
80
- * <i>AWS IAM User Guide</i>.</p>
81
- */
82
- sessionToken?: string;
83
-
84
- /**
85
- * <p>The date on which temporary security credentials expire.</p>
86
- */
87
- expiration?: number;
88
- }
89
-
90
- export namespace RoleCredentials {
91
- /**
92
- * @internal
93
- */
94
- export const filterSensitiveLog = (obj: RoleCredentials): any => ({
95
- ...obj,
96
- ...(obj.secretAccessKey && { secretAccessKey: SENSITIVE_STRING }),
97
- ...(obj.sessionToken && { sessionToken: SENSITIVE_STRING }),
98
- });
99
- }
100
-
101
- export interface GetRoleCredentialsResponse {
102
- /**
103
- * <p>The credentials for the role that is assigned to the user.</p>
104
- */
105
- roleCredentials?: RoleCredentials;
106
- }
107
-
108
- export namespace GetRoleCredentialsResponse {
109
- /**
110
- * @internal
111
- */
112
- export const filterSensitiveLog = (obj: GetRoleCredentialsResponse): any => ({
113
- ...obj,
114
- ...(obj.roleCredentials && { roleCredentials: RoleCredentials.filterSensitiveLog(obj.roleCredentials) }),
115
- });
116
- }
117
-
118
- /**
119
- * <p>Indicates that a problem occurred with the input to the request. For example, a required
120
- * parameter might be missing or out of range.</p>
121
- */
122
- export interface InvalidRequestException extends __SmithyException, $MetadataBearer {
123
- name: "InvalidRequestException";
124
- $fault: "client";
125
- message?: string;
126
- }
127
-
128
- export namespace InvalidRequestException {
129
- /**
130
- * @internal
131
- */
132
- export const filterSensitiveLog = (obj: InvalidRequestException): any => ({
133
- ...obj,
134
- });
135
- }
136
-
137
- /**
138
- * <p>The specified resource doesn't exist.</p>
139
- */
140
- export interface ResourceNotFoundException extends __SmithyException, $MetadataBearer {
141
- name: "ResourceNotFoundException";
142
- $fault: "client";
143
- message?: string;
144
- }
145
-
146
- export namespace ResourceNotFoundException {
147
- /**
148
- * @internal
149
- */
150
- export const filterSensitiveLog = (obj: ResourceNotFoundException): any => ({
151
- ...obj,
152
- });
153
- }
154
-
155
- /**
156
- * <p>Indicates that the request is being made too frequently and is more than what the server can handle.</p>
157
- */
158
- export interface TooManyRequestsException extends __SmithyException, $MetadataBearer {
159
- name: "TooManyRequestsException";
160
- $fault: "client";
161
- message?: string;
162
- }
163
-
164
- export namespace TooManyRequestsException {
165
- /**
166
- * @internal
167
- */
168
- export const filterSensitiveLog = (obj: TooManyRequestsException): any => ({
169
- ...obj,
170
- });
171
- }
172
-
173
- /**
174
- * <p>Indicates that the request is not authorized. This can happen due to an invalid access token in the request.</p>
175
- */
176
- export interface UnauthorizedException extends __SmithyException, $MetadataBearer {
177
- name: "UnauthorizedException";
178
- $fault: "client";
179
- message?: string;
180
- }
181
-
182
- export namespace UnauthorizedException {
183
- /**
184
- * @internal
185
- */
186
- export const filterSensitiveLog = (obj: UnauthorizedException): any => ({
187
- ...obj,
188
- });
189
- }
190
-
191
- export interface ListAccountRolesRequest {
192
- /**
193
- * <p>The page token from the previous response output when you request subsequent pages.</p>
194
- */
195
- nextToken?: string;
196
-
197
- /**
198
- * <p>The number of items that clients can request per page.</p>
199
- */
200
- maxResults?: number;
201
-
202
- /**
203
- * <p>The token issued by the <code>CreateToken</code> API call. For more information, see
204
- * <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html">CreateToken</a> in the <i>AWS SSO OIDC API Reference Guide</i>.</p>
205
- */
206
- accessToken: string | undefined;
207
-
208
- /**
209
- * <p>The identifier for the AWS account that is assigned to the user.</p>
210
- */
211
- accountId: string | undefined;
212
- }
213
-
214
- export namespace ListAccountRolesRequest {
215
- /**
216
- * @internal
217
- */
218
- export const filterSensitiveLog = (obj: ListAccountRolesRequest): any => ({
219
- ...obj,
220
- ...(obj.accessToken && { accessToken: SENSITIVE_STRING }),
221
- });
222
- }
223
-
224
- /**
225
- * <p>Provides information about the role that is assigned to the user.</p>
226
- */
227
- export interface RoleInfo {
228
- /**
229
- * <p>The friendly name of the role that is assigned to the user.</p>
230
- */
231
- roleName?: string;
232
-
233
- /**
234
- * <p>The identifier of the AWS account assigned to the user.</p>
235
- */
236
- accountId?: string;
237
- }
238
-
239
- export namespace RoleInfo {
240
- /**
241
- * @internal
242
- */
243
- export const filterSensitiveLog = (obj: RoleInfo): any => ({
244
- ...obj,
245
- });
246
- }
247
-
248
- export interface ListAccountRolesResponse {
249
- /**
250
- * <p>The page token client that is used to retrieve the list of accounts.</p>
251
- */
252
- nextToken?: string;
253
-
254
- /**
255
- * <p>A paginated response with the list of roles and the next token if more results are available.</p>
256
- */
257
- roleList?: RoleInfo[];
258
- }
259
-
260
- export namespace ListAccountRolesResponse {
261
- /**
262
- * @internal
263
- */
264
- export const filterSensitiveLog = (obj: ListAccountRolesResponse): any => ({
265
- ...obj,
266
- });
267
- }
268
-
269
- export interface ListAccountsRequest {
270
- /**
271
- * <p>(Optional) When requesting subsequent pages, this is the page token from the previous response output.</p>
272
- */
273
- nextToken?: string;
274
-
275
- /**
276
- * <p>This is the number of items clients can request per page.</p>
277
- */
278
- maxResults?: number;
279
-
280
- /**
281
- * <p>The token issued by the <code>CreateToken</code> API call. For more information, see
282
- * <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html">CreateToken</a> in the <i>AWS SSO OIDC API Reference Guide</i>.</p>
283
- */
284
- accessToken: string | undefined;
285
- }
286
-
287
- export namespace ListAccountsRequest {
288
- /**
289
- * @internal
290
- */
291
- export const filterSensitiveLog = (obj: ListAccountsRequest): any => ({
292
- ...obj,
293
- ...(obj.accessToken && { accessToken: SENSITIVE_STRING }),
294
- });
295
- }
296
-
297
- export interface ListAccountsResponse {
298
- /**
299
- * <p>The page token client that is used to retrieve the list of accounts.</p>
300
- */
301
- nextToken?: string;
302
-
303
- /**
304
- * <p>A paginated response with the list of account information and the next token if more results are available.</p>
305
- */
306
- accountList?: AccountInfo[];
307
- }
308
-
309
- export namespace ListAccountsResponse {
310
- /**
311
- * @internal
312
- */
313
- export const filterSensitiveLog = (obj: ListAccountsResponse): any => ({
314
- ...obj,
315
- });
316
- }
317
-
318
- export interface LogoutRequest {
319
- /**
320
- * <p>The token issued by the <code>CreateToken</code> API call. For more information, see
321
- * <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html">CreateToken</a> in the <i>AWS SSO OIDC API Reference Guide</i>.</p>
322
- */
323
- accessToken: string | undefined;
324
- }
325
-
326
- export namespace LogoutRequest {
327
- /**
328
- * @internal
329
- */
330
- export const filterSensitiveLog = (obj: LogoutRequest): any => ({
331
- ...obj,
332
- ...(obj.accessToken && { accessToken: SENSITIVE_STRING }),
333
- });
334
- }
@@ -1,7 +0,0 @@
1
- import { SSO } from "../SSO";
2
- import { SSOClient } from "../SSOClient";
3
- import { PaginationConfiguration } from "@aws-sdk/types";
4
-
5
- export interface SSOPaginationConfiguration extends PaginationConfiguration {
6
- client: SSO | SSOClient;
7
- }
@@ -1,58 +0,0 @@
1
- import { SSO } from "../SSO";
2
- import { SSOClient } from "../SSOClient";
3
- import {
4
- ListAccountRolesCommand,
5
- ListAccountRolesCommandInput,
6
- ListAccountRolesCommandOutput,
7
- } from "../commands/ListAccountRolesCommand";
8
- import { SSOPaginationConfiguration } from "./Interfaces";
9
- import { Paginator } from "@aws-sdk/types";
10
-
11
- /**
12
- * @private
13
- */
14
- const makePagedClientRequest = async (
15
- client: SSOClient,
16
- input: ListAccountRolesCommandInput,
17
- ...args: any
18
- ): Promise<ListAccountRolesCommandOutput> => {
19
- // @ts-ignore
20
- return await client.send(new ListAccountRolesCommand(input), ...args);
21
- };
22
- /**
23
- * @private
24
- */
25
- const makePagedRequest = async (
26
- client: SSO,
27
- input: ListAccountRolesCommandInput,
28
- ...args: any
29
- ): Promise<ListAccountRolesCommandOutput> => {
30
- // @ts-ignore
31
- return await client.listAccountRoles(input, ...args);
32
- };
33
- export async function* paginateListAccountRoles(
34
- config: SSOPaginationConfiguration,
35
- input: ListAccountRolesCommandInput,
36
- ...additionalArguments: any
37
- ): Paginator<ListAccountRolesCommandOutput> {
38
- // ToDo: replace with actual type instead of typeof input.nextToken
39
- let token: typeof input.nextToken | undefined = config.startingToken || undefined;
40
- let hasNext = true;
41
- let page: ListAccountRolesCommandOutput;
42
- while (hasNext) {
43
- input.nextToken = token;
44
- input["maxResults"] = config.pageSize;
45
- if (config.client instanceof SSO) {
46
- page = await makePagedRequest(config.client, input, ...additionalArguments);
47
- } else if (config.client instanceof SSOClient) {
48
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
49
- } else {
50
- throw new Error("Invalid client, expected SSO | SSOClient");
51
- }
52
- yield page;
53
- token = page.nextToken;
54
- hasNext = !!token;
55
- }
56
- // @ts-ignore
57
- return undefined;
58
- }
@@ -1,58 +0,0 @@
1
- import { SSO } from "../SSO";
2
- import { SSOClient } from "../SSOClient";
3
- import {
4
- ListAccountsCommand,
5
- ListAccountsCommandInput,
6
- ListAccountsCommandOutput,
7
- } from "../commands/ListAccountsCommand";
8
- import { SSOPaginationConfiguration } from "./Interfaces";
9
- import { Paginator } from "@aws-sdk/types";
10
-
11
- /**
12
- * @private
13
- */
14
- const makePagedClientRequest = async (
15
- client: SSOClient,
16
- input: ListAccountsCommandInput,
17
- ...args: any
18
- ): Promise<ListAccountsCommandOutput> => {
19
- // @ts-ignore
20
- return await client.send(new ListAccountsCommand(input), ...args);
21
- };
22
- /**
23
- * @private
24
- */
25
- const makePagedRequest = async (
26
- client: SSO,
27
- input: ListAccountsCommandInput,
28
- ...args: any
29
- ): Promise<ListAccountsCommandOutput> => {
30
- // @ts-ignore
31
- return await client.listAccounts(input, ...args);
32
- };
33
- export async function* paginateListAccounts(
34
- config: SSOPaginationConfiguration,
35
- input: ListAccountsCommandInput,
36
- ...additionalArguments: any
37
- ): Paginator<ListAccountsCommandOutput> {
38
- // ToDo: replace with actual type instead of typeof input.nextToken
39
- let token: typeof input.nextToken | undefined = config.startingToken || undefined;
40
- let hasNext = true;
41
- let page: ListAccountsCommandOutput;
42
- while (hasNext) {
43
- input.nextToken = token;
44
- input["maxResults"] = config.pageSize;
45
- if (config.client instanceof SSO) {
46
- page = await makePagedRequest(config.client, input, ...additionalArguments);
47
- } else if (config.client instanceof SSOClient) {
48
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
49
- } else {
50
- throw new Error("Invalid client, expected SSO | SSOClient");
51
- }
52
- yield page;
53
- token = page.nextToken;
54
- hasNext = !!token;
55
- }
56
- // @ts-ignore
57
- return undefined;
58
- }