-
Notifications
You must be signed in to change notification settings - Fork 452
/
restartkind_enumer.go
63 lines (51 loc) · 1.68 KB
/
restartkind_enumer.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
// Code generated by "enumer -type=RestartKind -linecomment -text"; DO NOT EDIT.
package services
import (
"fmt"
)
const _RestartKindName = "alwaysneveruntilSuccess"
var _RestartKindIndex = [...]uint8{0, 6, 11, 23}
func (i RestartKind) String() string {
i -= 1
if i < 0 || i >= RestartKind(len(_RestartKindIndex)-1) {
return fmt.Sprintf("RestartKind(%d)", i+1)
}
return _RestartKindName[_RestartKindIndex[i]:_RestartKindIndex[i+1]]
}
var _RestartKindValues = []RestartKind{1, 2, 3}
var _RestartKindNameToValueMap = map[string]RestartKind{
_RestartKindName[0:6]: 1,
_RestartKindName[6:11]: 2,
_RestartKindName[11:23]: 3,
}
// RestartKindString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func RestartKindString(s string) (RestartKind, error) {
if val, ok := _RestartKindNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to RestartKind values", s)
}
// RestartKindValues returns all values of the enum
func RestartKindValues() []RestartKind {
return _RestartKindValues
}
// IsARestartKind returns "true" if the value is listed in the enum definition. "false" otherwise
func (i RestartKind) IsARestartKind() bool {
for _, v := range _RestartKindValues {
if i == v {
return true
}
}
return false
}
// MarshalText implements the encoding.TextMarshaler interface for RestartKind
func (i RestartKind) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for RestartKind
func (i *RestartKind) UnmarshalText(text []byte) error {
var err error
*i, err = RestartKindString(string(text))
return err
}