Merge pull request #9603 from rainzm/lb/webhook

feat(webhook): send webhook notification when c/d loadbalancerlisterrule
This commit is contained in:
Zexi Li
2020-12-23 15:16:09 +08:00
committed by GitHub
2 changed files with 2 additions and 0 deletions
@@ -250,6 +250,7 @@ func (self *LoadbalancerListenerRuleCreateTask) OnLoadbalancerListenerRuleCreate
lbr.SetStatus(self.GetUserCred(), api.LB_STATUS_ENABLED, "")
db.OpsLog.LogEvent(lbr, db.ACT_ALLOCATE, lbr.GetShortDesc(ctx), self.UserCred)
logclient.AddActionLogWithStartable(self, lbr, logclient.ACT_CREATE, nil, self.UserCred, true)
notifyclient.NotifyWebhook(ctx, self.UserCred, lbr, notifyclient.ActionCreate)
lblis := lbr.GetLoadbalancerListener()
if lblis != nil {
logclient.AddActionLogWithStartable(self, lblis, logclient.ACT_LB_ADD_LISTENER_RULE, nil, self.UserCred, true)
@@ -60,6 +60,7 @@ func (self *LoadbalancerListenerRuleDeleteTask) OnInit(ctx context.Context, obj
func (self *LoadbalancerListenerRuleDeleteTask) OnLoadbalancerListenerRuleDeleteComplete(ctx context.Context, lbr *models.SLoadbalancerListenerRule, data jsonutils.JSONObject) {
db.OpsLog.LogEvent(lbr, db.ACT_DELETE, lbr.GetShortDesc(ctx), self.UserCred)
logclient.AddActionLogWithStartable(self, lbr, logclient.ACT_DELOCATE, nil, self.UserCred, true)
notifyclient.NotifyWebhook(ctx, self.UserCred, lbr, notifyclient.ActionDelete)
lblis := lbr.GetLoadbalancerListener()
if lblis != nil {
logclient.AddActionLogWithStartable(self, lblis, logclient.ACT_LB_REMOVE_LISTENER_RULE, nil, self.UserCred, true)