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

Support AWS pagination when fetching resources #12

Closed
fxaguessy opened this issue Dec 5, 2016 · 4 comments
Closed

Support AWS pagination when fetching resources #12

fxaguessy opened this issue Dec 5, 2016 · 4 comments

Comments

@fxaguessy
Copy link
Contributor

If there are too many resources, they may be sent by bunches, which is currently not managed in awless.

@fxaguessy fxaguessy changed the title Properly fetch the resources from AWS Better fetch resources from AWS Feb 10, 2017
@simcap simcap changed the title Better fetch resources from AWS Support AWS pagination when fetching resources Feb 10, 2017
@simcap
Copy link
Contributor

simcap commented Feb 10, 2017

Basically support the aws-sdk-go NextToken used to retrieve the next page of results.

@ajkerrigan
Copy link
Contributor

I'd like to take a crack at this if you don't mind. I'd probably start with ListUsers since (selfishly) it is currently most relevant to my use of this tool. Any objections? Also, any aversion to using the SDK-provided paginators (ListUsersPages in this case) where available instead of explicitly handling the NextToken?

@simcap
Copy link
Contributor

simcap commented Feb 22, 2017

@ajkerrigan-mdsol Actually in this case you might take a crack at it since this fetcher is not automatically generated Go code.

We have a convention where files containing generated Go code logic have the gen_ suffix (ex: awless/cloud/aws/gen_api.go)

Your modification would then be in awless/cloud/aws/api.go. The method fetch_all_user_graph is manually implemented since we have some custom logic around fetching users.

Using ListUserPages make sense for this one. You will be able to test if it works properly with you live data.

Out of curiosity, it seems to be a large number of users you have to require some pagination?

@ajkerrigan
Copy link
Contributor

Thanks for the information, I'll check it out. The fetch_all_user_graph method is exactly where I was looking, so I'm glad to have confirmation.

And yes, plenty of users. I'm wondering if implementing a user-definable limit (via a maxresults or maxresults.<resource type> config setting perhaps) should accompany this change, since supporting pagination without limits can have unfortunate side effects (increased API requests with the risk of throttling, slower performance, unmanageable result sets, etc). One step at a time though!

ajkerrigan pushed a commit to ajkerrigan/awless that referenced this issue Feb 24, 2017
ajkerrigan pushed a commit to ajkerrigan/awless that referenced this issue Feb 24, 2017
fxaguessy added a commit that referenced this issue Feb 27, 2017
Support pagination when fetching IAM users. #12
@simcap simcap closed this as completed Mar 21, 2017
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

No branches or pull requests

3 participants