-
Notifications
You must be signed in to change notification settings - Fork 457
/
operationalstate_enumer.go
66 lines (54 loc) · 2.02 KB
/
operationalstate_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
64
65
66
// Code generated by "enumer -type=OperationalState -linecomment -text"; DO NOT EDIT.
package nethelpers
import (
"fmt"
)
const _OperationalStateName = "unknownnotPresentdownlowerLayerDowntestingdormantup"
var _OperationalStateIndex = [...]uint8{0, 7, 17, 21, 35, 42, 49, 51}
func (i OperationalState) String() string {
if i >= OperationalState(len(_OperationalStateIndex)-1) {
return fmt.Sprintf("OperationalState(%d)", i)
}
return _OperationalStateName[_OperationalStateIndex[i]:_OperationalStateIndex[i+1]]
}
var _OperationalStateValues = []OperationalState{0, 1, 2, 3, 4, 5, 6}
var _OperationalStateNameToValueMap = map[string]OperationalState{
_OperationalStateName[0:7]: 0,
_OperationalStateName[7:17]: 1,
_OperationalStateName[17:21]: 2,
_OperationalStateName[21:35]: 3,
_OperationalStateName[35:42]: 4,
_OperationalStateName[42:49]: 5,
_OperationalStateName[49:51]: 6,
}
// OperationalStateString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func OperationalStateString(s string) (OperationalState, error) {
if val, ok := _OperationalStateNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to OperationalState values", s)
}
// OperationalStateValues returns all values of the enum
func OperationalStateValues() []OperationalState {
return _OperationalStateValues
}
// IsAOperationalState returns "true" if the value is listed in the enum definition. "false" otherwise
func (i OperationalState) IsAOperationalState() bool {
for _, v := range _OperationalStateValues {
if i == v {
return true
}
}
return false
}
// MarshalText implements the encoding.TextMarshaler interface for OperationalState
func (i OperationalState) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for OperationalState
func (i *OperationalState) UnmarshalText(text []byte) error {
var err error
*i, err = OperationalStateString(string(text))
return err
}