1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/ec2/model/InstanceEventWindowState.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 EC2
17   {
18     namespace Model
19     {
20       namespace InstanceEventWindowStateMapper
21       {
22 
23         static const int creating_HASH = HashingUtils::HashString("creating");
24         static const int deleting_HASH = HashingUtils::HashString("deleting");
25         static const int active_HASH = HashingUtils::HashString("active");
26         static const int deleted_HASH = HashingUtils::HashString("deleted");
27 
28 
GetInstanceEventWindowStateForName(const Aws::String & name)29         InstanceEventWindowState GetInstanceEventWindowStateForName(const Aws::String& name)
30         {
31           int hashCode = HashingUtils::HashString(name.c_str());
32           if (hashCode == creating_HASH)
33           {
34             return InstanceEventWindowState::creating;
35           }
36           else if (hashCode == deleting_HASH)
37           {
38             return InstanceEventWindowState::deleting;
39           }
40           else if (hashCode == active_HASH)
41           {
42             return InstanceEventWindowState::active;
43           }
44           else if (hashCode == deleted_HASH)
45           {
46             return InstanceEventWindowState::deleted;
47           }
48           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
49           if(overflowContainer)
50           {
51             overflowContainer->StoreOverflow(hashCode, name);
52             return static_cast<InstanceEventWindowState>(hashCode);
53           }
54 
55           return InstanceEventWindowState::NOT_SET;
56         }
57 
GetNameForInstanceEventWindowState(InstanceEventWindowState enumValue)58         Aws::String GetNameForInstanceEventWindowState(InstanceEventWindowState enumValue)
59         {
60           switch(enumValue)
61           {
62           case InstanceEventWindowState::creating:
63             return "creating";
64           case InstanceEventWindowState::deleting:
65             return "deleting";
66           case InstanceEventWindowState::active:
67             return "active";
68           case InstanceEventWindowState::deleted:
69             return "deleted";
70           default:
71             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
72             if(overflowContainer)
73             {
74               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
75             }
76 
77             return {};
78           }
79         }
80 
81       } // namespace InstanceEventWindowStateMapper
82     } // namespace Model
83   } // namespace EC2
84 } // namespace Aws
85