runzero.api.tasks

Management of runZero tasks.

Module Contents

Classes

Tasks

Management of runZero tasks.

class runzero.api.tasks.Tasks(client: runzero.client.Client)[source]

Management of runZero tasks.

Parameters:

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

Constructor method

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

Retrieves the runZero Task with the provided name or id, if it exists in your organization.

Parameters:
  • org_id (uuid.UUID) – ID of the organization the requested task is in

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

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

Raises:

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

Return type:

Optional[runzero.types.Task]

get_all(org_id: uuid.UUID, status: str | None = None, query: str | None = None) List[runzero.types.Task][source]

Retrieves all runZero Tasks available within the given Organization

Parameters:
  • org_id (uuid.UUID) – The unique ID of the organization to retrieve the tasks from.

  • status (Optional[str]) – An optional status value to filter tasks by. This is a case-insensitive string match, stripped of surrounding whitespace.

  • query (Optional[str]) – An optional query to filter returned tasks. Query string format is the same as in-UI search. See https://www.runzero.com/docs/search-query-tasks/

Returns:

A list of all tasks

Return type:

List[runzero.types.Task]

get_status(org_id: uuid.UUID, task_id: uuid.UUID) str | None[source]

Retrieves the status of a runZero Task with the provided id, if it exists in your organization.

The org_id should be provided if using an Account level api key.

Parameters:
  • org_id (uuid.UUID) – ID of the organization the requested task is in

  • task_id (uuid.UUID) – ID of the task you want the status for

Returns:

a string result indicating task status, or None

Return type:

Optional[str]

hide(org_id: uuid.UUID, task_id: uuid.UUID) runzero.types.Task[source]

Signal that a completed task should be hidden.

Parameters:
  • org_id (uuid.UUID) – ID of the organization the requested task is in

  • task_id (uuid.UUID) – task to modify

Returns:

Completed task which has been hidden

Raises:

AuthError, ClientError, ServerError

Return type:

runzero.types.Task

stop(org_id: uuid.UUID, task_id: uuid.UUID) runzero.types.Task[source]

Signals an explorer to stop a currently running task, or signals server to remove a future or recurring task.

Parameters:
  • org_id (uuid.UUID) – ID of the organization the requested task is in

  • task_id (uuid.UUID) – ID of task to stop, or scheduled task to remove from schedule.

Returns:

Task which has been signalled to stop

Raises:

AuthError, ClientError, ServerError

Return type:

runzero.types.Task

update(org_id: uuid.UUID, task_id: uuid.UUID, task_options: runzero.types.TaskOptions) runzero.types.Task[source]

Updates task parameters with provided task options values.

Parameters:
  • org_id (uuid.UUID) – ID of the organization the requested task is in

  • task_id (uuid.UUID) – ID of task to modify

  • task_options (runzero.types.TaskOptions) – task values to update

Returns:

Task which has been updated

Raises:

AuthError, ClientError, ServerError

Return type:

runzero.types.Task