1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/ssm/model/PatchProperty.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 SSM
17   {
18     namespace Model
19     {
20       namespace PatchPropertyMapper
21       {
22 
23         static const int PRODUCT_HASH = HashingUtils::HashString("PRODUCT");
24         static const int PRODUCT_FAMILY_HASH = HashingUtils::HashString("PRODUCT_FAMILY");
25         static const int CLASSIFICATION_HASH = HashingUtils::HashString("CLASSIFICATION");
26         static const int MSRC_SEVERITY_HASH = HashingUtils::HashString("MSRC_SEVERITY");
27         static const int PRIORITY_HASH = HashingUtils::HashString("PRIORITY");
28         static const int SEVERITY_HASH = HashingUtils::HashString("SEVERITY");
29 
30 
GetPatchPropertyForName(const Aws::String & name)31         PatchProperty GetPatchPropertyForName(const Aws::String& name)
32         {
33           int hashCode = HashingUtils::HashString(name.c_str());
34           if (hashCode == PRODUCT_HASH)
35           {
36             return PatchProperty::PRODUCT;
37           }
38           else if (hashCode == PRODUCT_FAMILY_HASH)
39           {
40             return PatchProperty::PRODUCT_FAMILY;
41           }
42           else if (hashCode == CLASSIFICATION_HASH)
43           {
44             return PatchProperty::CLASSIFICATION;
45           }
46           else if (hashCode == MSRC_SEVERITY_HASH)
47           {
48             return PatchProperty::MSRC_SEVERITY;
49           }
50           else if (hashCode == PRIORITY_HASH)
51           {
52             return PatchProperty::PRIORITY;
53           }
54           else if (hashCode == SEVERITY_HASH)
55           {
56             return PatchProperty::SEVERITY;
57           }
58           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
59           if(overflowContainer)
60           {
61             overflowContainer->StoreOverflow(hashCode, name);
62             return static_cast<PatchProperty>(hashCode);
63           }
64 
65           return PatchProperty::NOT_SET;
66         }
67 
GetNameForPatchProperty(PatchProperty enumValue)68         Aws::String GetNameForPatchProperty(PatchProperty enumValue)
69         {
70           switch(enumValue)
71           {
72           case PatchProperty::PRODUCT:
73             return "PRODUCT";
74           case PatchProperty::PRODUCT_FAMILY:
75             return "PRODUCT_FAMILY";
76           case PatchProperty::CLASSIFICATION:
77             return "CLASSIFICATION";
78           case PatchProperty::MSRC_SEVERITY:
79             return "MSRC_SEVERITY";
80           case PatchProperty::PRIORITY:
81             return "PRIORITY";
82           case PatchProperty::SEVERITY:
83             return "SEVERITY";
84           default:
85             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
86             if(overflowContainer)
87             {
88               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
89             }
90 
91             return {};
92           }
93         }
94 
95       } // namespace PatchPropertyMapper
96     } // namespace Model
97   } // namespace SSM
98 } // namespace Aws
99