/
GetNetworkInsightsAccessScopeAnalysisFindingsPaginator.ts
50 lines (48 loc) · 1.83 KB
/
GetNetworkInsightsAccessScopeAnalysisFindingsPaginator.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// smithy-typescript generated code
import { Paginator } from "@aws-sdk/types";
import {
GetNetworkInsightsAccessScopeAnalysisFindingsCommand,
GetNetworkInsightsAccessScopeAnalysisFindingsCommandInput,
GetNetworkInsightsAccessScopeAnalysisFindingsCommandOutput,
} from "../commands/GetNetworkInsightsAccessScopeAnalysisFindingsCommand";
import { EC2Client } from "../EC2Client";
import { EC2PaginationConfiguration } from "./Interfaces";
/**
* @internal
*/
const makePagedClientRequest = async (
client: EC2Client,
input: GetNetworkInsightsAccessScopeAnalysisFindingsCommandInput,
...args: any
): Promise<GetNetworkInsightsAccessScopeAnalysisFindingsCommandOutput> => {
// @ts-ignore
return await client.send(new GetNetworkInsightsAccessScopeAnalysisFindingsCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateGetNetworkInsightsAccessScopeAnalysisFindings(
config: EC2PaginationConfiguration,
input: GetNetworkInsightsAccessScopeAnalysisFindingsCommandInput,
...additionalArguments: any
): Paginator<GetNetworkInsightsAccessScopeAnalysisFindingsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.NextToken
let token: typeof input.NextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: GetNetworkInsightsAccessScopeAnalysisFindingsCommandOutput;
while (hasNext) {
input.NextToken = token;
input["MaxResults"] = config.pageSize;
if (config.client instanceof EC2Client) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected EC2 | EC2Client");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}