Merge "Add 'get-anomaly-rule' to venusclient"
This commit is contained in:
@@ -44,6 +44,15 @@ class AnomalyManager(basemodels.BaseModelManager):
|
||||
except Exception as e:
|
||||
raise RuntimeError(str(e))
|
||||
|
||||
def get_anomaly_rule(self, rule_id):
|
||||
url = '/v1/anomaly/rule/' + rule_id
|
||||
|
||||
try:
|
||||
resp, body = self.api.json_request('GET', url)
|
||||
return body
|
||||
except Exception as e:
|
||||
raise RuntimeError(str(e))
|
||||
|
||||
def rule_list(self, title='', desc='', keyword='',
|
||||
log_type='', module_name='', host_name='',
|
||||
page_num=1, page_size=10):
|
||||
|
||||
@@ -44,6 +44,16 @@ def do_add_anomaly_rule(cs, args):
|
||||
return endpoint
|
||||
|
||||
|
||||
@utils.arg('id',
|
||||
metavar='<id>',
|
||||
help='The id of an anomaly rule.')
|
||||
def do_get_anomaly_rule(cs, args):
|
||||
"""get an anomaly rule"""
|
||||
endpoint = cs.anomaly.get_anomaly_rule(args.id)
|
||||
print(endpoint)
|
||||
return endpoint
|
||||
|
||||
|
||||
def do_rule_list(cs, args):
|
||||
"""get anomaly rule list"""
|
||||
endpoint = cs.anomaly.rule_list(args)
|
||||
|
||||
Reference in New Issue
Block a user