Alert Rules¶
_incydr_sdk.alert_rules.client.AlertRulesV2
(parent)Client for /v2/alert-rules
and /v2/alerts/rules
endpoints.
Usage example:
>>> import incydr
>>> client = incydr.Client(**kwargs)
>>> client.alert_rules.v2.get_page()
disable_rules
(self, rule_ids)Disable a single rule or list of alert rules.
Parameters:
- rule_ids:
str
,List[str]
(required) - A single rule ID or a list of rule IDs.
Returns: A requests.Response
indicating success.
enable_rules
(self, rule_ids)Enable a single rule or a list of alert rules.
Parameters:
- rule_ids:
str
,List[str]
(required) - A single rule ID or a list of rule IDs.
Returns: A requests.Response
indicating success.
get_page
(self, page_num=0, page_size=None, watchlist_id=None)Get a page of alert rules.
Parameters:
- page_num:
int
- Page number for results, starting at 0. - page_size:
int
- Max number of results to return for a page. - watchlist_id:
str
- Watchlist ID to filter for alert rules that are associated with this watchlist.
Returns: A list of RuleDetails
objects.
get_rule
(self, rule_id)Get a single alert rule.
Parameters:
- rule_id:
str
(required) - A rule ID.
Returns: A RuleDetails
object that contains the details for an alert rule.
get_users
(self, rule_id)Get all users assigned to a rule.
Raises a MissingUsernameCriterionError
if the rule doesn't have a username filter.
Parameters:
- rule_id:
str
(required) - The ID of the rule.
Returns: A RuleUsersList
model.
iter_all
(self, page_size=None, watchlist_id=None)Iterate over all alert rules.
Accepts the same parameters as .get_page()
excepting page_num
.
Returns: A generator yielding individual RuleDetails
objects.
remove_all_users
(self, rule_id)Remove all users from a rule.
Parameters:
- rule_id:
str
(required) - The ID of the rule to update.
Returns: A requests.Response
indicating success.