1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/cloudformation/model/StackDriftStatus.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 CloudFormation 17 { 18 namespace Model 19 { 20 namespace StackDriftStatusMapper 21 { 22 23 static const int DRIFTED_HASH = HashingUtils::HashString("DRIFTED"); 24 static const int IN_SYNC_HASH = HashingUtils::HashString("IN_SYNC"); 25 static const int UNKNOWN_HASH = HashingUtils::HashString("UNKNOWN"); 26 static const int NOT_CHECKED_HASH = HashingUtils::HashString("NOT_CHECKED"); 27 28 GetStackDriftStatusForName(const Aws::String & name)29 StackDriftStatus GetStackDriftStatusForName(const Aws::String& name) 30 { 31 int hashCode = HashingUtils::HashString(name.c_str()); 32 if (hashCode == DRIFTED_HASH) 33 { 34 return StackDriftStatus::DRIFTED; 35 } 36 else if (hashCode == IN_SYNC_HASH) 37 { 38 return StackDriftStatus::IN_SYNC; 39 } 40 else if (hashCode == UNKNOWN_HASH) 41 { 42 return StackDriftStatus::UNKNOWN; 43 } 44 else if (hashCode == NOT_CHECKED_HASH) 45 { 46 return StackDriftStatus::NOT_CHECKED; 47 } 48 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 49 if(overflowContainer) 50 { 51 overflowContainer->StoreOverflow(hashCode, name); 52 return static_cast<StackDriftStatus>(hashCode); 53 } 54 55 return StackDriftStatus::NOT_SET; 56 } 57 GetNameForStackDriftStatus(StackDriftStatus enumValue)58 Aws::String GetNameForStackDriftStatus(StackDriftStatus enumValue) 59 { 60 switch(enumValue) 61 { 62 case StackDriftStatus::DRIFTED: 63 return "DRIFTED"; 64 case StackDriftStatus::IN_SYNC: 65 return "IN_SYNC"; 66 case StackDriftStatus::UNKNOWN: 67 return "UNKNOWN"; 68 case StackDriftStatus::NOT_CHECKED: 69 return "NOT_CHECKED"; 70 default: 71 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 72 if(overflowContainer) 73 { 74 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 75 } 76 77 return {}; 78 } 79 } 80 81 } // namespace StackDriftStatusMapper 82 } // namespace Model 83 } // namespace CloudFormation 84 } // namespace Aws 85