This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pxz-hos-client-cpp-module/support/aws-sdk-cpp-master/aws-cpp-sdk-ecs/source/model/CreateServiceRequest.cpp

217 lines
6.2 KiB
C++
Raw Normal View History

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/ecs/model/CreateServiceRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::ECS::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
CreateServiceRequest::CreateServiceRequest() :
m_clusterHasBeenSet(false),
m_serviceNameHasBeenSet(false),
m_taskDefinitionHasBeenSet(false),
m_loadBalancersHasBeenSet(false),
m_serviceRegistriesHasBeenSet(false),
m_desiredCount(0),
m_desiredCountHasBeenSet(false),
m_clientTokenHasBeenSet(false),
m_launchType(LaunchType::NOT_SET),
m_launchTypeHasBeenSet(false),
m_capacityProviderStrategyHasBeenSet(false),
m_platformVersionHasBeenSet(false),
m_roleHasBeenSet(false),
m_deploymentConfigurationHasBeenSet(false),
m_placementConstraintsHasBeenSet(false),
m_placementStrategyHasBeenSet(false),
m_networkConfigurationHasBeenSet(false),
m_healthCheckGracePeriodSeconds(0),
m_healthCheckGracePeriodSecondsHasBeenSet(false),
m_schedulingStrategy(SchedulingStrategy::NOT_SET),
m_schedulingStrategyHasBeenSet(false),
m_deploymentControllerHasBeenSet(false),
m_tagsHasBeenSet(false),
m_enableECSManagedTags(false),
m_enableECSManagedTagsHasBeenSet(false),
m_propagateTags(PropagateTags::NOT_SET),
m_propagateTagsHasBeenSet(false)
{
}
Aws::String CreateServiceRequest::SerializePayload() const
{
JsonValue payload;
if(m_clusterHasBeenSet)
{
payload.WithString("cluster", m_cluster);
}
if(m_serviceNameHasBeenSet)
{
payload.WithString("serviceName", m_serviceName);
}
if(m_taskDefinitionHasBeenSet)
{
payload.WithString("taskDefinition", m_taskDefinition);
}
if(m_loadBalancersHasBeenSet)
{
Array<JsonValue> loadBalancersJsonList(m_loadBalancers.size());
for(unsigned loadBalancersIndex = 0; loadBalancersIndex < loadBalancersJsonList.GetLength(); ++loadBalancersIndex)
{
loadBalancersJsonList[loadBalancersIndex].AsObject(m_loadBalancers[loadBalancersIndex].Jsonize());
}
payload.WithArray("loadBalancers", std::move(loadBalancersJsonList));
}
if(m_serviceRegistriesHasBeenSet)
{
Array<JsonValue> serviceRegistriesJsonList(m_serviceRegistries.size());
for(unsigned serviceRegistriesIndex = 0; serviceRegistriesIndex < serviceRegistriesJsonList.GetLength(); ++serviceRegistriesIndex)
{
serviceRegistriesJsonList[serviceRegistriesIndex].AsObject(m_serviceRegistries[serviceRegistriesIndex].Jsonize());
}
payload.WithArray("serviceRegistries", std::move(serviceRegistriesJsonList));
}
if(m_desiredCountHasBeenSet)
{
payload.WithInteger("desiredCount", m_desiredCount);
}
if(m_clientTokenHasBeenSet)
{
payload.WithString("clientToken", m_clientToken);
}
if(m_launchTypeHasBeenSet)
{
payload.WithString("launchType", LaunchTypeMapper::GetNameForLaunchType(m_launchType));
}
if(m_capacityProviderStrategyHasBeenSet)
{
Array<JsonValue> capacityProviderStrategyJsonList(m_capacityProviderStrategy.size());
for(unsigned capacityProviderStrategyIndex = 0; capacityProviderStrategyIndex < capacityProviderStrategyJsonList.GetLength(); ++capacityProviderStrategyIndex)
{
capacityProviderStrategyJsonList[capacityProviderStrategyIndex].AsObject(m_capacityProviderStrategy[capacityProviderStrategyIndex].Jsonize());
}
payload.WithArray("capacityProviderStrategy", std::move(capacityProviderStrategyJsonList));
}
if(m_platformVersionHasBeenSet)
{
payload.WithString("platformVersion", m_platformVersion);
}
if(m_roleHasBeenSet)
{
payload.WithString("role", m_role);
}
if(m_deploymentConfigurationHasBeenSet)
{
payload.WithObject("deploymentConfiguration", m_deploymentConfiguration.Jsonize());
}
if(m_placementConstraintsHasBeenSet)
{
Array<JsonValue> placementConstraintsJsonList(m_placementConstraints.size());
for(unsigned placementConstraintsIndex = 0; placementConstraintsIndex < placementConstraintsJsonList.GetLength(); ++placementConstraintsIndex)
{
placementConstraintsJsonList[placementConstraintsIndex].AsObject(m_placementConstraints[placementConstraintsIndex].Jsonize());
}
payload.WithArray("placementConstraints", std::move(placementConstraintsJsonList));
}
if(m_placementStrategyHasBeenSet)
{
Array<JsonValue> placementStrategyJsonList(m_placementStrategy.size());
for(unsigned placementStrategyIndex = 0; placementStrategyIndex < placementStrategyJsonList.GetLength(); ++placementStrategyIndex)
{
placementStrategyJsonList[placementStrategyIndex].AsObject(m_placementStrategy[placementStrategyIndex].Jsonize());
}
payload.WithArray("placementStrategy", std::move(placementStrategyJsonList));
}
if(m_networkConfigurationHasBeenSet)
{
payload.WithObject("networkConfiguration", m_networkConfiguration.Jsonize());
}
if(m_healthCheckGracePeriodSecondsHasBeenSet)
{
payload.WithInteger("healthCheckGracePeriodSeconds", m_healthCheckGracePeriodSeconds);
}
if(m_schedulingStrategyHasBeenSet)
{
payload.WithString("schedulingStrategy", SchedulingStrategyMapper::GetNameForSchedulingStrategy(m_schedulingStrategy));
}
if(m_deploymentControllerHasBeenSet)
{
payload.WithObject("deploymentController", m_deploymentController.Jsonize());
}
if(m_tagsHasBeenSet)
{
Array<JsonValue> 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_enableECSManagedTagsHasBeenSet)
{
payload.WithBool("enableECSManagedTags", m_enableECSManagedTags);
}
if(m_propagateTagsHasBeenSet)
{
payload.WithString("propagateTags", PropagateTagsMapper::GetNameForPropagateTags(m_propagateTags));
}
return payload.View().WriteReadable();
}
Aws::Http::HeaderValueCollection CreateServiceRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AmazonEC2ContainerServiceV20141113.CreateService"));
return headers;
}