// Code generated by "internal/generate/listpages/main.go -ListOps=ListTrafficPolicyVersions -Paginator=TrafficPolicyVersionMarker list_traffic_policy_versions_pages_gen.go"; DO NOT EDIT.

package route53

import (
	"context"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/route53"
)

func listTrafficPolicyVersionsPages(conn *route53.Route53, input *route53.ListTrafficPolicyVersionsInput, fn func(*route53.ListTrafficPolicyVersionsOutput, bool) bool) error {
	return listTrafficPolicyVersionsPagesWithContext(context.Background(), conn, input, fn)
}

func listTrafficPolicyVersionsPagesWithContext(ctx context.Context, conn *route53.Route53, input *route53.ListTrafficPolicyVersionsInput, fn func(*route53.ListTrafficPolicyVersionsOutput, bool) bool) error {
	for {
		output, err := conn.ListTrafficPolicyVersionsWithContext(ctx, input)
		if err != nil {
			return err
		}

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

		input.TrafficPolicyVersionMarker = output.TrafficPolicyVersionMarker
	}
	return nil
}
