|
|
@@ -44,14 +44,14 @@ func (app *App) HandleCreateProjectCluster(w http.ResponseWriter, r *http.Reques
|
|
|
}
|
|
|
|
|
|
// handle write to the database
|
|
|
- cluster, err = app.repo.Cluster.CreateCluster(cluster)
|
|
|
+ cluster, err = app.Repo.Cluster.CreateCluster(cluster)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorDataWrite(err, w)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- app.logger.Info().Msgf("New cluster created: %d", cluster.ID)
|
|
|
+ app.Logger.Info().Msgf("New cluster created: %d", cluster.ID)
|
|
|
|
|
|
w.WriteHeader(http.StatusCreated)
|
|
|
|
|
|
@@ -72,7 +72,7 @@ func (app *App) HandleReadProjectCluster(w http.ResponseWriter, r *http.Request)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- cluster, err := app.repo.Cluster.ReadCluster(uint(id))
|
|
|
+ cluster, err := app.Repo.Cluster.ReadCluster(uint(id))
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorRead(err, ErrProjectDataRead, w)
|
|
|
@@ -98,7 +98,7 @@ func (app *App) HandleListProjectClusters(w http.ResponseWriter, r *http.Request
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- clusters, err := app.repo.Cluster.ListClustersByProjectID(uint(projID))
|
|
|
+ clusters, err := app.Repo.Cluster.ListClustersByProjectID(uint(projID))
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorRead(err, ErrProjectDataRead, w)
|
|
|
@@ -152,7 +152,7 @@ func (app *App) HandleUpdateProjectCluster(w http.ResponseWriter, r *http.Reques
|
|
|
}
|
|
|
|
|
|
// convert the form to a registry
|
|
|
- cluster, err := form.ToCluster(app.repo.Cluster)
|
|
|
+ cluster, err := form.ToCluster(app.Repo.Cluster)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorFormDecoding(err, ErrProjectDecode, w)
|
|
|
@@ -160,7 +160,7 @@ func (app *App) HandleUpdateProjectCluster(w http.ResponseWriter, r *http.Reques
|
|
|
}
|
|
|
|
|
|
// handle write to the database
|
|
|
- cluster, err = app.repo.Cluster.UpdateCluster(cluster)
|
|
|
+ cluster, err = app.Repo.Cluster.UpdateCluster(cluster)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorDataWrite(err, w)
|
|
|
@@ -186,14 +186,14 @@ func (app *App) HandleDeleteProjectCluster(w http.ResponseWriter, r *http.Reques
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- cluster, err := app.repo.Cluster.ReadCluster(uint(id))
|
|
|
+ cluster, err := app.Repo.Cluster.ReadCluster(uint(id))
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorRead(err, ErrProjectDataRead, w)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- err = app.repo.Cluster.DeleteCluster(cluster)
|
|
|
+ err = app.Repo.Cluster.DeleteCluster(cluster)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorRead(err, ErrProjectDataRead, w)
|
|
|
@@ -230,7 +230,7 @@ func (app *App) HandleCreateProjectClusterCandidates(w http.ResponseWriter, r *h
|
|
|
}
|
|
|
|
|
|
// convert the form to a ClusterCandidate
|
|
|
- ccs, err := form.ToClusterCandidates(app.isLocal)
|
|
|
+ ccs, err := form.ToClusterCandidates(app.ServerConf.IsLocal)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorFormDecoding(err, ErrProjectDecode, w)
|
|
|
@@ -239,7 +239,7 @@ func (app *App) HandleCreateProjectClusterCandidates(w http.ResponseWriter, r *h
|
|
|
|
|
|
extClusters := make([]*models.ClusterCandidateExternal, 0)
|
|
|
|
|
|
- session, err := app.store.Get(r, app.cookieName)
|
|
|
+ session, err := app.Store.Get(r, app.ServerConf.CookieName)
|
|
|
|
|
|
if err != nil {
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
@@ -250,20 +250,20 @@ func (app *App) HandleCreateProjectClusterCandidates(w http.ResponseWriter, r *h
|
|
|
|
|
|
for _, cc := range ccs {
|
|
|
// handle write to the database
|
|
|
- cc, err = app.repo.Cluster.CreateClusterCandidate(cc)
|
|
|
+ cc, err = app.Repo.Cluster.CreateClusterCandidate(cc)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorDataWrite(err, w)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- app.logger.Info().Msgf("New cluster candidate created: %d", cc.ID)
|
|
|
+ app.Logger.Info().Msgf("New cluster candidate created: %d", cc.ID)
|
|
|
|
|
|
// if the ClusterCandidate does not have any actions to perform, create the Cluster
|
|
|
// automatically
|
|
|
if len(cc.Resolvers) == 0 {
|
|
|
// we query the repo again to get the decrypted version of the cluster candidate
|
|
|
- cc, err = app.repo.Cluster.ReadClusterCandidate(cc.ID)
|
|
|
+ cc, err = app.Repo.Cluster.ReadClusterCandidate(cc.ID)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorDataRead(err, w)
|
|
|
@@ -277,28 +277,28 @@ func (app *App) HandleCreateProjectClusterCandidates(w http.ResponseWriter, r *h
|
|
|
UserID: userID,
|
|
|
}
|
|
|
|
|
|
- err := clusterForm.ResolveIntegration(*app.repo)
|
|
|
+ err := clusterForm.ResolveIntegration(*app.Repo)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorDataWrite(err, w)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- cluster, err := clusterForm.ResolveCluster(*app.repo)
|
|
|
+ cluster, err := clusterForm.ResolveCluster(*app.Repo)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorDataWrite(err, w)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- cc, err = app.repo.Cluster.UpdateClusterCandidateCreatedClusterID(cc.ID, cluster.ID)
|
|
|
+ cc, err = app.Repo.Cluster.UpdateClusterCandidateCreatedClusterID(cc.ID, cluster.ID)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorDataWrite(err, w)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- app.logger.Info().Msgf("New cluster created: %d", cluster.ID)
|
|
|
+ app.Logger.Info().Msgf("New cluster created: %d", cluster.ID)
|
|
|
}
|
|
|
|
|
|
extClusters = append(extClusters, cc.Externalize())
|
|
|
@@ -322,7 +322,7 @@ func (app *App) HandleListProjectClusterCandidates(w http.ResponseWriter, r *htt
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- ccs, err := app.repo.Cluster.ListClusterCandidatesByProjectID(uint(projID))
|
|
|
+ ccs, err := app.Repo.Cluster.ListClusterCandidatesByProjectID(uint(projID))
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorRead(err, ErrProjectDataRead, w)
|
|
|
@@ -361,7 +361,7 @@ func (app *App) HandleResolveClusterCandidate(w http.ResponseWriter, r *http.Req
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- session, err := app.store.Get(r, app.cookieName)
|
|
|
+ session, err := app.Store.Get(r, app.ServerConf.CookieName)
|
|
|
|
|
|
if err != nil {
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
@@ -385,28 +385,28 @@ func (app *App) HandleResolveClusterCandidate(w http.ResponseWriter, r *http.Req
|
|
|
UserID: userID,
|
|
|
}
|
|
|
|
|
|
- err = clusterResolver.ResolveIntegration(*app.repo)
|
|
|
+ err = clusterResolver.ResolveIntegration(*app.Repo)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorDataWrite(err, w)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- cluster, err := clusterResolver.ResolveCluster(*app.repo)
|
|
|
+ cluster, err := clusterResolver.ResolveCluster(*app.Repo)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorDataWrite(err, w)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- _, err = app.repo.Cluster.UpdateClusterCandidateCreatedClusterID(uint(candID), cluster.ID)
|
|
|
+ _, err = app.Repo.Cluster.UpdateClusterCandidateCreatedClusterID(uint(candID), cluster.ID)
|
|
|
|
|
|
if err != nil {
|
|
|
app.handleErrorDataWrite(err, w)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- app.logger.Info().Msgf("New cluster created: %d", cluster.ID)
|
|
|
+ app.Logger.Info().Msgf("New cluster created: %d", cluster.ID)
|
|
|
|
|
|
clusterExt := cluster.Externalize()
|
|
|
|