1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/appsync/model/ApiCacheType.h> 7 #include <aws/core/utils/HashingUtils.h> 8 #include <aws/core/Globals.h> 9 #include <aws/core/utils/EnumParseOverflowContainer.h> 10 11 using namespace Aws::Utils; 12 13 14 namespace Aws 15 { 16 namespace AppSync 17 { 18 namespace Model 19 { 20 namespace ApiCacheTypeMapper 21 { 22 23 static const int T2_SMALL_HASH = HashingUtils::HashString("T2_SMALL"); 24 static const int T2_MEDIUM_HASH = HashingUtils::HashString("T2_MEDIUM"); 25 static const int R4_LARGE_HASH = HashingUtils::HashString("R4_LARGE"); 26 static const int R4_XLARGE_HASH = HashingUtils::HashString("R4_XLARGE"); 27 static const int R4_2XLARGE_HASH = HashingUtils::HashString("R4_2XLARGE"); 28 static const int R4_4XLARGE_HASH = HashingUtils::HashString("R4_4XLARGE"); 29 static const int R4_8XLARGE_HASH = HashingUtils::HashString("R4_8XLARGE"); 30 static const int SMALL_HASH = HashingUtils::HashString("SMALL"); 31 static const int MEDIUM_HASH = HashingUtils::HashString("MEDIUM"); 32 static const int LARGE_HASH = HashingUtils::HashString("LARGE"); 33 static const int XLARGE_HASH = HashingUtils::HashString("XLARGE"); 34 static const int LARGE_2X_HASH = HashingUtils::HashString("LARGE_2X"); 35 static const int LARGE_4X_HASH = HashingUtils::HashString("LARGE_4X"); 36 static const int LARGE_8X_HASH = HashingUtils::HashString("LARGE_8X"); 37 static const int LARGE_12X_HASH = HashingUtils::HashString("LARGE_12X"); 38 39 GetApiCacheTypeForName(const Aws::String & name)40 ApiCacheType GetApiCacheTypeForName(const Aws::String& name) 41 { 42 int hashCode = HashingUtils::HashString(name.c_str()); 43 if (hashCode == T2_SMALL_HASH) 44 { 45 return ApiCacheType::T2_SMALL; 46 } 47 else if (hashCode == T2_MEDIUM_HASH) 48 { 49 return ApiCacheType::T2_MEDIUM; 50 } 51 else if (hashCode == R4_LARGE_HASH) 52 { 53 return ApiCacheType::R4_LARGE; 54 } 55 else if (hashCode == R4_XLARGE_HASH) 56 { 57 return ApiCacheType::R4_XLARGE; 58 } 59 else if (hashCode == R4_2XLARGE_HASH) 60 { 61 return ApiCacheType::R4_2XLARGE; 62 } 63 else if (hashCode == R4_4XLARGE_HASH) 64 { 65 return ApiCacheType::R4_4XLARGE; 66 } 67 else if (hashCode == R4_8XLARGE_HASH) 68 { 69 return ApiCacheType::R4_8XLARGE; 70 } 71 else if (hashCode == SMALL_HASH) 72 { 73 return ApiCacheType::SMALL; 74 } 75 else if (hashCode == MEDIUM_HASH) 76 { 77 return ApiCacheType::MEDIUM; 78 } 79 else if (hashCode == LARGE_HASH) 80 { 81 return ApiCacheType::LARGE; 82 } 83 else if (hashCode == XLARGE_HASH) 84 { 85 return ApiCacheType::XLARGE; 86 } 87 else if (hashCode == LARGE_2X_HASH) 88 { 89 return ApiCacheType::LARGE_2X; 90 } 91 else if (hashCode == LARGE_4X_HASH) 92 { 93 return ApiCacheType::LARGE_4X; 94 } 95 else if (hashCode == LARGE_8X_HASH) 96 { 97 return ApiCacheType::LARGE_8X; 98 } 99 else if (hashCode == LARGE_12X_HASH) 100 { 101 return ApiCacheType::LARGE_12X; 102 } 103 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 104 if(overflowContainer) 105 { 106 overflowContainer->StoreOverflow(hashCode, name); 107 return static_cast<ApiCacheType>(hashCode); 108 } 109 110 return ApiCacheType::NOT_SET; 111 } 112 GetNameForApiCacheType(ApiCacheType enumValue)113 Aws::String GetNameForApiCacheType(ApiCacheType enumValue) 114 { 115 switch(enumValue) 116 { 117 case ApiCacheType::T2_SMALL: 118 return "T2_SMALL"; 119 case ApiCacheType::T2_MEDIUM: 120 return "T2_MEDIUM"; 121 case ApiCacheType::R4_LARGE: 122 return "R4_LARGE"; 123 case ApiCacheType::R4_XLARGE: 124 return "R4_XLARGE"; 125 case ApiCacheType::R4_2XLARGE: 126 return "R4_2XLARGE"; 127 case ApiCacheType::R4_4XLARGE: 128 return "R4_4XLARGE"; 129 case ApiCacheType::R4_8XLARGE: 130 return "R4_8XLARGE"; 131 case ApiCacheType::SMALL: 132 return "SMALL"; 133 case ApiCacheType::MEDIUM: 134 return "MEDIUM"; 135 case ApiCacheType::LARGE: 136 return "LARGE"; 137 case ApiCacheType::XLARGE: 138 return "XLARGE"; 139 case ApiCacheType::LARGE_2X: 140 return "LARGE_2X"; 141 case ApiCacheType::LARGE_4X: 142 return "LARGE_4X"; 143 case ApiCacheType::LARGE_8X: 144 return "LARGE_8X"; 145 case ApiCacheType::LARGE_12X: 146 return "LARGE_12X"; 147 default: 148 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 149 if(overflowContainer) 150 { 151 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 152 } 153 154 return {}; 155 } 156 } 157 158 } // namespace ApiCacheTypeMapper 159 } // namespace Model 160 } // namespace AppSync 161 } // namespace Aws 162