Skip to content

Commit

Permalink
feat: codegen for paginator factory (#5590)
Browse files Browse the repository at this point in the history
* feat: sample diff for paginator factory

* feat: paginator simplification

* chore: update smithy hash

* chore: update smithy deps

* feat: update lib-storage paginators

* fix(lib-dynamodb): update dynamodbdocument paginators
  • Loading branch information
kuhe committed Dec 19, 2023
1 parent 9c86e1c commit e54099b
Show file tree
Hide file tree
Showing 2,891 changed files with 22,322 additions and 93,907 deletions.
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");

0 comments on commit e54099b

Please sign in to comment.