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