Skip to content

Roles

roles

Roles resource group.

Wraps the org-scoped Roles endpoints:

  • GET /v1/compliance/organizations/{org_uuid}/roles — offset- paginated list of roles.
  • GET /v1/compliance/organizations/{org_uuid}/roles/{role_id} — single role fetch.
  • GET /v1/compliance/organizations/{org_uuid}/roles/{role_id}/permissions — offset-paginated list of permissions attached to a role.

Every method takes org_uuid because the endpoints live under the organisation path. Enumerate organisations via list to obtain UUIDs.

Role dataclass

An RBAC role defined inside an organisation.

Attributes:

Name Type Description
id str

Tagged role identifier.

name str

Display name.

description str

Free-form description.

created_at str | None

ISO 8601 creation timestamp, or None when not recorded.

updated_at str | None

ISO 8601 last-update timestamp, or None when not recorded.

extra dict[str, Any]

Any additional fields the API adds in a later revision.

from_dict classmethod

from_dict(body: Mapping[str, Any]) -> 'Role'

Build a Role from one decoded record.

Permission dataclass

A single permission attached to a role.

Permissions are flat triples of (resource type, resource id, action) — the role grants its holders the named action on the addressed resource.

Attributes:

Name Type Description
resource_type str

Type of resource the permission applies to (e.g. "project").

resource_id str

Identifier of the specific resource, or a wildcard when the role grants on all of them.

action str

Action permitted on the resource (e.g. "read").

extra dict[str, Any]

Any additional fields the API adds in a later revision.

from_dict classmethod

from_dict(body: Mapping[str, Any]) -> 'Permission'

Build a Permission from one decoded record.

Roles

Synchronous client for the Roles endpoints.

list

list(
    org_uuid: str,
    *,
    limit: int | None = None,
    page: str | None = None
) -> OffsetPage[Role]

Fetch one offset-paginated page of roles in an organisation.

Parameters:

Name Type Description Default
org_uuid str

Organisation UUID.

required
limit int | None

Maximum results per page (default 500, max 1000).

None
page str | None

Opaque pagination token from a prior response.

None

iter

iter(
    org_uuid: str, *, limit: int | None = None
) -> Iterator[Role]

Iterate every role in an organisation, auto-paginating.

get

get(org_uuid: str, role_id: str) -> Role

Fetch one role by ID.

list_permissions

list_permissions(
    org_uuid: str,
    role_id: str,
    *,
    limit: int | None = None,
    page: str | None = None
) -> OffsetPage[Permission]

Fetch one offset-paginated page of permissions for a role.

iter_permissions

iter_permissions(
    org_uuid: str, role_id: str, *, limit: int | None = None
) -> Iterator[Permission]

Iterate every permission on a role, auto-paginating.

AsyncRoles

Asynchronous client for the Roles endpoints.

list async

list(
    org_uuid: str,
    *,
    limit: int | None = None,
    page: str | None = None
) -> OffsetPage[Role]

Async analogue of list.

iter

iter(
    org_uuid: str, *, limit: int | None = None
) -> AsyncIterator[Role]

Async analogue of iter.

get async

get(org_uuid: str, role_id: str) -> Role

Async analogue of get.

list_permissions async

list_permissions(
    org_uuid: str,
    role_id: str,
    *,
    limit: int | None = None,
    page: str | None = None
) -> OffsetPage[Permission]

Async analogue of list_permissions.

iter_permissions

iter_permissions(
    org_uuid: str, role_id: str, *, limit: int | None = None
) -> AsyncIterator[Permission]

Async analogue of iter_permissions.