import { Paginator } from "@aws-sdk/types" ; import { GetReadinessCheckResourceStatusCommand , GetReadinessCheckResourceStatusCommandInput , GetReadinessCheckResourceStatusCommandOutput , } from "../commands/GetReadinessCheckResourceStatusCommand" ; import { Route53RecoveryReadiness } from "../Route53RecoveryReadiness" ; import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient" ; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < GetReadinessCheckResourceStatusCommandOutput > => { return await client . send ( new GetReadinessCheckResourceStatusCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < GetReadinessCheckResourceStatusCommandOutput > => { return await client . getReadinessCheckResourceStatus ( input , ... args ) ; } ; export async function * paginateGetReadinessCheckResourceStatus ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . NextToken = token ; input [ "MaxResults" ] = config . pageSize ; if ( config . client instanceof Route53RecoveryReadiness ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof Route53RecoveryReadinessClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }