controllers.alerts_controller module¶
-
class
controllers.alerts_controller.
AlertsController
(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_notification_rule
(body=None)[source]¶ Does a POST request to /public/alertNotificationRules.
Creates a new notification rule with provided delivery targets such as email addresses and external apis.
- Args:
- body (NotificationRule, optional): Create Notification Rule
argument.
- Returns:
NotificationRule: 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_resolution
(body)[source]¶ Does a POST request to /public/alertResolutions.
Create an Alert Resolution and apply it to one or more Alerts. Mark the Alerts as resolved.
- Args:
- body (AlertResolutionRequest): Request to create an Alert
Resolution and apply it to the specified Alerts.
- Returns:
AlertResolution: 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_notification_rule
(rule_id)[source]¶ Does a DELETE request to /public/alertNotificationRules/{ruleId}.
Deletes an existing alert notification rule matching the rule id.
- Args:
rule_id (long|int): Specifies the rule id.
- 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_alert_by_id
(id)[source]¶ Does a GET request to /public/alerts/{id}.
Returns the Alert object corresponding to the specified id.
- Args:
id (string): Unique id of the Alert to return.
- Returns:
Alert: 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_alert_categories
()[source]¶ Does a GET request to /public/alertCategories.
Returns alert categories in Cohesity cluster.
- Returns:
list of AlertCategoryName: 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_alert_types
(alert_category_list=None)[source]¶ Does a GET request to /public/alertTypes.
Returns registered alerts in the Cohesity cluster that match the filter criteria specified using parameters. If no filter parameters are specified, all registered alerts in the Cohesity cluster are returned.
- Args:
- alert_category_list (list of AlertCategoryListEnum, optional):
Specifies a list of Alert Categories to filter alert types by. Specifies the category of an Alert.
- Returns:
list of AlertMetadata: 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_alerts
(max_alerts, alert_id_list=None, alert_type_list=None, alert_category_list=None, property_key=None, property_value=None, start_date_usecs=None, end_date_usecs=None, alert_state_list=None, alert_severity_list=None, alert_type_bucket_list=None, resolution_id_list=None, tenant_ids=None, all_under_hierarchy=None)[source]¶ Does a GET request to /public/alerts.
Returns all Alert objects found on the Cohesity Cluster that match the filter criteria specified using parameters. The Cohesity Cluster creates an Alert when a potential problem is found or when a threshold has been exceeded on the Cohesity Cluster. If no filter parameters are specified, all Alert objects are returned. Each object provides details about the Alert such as the Status and Severity.
- Args:
- max_alerts (int): Specifies the number of returned Alerts to be
returned. The newest Alerts are returned.
- alert_id_list (list of string, optional): Specifies list of Alert
ids to filter alerts by.
- alert_type_list (list of int, optional): Specifies list of Alert
Types to filter alerts by.
- alert_category_list (list of AlertCategoryListGetAlertsEnum,
optional): Specifies list of Alert Categories.
- property_key (string, optional): Specifies name of the property to
filter alerts by.
- property_value (string, optional): Specifies value of the property
to filter alerts by.
- start_date_usecs (long|int, optional): Specifies start time Unix
epoch time in microseconds to filter alerts by.
- end_date_usecs (long|int, optional): Specifies end time Unix epoch
time in microseconds to filter alerts by.
- alert_state_list (list of AlertStateListEnum, optional): Specifies
list of Alert States to filter alerts by.
- alert_severity_list (list of AlertSeverityListEnum, optional):
Specifies list of Alert severity to filter alerts by.
- alert_type_bucket_list (list of AlertTypeBucketListEnum,
optional): Specifies the list of Alert type bucket. Specifies the Alert type bucket.
- resolution_id_list (list of long|int, optional): Specifies alert
resolution ids to filter alerts by.
- 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 Alert: 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_notification_rules
()[source]¶ Does a GET request to /public/alertNotificationRules.
Gets all alert notification rules containing criteria to deliver notification to delivery targets such as email addresses, invoking external apis etc.
- Returns:
list of NotificationRule: 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_resolution_by_id
(id)[source]¶ Does a GET request to /public/alertResolutions/{id}.
Returns the Alert Resolution object corresponding to passed in Alert Resolution Id.
- Args:
id (long|int): Unique id of the Alert Resolution to return.
- Returns:
AlertResolution: 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_resolutions
(max_resolutions, resolution_id_list=None, alert_id_list=None, start_date_usecs=None, end_date_usecs=None, tenant_ids=None, all_under_hierarchy=None)[source]¶ Does a GET request to /public/alertResolutions.
Returns all Alert Resolution objects found on the Cohesity Cluster that match the filter criteria specified using parameters. If no filter parameters are specified, all Alert Resolution objects are returned. Each object provides details about the Alert Resolution such as the resolution summary and details.
- Args:
- max_resolutions (int): Specifies the number of returned
Resolutions to be returned. The newest Resolutions are returned.
- resolution_id_list (list of long|int, optional): Specifies list of
Alert Resolution ids to filter resolutions by.
- alert_id_list (list of string, optional): Specifies list of Alert
Resolution ids to filter resolutions by.
- start_date_usecs (long|int, optional): Specifies Start Time Unix
epoch in microseconds to filter resolutions by.
- end_date_usecs (long|int, optional): Specifies End Time Unix epoch
in microseconds to filter resolutions by.
- 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 AlertResolution: 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_notification_rule
()[source]¶ Does a PUT request to /public/alertNotificationRules.
Updates delivery targets such as email addresses and external apis in an existing notification rule.
- Returns:
NotificationRule: 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_resolution
(id, body)[source]¶ Does a PUT request to /public/alertResolutions/{id}.
Apply an existing Alert Resolution to one or more additional Alerts. Mark those additional Alerts as resolved.
- Args:
id (long|int): Unique id of the Alert Resolution to return. body (UpdateResolutionParams): Request to apply an existing
resolution to the specified Alerts.
- Returns:
AlertResolution: 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.
-