Skip to content

Commit 0c7f7ee

Browse files
authored
feat: adds client paginators (#1458)
1 parent 88baaad commit 0c7f7ee

File tree

1,179 files changed

+47050
-1
lines changed

Some content is hidden

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

1,179 files changed

+47050
-1
lines changed

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jspm_packages
1818
.node_repl_history
1919
*.tgz
2020
.yarn-integrity
21-
21+
.DS_Store
2222
.vscode/launch.json
2323

2424
lerna-debug.log

Diff for: clients/client-accessanalyzer/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ export * from "./commands/GetAnalyzerCommand";
99
export * from "./commands/GetArchiveRuleCommand";
1010
export * from "./commands/GetFindingCommand";
1111
export * from "./commands/ListAnalyzedResourcesCommand";
12+
export * from "./pagination/ListAnalyzedResourcesPaginator";
1213
export * from "./commands/ListAnalyzersCommand";
14+
export * from "./pagination/ListAnalyzersPaginator";
1315
export * from "./commands/ListArchiveRulesCommand";
16+
export * from "./pagination/ListArchiveRulesPaginator";
1417
export * from "./commands/ListFindingsCommand";
18+
export * from "./pagination/ListFindingsPaginator";
1519
export * from "./commands/ListTagsForResourceCommand";
1620
export * from "./commands/StartResourceScanCommand";
1721
export * from "./commands/TagResourceCommand";
1822
export * from "./commands/UntagResourceCommand";
1923
export * from "./commands/UpdateArchiveRuleCommand";
2024
export * from "./commands/UpdateFindingsCommand";
25+
export * from "./pagination/Interfaces";
2126
export * from "./models/index";
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { AccessAnalyzer } from "../AccessAnalyzer";
2+
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
3+
import { PaginationConfiguration } from "@aws-sdk/types";
4+
5+
export interface AccessAnalyzerPaginationConfiguration extends PaginationConfiguration {
6+
client: AccessAnalyzer | AccessAnalyzerClient;
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { AccessAnalyzer } from "../AccessAnalyzer";
2+
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
3+
import {
4+
ListAnalyzedResourcesCommand,
5+
ListAnalyzedResourcesCommandInput,
6+
ListAnalyzedResourcesCommandOutput,
7+
} from "../commands/ListAnalyzedResourcesCommand";
8+
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
9+
import { Paginator } from "@aws-sdk/types";
10+
11+
const makePagedClientRequest = async (
12+
client: AccessAnalyzerClient,
13+
input: ListAnalyzedResourcesCommandInput,
14+
...args: any
15+
): Promise<ListAnalyzedResourcesCommandOutput> => {
16+
// @ts-ignore
17+
return await client.send(new ListAnalyzedResourcesCommand(input, ...args));
18+
};
19+
const makePagedRequest = async (
20+
client: AccessAnalyzer,
21+
input: ListAnalyzedResourcesCommandInput,
22+
...args: any
23+
): Promise<ListAnalyzedResourcesCommandOutput> => {
24+
// @ts-ignore
25+
return await client.listAnalyzedResources(input, ...args);
26+
};
27+
export async function* listAnalyzedResourcesPaginate(
28+
config: AccessAnalyzerPaginationConfiguration,
29+
input: ListAnalyzedResourcesCommandInput,
30+
...additionalArguments: any
31+
): Paginator<ListAnalyzedResourcesCommandOutput> {
32+
let token: string | undefined = config.startingToken || "";
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 AccessAnalyzer) {
39+
page = await makePagedRequest(config.client, input, ...additionalArguments);
40+
} else if (config.client instanceof AccessAnalyzerClient) {
41+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
42+
} else {
43+
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
44+
}
45+
yield page;
46+
token = page["nextToken"];
47+
hasNext = !!token;
48+
}
49+
// @ts-ignore
50+
return undefined;
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { AccessAnalyzer } from "../AccessAnalyzer";
2+
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
3+
import {
4+
ListAnalyzersCommand,
5+
ListAnalyzersCommandInput,
6+
ListAnalyzersCommandOutput,
7+
} from "../commands/ListAnalyzersCommand";
8+
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
9+
import { Paginator } from "@aws-sdk/types";
10+
11+
const makePagedClientRequest = async (
12+
client: AccessAnalyzerClient,
13+
input: ListAnalyzersCommandInput,
14+
...args: any
15+
): Promise<ListAnalyzersCommandOutput> => {
16+
// @ts-ignore
17+
return await client.send(new ListAnalyzersCommand(input, ...args));
18+
};
19+
const makePagedRequest = async (
20+
client: AccessAnalyzer,
21+
input: ListAnalyzersCommandInput,
22+
...args: any
23+
): Promise<ListAnalyzersCommandOutput> => {
24+
// @ts-ignore
25+
return await client.listAnalyzers(input, ...args);
26+
};
27+
export async function* listAnalyzersPaginate(
28+
config: AccessAnalyzerPaginationConfiguration,
29+
input: ListAnalyzersCommandInput,
30+
...additionalArguments: any
31+
): Paginator<ListAnalyzersCommandOutput> {
32+
let token: string | undefined = config.startingToken || "";
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 AccessAnalyzer) {
39+
page = await makePagedRequest(config.client, input, ...additionalArguments);
40+
} else if (config.client instanceof AccessAnalyzerClient) {
41+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
42+
} else {
43+
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
44+
}
45+
yield page;
46+
token = page["nextToken"];
47+
hasNext = !!token;
48+
}
49+
// @ts-ignore
50+
return undefined;
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { AccessAnalyzer } from "../AccessAnalyzer";
2+
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
3+
import {
4+
ListArchiveRulesCommand,
5+
ListArchiveRulesCommandInput,
6+
ListArchiveRulesCommandOutput,
7+
} from "../commands/ListArchiveRulesCommand";
8+
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
9+
import { Paginator } from "@aws-sdk/types";
10+
11+
const makePagedClientRequest = async (
12+
client: AccessAnalyzerClient,
13+
input: ListArchiveRulesCommandInput,
14+
...args: any
15+
): Promise<ListArchiveRulesCommandOutput> => {
16+
// @ts-ignore
17+
return await client.send(new ListArchiveRulesCommand(input, ...args));
18+
};
19+
const makePagedRequest = async (
20+
client: AccessAnalyzer,
21+
input: ListArchiveRulesCommandInput,
22+
...args: any
23+
): Promise<ListArchiveRulesCommandOutput> => {
24+
// @ts-ignore
25+
return await client.listArchiveRules(input, ...args);
26+
};
27+
export async function* listArchiveRulesPaginate(
28+
config: AccessAnalyzerPaginationConfiguration,
29+
input: ListArchiveRulesCommandInput,
30+
...additionalArguments: any
31+
): Paginator<ListArchiveRulesCommandOutput> {
32+
let token: string | undefined = config.startingToken || "";
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 AccessAnalyzer) {
39+
page = await makePagedRequest(config.client, input, ...additionalArguments);
40+
} else if (config.client instanceof AccessAnalyzerClient) {
41+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
42+
} else {
43+
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
44+
}
45+
yield page;
46+
token = page["nextToken"];
47+
hasNext = !!token;
48+
}
49+
// @ts-ignore
50+
return undefined;
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { AccessAnalyzer } from "../AccessAnalyzer";
2+
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
3+
import {
4+
ListFindingsCommand,
5+
ListFindingsCommandInput,
6+
ListFindingsCommandOutput,
7+
} from "../commands/ListFindingsCommand";
8+
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
9+
import { Paginator } from "@aws-sdk/types";
10+
11+
const makePagedClientRequest = async (
12+
client: AccessAnalyzerClient,
13+
input: ListFindingsCommandInput,
14+
...args: any
15+
): Promise<ListFindingsCommandOutput> => {
16+
// @ts-ignore
17+
return await client.send(new ListFindingsCommand(input, ...args));
18+
};
19+
const makePagedRequest = async (
20+
client: AccessAnalyzer,
21+
input: ListFindingsCommandInput,
22+
...args: any
23+
): Promise<ListFindingsCommandOutput> => {
24+
// @ts-ignore
25+
return await client.listFindings(input, ...args);
26+
};
27+
export async function* listFindingsPaginate(
28+
config: AccessAnalyzerPaginationConfiguration,
29+
input: ListFindingsCommandInput,
30+
...additionalArguments: any
31+
): Paginator<ListFindingsCommandOutput> {
32+
let token: string | undefined = config.startingToken || "";
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 AccessAnalyzer) {
39+
page = await makePagedRequest(config.client, input, ...additionalArguments);
40+
} else if (config.client instanceof AccessAnalyzerClient) {
41+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
42+
} else {
43+
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
44+
}
45+
yield page;
46+
token = page["nextToken"];
47+
hasNext = !!token;
48+
}
49+
// @ts-ignore
50+
return undefined;
51+
}

Diff for: clients/client-acm-pca/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ export * from "./commands/GetCertificateAuthorityCsrCommand";
1313
export * from "./commands/ImportCertificateAuthorityCertificateCommand";
1414
export * from "./commands/IssueCertificateCommand";
1515
export * from "./commands/ListCertificateAuthoritiesCommand";
16+
export * from "./pagination/ListCertificateAuthoritiesPaginator";
1617
export * from "./commands/ListPermissionsCommand";
18+
export * from "./pagination/ListPermissionsPaginator";
1719
export * from "./commands/ListTagsCommand";
20+
export * from "./pagination/ListTagsPaginator";
1821
export * from "./commands/RestoreCertificateAuthorityCommand";
1922
export * from "./commands/RevokeCertificateCommand";
2023
export * from "./commands/TagCertificateAuthorityCommand";
2124
export * from "./commands/UntagCertificateAuthorityCommand";
2225
export * from "./commands/UpdateCertificateAuthorityCommand";
26+
export * from "./pagination/Interfaces";
2327
export * from "./models/index";

Diff for: clients/client-acm-pca/pagination/Interfaces.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { ACMPCA } from "../ACMPCA";
2+
import { ACMPCAClient } from "../ACMPCAClient";
3+
import { PaginationConfiguration } from "@aws-sdk/types";
4+
5+
export interface ACMPCAPaginationConfiguration extends PaginationConfiguration {
6+
client: ACMPCA | ACMPCAClient;
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { ACMPCA } from "../ACMPCA";
2+
import { ACMPCAClient } from "../ACMPCAClient";
3+
import {
4+
ListCertificateAuthoritiesCommand,
5+
ListCertificateAuthoritiesCommandInput,
6+
ListCertificateAuthoritiesCommandOutput,
7+
} from "../commands/ListCertificateAuthoritiesCommand";
8+
import { ACMPCAPaginationConfiguration } from "./Interfaces";
9+
import { Paginator } from "@aws-sdk/types";
10+
11+
const makePagedClientRequest = async (
12+
client: ACMPCAClient,
13+
input: ListCertificateAuthoritiesCommandInput,
14+
...args: any
15+
): Promise<ListCertificateAuthoritiesCommandOutput> => {
16+
// @ts-ignore
17+
return await client.send(new ListCertificateAuthoritiesCommand(input, ...args));
18+
};
19+
const makePagedRequest = async (
20+
client: ACMPCA,
21+
input: ListCertificateAuthoritiesCommandInput,
22+
...args: any
23+
): Promise<ListCertificateAuthoritiesCommandOutput> => {
24+
// @ts-ignore
25+
return await client.listCertificateAuthorities(input, ...args);
26+
};
27+
export async function* listCertificateAuthoritiesPaginate(
28+
config: ACMPCAPaginationConfiguration,
29+
input: ListCertificateAuthoritiesCommandInput,
30+
...additionalArguments: any
31+
): Paginator<ListCertificateAuthoritiesCommandOutput> {
32+
let token: string | undefined = config.startingToken || "";
33+
let hasNext = true;
34+
let page: ListCertificateAuthoritiesCommandOutput;
35+
while (hasNext) {
36+
input["NextToken"] = token;
37+
input["MaxResults"] = config.pageSize;
38+
if (config.client instanceof ACMPCA) {
39+
page = await makePagedRequest(config.client, input, ...additionalArguments);
40+
} else if (config.client instanceof ACMPCAClient) {
41+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
42+
} else {
43+
throw new Error("Invalid client, expected ACMPCA | ACMPCAClient");
44+
}
45+
yield page;
46+
token = page["NextToken"];
47+
hasNext = !!token;
48+
}
49+
// @ts-ignore
50+
return undefined;
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { ACMPCA } from "../ACMPCA";
2+
import { ACMPCAClient } from "../ACMPCAClient";
3+
import {
4+
ListPermissionsCommand,
5+
ListPermissionsCommandInput,
6+
ListPermissionsCommandOutput,
7+
} from "../commands/ListPermissionsCommand";
8+
import { ACMPCAPaginationConfiguration } from "./Interfaces";
9+
import { Paginator } from "@aws-sdk/types";
10+
11+
const makePagedClientRequest = async (
12+
client: ACMPCAClient,
13+
input: ListPermissionsCommandInput,
14+
...args: any
15+
): Promise<ListPermissionsCommandOutput> => {
16+
// @ts-ignore
17+
return await client.send(new ListPermissionsCommand(input, ...args));
18+
};
19+
const makePagedRequest = async (
20+
client: ACMPCA,
21+
input: ListPermissionsCommandInput,
22+
...args: any
23+
): Promise<ListPermissionsCommandOutput> => {
24+
// @ts-ignore
25+
return await client.listPermissions(input, ...args);
26+
};
27+
export async function* listPermissionsPaginate(
28+
config: ACMPCAPaginationConfiguration,
29+
input: ListPermissionsCommandInput,
30+
...additionalArguments: any
31+
): Paginator<ListPermissionsCommandOutput> {
32+
let token: string | undefined = config.startingToken || "";
33+
let hasNext = true;
34+
let page: ListPermissionsCommandOutput;
35+
while (hasNext) {
36+
input["NextToken"] = token;
37+
input["MaxResults"] = config.pageSize;
38+
if (config.client instanceof ACMPCA) {
39+
page = await makePagedRequest(config.client, input, ...additionalArguments);
40+
} else if (config.client instanceof ACMPCAClient) {
41+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
42+
} else {
43+
throw new Error("Invalid client, expected ACMPCA | ACMPCAClient");
44+
}
45+
yield page;
46+
token = page["NextToken"];
47+
hasNext = !!token;
48+
}
49+
// @ts-ignore
50+
return undefined;
51+
}

0 commit comments

Comments
 (0)