forked from lkarlslund/Adalanche
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjecttype_enumer.go
More file actions
137 lines (119 loc) · 4.88 KB
/
objecttype_enumer.go
File metadata and controls
137 lines (119 loc) · 4.88 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// Code generated by "enumer -type=ObjectType -trimprefix=ObjectType -json"; DO NOT EDIT.
package main
import (
"encoding/json"
"fmt"
"strings"
)
const _ObjectTypeName = "OtherAttributeSchemaGroupForeignSecurityPrincipalUserComputerManagedServiceAccountOrganizationalUnitContainerGroupPolicyContainerCertificateTemplateTrust"
var _ObjectTypeIndex = [...]uint8{0, 5, 20, 25, 49, 53, 61, 82, 100, 109, 129, 148, 153}
const _ObjectTypeLowerName = "otherattributeschemagroupforeignsecurityprincipalusercomputermanagedserviceaccountorganizationalunitcontainergrouppolicycontainercertificatetemplatetrust"
func (i ObjectType) String() string {
i -= 1
if i >= ObjectType(len(_ObjectTypeIndex)-1) {
return fmt.Sprintf("ObjectType(%d)", i+1)
}
return _ObjectTypeName[_ObjectTypeIndex[i]:_ObjectTypeIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _ObjectTypeNoOp() {
var x [1]struct{}
_ = x[ObjectTypeOther-(1)]
_ = x[ObjectTypeAttributeSchema-(2)]
_ = x[ObjectTypeGroup-(3)]
_ = x[ObjectTypeForeignSecurityPrincipal-(4)]
_ = x[ObjectTypeUser-(5)]
_ = x[ObjectTypeComputer-(6)]
_ = x[ObjectTypeManagedServiceAccount-(7)]
_ = x[ObjectTypeOrganizationalUnit-(8)]
_ = x[ObjectTypeContainer-(9)]
_ = x[ObjectTypeGroupPolicyContainer-(10)]
_ = x[ObjectTypeCertificateTemplate-(11)]
_ = x[ObjectTypeTrust-(12)]
}
var _ObjectTypeValues = []ObjectType{ObjectTypeOther, ObjectTypeAttributeSchema, ObjectTypeGroup, ObjectTypeForeignSecurityPrincipal, ObjectTypeUser, ObjectTypeComputer, ObjectTypeManagedServiceAccount, ObjectTypeOrganizationalUnit, ObjectTypeContainer, ObjectTypeGroupPolicyContainer, ObjectTypeCertificateTemplate, ObjectTypeTrust}
var _ObjectTypeNameToValueMap = map[string]ObjectType{
_ObjectTypeName[0:5]: ObjectTypeOther,
_ObjectTypeLowerName[0:5]: ObjectTypeOther,
_ObjectTypeName[5:20]: ObjectTypeAttributeSchema,
_ObjectTypeLowerName[5:20]: ObjectTypeAttributeSchema,
_ObjectTypeName[20:25]: ObjectTypeGroup,
_ObjectTypeLowerName[20:25]: ObjectTypeGroup,
_ObjectTypeName[25:49]: ObjectTypeForeignSecurityPrincipal,
_ObjectTypeLowerName[25:49]: ObjectTypeForeignSecurityPrincipal,
_ObjectTypeName[49:53]: ObjectTypeUser,
_ObjectTypeLowerName[49:53]: ObjectTypeUser,
_ObjectTypeName[53:61]: ObjectTypeComputer,
_ObjectTypeLowerName[53:61]: ObjectTypeComputer,
_ObjectTypeName[61:82]: ObjectTypeManagedServiceAccount,
_ObjectTypeLowerName[61:82]: ObjectTypeManagedServiceAccount,
_ObjectTypeName[82:100]: ObjectTypeOrganizationalUnit,
_ObjectTypeLowerName[82:100]: ObjectTypeOrganizationalUnit,
_ObjectTypeName[100:109]: ObjectTypeContainer,
_ObjectTypeLowerName[100:109]: ObjectTypeContainer,
_ObjectTypeName[109:129]: ObjectTypeGroupPolicyContainer,
_ObjectTypeLowerName[109:129]: ObjectTypeGroupPolicyContainer,
_ObjectTypeName[129:148]: ObjectTypeCertificateTemplate,
_ObjectTypeLowerName[129:148]: ObjectTypeCertificateTemplate,
_ObjectTypeName[148:153]: ObjectTypeTrust,
_ObjectTypeLowerName[148:153]: ObjectTypeTrust,
}
var _ObjectTypeNames = []string{
_ObjectTypeName[0:5],
_ObjectTypeName[5:20],
_ObjectTypeName[20:25],
_ObjectTypeName[25:49],
_ObjectTypeName[49:53],
_ObjectTypeName[53:61],
_ObjectTypeName[61:82],
_ObjectTypeName[82:100],
_ObjectTypeName[100:109],
_ObjectTypeName[109:129],
_ObjectTypeName[129:148],
_ObjectTypeName[148:153],
}
// ObjectTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func ObjectTypeString(s string) (ObjectType, error) {
if val, ok := _ObjectTypeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _ObjectTypeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to ObjectType values", s)
}
// ObjectTypeValues returns all values of the enum
func ObjectTypeValues() []ObjectType {
return _ObjectTypeValues
}
// ObjectTypeStrings returns a slice of all String values of the enum
func ObjectTypeStrings() []string {
strs := make([]string, len(_ObjectTypeNames))
copy(strs, _ObjectTypeNames)
return strs
}
// IsAObjectType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i ObjectType) IsAObjectType() bool {
for _, v := range _ObjectTypeValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for ObjectType
func (i ObjectType) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for ObjectType
func (i *ObjectType) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("ObjectType should be a string, got %s", data)
}
var err error
*i, err = ObjectTypeString(s)
return err
}