1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/amplify/model/Stage.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 Amplify
17   {
18     namespace Model
19     {
20       namespace StageMapper
21       {
22 
23         static const int PRODUCTION_HASH = HashingUtils::HashString("PRODUCTION");
24         static const int BETA_HASH = HashingUtils::HashString("BETA");
25         static const int DEVELOPMENT_HASH = HashingUtils::HashString("DEVELOPMENT");
26         static const int EXPERIMENTAL_HASH = HashingUtils::HashString("EXPERIMENTAL");
27         static const int PULL_REQUEST_HASH = HashingUtils::HashString("PULL_REQUEST");
28 
29 
GetStageForName(const Aws::String & name)30         Stage GetStageForName(const Aws::String& name)
31         {
32           int hashCode = HashingUtils::HashString(name.c_str());
33           if (hashCode == PRODUCTION_HASH)
34           {
35             return Stage::PRODUCTION;
36           }
37           else if (hashCode == BETA_HASH)
38           {
39             return Stage::BETA;
40           }
41           else if (hashCode == DEVELOPMENT_HASH)
42           {
43             return Stage::DEVELOPMENT;
44           }
45           else if (hashCode == EXPERIMENTAL_HASH)
46           {
47             return Stage::EXPERIMENTAL;
48           }
49           else if (hashCode == PULL_REQUEST_HASH)
50           {
51             return Stage::PULL_REQUEST;
52           }
53           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
54           if(overflowContainer)
55           {
56             overflowContainer->StoreOverflow(hashCode, name);
57             return static_cast<Stage>(hashCode);
58           }
59 
60           return Stage::NOT_SET;
61         }
62 
GetNameForStage(Stage enumValue)63         Aws::String GetNameForStage(Stage enumValue)
64         {
65           switch(enumValue)
66           {
67           case Stage::PRODUCTION:
68             return "PRODUCTION";
69           case Stage::BETA:
70             return "BETA";
71           case Stage::DEVELOPMENT:
72             return "DEVELOPMENT";
73           case Stage::EXPERIMENTAL:
74             return "EXPERIMENTAL";
75           case Stage::PULL_REQUEST:
76             return "PULL_REQUEST";
77           default:
78             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
79             if(overflowContainer)
80             {
81               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
82             }
83 
84             return {};
85           }
86         }
87 
88       } // namespace StageMapper
89     } // namespace Model
90   } // namespace Amplify
91 } // namespace Aws
92