import { Paginator } from "@aws-sdk/types" ; import { DescribeEnvironmentManagedActionHistoryCommand , DescribeEnvironmentManagedActionHistoryCommandInput , DescribeEnvironmentManagedActionHistoryCommandOutput , } from "../commands/DescribeEnvironmentManagedActionHistoryCommand" ; import { ElasticBeanstalk } from "../ElasticBeanstalk" ; import { ElasticBeanstalkClient } from "../ElasticBeanstalkClient" ; import { ElasticBeanstalkPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < DescribeEnvironmentManagedActionHistoryCommandOutput > => { return await client . send ( new DescribeEnvironmentManagedActionHistoryCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < DescribeEnvironmentManagedActionHistoryCommandOutput > => { return await client . describeEnvironmentManagedActionHistory ( input , ... args ) ; } ; export async function * paginateDescribeEnvironmentManagedActionHistory ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . NextToken = token ; input [ "MaxItems" ] = config . pageSize ; if ( config . client instanceof ElasticBeanstalk ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof ElasticBeanstalkClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected ElasticBeanstalk | ElasticBeanstalkClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }