Skip to content

list_users

list_users(
    organization_id: OrganizationId,
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
    filters: Optional[ListUsersFilters] = None,
) -> ListUsersResponse

Returns summaries of the organization's users.

Parameters:

  • organization_id (OrganizationId) –

    The identifier for the organization under which the users exist.

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

    The token to use to retrieve the next page of results. The first call does not contain any tokens.

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

    The maximum number of results to return in a single call.

  • filters (Optional[ListUsersFilters], default: None ) –

    Limit the user search results based on the filter criteria. You can only use one filter per request.

Raises:

Source code in docs_src/capo_workmail/_services/work_mail.py
def list_users(
    self,
    organization_id: "capo_workmail.types.organization_id.OrganizationId",
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
    next_token: Optional["capo_workmail.types.next_token.NextToken"] = None,
    max_results: Optional["capo_workmail.types.max_results.MaxResults"] = None,
    filters: Optional[
        "capo_workmail.types.list_users_filters.ListUsersFilters"
    ] = None,
) -> "capo_workmail.types.list_users_response.ListUsersResponse":
    """<p>Returns summaries of the organization's users.</p>

    Args:
        organization_id: <p>The identifier for the organization under which the users exist.</p>
        next_token: <p>The token to use to retrieve the next page of results. The first call does not contain any tokens.</p>
        max_results: <p>The maximum number of results to return in a single call.</p>
        filters: <p>Limit the user search results based on the filter criteria. You can only use one filter per request.</p>

    Raises:
        capo_workmail.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the input parameters don't match the service's restrictions.</p>
        capo_workmail.errors.organization_not_found_exception.OrganizationNotFoundException: <p>An operation received a valid organization identifier that either doesn't belong or exist in the system.</p>
        capo_workmail.errors.organization_state_exception.OrganizationStateException: <p>The organization must have a valid state to perform certain operations on the organization or its members.</p>
        capo_workmail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_workmail._operations.work_mail_service.list_users.list_users(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_workmail.types.list_users_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListUsers", redact_input=_redact_input)
    )
    input_: capo_workmail.types.list_users_request.ListUsersRequest = {
        "organization_id": organization_id
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if filters is not None:
        input_["filters"] = filters

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