ObjectLockLegalHoldStatus.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. * SPDX-License-Identifier: Apache-2.0.
  4. */
  5. #include <aws/s3/model/ObjectLockLegalHoldStatus.h>
  6. #include <aws/core/utils/HashingUtils.h>
  7. #include <aws/core/Globals.h>
  8. #include <aws/core/utils/EnumParseOverflowContainer.h>
  9. using namespace Aws::Utils;
  10. namespace Aws
  11. {
  12. namespace S3
  13. {
  14. namespace Model
  15. {
  16. namespace ObjectLockLegalHoldStatusMapper
  17. {
  18. static const int ON_HASH = HashingUtils::HashString("ON");
  19. static const int OFF_HASH = HashingUtils::HashString("OFF");
  20. ObjectLockLegalHoldStatus GetObjectLockLegalHoldStatusForName(const Aws::String& name)
  21. {
  22. int hashCode = HashingUtils::HashString(name.c_str());
  23. if (hashCode == ON_HASH)
  24. {
  25. return ObjectLockLegalHoldStatus::ON;
  26. }
  27. else if (hashCode == OFF_HASH)
  28. {
  29. return ObjectLockLegalHoldStatus::OFF;
  30. }
  31. EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
  32. if(overflowContainer)
  33. {
  34. overflowContainer->StoreOverflow(hashCode, name);
  35. return static_cast<ObjectLockLegalHoldStatus>(hashCode);
  36. }
  37. return ObjectLockLegalHoldStatus::NOT_SET;
  38. }
  39. Aws::String GetNameForObjectLockLegalHoldStatus(ObjectLockLegalHoldStatus enumValue)
  40. {
  41. switch(enumValue)
  42. {
  43. case ObjectLockLegalHoldStatus::ON:
  44. return "ON";
  45. case ObjectLockLegalHoldStatus::OFF:
  46. return "OFF";
  47. default:
  48. EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
  49. if(overflowContainer)
  50. {
  51. return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
  52. }
  53. return {};
  54. }
  55. }
  56. } // namespace ObjectLockLegalHoldStatusMapper
  57. } // namespace Model
  58. } // namespace S3
  59. } // namespace Aws