Преглед на файлове

add integration ids to registry model as well

Alexander Belanger преди 4 години
родител
ревизия
774a6be550
променени са 3 файла, в които са добавени 26 реда и са изтрити 9 реда
  1. 3 3
      api/types/infra.go
  2. 13 0
      api/types/registry.go
  3. 10 6
      internal/models/registry.go

+ 3 - 3
api/types/infra.go

@@ -39,14 +39,14 @@ type Infra struct {
 	Status InfraStatus `json:"status"`
 
 	// The AWS integration that was used to create the infra
-	AWSIntegrationID uint `json:"aws_integration_id"`
+	AWSIntegrationID uint `json:"aws_integration_id,omitempty"`
 
 	// The GCP integration that was used to create the infra
-	GCPIntegrationID uint `json:"gcp_integration_id"`
+	GCPIntegrationID uint `json:"gcp_integration_id,omitempty"`
 
 	// The DO integration that was used to create the infra:
 	// this points to an OAuthIntegrationID
-	DOIntegrationID uint `json:"do_integration_id"`
+	DOIntegrationID uint `json:"do_integration_id,omitempty"`
 
 	// The last-applied, non-sensitive input variables to the provisioner. For now,
 	// this is a map[string]string since we marshal into env vars anyway, but

+ 13 - 0
api/types/registry.go

@@ -23,6 +23,19 @@ type Registry struct {
 
 	// The infra id, if registry was provisioned with Porter
 	InfraID uint `json:"infra_id"`
+
+	// The AWS integration that was used to create or connect the registry
+	AWSIntegrationID uint `json:"aws_integration_id,omitempty"`
+
+	// The GCP integration that was used to create or connect the registry
+	GCPIntegrationID uint `json:"gcp_integration_id,omitempty"`
+
+	// The DO integration that was used to create or connect the registry:
+	// this points to an OAuthIntegrationID
+	DOIntegrationID uint `json:"do_integration_id,omitempty"`
+
+	// The basic integration that was used to connect the registry:
+	BasicIntegrationID uint `json:"basic_integration_id,omitempty"`
 }
 
 // Repository is a collection of images

+ 10 - 6
internal/models/registry.go

@@ -59,11 +59,15 @@ func (r *Registry) ToRegistryType() *types.Registry {
 	}
 
 	return &types.Registry{
-		ID:        r.ID,
-		ProjectID: r.ProjectID,
-		Name:      r.Name,
-		URL:       uri,
-		Service:   serv,
-		InfraID:   r.InfraID,
+		ID:                 r.ID,
+		ProjectID:          r.ProjectID,
+		Name:               r.Name,
+		URL:                uri,
+		Service:            serv,
+		InfraID:            r.InfraID,
+		GCPIntegrationID:   r.GCPIntegrationID,
+		AWSIntegrationID:   r.AWSIntegrationID,
+		DOIntegrationID:    r.DOIntegrationID,
+		BasicIntegrationID: r.BasicIntegrationID,
 	}
 }