controllers.protection_policies_controller module¶
-
class
controllers.protection_policies_controller.
ProtectionPoliciesController
(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_protection_policy
(body)[source]¶ Does a POST request to /public/protectionPolicies.
Returns the created Protection Policy.
- Args:
- body (ProtectionPolicyRequest): Request to create a Protection
Policy.
- 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.
-
delete_protection_policy
(id)[source]¶ Does a DELETE request to /public/protectionPolicies/{id}.
Returns Success if the Protection Policy is deleted.
- Args:
- id (string): Specifies a unique id of the Protection Policy to
return.
- 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_policies
(ids=None, names=None, environments=None, vault_ids=None, origin=None, types=None, tenant_ids=None, all_under_hierarchy=None)[source]¶ Does a GET request to /public/protectionPolicies.
If no parameters are specified, all Protection Policies currently on the Cohesity Cluster are returned. Specifying parameters filters the results that are returned.
- Args:
- ids (list of string, optional): Filter by a list of Protection
Policy ids.
- names (list of string, optional): Filter by a list of Protection
Policy names.
- environments (list of EnvironmentGetProtectionPoliciesEnum,
optional): Filter by Environment type such as ‘kVMware’, ‘kView’, etc. Only Policies protecting the specified environment type are returned. NOTE: ‘kPuppeteer’ refers to Cohesity’s Remote Adapter.
- vault_ids (list of long|int, optional): Filter by a list of Vault
ids. Policies archiving to any of the specified vaults will be returned.
- origin (OriginEnum, optional): Specifies the origin of the
protection policy. ‘kHelios’ means a global policy which was created on Helios. ‘kLocal’ means a local policy which was created on the cluster.
- types (TypeProtectionPolicyRequestEnum, optional): Specifies the
type of the protection policy. ‘kRegular’ means a regular Protection Policy. ‘kRPO’ means an RPO Protection Policy.
- 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 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_protection_policy_by_id
(id)[source]¶ Does a GET request to /public/protectionPolicies/{id}.
Returns the Protection Policy corresponding to the specified Policy Id.
- Args:
- id (string): Specifies a unique id of the Protection Policy 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_protection_policy_summary
(id, include_aggregated_last_run_summary=None, include_aggregated_runs_summary=None, start_time_usecs=None, end_time_usecs=None, page_count=None, pagination_cookie=None)[source]¶ Does a GET request to /public/protectionPolicySummary.
List Protection Policy Summary.
- Args:
- id (string): Specifies the id of the policy whose summary should
be retrieved. If this is not set, the API will return error.
- include_aggregated_last_run_summary (bool, optional): Specifies
whether to include summary of the last Protection Run of each Protection Source.
- include_aggregated_runs_summary (bool, optional): Specifies
whether to include summary of all Protection Runs of the Protection Source or Protection Jobs. If this is set to true, then only the Protection Runs from the provided ‘startTimeUsecs’ and ‘endTimeUsecs’ are processed.
- start_time_usecs (long|int, optional): Filter by a start time
specified as a Unix epoch Timestamp (in microseconds). Only Job Runs that started after the specified time are included in the aggregated runs summary result.
- 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 included int he aggregated runs summary result.
- page_count (long|int, optional): Specifies the limit of the number
of Protection Sources or Protection Jobs to be returned as a part of the Protection Policy Summary.
- pagination_cookie (string, optional): If set, i.e. there are more
results to display, use this value to get the next set of results, by using this value in paginationCookie param for the next request to GetProtectionPolicySummary.
- Returns:
ProtectionPolicySummary: 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
(body, id)[source]¶ Does a PUT request to /public/protectionPolicies/{id}.
Returns the updated Protection Policy.
- Args:
- body (ProtectionPolicyRequest): Request to update a Protection
Policy.
- id (string): Specifies a unique id of the Protection Policy 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.
-