Skip to content

list_users

list_users(
    network_id: NetworkId,
    *,
    config_overrides: Optional[WickrClientConfig] = None,
    next_token: Optional[GenericString] = None,
    max_results: Optional[int] = None,
    sort_fields: Optional[GenericString] = None,
    sort_direction: Optional[SortDirection] = None,
    first_name: Optional[SensitiveString] = None,
    last_name: Optional[SensitiveString] = None,
    username: Optional[GenericString] = None,
    status: Optional[UserStatus] = None,
    group_id: Optional[GenericString] = None,
) -> ListUsersResponse

Retrieves a paginated list of users in a specified Wickr network. You can filter and sort the results based on various criteria such as name, status, or security group membership.

Parameters:

  • network_id (NetworkId) –

    The ID of the Wickr network from which to list users.

  • next_token (Optional[GenericString], default: None ) –

    The token for retrieving the next page of results. This is returned from a previous request when there are more results available.

  • max_results (Optional[int], default: None ) –

    The maximum number of users to return in a single page. Valid range is 1-100. Default is 10.

  • sort_fields (Optional[GenericString], default: None ) –

    The fields to sort users by. Multiple fields can be specified by separating them with '+'. Accepted values include 'username', 'firstName', 'lastName', 'status', and 'groupId'.

  • sort_direction (Optional[SortDirection], default: None ) –

    The direction to sort results. Valid values are 'ASC' (ascending) or 'DESC' (descending). Default is 'DESC'.

  • first_name (Optional[SensitiveString], default: None ) –

    Filter results to only include users with first names matching this value.

  • last_name (Optional[SensitiveString], default: None ) –

    Filter results to only include users with last names matching this value.

  • username (Optional[GenericString], default: None ) –

    Filter results to only include users with usernames matching this value.

  • status (Optional[UserStatus], default: None ) –

    Filter results to only include users with this status (1 for pending, 2 for active).

  • group_id (Optional[GenericString], default: None ) –

    Filter results to only include users belonging to this security group.

Raises:

  • BadRequestError –

    The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.

  • ForbiddenError –

    Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.

  • InternalServerError –

    An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.

  • RateLimitError –

    The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.

  • ResourceNotFoundError –

    The requested resource could not be found. This error occurs when you try to access or modify a network, user, bot, security group, or other resource that doesn't exist or has been deleted.

  • UnauthorizedError –

    The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.

  • ValidationError –

    One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Get paginated list of users

>>> client.list_users(network_id='12345678', max_results=20, sort_fields='username', sort_direction='ASC')
Filter by status and group
>>> client.list_users(network_id='12345678', status=1, group_id='BCTY8Qhe', max_results=10)
Empty user list for network with no users
>>> client.list_users(network_id='12345678')
Source code in docs_src/capo_wickr/_services/wickr.py
def list_users(
    self,
    network_id: "capo_wickr.types.network_id.NetworkId",
    *,
    config_overrides: Optional[WickrClientConfig] = None,
    next_token: Optional["capo_wickr.types.generic_string.GenericString"] = None,
    max_results: Optional[int] = None,
    sort_fields: Optional["capo_wickr.types.generic_string.GenericString"] = None,
    sort_direction: Optional[
        "capo_wickr.types.sort_direction.SortDirection"
    ] = None,
    first_name: Optional[
        "capo_wickr.types.sensitive_string.SensitiveString"
    ] = None,
    last_name: Optional["capo_wickr.types.sensitive_string.SensitiveString"] = None,
    username: Optional["capo_wickr.types.generic_string.GenericString"] = None,
    status: Optional["capo_wickr.types.user_status.UserStatus"] = None,
    group_id: Optional["capo_wickr.types.generic_string.GenericString"] = None,
) -> "capo_wickr.types.list_users_response.ListUsersResponse":
    """<p>Retrieves a paginated list of users in a specified Wickr network. You can filter and sort the results based on various criteria such as name, status, or security group membership.</p>

    Args:
        network_id: <p>The ID of the Wickr network from which to list users.</p>
        next_token: <p>The token for retrieving the next page of results. This is returned from a previous request when there are more results available.</p>
        max_results: <p>The maximum number of users to return in a single page. Valid range is 1-100. Default is 10.</p>
        sort_fields: <p>The fields to sort users by. Multiple fields can be specified by separating them with '+'. Accepted values include 'username', 'firstName', 'lastName', 'status', and 'groupId'.</p>
        sort_direction: <p>The direction to sort results. Valid values are 'ASC' (ascending) or 'DESC' (descending). Default is 'DESC'.</p>
        first_name: <p>Filter results to only include users with first names matching this value.</p>
        last_name: <p>Filter results to only include users with last names matching this value.</p>
        username: <p>Filter results to only include users with usernames matching this value.</p>
        status: <p>Filter results to only include users with this status (1 for pending, 2 for active).</p>
        group_id: <p>Filter results to only include users belonging to this security group.</p>

    Raises:
        capo_wickr.errors.bad_request_error.BadRequestError: <p>The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.</p>
        capo_wickr.errors.forbidden_error.ForbiddenError: <p>Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.</p>
        capo_wickr.errors.internal_server_error.InternalServerError: <p>An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.</p>
        capo_wickr.errors.rate_limit_error.RateLimitError: <p>The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.</p>
        capo_wickr.errors.resource_not_found_error.ResourceNotFoundError: <p>The requested resource could not be found. This error occurs when you try to access or modify a network, user, bot, security group, or other resource that doesn't exist or has been deleted.</p>
        capo_wickr.errors.unauthorized_error.UnauthorizedError: <p>The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.</p>
        capo_wickr.errors.validation_error.ValidationError: <p>One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.</p>
        capo_wickr.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Get paginated list of users

        >>> client.list_users(network_id='12345678', max_results=20, sort_fields='username', sort_direction='ASC')
        Filter by status and group

        >>> client.list_users(network_id='12345678', status=1, group_id='BCTY8Qhe', max_results=10)
        Empty user list for network with no users

        >>> client.list_users(network_id='12345678')
    """

    def _handler(
        req: "OperationRequest[capo_wickr.types.list_users_request.ListUsersRequest]",
    ) -> OperationResponse[
        "capo_wickr.types.list_users_response.ListUsersResponse"
    ]:
        import capo_wickr._operations.wickr_admin_api.list_users

        output, http_response = (
            capo_wickr._operations.wickr_admin_api.list_users.list_users(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_wickr.types.list_users_request.ListUsersRequest",
    ) -> dict[str, Any]:
        import capo_wickr.types.list_users_request

        return capo_wickr.types.list_users_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_wickr.types.list_users_response.ListUsersResponse",
    ) -> dict[str, Any]:
        import capo_wickr.types.list_users_response

        return capo_wickr.types.list_users_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ListUsers", redact_input=_redact_input, redact_output=_redact_output
        ),
    )
    input_: capo_wickr.types.list_users_request.ListUsersRequest = {
        "network_id": network_id
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if sort_fields is not None:
        input_["sort_fields"] = sort_fields
    if sort_direction is not None:
        input_["sort_direction"] = sort_direction
    if first_name is not None:
        input_["first_name"] = first_name
    if last_name is not None:
        input_["last_name"] = last_name
    if username is not None:
        input_["username"] = username
    if status is not None:
        input_["status"] = status
    if group_id is not None:
        input_["group_id"] = group_id

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output