1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/apigateway/model/EndpointType.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 APIGateway
17   {
18     namespace Model
19     {
20       namespace EndpointTypeMapper
21       {
22 
23         static const int REGIONAL_HASH = HashingUtils::HashString("REGIONAL");
24         static const int EDGE_HASH = HashingUtils::HashString("EDGE");
25         static const int PRIVATE__HASH = HashingUtils::HashString("PRIVATE");
26 
27 
GetEndpointTypeForName(const Aws::String & name)28         EndpointType GetEndpointTypeForName(const Aws::String& name)
29         {
30           int hashCode = HashingUtils::HashString(name.c_str());
31           if (hashCode == REGIONAL_HASH)
32           {
33             return EndpointType::REGIONAL;
34           }
35           else if (hashCode == EDGE_HASH)
36           {
37             return EndpointType::EDGE;
38           }
39           else if (hashCode == PRIVATE__HASH)
40           {
41             return EndpointType::PRIVATE_;
42           }
43           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
44           if(overflowContainer)
45           {
46             overflowContainer->StoreOverflow(hashCode, name);
47             return static_cast<EndpointType>(hashCode);
48           }
49 
50           return EndpointType::NOT_SET;
51         }
52 
GetNameForEndpointType(EndpointType enumValue)53         Aws::String GetNameForEndpointType(EndpointType enumValue)
54         {
55           switch(enumValue)
56           {
57           case EndpointType::REGIONAL:
58             return "REGIONAL";
59           case EndpointType::EDGE:
60             return "EDGE";
61           case EndpointType::PRIVATE_:
62             return "PRIVATE";
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 EndpointTypeMapper
75     } // namespace Model
76   } // namespace APIGateway
77 } // namespace Aws
78