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

Add list_user_pool_clients with pagination and better pagination support for users and groups #267

Closed
wants to merge 3 commits into from

Conversation

wazy
Copy link

@wazy wazy commented Jul 26, 2024

This PR does the following:

  • better support for paginating through users
  • pagination support for groups
  • added list_user_pool_clients to support retrieving all clients of a user pool along with pagination support
  • made client_id optional for instantiation of Cognito class as it shouldn't be required for every usecase (e.g. a user may only want to retrieve information such as all users/groups/clients)
  • tests are included and tox is happy
  • it does NOT include any breaking changes so it is safe to merge

An example of why having pagination limit and explicit pagination token support is that this is useful in a very large pool let's say 1000 clients/groups/users where you need to have some way to request smaller chunks of items and then be able to continue from where you left off. I'm using this approach from a frontend calling lambda that uses these pycognito changes to retrieve pages of clients/groups/users one chunk at a time based on page_tokens passed back and forth.

Not sure if you are the correct one to tag for the PR review @ludeeus but let me know if you have any feedback/request for changes.

@wazy
Copy link
Author

wazy commented Jul 29, 2024

@ludeeus just added a commit to allow username to be specified for admin_update_profile along with a helper function to determine if attrs is already formatted for cognito - includes tests and doesn't break existing code

This can be done now to update a user's attributes ->

cognito = Cognito(user_pool_id=user_pool_id)
cognito.admin_update_profile(username=username, attrs=attrs)

@ludeeus
Copy link

ludeeus commented Jul 29, 2024

Hi @wazy ,
I have not fully looked at this yet.
But please split it up in several PRs, so each PR only add/change one thing.

And the token needs to be a local reference in the individual functions or there will be conflicts in an asynchronous workflow.

@wazy
Copy link
Author

wazy commented Jul 29, 2024

Hi @wazy , I have not fully looked at this yet. But please split it up in several PRs, so each PR only add/change one thing.

And the token needs to be a local reference in the individual functions or there will be conflicts in an asynchronous workflow.

I can break it into 2-3 PRs if you'd like.

I'm not sure asynch makes sense for the support of walking through the pagination manually since the next token becomes available once cognito responds with the requested results.

@wazy
Copy link
Author

wazy commented Jul 29, 2024

@ludeeus Created #268 #269 #270 to continue conversation 👍

@wazy wazy closed this Jul 29, 2024
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.

2 participants