Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerated Clients with Paginator Support #885

Merged
merged 3 commits into from
Nov 24, 2020

Conversation

skmcgrail
Copy link
Member

@skmcgrail skmcgrail commented Nov 9, 2020

Adds support for paginators.

Related #820
Related aws/aws-sdk-go#3513
Closes #439

Depends on:
aws/smithy-go#234
smithy-lang/smithy#628

@skmcgrail skmcgrail force-pushed the paginators branch 2 times, most recently from c113f2f to c599e40 Compare November 9, 2020 22:16
@skmcgrail skmcgrail requested review from JordonPhillips and jasdel and removed request for JordonPhillips November 9, 2020 22:44
service/accessanalyzer/paginators.go Outdated Show resolved Hide resolved
service/accessanalyzer/paginators.go Outdated Show resolved Hide resolved
service/accessanalyzer/paginators.go Outdated Show resolved Hide resolved
service/alexaforbusiness/api_op_ListSkills.go Outdated Show resolved Hide resolved
service/s3/api_op_ListObjectsV2.go Show resolved Hide resolved
@jasdel
Copy link
Contributor

jasdel commented Nov 18, 2020

What do you think about the following as a way we can simplify some of the logic around that Limit option value.

The Paginator should auto fill Limit option based on the the value in the Input struct. So if a user does use the func option for setting the Limit option it would start off in what ever value was in the Input parameter if there was one.

This strategy highlights a question: What if user wants to clear the page size limit via the Limit option? How would this be done? Would Limit option value of 0 be translated to be the zero value of a boxed limit input member?

// For boxed PageSize
var options PaginatorOptions
options = ptr.ToInt32(input.PageSize)


// For unboxed PageSize
var options PaginatorOptions
options.Limit = input.PageSize
// if PageSize is boxed
if p.options.Limit == 0 {
     input.PageSize = nil
} else {
    input.PageSize = ptr.Int32(p.options.Limit)
}

// if PageSize is unboxed
input.PageSize = p.options.Limit

The above has one notable downside it is impossible to send a page size of 0 with this strategy. Arguably that probably is OK, because the behavior isn't really well defined if 0 were to be sent, Could be failure be service, could be infinite loop, service could ignore page size and use a default.

@skmcgrail skmcgrail merged commit c0ea711 into aws:master Nov 24, 2020
@skmcgrail skmcgrail deleted the paginators branch November 24, 2020 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactoring API client Paginators for better refactored API Client
3 participants