This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
/
secretmanagertype_enumer.go
87 lines (71 loc) · 2.5 KB
/
secretmanagertype_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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Code generated by "enumer --type=SecretManagerType --trimprefix=SecretManagerType -json -yaml"; DO NOT EDIT.
//
package config
import (
"encoding/json"
"fmt"
)
const _SecretManagerTypeName = "GlobalK8sAWSVault"
var _SecretManagerTypeIndex = [...]uint8{0, 6, 9, 12, 17}
func (i SecretManagerType) String() string {
if i < 0 || i >= SecretManagerType(len(_SecretManagerTypeIndex)-1) {
return fmt.Sprintf("SecretManagerType(%d)", i)
}
return _SecretManagerTypeName[_SecretManagerTypeIndex[i]:_SecretManagerTypeIndex[i+1]]
}
var _SecretManagerTypeValues = []SecretManagerType{0, 1, 2, 3}
var _SecretManagerTypeNameToValueMap = map[string]SecretManagerType{
_SecretManagerTypeName[0:6]: 0,
_SecretManagerTypeName[6:9]: 1,
_SecretManagerTypeName[9:12]: 2,
_SecretManagerTypeName[12:17]: 3,
}
// SecretManagerTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func SecretManagerTypeString(s string) (SecretManagerType, error) {
if val, ok := _SecretManagerTypeNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to SecretManagerType values", s)
}
// SecretManagerTypeValues returns all values of the enum
func SecretManagerTypeValues() []SecretManagerType {
return _SecretManagerTypeValues
}
// IsASecretManagerType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i SecretManagerType) IsASecretManagerType() bool {
for _, v := range _SecretManagerTypeValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for SecretManagerType
func (i SecretManagerType) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for SecretManagerType
func (i *SecretManagerType) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("SecretManagerType should be a string, got %s", data)
}
var err error
*i, err = SecretManagerTypeString(s)
return err
}
// MarshalYAML implements a YAML Marshaler for SecretManagerType
func (i SecretManagerType) MarshalYAML() (interface{}, error) {
return i.String(), nil
}
// UnmarshalYAML implements a YAML Unmarshaler for SecretManagerType
func (i *SecretManagerType) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
var err error
*i, err = SecretManagerTypeString(s)
return err
}