1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/auditmanager/model/SourceType.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 AuditManager 17 { 18 namespace Model 19 { 20 namespace SourceTypeMapper 21 { 22 23 static const int AWS_Cloudtrail_HASH = HashingUtils::HashString("AWS_Cloudtrail"); 24 static const int AWS_Config_HASH = HashingUtils::HashString("AWS_Config"); 25 static const int AWS_Security_Hub_HASH = HashingUtils::HashString("AWS_Security_Hub"); 26 static const int AWS_API_Call_HASH = HashingUtils::HashString("AWS_API_Call"); 27 static const int MANUAL_HASH = HashingUtils::HashString("MANUAL"); 28 29 GetSourceTypeForName(const Aws::String & name)30 SourceType GetSourceTypeForName(const Aws::String& name) 31 { 32 int hashCode = HashingUtils::HashString(name.c_str()); 33 if (hashCode == AWS_Cloudtrail_HASH) 34 { 35 return SourceType::AWS_Cloudtrail; 36 } 37 else if (hashCode == AWS_Config_HASH) 38 { 39 return SourceType::AWS_Config; 40 } 41 else if (hashCode == AWS_Security_Hub_HASH) 42 { 43 return SourceType::AWS_Security_Hub; 44 } 45 else if (hashCode == AWS_API_Call_HASH) 46 { 47 return SourceType::AWS_API_Call; 48 } 49 else if (hashCode == MANUAL_HASH) 50 { 51 return SourceType::MANUAL; 52 } 53 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 54 if(overflowContainer) 55 { 56 overflowContainer->StoreOverflow(hashCode, name); 57 return static_cast<SourceType>(hashCode); 58 } 59 60 return SourceType::NOT_SET; 61 } 62 GetNameForSourceType(SourceType enumValue)63 Aws::String GetNameForSourceType(SourceType enumValue) 64 { 65 switch(enumValue) 66 { 67 case SourceType::AWS_Cloudtrail: 68 return "AWS_Cloudtrail"; 69 case SourceType::AWS_Config: 70 return "AWS_Config"; 71 case SourceType::AWS_Security_Hub: 72 return "AWS_Security_Hub"; 73 case SourceType::AWS_API_Call: 74 return "AWS_API_Call"; 75 case SourceType::MANUAL: 76 return "MANUAL"; 77 default: 78 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 79 if(overflowContainer) 80 { 81 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 82 } 83 84 return {}; 85 } 86 } 87 88 } // namespace SourceTypeMapper 89 } // namespace Model 90 } // namespace AuditManager 91 } // namespace Aws 92