mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): send webhook when the creation task is completely completed
This commit is contained in:
@@ -66,7 +66,6 @@ func (self *DBInstanceCreateTask) CreateDBInstance(ctx context.Context, rds *mod
|
||||
func (self *DBInstanceCreateTask) OnCreateDBInstanceComplete(ctx context.Context, obj db.IStandaloneModel, data jsonutils.JSONObject) {
|
||||
dbinstance := obj.(*models.SDBInstance)
|
||||
logclient.AddActionLogWithStartable(self, dbinstance, logclient.ACT_CREATE, nil, self.UserCred, true)
|
||||
notifyclient.NotifyWebhook(ctx, self.UserCred, dbinstance, notifyclient.ActionCreate)
|
||||
self.SetStage("OnSyncDBInstanceStatusComplete", nil)
|
||||
models.StartResourceSyncStatusTask(ctx, self.UserCred, dbinstance, "DBInstanceSyncStatusTask", self.GetTaskId())
|
||||
}
|
||||
@@ -77,6 +76,8 @@ func (self *DBInstanceCreateTask) OnCreateDBInstanceCompleteFailed(ctx context.C
|
||||
}
|
||||
|
||||
func (self *DBInstanceCreateTask) OnSyncDBInstanceStatusComplete(ctx context.Context, obj db.IStandaloneModel, data jsonutils.JSONObject) {
|
||||
dbinstance := obj.(*models.SDBInstance)
|
||||
notifyclient.NotifyWebhook(ctx, self.UserCred, dbinstance, notifyclient.ActionCreate)
|
||||
self.SetStageComplete(ctx, nil)
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ func (self *LoadbalancerCreateTask) OnLoadbalancerCreateComplete(ctx context.Con
|
||||
lb.SetStatus(self.GetUserCred(), api.LB_STATUS_ENABLED, "")
|
||||
db.OpsLog.LogEvent(lb, db.ACT_ALLOCATE, lb.GetShortDesc(ctx), self.UserCred)
|
||||
logclient.AddActionLogWithStartable(self, lb, logclient.ACT_CREATE, nil, self.UserCred, true)
|
||||
notifyclient.NotifyWebhook(ctx, self.UserCred, lb, notifyclient.ActionCreate)
|
||||
self.SetStage("OnLoadbalancerStartComplete", nil)
|
||||
lb.StartLoadBalancerStartTask(ctx, self.GetUserCred(), self.GetTaskId())
|
||||
}
|
||||
@@ -72,6 +71,7 @@ func (self *LoadbalancerCreateTask) OnLoadbalancerCreateCompleteFailed(ctx conte
|
||||
|
||||
func (self *LoadbalancerCreateTask) OnLoadbalancerStartComplete(ctx context.Context, lb *models.SLoadbalancer, data jsonutils.JSONObject) {
|
||||
lb.SetStatus(self.GetUserCred(), api.LB_STATUS_ENABLED, "")
|
||||
notifyclient.NotifyWebhook(ctx, self.UserCred, lb, notifyclient.ActionCreate)
|
||||
self.SetStageComplete(ctx, nil)
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,6 @@ func (self *LoadbalancerListenerCreateTask) OnPrepareLoadbalancerBackendgroup(ct
|
||||
lblis.SetStatus(self.GetUserCred(), api.LB_STATUS_ENABLED, "")
|
||||
db.OpsLog.LogEvent(lblis, db.ACT_ALLOCATE, lblis.GetShortDesc(ctx), self.UserCred)
|
||||
logclient.AddActionLogWithStartable(self, lblis, logclient.ACT_CREATE, nil, self.UserCred, true)
|
||||
notifyclient.NotifyWebhook(ctx, self.UserCred, lblis, notifyclient.ActionCreate)
|
||||
self.SetStage("OnLoadbalancerListenerStartComplete", nil)
|
||||
lblis.StartLoadBalancerListenerStartTask(ctx, self.GetUserCred(), self.GetTaskId())
|
||||
}
|
||||
@@ -201,6 +200,7 @@ func (self *LoadbalancerListenerCreateTask) OnLoadbalancerListenerCreateComplete
|
||||
|
||||
func (self *LoadbalancerListenerCreateTask) OnLoadbalancerListenerStartComplete(ctx context.Context, lblis *models.SLoadbalancerListener, data jsonutils.JSONObject) {
|
||||
lblis.SetStatus(self.GetUserCred(), api.LB_STATUS_ENABLED, "")
|
||||
notifyclient.NotifyWebhook(ctx, self.UserCred, lblis, notifyclient.ActionCreate)
|
||||
self.SetStageComplete(ctx, nil)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user