forked from openshift/installer
/
clustermetadata.go
45 lines (41 loc) · 1.33 KB
/
clustermetadata.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package types
import (
"github.com/openshift/installer/pkg/types/aws"
"github.com/openshift/installer/pkg/types/libvirt"
"github.com/openshift/installer/pkg/types/openstack"
)
// ClusterMetadata contains information
// regarding the cluster that was created by installer.
type ClusterMetadata struct {
// clusterName is the name for the cluster.
ClusterName string `json:"clusterName"`
// clusterID is a globally unique ID that is used to identify an Openshift cluster.
ClusterID string `json:"clusterID"`
// infraID is an ID that is used to identify cloud resources created by the installer.
InfraID string `json:"infraID"`
ClusterPlatformMetadata `json:",inline"`
}
// ClusterPlatformMetadata contains metadata for platfrom.
type ClusterPlatformMetadata struct {
AWS *aws.Metadata `json:"aws,omitempty"`
OpenStack *openstack.Metadata `json:"openstack,omitempty"`
Libvirt *libvirt.Metadata `json:"libvirt,omitempty"`
}
// Platform returns a string representation of the platform
// (e.g. "aws" if AWS is non-nil). It returns an empty string if no
// platform is configured.
func (cpm *ClusterPlatformMetadata) Platform() string {
if cpm == nil {
return ""
}
if cpm.AWS != nil {
return "aws"
}
if cpm.Libvirt != nil {
return "libvirt"
}
if cpm.OpenStack != nil {
return "openstack"
}
return ""
}