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