Add delete-anomaly-rule in venusclient CLI

Change-Id: Id201e76e0692974170dc4ffdde9139f36b165194
This commit is contained in:
leiyashuai 2023-09-14 18:49:57 +08:00
parent 5263e811cc
commit 9208ade2b2
2 changed files with 19 additions and 0 deletions

View File

@ -76,6 +76,15 @@ class AnomalyManager(basemodels.BaseModelManager):
except Exception as e:
raise RuntimeError(str(e))
def delete_anomaly_rule(self, rule_id):
url = '/v1/anomaly/rule/' + rule_id
try:
resp, body = self.api.json_request('DELETE', url)
return body
except Exception as e:
raise RuntimeError(str(e))
def record_list(self, title='', log_type='', module='',
start_time=0, end_time=0,
page_num=1, page_size=1):

View File

@ -61,6 +61,16 @@ def do_rule_list(cs, args):
return endpoint
@utils.arg('id',
metavar='<id>',
help='The id of an anomaly rule.')
def do_delete_anomaly_rule(cs, args):
"""delete an anomaly rule"""
endpoint = cs.anomaly.delete_anomaly_rule(args.id)
print(endpoint)
return endpoint
def do_record_list(cs, args):
"""get anomaly record list"""
endpoint = cs.anomaly.rule_list(args)