Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: codegen for paginator factory #5590

Merged
merged 6 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// smithy-typescript generated code
import { createPaginator } from "@smithy/core";
import { Paginator } from "@smithy/types";

import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
Expand All @@ -9,42 +10,15 @@ import {
} from "../commands/GetFindingV2Command";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: GetFindingV2CommandInput,
...args: any
): Promise<GetFindingV2CommandOutput> => {
// @ts-ignore
return await client.send(new GetFindingV2Command(input), ...args);
};
/**
* @public
*/
export async function* paginateGetFindingV2(
export const paginateGetFindingV2: (
config: AccessAnalyzerPaginationConfiguration,
input: GetFindingV2CommandInput,
...additionalArguments: any
): Paginator<GetFindingV2CommandOutput> {
// ToDo: replace with actual type instead of typeof input.nextToken
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: GetFindingV2CommandOutput;
while (hasNext) {
input.nextToken = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
...rest: any[]
) => Paginator<GetFindingV2CommandOutput> = createPaginator<
AccessAnalyzerPaginationConfiguration,
GetFindingV2CommandInput,
GetFindingV2CommandOutput
>(AccessAnalyzerClient, GetFindingV2Command, "nextToken", "nextToken", "maxResults");
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// smithy-typescript generated code
import { createPaginator } from "@smithy/core";
import { Paginator } from "@smithy/types";

import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
Expand All @@ -9,42 +10,15 @@ import {
} from "../commands/ListAccessPreviewFindingsCommand";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: ListAccessPreviewFindingsCommandInput,
...args: any
): Promise<ListAccessPreviewFindingsCommandOutput> => {
// @ts-ignore
return await client.send(new ListAccessPreviewFindingsCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListAccessPreviewFindings(
export const paginateListAccessPreviewFindings: (
config: AccessAnalyzerPaginationConfiguration,
input: ListAccessPreviewFindingsCommandInput,
...additionalArguments: any
): Paginator<ListAccessPreviewFindingsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.nextToken
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListAccessPreviewFindingsCommandOutput;
while (hasNext) {
input.nextToken = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
...rest: any[]
) => Paginator<ListAccessPreviewFindingsCommandOutput> = createPaginator<
AccessAnalyzerPaginationConfiguration,
ListAccessPreviewFindingsCommandInput,
ListAccessPreviewFindingsCommandOutput
>(AccessAnalyzerClient, ListAccessPreviewFindingsCommand, "nextToken", "nextToken", "maxResults");
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// smithy-typescript generated code
import { createPaginator } from "@smithy/core";
import { Paginator } from "@smithy/types";

import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
Expand All @@ -9,42 +10,15 @@ import {
} from "../commands/ListAccessPreviewsCommand";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: ListAccessPreviewsCommandInput,
...args: any
): Promise<ListAccessPreviewsCommandOutput> => {
// @ts-ignore
return await client.send(new ListAccessPreviewsCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListAccessPreviews(
export const paginateListAccessPreviews: (
config: AccessAnalyzerPaginationConfiguration,
input: ListAccessPreviewsCommandInput,
...additionalArguments: any
): Paginator<ListAccessPreviewsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.nextToken
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListAccessPreviewsCommandOutput;
while (hasNext) {
input.nextToken = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
...rest: any[]
) => Paginator<ListAccessPreviewsCommandOutput> = createPaginator<
AccessAnalyzerPaginationConfiguration,
ListAccessPreviewsCommandInput,
ListAccessPreviewsCommandOutput
>(AccessAnalyzerClient, ListAccessPreviewsCommand, "nextToken", "nextToken", "maxResults");
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// smithy-typescript generated code
import { createPaginator } from "@smithy/core";
import { Paginator } from "@smithy/types";

import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
Expand All @@ -9,42 +10,15 @@ import {
} from "../commands/ListAnalyzedResourcesCommand";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: ListAnalyzedResourcesCommandInput,
...args: any
): Promise<ListAnalyzedResourcesCommandOutput> => {
// @ts-ignore
return await client.send(new ListAnalyzedResourcesCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListAnalyzedResources(
export const paginateListAnalyzedResources: (
config: AccessAnalyzerPaginationConfiguration,
input: ListAnalyzedResourcesCommandInput,
...additionalArguments: any
): Paginator<ListAnalyzedResourcesCommandOutput> {
// ToDo: replace with actual type instead of typeof input.nextToken
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListAnalyzedResourcesCommandOutput;
while (hasNext) {
input.nextToken = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
...rest: any[]
) => Paginator<ListAnalyzedResourcesCommandOutput> = createPaginator<
AccessAnalyzerPaginationConfiguration,
ListAnalyzedResourcesCommandInput,
ListAnalyzedResourcesCommandOutput
>(AccessAnalyzerClient, ListAnalyzedResourcesCommand, "nextToken", "nextToken", "maxResults");
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// smithy-typescript generated code
import { createPaginator } from "@smithy/core";
import { Paginator } from "@smithy/types";

import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
Expand All @@ -9,42 +10,15 @@ import {
} from "../commands/ListAnalyzersCommand";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: ListAnalyzersCommandInput,
...args: any
): Promise<ListAnalyzersCommandOutput> => {
// @ts-ignore
return await client.send(new ListAnalyzersCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListAnalyzers(
export const paginateListAnalyzers: (
config: AccessAnalyzerPaginationConfiguration,
input: ListAnalyzersCommandInput,
...additionalArguments: any
): Paginator<ListAnalyzersCommandOutput> {
// ToDo: replace with actual type instead of typeof input.nextToken
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListAnalyzersCommandOutput;
while (hasNext) {
input.nextToken = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
...rest: any[]
) => Paginator<ListAnalyzersCommandOutput> = createPaginator<
AccessAnalyzerPaginationConfiguration,
ListAnalyzersCommandInput,
ListAnalyzersCommandOutput
>(AccessAnalyzerClient, ListAnalyzersCommand, "nextToken", "nextToken", "maxResults");
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// smithy-typescript generated code
import { createPaginator } from "@smithy/core";
import { Paginator } from "@smithy/types";

import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
Expand All @@ -9,42 +10,15 @@ import {
} from "../commands/ListArchiveRulesCommand";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: ListArchiveRulesCommandInput,
...args: any
): Promise<ListArchiveRulesCommandOutput> => {
// @ts-ignore
return await client.send(new ListArchiveRulesCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListArchiveRules(
export const paginateListArchiveRules: (
config: AccessAnalyzerPaginationConfiguration,
input: ListArchiveRulesCommandInput,
...additionalArguments: any
): Paginator<ListArchiveRulesCommandOutput> {
// ToDo: replace with actual type instead of typeof input.nextToken
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListArchiveRulesCommandOutput;
while (hasNext) {
input.nextToken = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
...rest: any[]
) => Paginator<ListArchiveRulesCommandOutput> = createPaginator<
AccessAnalyzerPaginationConfiguration,
ListArchiveRulesCommandInput,
ListArchiveRulesCommandOutput
>(AccessAnalyzerClient, ListArchiveRulesCommand, "nextToken", "nextToken", "maxResults");
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// smithy-typescript generated code
import { createPaginator } from "@smithy/core";
import { Paginator } from "@smithy/types";

import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
Expand All @@ -9,42 +10,15 @@ import {
} from "../commands/ListFindingsCommand";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: ListFindingsCommandInput,
...args: any
): Promise<ListFindingsCommandOutput> => {
// @ts-ignore
return await client.send(new ListFindingsCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListFindings(
export const paginateListFindings: (
config: AccessAnalyzerPaginationConfiguration,
input: ListFindingsCommandInput,
...additionalArguments: any
): Paginator<ListFindingsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.nextToken
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListFindingsCommandOutput;
while (hasNext) {
input.nextToken = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
...rest: any[]
) => Paginator<ListFindingsCommandOutput> = createPaginator<
AccessAnalyzerPaginationConfiguration,
ListFindingsCommandInput,
ListFindingsCommandOutput
>(AccessAnalyzerClient, ListFindingsCommand, "nextToken", "nextToken", "maxResults");
Loading
Loading