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

package licensemanager

import (
	"context"

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

func listLicenseConfigurationsPages(conn *licensemanager.LicenseManager, input *licensemanager.ListLicenseConfigurationsInput, fn func(*licensemanager.ListLicenseConfigurationsOutput, bool) bool) error {
	return listLicenseConfigurationsPagesWithContext(context.Background(), conn, input, fn)
}

func listLicenseConfigurationsPagesWithContext(ctx context.Context, conn *licensemanager.LicenseManager, input *licensemanager.ListLicenseConfigurationsInput, fn func(*licensemanager.ListLicenseConfigurationsOutput, bool) bool) error {
	for {
		output, err := conn.ListLicenseConfigurationsWithContext(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 listLicenseSpecificationsForResourcePages(conn *licensemanager.LicenseManager, input *licensemanager.ListLicenseSpecificationsForResourceInput, fn func(*licensemanager.ListLicenseSpecificationsForResourceOutput, bool) bool) error {
	return listLicenseSpecificationsForResourcePagesWithContext(context.Background(), conn, input, fn)
}

func listLicenseSpecificationsForResourcePagesWithContext(ctx context.Context, conn *licensemanager.LicenseManager, input *licensemanager.ListLicenseSpecificationsForResourceInput, fn func(*licensemanager.ListLicenseSpecificationsForResourceOutput, bool) bool) error {
	for {
		output, err := conn.ListLicenseSpecificationsForResourceWithContext(ctx, input)
		if err != nil {
			return err
		}

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

		input.NextToken = output.NextToken
	}
	return nil
}
