Skip to content

list_personal_access_tokens

list_personal_access_tokens(
    organization_id: OrganizationId,
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
    user_id: Optional[EntityIdentifier] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListPersonalAccessTokensResponse

Returns a summary of your Personal Access Tokens.

Parameters:

  • organization_id (OrganizationId) –

    The Organization ID.

  • user_id (Optional[EntityIdentifier], default: None ) –

    The WorkMail User ID.

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

    The token from the previous response to query the next page.

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

    The maximum amount of items that should be returned in a response.

Raises:

  • EntityNotFoundException –

    The identifier supplied for the user, group, or resource does not exist in your organization.

  • EntityStateException –

    You are performing an operation on a user, group, or resource that isn't in the expected state, such as trying to delete an active user.

  • InvalidParameterException –

    One or more of the input parameters don't match the service's restrictions.

  • OrganizationNotFoundException –

    An operation received a valid organization identifier that either doesn't belong or exist in the system.

  • OrganizationStateException –

    The organization must have a valid state to perform certain operations on the organization or its members.

  • UnknownServiceError –

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

Source code in docs_src/capo_workmail/_services/work_mail.py
def list_personal_access_tokens(
    self,
    organization_id: "capo_workmail.types.organization_id.OrganizationId",
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
    user_id: Optional[
        "capo_workmail.types.entity_identifier.EntityIdentifier"
    ] = None,
    next_token: Optional["capo_workmail.types.next_token.NextToken"] = None,
    max_results: Optional["capo_workmail.types.max_results.MaxResults"] = None,
) -> "capo_workmail.types.list_personal_access_tokens_response.ListPersonalAccessTokensResponse":
    """<p> Returns a summary of your Personal Access Tokens. </p>

    Args:
        organization_id: <p> The Organization ID. </p>
        user_id: <p> The WorkMail User ID. </p>
        next_token: <p> The token from the previous response to query the next page.</p>
        max_results: <p> The maximum amount of items that should be returned in a response. </p>

    Raises:
        capo_workmail.errors.entity_not_found_exception.EntityNotFoundException: <p>The identifier supplied for the user, group, or resource does not exist in your organization.</p>
        capo_workmail.errors.entity_state_exception.EntityStateException: <p>You are performing an operation on a user, group, or resource that isn't in the expected state, such as trying to delete an active user.</p>
        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_personal_access_tokens_request.ListPersonalAccessTokensRequest]",
    ) -> OperationResponse[
        "capo_workmail.types.list_personal_access_tokens_response.ListPersonalAccessTokensResponse"
    ]:
        import capo_workmail._operations.work_mail_service.list_personal_access_tokens

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPersonalAccessTokens")
    )
    input_: capo_workmail.types.list_personal_access_tokens_request.ListPersonalAccessTokensRequest = {
        "organization_id": organization_id
    }
    if user_id is not None:
        input_["user_id"] = user_id
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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