Skip to content

Commit

Permalink
feat(client-ec2): Adds an SDK paginator for GetNetworkInsightsAccessS…
Browse files Browse the repository at this point in the history
…copeAnalysisFindings
  • Loading branch information
awstools committed May 3, 2023
1 parent bd6c71a commit ed4b264
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
@@ -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;
}
1 change: 1 addition & 0 deletions clients/client-ec2/src/pagination/index.ts
Expand Up @@ -131,6 +131,7 @@ export * from "./GetIpamPoolCidrsPaginator";
export * from "./GetIpamResourceCidrsPaginator";
export * from "./GetManagedPrefixListAssociationsPaginator";
export * from "./GetManagedPrefixListEntriesPaginator";
export * from "./GetNetworkInsightsAccessScopeAnalysisFindingsPaginator";
export * from "./GetSpotPlacementScoresPaginator";
export * from "./GetTransitGatewayAttachmentPropagationsPaginator";
export * from "./GetTransitGatewayMulticastDomainAssociationsPaginator";
Expand Down
8 changes: 7 additions & 1 deletion codegen/sdk-codegen/aws-models/ec2.json
Expand Up @@ -48149,7 +48149,13 @@
"target": "com.amazonaws.ec2#GetNetworkInsightsAccessScopeAnalysisFindingsResult"
},
"traits": {
"smithy.api#documentation": "<p>Gets the findings for the specified Network Access Scope analysis.</p>"
"smithy.api#documentation": "<p>Gets the findings for the specified Network Access Scope analysis.</p>",
"smithy.api#paginated": {
"inputToken": "NextToken",
"outputToken": "NextToken",
"items": "AnalysisFindings",
"pageSize": "MaxResults"
}
}
},
"com.amazonaws.ec2#GetNetworkInsightsAccessScopeAnalysisFindingsRequest": {
Expand Down

0 comments on commit ed4b264

Please sign in to comment.