Skip to content

Commit

Permalink
feat: adds client paginators (#1458)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexforsyth committed Aug 24, 2020
1 parent 88baaad commit 0c7f7ee
Show file tree
Hide file tree
Showing 1,179 changed files with 47,050 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -18,7 +18,7 @@ jspm_packages
.node_repl_history
*.tgz
.yarn-integrity

.DS_Store
.vscode/launch.json

lerna-debug.log
Expand Down
5 changes: 5 additions & 0 deletions clients/client-accessanalyzer/index.ts
Expand Up @@ -9,13 +9,18 @@ export * from "./commands/GetAnalyzerCommand";
export * from "./commands/GetArchiveRuleCommand";
export * from "./commands/GetFindingCommand";
export * from "./commands/ListAnalyzedResourcesCommand";
export * from "./pagination/ListAnalyzedResourcesPaginator";
export * from "./commands/ListAnalyzersCommand";
export * from "./pagination/ListAnalyzersPaginator";
export * from "./commands/ListArchiveRulesCommand";
export * from "./pagination/ListArchiveRulesPaginator";
export * from "./commands/ListFindingsCommand";
export * from "./pagination/ListFindingsPaginator";
export * from "./commands/ListTagsForResourceCommand";
export * from "./commands/StartResourceScanCommand";
export * from "./commands/TagResourceCommand";
export * from "./commands/UntagResourceCommand";
export * from "./commands/UpdateArchiveRuleCommand";
export * from "./commands/UpdateFindingsCommand";
export * from "./pagination/Interfaces";
export * from "./models/index";
7 changes: 7 additions & 0 deletions clients/client-accessanalyzer/pagination/Interfaces.ts
@@ -0,0 +1,7 @@
import { AccessAnalyzer } from "../AccessAnalyzer";
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
import { PaginationConfiguration } from "@aws-sdk/types";

export interface AccessAnalyzerPaginationConfiguration extends PaginationConfiguration {
client: AccessAnalyzer | AccessAnalyzerClient;
}
@@ -0,0 +1,51 @@
import { AccessAnalyzer } from "../AccessAnalyzer";
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
import {
ListAnalyzedResourcesCommand,
ListAnalyzedResourcesCommandInput,
ListAnalyzedResourcesCommandOutput,
} from "../commands/ListAnalyzedResourcesCommand";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
import { Paginator } from "@aws-sdk/types";

const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: ListAnalyzedResourcesCommandInput,
...args: any
): Promise<ListAnalyzedResourcesCommandOutput> => {
// @ts-ignore
return await client.send(new ListAnalyzedResourcesCommand(input, ...args));
};
const makePagedRequest = async (
client: AccessAnalyzer,
input: ListAnalyzedResourcesCommandInput,
...args: any
): Promise<ListAnalyzedResourcesCommandOutput> => {
// @ts-ignore
return await client.listAnalyzedResources(input, ...args);
};
export async function* listAnalyzedResourcesPaginate(
config: AccessAnalyzerPaginationConfiguration,
input: ListAnalyzedResourcesCommandInput,
...additionalArguments: any
): Paginator<ListAnalyzedResourcesCommandOutput> {
let token: string | undefined = config.startingToken || "";
let hasNext = true;
let page: ListAnalyzedResourcesCommandOutput;
while (hasNext) {
input["nextToken"] = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzer) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
token = page["nextToken"];
hasNext = !!token;
}
// @ts-ignore
return undefined;
}
51 changes: 51 additions & 0 deletions clients/client-accessanalyzer/pagination/ListAnalyzersPaginator.ts
@@ -0,0 +1,51 @@
import { AccessAnalyzer } from "../AccessAnalyzer";
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
import {
ListAnalyzersCommand,
ListAnalyzersCommandInput,
ListAnalyzersCommandOutput,
} from "../commands/ListAnalyzersCommand";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
import { Paginator } from "@aws-sdk/types";

const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: ListAnalyzersCommandInput,
...args: any
): Promise<ListAnalyzersCommandOutput> => {
// @ts-ignore
return await client.send(new ListAnalyzersCommand(input, ...args));
};
const makePagedRequest = async (
client: AccessAnalyzer,
input: ListAnalyzersCommandInput,
...args: any
): Promise<ListAnalyzersCommandOutput> => {
// @ts-ignore
return await client.listAnalyzers(input, ...args);
};
export async function* listAnalyzersPaginate(
config: AccessAnalyzerPaginationConfiguration,
input: ListAnalyzersCommandInput,
...additionalArguments: any
): Paginator<ListAnalyzersCommandOutput> {
let token: string | undefined = config.startingToken || "";
let hasNext = true;
let page: ListAnalyzersCommandOutput;
while (hasNext) {
input["nextToken"] = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzer) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
token = page["nextToken"];
hasNext = !!token;
}
// @ts-ignore
return undefined;
}
@@ -0,0 +1,51 @@
import { AccessAnalyzer } from "../AccessAnalyzer";
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
import {
ListArchiveRulesCommand,
ListArchiveRulesCommandInput,
ListArchiveRulesCommandOutput,
} from "../commands/ListArchiveRulesCommand";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
import { Paginator } from "@aws-sdk/types";

const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: ListArchiveRulesCommandInput,
...args: any
): Promise<ListArchiveRulesCommandOutput> => {
// @ts-ignore
return await client.send(new ListArchiveRulesCommand(input, ...args));
};
const makePagedRequest = async (
client: AccessAnalyzer,
input: ListArchiveRulesCommandInput,
...args: any
): Promise<ListArchiveRulesCommandOutput> => {
// @ts-ignore
return await client.listArchiveRules(input, ...args);
};
export async function* listArchiveRulesPaginate(
config: AccessAnalyzerPaginationConfiguration,
input: ListArchiveRulesCommandInput,
...additionalArguments: any
): Paginator<ListArchiveRulesCommandOutput> {
let token: string | undefined = config.startingToken || "";
let hasNext = true;
let page: ListArchiveRulesCommandOutput;
while (hasNext) {
input["nextToken"] = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzer) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
token = page["nextToken"];
hasNext = !!token;
}
// @ts-ignore
return undefined;
}
51 changes: 51 additions & 0 deletions clients/client-accessanalyzer/pagination/ListFindingsPaginator.ts
@@ -0,0 +1,51 @@
import { AccessAnalyzer } from "../AccessAnalyzer";
import { AccessAnalyzerClient } from "../AccessAnalyzerClient";
import {
ListFindingsCommand,
ListFindingsCommandInput,
ListFindingsCommandOutput,
} from "../commands/ListFindingsCommand";
import { AccessAnalyzerPaginationConfiguration } from "./Interfaces";
import { Paginator } from "@aws-sdk/types";

const makePagedClientRequest = async (
client: AccessAnalyzerClient,
input: ListFindingsCommandInput,
...args: any
): Promise<ListFindingsCommandOutput> => {
// @ts-ignore
return await client.send(new ListFindingsCommand(input, ...args));
};
const makePagedRequest = async (
client: AccessAnalyzer,
input: ListFindingsCommandInput,
...args: any
): Promise<ListFindingsCommandOutput> => {
// @ts-ignore
return await client.listFindings(input, ...args);
};
export async function* listFindingsPaginate(
config: AccessAnalyzerPaginationConfiguration,
input: ListFindingsCommandInput,
...additionalArguments: any
): Paginator<ListFindingsCommandOutput> {
let token: string | undefined = config.startingToken || "";
let hasNext = true;
let page: ListFindingsCommandOutput;
while (hasNext) {
input["nextToken"] = token;
input["maxResults"] = config.pageSize;
if (config.client instanceof AccessAnalyzer) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof AccessAnalyzerClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
token = page["nextToken"];
hasNext = !!token;
}
// @ts-ignore
return undefined;
}
4 changes: 4 additions & 0 deletions clients/client-acm-pca/index.ts
Expand Up @@ -13,11 +13,15 @@ export * from "./commands/GetCertificateAuthorityCsrCommand";
export * from "./commands/ImportCertificateAuthorityCertificateCommand";
export * from "./commands/IssueCertificateCommand";
export * from "./commands/ListCertificateAuthoritiesCommand";
export * from "./pagination/ListCertificateAuthoritiesPaginator";
export * from "./commands/ListPermissionsCommand";
export * from "./pagination/ListPermissionsPaginator";
export * from "./commands/ListTagsCommand";
export * from "./pagination/ListTagsPaginator";
export * from "./commands/RestoreCertificateAuthorityCommand";
export * from "./commands/RevokeCertificateCommand";
export * from "./commands/TagCertificateAuthorityCommand";
export * from "./commands/UntagCertificateAuthorityCommand";
export * from "./commands/UpdateCertificateAuthorityCommand";
export * from "./pagination/Interfaces";
export * from "./models/index";
7 changes: 7 additions & 0 deletions clients/client-acm-pca/pagination/Interfaces.ts
@@ -0,0 +1,7 @@
import { ACMPCA } from "../ACMPCA";
import { ACMPCAClient } from "../ACMPCAClient";
import { PaginationConfiguration } from "@aws-sdk/types";

export interface ACMPCAPaginationConfiguration extends PaginationConfiguration {
client: ACMPCA | ACMPCAClient;
}
@@ -0,0 +1,51 @@
import { ACMPCA } from "../ACMPCA";
import { ACMPCAClient } from "../ACMPCAClient";
import {
ListCertificateAuthoritiesCommand,
ListCertificateAuthoritiesCommandInput,
ListCertificateAuthoritiesCommandOutput,
} from "../commands/ListCertificateAuthoritiesCommand";
import { ACMPCAPaginationConfiguration } from "./Interfaces";
import { Paginator } from "@aws-sdk/types";

const makePagedClientRequest = async (
client: ACMPCAClient,
input: ListCertificateAuthoritiesCommandInput,
...args: any
): Promise<ListCertificateAuthoritiesCommandOutput> => {
// @ts-ignore
return await client.send(new ListCertificateAuthoritiesCommand(input, ...args));
};
const makePagedRequest = async (
client: ACMPCA,
input: ListCertificateAuthoritiesCommandInput,
...args: any
): Promise<ListCertificateAuthoritiesCommandOutput> => {
// @ts-ignore
return await client.listCertificateAuthorities(input, ...args);
};
export async function* listCertificateAuthoritiesPaginate(
config: ACMPCAPaginationConfiguration,
input: ListCertificateAuthoritiesCommandInput,
...additionalArguments: any
): Paginator<ListCertificateAuthoritiesCommandOutput> {
let token: string | undefined = config.startingToken || "";
let hasNext = true;
let page: ListCertificateAuthoritiesCommandOutput;
while (hasNext) {
input["NextToken"] = token;
input["MaxResults"] = config.pageSize;
if (config.client instanceof ACMPCA) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof ACMPCAClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected ACMPCA | ACMPCAClient");
}
yield page;
token = page["NextToken"];
hasNext = !!token;
}
// @ts-ignore
return undefined;
}
51 changes: 51 additions & 0 deletions clients/client-acm-pca/pagination/ListPermissionsPaginator.ts
@@ -0,0 +1,51 @@
import { ACMPCA } from "../ACMPCA";
import { ACMPCAClient } from "../ACMPCAClient";
import {
ListPermissionsCommand,
ListPermissionsCommandInput,
ListPermissionsCommandOutput,
} from "../commands/ListPermissionsCommand";
import { ACMPCAPaginationConfiguration } from "./Interfaces";
import { Paginator } from "@aws-sdk/types";

const makePagedClientRequest = async (
client: ACMPCAClient,
input: ListPermissionsCommandInput,
...args: any
): Promise<ListPermissionsCommandOutput> => {
// @ts-ignore
return await client.send(new ListPermissionsCommand(input, ...args));
};
const makePagedRequest = async (
client: ACMPCA,
input: ListPermissionsCommandInput,
...args: any
): Promise<ListPermissionsCommandOutput> => {
// @ts-ignore
return await client.listPermissions(input, ...args);
};
export async function* listPermissionsPaginate(
config: ACMPCAPaginationConfiguration,
input: ListPermissionsCommandInput,
...additionalArguments: any
): Paginator<ListPermissionsCommandOutput> {
let token: string | undefined = config.startingToken || "";
let hasNext = true;
let page: ListPermissionsCommandOutput;
while (hasNext) {
input["NextToken"] = token;
input["MaxResults"] = config.pageSize;
if (config.client instanceof ACMPCA) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof ACMPCAClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected ACMPCA | ACMPCAClient");
}
yield page;
token = page["NextToken"];
hasNext = !!token;
}
// @ts-ignore
return undefined;
}

0 comments on commit 0c7f7ee

Please sign in to comment.