github.com/aldelo/common@v1.5.1/wrapper/sns/snssubscribeattribute/snssubscribeattribute_enumer.go (about) 1 // Code Generated By gen-enumer For "Enum Type: SNSSubscribeAttribute" - 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 snssubscribeattribute 20 21 import ( 22 "fmt" 23 "strconv" 24 ) 25 26 // enum names constants 27 const ( 28 _SNSSubscribeAttributeName_0 = "UNKNOWN" 29 _SNSSubscribeAttributeName_1 = "DeliveryPolicy" 30 _SNSSubscribeAttributeName_2 = "FilterPolicy" 31 _SNSSubscribeAttributeName_3 = "RawMessageDelivery" 32 _SNSSubscribeAttributeName_4 = "RedrivePolicy" 33 ) 34 35 // var declares of enum indexes 36 var ( 37 _SNSSubscribeAttributeIndex_0 = [...]uint8{0, 7} 38 _SNSSubscribeAttributeIndex_1 = [...]uint8{0, 14} 39 _SNSSubscribeAttributeIndex_2 = [...]uint8{0, 12} 40 _SNSSubscribeAttributeIndex_3 = [...]uint8{0, 18} 41 _SNSSubscribeAttributeIndex_4 = [...]uint8{0, 13} 42 ) 43 44 func (i SNSSubscribeAttribute) String() string { 45 switch { 46 case i == UNKNOWN: 47 return _SNSSubscribeAttributeName_0 48 case i == DeliveryPolicy: 49 return _SNSSubscribeAttributeName_1 50 case i == FilterPolicy: 51 return _SNSSubscribeAttributeName_2 52 case i == RawMessageDelivery: 53 return _SNSSubscribeAttributeName_3 54 case i == RedrivePolicy: 55 return _SNSSubscribeAttributeName_4 56 default: 57 return "" 58 } 59 } 60 61 var _SNSSubscribeAttributeValues = []SNSSubscribeAttribute{ 62 0, // UNKNOWN 63 1, // DeliveryPolicy 64 2, // FilterPolicy 65 3, // RawMessageDelivery 66 4, // RedrivePolicy 67 } 68 69 var _SNSSubscribeAttributeNameToValueMap = map[string]SNSSubscribeAttribute{ 70 _SNSSubscribeAttributeName_0[0:7]: 0, // UNKNOWN 71 _SNSSubscribeAttributeName_1[0:14]: 1, // DeliveryPolicy 72 _SNSSubscribeAttributeName_2[0:12]: 2, // FilterPolicy 73 _SNSSubscribeAttributeName_3[0:18]: 3, // RawMessageDelivery 74 _SNSSubscribeAttributeName_4[0:13]: 4, // RedrivePolicy 75 } 76 77 var _SNSSubscribeAttributeValueToKeyMap = map[SNSSubscribeAttribute]string{ 78 0: _SNSSubscribeAttributeKey_0, // UNKNOWN 79 1: _SNSSubscribeAttributeKey_1, // DeliveryPolicy 80 2: _SNSSubscribeAttributeKey_2, // FilterPolicy 81 3: _SNSSubscribeAttributeKey_3, // RawMessageDelivery 82 4: _SNSSubscribeAttributeKey_4, // RedrivePolicy 83 } 84 85 var _SNSSubscribeAttributeValueToCaptionMap = map[SNSSubscribeAttribute]string{ 86 0: _SNSSubscribeAttributeCaption_0, // UNKNOWN 87 1: _SNSSubscribeAttributeCaption_1, // DeliveryPolicy 88 2: _SNSSubscribeAttributeCaption_2, // FilterPolicy 89 3: _SNSSubscribeAttributeCaption_3, // RawMessageDelivery 90 4: _SNSSubscribeAttributeCaption_4, // RedrivePolicy 91 } 92 93 var _SNSSubscribeAttributeValueToDescriptionMap = map[SNSSubscribeAttribute]string{ 94 0: _SNSSubscribeAttributeDescription_0, // UNKNOWN 95 1: _SNSSubscribeAttributeDescription_1, // DeliveryPolicy 96 2: _SNSSubscribeAttributeDescription_2, // FilterPolicy 97 3: _SNSSubscribeAttributeDescription_3, // RawMessageDelivery 98 4: _SNSSubscribeAttributeDescription_4, // RedrivePolicy 99 } 100 101 // Valid returns 'true' if the value is listed in the SNSSubscribeAttribute enum map definition, 'false' otherwise 102 func (i SNSSubscribeAttribute) Valid() bool { 103 for _, v := range _SNSSubscribeAttributeValues { 104 if i == v { 105 return true 106 } 107 } 108 109 return false 110 } 111 112 // ParseByName retrieves a SNSSubscribeAttribute enum value from the enum string name, 113 // throws an error if the param is not part of the enum 114 func (i SNSSubscribeAttribute) ParseByName(s string) (SNSSubscribeAttribute, error) { 115 if val, ok := _SNSSubscribeAttributeNameToValueMap[s]; ok { 116 // parse ok 117 return val, nil 118 } 119 120 // error 121 return -1, fmt.Errorf("Enum Name of %s Not Expected In SNSSubscribeAttribute Values List", s) 122 } 123 124 // ParseByKey retrieves a SNSSubscribeAttribute enum value from the enum string key, 125 // throws an error if the param is not part of the enum 126 func (i SNSSubscribeAttribute) ParseByKey(s string) (SNSSubscribeAttribute, error) { 127 for k, v := range _SNSSubscribeAttributeValueToKeyMap { 128 if v == s { 129 // parse ok 130 return k, nil 131 } 132 } 133 134 // error 135 return -1, fmt.Errorf("Enum Key of %s Not Expected In SNSSubscribeAttribute Keys List", s) 136 } 137 138 // Key retrieves a SNSSubscribeAttribute enum string key 139 func (i SNSSubscribeAttribute) Key() string { 140 if val, ok := _SNSSubscribeAttributeValueToKeyMap[i]; ok { 141 // found 142 return val 143 } else { 144 // not found 145 return "" 146 } 147 } 148 149 // Caption retrieves a SNSSubscribeAttribute enum string caption 150 func (i SNSSubscribeAttribute) Caption() string { 151 if val, ok := _SNSSubscribeAttributeValueToCaptionMap[i]; ok { 152 // found 153 return val 154 } else { 155 // not found 156 return "" 157 } 158 } 159 160 // Description retrieves a SNSSubscribeAttribute enum string description 161 func (i SNSSubscribeAttribute) Description() string { 162 if val, ok := _SNSSubscribeAttributeValueToDescriptionMap[i]; ok { 163 // found 164 return val 165 } else { 166 // not found 167 return "" 168 } 169 } 170 171 // IntValue gets the intrinsic enum integer value 172 func (i SNSSubscribeAttribute) IntValue() int { 173 return int(i) 174 } 175 176 // IntString gets the intrinsic enum integer value represented in string format 177 func (i SNSSubscribeAttribute) IntString() string { 178 return strconv.Itoa(int(i)) 179 } 180 181 // ValueSlice returns all values of the enum SNSSubscribeAttribute in a slice 182 func (i SNSSubscribeAttribute) ValueSlice() []SNSSubscribeAttribute { 183 return _SNSSubscribeAttributeValues 184 } 185 186 // NameMap returns all names of the enum SNSSubscribeAttribute in a K:name,V:SNSSubscribeAttribute map 187 func (i SNSSubscribeAttribute) NameMap() map[string]SNSSubscribeAttribute { 188 return _SNSSubscribeAttributeNameToValueMap 189 } 190 191 // KeyMap returns all keys of the enum SNSSubscribeAttribute in a K:SNSSubscribeAttribute,V:key map 192 func (i SNSSubscribeAttribute) KeyMap() map[SNSSubscribeAttribute]string { 193 return _SNSSubscribeAttributeValueToKeyMap 194 } 195 196 // CaptionMap returns all captions of the enum SNSSubscribeAttribute in a K:SNSSubscribeAttribute,V:caption map 197 func (i SNSSubscribeAttribute) CaptionMap() map[SNSSubscribeAttribute]string { 198 return _SNSSubscribeAttributeValueToCaptionMap 199 } 200 201 // DescriptionMap returns all descriptions of the enum SNSSubscribeAttribute in a K:SNSSubscribeAttribute,V:description map 202 func (i SNSSubscribeAttribute) DescriptionMap() map[SNSSubscribeAttribute]string { 203 return _SNSSubscribeAttributeValueToDescriptionMap 204 }