import { Paginator } from "@aws-sdk/types" ; import { DescribeDBClusterSnapshotsCommand , DescribeDBClusterSnapshotsCommandInput , DescribeDBClusterSnapshotsCommandOutput , } from "../commands/DescribeDBClusterSnapshotsCommand" ; import { RDS } from "../RDS" ; import { RDSClient } from "../RDSClient" ; import { RDSPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < DescribeDBClusterSnapshotsCommandOutput > => { return await client . send ( new DescribeDBClusterSnapshotsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < DescribeDBClusterSnapshotsCommandOutput > => { return await client . describeDBClusterSnapshots ( input , ... args ) ; } ; export async function * paginateDescribeDBClusterSnapshots ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . Marker = token ; input [ "MaxRecords" ] = config . pageSize ; if ( config . client instanceof RDS ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof RDSClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected RDS | RDSClient" ) ; } yield page ; token = page . Marker ; hasNext = ! ! token ; } return undefined ; }