def add(self, fail_on_error=True, **kwargs):
"""Add a new Rule.
This method is meant to be invoked only by the `Rule.add` classmethod.
"""
for field in ('queries', ): # TODO 'window', 'interval', ):
if field not in kwargs:
raise RequiredParameterMissingError(field)
try:
self.update(fail_on_error=fail_on_error, **kwargs)
except (me.ValidationError, BadRequestError) as err:
log.error('Error adding %s: %s', self.rule.name, err)
raise
评论列表
文章目录