github.com/aldelo/common@v1.5.1/wrapper/sns/snsendpointattribute/snsendpointattribute_enumer.go (about) 1 // Code Generated By gen-enumer For "Enum Type: SNSEndpointAttribute" - 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 snsendpointattribute 20 21 import ( 22 "fmt" 23 "strconv" 24 ) 25 26 // enum names constants 27 const ( 28 _SNSEndpointAttributeName_0 = "UNKNOWN" 29 _SNSEndpointAttributeName_1 = "CustomUserData" 30 _SNSEndpointAttributeName_2 = "Enabled" 31 _SNSEndpointAttributeName_3 = "Token" 32 ) 33 34 // var declares of enum indexes 35 var ( 36 _SNSEndpointAttributeIndex_0 = [...]uint8{0, 7} 37 _SNSEndpointAttributeIndex_1 = [...]uint8{0, 14} 38 _SNSEndpointAttributeIndex_2 = [...]uint8{0, 7} 39 _SNSEndpointAttributeIndex_3 = [...]uint8{0, 5} 40 ) 41 42 func (i SNSEndpointAttribute) String() string { 43 switch { 44 case i == UNKNOWN: 45 return _SNSEndpointAttributeName_0 46 case i == CustomUserData: 47 return _SNSEndpointAttributeName_1 48 case i == Enabled: 49 return _SNSEndpointAttributeName_2 50 case i == Token: 51 return _SNSEndpointAttributeName_3 52 default: 53 return "" 54 } 55 } 56 57 var _SNSEndpointAttributeValues = []SNSEndpointAttribute{ 58 0, // UNKNOWN 59 1, // CustomUserData 60 2, // Enabled 61 3, // Token 62 } 63 64 var _SNSEndpointAttributeNameToValueMap = map[string]SNSEndpointAttribute{ 65 _SNSEndpointAttributeName_0[0:7]: 0, // UNKNOWN 66 _SNSEndpointAttributeName_1[0:14]: 1, // CustomUserData 67 _SNSEndpointAttributeName_2[0:7]: 2, // Enabled 68 _SNSEndpointAttributeName_3[0:5]: 3, // Token 69 } 70 71 var _SNSEndpointAttributeValueToKeyMap = map[SNSEndpointAttribute]string{ 72 0: _SNSEndpointAttributeKey_0, // UNKNOWN 73 1: _SNSEndpointAttributeKey_1, // CustomUserData 74 2: _SNSEndpointAttributeKey_2, // Enabled 75 3: _SNSEndpointAttributeKey_3, // Token 76 } 77 78 var _SNSEndpointAttributeValueToCaptionMap = map[SNSEndpointAttribute]string{ 79 0: _SNSEndpointAttributeCaption_0, // UNKNOWN 80 1: _SNSEndpointAttributeCaption_1, // CustomUserData 81 2: _SNSEndpointAttributeCaption_2, // Enabled 82 3: _SNSEndpointAttributeCaption_3, // Token 83 } 84 85 var _SNSEndpointAttributeValueToDescriptionMap = map[SNSEndpointAttribute]string{ 86 0: _SNSEndpointAttributeDescription_0, // UNKNOWN 87 1: _SNSEndpointAttributeDescription_1, // CustomUserData 88 2: _SNSEndpointAttributeDescription_2, // Enabled 89 3: _SNSEndpointAttributeDescription_3, // Token 90 } 91 92 // Valid returns 'true' if the value is listed in the SNSEndpointAttribute enum map definition, 'false' otherwise 93 func (i SNSEndpointAttribute) Valid() bool { 94 for _, v := range _SNSEndpointAttributeValues { 95 if i == v { 96 return true 97 } 98 } 99 100 return false 101 } 102 103 // ParseByName retrieves a SNSEndpointAttribute enum value from the enum string name, 104 // throws an error if the param is not part of the enum 105 func (i SNSEndpointAttribute) ParseByName(s string) (SNSEndpointAttribute, error) { 106 if val, ok := _SNSEndpointAttributeNameToValueMap[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 SNSEndpointAttribute Values List", s) 113 } 114 115 // ParseByKey retrieves a SNSEndpointAttribute enum value from the enum string key, 116 // throws an error if the param is not part of the enum 117 func (i SNSEndpointAttribute) ParseByKey(s string) (SNSEndpointAttribute, error) { 118 for k, v := range _SNSEndpointAttributeValueToKeyMap { 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 SNSEndpointAttribute Keys List", s) 127 } 128 129 // Key retrieves a SNSEndpointAttribute enum string key 130 func (i SNSEndpointAttribute) Key() string { 131 if val, ok := _SNSEndpointAttributeValueToKeyMap[i]; ok { 132 // found 133 return val 134 } else { 135 // not found 136 return "" 137 } 138 } 139 140 // Caption retrieves a SNSEndpointAttribute enum string caption 141 func (i SNSEndpointAttribute) Caption() string { 142 if val, ok := _SNSEndpointAttributeValueToCaptionMap[i]; ok { 143 // found 144 return val 145 } else { 146 // not found 147 return "" 148 } 149 } 150 151 // Description retrieves a SNSEndpointAttribute enum string description 152 func (i SNSEndpointAttribute) Description() string { 153 if val, ok := _SNSEndpointAttributeValueToDescriptionMap[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 SNSEndpointAttribute) IntValue() int { 164 return int(i) 165 } 166 167 // IntString gets the intrinsic enum integer value represented in string format 168 func (i SNSEndpointAttribute) IntString() string { 169 return strconv.Itoa(int(i)) 170 } 171 172 // ValueSlice returns all values of the enum SNSEndpointAttribute in a slice 173 func (i SNSEndpointAttribute) ValueSlice() []SNSEndpointAttribute { 174 return _SNSEndpointAttributeValues 175 } 176 177 // NameMap returns all names of the enum SNSEndpointAttribute in a K:name,V:SNSEndpointAttribute map 178 func (i SNSEndpointAttribute) NameMap() map[string]SNSEndpointAttribute { 179 return _SNSEndpointAttributeNameToValueMap 180 } 181 182 // KeyMap returns all keys of the enum SNSEndpointAttribute in a K:SNSEndpointAttribute,V:key map 183 func (i SNSEndpointAttribute) KeyMap() map[SNSEndpointAttribute]string { 184 return _SNSEndpointAttributeValueToKeyMap 185 } 186 187 // CaptionMap returns all captions of the enum SNSEndpointAttribute in a K:SNSEndpointAttribute,V:caption map 188 func (i SNSEndpointAttribute) CaptionMap() map[SNSEndpointAttribute]string { 189 return _SNSEndpointAttributeValueToCaptionMap 190 } 191 192 // DescriptionMap returns all descriptions of the enum SNSEndpointAttribute in a K:SNSEndpointAttribute,V:description map 193 func (i SNSEndpointAttribute) DescriptionMap() map[SNSEndpointAttribute]string { 194 return _SNSEndpointAttributeValueToDescriptionMap 195 }