ServiceAccounts API Reference

ServiceAccounts

class neuro_sdk.ServiceAccounts

Service accounts subsystems. Service accounts can be used to generate tokens that can be used in automated environments by third-party services.

async-with async-for list() AsyncContextManager[AsyncIterator[ServiceAccount]][source]

List user’s service accounts, async iterator. Yields ServiceAccount instances.

coroutine create(name: Optional[str], default_cluster: Optional[str]) Tuple[ServiceAccount, str][source]

Create a service account.

Parameters
  • role (str) – Authorization role to use for this service account.

  • default_cluster (Optional[str]) – Default cluster to embed into generated token. Defaults to current cluster.

Returns

Pair of newly created service account info and token. This is the only way to get token of a service account.

coroutine get(id_or_name: str) ServiceAccount[source]

Get a service account with id or name id_or_name.

Parameters

id_or_name (str) – service account’s id or name.

Returns

Service account info (ServiceAccount)

coroutine rm(id_or_name: str) None[source]

Revoke and delete a service account with id or name id_or_name.

Parameters

id_or_name (str) – service account’s id or name.

ServiceAccount

class neuro_sdk.ServiceAccount

Read-only dataclass for describing service account instance.

id

The service account id, str.

role

Authorization role this service account is based on.

owner

The service account owner username, str.

name

The service account name set by user, unique among all user’s service accounts, str or None if no name was set.

default_cluster

A default cluster that this service account uses after login, str.

created_at

Service account creation timestamp, datetime.

role_deleted

True if corresponding role was deleted, otherwise False.