-
Notifications
You must be signed in to change notification settings - Fork 32
/
state_management_setting.go
40 lines (38 loc) · 1.1 KB
/
state_management_setting.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
package models
// State Management Setting.
type StateManagementSetting int
const (
// Not configured.
NOTCONFIGURED_STATEMANAGEMENTSETTING StateManagementSetting = iota
// Blocked.
BLOCKED_STATEMANAGEMENTSETTING
// Allowed.
ALLOWED_STATEMANAGEMENTSETTING
)
func (i StateManagementSetting) String() string {
return []string{"notConfigured", "blocked", "allowed"}[i]
}
func ParseStateManagementSetting(v string) (any, error) {
result := NOTCONFIGURED_STATEMANAGEMENTSETTING
switch v {
case "notConfigured":
result = NOTCONFIGURED_STATEMANAGEMENTSETTING
case "blocked":
result = BLOCKED_STATEMANAGEMENTSETTING
case "allowed":
result = ALLOWED_STATEMANAGEMENTSETTING
default:
return nil, nil
}
return &result, nil
}
func SerializeStateManagementSetting(values []StateManagementSetting) []string {
result := make([]string, len(values))
for i, v := range values {
result[i] = v.String()
}
return result
}
func (i StateManagementSetting) isMultiValue() bool {
return false
}