aws_sdk_cognitoidentityprovider/client/
list_users.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3    /// Constructs a fluent builder for the [`ListUsers`](crate::operation::list_users::builders::ListUsersFluentBuilder) operation.
4    /// This operation supports pagination; See [`into_paginator()`](crate::operation::list_users::builders::ListUsersFluentBuilder::into_paginator).
5    ///
6    /// - The fluent builder is configurable:
7    ///   - [`user_pool_id(impl Into<String>)`](crate::operation::list_users::builders::ListUsersFluentBuilder::user_pool_id) / [`set_user_pool_id(Option<String>)`](crate::operation::list_users::builders::ListUsersFluentBuilder::set_user_pool_id):<br>required: **true**<br><p>The ID of the user pool where you want to display or search for users.</p><br>
8    ///   - [`attributes_to_get(impl Into<String>)`](crate::operation::list_users::builders::ListUsersFluentBuilder::attributes_to_get) / [`set_attributes_to_get(Option<Vec::<String>>)`](crate::operation::list_users::builders::ListUsersFluentBuilder::set_attributes_to_get):<br>required: **false**<br><p>A JSON array of user attribute names, for example <code>given_name</code>, that you want Amazon Cognito to include in the response for each user. When you don't provide an <code>AttributesToGet</code> parameter, Amazon Cognito returns all attributes for each user.</p> <p>Use <code>AttributesToGet</code> with required attributes in your user pool, or in conjunction with <code>Filter</code>. Amazon Cognito returns an error if not all users in the results have set a value for the attribute you request. Attributes that you can't filter on, including custom attributes, must have a value set in every user profile before an <code>AttributesToGet</code> parameter returns results.</p><br>
9    ///   - [`limit(i32)`](crate::operation::list_users::builders::ListUsersFluentBuilder::limit) / [`set_limit(Option<i32>)`](crate::operation::list_users::builders::ListUsersFluentBuilder::set_limit):<br>required: **false**<br><p>The maximum number of users that you want Amazon Cognito to return in the response.</p><br>
10    ///   - [`pagination_token(impl Into<String>)`](crate::operation::list_users::builders::ListUsersFluentBuilder::pagination_token) / [`set_pagination_token(Option<String>)`](crate::operation::list_users::builders::ListUsersFluentBuilder::set_pagination_token):<br>required: **false**<br><p>This API operation returns a limited number of results. The pagination token is an identifier that you can present in an additional API request with the same parameters. When you include the pagination token, Amazon Cognito returns the next set of items after the current list. Subsequent requests return a new pagination token. By use of this token, you can paginate through the full list of items.</p><br>
11    ///   - [`filter(impl Into<String>)`](crate::operation::list_users::builders::ListUsersFluentBuilder::filter) / [`set_filter(Option<String>)`](crate::operation::list_users::builders::ListUsersFluentBuilder::set_filter):<br>required: **false**<br><p>A filter string of the form <code>"AttributeName Filter-Type "AttributeValue"</code>. Quotation marks within the filter string must be escaped using the backslash (<code>\</code>) character. For example, <code>"family_name = \"Reddy\""</code>.</p> <ul>  <li>   <p><i>AttributeName</i>: The name of the attribute to search for. You can only search for one attribute at a time.</p></li>  <li>   <p><i>Filter-Type</i>: For an exact match, use <code>=</code>, for example, "<code>given_name = \"Jon\"</code>". For a prefix ("starts with") match, use <code>^=</code>, for example, "<code>given_name ^= \"Jon\"</code>".</p></li>  <li>   <p><i>AttributeValue</i>: The attribute value that must be matched for each user.</p></li> </ul> <p>If the filter string is empty, <code>ListUsers</code> returns all users in the user pool.</p> <p>You can only search for the following standard attributes:</p> <ul>  <li>   <p><code>username</code> (case-sensitive)</p></li>  <li>   <p><code>email</code></p></li>  <li>   <p><code>phone_number</code></p></li>  <li>   <p><code>name</code></p></li>  <li>   <p><code>given_name</code></p></li>  <li>   <p><code>family_name</code></p></li>  <li>   <p><code>preferred_username</code></p></li>  <li>   <p><code>cognito:user_status</code> (called <b>Status</b> in the Console) (case-insensitive)</p></li>  <li>   <p><code>status (called <b>Enabled</b> in the Console) (case-sensitive)</code></p></li>  <li>   <p><code>sub</code></p></li> </ul> <p>Custom attributes aren't searchable.</p><note>  <p>You can also list users with a client-side filter. The server-side filter matches no more than one attribute. For an advanced search, use a client-side filter with the <code>--query</code> parameter of the <code>list-users</code> action in the CLI. When you use a client-side filter, ListUsers returns a paginated list of zero or more users. You can receive multiple pages in a row with zero results. Repeat the query with each pagination token that is returned until you receive a null pagination token value, and then review the combined result.</p>  <p>For more information about server-side and client-side filtering, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html">FilteringCLI output</a> in the <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html">Command Line Interface User Guide</a>.</p> </note> <p>For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/how-to-manage-user-accounts.html#cognito-user-pools-searching-for-users-using-listusers-api">Searching for Users Using the ListUsers API</a> and <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/how-to-manage-user-accounts.html#cognito-user-pools-searching-for-users-listusers-api-examples">Examples of Using the ListUsers API</a> in the <i>Amazon Cognito Developer Guide</i>.</p><br>
12    /// - On success, responds with [`ListUsersOutput`](crate::operation::list_users::ListUsersOutput) with field(s):
13    ///   - [`users(Option<Vec::<UserType>>)`](crate::operation::list_users::ListUsersOutput::users): <p>An array of user pool users who match your query, and their attributes.</p>
14    ///   - [`pagination_token(Option<String>)`](crate::operation::list_users::ListUsersOutput::pagination_token): <p>The identifier that Amazon Cognito returned with the previous request to this operation. When you include a pagination token in your request, Amazon Cognito returns the next set of items in the list. By use of this token, you can paginate through the full list of items.</p>
15    /// - On failure, responds with [`SdkError<ListUsersError>`](crate::operation::list_users::ListUsersError)
16    pub fn list_users(&self) -> crate::operation::list_users::builders::ListUsersFluentBuilder {
17        crate::operation::list_users::builders::ListUsersFluentBuilder::new(self.handle.clone())
18    }
19}