// Code generated by "internal/generate/listpages/main.go -ListOps=DescribeDirectories,DescribeRegions"; DO NOT EDIT.

package ds

import (
	"context"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/directoryservice"
	"github.com/aws/aws-sdk-go/service/directoryservice/directoryserviceiface"
)

func describeDirectoriesPages(ctx context.Context, conn directoryserviceiface.DirectoryServiceAPI, input *directoryservice.DescribeDirectoriesInput, fn func(*directoryservice.DescribeDirectoriesOutput, bool) bool) error {
	for {
		output, err := conn.DescribeDirectoriesWithContext(ctx, input)
		if err != nil {
			return err
		}

		lastPage := aws.StringValue(output.NextToken) == ""
		if !fn(output, lastPage) || lastPage {
			break
		}

		input.NextToken = output.NextToken
	}
	return nil
}
func describeRegionsPages(ctx context.Context, conn directoryserviceiface.DirectoryServiceAPI, input *directoryservice.DescribeRegionsInput, fn func(*directoryservice.DescribeRegionsOutput, bool) bool) error {
	for {
		output, err := conn.DescribeRegionsWithContext(ctx, input)
		if err != nil {
			return err
		}

		lastPage := aws.StringValue(output.NextToken) == ""
		if !fn(output, lastPage) || lastPage {
			break
		}

		input.NextToken = output.NextToken
	}
	return nil
}
