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

package autoscalingplans

import (
	"context"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/autoscalingplans"
	"github.com/aws/aws-sdk-go/service/autoscalingplans/autoscalingplansiface"
)

func describeScalingPlansPages(ctx context.Context, conn autoscalingplansiface.AutoScalingPlansAPI, input *autoscalingplans.DescribeScalingPlansInput, fn func(*autoscalingplans.DescribeScalingPlansOutput, bool) bool) error {
	for {
		output, err := conn.DescribeScalingPlansWithContext(ctx, input)
		if err != nil {
			return err
		}

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

		input.NextToken = output.NextToken
	}
	return nil
}
