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/RecrawlBehavior.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 RecrawlBehaviorMapper 21 { 22 23 static const int CRAWL_EVERYTHING_HASH = HashingUtils::HashString("CRAWL_EVERYTHING"); 24 static const int CRAWL_NEW_FOLDERS_ONLY_HASH = HashingUtils::HashString("CRAWL_NEW_FOLDERS_ONLY"); 25 static const int CRAWL_EVENT_MODE_HASH = HashingUtils::HashString("CRAWL_EVENT_MODE"); 26 27 GetRecrawlBehaviorForName(const Aws::String & name)28 RecrawlBehavior GetRecrawlBehaviorForName(const Aws::String& name) 29 { 30 int hashCode = HashingUtils::HashString(name.c_str()); 31 if (hashCode == CRAWL_EVERYTHING_HASH) 32 { 33 return RecrawlBehavior::CRAWL_EVERYTHING; 34 } 35 else if (hashCode == CRAWL_NEW_FOLDERS_ONLY_HASH) 36 { 37 return RecrawlBehavior::CRAWL_NEW_FOLDERS_ONLY; 38 } 39 else if (hashCode == CRAWL_EVENT_MODE_HASH) 40 { 41 return RecrawlBehavior::CRAWL_EVENT_MODE; 42 } 43 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 44 if(overflowContainer) 45 { 46 overflowContainer->StoreOverflow(hashCode, name); 47 return static_cast<RecrawlBehavior>(hashCode); 48 } 49 50 return RecrawlBehavior::NOT_SET; 51 } 52 GetNameForRecrawlBehavior(RecrawlBehavior enumValue)53 Aws::String GetNameForRecrawlBehavior(RecrawlBehavior enumValue) 54 { 55 switch(enumValue) 56 { 57 case RecrawlBehavior::CRAWL_EVERYTHING: 58 return "CRAWL_EVERYTHING"; 59 case RecrawlBehavior::CRAWL_NEW_FOLDERS_ONLY: 60 return "CRAWL_NEW_FOLDERS_ONLY"; 61 case RecrawlBehavior::CRAWL_EVENT_MODE: 62 return "CRAWL_EVENT_MODE"; 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 RecrawlBehaviorMapper 75 } // namespace Model 76 } // namespace Glue 77 } // namespace Aws 78