controllers.protection_jobs_controller module

class controllers.protection_jobs_controller.ProtectionJobsController(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.

change_protection_job_state(id, body=None)[source]

Does a POST request to /public/protectionJobState/{id}.

If the Protection Job is currently running (not paused) and true is passed in, this operation stops any new Runs of this Protection Job from stating and executing. However, any existing Runs that were already executing will continue to run. If this Projection Job is paused and false is passed in, this operation restores the Job to a running state and new Runs are started as defined by the schedule in the Policy associated with the Job. Returns success if the paused state is changed.

Args:

id (long|int): Specifies a unique id of the Protection Job. body (ChangeProtectionJobStateParam, 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.

create_protection_job(body)[source]

Does a POST request to /public/protectionJobs.

Returns the created Protection Job.

Args:
body (ProtectionJobRequestBody): Request to create a Protection

Job.

Returns:

ProtectionJob: 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.

create_run_protection_job(id, body)[source]

Does a POST request to /public/protectionJobs/run/{id}.

Immediately execute a single Job Run and ignore the schedule defined in the Policy. A Protection Policy associated with the Job may define up to three backup run types: 1) Regular (CBT utilized), 2) Full (CBT not utilized) and 3) Log. The passed in run type defines what type of backup is done by the Job Run. The schedule defined in the Policy for the backup run type is ignored but other settings such as the snapshot retention and retry settings are used. Returns success if the Job Run starts.

Args:

id (long|int): Specifies a unique id of the Protection Job. body (RunProtectionJobParam): Specifies the type of backup. If not

specified, the ‘kRegular’ backup is run.

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.

delete_protection_job(id, body=None)[source]

Does a DELETE request to /public/protectionJobs/{id}.

Returns Success if the Protection Job is deleted.

Args:

id (long|int): Specifies a unique id of the Protection Job. body (DeleteProtectionJobParam, optional): Request to delete a

protection job.

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_job_audit(id)[source]

Does a GET request to /public/protectionJobs/{id}/auditTrail.

Returns the audit of specific protection job edit history.

Args:

id (long|int): Specifies a unique id of the Protection Job.

Returns:

list of ProtectionJobAuditTrail: 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_job_by_id(id)[source]

Does a GET request to /public/protectionJobs/{id}.

Returns the Protection Job corresponding to the specified Job id.

Args:

id (long|int): Specifies a unique id of the Protection Job.

Returns:

ProtectionJob: 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_jobs(ids=None, names=None, policy_ids=None, environments=None, is_active=None, is_deleted=None, only_return_basic_summary=None, include_last_run_and_stats=None, include_rpo_snapshots=None, is_last_run_sla_violated=None, only_return_data_migration_jobs=None, prune_excluded_source_ids=None, tenant_ids=None, all_under_hierarchy=None)[source]

Does a GET request to /public/protectionJobs.

If no parameters are specified, all Protection Jobs currently on the Cohesity Cluster are returned. Specifying parameters filters the results that are returned.

Args:
ids (list of long|int, optional): Filter by a list of Protection

Job ids.

names (list of string, optional): Filter by a list of Protection

Job names.

policy_ids (list of string, optional): Filter by Policy ids that

are associated with Protection Jobs. Only Jobs associated with the specified Policy ids, are returned.

environments (list of EnvironmentGetProtectionJobsEnum, optional):

Filter by environment types such as ‘kVMware’, ‘kView’, etc. Only Jobs protecting the specified environment types are returned. NOTE: ‘kPuppeteer’ refers to Cohesity’s Remote Adapter.

is_active (bool, optional): Filter by Inactive or Active Jobs. If

not set, all Inactive and Active Jobs are returned. If true, only Active Jobs are returned. If false, only Inactive Jobs are returned. When you create a Protection Job on a Primary Cluster with a replication schedule, the Cluster creates an Inactive copy of the Job on the Remote Cluster. In addition, when an Active and running Job is deactivated, the Job becomes Inactive.

is_deleted (bool, optional): If true, return only Protection Jobs

that have been deleted but still have Snapshots associated with them. If false, return all Protection Jobs except those Jobs that have been deleted and still have Snapshots associated with them. A Job that is deleted with all its Snapshots is not returned for either of these cases.

only_return_basic_summary (bool, optional): if true then only job

descriptions and the most recent run of the job will be returned.

include_last_run_and_stats (bool, optional): If true, return the

last Protection Run of the Job and the summary stats.

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

Protected Objects protected by RPO policies will also be returned.

is_last_run_sla_violated (bool, optional): IsLastRunSlaViolated is

the parameter to filter the Protection Jobs based on the SLA violation status of the last Protection Run.

only_return_data_migration_jobs (bool, optional):

OnlyReturnDataMigrationJobs specifies if only data migration jobs should be returned. If not set, no data migration job will be returned.

prune_excluded_source_ids (bool, optional): If true, the list of

exclusion sources will be omitted from the response. This can be used to improve performance when the exclusion sources are not needed.

tenant_ids (list of string, optional): TenantIds contains ids of

the tenants for which objects are to be returned.

all_under_hierarchy (bool, optional): AllUnderHierarchy specifies

if objects of all the tenants under the hierarchy of the logged in user’s organization should be returned.

Returns:

list of ProtectionJob: 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_job(body, id)[source]

Does a PUT request to /public/protectionJobs/{id}.

Returns the updated Protection Job.

Args:
body (ProtectionJobRequestBody): Request to update a protection

job.

id (long|int): Specifies a unique id of the Protection Job.

Returns:

ProtectionJob: 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_jobs_state(body=None)[source]

Does a POST request to /public/protectionJobs/states.

Note that the pause or resume actions will take effect from next Protection Run. Also, user can specify only one type of action on all the Protection Jobs. Deactivate and activate actions are independent of pause and resume state. Deactivate and activate actions are useful in case of failover situations. Returns success if the state of all the Protection Jobs state is changed successfully.

Args:
body (UpdateProtectionJobsStateRequestBody, optional): TODO: type

description here. Example:

Returns:

UpdateProtectionJobsState: 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.