1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/synthetics/model/VpcConfigInput.h> 7 #include <aws/core/utils/json/JsonSerializer.h> 8 9 #include <utility> 10 11 using namespace Aws::Utils::Json; 12 using namespace Aws::Utils; 13 14 namespace Aws 15 { 16 namespace Synthetics 17 { 18 namespace Model 19 { 20 VpcConfigInput()21VpcConfigInput::VpcConfigInput() : 22 m_subnetIdsHasBeenSet(false), 23 m_securityGroupIdsHasBeenSet(false) 24 { 25 } 26 VpcConfigInput(JsonView jsonValue)27VpcConfigInput::VpcConfigInput(JsonView jsonValue) : 28 m_subnetIdsHasBeenSet(false), 29 m_securityGroupIdsHasBeenSet(false) 30 { 31 *this = jsonValue; 32 } 33 operator =(JsonView jsonValue)34VpcConfigInput& VpcConfigInput::operator =(JsonView jsonValue) 35 { 36 if(jsonValue.ValueExists("SubnetIds")) 37 { 38 Array<JsonView> subnetIdsJsonList = jsonValue.GetArray("SubnetIds"); 39 for(unsigned subnetIdsIndex = 0; subnetIdsIndex < subnetIdsJsonList.GetLength(); ++subnetIdsIndex) 40 { 41 m_subnetIds.push_back(subnetIdsJsonList[subnetIdsIndex].AsString()); 42 } 43 m_subnetIdsHasBeenSet = true; 44 } 45 46 if(jsonValue.ValueExists("SecurityGroupIds")) 47 { 48 Array<JsonView> securityGroupIdsJsonList = jsonValue.GetArray("SecurityGroupIds"); 49 for(unsigned securityGroupIdsIndex = 0; securityGroupIdsIndex < securityGroupIdsJsonList.GetLength(); ++securityGroupIdsIndex) 50 { 51 m_securityGroupIds.push_back(securityGroupIdsJsonList[securityGroupIdsIndex].AsString()); 52 } 53 m_securityGroupIdsHasBeenSet = true; 54 } 55 56 return *this; 57 } 58 Jsonize() const59JsonValue VpcConfigInput::Jsonize() const 60 { 61 JsonValue payload; 62 63 if(m_subnetIdsHasBeenSet) 64 { 65 Array<JsonValue> subnetIdsJsonList(m_subnetIds.size()); 66 for(unsigned subnetIdsIndex = 0; subnetIdsIndex < subnetIdsJsonList.GetLength(); ++subnetIdsIndex) 67 { 68 subnetIdsJsonList[subnetIdsIndex].AsString(m_subnetIds[subnetIdsIndex]); 69 } 70 payload.WithArray("SubnetIds", std::move(subnetIdsJsonList)); 71 72 } 73 74 if(m_securityGroupIdsHasBeenSet) 75 { 76 Array<JsonValue> securityGroupIdsJsonList(m_securityGroupIds.size()); 77 for(unsigned securityGroupIdsIndex = 0; securityGroupIdsIndex < securityGroupIdsJsonList.GetLength(); ++securityGroupIdsIndex) 78 { 79 securityGroupIdsJsonList[securityGroupIdsIndex].AsString(m_securityGroupIds[securityGroupIdsIndex]); 80 } 81 payload.WithArray("SecurityGroupIds", std::move(securityGroupIdsJsonList)); 82 83 } 84 85 return payload; 86 } 87 88 } // namespace Model 89 } // namespace Synthetics 90 } // namespace Aws 91