|
| 1 | +/** |
| 2 | + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | + * SPDX-License-Identifier: Apache-2.0. |
| 4 | + */ |
| 5 | + |
| 6 | +#include <aws/verifiedpermissions/model/DeletionProtection.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 VerifiedPermissions |
| 17 | + { |
| 18 | + namespace Model |
| 19 | + { |
| 20 | + namespace DeletionProtectionMapper |
| 21 | + { |
| 22 | + |
| 23 | + static const int ENABLED_HASH = HashingUtils::HashString("ENABLED"); |
| 24 | + static const int DISABLED_HASH = HashingUtils::HashString("DISABLED"); |
| 25 | + |
| 26 | + |
| 27 | + DeletionProtection GetDeletionProtectionForName(const Aws::String& name) |
| 28 | + { |
| 29 | + int hashCode = HashingUtils::HashString(name.c_str()); |
| 30 | + if (hashCode == ENABLED_HASH) |
| 31 | + { |
| 32 | + return DeletionProtection::ENABLED; |
| 33 | + } |
| 34 | + else if (hashCode == DISABLED_HASH) |
| 35 | + { |
| 36 | + return DeletionProtection::DISABLED; |
| 37 | + } |
| 38 | + EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); |
| 39 | + if(overflowContainer) |
| 40 | + { |
| 41 | + overflowContainer->StoreOverflow(hashCode, name); |
| 42 | + return static_cast<DeletionProtection>(hashCode); |
| 43 | + } |
| 44 | + |
| 45 | + return DeletionProtection::NOT_SET; |
| 46 | + } |
| 47 | + |
| 48 | + Aws::String GetNameForDeletionProtection(DeletionProtection enumValue) |
| 49 | + { |
| 50 | + switch(enumValue) |
| 51 | + { |
| 52 | + case DeletionProtection::NOT_SET: |
| 53 | + return {}; |
| 54 | + case DeletionProtection::ENABLED: |
| 55 | + return "ENABLED"; |
| 56 | + case DeletionProtection::DISABLED: |
| 57 | + return "DISABLED"; |
| 58 | + default: |
| 59 | + EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); |
| 60 | + if(overflowContainer) |
| 61 | + { |
| 62 | + return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); |
| 63 | + } |
| 64 | + |
| 65 | + return {}; |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + } // namespace DeletionProtectionMapper |
| 70 | + } // namespace Model |
| 71 | + } // namespace VerifiedPermissions |
| 72 | +} // namespace Aws |
0 commit comments