1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/qldb/model/EncryptionStatus.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 QLDB 17 { 18 namespace Model 19 { 20 namespace EncryptionStatusMapper 21 { 22 23 static const int ENABLED_HASH = HashingUtils::HashString("ENABLED"); 24 static const int UPDATING_HASH = HashingUtils::HashString("UPDATING"); 25 static const int KMS_KEY_INACCESSIBLE_HASH = HashingUtils::HashString("KMS_KEY_INACCESSIBLE"); 26 27 GetEncryptionStatusForName(const Aws::String & name)28 EncryptionStatus GetEncryptionStatusForName(const Aws::String& name) 29 { 30 int hashCode = HashingUtils::HashString(name.c_str()); 31 if (hashCode == ENABLED_HASH) 32 { 33 return EncryptionStatus::ENABLED; 34 } 35 else if (hashCode == UPDATING_HASH) 36 { 37 return EncryptionStatus::UPDATING; 38 } 39 else if (hashCode == KMS_KEY_INACCESSIBLE_HASH) 40 { 41 return EncryptionStatus::KMS_KEY_INACCESSIBLE; 42 } 43 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 44 if(overflowContainer) 45 { 46 overflowContainer->StoreOverflow(hashCode, name); 47 return static_cast<EncryptionStatus>(hashCode); 48 } 49 50 return EncryptionStatus::NOT_SET; 51 } 52 GetNameForEncryptionStatus(EncryptionStatus enumValue)53 Aws::String GetNameForEncryptionStatus(EncryptionStatus enumValue) 54 { 55 switch(enumValue) 56 { 57 case EncryptionStatus::ENABLED: 58 return "ENABLED"; 59 case EncryptionStatus::UPDATING: 60 return "UPDATING"; 61 case EncryptionStatus::KMS_KEY_INACCESSIBLE: 62 return "KMS_KEY_INACCESSIBLE"; 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 EncryptionStatusMapper 75 } // namespace Model 76 } // namespace QLDB 77 } // namespace Aws 78