/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Lightsail::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; CreateInstancesRequest::CreateInstancesRequest() : m_instanceNamesHasBeenSet(false), m_availabilityZoneHasBeenSet(false), m_blueprintIdHasBeenSet(false), m_bundleIdHasBeenSet(false), m_userDataHasBeenSet(false), m_keyPairNameHasBeenSet(false), m_tagsHasBeenSet(false), m_addOnsHasBeenSet(false), m_ipAddressType(IpAddressType::NOT_SET), m_ipAddressTypeHasBeenSet(false) { } Aws::String CreateInstancesRequest::SerializePayload() const { JsonValue payload; if(m_instanceNamesHasBeenSet) { Aws::Utils::Array instanceNamesJsonList(m_instanceNames.size()); for(unsigned instanceNamesIndex = 0; instanceNamesIndex < instanceNamesJsonList.GetLength(); ++instanceNamesIndex) { instanceNamesJsonList[instanceNamesIndex].AsString(m_instanceNames[instanceNamesIndex]); } payload.WithArray("instanceNames", std::move(instanceNamesJsonList)); } if(m_availabilityZoneHasBeenSet) { payload.WithString("availabilityZone", m_availabilityZone); } if(m_blueprintIdHasBeenSet) { payload.WithString("blueprintId", m_blueprintId); } if(m_bundleIdHasBeenSet) { payload.WithString("bundleId", m_bundleId); } if(m_userDataHasBeenSet) { payload.WithString("userData", m_userData); } if(m_keyPairNameHasBeenSet) { payload.WithString("keyPairName", m_keyPairName); } if(m_tagsHasBeenSet) { Aws::Utils::Array tagsJsonList(m_tags.size()); for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex) { tagsJsonList[tagsIndex].AsObject(m_tags[tagsIndex].Jsonize()); } payload.WithArray("tags", std::move(tagsJsonList)); } if(m_addOnsHasBeenSet) { Aws::Utils::Array addOnsJsonList(m_addOns.size()); for(unsigned addOnsIndex = 0; addOnsIndex < addOnsJsonList.GetLength(); ++addOnsIndex) { addOnsJsonList[addOnsIndex].AsObject(m_addOns[addOnsIndex].Jsonize()); } payload.WithArray("addOns", std::move(addOnsJsonList)); } if(m_ipAddressTypeHasBeenSet) { payload.WithString("ipAddressType", IpAddressTypeMapper::GetNameForIpAddressType(m_ipAddressType)); } return payload.View().WriteReadable(); } Aws::Http::HeaderValueCollection CreateInstancesRequest::GetRequestSpecificHeaders() const { Aws::Http::HeaderValueCollection headers; headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "Lightsail_20161128.CreateInstances")); return headers; }