github.com/aldelo/common@v1.5.1/wrapper/aws/awsregion/awsregion_enumer.go (about) 1 package awsregion 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 // Code Generated By gen-enumer For "Enum Type: AWSRegion" - DO NOT EDIT; 20 21 import ( 22 "fmt" 23 "strconv" 24 ) 25 26 // enum names constants 27 const ( 28 _AWSRegionName_0 = "UNKNOWN" 29 _AWSRegionName_1 = "AWS_us_west_2_oregon" 30 _AWSRegionName_2 = "AWS_us_east_1_nvirginia" 31 _AWSRegionName_3 = "AWS_eu_west_2_london" 32 _AWSRegionName_4 = "AWS_eu_central_1_frankfurt" 33 _AWSRegionName_5 = "AWS_ap_southeast_1_singapore" 34 _AWSRegionName_6 = "AWS_ap_east_1_hongkong" 35 _AWSRegionName_7 = "AWS_ap_northeast_1_tokyo" 36 _AWSRegionName_8 = "AWS_ap_southeast_2_sydney" 37 ) 38 39 // var declares of enum indexes 40 var ( 41 _AWSRegionIndex_0 = [...]uint8{0, 7} 42 _AWSRegionIndex_1 = [...]uint8{0, 20} 43 _AWSRegionIndex_2 = [...]uint8{0, 23} 44 _AWSRegionIndex_3 = [...]uint8{0, 20} 45 _AWSRegionIndex_4 = [...]uint8{0, 26} 46 _AWSRegionIndex_5 = [...]uint8{0, 28} 47 _AWSRegionIndex_6 = [...]uint8{0, 22} 48 _AWSRegionIndex_7 = [...]uint8{0, 24} 49 _AWSRegionIndex_8 = [...]uint8{0, 25} 50 ) 51 52 func (i AWSRegion) String() string { 53 switch { 54 case i == UNKNOWN: 55 return _AWSRegionName_0 56 case i == AWS_us_west_2_oregon: 57 return _AWSRegionName_1 58 case i == AWS_us_east_1_nvirginia: 59 return _AWSRegionName_2 60 case i == AWS_eu_west_2_london: 61 return _AWSRegionName_3 62 case i == AWS_eu_central_1_frankfurt: 63 return _AWSRegionName_4 64 case i == AWS_ap_southeast_1_singapore: 65 return _AWSRegionName_5 66 case i == AWS_ap_east_1_hongkong: 67 return _AWSRegionName_6 68 case i == AWS_ap_northeast_1_tokyo: 69 return _AWSRegionName_7 70 case i == AWS_ap_southeast_2_sydney: 71 return _AWSRegionName_8 72 default: 73 return "" 74 } 75 } 76 77 var _AWSRegionValues = []AWSRegion{ 78 0, // UNKNOWN 79 1, // AWS_us_west_2_oregon 80 2, // AWS_us_east_1_nvirginia 81 3, // AWS_eu_west_2_london 82 4, // AWS_eu_central_1_frankfurt 83 5, // AWS_ap_southeast_1_singapore 84 6, // AWS_ap_east_1_hongkong 85 7, // AWS_ap_northeast_1_tokyo 86 8, // AWS_ap_southeast_2_sydney 87 } 88 89 var _AWSRegionNameToValueMap = map[string]AWSRegion{ 90 _AWSRegionName_0[0:7]: 0, // UNKNOWN 91 _AWSRegionName_1[0:20]: 1, // AWS_us_west_2_oregon 92 _AWSRegionName_2[0:23]: 2, // AWS_us_east_1_nvirginia 93 _AWSRegionName_3[0:20]: 3, // AWS_eu_west_2_london 94 _AWSRegionName_4[0:26]: 4, // AWS_eu_central_1_frankfurt 95 _AWSRegionName_5[0:28]: 5, // AWS_ap_southeast_1_singapore 96 _AWSRegionName_6[0:22]: 6, // AWS_ap_east_1_hongkong 97 _AWSRegionName_7[0:24]: 7, // AWS_ap_northeast_1_tokyo 98 _AWSRegionName_8[0:25]: 8, // AWS_ap_southeast_2_sydney 99 } 100 101 var _AWSRegionValueToKeyMap = map[AWSRegion]string{ 102 0: _AWSRegionKey_0, // UNKNOWN 103 1: _AWSRegionKey_1, // AWS_us_west_2_oregon 104 2: _AWSRegionKey_2, // AWS_us_east_1_nvirginia 105 3: _AWSRegionKey_3, // AWS_eu_west_2_london 106 4: _AWSRegionKey_4, // AWS_eu_central_1_frankfurt 107 5: _AWSRegionKey_5, // AWS_ap_southeast_1_singapore 108 6: _AWSRegionKey_6, // AWS_ap_east_1_hongkong 109 7: _AWSRegionKey_7, // AWS_ap_northeast_1_tokyo 110 8: _AWSRegionKey_8, // AWS_ap_southeast_2_sydney 111 } 112 113 var _AWSRegionValueToCaptionMap = map[AWSRegion]string{ 114 0: _AWSRegionCaption_0, // UNKNOWN 115 1: _AWSRegionCaption_1, // AWS_us_west_2_oregon 116 2: _AWSRegionCaption_2, // AWS_us_east_1_nvirginia 117 3: _AWSRegionCaption_3, // AWS_eu_west_2_london 118 4: _AWSRegionCaption_4, // AWS_eu_central_1_frankfurt 119 5: _AWSRegionCaption_5, // AWS_ap_southeast_1_singapore 120 6: _AWSRegionCaption_6, // AWS_ap_east_1_hongkong 121 7: _AWSRegionCaption_7, // AWS_ap_northeast_1_tokyo 122 8: _AWSRegionCaption_8, // AWS_ap_southeast_2_sydney 123 } 124 125 var _AWSRegionValueToDescriptionMap = map[AWSRegion]string{ 126 0: _AWSRegionDescription_0, // UNKNOWN 127 1: _AWSRegionDescription_1, // AWS_us_west_2_oregon 128 2: _AWSRegionDescription_2, // AWS_us_east_1_nvirginia 129 3: _AWSRegionDescription_3, // AWS_eu_west_2_london 130 4: _AWSRegionDescription_4, // AWS_eu_central_1_frankfurt 131 5: _AWSRegionDescription_5, // AWS_ap_southeast_1_singapore 132 6: _AWSRegionDescription_6, // AWS_ap_east_1_hongkong 133 7: _AWSRegionDescription_7, // AWS_ap_northeast_1_tokyo 134 8: _AWSRegionDescription_8, // AWS_ap_southeast_2_sydney 135 } 136 137 // Valid returns 'true' if the value is listed in the AWSRegion enum map definition, 'false' otherwise 138 func (i AWSRegion) Valid() bool { 139 for _, v := range _AWSRegionValues { 140 if i == v { 141 return true 142 } 143 } 144 145 return false 146 } 147 148 // ParseByName retrieves a AWSRegion enum value from the enum string name, 149 // throws an error if the param is not part of the enum 150 func (i AWSRegion) ParseByName(s string) (AWSRegion, error) { 151 if val, ok := _AWSRegionNameToValueMap[s]; ok { 152 // parse ok 153 return val, nil 154 } 155 156 // error 157 return -1, fmt.Errorf("Enum Name of %s Not Expected In AWSRegion Values List", s) 158 } 159 160 // ParseByKey retrieves a AWSRegion enum value from the enum string key, 161 // throws an error if the param is not part of the enum 162 func (i AWSRegion) ParseByKey(s string) (AWSRegion, error) { 163 for k, v := range _AWSRegionValueToKeyMap { 164 if v == s { 165 // parse ok 166 return k, nil 167 } 168 } 169 170 // error 171 return -1, fmt.Errorf("Enum Key of %s Not Expected In AWSRegion Keys List", s) 172 } 173 174 // Key retrieves a AWSRegion enum string key 175 func (i AWSRegion) Key() string { 176 if val, ok := _AWSRegionValueToKeyMap[i]; ok { 177 // found 178 return val 179 } else { 180 // not found 181 return "" 182 } 183 } 184 185 // Caption retrieves a AWSRegion enum string caption 186 func (i AWSRegion) Caption() string { 187 if val, ok := _AWSRegionValueToCaptionMap[i]; ok { 188 // found 189 return val 190 } else { 191 // not found 192 return "" 193 } 194 } 195 196 // Description retrieves a AWSRegion enum string description 197 func (i AWSRegion) Description() string { 198 if val, ok := _AWSRegionValueToDescriptionMap[i]; ok { 199 // found 200 return val 201 } else { 202 // not found 203 return "" 204 } 205 } 206 207 // IntValue gets the intrinsic enum integer value 208 func (i AWSRegion) IntValue() int { 209 return int(i) 210 } 211 212 // IntString gets the intrinsic enum integer value represented in string format 213 func (i AWSRegion) IntString() string { 214 return strconv.Itoa(int(i)) 215 } 216 217 // ValueSlice returns all values of the enum AWSRegion in a slice 218 func (i AWSRegion) ValueSlice() []AWSRegion { 219 return _AWSRegionValues 220 } 221 222 // NameMap returns all names of the enum AWSRegion in a K:name,V:AWSRegion map 223 func (i AWSRegion) NameMap() map[string]AWSRegion { 224 return _AWSRegionNameToValueMap 225 } 226 227 // KeyMap returns all keys of the enum AWSRegion in a K:AWSRegion,V:key map 228 func (i AWSRegion) KeyMap() map[AWSRegion]string { 229 return _AWSRegionValueToKeyMap 230 } 231 232 // CaptionMap returns all captions of the enum AWSRegion in a K:AWSRegion,V:caption map 233 func (i AWSRegion) CaptionMap() map[AWSRegion]string { 234 return _AWSRegionValueToCaptionMap 235 } 236 237 // DescriptionMap returns all descriptions of the enum AWSRegion in a K:AWSRegion,V:description map 238 func (i AWSRegion) DescriptionMap() map[AWSRegion]string { 239 return _AWSRegionValueToDescriptionMap 240 }