import { Paginator } from "@aws-sdk/types" ; import { DescribeTagsCommand , DescribeTagsCommandInput , DescribeTagsCommandOutput , } from "../commands/DescribeTagsCommand" ; import { EFS } from "../EFS" ; import { EFSClient } from "../EFSClient" ; import { EFSPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < DescribeTagsCommandOutput > => { return await client . send ( new DescribeTagsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < DescribeTagsCommandOutput > => { return await client . describeTags ( input , ... args ) ; } ; export async function * paginateDescribeTags ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . Marker = token ; input [ "MaxItems" ] = config . pageSize ; if ( config . client instanceof EFS ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof EFSClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected EFS | EFSClient" ) ; } yield page ; token = page . NextMarker ; hasNext = ! ! token ; } return undefined ; }