Skip to main content

enterprise_ai.tenant

Source: sdks/python/src/enterprise_ai/tenant/__init__.py. Back to the Python SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class TenantsClient​

/v1/tenants.

Resource

TenantsClient.create​

create(slug: str, name: str, **extra: Any) -> Any

Create a tenant. Creates a tenant and makes each subject of admins its tenant_admin. Needs platform_admin. A slug already used answers 409 conflict. Writes the audit event tenant.create in the chain of the new tenant.

Route: /v1/tenants (POST).

NameTypeDefaultRequiredDescription
slugstryesShort identifier of the tenant, lowercase letters, digits and hyphens, 2 to 63 characters. Also used in the tenant claim and in directory group names.
namestryesDisplay name, 1 to 200 characters.
**extraAnynoExtra fields merged into the request body.

Returns: Any. Decoded JSON answer of the operation "Create a tenant".

Raises: the typed errors of the transport (Errors).

TenantsClient.get​

get(tenant_id: str) -> Any

Get a tenant. Returns one tenant: slug, name, status, data residency and settings. A tenant the caller may not see answers 404 not_found.

Route: /v1/tenants/{tenant_id} (GET).

NameTypeDefaultRequiredDescription
tenant_idstryesIdentifier (UUID) of the tenant.

Returns: Any. Decoded JSON answer of the operation "Get a tenant".

Raises: the typed errors of the transport (Errors).

TenantsClient.list​

list(**page: Any) -> Any

List the tenants. Lists the tenants the caller may see, ordered by slug, paginated: their own tenant for a tenant credential, every tenant for a platform administrator.

Route: /v1/tenants (GET).

NameTypeDefaultRequiredDescription
**pageAnynoPagination options passed to the listing: limit (maximum number of items per page) and cursor (the next_cursor of the previous page). Iterating the returned page follows every cursor.

Returns: Any. Decoded JSON answer of the operation "List the tenants".

Raises: the typed errors of the transport (Errors).

TenantsClient.update​

update(tenant_id: str, **changes: Any) -> Any

Update a tenant. Changes the name, data residency, settings or status of a tenant. Needs tenant_admin; changing status (active or suspended) needs a platform administrator (403 forbidden). A suspended tenant answers 403 tenant_suspended to every credential. Writes the audit event tenant.update.

Route: /v1/tenants/{tenant_id} (PATCH).

NameTypeDefaultRequiredDescription
tenant_idstryesIdentifier (UUID) of the tenant.
**changesAnynoFields of the tenant to change, sent as the PATCH body.

Returns: Any. Decoded JSON answer of the operation "Update a tenant".

Raises: the typed errors of the transport (Errors).

Class ProjectsClient​

/v1/projects and project environments.

Resource

ProjectsClient.create​

create(slug: str, name: str, **extra: Any) -> Any

Create a project. Creates a project in the tenant of the caller. Needs tenant_admin.

Route: /v1/projects (POST).

NameTypeDefaultRequiredDescription
slugstryesShort identifier of the project, lowercase letters, digits and hyphens, at most 63 characters, unique in the tenant. Used in the X-Project header.
namestryesDisplay name, 1 to 200 characters.
**extraAnynoExtra fields merged into the request body.

Returns: Any. Decoded JSON answer of the operation "Create a project".

Raises: the typed errors of the transport (Errors).

ProjectsClient.create_environment​

create_environment(project_id: str, name: str, **extra: Any) -> Any

Create an environment. Adds an environment (dev, test, staging or prod) to the project. Needs tenant_admin and the relation editor on the project. An environment that already exists answers 409 conflict. Writes the audit event environment.create.

Route: /v1/projects/{project_id}/environments (POST).

NameTypeDefaultRequiredDescription
project_idstryesIdentifier (UUID) of the project.
namestryesdev, test, staging or prod.
**extraAnynoExtra fields merged into the request body.

Returns: Any. Decoded JSON answer of the operation "Create an environment".

Raises: the typed errors of the transport (Errors).

ProjectsClient.delete​

delete(project_id: str) -> Any

Delete a project. Deletes the project and its environments. Needs tenant_admin and the relation owner on the project (403 relation_required). Objects that still reference the project may block the deletion (409 conflict). Writes the audit event project.delete. Answers 204.

Route: /v1/projects/{project_id} (DELETE).

NameTypeDefaultRequiredDescription
project_idstryesIdentifier (UUID) of the project.

Returns: Any. Decoded JSON answer of the operation "Delete a project".

Raises: the typed errors of the transport (Errors).

ProjectsClient.get​

get(project_id: str) -> Any

Get a project. Returns the project with its environments. Needs the relation viewer on the project (403 relation_required, audited). Answers 404 not_found for an unknown project.

Route: /v1/projects/{project_id} (GET).

NameTypeDefaultRequiredDescription
project_idstryesIdentifier (UUID) of the project.

Returns: Any. Decoded JSON answer of the operation "Get a project".

Raises: the typed errors of the transport (Errors).

ProjectsClient.list​

list(**page: Any) -> Any

List the projects. Lists the projects of the tenant ordered by slug, paginated, optionally filtered by organization or business unit. Open to any member of the tenant.

Route: /v1/projects (GET).

NameTypeDefaultRequiredDescription
**pageAnynoPagination options passed to the listing: limit (maximum number of items per page) and cursor (the next_cursor of the previous page). Iterating the returned page follows every cursor.

Returns: Any. Decoded JSON answer of the operation "List the projects".

Raises: the typed errors of the transport (Errors).

ProjectsClient.list_environments​

list_environments(project_id: str) -> Any

List the environments of a project. Lists the environments of the project, ordered by name. Needs the relation viewer on the project. Not paginated: next_cursor is always null.

Route: /v1/projects/{project_id}/environments (GET).

NameTypeDefaultRequiredDescription
project_idstryesIdentifier (UUID) of the project.

Returns: Any. Decoded JSON answer of the operation "List the environments of a project".

Raises: the typed errors of the transport (Errors).

ProjectsClient.update​

update(project_id: str, **changes: Any) -> Any

Update a project. Changes the name, description, settings, metadata or attachment of a project. Sending organization_id or business_unit_id as null detaches the project. The unit must belong to the organization (422 invalid_hierarchy). Needs tenant_admin and the relation editor on the project. Send expected_version to detect a concurrent change (409 version_conflict). Writes the audit event project.update.

Route: /v1/projects/{project_id} (PATCH).

NameTypeDefaultRequiredDescription
project_idstryesIdentifier (UUID) of the project.
**changesAnynoFields of the project to change, sent as the PATCH body.

Returns: Any. Decoded JSON answer of the operation "Update a project".

Raises: the typed errors of the transport (Errors).

Class OrganizationsClient​

/v1/organizations: organizations of the tenant (tenant hierarchy, ADR-0156).

Resource

OrganizationsClient.create​

create(slug: str, name: str, description: str | None = None, metadata: dict[str, Any] | None = None) -> Any

Create an organization. Creates an organization in the tenant. Needs tenant_admin. A slug already used answers 409 conflict. Writes the audit event organization.create.

Route: /v1/organizations (POST).

NameTypeDefaultRequiredDescription
slugstryesShort identifier, lowercase letters, digits and hyphens, starting with a letter or a digit, at most 63 characters. Unique, it cannot be changed later.
namestryesDisplay name, 1 to 200 characters.
descriptionstr | NoneNonenoDescription, at most 2000 characters (empty by default).
metadatadict[str, Any] | NoneNonenoFree key-value pairs stored with the object. Checked by the database: a refused object answers 422 invalid_metadata.

Returns: Any. Decoded JSON answer of the operation "Create an organization".

Raises: the typed errors of the transport (Errors).

OrganizationsClient.list​

list(**page: Any) -> Any

List the organizations. Lists the organizations of the tenant, paginated. Open to any member of the tenant.

Route: /v1/organizations (GET).

NameTypeDefaultRequiredDescription
**pageAnynoPagination options passed to the listing: limit (maximum number of items per page) and cursor (the next_cursor of the previous page). Iterating the returned page follows every cursor.

Returns: Any. Decoded JSON answer of the operation "List the organizations".

Raises: the typed errors of the transport (Errors).

OrganizationsClient.update​

update(organization_id: str, expected_version: int | None = None, **changes: Any) -> Any

Update an organization. Changes the name, description, status (active or archived) or metadata of an organization. Needs tenant_admin. Send expected_version to detect a concurrent change (409 version_conflict). Writes the audit event organization.update.

Route: /v1/organizations/{organization_id} (PATCH).

NameTypeDefaultRequiredDescription
organization_idstryesIdentifier (UUID) of the organization.
expected_versionint | NoneNonenoVersion the caller last read. A stale version answers 409 version_conflict (optimistic concurrency).
**changesAnynoFields of the organization to change, sent as the PATCH body.

Returns: Any. Decoded JSON answer of the operation "Update an organization".

Raises: the typed errors of the transport (Errors).

Class BusinessUnitsClient​

/v1/business-units: business units of an organization, optionally nested (tenant hierarchy).

Resource

BusinessUnitsClient.create​

create(organization_id: str, slug: str, name: str, parent_id: str | None = None, description: str | None = None, metadata: dict[str, Any] | None = None) -> Any

Create a business unit. Creates a business unit in an organization, optionally under a parent unit of the same organization (422 invalid_hierarchy otherwise). Needs tenant_admin. A slug already used answers 409 conflict. Writes the audit event business_unit.create.

Route: /v1/business-units (POST).

NameTypeDefaultRequiredDescription
organization_idstryesOrganization that holds the unit. Required.
slugstryesShort identifier, lowercase letters, digits and hyphens, starting with a letter or a digit, at most 63 characters. Unique, it cannot be changed later.
namestryesDisplay name, 1 to 200 characters.
parent_idstr | NoneNonenoParent unit in the same organization; null for a top level unit. Cannot be changed later.
descriptionstr | NoneNonenoDescription, at most 2000 characters (empty by default).
metadatadict[str, Any] | NoneNonenoFree key-value pairs stored with the object. Checked by the database: a refused object answers 422 invalid_metadata.

Returns: Any. Decoded JSON answer of the operation "Create a business unit".

Raises: the typed errors of the transport (Errors).

BusinessUnitsClient.list​

list(organization_id: str | None = None, parent_id: str | None = None, **page: Any) -> Any

List the business units. Lists the business units of the tenant, paginated, optionally filtered by organization or by parent unit. Open to any member of the tenant.

Route: /v1/business-units (GET).

NameTypeDefaultRequiredDescription
organization_idstr | NoneNonenoOnly the units of this organization.
parent_idstr | NoneNonenoOnly the direct children of this business unit.
**pageAnynoPagination options passed to the listing: limit (maximum number of items per page) and cursor (the next_cursor of the previous page). Iterating the returned page follows every cursor.

Returns: Any. Decoded JSON answer of the operation "List the business units".

Raises: the typed errors of the transport (Errors).

BusinessUnitsClient.update​

update(business_unit_id: str, expected_version: int | None = None, **changes: Any) -> Any

Update a business unit. Changes the name, description, status (active or archived) or metadata of a business unit. Its organization and parent cannot change. Needs tenant_admin. Send expected_version to detect a concurrent change (409 version_conflict). Writes the audit event business_unit.update.

Route: /v1/business-units/{business_unit_id} (PATCH).

NameTypeDefaultRequiredDescription
business_unit_idstryesIdentifier (UUID) of the business unit.
expected_versionint | NoneNonenoVersion the caller last read. A stale version answers 409 version_conflict (optimistic concurrency).
**changesAnynoFields of the business unit to change, sent as the PATCH body.

Returns: Any. Decoded JSON answer of the operation "Update a business unit".

Raises: the typed errors of the transport (Errors).