1
1
// smithy-typescript generated code
2
+ import { createPaginator } from "@smithy/core" ;
2
3
import { Paginator } from "@smithy/types" ;
3
4
4
5
import { AccessAnalyzerClient } from "../AccessAnalyzerClient" ;
@@ -9,42 +10,15 @@ import {
9
10
} from "../commands/ListAccessPreviewFindingsCommand" ;
10
11
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces" ;
11
12
12
- /**
13
- * @internal
14
- */
15
- const makePagedClientRequest = async (
16
- client : AccessAnalyzerClient ,
17
- input : ListAccessPreviewFindingsCommandInput ,
18
- ...args : any
19
- ) : Promise < ListAccessPreviewFindingsCommandOutput > => {
20
- // @ts -ignore
21
- return await client . send ( new ListAccessPreviewFindingsCommand ( input ) , ...args ) ;
22
- } ;
23
13
/**
24
14
* @public
25
15
*/
26
- export async function * paginateListAccessPreviewFindings (
16
+ export const paginateListAccessPreviewFindings : (
27
17
config : AccessAnalyzerPaginationConfiguration ,
28
18
input : ListAccessPreviewFindingsCommandInput ,
29
- ...additionalArguments : any
30
- ) : Paginator < ListAccessPreviewFindingsCommandOutput > {
31
- // ToDo: replace with actual type instead of typeof input.nextToken
32
- let token : typeof input . nextToken | undefined = config . startingToken || undefined ;
33
- let hasNext = true ;
34
- let page : ListAccessPreviewFindingsCommandOutput ;
35
- while ( hasNext ) {
36
- input . nextToken = token ;
37
- input [ "maxResults" ] = config . pageSize ;
38
- if ( config . client instanceof AccessAnalyzerClient ) {
39
- page = await makePagedClientRequest ( config . client , input , ...additionalArguments ) ;
40
- } else {
41
- throw new Error ( "Invalid client, expected AccessAnalyzer | AccessAnalyzerClient" ) ;
42
- }
43
- yield page ;
44
- const prevToken = token ;
45
- token = page . nextToken ;
46
- hasNext = ! ! ( token && ( ! config . stopOnSameToken || token !== prevToken ) ) ;
47
- }
48
- // @ts -ignore
49
- return undefined ;
50
- }
19
+ ...rest : any [ ]
20
+ ) => Paginator < ListAccessPreviewFindingsCommandOutput > = createPaginator <
21
+ AccessAnalyzerPaginationConfiguration ,
22
+ ListAccessPreviewFindingsCommandInput ,
23
+ ListAccessPreviewFindingsCommandOutput
24
+ > ( AccessAnalyzerClient , ListAccessPreviewFindingsCommand , "nextToken" , "nextToken" , "maxResults" ) ;
0 commit comments