runzero.api.sites

Management of an organization’s sites.

Module Contents

Classes

SiteOptions

Sites

Management of runZero sites.

class runzero.api.sites.Sites(client: runzero.client.Client)[source]

Management of runZero sites.

Assets, tasks, and other objects are contained within or associated with Sites.

Parameters:

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

Constructor method

create(org_id: uuid.UUID, site_options: runzero.types.SiteOptions) runzero.types.Site | None[source]

Creates a new site in the given org.

Parameters:
  • org_id (uuid.UUID) – The ID of the organization to operate against

  • site_options (runzero.types.SiteOptions) – Description of site to create

Returns:

Site created or None

Raises:

AuthError, ClientError, ServerError

Return type:

Optional[runzero.types.Site]

delete(org_id: uuid.UUID, site_id: uuid.UUID) None[source]

Deletes a site from your account.

Parameters:
  • org_id (uuid.UUID) – The ID of the organization to operate against

  • site_id (uuid.UUID) – Custom asset site id to delete

Returns:

None

Raises:

AuthError, ClientError, ServerError

Return type:

None

get(org_id: uuid.UUID, name: str | None = None, site_id: uuid.UUID | None = None) runzero.types.Site | None[source]

Retrieves the runZero Site with the provided name or id, if it exists in your account

Parameters:
  • org_id (uuid.UUID) – The ID of the organization to operate against

  • name (Optional[str]) – Optional name of the site to retrieve. If not provided, must provide site_id.

  • site_id (Optional[uuid.UUID]) – Optional id of the site to retrieve. If not provided, must provide name.

Returns:

site requested or None

Raises:

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

Return type:

Optional[runzero.types.Site]

get_all(org_id: uuid.UUID) List[runzero.types.Site][source]

Retrieves all runZero Sites available within the given organization

Parameters:

org_id (uuid.UUID) – The ID of the organization to operate against

Returns:

a list of all Sites available within the given organization

Raises:

AuthError, ClientError, ServerError

Return type:

List[runzero.types.Site]

update(org_id: uuid.UUID, site_id: uuid.UUID, site_options: runzero.types.SiteOptions) runzero.types.Site | None[source]

Updates a site associated with your organization.

Parameters:
  • org_id (uuid.UUID) – The ID of the organization to operate against

  • site_id (uuid.UUID) – The ID of the site to update.

  • site_options (runzero.types.SiteOptions) – Site’s updated values

Returns:

Site updated or None

Raises:

AuthError, ClientError, ServerError

Return type:

Optional[runzero.types.Site]