1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/mgn/model/FirstBoot.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 mgn
17   {
18     namespace Model
19     {
20       namespace FirstBootMapper
21       {
22 
23         static const int WAITING_HASH = HashingUtils::HashString("WAITING");
24         static const int SUCCEEDED_HASH = HashingUtils::HashString("SUCCEEDED");
25         static const int UNKNOWN_HASH = HashingUtils::HashString("UNKNOWN");
26         static const int STOPPED_HASH = HashingUtils::HashString("STOPPED");
27 
28 
GetFirstBootForName(const Aws::String & name)29         FirstBoot GetFirstBootForName(const Aws::String& name)
30         {
31           int hashCode = HashingUtils::HashString(name.c_str());
32           if (hashCode == WAITING_HASH)
33           {
34             return FirstBoot::WAITING;
35           }
36           else if (hashCode == SUCCEEDED_HASH)
37           {
38             return FirstBoot::SUCCEEDED;
39           }
40           else if (hashCode == UNKNOWN_HASH)
41           {
42             return FirstBoot::UNKNOWN;
43           }
44           else if (hashCode == STOPPED_HASH)
45           {
46             return FirstBoot::STOPPED;
47           }
48           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
49           if(overflowContainer)
50           {
51             overflowContainer->StoreOverflow(hashCode, name);
52             return static_cast<FirstBoot>(hashCode);
53           }
54 
55           return FirstBoot::NOT_SET;
56         }
57 
GetNameForFirstBoot(FirstBoot enumValue)58         Aws::String GetNameForFirstBoot(FirstBoot enumValue)
59         {
60           switch(enumValue)
61           {
62           case FirstBoot::WAITING:
63             return "WAITING";
64           case FirstBoot::SUCCEEDED:
65             return "SUCCEEDED";
66           case FirstBoot::UNKNOWN:
67             return "UNKNOWN";
68           case FirstBoot::STOPPED:
69             return "STOPPED";
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 FirstBootMapper
82     } // namespace Model
83   } // namespace mgn
84 } // namespace Aws
85