1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/events/model/ConnectionState.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 CloudWatchEvents
17   {
18     namespace Model
19     {
20       namespace ConnectionStateMapper
21       {
22 
23         static const int CREATING_HASH = HashingUtils::HashString("CREATING");
24         static const int UPDATING_HASH = HashingUtils::HashString("UPDATING");
25         static const int DELETING_HASH = HashingUtils::HashString("DELETING");
26         static const int AUTHORIZED_HASH = HashingUtils::HashString("AUTHORIZED");
27         static const int DEAUTHORIZED_HASH = HashingUtils::HashString("DEAUTHORIZED");
28         static const int AUTHORIZING_HASH = HashingUtils::HashString("AUTHORIZING");
29         static const int DEAUTHORIZING_HASH = HashingUtils::HashString("DEAUTHORIZING");
30 
31 
GetConnectionStateForName(const Aws::String & name)32         ConnectionState GetConnectionStateForName(const Aws::String& name)
33         {
34           int hashCode = HashingUtils::HashString(name.c_str());
35           if (hashCode == CREATING_HASH)
36           {
37             return ConnectionState::CREATING;
38           }
39           else if (hashCode == UPDATING_HASH)
40           {
41             return ConnectionState::UPDATING;
42           }
43           else if (hashCode == DELETING_HASH)
44           {
45             return ConnectionState::DELETING;
46           }
47           else if (hashCode == AUTHORIZED_HASH)
48           {
49             return ConnectionState::AUTHORIZED;
50           }
51           else if (hashCode == DEAUTHORIZED_HASH)
52           {
53             return ConnectionState::DEAUTHORIZED;
54           }
55           else if (hashCode == AUTHORIZING_HASH)
56           {
57             return ConnectionState::AUTHORIZING;
58           }
59           else if (hashCode == DEAUTHORIZING_HASH)
60           {
61             return ConnectionState::DEAUTHORIZING;
62           }
63           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
64           if(overflowContainer)
65           {
66             overflowContainer->StoreOverflow(hashCode, name);
67             return static_cast<ConnectionState>(hashCode);
68           }
69 
70           return ConnectionState::NOT_SET;
71         }
72 
GetNameForConnectionState(ConnectionState enumValue)73         Aws::String GetNameForConnectionState(ConnectionState enumValue)
74         {
75           switch(enumValue)
76           {
77           case ConnectionState::CREATING:
78             return "CREATING";
79           case ConnectionState::UPDATING:
80             return "UPDATING";
81           case ConnectionState::DELETING:
82             return "DELETING";
83           case ConnectionState::AUTHORIZED:
84             return "AUTHORIZED";
85           case ConnectionState::DEAUTHORIZED:
86             return "DEAUTHORIZED";
87           case ConnectionState::AUTHORIZING:
88             return "AUTHORIZING";
89           case ConnectionState::DEAUTHORIZING:
90             return "DEAUTHORIZING";
91           default:
92             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
93             if(overflowContainer)
94             {
95               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
96             }
97 
98             return {};
99           }
100         }
101 
102       } // namespace ConnectionStateMapper
103     } // namespace Model
104   } // namespace CloudWatchEvents
105 } // namespace Aws
106