1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/eks/model/ClusterStatus.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 EKS 17 { 18 namespace Model 19 { 20 namespace ClusterStatusMapper 21 { 22 23 static const int CREATING_HASH = HashingUtils::HashString("CREATING"); 24 static const int ACTIVE_HASH = HashingUtils::HashString("ACTIVE"); 25 static const int DELETING_HASH = HashingUtils::HashString("DELETING"); 26 static const int FAILED_HASH = HashingUtils::HashString("FAILED"); 27 static const int UPDATING_HASH = HashingUtils::HashString("UPDATING"); 28 static const int PENDING_HASH = HashingUtils::HashString("PENDING"); 29 30 GetClusterStatusForName(const Aws::String & name)31 ClusterStatus GetClusterStatusForName(const Aws::String& name) 32 { 33 int hashCode = HashingUtils::HashString(name.c_str()); 34 if (hashCode == CREATING_HASH) 35 { 36 return ClusterStatus::CREATING; 37 } 38 else if (hashCode == ACTIVE_HASH) 39 { 40 return ClusterStatus::ACTIVE; 41 } 42 else if (hashCode == DELETING_HASH) 43 { 44 return ClusterStatus::DELETING; 45 } 46 else if (hashCode == FAILED_HASH) 47 { 48 return ClusterStatus::FAILED; 49 } 50 else if (hashCode == UPDATING_HASH) 51 { 52 return ClusterStatus::UPDATING; 53 } 54 else if (hashCode == PENDING_HASH) 55 { 56 return ClusterStatus::PENDING; 57 } 58 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 59 if(overflowContainer) 60 { 61 overflowContainer->StoreOverflow(hashCode, name); 62 return static_cast<ClusterStatus>(hashCode); 63 } 64 65 return ClusterStatus::NOT_SET; 66 } 67 GetNameForClusterStatus(ClusterStatus enumValue)68 Aws::String GetNameForClusterStatus(ClusterStatus enumValue) 69 { 70 switch(enumValue) 71 { 72 case ClusterStatus::CREATING: 73 return "CREATING"; 74 case ClusterStatus::ACTIVE: 75 return "ACTIVE"; 76 case ClusterStatus::DELETING: 77 return "DELETING"; 78 case ClusterStatus::FAILED: 79 return "FAILED"; 80 case ClusterStatus::UPDATING: 81 return "UPDATING"; 82 case ClusterStatus::PENDING: 83 return "PENDING"; 84 default: 85 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 86 if(overflowContainer) 87 { 88 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 89 } 90 91 return {}; 92 } 93 } 94 95 } // namespace ClusterStatusMapper 96 } // namespace Model 97 } // namespace EKS 98 } // namespace Aws 99