github.com/openshift/installer@v1.4.17/pkg/types/clustermetadata.go (about) 1 package types 2 3 import ( 4 configv1 "github.com/openshift/api/config/v1" 5 "github.com/openshift/installer/pkg/types/aws" 6 "github.com/openshift/installer/pkg/types/azure" 7 "github.com/openshift/installer/pkg/types/baremetal" 8 "github.com/openshift/installer/pkg/types/gcp" 9 "github.com/openshift/installer/pkg/types/ibmcloud" 10 "github.com/openshift/installer/pkg/types/nutanix" 11 "github.com/openshift/installer/pkg/types/openstack" 12 "github.com/openshift/installer/pkg/types/ovirt" 13 "github.com/openshift/installer/pkg/types/powervs" 14 "github.com/openshift/installer/pkg/types/vsphere" 15 ) 16 17 // ClusterMetadata contains information 18 // regarding the cluster that was created by installer. 19 type ClusterMetadata struct { 20 // ClusterName is the name for the cluster. 21 ClusterName string `json:"clusterName"` 22 // ClusterID is a globally unique ID that is used to identify an Openshift cluster. 23 ClusterID string `json:"clusterID"` 24 // InfraID is an ID that is used to identify cloud resources created by the installer. 25 InfraID string `json:"infraID"` 26 ClusterPlatformMetadata `json:",inline"` 27 FeatureSet configv1.FeatureSet `json:"featureSet"` 28 CustomFeatureSet *configv1.CustomFeatureGates `json:"customFeatureSet"` 29 } 30 31 // ClusterPlatformMetadata contains metadata for platfrom. 32 type ClusterPlatformMetadata struct { 33 AWS *aws.Metadata `json:"aws,omitempty"` 34 OpenStack *openstack.Metadata `json:"openstack,omitempty"` 35 Azure *azure.Metadata `json:"azure,omitempty"` 36 GCP *gcp.Metadata `json:"gcp,omitempty"` 37 IBMCloud *ibmcloud.Metadata `json:"ibmcloud,omitempty"` 38 BareMetal *baremetal.Metadata `json:"baremetal,omitempty"` 39 Ovirt *ovirt.Metadata `json:"ovirt,omitempty"` 40 PowerVS *powervs.Metadata `json:"powervs,omitempty"` 41 VSphere *vsphere.Metadata `json:"vsphere,omitempty"` 42 Nutanix *nutanix.Metadata `json:"nutanix,omitempty"` 43 } 44 45 // Platform returns a string representation of the platform 46 // (e.g. "aws" if AWS is non-nil). It returns an empty string if no 47 // platform is configured. 48 func (cpm *ClusterPlatformMetadata) Platform() string { 49 if cpm == nil { 50 return "" 51 } 52 if cpm.AWS != nil { 53 return aws.Name 54 } 55 if cpm.OpenStack != nil { 56 return openstack.Name 57 } 58 if cpm.Azure != nil { 59 return azure.Name 60 } 61 if cpm.GCP != nil { 62 return gcp.Name 63 } 64 if cpm.IBMCloud != nil { 65 return ibmcloud.Name 66 } 67 if cpm.BareMetal != nil { 68 return "baremetal" 69 } 70 if cpm.Ovirt != nil { 71 return ovirt.Name 72 } 73 if cpm.PowerVS != nil { 74 return powervs.Name 75 } 76 if cpm.VSphere != nil { 77 return vsphere.Name 78 } 79 if cpm.Nutanix != nil { 80 return nutanix.Name 81 } 82 return "" 83 }