Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(client-ec2): Adds an SDK paginator for GetNetworkInsightsAccessS…
…copeAnalysisFindings
- Loading branch information
awstools
committed
May 3, 2023
1 parent
bd6c71a
commit ed4b264
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
clients/client-ec2/src/pagination/GetNetworkInsightsAccessScopeAnalysisFindingsPaginator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters