runzero.api.admin.tasks

Account level management of runZero tasks, including scan templates which apply to all orgs.

Module Contents

Classes

TasksAdmin

Account level management of runZero tasks in all organizations.

TemplatesAdmin

Account level management of runZero scan templates in all organizations.

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

Account level management of runZero tasks in all organizations.

Parameters:

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

Constructor method

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

Retrieves up to 1000 runZero Tasks available within all organizations in the account.

Parameters:
  • 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/

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

Returns:

A list of all tasks, or tasks which match the provided query string

Return type:

List[runzero.types.Task]

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

Account level management of runZero scan templates in all organizations.

Parameters:

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

Constructor method

create(scan_template_options: runzero.types.ScanTemplateOptions) runzero.types.ScanTemplate | None[source]

Creates a new scan template in your account.

Parameters:

scan_template_options (runzero.types.ScanTemplateOptions) – Description of scan template to create

Returns:

ScanTemplate created or None

Raises:

AuthError, ClientError, ServerError

Return type:

Optional[runzero.types.ScanTemplate]

delete(scan_template_id: uuid.UUID) None[source]

Deletes a scan template with provided ID from your account.

Parameters:

scan_template_id (uuid.UUID) – The ID of the scan template to delete

Returns:

None

Raises:

AuthError, ClientError, ServerError

Return type:

None

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

Retrieves the scan template with the provided name or id, if it exists in your account.

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

  • scan_template_id (Optional[uuid.UUID]) – Optional, the id of the scan template to retrieve

Returns:

ScanTemplate created or None

Raises:

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

Return type:

Optional[runzero.types.ScanTemplate]

get_all(query: str | None = None) List[runzero.types.ScanTemplate][source]

Retrieves up to 1000 runZero task scan templates available to all organizations in the account.

Parameters:

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

Returns:

A list of all task scan templates

Raises:

AuthError, ClientError, ServerError

Return type:

List[runzero.types.ScanTemplate]

update(new_scan_template_values: runzero.types.ScanTemplate) runzero.types.ScanTemplate | None[source]

Updates an existing scan template in your account by replacing all values.

The ‘id’ field of the ScanTemplate must match an existing scan template, which will be changed to the new ScanTemplate.

Parameters:
  • scan_template_id – The id of the scan template to update

  • new_scan_template_values (runzero.types.ScanTemplate) – Values to update the target scan template with

Returns:

ScanTemplate updated with new values or None

Raises:

AuthError, ClientError, ServerError

Return type:

Optional[runzero.types.ScanTemplate]