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/ChangeSetType.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 ChangeSetTypeMapper 21 { 22 23 static const int CREATE_HASH = HashingUtils::HashString("CREATE"); 24 static const int UPDATE_HASH = HashingUtils::HashString("UPDATE"); 25 static const int IMPORT_HASH = HashingUtils::HashString("IMPORT"); 26 27 GetChangeSetTypeForName(const Aws::String & name)28 ChangeSetType GetChangeSetTypeForName(const Aws::String& name) 29 { 30 int hashCode = HashingUtils::HashString(name.c_str()); 31 if (hashCode == CREATE_HASH) 32 { 33 return ChangeSetType::CREATE; 34 } 35 else if (hashCode == UPDATE_HASH) 36 { 37 return ChangeSetType::UPDATE; 38 } 39 else if (hashCode == IMPORT_HASH) 40 { 41 return ChangeSetType::IMPORT; 42 } 43 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 44 if(overflowContainer) 45 { 46 overflowContainer->StoreOverflow(hashCode, name); 47 return static_cast<ChangeSetType>(hashCode); 48 } 49 50 return ChangeSetType::NOT_SET; 51 } 52 GetNameForChangeSetType(ChangeSetType enumValue)53 Aws::String GetNameForChangeSetType(ChangeSetType enumValue) 54 { 55 switch(enumValue) 56 { 57 case ChangeSetType::CREATE: 58 return "CREATE"; 59 case ChangeSetType::UPDATE: 60 return "UPDATE"; 61 case ChangeSetType::IMPORT: 62 return "IMPORT"; 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 ChangeSetTypeMapper 75 } // namespace Model 76 } // namespace CloudFormation 77 } // namespace Aws 78