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