1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/glue/model/LastCrawlStatus.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 Glue
17   {
18     namespace Model
19     {
20       namespace LastCrawlStatusMapper
21       {
22 
23         static const int SUCCEEDED_HASH = HashingUtils::HashString("SUCCEEDED");
24         static const int CANCELLED_HASH = HashingUtils::HashString("CANCELLED");
25         static const int FAILED_HASH = HashingUtils::HashString("FAILED");
26 
27 
GetLastCrawlStatusForName(const Aws::String & name)28         LastCrawlStatus GetLastCrawlStatusForName(const Aws::String& name)
29         {
30           int hashCode = HashingUtils::HashString(name.c_str());
31           if (hashCode == SUCCEEDED_HASH)
32           {
33             return LastCrawlStatus::SUCCEEDED;
34           }
35           else if (hashCode == CANCELLED_HASH)
36           {
37             return LastCrawlStatus::CANCELLED;
38           }
39           else if (hashCode == FAILED_HASH)
40           {
41             return LastCrawlStatus::FAILED;
42           }
43           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
44           if(overflowContainer)
45           {
46             overflowContainer->StoreOverflow(hashCode, name);
47             return static_cast<LastCrawlStatus>(hashCode);
48           }
49 
50           return LastCrawlStatus::NOT_SET;
51         }
52 
GetNameForLastCrawlStatus(LastCrawlStatus enumValue)53         Aws::String GetNameForLastCrawlStatus(LastCrawlStatus enumValue)
54         {
55           switch(enumValue)
56           {
57           case LastCrawlStatus::SUCCEEDED:
58             return "SUCCEEDED";
59           case LastCrawlStatus::CANCELLED:
60             return "CANCELLED";
61           case LastCrawlStatus::FAILED:
62             return "FAILED";
63           default:
64             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
65             if(overflowContainer)
66             {
67               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
68             }
69 
70             return {};
71           }
72         }
73 
74       } // namespace LastCrawlStatusMapper
75     } // namespace Model
76   } // namespace Glue
77 } // namespace Aws
78