1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/route53domains/model/OperationStatus.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 Route53Domains
17   {
18     namespace Model
19     {
20       namespace OperationStatusMapper
21       {
22 
23         static const int SUBMITTED_HASH = HashingUtils::HashString("SUBMITTED");
24         static const int IN_PROGRESS_HASH = HashingUtils::HashString("IN_PROGRESS");
25         static const int ERROR__HASH = HashingUtils::HashString("ERROR");
26         static const int SUCCESSFUL_HASH = HashingUtils::HashString("SUCCESSFUL");
27         static const int FAILED_HASH = HashingUtils::HashString("FAILED");
28 
29 
GetOperationStatusForName(const Aws::String & name)30         OperationStatus GetOperationStatusForName(const Aws::String& name)
31         {
32           int hashCode = HashingUtils::HashString(name.c_str());
33           if (hashCode == SUBMITTED_HASH)
34           {
35             return OperationStatus::SUBMITTED;
36           }
37           else if (hashCode == IN_PROGRESS_HASH)
38           {
39             return OperationStatus::IN_PROGRESS;
40           }
41           else if (hashCode == ERROR__HASH)
42           {
43             return OperationStatus::ERROR_;
44           }
45           else if (hashCode == SUCCESSFUL_HASH)
46           {
47             return OperationStatus::SUCCESSFUL;
48           }
49           else if (hashCode == FAILED_HASH)
50           {
51             return OperationStatus::FAILED;
52           }
53           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
54           if(overflowContainer)
55           {
56             overflowContainer->StoreOverflow(hashCode, name);
57             return static_cast<OperationStatus>(hashCode);
58           }
59 
60           return OperationStatus::NOT_SET;
61         }
62 
GetNameForOperationStatus(OperationStatus enumValue)63         Aws::String GetNameForOperationStatus(OperationStatus enumValue)
64         {
65           switch(enumValue)
66           {
67           case OperationStatus::SUBMITTED:
68             return "SUBMITTED";
69           case OperationStatus::IN_PROGRESS:
70             return "IN_PROGRESS";
71           case OperationStatus::ERROR_:
72             return "ERROR";
73           case OperationStatus::SUCCESSFUL:
74             return "SUCCESSFUL";
75           case OperationStatus::FAILED:
76             return "FAILED";
77           default:
78             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
79             if(overflowContainer)
80             {
81               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
82             }
83 
84             return {};
85           }
86         }
87 
88       } // namespace OperationStatusMapper
89     } // namespace Model
90   } // namespace Route53Domains
91 } // namespace Aws
92