1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/appstream/model/ImageState.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 AppStream
17   {
18     namespace Model
19     {
20       namespace ImageStateMapper
21       {
22 
23         static const int PENDING_HASH = HashingUtils::HashString("PENDING");
24         static const int AVAILABLE_HASH = HashingUtils::HashString("AVAILABLE");
25         static const int FAILED_HASH = HashingUtils::HashString("FAILED");
26         static const int COPYING_HASH = HashingUtils::HashString("COPYING");
27         static const int DELETING_HASH = HashingUtils::HashString("DELETING");
28         static const int CREATING_HASH = HashingUtils::HashString("CREATING");
29         static const int IMPORTING_HASH = HashingUtils::HashString("IMPORTING");
30 
31 
GetImageStateForName(const Aws::String & name)32         ImageState GetImageStateForName(const Aws::String& name)
33         {
34           int hashCode = HashingUtils::HashString(name.c_str());
35           if (hashCode == PENDING_HASH)
36           {
37             return ImageState::PENDING;
38           }
39           else if (hashCode == AVAILABLE_HASH)
40           {
41             return ImageState::AVAILABLE;
42           }
43           else if (hashCode == FAILED_HASH)
44           {
45             return ImageState::FAILED;
46           }
47           else if (hashCode == COPYING_HASH)
48           {
49             return ImageState::COPYING;
50           }
51           else if (hashCode == DELETING_HASH)
52           {
53             return ImageState::DELETING;
54           }
55           else if (hashCode == CREATING_HASH)
56           {
57             return ImageState::CREATING;
58           }
59           else if (hashCode == IMPORTING_HASH)
60           {
61             return ImageState::IMPORTING;
62           }
63           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
64           if(overflowContainer)
65           {
66             overflowContainer->StoreOverflow(hashCode, name);
67             return static_cast<ImageState>(hashCode);
68           }
69 
70           return ImageState::NOT_SET;
71         }
72 
GetNameForImageState(ImageState enumValue)73         Aws::String GetNameForImageState(ImageState enumValue)
74         {
75           switch(enumValue)
76           {
77           case ImageState::PENDING:
78             return "PENDING";
79           case ImageState::AVAILABLE:
80             return "AVAILABLE";
81           case ImageState::FAILED:
82             return "FAILED";
83           case ImageState::COPYING:
84             return "COPYING";
85           case ImageState::DELETING:
86             return "DELETING";
87           case ImageState::CREATING:
88             return "CREATING";
89           case ImageState::IMPORTING:
90             return "IMPORTING";
91           default:
92             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
93             if(overflowContainer)
94             {
95               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
96             }
97 
98             return {};
99           }
100         }
101 
102       } // namespace ImageStateMapper
103     } // namespace Model
104   } // namespace AppStream
105 } // namespace Aws
106