From 76305894654e4de0ac383b0227a4ed41fa69ce94 Mon Sep 17 00:00:00 2001 From: rainzm Date: Fri, 19 Mar 2021 16:36:27 +0800 Subject: [PATCH] feat(notify): add action 'change_ipaddr' for notify topic --- pkg/apis/notify/event.go | 1 + pkg/notify/models/event_template.go | 1 + pkg/notify/models/topic.go | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/pkg/apis/notify/event.go b/pkg/apis/notify/event.go index b45dc29645..8e33598ed7 100644 --- a/pkg/apis/notify/event.go +++ b/pkg/apis/notify/event.go @@ -32,6 +32,7 @@ var ( ActionResize SAction = "resize" ActionExpiredRelease SAction = "expired_release" ActionExecute SAction = "execute" + ActionChangeIpaddr SAction = "change_ipaddr" ) const ( diff --git a/pkg/notify/models/event_template.go b/pkg/notify/models/event_template.go index 7c95d9577c..16bf7e27e9 100644 --- a/pkg/notify/models/event_template.go +++ b/pkg/notify/models/event_template.go @@ -151,6 +151,7 @@ var action2Topic = make(map[string]string, 0) func init() { action2Topic[string(api.ActionRebuildRoot)] = string(api.ActionUpdate) action2Topic[string(api.ActionResetPassword)] = string(api.ActionUpdate) + action2Topic[string(api.ActionChangeIpaddr)] = string(api.ActionUpdate) } func (lt *SLocalTemplateManager) fillWithTemplate(ctx context.Context, titleOrContent string, contactType string, lang string, event api.SEvent, dis jsonutils.JSONObject) (string, error) { diff --git a/pkg/notify/models/topic.go b/pkg/notify/models/topic.go index 5610e86efa..1956c38442 100644 --- a/pkg/notify/models/topic.go +++ b/pkg/notify/models/topic.go @@ -149,6 +149,9 @@ func (sm *STopicManager) InitializeData() error { notify.TOPIC_RESOURCE_ELASTICCACHE, ) t.addAction(notify.ActionUpdate) + t.addAction(notify.ActionRebuildRoot) + t.addAction(notify.ActionResetPassword) + t.addAction(notify.ActionChangeIpaddr) t.Type = notify.TOPIC_TYPE_RESOURCE case DefaultResourceReleaseDue1Day: t.addResources( @@ -340,6 +343,7 @@ func init() { notify.ActionChangeConfig, notify.ActionExpiredRelease, notify.ActionExecute, + notify.ActionChangeIpaddr, ) }