1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/mgn/model/LifeCycleState.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 mgn 17 { 18 namespace Model 19 { 20 namespace LifeCycleStateMapper 21 { 22 23 static const int STOPPED_HASH = HashingUtils::HashString("STOPPED"); 24 static const int NOT_READY_HASH = HashingUtils::HashString("NOT_READY"); 25 static const int READY_FOR_TEST_HASH = HashingUtils::HashString("READY_FOR_TEST"); 26 static const int TESTING_HASH = HashingUtils::HashString("TESTING"); 27 static const int READY_FOR_CUTOVER_HASH = HashingUtils::HashString("READY_FOR_CUTOVER"); 28 static const int CUTTING_OVER_HASH = HashingUtils::HashString("CUTTING_OVER"); 29 static const int CUTOVER_HASH = HashingUtils::HashString("CUTOVER"); 30 static const int DISCONNECTED_HASH = HashingUtils::HashString("DISCONNECTED"); 31 32 GetLifeCycleStateForName(const Aws::String & name)33 LifeCycleState GetLifeCycleStateForName(const Aws::String& name) 34 { 35 int hashCode = HashingUtils::HashString(name.c_str()); 36 if (hashCode == STOPPED_HASH) 37 { 38 return LifeCycleState::STOPPED; 39 } 40 else if (hashCode == NOT_READY_HASH) 41 { 42 return LifeCycleState::NOT_READY; 43 } 44 else if (hashCode == READY_FOR_TEST_HASH) 45 { 46 return LifeCycleState::READY_FOR_TEST; 47 } 48 else if (hashCode == TESTING_HASH) 49 { 50 return LifeCycleState::TESTING; 51 } 52 else if (hashCode == READY_FOR_CUTOVER_HASH) 53 { 54 return LifeCycleState::READY_FOR_CUTOVER; 55 } 56 else if (hashCode == CUTTING_OVER_HASH) 57 { 58 return LifeCycleState::CUTTING_OVER; 59 } 60 else if (hashCode == CUTOVER_HASH) 61 { 62 return LifeCycleState::CUTOVER; 63 } 64 else if (hashCode == DISCONNECTED_HASH) 65 { 66 return LifeCycleState::DISCONNECTED; 67 } 68 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 69 if(overflowContainer) 70 { 71 overflowContainer->StoreOverflow(hashCode, name); 72 return static_cast<LifeCycleState>(hashCode); 73 } 74 75 return LifeCycleState::NOT_SET; 76 } 77 GetNameForLifeCycleState(LifeCycleState enumValue)78 Aws::String GetNameForLifeCycleState(LifeCycleState enumValue) 79 { 80 switch(enumValue) 81 { 82 case LifeCycleState::STOPPED: 83 return "STOPPED"; 84 case LifeCycleState::NOT_READY: 85 return "NOT_READY"; 86 case LifeCycleState::READY_FOR_TEST: 87 return "READY_FOR_TEST"; 88 case LifeCycleState::TESTING: 89 return "TESTING"; 90 case LifeCycleState::READY_FOR_CUTOVER: 91 return "READY_FOR_CUTOVER"; 92 case LifeCycleState::CUTTING_OVER: 93 return "CUTTING_OVER"; 94 case LifeCycleState::CUTOVER: 95 return "CUTOVER"; 96 case LifeCycleState::DISCONNECTED: 97 return "DISCONNECTED"; 98 default: 99 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 100 if(overflowContainer) 101 { 102 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 103 } 104 105 return {}; 106 } 107 } 108 109 } // namespace LifeCycleStateMapper 110 } // namespace Model 111 } // namespace mgn 112 } // namespace Aws 113