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/Tier.h>
17#include <aws/core/utils/HashingUtils.h>
18#include <aws/core/Globals.h>
19#include <aws/core/utils/EnumParseOverflowContainer.h>
20
21using namespace Aws::Utils;
22
23
24namespace Aws
25{
26 namespace S3
27 {
28 namespace Model
29 {
30 namespace TierMapper
31 {
32
33 static const int Standard_HASH = HashingUtils::HashString("Standard");
34 static const int Bulk_HASH = HashingUtils::HashString("Bulk");
35 static const int Expedited_HASH = HashingUtils::HashString("Expedited");
36
37
38 Tier GetTierForName(const Aws::String& name)
39 {
40 int hashCode = HashingUtils::HashString(name.c_str());
41 if (hashCode == Standard_HASH)
42 {
43 return Tier::Standard;
44 }
45 else if (hashCode == Bulk_HASH)
46 {
47 return Tier::Bulk;
48 }
49 else if (hashCode == Expedited_HASH)
50 {
51 return Tier::Expedited;
52 }
53 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
54 if(overflowContainer)
55 {
56 overflowContainer->StoreOverflow(hashCode, name);
57 return static_cast<Tier>(hashCode);
58 }
59
60 return Tier::NOT_SET;
61 }
62
63 Aws::String GetNameForTier(Tier enumValue)
64 {
65 switch(enumValue)
66 {
67 case Tier::Standard:
68 return "Standard";
69 case Tier::Bulk:
70 return "Bulk";
71 case Tier::Expedited:
72 return "Expedited";
73 default:
74 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
75 if(overflowContainer)
76 {
77 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
78 }
79
80 return {};
81 }
82 }
83
84 } // namespace TierMapper
85 } // namespace Model
86 } // namespace S3
87} // namespace Aws
88