Skip to content

Commit e54099b

Browse files
authored
feat: codegen for paginator factory (#5590)
* 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
1 parent 9c86e1c commit e54099b

File tree

2,891 files changed

+22322
-93907
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,891 files changed

+22322
-93907
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// smithy-typescript generated code
2+
import { createPaginator } from "@smithy/core";
23
import { Paginator } from "@smithy/types";
34

45
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
@@ -9,42 +10,15 @@ import {
910
} from "../commands/GetFindingV2Command";
1011
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
1112

12-
/**
13-
* @internal
14-
*/
15-
const makePagedClientRequest = async (
16-
client: AccessAnalyzerClient,
17-
input: GetFindingV2CommandInput,
18-
...args: any
19-
): Promise<GetFindingV2CommandOutput> => {
20-
// @ts-ignore
21-
return await client.send(new GetFindingV2Command(input), ...args);
22-
};
2313
/**
2414
* @public
2515
*/
26-
export async function* paginateGetFindingV2(
16+
export const paginateGetFindingV2: (
2717
config: AccessAnalyzerPaginationConfiguration,
2818
input: GetFindingV2CommandInput,
29-
...additionalArguments: any
30-
): Paginator<GetFindingV2CommandOutput> {
31-
// ToDo: replace with actual type instead of typeof input.nextToken
32-
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
33-
let hasNext = true;
34-
let page: GetFindingV2CommandOutput;
35-
while (hasNext) {
36-
input.nextToken = token;
37-
input["maxResults"] = config.pageSize;
38-
if (config.client instanceof AccessAnalyzerClient) {
39-
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
40-
} else {
41-
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
42-
}
43-
yield page;
44-
const prevToken = token;
45-
token = page.nextToken;
46-
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
47-
}
48-
// @ts-ignore
49-
return undefined;
50-
}
19+
...rest: any[]
20+
) => Paginator<GetFindingV2CommandOutput> = createPaginator<
21+
AccessAnalyzerPaginationConfiguration,
22+
GetFindingV2CommandInput,
23+
GetFindingV2CommandOutput
24+
>(AccessAnalyzerClient, GetFindingV2Command, "nextToken", "nextToken", "maxResults");
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// smithy-typescript generated code
2+
import { createPaginator } from "@smithy/core";
23
import { Paginator } from "@smithy/types";
34

45
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
@@ -9,42 +10,15 @@ import {
910
} from "../commands/ListAccessPreviewFindingsCommand";
1011
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
1112

12-
/**
13-
* @internal
14-
*/
15-
const makePagedClientRequest = async (
16-
client: AccessAnalyzerClient,
17-
input: ListAccessPreviewFindingsCommandInput,
18-
...args: any
19-
): Promise<ListAccessPreviewFindingsCommandOutput> => {
20-
// @ts-ignore
21-
return await client.send(new ListAccessPreviewFindingsCommand(input), ...args);
22-
};
2313
/**
2414
* @public
2515
*/
26-
export async function* paginateListAccessPreviewFindings(
16+
export const paginateListAccessPreviewFindings: (
2717
config: AccessAnalyzerPaginationConfiguration,
2818
input: ListAccessPreviewFindingsCommandInput,
29-
...additionalArguments: any
30-
): Paginator<ListAccessPreviewFindingsCommandOutput> {
31-
// ToDo: replace with actual type instead of typeof input.nextToken
32-
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
33-
let hasNext = true;
34-
let page: ListAccessPreviewFindingsCommandOutput;
35-
while (hasNext) {
36-
input.nextToken = token;
37-
input["maxResults"] = config.pageSize;
38-
if (config.client instanceof AccessAnalyzerClient) {
39-
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
40-
} else {
41-
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
42-
}
43-
yield page;
44-
const prevToken = token;
45-
token = page.nextToken;
46-
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
47-
}
48-
// @ts-ignore
49-
return undefined;
50-
}
19+
...rest: any[]
20+
) => Paginator<ListAccessPreviewFindingsCommandOutput> = createPaginator<
21+
AccessAnalyzerPaginationConfiguration,
22+
ListAccessPreviewFindingsCommandInput,
23+
ListAccessPreviewFindingsCommandOutput
24+
>(AccessAnalyzerClient, ListAccessPreviewFindingsCommand, "nextToken", "nextToken", "maxResults");
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// smithy-typescript generated code
2+
import { createPaginator } from "@smithy/core";
23
import { Paginator } from "@smithy/types";
34

45
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
@@ -9,42 +10,15 @@ import {
910
} from "../commands/ListAccessPreviewsCommand";
1011
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
1112

12-
/**
13-
* @internal
14-
*/
15-
const makePagedClientRequest = async (
16-
client: AccessAnalyzerClient,
17-
input: ListAccessPreviewsCommandInput,
18-
...args: any
19-
): Promise<ListAccessPreviewsCommandOutput> => {
20-
// @ts-ignore
21-
return await client.send(new ListAccessPreviewsCommand(input), ...args);
22-
};
2313
/**
2414
* @public
2515
*/
26-
export async function* paginateListAccessPreviews(
16+
export const paginateListAccessPreviews: (
2717
config: AccessAnalyzerPaginationConfiguration,
2818
input: ListAccessPreviewsCommandInput,
29-
...additionalArguments: any
30-
): Paginator<ListAccessPreviewsCommandOutput> {
31-
// ToDo: replace with actual type instead of typeof input.nextToken
32-
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
33-
let hasNext = true;
34-
let page: ListAccessPreviewsCommandOutput;
35-
while (hasNext) {
36-
input.nextToken = token;
37-
input["maxResults"] = config.pageSize;
38-
if (config.client instanceof AccessAnalyzerClient) {
39-
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
40-
} else {
41-
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
42-
}
43-
yield page;
44-
const prevToken = token;
45-
token = page.nextToken;
46-
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
47-
}
48-
// @ts-ignore
49-
return undefined;
50-
}
19+
...rest: any[]
20+
) => Paginator<ListAccessPreviewsCommandOutput> = createPaginator<
21+
AccessAnalyzerPaginationConfiguration,
22+
ListAccessPreviewsCommandInput,
23+
ListAccessPreviewsCommandOutput
24+
>(AccessAnalyzerClient, ListAccessPreviewsCommand, "nextToken", "nextToken", "maxResults");
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// smithy-typescript generated code
2+
import { createPaginator } from "@smithy/core";
23
import { Paginator } from "@smithy/types";
34

45
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
@@ -9,42 +10,15 @@ import {
910
} from "../commands/ListAnalyzedResourcesCommand";
1011
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
1112

12-
/**
13-
* @internal
14-
*/
15-
const makePagedClientRequest = async (
16-
client: AccessAnalyzerClient,
17-
input: ListAnalyzedResourcesCommandInput,
18-
...args: any
19-
): Promise<ListAnalyzedResourcesCommandOutput> => {
20-
// @ts-ignore
21-
return await client.send(new ListAnalyzedResourcesCommand(input), ...args);
22-
};
2313
/**
2414
* @public
2515
*/
26-
export async function* paginateListAnalyzedResources(
16+
export const paginateListAnalyzedResources: (
2717
config: AccessAnalyzerPaginationConfiguration,
2818
input: ListAnalyzedResourcesCommandInput,
29-
...additionalArguments: any
30-
): Paginator<ListAnalyzedResourcesCommandOutput> {
31-
// ToDo: replace with actual type instead of typeof input.nextToken
32-
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
33-
let hasNext = true;
34-
let page: ListAnalyzedResourcesCommandOutput;
35-
while (hasNext) {
36-
input.nextToken = token;
37-
input["maxResults"] = config.pageSize;
38-
if (config.client instanceof AccessAnalyzerClient) {
39-
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
40-
} else {
41-
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
42-
}
43-
yield page;
44-
const prevToken = token;
45-
token = page.nextToken;
46-
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
47-
}
48-
// @ts-ignore
49-
return undefined;
50-
}
19+
...rest: any[]
20+
) => Paginator<ListAnalyzedResourcesCommandOutput> = createPaginator<
21+
AccessAnalyzerPaginationConfiguration,
22+
ListAnalyzedResourcesCommandInput,
23+
ListAnalyzedResourcesCommandOutput
24+
>(AccessAnalyzerClient, ListAnalyzedResourcesCommand, "nextToken", "nextToken", "maxResults");
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// smithy-typescript generated code
2+
import { createPaginator } from "@smithy/core";
23
import { Paginator } from "@smithy/types";
34

45
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
@@ -9,42 +10,15 @@ import {
910
} from "../commands/ListAnalyzersCommand";
1011
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
1112

12-
/**
13-
* @internal
14-
*/
15-
const makePagedClientRequest = async (
16-
client: AccessAnalyzerClient,
17-
input: ListAnalyzersCommandInput,
18-
...args: any
19-
): Promise<ListAnalyzersCommandOutput> => {
20-
// @ts-ignore
21-
return await client.send(new ListAnalyzersCommand(input), ...args);
22-
};
2313
/**
2414
* @public
2515
*/
26-
export async function* paginateListAnalyzers(
16+
export const paginateListAnalyzers: (
2717
config: AccessAnalyzerPaginationConfiguration,
2818
input: ListAnalyzersCommandInput,
29-
...additionalArguments: any
30-
): Paginator<ListAnalyzersCommandOutput> {
31-
// ToDo: replace with actual type instead of typeof input.nextToken
32-
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
33-
let hasNext = true;
34-
let page: ListAnalyzersCommandOutput;
35-
while (hasNext) {
36-
input.nextToken = token;
37-
input["maxResults"] = config.pageSize;
38-
if (config.client instanceof AccessAnalyzerClient) {
39-
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
40-
} else {
41-
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
42-
}
43-
yield page;
44-
const prevToken = token;
45-
token = page.nextToken;
46-
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
47-
}
48-
// @ts-ignore
49-
return undefined;
50-
}
19+
...rest: any[]
20+
) => Paginator<ListAnalyzersCommandOutput> = createPaginator<
21+
AccessAnalyzerPaginationConfiguration,
22+
ListAnalyzersCommandInput,
23+
ListAnalyzersCommandOutput
24+
>(AccessAnalyzerClient, ListAnalyzersCommand, "nextToken", "nextToken", "maxResults");
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// smithy-typescript generated code
2+
import { createPaginator } from "@smithy/core";
23
import { Paginator } from "@smithy/types";
34

45
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
@@ -9,42 +10,15 @@ import {
910
} from "../commands/ListArchiveRulesCommand";
1011
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
1112

12-
/**
13-
* @internal
14-
*/
15-
const makePagedClientRequest = async (
16-
client: AccessAnalyzerClient,
17-
input: ListArchiveRulesCommandInput,
18-
...args: any
19-
): Promise<ListArchiveRulesCommandOutput> => {
20-
// @ts-ignore
21-
return await client.send(new ListArchiveRulesCommand(input), ...args);
22-
};
2313
/**
2414
* @public
2515
*/
26-
export async function* paginateListArchiveRules(
16+
export const paginateListArchiveRules: (
2717
config: AccessAnalyzerPaginationConfiguration,
2818
input: ListArchiveRulesCommandInput,
29-
...additionalArguments: any
30-
): Paginator<ListArchiveRulesCommandOutput> {
31-
// ToDo: replace with actual type instead of typeof input.nextToken
32-
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
33-
let hasNext = true;
34-
let page: ListArchiveRulesCommandOutput;
35-
while (hasNext) {
36-
input.nextToken = token;
37-
input["maxResults"] = config.pageSize;
38-
if (config.client instanceof AccessAnalyzerClient) {
39-
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
40-
} else {
41-
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
42-
}
43-
yield page;
44-
const prevToken = token;
45-
token = page.nextToken;
46-
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
47-
}
48-
// @ts-ignore
49-
return undefined;
50-
}
19+
...rest: any[]
20+
) => Paginator<ListArchiveRulesCommandOutput> = createPaginator<
21+
AccessAnalyzerPaginationConfiguration,
22+
ListArchiveRulesCommandInput,
23+
ListArchiveRulesCommandOutput
24+
>(AccessAnalyzerClient, ListArchiveRulesCommand, "nextToken", "nextToken", "maxResults");
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// smithy-typescript generated code
2+
import { createPaginator } from "@smithy/core";
23
import { Paginator } from "@smithy/types";
34

45
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
@@ -9,42 +10,15 @@ import {
910
} from "../commands/ListFindingsCommand";
1011
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
1112

12-
/**
13-
* @internal
14-
*/
15-
const makePagedClientRequest = async (
16-
client: AccessAnalyzerClient,
17-
input: ListFindingsCommandInput,
18-
...args: any
19-
): Promise<ListFindingsCommandOutput> => {
20-
// @ts-ignore
21-
return await client.send(new ListFindingsCommand(input), ...args);
22-
};
2313
/**
2414
* @public
2515
*/
26-
export async function* paginateListFindings(
16+
export const paginateListFindings: (
2717
config: AccessAnalyzerPaginationConfiguration,
2818
input: ListFindingsCommandInput,
29-
...additionalArguments: any
30-
): Paginator<ListFindingsCommandOutput> {
31-
// ToDo: replace with actual type instead of typeof input.nextToken
32-
let token: typeof input.nextToken | undefined = config.startingToken || undefined;
33-
let hasNext = true;
34-
let page: ListFindingsCommandOutput;
35-
while (hasNext) {
36-
input.nextToken = token;
37-
input["maxResults"] = config.pageSize;
38-
if (config.client instanceof AccessAnalyzerClient) {
39-
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
40-
} else {
41-
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
42-
}
43-
yield page;
44-
const prevToken = token;
45-
token = page.nextToken;
46-
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
47-
}
48-
// @ts-ignore
49-
return undefined;
50-
}
19+
...rest: any[]
20+
) => Paginator<ListFindingsCommandOutput> = createPaginator<
21+
AccessAnalyzerPaginationConfiguration,
22+
ListFindingsCommandInput,
23+
ListFindingsCommandOutput
24+
>(AccessAnalyzerClient, ListFindingsCommand, "nextToken", "nextToken", "maxResults");

0 commit comments

Comments
 (0)