import { Paginator } from "@aws-sdk/types" ; import { DescribeFleetAttributesCommand , DescribeFleetAttributesCommandInput , DescribeFleetAttributesCommandOutput , } from "../commands/DescribeFleetAttributesCommand" ; import { GameLift } from "../GameLift" ; import { GameLiftClient } from "../GameLiftClient" ; import { GameLiftPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < DescribeFleetAttributesCommandOutput > => { return await client . send ( new DescribeFleetAttributesCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < DescribeFleetAttributesCommandOutput > => { return await client . describeFleetAttributes ( input , ... args ) ; } ; export async function * paginateDescribeFleetAttributes ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . NextToken = token ; input [ "Limit" ] = config . pageSize ; if ( config . client instanceof GameLift ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof GameLiftClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected GameLift | GameLiftClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }