1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/route53/model/HealthCheckRegion.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 Route53 17 { 18 namespace Model 19 { 20 namespace HealthCheckRegionMapper 21 { 22 23 static const int us_east_1_HASH = HashingUtils::HashString("us-east-1"); 24 static const int us_west_1_HASH = HashingUtils::HashString("us-west-1"); 25 static const int us_west_2_HASH = HashingUtils::HashString("us-west-2"); 26 static const int eu_west_1_HASH = HashingUtils::HashString("eu-west-1"); 27 static const int ap_southeast_1_HASH = HashingUtils::HashString("ap-southeast-1"); 28 static const int ap_southeast_2_HASH = HashingUtils::HashString("ap-southeast-2"); 29 static const int ap_northeast_1_HASH = HashingUtils::HashString("ap-northeast-1"); 30 static const int sa_east_1_HASH = HashingUtils::HashString("sa-east-1"); 31 32 GetHealthCheckRegionForName(const Aws::String & name)33 HealthCheckRegion GetHealthCheckRegionForName(const Aws::String& name) 34 { 35 int hashCode = HashingUtils::HashString(name.c_str()); 36 if (hashCode == us_east_1_HASH) 37 { 38 return HealthCheckRegion::us_east_1; 39 } 40 else if (hashCode == us_west_1_HASH) 41 { 42 return HealthCheckRegion::us_west_1; 43 } 44 else if (hashCode == us_west_2_HASH) 45 { 46 return HealthCheckRegion::us_west_2; 47 } 48 else if (hashCode == eu_west_1_HASH) 49 { 50 return HealthCheckRegion::eu_west_1; 51 } 52 else if (hashCode == ap_southeast_1_HASH) 53 { 54 return HealthCheckRegion::ap_southeast_1; 55 } 56 else if (hashCode == ap_southeast_2_HASH) 57 { 58 return HealthCheckRegion::ap_southeast_2; 59 } 60 else if (hashCode == ap_northeast_1_HASH) 61 { 62 return HealthCheckRegion::ap_northeast_1; 63 } 64 else if (hashCode == sa_east_1_HASH) 65 { 66 return HealthCheckRegion::sa_east_1; 67 } 68 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 69 if(overflowContainer) 70 { 71 overflowContainer->StoreOverflow(hashCode, name); 72 return static_cast<HealthCheckRegion>(hashCode); 73 } 74 75 return HealthCheckRegion::NOT_SET; 76 } 77 GetNameForHealthCheckRegion(HealthCheckRegion enumValue)78 Aws::String GetNameForHealthCheckRegion(HealthCheckRegion enumValue) 79 { 80 switch(enumValue) 81 { 82 case HealthCheckRegion::us_east_1: 83 return "us-east-1"; 84 case HealthCheckRegion::us_west_1: 85 return "us-west-1"; 86 case HealthCheckRegion::us_west_2: 87 return "us-west-2"; 88 case HealthCheckRegion::eu_west_1: 89 return "eu-west-1"; 90 case HealthCheckRegion::ap_southeast_1: 91 return "ap-southeast-1"; 92 case HealthCheckRegion::ap_southeast_2: 93 return "ap-southeast-2"; 94 case HealthCheckRegion::ap_northeast_1: 95 return "ap-northeast-1"; 96 case HealthCheckRegion::sa_east_1: 97 return "sa-east-1"; 98 default: 99 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 100 if(overflowContainer) 101 { 102 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 103 } 104 105 return {}; 106 } 107 } 108 109 } // namespace HealthCheckRegionMapper 110 } // namespace Model 111 } // namespace Route53 112 } // namespace Aws 113