/
etcd_ops_types_enum.go
100 lines (88 loc) · 3.63 KB
/
etcd_ops_types_enum.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Code generated by go-enum DO NOT EDIT.
// Version:
// Revision:
// Build Date:
// Built By:
package v1alpha1
import (
"fmt"
"strings"
)
const (
// EtcdOpsRequestTypeUpdateVersion is a EtcdOpsRequestType of type UpdateVersion.
EtcdOpsRequestTypeUpdateVersion EtcdOpsRequestType = "UpdateVersion"
// EtcdOpsRequestTypeHorizontalScaling is a EtcdOpsRequestType of type HorizontalScaling.
EtcdOpsRequestTypeHorizontalScaling EtcdOpsRequestType = "HorizontalScaling"
// EtcdOpsRequestTypeVerticalScaling is a EtcdOpsRequestType of type VerticalScaling.
EtcdOpsRequestTypeVerticalScaling EtcdOpsRequestType = "VerticalScaling"
// EtcdOpsRequestTypeVolumeExpansion is a EtcdOpsRequestType of type VolumeExpansion.
EtcdOpsRequestTypeVolumeExpansion EtcdOpsRequestType = "VolumeExpansion"
// EtcdOpsRequestTypeRestart is a EtcdOpsRequestType of type Restart.
EtcdOpsRequestTypeRestart EtcdOpsRequestType = "Restart"
// EtcdOpsRequestTypeReconfigure is a EtcdOpsRequestType of type Reconfigure.
EtcdOpsRequestTypeReconfigure EtcdOpsRequestType = "Reconfigure"
// EtcdOpsRequestTypeReconfigureTLS is a EtcdOpsRequestType of type ReconfigureTLS.
EtcdOpsRequestTypeReconfigureTLS EtcdOpsRequestType = "ReconfigureTLS"
)
var ErrInvalidEtcdOpsRequestType = fmt.Errorf("not a valid EtcdOpsRequestType, try [%s]", strings.Join(_EtcdOpsRequestTypeNames, ", "))
var _EtcdOpsRequestTypeNames = []string{
string(EtcdOpsRequestTypeUpdateVersion),
string(EtcdOpsRequestTypeHorizontalScaling),
string(EtcdOpsRequestTypeVerticalScaling),
string(EtcdOpsRequestTypeVolumeExpansion),
string(EtcdOpsRequestTypeRestart),
string(EtcdOpsRequestTypeReconfigure),
string(EtcdOpsRequestTypeReconfigureTLS),
}
// EtcdOpsRequestTypeNames returns a list of possible string values of EtcdOpsRequestType.
func EtcdOpsRequestTypeNames() []string {
tmp := make([]string, len(_EtcdOpsRequestTypeNames))
copy(tmp, _EtcdOpsRequestTypeNames)
return tmp
}
// EtcdOpsRequestTypeValues returns a list of the values for EtcdOpsRequestType
func EtcdOpsRequestTypeValues() []EtcdOpsRequestType {
return []EtcdOpsRequestType{
EtcdOpsRequestTypeUpdateVersion,
EtcdOpsRequestTypeHorizontalScaling,
EtcdOpsRequestTypeVerticalScaling,
EtcdOpsRequestTypeVolumeExpansion,
EtcdOpsRequestTypeRestart,
EtcdOpsRequestTypeReconfigure,
EtcdOpsRequestTypeReconfigureTLS,
}
}
// String implements the Stringer interface.
func (x EtcdOpsRequestType) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x EtcdOpsRequestType) IsValid() bool {
_, err := ParseEtcdOpsRequestType(string(x))
return err == nil
}
var _EtcdOpsRequestTypeValue = map[string]EtcdOpsRequestType{
"UpdateVersion": EtcdOpsRequestTypeUpdateVersion,
"HorizontalScaling": EtcdOpsRequestTypeHorizontalScaling,
"VerticalScaling": EtcdOpsRequestTypeVerticalScaling,
"VolumeExpansion": EtcdOpsRequestTypeVolumeExpansion,
"Restart": EtcdOpsRequestTypeRestart,
"Reconfigure": EtcdOpsRequestTypeReconfigure,
"ReconfigureTLS": EtcdOpsRequestTypeReconfigureTLS,
}
// ParseEtcdOpsRequestType attempts to convert a string to a EtcdOpsRequestType.
func ParseEtcdOpsRequestType(name string) (EtcdOpsRequestType, error) {
if x, ok := _EtcdOpsRequestTypeValue[name]; ok {
return x, nil
}
return EtcdOpsRequestType(""), fmt.Errorf("%s is %w", name, ErrInvalidEtcdOpsRequestType)
}
// MustParseEtcdOpsRequestType converts a string to a EtcdOpsRequestType, and panics if is not valid.
func MustParseEtcdOpsRequestType(name string) EtcdOpsRequestType {
val, err := ParseEtcdOpsRequestType(name)
if err != nil {
panic(err)
}
return val
}