diff --git a/clients/client-lambda/src/pagination/ListAliasesPaginator.ts b/clients/client-lambda/src/pagination/ListAliasesPaginator.ts index 9a8409d2ea07..0a666a6d6cfb 100644 --- a/clients/client-lambda/src/pagination/ListAliasesPaginator.ts +++ b/clients/client-lambda/src/pagination/ListAliasesPaginator.ts @@ -1,46 +1,20 @@ // 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 => { - // @ts-ignore - return await client.send(new ListAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAliases( +export const paginateListAliases: ( config: LambdaPaginationConfiguration, input: ListAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListAliasesCommandInput, + ListAliasesCommandOutput +>(LambdaClient, ListAliasesCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListCodeSigningConfigsPaginator.ts b/clients/client-lambda/src/pagination/ListCodeSigningConfigsPaginator.ts index 217426685969..724aa5405486 100644 --- a/clients/client-lambda/src/pagination/ListCodeSigningConfigsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListCodeSigningConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListCodeSigningConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCodeSigningConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCodeSigningConfigs( +export const paginateListCodeSigningConfigs: ( config: LambdaPaginationConfiguration, input: ListCodeSigningConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListCodeSigningConfigsCommandInput, + ListCodeSigningConfigsCommandOutput +>(LambdaClient, ListCodeSigningConfigsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListEventSourceMappingsPaginator.ts b/clients/client-lambda/src/pagination/ListEventSourceMappingsPaginator.ts index a4bb6ee853f4..3e9e30459f98 100644 --- a/clients/client-lambda/src/pagination/ListEventSourceMappingsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListEventSourceMappingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListEventSourceMappingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventSourceMappingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventSourceMappings( +export const paginateListEventSourceMappings: ( config: LambdaPaginationConfiguration, input: ListEventSourceMappingsCommandInput, - ...additionalArguments: any -): Paginator { - // 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListEventSourceMappingsCommandInput, + ListEventSourceMappingsCommandOutput +>(LambdaClient, ListEventSourceMappingsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListFunctionEventInvokeConfigsPaginator.ts b/clients/client-lambda/src/pagination/ListFunctionEventInvokeConfigsPaginator.ts index cb90f205c2fc..22ad0f62d58e 100644 --- a/clients/client-lambda/src/pagination/ListFunctionEventInvokeConfigsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListFunctionEventInvokeConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListFunctionEventInvokeConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFunctionEventInvokeConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFunctionEventInvokeConfigs( +export const paginateListFunctionEventInvokeConfigs: ( config: LambdaPaginationConfiguration, input: ListFunctionEventInvokeConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListFunctionEventInvokeConfigsCommandInput, + ListFunctionEventInvokeConfigsCommandOutput +>(LambdaClient, ListFunctionEventInvokeConfigsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListFunctionUrlConfigsPaginator.ts b/clients/client-lambda/src/pagination/ListFunctionUrlConfigsPaginator.ts index e8d69ad4449a..73c8b3999941 100644 --- a/clients/client-lambda/src/pagination/ListFunctionUrlConfigsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListFunctionUrlConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListFunctionUrlConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFunctionUrlConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFunctionUrlConfigs( +export const paginateListFunctionUrlConfigs: ( config: LambdaPaginationConfiguration, input: ListFunctionUrlConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListFunctionUrlConfigsCommandInput, + ListFunctionUrlConfigsCommandOutput +>(LambdaClient, ListFunctionUrlConfigsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListFunctionsByCodeSigningConfigPaginator.ts b/clients/client-lambda/src/pagination/ListFunctionsByCodeSigningConfigPaginator.ts index e711d3890c12..c9adaf398e09 100644 --- a/clients/client-lambda/src/pagination/ListFunctionsByCodeSigningConfigPaginator.ts +++ b/clients/client-lambda/src/pagination/ListFunctionsByCodeSigningConfigPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListFunctionsByCodeSigningConfigCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFunctionsByCodeSigningConfigCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFunctionsByCodeSigningConfig( +export const paginateListFunctionsByCodeSigningConfig: ( config: LambdaPaginationConfiguration, input: ListFunctionsByCodeSigningConfigCommandInput, - ...additionalArguments: any -): Paginator { - // 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListFunctionsByCodeSigningConfigCommandInput, + ListFunctionsByCodeSigningConfigCommandOutput +>(LambdaClient, ListFunctionsByCodeSigningConfigCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListFunctionsPaginator.ts b/clients/client-lambda/src/pagination/ListFunctionsPaginator.ts index c7fe58d52929..ead1ea818843 100644 --- a/clients/client-lambda/src/pagination/ListFunctionsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListFunctionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListFunctionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFunctionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFunctions( +export const paginateListFunctions: ( config: LambdaPaginationConfiguration, input: ListFunctionsCommandInput, - ...additionalArguments: any -): Paginator { - // 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListFunctionsCommandInput, + ListFunctionsCommandOutput +>(LambdaClient, ListFunctionsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListLayerVersionsPaginator.ts b/clients/client-lambda/src/pagination/ListLayerVersionsPaginator.ts index 88fbca0b33cd..874f4eaf2b7f 100644 --- a/clients/client-lambda/src/pagination/ListLayerVersionsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListLayerVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListLayerVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLayerVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLayerVersions( +export const paginateListLayerVersions: ( config: LambdaPaginationConfiguration, input: ListLayerVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLayerVersionsCommandOutput; - 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListLayerVersionsCommandInput, + ListLayerVersionsCommandOutput +>(LambdaClient, ListLayerVersionsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListLayersPaginator.ts b/clients/client-lambda/src/pagination/ListLayersPaginator.ts index 9921b3978cf3..335efadfc3f8 100644 --- a/clients/client-lambda/src/pagination/ListLayersPaginator.ts +++ b/clients/client-lambda/src/pagination/ListLayersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListLayersCommand, ListLayersCommandInput, ListLayersCommandOutput } from "../commands/ListLayersCommand"; import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListLayersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLayersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLayers( +export const paginateListLayers: ( config: LambdaPaginationConfiguration, input: ListLayersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLayersCommandOutput; - 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListLayersCommandInput, + ListLayersCommandOutput +>(LambdaClient, ListLayersCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListProvisionedConcurrencyConfigsPaginator.ts b/clients/client-lambda/src/pagination/ListProvisionedConcurrencyConfigsPaginator.ts index 31b2c5ec7242..dd2a5ad6424d 100644 --- a/clients/client-lambda/src/pagination/ListProvisionedConcurrencyConfigsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListProvisionedConcurrencyConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListProvisionedConcurrencyConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProvisionedConcurrencyConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProvisionedConcurrencyConfigs( +export const paginateListProvisionedConcurrencyConfigs: ( config: LambdaPaginationConfiguration, input: ListProvisionedConcurrencyConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProvisionedConcurrencyConfigsCommandOutput; - 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListProvisionedConcurrencyConfigsCommandInput, + ListProvisionedConcurrencyConfigsCommandOutput +>(LambdaClient, ListProvisionedConcurrencyConfigsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListVersionsByFunctionPaginator.ts b/clients/client-lambda/src/pagination/ListVersionsByFunctionPaginator.ts index 473c1a434232..c029c78939af 100644 --- a/clients/client-lambda/src/pagination/ListVersionsByFunctionPaginator.ts +++ b/clients/client-lambda/src/pagination/ListVersionsByFunctionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListVersionsByFunctionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVersionsByFunctionCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVersionsByFunction( +export const paginateListVersionsByFunction: ( config: LambdaPaginationConfiguration, input: ListVersionsByFunctionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVersionsByFunctionCommandOutput; - 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; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListVersionsByFunctionCommandInput, + ListVersionsByFunctionCommandOutput +>(LambdaClient, ListVersionsByFunctionCommand, "Marker", "NextMarker", "MaxItems");