1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/cloudformation/model/ExecutionStatus.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 CloudFormation
17   {
18     namespace Model
19     {
20       namespace ExecutionStatusMapper
21       {
22 
23         static const int UNAVAILABLE_HASH = HashingUtils::HashString("UNAVAILABLE");
24         static const int AVAILABLE_HASH = HashingUtils::HashString("AVAILABLE");
25         static const int EXECUTE_IN_PROGRESS_HASH = HashingUtils::HashString("EXECUTE_IN_PROGRESS");
26         static const int EXECUTE_COMPLETE_HASH = HashingUtils::HashString("EXECUTE_COMPLETE");
27         static const int EXECUTE_FAILED_HASH = HashingUtils::HashString("EXECUTE_FAILED");
28         static const int OBSOLETE_HASH = HashingUtils::HashString("OBSOLETE");
29 
30 
GetExecutionStatusForName(const Aws::String & name)31         ExecutionStatus GetExecutionStatusForName(const Aws::String& name)
32         {
33           int hashCode = HashingUtils::HashString(name.c_str());
34           if (hashCode == UNAVAILABLE_HASH)
35           {
36             return ExecutionStatus::UNAVAILABLE;
37           }
38           else if (hashCode == AVAILABLE_HASH)
39           {
40             return ExecutionStatus::AVAILABLE;
41           }
42           else if (hashCode == EXECUTE_IN_PROGRESS_HASH)
43           {
44             return ExecutionStatus::EXECUTE_IN_PROGRESS;
45           }
46           else if (hashCode == EXECUTE_COMPLETE_HASH)
47           {
48             return ExecutionStatus::EXECUTE_COMPLETE;
49           }
50           else if (hashCode == EXECUTE_FAILED_HASH)
51           {
52             return ExecutionStatus::EXECUTE_FAILED;
53           }
54           else if (hashCode == OBSOLETE_HASH)
55           {
56             return ExecutionStatus::OBSOLETE;
57           }
58           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
59           if(overflowContainer)
60           {
61             overflowContainer->StoreOverflow(hashCode, name);
62             return static_cast<ExecutionStatus>(hashCode);
63           }
64 
65           return ExecutionStatus::NOT_SET;
66         }
67 
GetNameForExecutionStatus(ExecutionStatus enumValue)68         Aws::String GetNameForExecutionStatus(ExecutionStatus enumValue)
69         {
70           switch(enumValue)
71           {
72           case ExecutionStatus::UNAVAILABLE:
73             return "UNAVAILABLE";
74           case ExecutionStatus::AVAILABLE:
75             return "AVAILABLE";
76           case ExecutionStatus::EXECUTE_IN_PROGRESS:
77             return "EXECUTE_IN_PROGRESS";
78           case ExecutionStatus::EXECUTE_COMPLETE:
79             return "EXECUTE_COMPLETE";
80           case ExecutionStatus::EXECUTE_FAILED:
81             return "EXECUTE_FAILED";
82           case ExecutionStatus::OBSOLETE:
83             return "OBSOLETE";
84           default:
85             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
86             if(overflowContainer)
87             {
88               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
89             }
90 
91             return {};
92           }
93         }
94 
95       } // namespace ExecutionStatusMapper
96     } // namespace Model
97   } // namespace CloudFormation
98 } // namespace Aws
99