forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.go
54 lines (48 loc) · 1.41 KB
/
product.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
46
47
48
49
50
51
52
53
54
package util
import (
"path/filepath"
)
const (
ProductOrigin = `Origin`
ProductOpenShift = `OpenShift`
ProductAtomicEnterprise = `Atomic Enterprise`
)
// GetProductName chooses appropriate product for a binary name.
func GetProductName(binaryName string) string {
name := filepath.Base(binaryName)
for {
switch name {
case "openshift":
return ProductOpenShift
case "atomic-enterprise":
return ProductAtomicEnterprise
default:
return ProductOrigin
}
}
}
// GetPlatformName returns an appropriate platform name for given binary name.
// Platform name can be used as a headline in command's usage.
func GetPlatformName(binaryName string) string {
switch GetProductName(binaryName) {
case ProductAtomicEnterprise:
return "Atomic Enterprise Platform"
case ProductOpenShift:
return "OpenShift Application Platform"
default:
return "Origin Application Platform"
}
}
// GetDistributionName returns an appropriate Kubernetes distribution name.
// Distribution name can be used in relation to some feature set in command's
// usage string (e.g. <distribution name> allows you to build, run, etc.).
func GetDistributionName(binaryName string) string {
switch GetProductName(binaryName) {
case ProductAtomicEnterprise:
return "Atomic distribution of Kubernetes"
case ProductOpenShift:
return "OpenShift distribution of Kubernetes"
default:
return "Origin distribution of Kubernetes"
}
}