Skip to content

list_workspace_service_account_tokens async

list_workspace_service_account_tokens(
    service_account_id: str,
    workspace_id: WorkspaceId,
    *,
    config_overrides: Optional[AsyncgrafanaClientConfig] = None,
    max_results: Optional[int] = None,
    next_token: Optional[PaginationToken] = None,
) -> ListWorkspaceServiceAccountTokensResponse

Returns a list of tokens for a workspace service account.

This does not return the key for each token. You cannot access keys after they are created. To create a new key, delete the token and recreate it.

Service accounts are only available for workspaces that are compatible with Grafana version 9 and above.

Parameters:

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

    The maximum number of tokens to include in the results.

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

    The token for the next set of service accounts to return. (You receive this token from a previous ListWorkspaceServiceAccountTokens operation.)

  • service_account_id (str) –

    The ID of the service account for which to return tokens.

  • workspace_id (WorkspaceId) –

    The ID of the workspace for which to return tokens.

Raises:

Source code in docs_src/capo_grafana/_services/async_grafana.py
async def list_workspace_service_account_tokens(
    self,
    service_account_id: str,
    workspace_id: "capo_grafana.types.workspace_id.WorkspaceId",
    *,
    config_overrides: Optional[AsyncgrafanaClientConfig] = None,
    max_results: Optional[int] = None,
    next_token: Optional[
        "capo_grafana.types.pagination_token.PaginationToken"
    ] = None,
) -> "capo_grafana.types.list_workspace_service_account_tokens_response.ListWorkspaceServiceAccountTokensResponse":
    """<p>Returns a list of tokens for a workspace service account.</p> <note> <p>This does not return the key for each token. You cannot access keys after they are created. To create a new key, delete the token and recreate it.</p> </note> <p>Service accounts are only available for workspaces that are compatible with Grafana version 9 and above.</p>

    Args:
        max_results: <p>The maximum number of tokens to include in the results.</p>
        next_token: <p>The token for the next set of service accounts to return. (You receive this token from a previous <code>ListWorkspaceServiceAccountTokens</code> operation.)</p>
        service_account_id: <p>The ID of the service account for which to return tokens.</p>
        workspace_id: <p>The ID of the workspace for which to return tokens.</p>

    Raises:
        capo_grafana.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action. </p>
        capo_grafana.errors.conflict_exception.ConflictException: <p>A resource was in an inconsistent state during an update or a deletion.</p>
        capo_grafana.errors.internal_server_exception.InternalServerException: <p>Unexpected error while processing the request. Retry the request.</p>
        capo_grafana.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that does not exist.</p>
        capo_grafana.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling. Retry the request.</p>
        capo_grafana.errors.validation_exception.ValidationException: <p>The value of a parameter in the request caused an error.</p>
        capo_grafana.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_grafana.types.list_workspace_service_account_tokens_request.ListWorkspaceServiceAccountTokensRequest]",
    ) -> AsyncOperationResponse[
        "capo_grafana.types.list_workspace_service_account_tokens_response.ListWorkspaceServiceAccountTokensResponse"
    ]:
        import capo_grafana._operations.aws_grafana_control_plane.list_workspace_service_account_tokens

        (
            output,
            http_response,
        ) = await capo_grafana._operations.aws_grafana_control_plane.list_workspace_service_account_tokens.async_list_workspace_service_account_tokens(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListWorkspaceServiceAccountTokens")
    )
    input_: capo_grafana.types.list_workspace_service_account_tokens_request.ListWorkspaceServiceAccountTokensRequest = {
        "service_account_id": service_account_id,
        "workspace_id": workspace_id,
    }
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output