1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/ecs/model/AgentUpdateStatus.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 ECS 17 { 18 namespace Model 19 { 20 namespace AgentUpdateStatusMapper 21 { 22 23 static const int PENDING_HASH = HashingUtils::HashString("PENDING"); 24 static const int STAGING_HASH = HashingUtils::HashString("STAGING"); 25 static const int STAGED_HASH = HashingUtils::HashString("STAGED"); 26 static const int UPDATING_HASH = HashingUtils::HashString("UPDATING"); 27 static const int UPDATED_HASH = HashingUtils::HashString("UPDATED"); 28 static const int FAILED_HASH = HashingUtils::HashString("FAILED"); 29 30 GetAgentUpdateStatusForName(const Aws::String & name)31 AgentUpdateStatus GetAgentUpdateStatusForName(const Aws::String& name) 32 { 33 int hashCode = HashingUtils::HashString(name.c_str()); 34 if (hashCode == PENDING_HASH) 35 { 36 return AgentUpdateStatus::PENDING; 37 } 38 else if (hashCode == STAGING_HASH) 39 { 40 return AgentUpdateStatus::STAGING; 41 } 42 else if (hashCode == STAGED_HASH) 43 { 44 return AgentUpdateStatus::STAGED; 45 } 46 else if (hashCode == UPDATING_HASH) 47 { 48 return AgentUpdateStatus::UPDATING; 49 } 50 else if (hashCode == UPDATED_HASH) 51 { 52 return AgentUpdateStatus::UPDATED; 53 } 54 else if (hashCode == FAILED_HASH) 55 { 56 return AgentUpdateStatus::FAILED; 57 } 58 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 59 if(overflowContainer) 60 { 61 overflowContainer->StoreOverflow(hashCode, name); 62 return static_cast<AgentUpdateStatus>(hashCode); 63 } 64 65 return AgentUpdateStatus::NOT_SET; 66 } 67 GetNameForAgentUpdateStatus(AgentUpdateStatus enumValue)68 Aws::String GetNameForAgentUpdateStatus(AgentUpdateStatus enumValue) 69 { 70 switch(enumValue) 71 { 72 case AgentUpdateStatus::PENDING: 73 return "PENDING"; 74 case AgentUpdateStatus::STAGING: 75 return "STAGING"; 76 case AgentUpdateStatus::STAGED: 77 return "STAGED"; 78 case AgentUpdateStatus::UPDATING: 79 return "UPDATING"; 80 case AgentUpdateStatus::UPDATED: 81 return "UPDATED"; 82 case AgentUpdateStatus::FAILED: 83 return "FAILED"; 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 AgentUpdateStatusMapper 96 } // namespace Model 97 } // namespace ECS 98 } // namespace Aws 99