runzero.api.admin.custom_integrations

Administrative management of runZero custom integrations, including write operations.

These operations are privileged and require an account token directly or an OAuth key that can generate one.

Module Contents

Classes

CRUDAsset

A Pydantic-compliant class for marshaling custom assets.

CRUDImportAsset

A wrapper class for importing assets via CRUD.

CustomIntegrationAssetAdmin

Allows administration of custom integration-related features of assets.

CustomIntegrationAssetSet

A Pydantic-compliant class for marshaling custom asset ids.

CustomIntegrationAttributeSet

A Pydantic-compliant class for marshaling custom attributes.

CustomIntegrationsAdmin

Full Management of custom integrations.

class runzero.api.admin.custom_integrations.CRUDAsset[source]

Bases: pydantic.BaseModel

A Pydantic-compliant class for marshaling custom assets.

class Config[source]

Inner config class.

merge_import_asset(import_asset: runzero.types.ImportAsset) None[source]

Merge an existing ImportAsset with this CRUD asset.

class runzero.api.admin.custom_integrations.CRUDImportAsset[source]

Bases: pydantic.BaseModel

A wrapper class for importing assets via CRUD.

class runzero.api.admin.custom_integrations.CustomIntegrationAssetAdmin(client: runzero.client.Client, integration_id: uuid.UUID)[source]

Allows administration of custom integration-related features of assets.

This allows for assets to be created via a custom integration, without creating a runZero import task, and for setting of attributes on assets using this custom integration.

Parameters:

client (runzero.client.Client) – A handle to the runzero.Client which manages interactions with the runZero server.

Constructor methods.

bulk_remove_custom_integration(org_id: uuid.UUID, asset_ids: List[uuid.UUID]) None[source]

Removes a custom integration from a list of assets.

Parameters:
  • org_id (uuid.UUID) – organization id

  • asset_ids (List[uuid.UUID]) – the list of assets to update

Raises:

AuthError, ClientError, ServerError

bulk_update_custom_attributes(org_id: uuid.UUID, search: str, attributes: Dict[str, str], site: uuid.UUID | None = None, limit: int = 0) int[source]

Adds, deletes, and updates custom integration attributes on assets matching the given search.

Parameters:
  • org_id (uuid.UUID) – organization id

  • search (str) – a search query to locate assets to update

  • attributes (Dict[str, str]) – a dictionary of key-value pairs to update; empty values delete attributes

  • site (Optional[uuid.UUID]) – limit the search to a given site

  • limit (int) – limit the number of query results

Returns:

An integer indicating the number of assets updated

Raises:

AuthError, ClientError, ServerError

Return type:

int

create_asset(org_id: uuid.UUID, site_id: uuid.UUID, asset: runzero.types.ImportAsset) uuid.UUID[source]

Create a new asset in the specified organization and site, using this custom integration..

Note that not all fields of an ImportAsset can be used when creating an asset directly.

Parameters:
  • org_id (uuid.UUID) – organization id

  • site_id (uuid.UUID) – site id

  • asset (runzero.types.ImportAsset) – a description of the asset to be created:

Returns:

A UUID identifying the new asset in runZero.

Raises:

AuthError, ClientError, ServerError

Return type:

uuid.UUID

remove_custom_integration(org_id: uuid.UUID, asset_id: uuid.UUID) None[source]

Removes a custom integration from a specific asset.

Parameters:
Raises:

AuthError, ClientError, ServerError

update_custom_attributes(org_id: uuid.UUID, asset_id: uuid.UUID, attributes: Dict[str, str]) int[source]

Adds, deletes, or updates custom integration attributes on a specific asset.

Parameters:
  • org_id (uuid.UUID) – organization id

  • asset_id (uuid.UUID) – the asset to update

  • attributes (Dict[str, str]) – a dictionary of key-value pairs to update; empty values delete attributes

Returns:

An integer indicating the number of assets updated

Raises:

AuthError, ClientError, ServerError

Return type:

int

class runzero.api.admin.custom_integrations.CustomIntegrationAssetSet[source]

Bases: pydantic.BaseModel

A Pydantic-compliant class for marshaling custom asset ids.

class runzero.api.admin.custom_integrations.CustomIntegrationAttributeSet[source]

Bases: pydantic.BaseModel

A Pydantic-compliant class for marshaling custom attributes.

class runzero.api.admin.custom_integrations.CustomIntegrationsAdmin(client: runzero.client.Client)[source]

Full Management of custom integrations.

Custom integrations are descriptive registered associations between integrations of data and assets imported which are associated with those integrations.

This is a superset of operations available in runzero.custom_integrations.CustomIntegrations which allows only read operations.

Parameters:

client (runzero.client.Client) – A handle to the runzero.Client which manages interactions with the runZero server.

Constructor method

PYTHON_ICON

A default icon representing a custom integration defined via this Python SDK.

create(name: str, description: str | None = None, icon: bytes | bytearray | memoryview | pathlib.Path | str | None = PYTHON_ICON) runzero.types.CustomIntegration[source]

Creates a new custom integration.

Parameters:
  • name (str) – Name of custom integration to be created in to your account. The name may not contain spaces, tabs, or other whitespace

  • description (Optional[str]) – Optional description of custom integration to be created

  • icon (Optional[Union[bytes, bytearray, memoryview, pathlib.Path, str]]) – Optional file path to, or bytes of icon data. The icon must be a png formatted image with a maximum size of 32x32. Icon format is validated by the server. The default value assigns your custom data source the Python logo to indicate it was created by this SDK. Use None to have the server choose the default custom integration logo, a grey runZero logo

Returns:

CustomIntegration created

Raises:

AuthError, ClientError, ServerError

Return type:

runzero.types.CustomIntegration

delete(custom_integration_id: uuid.UUID) runzero.types.CustomIntegration[source]

Deletes a custom integration from your account.

Parameters:

custom_integration_id (uuid.UUID) – custom integration id to delete

Returns:

CustomIntegration deleted

Raises:

AuthError, ClientError, ServerError

Return type:

runzero.types.CustomIntegration

get(name: str | None = None, custom_integration_id: uuid.UUID | None = None) runzero.types.CustomIntegration | None[source]

Retrieves runZero custom integrations with either the matching ID or Name.

Parameters:
  • name (Optional[str]) – Optional, name of the custom integration to retrieve

  • custom_integration_id (Optional[uuid.UUID]) – Optional, the id of the custom integration to retrieve

Raises:

AuthError, ClientError, ServerError ValueError if neither custom_integration_id nor name are provided.

Returns:

The matching CustomIntegration or None

Return type:

Optional[runzero.types.CustomIntegration]

get_all() List[runzero.types.CustomIntegration][source]

Lists all custom integrations available to your account.

Returns:

List of custom integrations

Raises:

AuthError, ClientError, ServerError

Return type:

List[runzero.types.CustomIntegration]

get_asset_admin_handle(custom_integration_id: uuid.UUID) CustomIntegrationAssetAdmin | None[source]

Gets a CustomIntegrationAdmin object to manipulate assets related to the given integration.

Parameters:

custom_integration_id (uuid.UUID) – The ID of the custom integration.

Raises:

AuthError, ClientError, ServerError ValueError if neither custom_integration_id nor name are provided.

Returns:

The matching CustomIntegrationAssetAdmin or None

Return type:

Optional[CustomIntegrationAssetAdmin]

update(custom_integration_id: uuid.UUID, source_options: runzero.types.BaseCustomIntegration) runzero.types.CustomIntegration[source]

Updates a custom integration associated with your account.

Parameters:
  • custom_integration_id (uuid.UUID) – custom integration with updated values

  • source_options (runzero.types.BaseCustomIntegration) – custom integration request values to update

Returns:

CustomIntegration updated

Raises:

AuthError, ClientError, ServerError

Return type:

runzero.types.CustomIntegration