aistore.sdk.authn.role_manager

View as Markdown

Module Contents

Classes

NameDescription
RoleManagerManages role-related operations.

Data

logger

API

class aistore.sdk.authn.role_manager.RoleManager(
client: aistore.sdk.request_client.RequestClient
)

Manages role-related operations.

This class provides methods to interact with roles, including retrieving, creating, updating, and deleting role information.

Parameters:

client
RequestClient

The RequestClient used to make HTTP requests.

client
RequestClient

Returns the RequestClient instance used by this RoleManager.

aistore.sdk.authn.role_manager.RoleManager.create(
name: str,
desc: str,
cluster_alias: str,
perms: typing.List[aistore.sdk.authn.access_attr.AccessAttr],
bucket_name: typing.Optional[str] = None
) -> aistore.sdk.authn.types.RoleInfo

Creates a new role.

Parameters:

name
str

The name of the role.

desc
str

A description of the role.

cluster_alias
str

The alias of the cluster this role will have access to.

perms
List[AccessAttr]

A list of permissions to be granted for this role.

bucket_name
strDefaults to None

The name of the bucket this role will have access to.

Returns: RoleInfo

Information about the newly created role.

Raises:

  • aistore.sdk.errors.AISError: All other types of errors with AIStore.
  • requests.RequestException: If the HTTP request fails.
aistore.sdk.authn.role_manager.RoleManager.delete(
name: str,
missing_ok: bool = False
) -> None

Deletes a role.

Parameters:

name
str

The name of the role to delete.

missing_ok
boolDefaults to False

Ignore error if role does not exist. Defaults to False

Raises:

  • ErrRoleNotFound: If the role does not exist and missing_ok is False.
  • aistore.sdk.errors.AISError: All other types of errors with AIStore.
  • requests.RequestException: If the HTTP request fails.
aistore.sdk.authn.role_manager.RoleManager.get(
role_name: str
) -> aistore.sdk.authn.types.RoleInfo

Retrieves information about a specific role.

Parameters:

role_name
str

The name of the role to retrieve.

Returns: RoleInfo

Information about the specified role.

Raises:

  • aistore.sdk.errors.AISError: All other types of errors with AIStore.
  • requests.RequestException: If the HTTP request fails.
aistore.sdk.authn.role_manager.RoleManager.list() -> aistore.sdk.authn.types.RolesList

Retrieves information about all roles.

Returns: RolesList

A list containing information about all roles.

Raises:

  • aistore.sdk.errors.AISError: All other types of errors with AIStore.
  • requests.RequestException: If the HTTP request fails.
aistore.sdk.authn.role_manager.RoleManager.update(
name: str,
desc: typing.Optional[str] = None,
cluster_alias: typing.Optional[str] = None,
perms: typing.Optional[typing.List[aistore.sdk.authn.access_attr.AccessAttr]] = None,
bucket_name: typing.Optional[str] = None
) -> None

Updates an existing role.

Parameters:

name
str

The name of the role.

desc
strDefaults to None

An updated description of the role.

cluster_alias
strDefaults to None

The alias of the cluster this role will have access to.

perms
List[AccessAttr]Defaults to None

A list of updated permissions to be granted for this role.

bucket_name
strDefaults to None

The name of the bucket this role will have access to.

Raises:

  • aistore.sdk.errors.AISError: All other types of errors with AIStore.
  • requests.RequestException: If the HTTP request fails.
  • ValueError: If the role does not exist or if invalid parameters are provided.
aistore.sdk.authn.role_manager.logger = get_logger(__name__)