Sfoglia il codice sorgente

moving things around

Feroze Mohideen 3 anni fa
parent
commit
b403ecfa90
2 ha cambiato i file con 39 aggiunte e 39 eliminazioni
  1. 39 0
      api/server/handlers/stacks/create.go
  2. 0 39
      api/server/handlers/stacks/update.go

+ 39 - 0
api/server/handlers/stacks/create.go

@@ -12,6 +12,7 @@ import (
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/helm"
 	"github.com/porter-dev/porter/internal/models"
+	"github.com/stefanmcshane/helm/pkg/chart"
 )
 
 type CreateStackHandler struct {
@@ -94,3 +95,41 @@ func (c *CreateStackHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	}
 	w.WriteHeader(http.StatusCreated)
 }
+
+func createChartFromDependencies(deps []types.Dependency) (*chart.Chart, error) {
+	metadata := &chart.Metadata{
+		Name:        "umbrella",
+		Description: "Web application that is exposed to external traffic.",
+		Version:     "0.96.0",
+		APIVersion:  "v2",
+		Home:        "https://getporter.dev/",
+		Icon:        "https://user-images.githubusercontent.com/65516095/111255214-07d3da80-85ed-11eb-99e2-fddcbdb99bdb.png",
+		Keywords: []string{
+			"porter",
+			"application",
+			"service",
+			"umbrella",
+		},
+		Type:         "application",
+		Dependencies: createChartDependencies(deps),
+	}
+
+	// create a new chart object with the metadata
+	c := &chart.Chart{
+		Metadata: metadata,
+	}
+	return c, nil
+}
+
+func createChartDependencies(deps []types.Dependency) []*chart.Dependency {
+	var chartDependencies []*chart.Dependency
+	for _, d := range deps {
+		chartDependencies = append(chartDependencies, &chart.Dependency{
+			Name:       d.Name,
+			Alias:      d.Alias,
+			Version:    d.Version,
+			Repository: d.Repository,
+		})
+	}
+	return chartDependencies
+}

+ 0 - 39
api/server/handlers/stacks/update.go

@@ -12,7 +12,6 @@ import (
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/helm"
 	"github.com/porter-dev/porter/internal/models"
-	"github.com/stefanmcshane/helm/pkg/chart"
 )
 
 type UpdateStackHandler struct {
@@ -82,41 +81,3 @@ func (c *UpdateStackHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	}
 	w.WriteHeader(http.StatusCreated)
 }
-
-func createChartFromDependencies(deps []types.Dependency) (*chart.Chart, error) {
-	metadata := &chart.Metadata{
-		Name:        "umbrella",
-		Description: "Web application that is exposed to external traffic.",
-		Version:     "0.96.0",
-		APIVersion:  "v2",
-		Home:        "https://getporter.dev/",
-		Icon:        "https://user-images.githubusercontent.com/65516095/111255214-07d3da80-85ed-11eb-99e2-fddcbdb99bdb.png",
-		Keywords: []string{
-			"porter",
-			"application",
-			"service",
-			"umbrella",
-		},
-		Type:         "application",
-		Dependencies: createChartDependencies(deps),
-	}
-
-	// create a new chart object with the metadata
-	c := &chart.Chart{
-		Metadata: metadata,
-	}
-	return c, nil
-}
-
-func createChartDependencies(deps []types.Dependency) []*chart.Dependency {
-	var chartDependencies []*chart.Dependency
-	for _, d := range deps {
-		chartDependencies = append(chartDependencies, &chart.Dependency{
-			Name:       d.Name,
-			Alias:      d.Alias,
-			Version:    d.Version,
-			Repository: d.Repository,
-		})
-	}
-	return chartDependencies
-}