1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/glue/model/WorkerType.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 Glue 17 { 18 namespace Model 19 { 20 namespace WorkerTypeMapper 21 { 22 23 static const int Standard_HASH = HashingUtils::HashString("Standard"); 24 static const int G_1X_HASH = HashingUtils::HashString("G.1X"); 25 static const int G_2X_HASH = HashingUtils::HashString("G.2X"); 26 27 GetWorkerTypeForName(const Aws::String & name)28 WorkerType GetWorkerTypeForName(const Aws::String& name) 29 { 30 int hashCode = HashingUtils::HashString(name.c_str()); 31 if (hashCode == Standard_HASH) 32 { 33 return WorkerType::Standard; 34 } 35 else if (hashCode == G_1X_HASH) 36 { 37 return WorkerType::G_1X; 38 } 39 else if (hashCode == G_2X_HASH) 40 { 41 return WorkerType::G_2X; 42 } 43 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 44 if(overflowContainer) 45 { 46 overflowContainer->StoreOverflow(hashCode, name); 47 return static_cast<WorkerType>(hashCode); 48 } 49 50 return WorkerType::NOT_SET; 51 } 52 GetNameForWorkerType(WorkerType enumValue)53 Aws::String GetNameForWorkerType(WorkerType enumValue) 54 { 55 switch(enumValue) 56 { 57 case WorkerType::Standard: 58 return "Standard"; 59 case WorkerType::G_1X: 60 return "G.1X"; 61 case WorkerType::G_2X: 62 return "G.2X"; 63 default: 64 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 65 if(overflowContainer) 66 { 67 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 68 } 69 70 return {}; 71 } 72 } 73 74 } // namespace WorkerTypeMapper 75 } // namespace Model 76 } // namespace Glue 77 } // namespace Aws 78