controllers_v2.protection_policies_controller module

class controllers_v2.protection_policies_controller.ProtectionPoliciesController(config=None, client=None, call_back=None)[source]

Bases: cohesity_management_sdk.controllers_v2.base_controller.BaseController

A Controller to access Endpoints in the cohesity_management_sdk API.

create_protection_policy(body)[source]

Does a POST request to /data-protect/policies.

Create the Protection Policy and returns the newly created policy object.

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

Policy.

Returns:

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

delete_protection_policy(id)[source]

Does a DELETE request to /data-protect/policies/{id}.

Deletes a Protection Policy based on given policy id.

Args:
id (string): Specifies a unique id of the Protection Policy to

delete.

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

Does a GET request to /data-protect/policy-templates/{id}.

Returns the Policy Template corresponding to the specified Policy Id.

Args:
id (string): Specifies a unique id of the Policy Template to

return.

Returns:

ProtectionPolicy: 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_policy_templates(ids=None, policy_names=None, tenant_ids=None, include_tenants=None)[source]

Does a GET request to /data-protect/policy-templates.

Returns the policy templates based on the filtering parameters. If no parameters are specified, then all the policy templates are returned.

Args:
ids (list of string, optional): Filter policies by a list of

policy template ids.

policy_names (list of string, optional): Filter policies by a list

of policy names.

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

the organizations for which objects are to be returned.

include_tenants (bool, optional): IncludeTenantPolicies specifies

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

Returns:

ProtectionPolicyTemplateResponse: 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_policies(ids=None, policy_names=None, tenant_ids=None, include_tenants=None, exclude_linked_policies=None, types=None)[source]

Does a GET request to /data-protect/policies.

Lists protection policies based on filtering query parameters.

Args:
ids (list of string, optional): Filter policies by a list of

policy ids.

policy_names (list of string, optional): Filter policies by a list

of policy names.

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

the organizations for which objects are to be returned.

include_tenants (bool, optional): IncludeTenantPolicies specifies

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

exclude_linked_policies (bool, optional): If excludeLinkedPolicies

is set to true then only local policies created on cluster will be returned. The result will exclude all linked policies created from policy templates.

types (list of Type40Enum, optional): Types specifies the policy

type of policies to be returned

Returns:

ProtectionPolicyResponse: 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_policy_by_id(id)[source]

Does a GET request to /data-protect/policies/{id}.

Returns the Protection Policy details based on provided Policy Id.

Args:
id (string): Specifies a unique id of the Protection Policy to

return.

Returns:

ProtectionPolicy2: 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_policy(id, body)[source]

Does a PUT request to /data-protect/policies/{id}.

Specifies the request to update the existing Protection Policy. On successful update, returns the updated policy object.

Args:
id (string): Specifies a unique id of the Protection Policy to

update.

body (ProtectionPolicyRequest): Request to update a Protection

Policy.

Returns:

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