Quellcode durchsuchen

Implemented cluster detail external struct and DetailedExternalize function to cluster

jnfrati vor 5 Jahren
Ursprung
Commit
fb3913b03d
1 geänderte Dateien mit 16 neuen und 3 gelöschten Zeilen
  1. 16 3
      internal/models/cluster.go

+ 16 - 3
internal/models/cluster.go

@@ -86,9 +86,6 @@ type ClusterExternal struct {
 
 	// The infra id, if cluster was provisioned with Porter
 	InfraID uint `json:"infra_id"`
-
-	// The ingress ip for the cluster
-	IngressIP string `json:"ingress_ip"`
 }
 
 // Externalize generates an external Cluster to be shared over REST
@@ -113,6 +110,22 @@ func (c *Cluster) Externalize() *ClusterExternal {
 	}
 }
 
+type ClusterDetailedExternal struct {
+	// Simple cluster external data
+	ClusterExternal
+
+	// The NGINX Ingress IP to access the cluster
+	IngressIP string `json:"ingress_ip"`
+}
+
+func (c *Cluster) DetailedExternalize() *ClusterDetailedExternal {
+	clusterExt := c.Externalize()
+
+	return &ClusterDetailedExternal{
+		ClusterExternal: *clusterExt,
+	}
+}
+
 // ClusterCandidate is a cluster integration that requires additional action
 // from the user to set up.
 type ClusterCandidate struct {