github.com/aldelo/common@v1.5.1/wrapper/cloudmap/sdnamespacefilter/sdnamespacefilter_enumer.go (about) 1 // Code Generated By gen-enumer For "Enum Type: SdNamespaceFilter" - DO NOT EDIT; 2 3 /* 4 * Copyright 2020-2023 Aldelo, LP 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package sdnamespacefilter 20 21 import ( 22 "fmt" 23 "strconv" 24 ) 25 26 // enum names constants 27 const ( 28 _SdNamespaceFilterName_0 = "UNKNOWN" 29 _SdNamespaceFilterName_1 = "PublicDnsNamespace" 30 _SdNamespaceFilterName_2 = "PrivateDnsNamespace" 31 _SdNamespaceFilterName_3 = "Both" 32 ) 33 34 // var declares of enum indexes 35 var ( 36 _SdNamespaceFilterIndex_0 = [...]uint8{0, 7} 37 _SdNamespaceFilterIndex_1 = [...]uint8{0, 18} 38 _SdNamespaceFilterIndex_2 = [...]uint8{0, 19} 39 _SdNamespaceFilterIndex_3 = [...]uint8{0, 4} 40 ) 41 42 func (i SdNamespaceFilter) String() string { 43 switch { 44 case i == UNKNOWN: 45 return _SdNamespaceFilterName_0 46 case i == PublicDnsNamespace: 47 return _SdNamespaceFilterName_1 48 case i == PrivateDnsNamespace: 49 return _SdNamespaceFilterName_2 50 case i == Both: 51 return _SdNamespaceFilterName_3 52 default: 53 return "" 54 } 55 } 56 57 var _SdNamespaceFilterValues = []SdNamespaceFilter{ 58 0, // UNKNOWN 59 1, // PublicDnsNamespace 60 2, // PrivateDnsNamespace 61 3, // Both 62 } 63 64 var _SdNamespaceFilterNameToValueMap = map[string]SdNamespaceFilter{ 65 _SdNamespaceFilterName_0[0:7]: 0, // UNKNOWN 66 _SdNamespaceFilterName_1[0:18]: 1, // PublicDnsNamespace 67 _SdNamespaceFilterName_2[0:19]: 2, // PrivateDnsNamespace 68 _SdNamespaceFilterName_3[0:4]: 3, // Both 69 } 70 71 var _SdNamespaceFilterValueToKeyMap = map[SdNamespaceFilter]string{ 72 0: _SdNamespaceFilterKey_0, // UNKNOWN 73 1: _SdNamespaceFilterKey_1, // PublicDnsNamespace 74 2: _SdNamespaceFilterKey_2, // PrivateDnsNamespace 75 3: _SdNamespaceFilterKey_3, // Both 76 } 77 78 var _SdNamespaceFilterValueToCaptionMap = map[SdNamespaceFilter]string{ 79 0: _SdNamespaceFilterCaption_0, // UNKNOWN 80 1: _SdNamespaceFilterCaption_1, // PublicDnsNamespace 81 2: _SdNamespaceFilterCaption_2, // PrivateDnsNamespace 82 3: _SdNamespaceFilterCaption_3, // Both 83 } 84 85 var _SdNamespaceFilterValueToDescriptionMap = map[SdNamespaceFilter]string{ 86 0: _SdNamespaceFilterDescription_0, // UNKNOWN 87 1: _SdNamespaceFilterDescription_1, // PublicDnsNamespace 88 2: _SdNamespaceFilterDescription_2, // PrivateDnsNamespace 89 3: _SdNamespaceFilterDescription_3, // Both 90 } 91 92 // Valid returns 'true' if the value is listed in the SdNamespaceFilter enum map definition, 'false' otherwise 93 func (i SdNamespaceFilter) Valid() bool { 94 for _, v := range _SdNamespaceFilterValues { 95 if i == v { 96 return true 97 } 98 } 99 100 return false 101 } 102 103 // ParseByName retrieves a SdNamespaceFilter enum value from the enum string name, 104 // throws an error if the param is not part of the enum 105 func (i SdNamespaceFilter) ParseByName(s string) (SdNamespaceFilter, error) { 106 if val, ok := _SdNamespaceFilterNameToValueMap[s]; ok { 107 // parse ok 108 return val, nil 109 } 110 111 // error 112 return -1, fmt.Errorf("Enum Name of %s Not Expected In SdNamespaceFilter Values List", s) 113 } 114 115 // ParseByKey retrieves a SdNamespaceFilter enum value from the enum string key, 116 // throws an error if the param is not part of the enum 117 func (i SdNamespaceFilter) ParseByKey(s string) (SdNamespaceFilter, error) { 118 for k, v := range _SdNamespaceFilterValueToKeyMap { 119 if v == s { 120 // parse ok 121 return k, nil 122 } 123 } 124 125 // error 126 return -1, fmt.Errorf("Enum Key of %s Not Expected In SdNamespaceFilter Keys List", s) 127 } 128 129 // Key retrieves a SdNamespaceFilter enum string key 130 func (i SdNamespaceFilter) Key() string { 131 if val, ok := _SdNamespaceFilterValueToKeyMap[i]; ok { 132 // found 133 return val 134 } else { 135 // not found 136 return "" 137 } 138 } 139 140 // Caption retrieves a SdNamespaceFilter enum string caption 141 func (i SdNamespaceFilter) Caption() string { 142 if val, ok := _SdNamespaceFilterValueToCaptionMap[i]; ok { 143 // found 144 return val 145 } else { 146 // not found 147 return "" 148 } 149 } 150 151 // Description retrieves a SdNamespaceFilter enum string description 152 func (i SdNamespaceFilter) Description() string { 153 if val, ok := _SdNamespaceFilterValueToDescriptionMap[i]; ok { 154 // found 155 return val 156 } else { 157 // not found 158 return "" 159 } 160 } 161 162 // IntValue gets the intrinsic enum integer value 163 func (i SdNamespaceFilter) IntValue() int { 164 return int(i) 165 } 166 167 // IntString gets the intrinsic enum integer value represented in string format 168 func (i SdNamespaceFilter) IntString() string { 169 return strconv.Itoa(int(i)) 170 } 171 172 // ValueSlice returns all values of the enum SdNamespaceFilter in a slice 173 func (i SdNamespaceFilter) ValueSlice() []SdNamespaceFilter { 174 return _SdNamespaceFilterValues 175 } 176 177 // NameMap returns all names of the enum SdNamespaceFilter in a K:name,V:SdNamespaceFilter map 178 func (i SdNamespaceFilter) NameMap() map[string]SdNamespaceFilter { 179 return _SdNamespaceFilterNameToValueMap 180 } 181 182 // KeyMap returns all keys of the enum SdNamespaceFilter in a K:SdNamespaceFilter,V:key map 183 func (i SdNamespaceFilter) KeyMap() map[SdNamespaceFilter]string { 184 return _SdNamespaceFilterValueToKeyMap 185 } 186 187 // CaptionMap returns all captions of the enum SdNamespaceFilter in a K:SdNamespaceFilter,V:caption map 188 func (i SdNamespaceFilter) CaptionMap() map[SdNamespaceFilter]string { 189 return _SdNamespaceFilterValueToCaptionMap 190 } 191 192 // DescriptionMap returns all descriptions of the enum SdNamespaceFilter in a K:SdNamespaceFilter,V:description map 193 func (i SdNamespaceFilter) DescriptionMap() map[SdNamespaceFilter]string { 194 return _SdNamespaceFilterValueToDescriptionMap 195 }