github.com/aldelo/common@v1.5.1/wrapper/sns/snsprotocol/snsprotocol_enumer.go (about) 1 // Code Generated By gen-enumer For "Enum Type: SNSProtocol" - 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 snsprotocol 20 21 import ( 22 "fmt" 23 "strconv" 24 ) 25 26 // enum names constants 27 const ( 28 _SNSProtocolName_0 = "UNKNOWN" 29 _SNSProtocolName_1 = "Http" 30 _SNSProtocolName_2 = "Https" 31 _SNSProtocolName_3 = "Email" 32 _SNSProtocolName_4 = "EmailJson" 33 _SNSProtocolName_5 = "Sms" 34 _SNSProtocolName_6 = "Sqs" 35 _SNSProtocolName_7 = "ApplicationEndpoint" 36 _SNSProtocolName_8 = "Lambda" 37 ) 38 39 // var declares of enum indexes 40 var ( 41 _SNSProtocolIndex_0 = [...]uint8{0, 7} 42 _SNSProtocolIndex_1 = [...]uint8{0, 4} 43 _SNSProtocolIndex_2 = [...]uint8{0, 5} 44 _SNSProtocolIndex_3 = [...]uint8{0, 5} 45 _SNSProtocolIndex_4 = [...]uint8{0, 9} 46 _SNSProtocolIndex_5 = [...]uint8{0, 3} 47 _SNSProtocolIndex_6 = [...]uint8{0, 3} 48 _SNSProtocolIndex_7 = [...]uint8{0, 19} 49 _SNSProtocolIndex_8 = [...]uint8{0, 6} 50 ) 51 52 func (i SNSProtocol) String() string { 53 switch { 54 case i == UNKNOWN: 55 return _SNSProtocolName_0 56 case i == Http: 57 return _SNSProtocolName_1 58 case i == Https: 59 return _SNSProtocolName_2 60 case i == Email: 61 return _SNSProtocolName_3 62 case i == EmailJson: 63 return _SNSProtocolName_4 64 case i == Sms: 65 return _SNSProtocolName_5 66 case i == Sqs: 67 return _SNSProtocolName_6 68 case i == ApplicationEndpoint: 69 return _SNSProtocolName_7 70 case i == Lambda: 71 return _SNSProtocolName_8 72 default: 73 return "" 74 } 75 } 76 77 var _SNSProtocolValues = []SNSProtocol{ 78 0, // UNKNOWN 79 1, // Http 80 2, // Https 81 3, // Email 82 4, // EmailJson 83 5, // Sms 84 6, // Sqs 85 7, // ApplicationEndpoint 86 8, // Lambda 87 } 88 89 var _SNSProtocolNameToValueMap = map[string]SNSProtocol{ 90 _SNSProtocolName_0[0:7]: 0, // UNKNOWN 91 _SNSProtocolName_1[0:4]: 1, // Http 92 _SNSProtocolName_2[0:5]: 2, // Https 93 _SNSProtocolName_3[0:5]: 3, // Email 94 _SNSProtocolName_4[0:9]: 4, // EmailJson 95 _SNSProtocolName_5[0:3]: 5, // Sms 96 _SNSProtocolName_6[0:3]: 6, // Sqs 97 _SNSProtocolName_7[0:19]: 7, // ApplicationEndpoint 98 _SNSProtocolName_8[0:6]: 8, // Lambda 99 } 100 101 var _SNSProtocolValueToKeyMap = map[SNSProtocol]string{ 102 0: _SNSProtocolKey_0, // UNKNOWN 103 1: _SNSProtocolKey_1, // Http 104 2: _SNSProtocolKey_2, // Https 105 3: _SNSProtocolKey_3, // Email 106 4: _SNSProtocolKey_4, // EmailJson 107 5: _SNSProtocolKey_5, // Sms 108 6: _SNSProtocolKey_6, // Sqs 109 7: _SNSProtocolKey_7, // ApplicationEndpoint 110 8: _SNSProtocolKey_8, // Lambda 111 } 112 113 var _SNSProtocolValueToCaptionMap = map[SNSProtocol]string{ 114 0: _SNSProtocolCaption_0, // UNKNOWN 115 1: _SNSProtocolCaption_1, // Http 116 2: _SNSProtocolCaption_2, // Https 117 3: _SNSProtocolCaption_3, // Email 118 4: _SNSProtocolCaption_4, // EmailJson 119 5: _SNSProtocolCaption_5, // Sms 120 6: _SNSProtocolCaption_6, // Sqs 121 7: _SNSProtocolCaption_7, // ApplicationEndpoint 122 8: _SNSProtocolCaption_8, // Lambda 123 } 124 125 var _SNSProtocolValueToDescriptionMap = map[SNSProtocol]string{ 126 0: _SNSProtocolDescription_0, // UNKNOWN 127 1: _SNSProtocolDescription_1, // Http 128 2: _SNSProtocolDescription_2, // Https 129 3: _SNSProtocolDescription_3, // Email 130 4: _SNSProtocolDescription_4, // EmailJson 131 5: _SNSProtocolDescription_5, // Sms 132 6: _SNSProtocolDescription_6, // Sqs 133 7: _SNSProtocolDescription_7, // ApplicationEndpoint 134 8: _SNSProtocolDescription_8, // Lambda 135 } 136 137 // Valid returns 'true' if the value is listed in the SNSProtocol enum map definition, 'false' otherwise 138 func (i SNSProtocol) Valid() bool { 139 for _, v := range _SNSProtocolValues { 140 if i == v { 141 return true 142 } 143 } 144 145 return false 146 } 147 148 // ParseByName retrieves a SNSProtocol enum value from the enum string name, 149 // throws an error if the param is not part of the enum 150 func (i SNSProtocol) ParseByName(s string) (SNSProtocol, error) { 151 if val, ok := _SNSProtocolNameToValueMap[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 SNSProtocol Values List", s) 158 } 159 160 // ParseByKey retrieves a SNSProtocol enum value from the enum string key, 161 // throws an error if the param is not part of the enum 162 func (i SNSProtocol) ParseByKey(s string) (SNSProtocol, error) { 163 for k, v := range _SNSProtocolValueToKeyMap { 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 SNSProtocol Keys List", s) 172 } 173 174 // Key retrieves a SNSProtocol enum string key 175 func (i SNSProtocol) Key() string { 176 if val, ok := _SNSProtocolValueToKeyMap[i]; ok { 177 // found 178 return val 179 } else { 180 // not found 181 return "" 182 } 183 } 184 185 // Caption retrieves a SNSProtocol enum string caption 186 func (i SNSProtocol) Caption() string { 187 if val, ok := _SNSProtocolValueToCaptionMap[i]; ok { 188 // found 189 return val 190 } else { 191 // not found 192 return "" 193 } 194 } 195 196 // Description retrieves a SNSProtocol enum string description 197 func (i SNSProtocol) Description() string { 198 if val, ok := _SNSProtocolValueToDescriptionMap[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 SNSProtocol) IntValue() int { 209 return int(i) 210 } 211 212 // IntString gets the intrinsic enum integer value represented in string format 213 func (i SNSProtocol) IntString() string { 214 return strconv.Itoa(int(i)) 215 } 216 217 // ValueSlice returns all values of the enum SNSProtocol in a slice 218 func (i SNSProtocol) ValueSlice() []SNSProtocol { 219 return _SNSProtocolValues 220 } 221 222 // NameMap returns all names of the enum SNSProtocol in a K:name,V:SNSProtocol map 223 func (i SNSProtocol) NameMap() map[string]SNSProtocol { 224 return _SNSProtocolNameToValueMap 225 } 226 227 // KeyMap returns all keys of the enum SNSProtocol in a K:SNSProtocol,V:key map 228 func (i SNSProtocol) KeyMap() map[SNSProtocol]string { 229 return _SNSProtocolValueToKeyMap 230 } 231 232 // CaptionMap returns all captions of the enum SNSProtocol in a K:SNSProtocol,V:caption map 233 func (i SNSProtocol) CaptionMap() map[SNSProtocol]string { 234 return _SNSProtocolValueToCaptionMap 235 } 236 237 // DescriptionMap returns all descriptions of the enum SNSProtocol in a K:SNSProtocol,V:description map 238 func (i SNSProtocol) DescriptionMap() map[SNSProtocol]string { 239 return _SNSProtocolValueToDescriptionMap 240 }