controllers.protection_runs_controller module

class controllers.protection_runs_controller.ProtectionRunsController(config=None, client=None, call_back=None)[source]

Bases: cohesity_management_sdk.controllers.base_controller.BaseController

A Controller to access Endpoints in the cohesity_management_sdk API.

create_cancel_protection_job_run(id, body=None)[source]

Does a POST request to /public/protectionRuns/cancel/{id}.

Cancel a Protection Job run.

Args:

id (long|int): Specifies a unique id of the Protection Job. body (CancelProtectionJobRunParam, optional): TODO: type

description here. Example:

Returns:

void: Response from the API. No Content

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_protection_run_errors(job_id, start_time_usecs, task_id, limit_number_of_errors=None, pagination_cookie=None)[source]

Does a GET request to /public/protectionRuns/errors.

jobId, startTimeUsecs and taskId have to be provided to get the a list of errors for a job run task.

Args:
job_id (long|int): Specifies the id of the Protection Job whose

runs are to be returned. This field is required.

start_time_usecs (long|int): Specifies the time when the Job Run

started as a Unix epoch Timestamp (in microseconds). This field is required

task_id (long|int): Specifies the id of the Protection Run task

for which errors are to be returned. This field is required to get the errors list.

limit_number_of_errors (long|int, optional): Specifies the number

of the results expected.

pagination_cookie (string, optional): Specifies the cookie for

next set of results.

Returns:

ProtectionRunErrors: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_protection_runs(job_id=None, include_rpo_snapshots=None, started_time_usecs=None, start_time_usecs=None, end_time_usecs=None, num_runs=None, exclude_tasks=None, source_id=None, run_types=None, exclude_error_runs=None, exclude_non_restoreable_runs=None, only_return_shell_info=None)[source]

Does a GET request to /public/protectionRuns.

If no parameters are specified, Job Runs currently on the Cohesity Cluster are returned. Both running and completed Job Runs are reported. Specifying parameters filters the results that are returned.

Args:
job_id (long|int, optional): Filter by a Protection Job that is

specified by id. If not specified, all Job Runs for all Protection Jobs are returned.

include_rpo_snapshots (bool, optional): If true, then the

snapshots for Protection Sources protected by Rpo policies will also be returned.

started_time_usecs (long|int, optional): Return a specific Job Run

by specifying a time and a jobId. Specify the time when the Job Run started as a Unix epoch Timestamp (in microseconds). If this field is specified, jobId must also be specified.

start_time_usecs (long|int, optional): Filter by a start time.

Only Job Runs that started after the specified time are returned. Specify the start time as a Unix epoch Timestamp (in microseconds).

end_time_usecs (long|int, optional): Filter by a end time

specified as a Unix epoch Timestamp (in microseconds). Only Job Runs that completed before the specified end time are returned.

num_runs (long|int, optional): Specify the number of Job Runs to

return. The newest Job Runs are returned.

exclude_tasks (bool, optional): If true, the individual backup

status for all the objects protected by the Job Run are not populated in the response. For example in a VMware environment, the status of backing up each VM associated with a Job is not returned.

source_id (long|int, optional): Filter by source id. Only Job Runs

protecting the specified source (such as a VM or View) are returned. The source id is assigned by the Cohesity Cluster.

run_types (list of string, optional): Filter by run type such as

‘kFull’, ‘kRegular’ or ‘kLog’. If not specified, Job Runs of all types are returned.

exclude_error_runs (bool, optional): Filter out Jobs Runs with

errors by setting this field to ‘true’. If not set or set to ‘false’, Job Runs with errors are returned.

exclude_non_restoreable_runs (bool, optional): Filter out jobs

runs that cannot be restored by setting this field to ‘true’. If not set or set to ‘false’, Runs without any successful object will be returned. The default value is false.

only_return_shell_info (bool, optional): If passed as true, then

only returns the summary information about run including details such as runs start time, status, type etc. It does not include extra details such as attempt/task info etc.

Returns:

list of ProtectionRunInstance: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

update_protection_runs(body)[source]

Does a PUT request to /public/protectionRuns.

Update the expiration date (retention period) for the specified Protection Job Runs and their snapshots. After an expiration time is reached, the Job Run and its snapshots are deleted. If an expiration time of 0 is specified, a Job Run and its snapshots are immediately deleted.

Args:
body (UpdateProtectionJobRunsParam): Request to update the

expiration time of Protection Job Runs.

Returns:

void: Response from the API. No Content

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.