/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace imagebuilder { namespace Model { LaunchPermissionConfiguration::LaunchPermissionConfiguration() : m_userIdsHasBeenSet(false), m_userGroupsHasBeenSet(false) { } LaunchPermissionConfiguration::LaunchPermissionConfiguration(JsonView jsonValue) : m_userIdsHasBeenSet(false), m_userGroupsHasBeenSet(false) { *this = jsonValue; } LaunchPermissionConfiguration& LaunchPermissionConfiguration::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("userIds")) { Array userIdsJsonList = jsonValue.GetArray("userIds"); for(unsigned userIdsIndex = 0; userIdsIndex < userIdsJsonList.GetLength(); ++userIdsIndex) { m_userIds.push_back(userIdsJsonList[userIdsIndex].AsString()); } m_userIdsHasBeenSet = true; } if(jsonValue.ValueExists("userGroups")) { Array userGroupsJsonList = jsonValue.GetArray("userGroups"); for(unsigned userGroupsIndex = 0; userGroupsIndex < userGroupsJsonList.GetLength(); ++userGroupsIndex) { m_userGroups.push_back(userGroupsJsonList[userGroupsIndex].AsString()); } m_userGroupsHasBeenSet = true; } return *this; } JsonValue LaunchPermissionConfiguration::Jsonize() const { JsonValue payload; if(m_userIdsHasBeenSet) { Array userIdsJsonList(m_userIds.size()); for(unsigned userIdsIndex = 0; userIdsIndex < userIdsJsonList.GetLength(); ++userIdsIndex) { userIdsJsonList[userIdsIndex].AsString(m_userIds[userIdsIndex]); } payload.WithArray("userIds", std::move(userIdsJsonList)); } if(m_userGroupsHasBeenSet) { Array userGroupsJsonList(m_userGroups.size()); for(unsigned userGroupsIndex = 0; userGroupsIndex < userGroupsJsonList.GetLength(); ++userGroupsIndex) { userGroupsJsonList[userGroupsIndex].AsString(m_userGroups[userGroupsIndex]); } payload.WithArray("userGroups", std::move(userGroupsJsonList)); } return payload; } } // namespace Model } // namespace imagebuilder } // namespace Aws