| 1 | /* |
|---|---|
| 2 | * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | * You may not use this file except in compliance with the License. |
| 6 | * A copy of the License is located at |
| 7 | * |
| 8 | * http://aws.amazon.com/apache2.0 |
| 9 | * |
| 10 | * or in the "license" file accompanying this file. This file is distributed |
| 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | * express or implied. See the License for the specific language governing |
| 13 | * permissions and limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | #include <aws/s3/model/InventoryOptionalField.h> |
| 17 | #include <aws/core/utils/HashingUtils.h> |
| 18 | #include <aws/core/Globals.h> |
| 19 | #include <aws/core/utils/EnumParseOverflowContainer.h> |
| 20 | |
| 21 | using namespace Aws::Utils; |
| 22 | |
| 23 | |
| 24 | namespace Aws |
| 25 | { |
| 26 | namespace S3 |
| 27 | { |
| 28 | namespace Model |
| 29 | { |
| 30 | namespace InventoryOptionalFieldMapper |
| 31 | { |
| 32 | |
| 33 | static const int Size_HASH = HashingUtils::HashString("Size"); |
| 34 | static const int LastModifiedDate_HASH = HashingUtils::HashString("LastModifiedDate"); |
| 35 | static const int StorageClass_HASH = HashingUtils::HashString("StorageClass"); |
| 36 | static const int ETag_HASH = HashingUtils::HashString("ETag"); |
| 37 | static const int IsMultipartUploaded_HASH = HashingUtils::HashString("IsMultipartUploaded"); |
| 38 | static const int ReplicationStatus_HASH = HashingUtils::HashString("ReplicationStatus"); |
| 39 | static const int EncryptionStatus_HASH = HashingUtils::HashString("EncryptionStatus"); |
| 40 | static const int ObjectLockRetainUntilDate_HASH = HashingUtils::HashString("ObjectLockRetainUntilDate"); |
| 41 | static const int ObjectLockMode_HASH = HashingUtils::HashString("ObjectLockMode"); |
| 42 | static const int ObjectLockLegalHoldStatus_HASH = HashingUtils::HashString("ObjectLockLegalHoldStatus"); |
| 43 | static const int IntelligentTieringAccessTier_HASH = HashingUtils::HashString("IntelligentTieringAccessTier"); |
| 44 | |
| 45 | |
| 46 | InventoryOptionalField GetInventoryOptionalFieldForName(const Aws::String& name) |
| 47 | { |
| 48 | int hashCode = HashingUtils::HashString(name.c_str()); |
| 49 | if (hashCode == Size_HASH) |
| 50 | { |
| 51 | return InventoryOptionalField::Size; |
| 52 | } |
| 53 | else if (hashCode == LastModifiedDate_HASH) |
| 54 | { |
| 55 | return InventoryOptionalField::LastModifiedDate; |
| 56 | } |
| 57 | else if (hashCode == StorageClass_HASH) |
| 58 | { |
| 59 | return InventoryOptionalField::StorageClass; |
| 60 | } |
| 61 | else if (hashCode == ETag_HASH) |
| 62 | { |
| 63 | return InventoryOptionalField::ETag; |
| 64 | } |
| 65 | else if (hashCode == IsMultipartUploaded_HASH) |
| 66 | { |
| 67 | return InventoryOptionalField::IsMultipartUploaded; |
| 68 | } |
| 69 | else if (hashCode == ReplicationStatus_HASH) |
| 70 | { |
| 71 | return InventoryOptionalField::ReplicationStatus; |
| 72 | } |
| 73 | else if (hashCode == EncryptionStatus_HASH) |
| 74 | { |
| 75 | return InventoryOptionalField::EncryptionStatus; |
| 76 | } |
| 77 | else if (hashCode == ObjectLockRetainUntilDate_HASH) |
| 78 | { |
| 79 | return InventoryOptionalField::ObjectLockRetainUntilDate; |
| 80 | } |
| 81 | else if (hashCode == ObjectLockMode_HASH) |
| 82 | { |
| 83 | return InventoryOptionalField::ObjectLockMode; |
| 84 | } |
| 85 | else if (hashCode == ObjectLockLegalHoldStatus_HASH) |
| 86 | { |
| 87 | return InventoryOptionalField::ObjectLockLegalHoldStatus; |
| 88 | } |
| 89 | else if (hashCode == IntelligentTieringAccessTier_HASH) |
| 90 | { |
| 91 | return InventoryOptionalField::IntelligentTieringAccessTier; |
| 92 | } |
| 93 | EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); |
| 94 | if(overflowContainer) |
| 95 | { |
| 96 | overflowContainer->StoreOverflow(hashCode, name); |
| 97 | return static_cast<InventoryOptionalField>(hashCode); |
| 98 | } |
| 99 | |
| 100 | return InventoryOptionalField::NOT_SET; |
| 101 | } |
| 102 | |
| 103 | Aws::String GetNameForInventoryOptionalField(InventoryOptionalField enumValue) |
| 104 | { |
| 105 | switch(enumValue) |
| 106 | { |
| 107 | case InventoryOptionalField::Size: |
| 108 | return "Size"; |
| 109 | case InventoryOptionalField::LastModifiedDate: |
| 110 | return "LastModifiedDate"; |
| 111 | case InventoryOptionalField::StorageClass: |
| 112 | return "StorageClass"; |
| 113 | case InventoryOptionalField::ETag: |
| 114 | return "ETag"; |
| 115 | case InventoryOptionalField::IsMultipartUploaded: |
| 116 | return "IsMultipartUploaded"; |
| 117 | case InventoryOptionalField::ReplicationStatus: |
| 118 | return "ReplicationStatus"; |
| 119 | case InventoryOptionalField::EncryptionStatus: |
| 120 | return "EncryptionStatus"; |
| 121 | case InventoryOptionalField::ObjectLockRetainUntilDate: |
| 122 | return "ObjectLockRetainUntilDate"; |
| 123 | case InventoryOptionalField::ObjectLockMode: |
| 124 | return "ObjectLockMode"; |
| 125 | case InventoryOptionalField::ObjectLockLegalHoldStatus: |
| 126 | return "ObjectLockLegalHoldStatus"; |
| 127 | case InventoryOptionalField::IntelligentTieringAccessTier: |
| 128 | return "IntelligentTieringAccessTier"; |
| 129 | default: |
| 130 | EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); |
| 131 | if(overflowContainer) |
| 132 | { |
| 133 | return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); |
| 134 | } |
| 135 | |
| 136 | return {}; |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | } // namespace InventoryOptionalFieldMapper |
| 141 | } // namespace Model |
| 142 | } // namespace S3 |
| 143 | } // namespace Aws |
| 144 |