/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include using namespace Aws::Utils; namespace Aws { namespace Greengrass { namespace Model { namespace PermissionMapper { static const int ro_HASH = HashingUtils::HashString("ro"); static const int rw_HASH = HashingUtils::HashString("rw"); Permission GetPermissionForName(const Aws::String& name) { int hashCode = HashingUtils::HashString(name.c_str()); if (hashCode == ro_HASH) { return Permission::ro; } else if (hashCode == rw_HASH) { return Permission::rw; } EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { overflowContainer->StoreOverflow(hashCode, name); return static_cast(hashCode); } return Permission::NOT_SET; } Aws::String GetNameForPermission(Permission enumValue) { switch(enumValue) { case Permission::ro: return "ro"; case Permission::rw: return "rw"; default: EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { return overflowContainer->RetrieveOverflow(static_cast(enumValue)); } return {}; } } } // namespace PermissionMapper } // namespace Model } // namespace Greengrass } // namespace Aws