1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/sagemaker/model/AlgorithmStatus.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 SageMaker
17   {
18     namespace Model
19     {
20       namespace AlgorithmStatusMapper
21       {
22 
23         static const int Pending_HASH = HashingUtils::HashString("Pending");
24         static const int InProgress_HASH = HashingUtils::HashString("InProgress");
25         static const int Completed_HASH = HashingUtils::HashString("Completed");
26         static const int Failed_HASH = HashingUtils::HashString("Failed");
27         static const int Deleting_HASH = HashingUtils::HashString("Deleting");
28 
29 
GetAlgorithmStatusForName(const Aws::String & name)30         AlgorithmStatus GetAlgorithmStatusForName(const Aws::String& name)
31         {
32           int hashCode = HashingUtils::HashString(name.c_str());
33           if (hashCode == Pending_HASH)
34           {
35             return AlgorithmStatus::Pending;
36           }
37           else if (hashCode == InProgress_HASH)
38           {
39             return AlgorithmStatus::InProgress;
40           }
41           else if (hashCode == Completed_HASH)
42           {
43             return AlgorithmStatus::Completed;
44           }
45           else if (hashCode == Failed_HASH)
46           {
47             return AlgorithmStatus::Failed;
48           }
49           else if (hashCode == Deleting_HASH)
50           {
51             return AlgorithmStatus::Deleting;
52           }
53           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
54           if(overflowContainer)
55           {
56             overflowContainer->StoreOverflow(hashCode, name);
57             return static_cast<AlgorithmStatus>(hashCode);
58           }
59 
60           return AlgorithmStatus::NOT_SET;
61         }
62 
GetNameForAlgorithmStatus(AlgorithmStatus enumValue)63         Aws::String GetNameForAlgorithmStatus(AlgorithmStatus enumValue)
64         {
65           switch(enumValue)
66           {
67           case AlgorithmStatus::Pending:
68             return "Pending";
69           case AlgorithmStatus::InProgress:
70             return "InProgress";
71           case AlgorithmStatus::Completed:
72             return "Completed";
73           case AlgorithmStatus::Failed:
74             return "Failed";
75           case AlgorithmStatus::Deleting:
76             return "Deleting";
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 AlgorithmStatusMapper
89     } // namespace Model
90   } // namespace SageMaker
91 } // namespace Aws
92