Role
Roles resource for user and permission role management.
SyncRoles
SyncRoles(client: SyncClient)
AsyncRoles
AsyncRoles(client: AsyncClient)
Bases: BaseResource['AsyncClient']
Async roles resource for RBAC role management.
Methods:
-
create–Create a new role.
-
delete–Delete role by ID.
-
get–Get role by ID.
-
get_all–List all roles.
-
patch–Partially update a role.
-
update–Fully update a role.
create
async
create(data: RoleCreate) -> str
Create a new role.
Parameters:
-
(dataRoleCreate) –The role creation data.
Returns: The ID of the created role.
delete
async
get
async
get(role_id: str) -> RoleInstance
Get role by ID.
Parameters:
-
(role_idstr) –The unique identifier of the role to retrieve.
Returns: The role instance corresponding to the provided ID.
patch
async
update
async
update(role_id: str, data: RoleUpdate) -> bool
Fully update a role.
Parameters:
-
(role_idstr) –The unique identifier of the role to update.
-
(dataRoleUpdate) –The complete role data for replacement.
Returns:
-
bool(bool) –True if the update was successful, False otherwise.
Request and response types: Role models.