1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/datasync/model/TaskExecutionStatus.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 DataSync
17   {
18     namespace Model
19     {
20       namespace TaskExecutionStatusMapper
21       {
22 
23         static const int QUEUED_HASH = HashingUtils::HashString("QUEUED");
24         static const int LAUNCHING_HASH = HashingUtils::HashString("LAUNCHING");
25         static const int PREPARING_HASH = HashingUtils::HashString("PREPARING");
26         static const int TRANSFERRING_HASH = HashingUtils::HashString("TRANSFERRING");
27         static const int VERIFYING_HASH = HashingUtils::HashString("VERIFYING");
28         static const int SUCCESS_HASH = HashingUtils::HashString("SUCCESS");
29         static const int ERROR__HASH = HashingUtils::HashString("ERROR");
30 
31 
GetTaskExecutionStatusForName(const Aws::String & name)32         TaskExecutionStatus GetTaskExecutionStatusForName(const Aws::String& name)
33         {
34           int hashCode = HashingUtils::HashString(name.c_str());
35           if (hashCode == QUEUED_HASH)
36           {
37             return TaskExecutionStatus::QUEUED;
38           }
39           else if (hashCode == LAUNCHING_HASH)
40           {
41             return TaskExecutionStatus::LAUNCHING;
42           }
43           else if (hashCode == PREPARING_HASH)
44           {
45             return TaskExecutionStatus::PREPARING;
46           }
47           else if (hashCode == TRANSFERRING_HASH)
48           {
49             return TaskExecutionStatus::TRANSFERRING;
50           }
51           else if (hashCode == VERIFYING_HASH)
52           {
53             return TaskExecutionStatus::VERIFYING;
54           }
55           else if (hashCode == SUCCESS_HASH)
56           {
57             return TaskExecutionStatus::SUCCESS;
58           }
59           else if (hashCode == ERROR__HASH)
60           {
61             return TaskExecutionStatus::ERROR_;
62           }
63           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
64           if(overflowContainer)
65           {
66             overflowContainer->StoreOverflow(hashCode, name);
67             return static_cast<TaskExecutionStatus>(hashCode);
68           }
69 
70           return TaskExecutionStatus::NOT_SET;
71         }
72 
GetNameForTaskExecutionStatus(TaskExecutionStatus enumValue)73         Aws::String GetNameForTaskExecutionStatus(TaskExecutionStatus enumValue)
74         {
75           switch(enumValue)
76           {
77           case TaskExecutionStatus::QUEUED:
78             return "QUEUED";
79           case TaskExecutionStatus::LAUNCHING:
80             return "LAUNCHING";
81           case TaskExecutionStatus::PREPARING:
82             return "PREPARING";
83           case TaskExecutionStatus::TRANSFERRING:
84             return "TRANSFERRING";
85           case TaskExecutionStatus::VERIFYING:
86             return "VERIFYING";
87           case TaskExecutionStatus::SUCCESS:
88             return "SUCCESS";
89           case TaskExecutionStatus::ERROR_:
90             return "ERROR";
91           default:
92             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
93             if(overflowContainer)
94             {
95               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
96             }
97 
98             return {};
99           }
100         }
101 
102       } // namespace TaskExecutionStatusMapper
103     } // namespace Model
104   } // namespace DataSync
105 } // namespace Aws
106