Sfoglia il codice sorgente

move models.InfraExternal to types.Infra

Anukul Sangwan 4 anni fa
parent
commit
0478929146

+ 40 - 0
api/types/infra.go

@@ -0,0 +1,40 @@
+package types
+
+// InfraStatus is the status that an infrastructure can take
+type InfraStatus string
+
+// The allowed statuses
+const (
+	StatusCreating   InfraStatus = "creating"
+	StatusCreated    InfraStatus = "created"
+	StatusError      InfraStatus = "error"
+	StatusDestroying InfraStatus = "destroying"
+	StatusDestroyed  InfraStatus = "destroyed"
+)
+
+// InfraKind is the kind that infra can be
+type InfraKind string
+
+// The supported infra kinds
+const (
+	InfraTest InfraKind = "test"
+	InfraECR  InfraKind = "ecr"
+	InfraEKS  InfraKind = "eks"
+	InfraGCR  InfraKind = "gcr"
+	InfraGKE  InfraKind = "gke"
+	InfraDOCR InfraKind = "docr"
+	InfraDOKS InfraKind = "doks"
+)
+
+type Infra struct {
+	ID uint `json:"id"`
+
+	// The project that this integration belongs to
+	ProjectID uint `json:"project_id"`
+
+	// The type of infra that was provisioned
+	Kind InfraKind `json:"kind"`
+
+	// Status is the status of the infra
+	Status InfraStatus `json:"status"`
+}

+ 2 - 2
cmd/migrate/keyrotate/helpers_test.go

@@ -483,9 +483,9 @@ func initInfra(tester *tester, t *testing.T) {
 	}
 
 	infra := &models.Infra{
-		Kind:        models.InfraECR,
+		Kind:        types.InfraECR,
 		ProjectID:   tester.initProjects[0].Model.ID,
-		Status:      models.StatusCreated,
+		Status:      types.StatusCreated,
 		LastApplied: []byte("testing"),
 	}
 

+ 15 - 14
internal/forms/infra.go

@@ -4,6 +4,7 @@ import (
 	"math/rand"
 	"time"
 
+	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
 )
 
@@ -18,10 +19,10 @@ type CreateTestInfra struct {
 // ToInfra converts the form to a gorm aws infra model
 func (ce *CreateTestInfra) ToInfra() (*models.Infra, error) {
 	return &models.Infra{
-		Kind:      models.InfraTest,
+		Kind:      types.InfraTest,
 		ProjectID: ce.ProjectID,
 		Suffix:    stringWithCharset(6, randCharset),
-		Status:    models.StatusCreating,
+		Status:    types.StatusCreating,
 	}, nil
 }
 
@@ -36,10 +37,10 @@ type CreateECRInfra struct {
 // ToInfra converts the form to a gorm aws infra model
 func (ce *CreateECRInfra) ToInfra() (*models.Infra, error) {
 	return &models.Infra{
-		Kind:             models.InfraECR,
+		Kind:             types.InfraECR,
 		ProjectID:        ce.ProjectID,
 		Suffix:           stringWithCharset(6, randCharset),
-		Status:           models.StatusCreating,
+		Status:           types.StatusCreating,
 		AWSIntegrationID: ce.AWSIntegrationID,
 	}, nil
 }
@@ -56,10 +57,10 @@ type CreateEKSInfra struct {
 // ToInfra converts the form to a gorm aws infra model
 func (ce *CreateEKSInfra) ToInfra() (*models.Infra, error) {
 	return &models.Infra{
-		Kind:             models.InfraEKS,
+		Kind:             types.InfraEKS,
 		ProjectID:        ce.ProjectID,
 		Suffix:           stringWithCharset(6, randCharset),
-		Status:           models.StatusCreating,
+		Status:           types.StatusCreating,
 		AWSIntegrationID: ce.AWSIntegrationID,
 	}, nil
 }
@@ -74,10 +75,10 @@ type CreateGCRInfra struct {
 // ToInfra converts the form to a gorm aws infra model
 func (ce *CreateGCRInfra) ToInfra() (*models.Infra, error) {
 	return &models.Infra{
-		Kind:             models.InfraGCR,
+		Kind:             types.InfraGCR,
 		ProjectID:        ce.ProjectID,
 		Suffix:           stringWithCharset(6, randCharset),
-		Status:           models.StatusCreating,
+		Status:           types.StatusCreating,
 		GCPIntegrationID: ce.GCPIntegrationID,
 	}, nil
 }
@@ -93,10 +94,10 @@ type CreateGKEInfra struct {
 // ToInfra converts the form to a gorm aws infra model
 func (ce *CreateGKEInfra) ToInfra() (*models.Infra, error) {
 	return &models.Infra{
-		Kind:             models.InfraGKE,
+		Kind:             types.InfraGKE,
 		ProjectID:        ce.ProjectID,
 		Suffix:           stringWithCharset(6, randCharset),
-		Status:           models.StatusCreating,
+		Status:           types.StatusCreating,
 		GCPIntegrationID: ce.GCPIntegrationID,
 	}, nil
 }
@@ -113,10 +114,10 @@ type CreateDOCRInfra struct {
 // ToInfra converts the form to a gorm infra model
 func (de *CreateDOCRInfra) ToInfra() (*models.Infra, error) {
 	return &models.Infra{
-		Kind:            models.InfraDOCR,
+		Kind:            types.InfraDOCR,
 		ProjectID:       de.ProjectID,
 		Suffix:          stringWithCharset(6, randCharset),
-		Status:          models.StatusCreating,
+		Status:          types.StatusCreating,
 		DOIntegrationID: de.DOIntegrationID,
 	}, nil
 }
@@ -133,10 +134,10 @@ type CreateDOKSInfra struct {
 // ToInfra converts the form to a gorm infra model
 func (de *CreateDOKSInfra) ToInfra() (*models.Infra, error) {
 	return &models.Infra{
-		Kind:            models.InfraDOKS,
+		Kind:            types.InfraDOKS,
 		ProjectID:       de.ProjectID,
 		Suffix:          stringWithCharset(6, randCharset),
-		Status:          models.StatusCreating,
+		Status:          types.StatusCreating,
 		DOIntegrationID: de.DOIntegrationID,
 	}, nil
 }

+ 12 - 12
internal/kubernetes/provisioner/global_stream.go

@@ -9,11 +9,11 @@ import (
 	"strings"
 
 	"github.com/aws/aws-sdk-go/service/ecr"
-	"github.com/porter-dev/porter/internal/repository"
-
-	redis "github.com/go-redis/redis/v8"
+	"github.com/go-redis/redis/v8"
 
+	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
+	"github.com/porter-dev/porter/internal/repository"
 )
 
 // GlobalStreamName is the name of the Redis stream for global operations
@@ -113,7 +113,7 @@ func GlobalStreamListener(
 					continue
 				}
 
-				infra.Status = models.StatusCreated
+				infra.Status = types.StatusCreated
 
 				infra, err = repo.Infra().UpdateInfra(infra)
 
@@ -122,7 +122,7 @@ func GlobalStreamListener(
 				}
 
 				// create ECR/EKS
-				if kind == string(models.InfraECR) {
+				if kind == string(types.InfraECR) {
 					reg := &models.Registry{
 						ProjectID:        projID,
 						AWSIntegrationID: infra.AWSIntegrationID,
@@ -163,7 +163,7 @@ func GlobalStreamListener(
 					if err != nil {
 						continue
 					}
-				} else if kind == string(models.InfraEKS) {
+				} else if kind == string(types.InfraEKS) {
 					cluster := &models.Cluster{
 						AuthMechanism:    models.AWS,
 						ProjectID:        projID,
@@ -197,7 +197,7 @@ func GlobalStreamListener(
 					if err != nil {
 						continue
 					}
-				} else if kind == string(models.InfraGCR) {
+				} else if kind == string(types.InfraGCR) {
 					reg := &models.Registry{
 						ProjectID:        projID,
 						GCPIntegrationID: infra.GCPIntegrationID,
@@ -217,7 +217,7 @@ func GlobalStreamListener(
 					if err != nil {
 						continue
 					}
-				} else if kind == string(models.InfraGKE) {
+				} else if kind == string(types.InfraGKE) {
 					cluster := &models.Cluster{
 						AuthMechanism:    models.GCP,
 						ProjectID:        projID,
@@ -251,7 +251,7 @@ func GlobalStreamListener(
 					if err != nil {
 						continue
 					}
-				} else if kind == string(models.InfraDOCR) {
+				} else if kind == string(types.InfraDOCR) {
 					reg := &models.Registry{
 						ProjectID:       projID,
 						DOIntegrationID: infra.DOIntegrationID,
@@ -270,7 +270,7 @@ func GlobalStreamListener(
 					if err != nil {
 						continue
 					}
-				} else if kind == string(models.InfraDOKS) {
+				} else if kind == string(types.InfraDOKS) {
 					cluster := &models.Cluster{
 						AuthMechanism:   models.DO,
 						ProjectID:       projID,
@@ -312,7 +312,7 @@ func GlobalStreamListener(
 					continue
 				}
 
-				infra.Status = models.StatusError
+				infra.Status = types.StatusError
 
 				infra, err = repo.Infra().UpdateInfra(infra)
 
@@ -326,7 +326,7 @@ func GlobalStreamListener(
 					continue
 				}
 
-				infra.Status = models.StatusDestroyed
+				infra.Status = types.StatusDestroyed
 
 				infra, err = repo.Infra().UpdateInfra(infra)
 

+ 5 - 43
internal/models/infra.go

@@ -6,32 +6,8 @@ import (
 	"strings"
 
 	"gorm.io/gorm"
-)
-
-// InfraStatus is the status that an infrastructure can take
-type InfraStatus string
-
-// The allowed statuses
-const (
-	StatusCreating   InfraStatus = "creating"
-	StatusCreated    InfraStatus = "created"
-	StatusError      InfraStatus = "error"
-	StatusDestroying InfraStatus = "destroying"
-	StatusDestroyed  InfraStatus = "destroyed"
-)
 
-// InfraKind is the kind that infra can be
-type InfraKind string
-
-// The supported infra kinds
-const (
-	InfraTest InfraKind = "test"
-	InfraECR  InfraKind = "ecr"
-	InfraEKS  InfraKind = "eks"
-	InfraGCR  InfraKind = "gcr"
-	InfraGKE  InfraKind = "gke"
-	InfraDOCR InfraKind = "docr"
-	InfraDOKS InfraKind = "doks"
+	"github.com/porter-dev/porter/api/types"
 )
 
 // Infra represents the metadata for an infrastructure type provisioned on
@@ -40,7 +16,7 @@ type Infra struct {
 	gorm.Model
 
 	// The type of infra that was provisioned
-	Kind InfraKind `json:"kind"`
+	Kind types.InfraKind `json:"kind"`
 
 	// A random 6-byte suffix to ensure workspace/stream ids are unique
 	Suffix string
@@ -49,7 +25,7 @@ type Infra struct {
 	ProjectID uint `json:"project_id"`
 
 	// Status is the status of the infra
-	Status InfraStatus `json:"status"`
+	Status types.InfraStatus `json:"status"`
 
 	// The AWS integration that was used to create the infra
 	AWSIntegrationID uint
@@ -69,23 +45,9 @@ type Infra struct {
 	LastApplied []byte
 }
 
-// InfraExternal is an external Infra to be shared over REST
-type InfraExternal struct {
-	ID uint `json:"id"`
-
-	// The project that this integration belongs to
-	ProjectID uint `json:"project_id"`
-
-	// The type of infra that was provisioned
-	Kind InfraKind `json:"kind"`
-
-	// Status is the status of the infra
-	Status InfraStatus `json:"status"`
-}
-
 // Externalize generates an external Infra to be shared over REST
-func (i *Infra) Externalize() *InfraExternal {
-	return &InfraExternal{
+func (i *Infra) Externalize() *types.Infra {
+	return &types.Infra{
 		ID:        i.ID,
 		ProjectID: i.ProjectID,
 		Kind:      i.Kind,

+ 2 - 2
internal/repository/gorm/helpers_test.go

@@ -485,9 +485,9 @@ func initInfra(tester *tester, t *testing.T) {
 	}
 
 	infra := &models.Infra{
-		Kind:      models.InfraECR,
+		Kind:      types.InfraECR,
 		ProjectID: tester.initProjects[0].Model.ID,
-		Status:    models.StatusCreated,
+		Status:    types.StatusCreated,
 	}
 
 	infra, err := tester.repo.Infra().CreateInfra(infra)

+ 10 - 8
internal/repository/gorm/infra_test.go

@@ -3,9 +3,11 @@ package gorm_test
 import (
 	"testing"
 
+	"gorm.io/gorm"
+
 	"github.com/go-test/deep"
+	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
-	"gorm.io/gorm"
 )
 
 func TestCreateInfra(t *testing.T) {
@@ -18,9 +20,9 @@ func TestCreateInfra(t *testing.T) {
 	defer cleanup(tester, t)
 
 	infra := &models.Infra{
-		Kind:      models.InfraECR,
+		Kind:      types.InfraECR,
 		ProjectID: tester.initProjects[0].Model.ID,
-		Status:    models.StatusCreated,
+		Status:    types.StatusCreated,
 	}
 
 	infra, err := tester.repo.Infra().CreateInfra(infra)
@@ -40,12 +42,12 @@ func TestCreateInfra(t *testing.T) {
 		t.Errorf("incorrect registry ID: expected %d, got %d\n", 1, infra.Model.ID)
 	}
 
-	if infra.Kind != models.InfraECR {
-		t.Errorf("incorrect aws infra kind: expected %s, got %s\n", models.InfraECR, infra.Kind)
+	if infra.Kind != types.InfraECR {
+		t.Errorf("incorrect aws infra kind: expected %s, got %s\n", types.InfraECR, infra.Kind)
 	}
 
-	if infra.Status != models.StatusCreated {
-		t.Errorf("incorrect aws infra status: expected %s, got %s\n", models.StatusCreated, infra.Status)
+	if infra.Status != types.StatusCreated {
+		t.Errorf("incorrect aws infra status: expected %s, got %s\n", types.StatusCreated, infra.Status)
 	}
 }
 
@@ -75,7 +77,7 @@ func TestListInfrasByProjectID(t *testing.T) {
 	expInfra := models.Infra{
 		Kind:      "ecr",
 		ProjectID: tester.initProjects[0].Model.ID,
-		Status:    models.StatusCreated,
+		Status:    types.StatusCreated,
 	}
 
 	infra := infras[0]

+ 3 - 2
server/api/infra_handler.go

@@ -6,7 +6,8 @@ import (
 	"strconv"
 
 	"github.com/go-chi/chi"
-	"github.com/porter-dev/porter/internal/models"
+
+	"github.com/porter-dev/porter/api/types"
 )
 
 // HandleListProjectInfra returns a list of infrasa for a project
@@ -25,7 +26,7 @@ func (app *App) HandleListProjectInfra(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	extInfras := make([]*models.InfraExternal, 0)
+	extInfras := make([]*types.Infra, 0)
 
 	for _, infra := range infras {
 		extInfras = append(extInfras, infra.Externalize())

+ 32 - 33
server/api/provision_handler.go

@@ -9,13 +9,12 @@ import (
 
 	"fmt"
 
+	"github.com/porter-dev/porter/api/types"
+	"github.com/porter-dev/porter/internal/adapter"
 	"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/adapter"
 )
 
 // HandleProvisionTestInfra will create a test resource by deploying a provisioner
@@ -66,7 +65,7 @@ func (app *App) HandleProvisionTestInfra(w http.ResponseWriter, r *http.Request)
 	)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorInternal(err, w)
@@ -107,7 +106,7 @@ func (app *App) HandleDestroyTestInfra(w http.ResponseWriter, r *http.Request) {
 	agent, err := kubernetes.GetAgentInClusterConfig()
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorDataRead(err, w)
@@ -115,7 +114,7 @@ func (app *App) HandleDestroyTestInfra(w http.ResponseWriter, r *http.Request) {
 	}
 
 	// mark infra for deletion
-	infra.Status = models.StatusDestroying
+	infra.Status = types.StatusDestroying
 	infra, err = app.Repo.Infra().UpdateInfra(infra)
 
 	if err != nil {
@@ -188,7 +187,7 @@ func (app *App) HandleProvisionAWSECRInfra(w http.ResponseWriter, r *http.Reques
 	awsInt, err := app.Repo.AWSIntegration().ReadAWSIntegration(infra.AWSIntegrationID)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorDataRead(err, w)
@@ -210,7 +209,7 @@ func (app *App) HandleProvisionAWSECRInfra(w http.ResponseWriter, r *http.Reques
 	)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorInternal(err, w)
@@ -253,7 +252,7 @@ func (app *App) HandleDestroyAWSECRInfra(w http.ResponseWriter, r *http.Request)
 
 	// decode from JSON to form value
 	if err := json.NewDecoder(r.Body).Decode(form); err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorFormDecoding(err, ErrProjectDecode, w)
@@ -262,7 +261,7 @@ func (app *App) HandleDestroyAWSECRInfra(w http.ResponseWriter, r *http.Request)
 
 	// validate the form
 	if err := app.validator.Struct(form); err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorFormValidation(err, ErrProjectValidateFields, w)
@@ -271,7 +270,7 @@ func (app *App) HandleDestroyAWSECRInfra(w http.ResponseWriter, r *http.Request)
 
 	// launch provisioning destruction pod
 	// mark infra for deletion
-	infra.Status = models.StatusDestroying
+	infra.Status = types.StatusDestroying
 	infra, err = app.Repo.Infra().UpdateInfra(infra)
 
 	if err != nil {
@@ -347,7 +346,7 @@ func (app *App) HandleProvisionAWSEKSInfra(w http.ResponseWriter, r *http.Reques
 	awsInt, err := app.Repo.AWSIntegration().ReadAWSIntegration(infra.AWSIntegrationID)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorDataRead(err, w)
@@ -370,7 +369,7 @@ func (app *App) HandleProvisionAWSEKSInfra(w http.ResponseWriter, r *http.Reques
 	)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorInternal(err, w)
@@ -423,7 +422,7 @@ func (app *App) HandleDestroyAWSEKSInfra(w http.ResponseWriter, r *http.Request)
 
 	// decode from JSON to form value
 	if err := json.NewDecoder(r.Body).Decode(form); err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorFormDecoding(err, ErrProjectDecode, w)
@@ -432,7 +431,7 @@ func (app *App) HandleDestroyAWSEKSInfra(w http.ResponseWriter, r *http.Request)
 
 	// validate the form
 	if err := app.validator.Struct(form); err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorFormValidation(err, ErrProjectValidateFields, w)
@@ -441,7 +440,7 @@ func (app *App) HandleDestroyAWSEKSInfra(w http.ResponseWriter, r *http.Request)
 
 	// launch provisioning destruction pod
 	// mark infra for deletion
-	infra.Status = models.StatusDestroying
+	infra.Status = types.StatusDestroying
 	infra, err = app.Repo.Infra().UpdateInfra(infra)
 
 	if err != nil {
@@ -526,7 +525,7 @@ func (app *App) HandleProvisionGCPGCRInfra(w http.ResponseWriter, r *http.Reques
 	gcpInt, err := app.Repo.GCPIntegration().ReadGCPIntegration(infra.GCPIntegrationID)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorDataRead(err, w)
@@ -547,7 +546,7 @@ func (app *App) HandleProvisionGCPGCRInfra(w http.ResponseWriter, r *http.Reques
 	)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorInternal(err, w)
@@ -611,7 +610,7 @@ func (app *App) HandleProvisionGCPGKEInfra(w http.ResponseWriter, r *http.Reques
 	gcpInt, err := app.Repo.GCPIntegration().ReadGCPIntegration(infra.GCPIntegrationID)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorDataRead(err, w)
@@ -633,7 +632,7 @@ func (app *App) HandleProvisionGCPGKEInfra(w http.ResponseWriter, r *http.Reques
 	)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorInternal(err, w)
@@ -686,7 +685,7 @@ func (app *App) HandleDestroyGCPGKEInfra(w http.ResponseWriter, r *http.Request)
 
 	// decode from JSON to form value
 	if err := json.NewDecoder(r.Body).Decode(form); err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorFormDecoding(err, ErrProjectDecode, w)
@@ -695,7 +694,7 @@ func (app *App) HandleDestroyGCPGKEInfra(w http.ResponseWriter, r *http.Request)
 
 	// validate the form
 	if err := app.validator.Struct(form); err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorFormValidation(err, ErrProjectValidateFields, w)
@@ -704,7 +703,7 @@ func (app *App) HandleDestroyGCPGKEInfra(w http.ResponseWriter, r *http.Request)
 
 	// launch provisioning destruction pod
 	// mark infra for deletion
-	infra.Status = models.StatusDestroying
+	infra.Status = types.StatusDestroying
 	infra, err = app.Repo.Infra().UpdateInfra(infra)
 
 	if err != nil {
@@ -832,7 +831,7 @@ func (app *App) HandleProvisionDODOCRInfra(w http.ResponseWriter, r *http.Reques
 	oauthInt, err := app.Repo.OAuthIntegration().ReadOAuthIntegration(infra.DOIntegrationID)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorDataRead(err, w)
@@ -856,7 +855,7 @@ func (app *App) HandleProvisionDODOCRInfra(w http.ResponseWriter, r *http.Reques
 	)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorInternal(err, w)
@@ -899,7 +898,7 @@ func (app *App) HandleDestroyDODOCRInfra(w http.ResponseWriter, r *http.Request)
 
 	// decode from JSON to form value
 	if err := json.NewDecoder(r.Body).Decode(form); err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorFormDecoding(err, ErrProjectDecode, w)
@@ -908,7 +907,7 @@ func (app *App) HandleDestroyDODOCRInfra(w http.ResponseWriter, r *http.Request)
 
 	// validate the form
 	if err := app.validator.Struct(form); err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorFormValidation(err, ErrProjectValidateFields, w)
@@ -917,7 +916,7 @@ func (app *App) HandleDestroyDODOCRInfra(w http.ResponseWriter, r *http.Request)
 
 	// launch provisioning destruction pod
 	// mark infra for deletion
-	infra.Status = models.StatusDestroying
+	infra.Status = types.StatusDestroying
 	infra, err = app.Repo.Infra().UpdateInfra(infra)
 
 	if err != nil {
@@ -995,7 +994,7 @@ func (app *App) HandleProvisionDODOKSInfra(w http.ResponseWriter, r *http.Reques
 	oauthInt, err := app.Repo.OAuthIntegration().ReadOAuthIntegration(infra.DOIntegrationID)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorDataRead(err, w)
@@ -1019,7 +1018,7 @@ func (app *App) HandleProvisionDODOKSInfra(w http.ResponseWriter, r *http.Reques
 	)
 
 	if err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorInternal(err, w)
@@ -1072,7 +1071,7 @@ func (app *App) HandleDestroyDODOKSInfra(w http.ResponseWriter, r *http.Request)
 
 	// decode from JSON to form value
 	if err := json.NewDecoder(r.Body).Decode(form); err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorFormDecoding(err, ErrProjectDecode, w)
@@ -1081,7 +1080,7 @@ func (app *App) HandleDestroyDODOKSInfra(w http.ResponseWriter, r *http.Request)
 
 	// validate the form
 	if err := app.validator.Struct(form); err != nil {
-		infra.Status = models.StatusError
+		infra.Status = types.StatusError
 		infra, _ = app.Repo.Infra().UpdateInfra(infra)
 
 		app.handleErrorFormValidation(err, ErrProjectValidateFields, w)
@@ -1090,7 +1089,7 @@ func (app *App) HandleDestroyDODOKSInfra(w http.ResponseWriter, r *http.Request)
 
 	// launch provisioning destruction pod
 	// mark infra for deletion
-	infra.Status = models.StatusDestroying
+	infra.Status = types.StatusDestroying
 	infra, err = app.Repo.Infra().UpdateInfra(infra)
 
 	if err != nil {