|
|
@@ -7,12 +7,13 @@ import (
|
|
|
|
|
|
"github.com/go-chi/chi"
|
|
|
|
|
|
+ "fmt"
|
|
|
+
|
|
|
+ "github.com/porter-dev/porter/internal/analytics"
|
|
|
"github.com/porter-dev/porter/internal/forms"
|
|
|
"github.com/porter-dev/porter/internal/kubernetes"
|
|
|
"github.com/porter-dev/porter/internal/kubernetes/provisioner"
|
|
|
"github.com/porter-dev/porter/internal/models"
|
|
|
- "github.com/porter-dev/porter/internal/analytics"
|
|
|
- "fmt"
|
|
|
|
|
|
"github.com/porter-dev/porter/internal/adapter"
|
|
|
)
|
|
|
@@ -377,7 +378,15 @@ func (app *App) HandleProvisionAWSEKSInfra(w http.ResponseWriter, r *http.Reques
|
|
|
}
|
|
|
|
|
|
app.Logger.Info().Msgf("New aws eks infra created: %d", infra.ID)
|
|
|
- app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(fmt.Sprintf("%v", userID), fmt.Sprintf("%v", projID), form.EKSName, "EKS", "provisioned"))
|
|
|
+ app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(
|
|
|
+ &analytics.NewClusterEventOpts{
|
|
|
+ UserId: fmt.Sprintf("%d", userID),
|
|
|
+ ProjId: fmt.Sprintf("%d", infra.ProjectID),
|
|
|
+ ClusterName: form.EKSName,
|
|
|
+ ClusterType: "EKS",
|
|
|
+ EventType: "provisioned",
|
|
|
+ },
|
|
|
+ ))
|
|
|
|
|
|
w.WriteHeader(http.StatusCreated)
|
|
|
|
|
|
@@ -460,7 +469,15 @@ func (app *App) HandleDestroyAWSEKSInfra(w http.ResponseWriter, r *http.Request)
|
|
|
}
|
|
|
|
|
|
app.Logger.Info().Msgf("AWS EKS infra marked for destruction: %d", infra.ID)
|
|
|
- app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(fmt.Sprintf("%v", userID), fmt.Sprintf("%v", infra.ProjectID), form.EKSName, "EKS", "destroyed"))
|
|
|
+ app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(
|
|
|
+ &analytics.NewClusterEventOpts{
|
|
|
+ UserId: fmt.Sprintf("%d", userID),
|
|
|
+ ProjId: fmt.Sprintf("%d", infra.ProjectID),
|
|
|
+ ClusterName: form.EKSName,
|
|
|
+ ClusterType: "EKS",
|
|
|
+ EventType: "destroyed",
|
|
|
+ },
|
|
|
+ ))
|
|
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
}
|
|
|
@@ -624,7 +641,15 @@ func (app *App) HandleProvisionGCPGKEInfra(w http.ResponseWriter, r *http.Reques
|
|
|
}
|
|
|
|
|
|
app.Logger.Info().Msgf("New gcp gke infra created: %d", infra.ID)
|
|
|
- app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(fmt.Sprintf("%v", userID), fmt.Sprintf("%v", projID), form.GKEName, "GKE", "provisioned"))
|
|
|
+ app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(
|
|
|
+ &analytics.NewClusterEventOpts{
|
|
|
+ UserId: fmt.Sprintf("%d", userID),
|
|
|
+ ProjId: fmt.Sprintf("%d", infra.ProjectID),
|
|
|
+ ClusterName: form.GKEName,
|
|
|
+ ClusterType: "GKE",
|
|
|
+ EventType: "provisioned",
|
|
|
+ },
|
|
|
+ ))
|
|
|
|
|
|
w.WriteHeader(http.StatusCreated)
|
|
|
|
|
|
@@ -706,7 +731,15 @@ func (app *App) HandleDestroyGCPGKEInfra(w http.ResponseWriter, r *http.Request)
|
|
|
}
|
|
|
|
|
|
app.Logger.Info().Msgf("GCP GKE infra marked for destruction: %d", infra.ID)
|
|
|
- app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(fmt.Sprintf("%v", userID), fmt.Sprintf("%v", infra.ProjectID), form.GKEName, "GKE", "destroyed"))
|
|
|
+ app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(
|
|
|
+ &analytics.NewClusterEventOpts{
|
|
|
+ UserId: fmt.Sprintf("%d", userID),
|
|
|
+ ProjId: fmt.Sprintf("%d", infra.ProjectID),
|
|
|
+ ClusterName: form.GKEName,
|
|
|
+ ClusterType: "GKE",
|
|
|
+ EventType: "destroyed",
|
|
|
+ },
|
|
|
+ ))
|
|
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
}
|
|
|
@@ -994,7 +1027,15 @@ func (app *App) HandleProvisionDODOKSInfra(w http.ResponseWriter, r *http.Reques
|
|
|
}
|
|
|
|
|
|
app.Logger.Info().Msgf("New do doks infra created: %d", infra.ID)
|
|
|
- app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(fmt.Sprintf("%v", userID), fmt.Sprintf("%v", projID), form.DOKSName, "DOKS", "provisioned"))
|
|
|
+ app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(
|
|
|
+ &analytics.NewClusterEventOpts{
|
|
|
+ UserId: fmt.Sprintf("%d", userID),
|
|
|
+ ProjId: fmt.Sprintf("%d", infra.ProjectID),
|
|
|
+ ClusterName: form.DOKSName,
|
|
|
+ ClusterType: "DOKS",
|
|
|
+ EventType: "provisioned",
|
|
|
+ },
|
|
|
+ ))
|
|
|
|
|
|
w.WriteHeader(http.StatusCreated)
|
|
|
|
|
|
@@ -1078,7 +1119,15 @@ func (app *App) HandleDestroyDODOKSInfra(w http.ResponseWriter, r *http.Request)
|
|
|
}
|
|
|
|
|
|
app.Logger.Info().Msgf("DO DOKS infra marked for destruction: %d", infra.ID)
|
|
|
- app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(fmt.Sprintf("%v", userID), fmt.Sprintf("%v", infra.ProjectID), form.DOKSName, "DOKS", "destroyed"))
|
|
|
+ app.analyticsClient.Track(analytics.CreateSegmentNewClusterEvent(
|
|
|
+ &analytics.NewClusterEventOpts{
|
|
|
+ UserId: fmt.Sprintf("%d", userID),
|
|
|
+ ProjId: fmt.Sprintf("%d", infra.ProjectID),
|
|
|
+ ClusterName: form.DOKSName,
|
|
|
+ ClusterType: "DOKS",
|
|
|
+ EventType: "destroyed",
|
|
|
+ },
|
|
|
+ ))
|
|
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
}
|