Skip to content

Commit

Permalink
feat: sample diff for paginator factory
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Dec 15, 2023
1 parent ad9fb3c commit e075c0d
Show file tree
Hide file tree
Showing 24 changed files with 144 additions and 862 deletions.
42 changes: 6 additions & 36 deletions clients/client-lambda/src/pagination/ListAliasesPaginator.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,16 @@
// smithy-typescript generated code
import { createPaginator } from "@smithy/core";
import { Paginator } from "@smithy/types";

import { ListAliasesCommand, ListAliasesCommandInput, ListAliasesCommandOutput } from "../commands/ListAliasesCommand";
import { LambdaClient } from "../LambdaClient";
import { LambdaPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: LambdaClient,
input: ListAliasesCommandInput,
...args: any
): Promise<ListAliasesCommandOutput> => {
// @ts-ignore
return await client.send(new ListAliasesCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListAliases(
config: LambdaPaginationConfiguration,
input: ListAliasesCommandInput,
...additionalArguments: any
): Paginator<ListAliasesCommandOutput> {
// ToDo: replace with actual type instead of typeof input.Marker
let token: typeof input.Marker | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListAliasesCommandOutput;
while (hasNext) {
input.Marker = token;
input["MaxItems"] = config.pageSize;
if (config.client instanceof LambdaClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Lambda | LambdaClient");
}
yield page;
const prevToken = token;
token = page.NextMarker;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
export const paginateListAliases = createPaginator<
LambdaPaginationConfiguration,
ListAliasesCommandInput,
ListAliasesCommandOutput
>(LambdaClient, ListAliasesCommand, "Marker", "NextMarker", "MaxItems");
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 {
Expand All @@ -9,42 +10,11 @@ import {
import { LambdaClient } from "../LambdaClient";
import { LambdaPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: LambdaClient,
input: ListCodeSigningConfigsCommandInput,
...args: any
): Promise<ListCodeSigningConfigsCommandOutput> => {
// @ts-ignore
return await client.send(new ListCodeSigningConfigsCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListCodeSigningConfigs(
config: LambdaPaginationConfiguration,
input: ListCodeSigningConfigsCommandInput,
...additionalArguments: any
): Paginator<ListCodeSigningConfigsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.Marker
let token: typeof input.Marker | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListCodeSigningConfigsCommandOutput;
while (hasNext) {
input.Marker = token;
input["MaxItems"] = config.pageSize;
if (config.client instanceof LambdaClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Lambda | LambdaClient");
}
yield page;
const prevToken = token;
token = page.NextMarker;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
export const paginateListCodeSigningConfigs = createPaginator<
LambdaPaginationConfiguration,
ListCodeSigningConfigsCommandInput,
ListCodeSigningConfigsCommandOutput
>(LambdaClient, ListCodeSigningConfigsCommand, "Marker", "NextMarker", "MaxItems");
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 {
Expand All @@ -9,42 +10,11 @@ import {
import { LambdaClient } from "../LambdaClient";
import { LambdaPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: LambdaClient,
input: ListEventSourceMappingsCommandInput,
...args: any
): Promise<ListEventSourceMappingsCommandOutput> => {
// @ts-ignore
return await client.send(new ListEventSourceMappingsCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListEventSourceMappings(
config: LambdaPaginationConfiguration,
input: ListEventSourceMappingsCommandInput,
...additionalArguments: any
): Paginator<ListEventSourceMappingsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.Marker
let token: typeof input.Marker | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListEventSourceMappingsCommandOutput;
while (hasNext) {
input.Marker = token;
input["MaxItems"] = config.pageSize;
if (config.client instanceof LambdaClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Lambda | LambdaClient");
}
yield page;
const prevToken = token;
token = page.NextMarker;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
export const paginateListEventSourceMappings = createPaginator<
LambdaPaginationConfiguration,
ListEventSourceMappingsCommandInput,
ListEventSourceMappingsCommandOutput
>(LambdaClient, ListEventSourceMappingsCommand, "Marker", "NextMarker", "MaxItems");
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 {
Expand All @@ -9,42 +10,11 @@ import {
import { LambdaClient } from "../LambdaClient";
import { LambdaPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: LambdaClient,
input: ListFunctionEventInvokeConfigsCommandInput,
...args: any
): Promise<ListFunctionEventInvokeConfigsCommandOutput> => {
// @ts-ignore
return await client.send(new ListFunctionEventInvokeConfigsCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListFunctionEventInvokeConfigs(
config: LambdaPaginationConfiguration,
input: ListFunctionEventInvokeConfigsCommandInput,
...additionalArguments: any
): Paginator<ListFunctionEventInvokeConfigsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.Marker
let token: typeof input.Marker | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListFunctionEventInvokeConfigsCommandOutput;
while (hasNext) {
input.Marker = token;
input["MaxItems"] = config.pageSize;
if (config.client instanceof LambdaClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Lambda | LambdaClient");
}
yield page;
const prevToken = token;
token = page.NextMarker;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
export const paginateListFunctionEventInvokeConfigs = createPaginator<
LambdaPaginationConfiguration,
ListFunctionEventInvokeConfigsCommandInput,
ListFunctionEventInvokeConfigsCommandOutput
>(LambdaClient, ListFunctionEventInvokeConfigsCommand, "Marker", "NextMarker", "MaxItems");
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 {
Expand All @@ -9,42 +10,11 @@ import {
import { LambdaClient } from "../LambdaClient";
import { LambdaPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: LambdaClient,
input: ListFunctionUrlConfigsCommandInput,
...args: any
): Promise<ListFunctionUrlConfigsCommandOutput> => {
// @ts-ignore
return await client.send(new ListFunctionUrlConfigsCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListFunctionUrlConfigs(
config: LambdaPaginationConfiguration,
input: ListFunctionUrlConfigsCommandInput,
...additionalArguments: any
): Paginator<ListFunctionUrlConfigsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.Marker
let token: typeof input.Marker | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListFunctionUrlConfigsCommandOutput;
while (hasNext) {
input.Marker = token;
input["MaxItems"] = config.pageSize;
if (config.client instanceof LambdaClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Lambda | LambdaClient");
}
yield page;
const prevToken = token;
token = page.NextMarker;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
export const paginateListFunctionUrlConfigs = createPaginator<
LambdaPaginationConfiguration,
ListFunctionUrlConfigsCommandInput,
ListFunctionUrlConfigsCommandOutput
>(LambdaClient, ListFunctionUrlConfigsCommand, "Marker", "NextMarker", "MaxItems");
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 {
Expand All @@ -9,42 +10,11 @@ import {
import { LambdaClient } from "../LambdaClient";
import { LambdaPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: LambdaClient,
input: ListFunctionsByCodeSigningConfigCommandInput,
...args: any
): Promise<ListFunctionsByCodeSigningConfigCommandOutput> => {
// @ts-ignore
return await client.send(new ListFunctionsByCodeSigningConfigCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListFunctionsByCodeSigningConfig(
config: LambdaPaginationConfiguration,
input: ListFunctionsByCodeSigningConfigCommandInput,
...additionalArguments: any
): Paginator<ListFunctionsByCodeSigningConfigCommandOutput> {
// ToDo: replace with actual type instead of typeof input.Marker
let token: typeof input.Marker | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListFunctionsByCodeSigningConfigCommandOutput;
while (hasNext) {
input.Marker = token;
input["MaxItems"] = config.pageSize;
if (config.client instanceof LambdaClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Lambda | LambdaClient");
}
yield page;
const prevToken = token;
token = page.NextMarker;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
export const paginateListFunctionsByCodeSigningConfig = createPaginator<
LambdaPaginationConfiguration,
ListFunctionsByCodeSigningConfigCommandInput,
ListFunctionsByCodeSigningConfigCommandOutput
>(LambdaClient, ListFunctionsByCodeSigningConfigCommand, "Marker", "NextMarker", "MaxItems");
42 changes: 6 additions & 36 deletions clients/client-lambda/src/pagination/ListFunctionsPaginator.ts
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 {
Expand All @@ -9,42 +10,11 @@ import {
import { LambdaClient } from "../LambdaClient";
import { LambdaPaginationConfiguration } from "./Interfaces";

/**
* @internal
*/
const makePagedClientRequest = async (
client: LambdaClient,
input: ListFunctionsCommandInput,
...args: any
): Promise<ListFunctionsCommandOutput> => {
// @ts-ignore
return await client.send(new ListFunctionsCommand(input), ...args);
};
/**
* @public
*/
export async function* paginateListFunctions(
config: LambdaPaginationConfiguration,
input: ListFunctionsCommandInput,
...additionalArguments: any
): Paginator<ListFunctionsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.Marker
let token: typeof input.Marker | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListFunctionsCommandOutput;
while (hasNext) {
input.Marker = token;
input["MaxItems"] = config.pageSize;
if (config.client instanceof LambdaClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected Lambda | LambdaClient");
}
yield page;
const prevToken = token;
token = page.NextMarker;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
}
export const paginateListFunctions = createPaginator<
LambdaPaginationConfiguration,
ListFunctionsCommandInput,
ListFunctionsCommandOutput
>(LambdaClient, ListFunctionsCommand, "Marker", "NextMarker", "MaxItems");
Loading

0 comments on commit e075c0d

Please sign in to comment.