mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
Refactor for Notify (#7611)
* refactor(notify): ALL * feat(climc): Notify v2 * feat: support notify for codegen.py * delete deprecated code and Maintain SDK compatibility * Adjust the template for mail validation to support captcha * fix: The issue of notify refactoring * add copyright for notifyv2 cli * Adjust according to the advice of make check * Remove utils package in notify * fix import format * remove redundant Template module * fix validateCreate and validateUpdate of notifytemplate * fix update issues of receivers * fix: Add SetStageComplete in tasks
This commit is contained in:
@@ -56,6 +56,8 @@ def run_swagger_yaml(svc, swagger_pkg_dir, output_dir):
|
||||
cmd.extend(["-o", pjoin(output_dir, "swagger_%s.yaml" % svc)])
|
||||
run_cmd(cmd)
|
||||
|
||||
def remove_prefix(text, prefix):
|
||||
return text[text.startswith(prefix) and len(prefix):]
|
||||
|
||||
class FuncDispatcher(object):
|
||||
|
||||
@@ -71,7 +73,7 @@ class FuncDispatcher(object):
|
||||
func = getattr(self, attr)
|
||||
if not callable(func):
|
||||
continue
|
||||
svc = attr.lstrip('gen_')
|
||||
svc = remove_prefix(attr, 'gen_')
|
||||
gen_dict[svc] = func
|
||||
self.gen_dict = gen_dict
|
||||
|
||||
@@ -131,6 +133,7 @@ class ModelAPI(FuncDispatcher):
|
||||
self.run_model("compute")
|
||||
self.run_model("image")
|
||||
self.run_model("cloudid")
|
||||
self.run_model("notify")
|
||||
|
||||
def gen_monitor(self):
|
||||
self.run(pkg=["monitor", "models"], out=["monitor"])
|
||||
@@ -174,6 +177,8 @@ class SwaggerCode(FuncDispatcher):
|
||||
def gen_monitor(self):
|
||||
self.run("monitor", pkg=["models"], out="monitor")
|
||||
|
||||
def gen_notify(self):
|
||||
self.run("notify", pkg=["models"], out="notify")
|
||||
|
||||
class SwaggerYAML(FuncDispatcher):
|
||||
|
||||
@@ -204,6 +209,8 @@ class SwaggerYAML(FuncDispatcher):
|
||||
def gen_monitor(self):
|
||||
self.run("monitor")
|
||||
|
||||
def gen_notify(self):
|
||||
self.run("notify")
|
||||
|
||||
class SwaggerServe(object):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user