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