/** * 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 IoT { namespace Model { VpcDestinationProperties::VpcDestinationProperties() : m_subnetIdsHasBeenSet(false), m_securityGroupsHasBeenSet(false), m_vpcIdHasBeenSet(false), m_roleArnHasBeenSet(false) { } VpcDestinationProperties::VpcDestinationProperties(JsonView jsonValue) : m_subnetIdsHasBeenSet(false), m_securityGroupsHasBeenSet(false), m_vpcIdHasBeenSet(false), m_roleArnHasBeenSet(false) { *this = jsonValue; } VpcDestinationProperties& VpcDestinationProperties::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("subnetIds")) { Aws::Utils::Array subnetIdsJsonList = jsonValue.GetArray("subnetIds"); for(unsigned subnetIdsIndex = 0; subnetIdsIndex < subnetIdsJsonList.GetLength(); ++subnetIdsIndex) { m_subnetIds.push_back(subnetIdsJsonList[subnetIdsIndex].AsString()); } m_subnetIdsHasBeenSet = true; } if(jsonValue.ValueExists("securityGroups")) { Aws::Utils::Array securityGroupsJsonList = jsonValue.GetArray("securityGroups"); for(unsigned securityGroupsIndex = 0; securityGroupsIndex < securityGroupsJsonList.GetLength(); ++securityGroupsIndex) { m_securityGroups.push_back(securityGroupsJsonList[securityGroupsIndex].AsString()); } m_securityGroupsHasBeenSet = true; } if(jsonValue.ValueExists("vpcId")) { m_vpcId = jsonValue.GetString("vpcId"); m_vpcIdHasBeenSet = true; } if(jsonValue.ValueExists("roleArn")) { m_roleArn = jsonValue.GetString("roleArn"); m_roleArnHasBeenSet = true; } return *this; } JsonValue VpcDestinationProperties::Jsonize() const { JsonValue payload; if(m_subnetIdsHasBeenSet) { Aws::Utils::Array subnetIdsJsonList(m_subnetIds.size()); for(unsigned subnetIdsIndex = 0; subnetIdsIndex < subnetIdsJsonList.GetLength(); ++subnetIdsIndex) { subnetIdsJsonList[subnetIdsIndex].AsString(m_subnetIds[subnetIdsIndex]); } payload.WithArray("subnetIds", std::move(subnetIdsJsonList)); } if(m_securityGroupsHasBeenSet) { Aws::Utils::Array securityGroupsJsonList(m_securityGroups.size()); for(unsigned securityGroupsIndex = 0; securityGroupsIndex < securityGroupsJsonList.GetLength(); ++securityGroupsIndex) { securityGroupsJsonList[securityGroupsIndex].AsString(m_securityGroups[securityGroupsIndex]); } payload.WithArray("securityGroups", std::move(securityGroupsJsonList)); } if(m_vpcIdHasBeenSet) { payload.WithString("vpcId", m_vpcId); } if(m_roleArnHasBeenSet) { payload.WithString("roleArn", m_roleArn); } return payload; } } // namespace Model } // namespace IoT } // namespace Aws