311 lines
8.9 KiB
C++
311 lines
8.9 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/ecs/model/Cluster.h>
|
|||
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|||
|
|
|
|||
|
|
#include <utility>
|
|||
|
|
|
|||
|
|
using namespace Aws::Utils::Json;
|
|||
|
|
using namespace Aws::Utils;
|
|||
|
|
|
|||
|
|
namespace Aws
|
|||
|
|
{
|
|||
|
|
namespace ECS
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Cluster::Cluster() :
|
|||
|
|
m_clusterArnHasBeenSet(false),
|
|||
|
|
m_clusterNameHasBeenSet(false),
|
|||
|
|
m_statusHasBeenSet(false),
|
|||
|
|
m_registeredContainerInstancesCount(0),
|
|||
|
|
m_registeredContainerInstancesCountHasBeenSet(false),
|
|||
|
|
m_runningTasksCount(0),
|
|||
|
|
m_runningTasksCountHasBeenSet(false),
|
|||
|
|
m_pendingTasksCount(0),
|
|||
|
|
m_pendingTasksCountHasBeenSet(false),
|
|||
|
|
m_activeServicesCount(0),
|
|||
|
|
m_activeServicesCountHasBeenSet(false),
|
|||
|
|
m_statisticsHasBeenSet(false),
|
|||
|
|
m_tagsHasBeenSet(false),
|
|||
|
|
m_settingsHasBeenSet(false),
|
|||
|
|
m_capacityProvidersHasBeenSet(false),
|
|||
|
|
m_defaultCapacityProviderStrategyHasBeenSet(false),
|
|||
|
|
m_attachmentsHasBeenSet(false),
|
|||
|
|
m_attachmentsStatusHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Cluster::Cluster(JsonView jsonValue) :
|
|||
|
|
m_clusterArnHasBeenSet(false),
|
|||
|
|
m_clusterNameHasBeenSet(false),
|
|||
|
|
m_statusHasBeenSet(false),
|
|||
|
|
m_registeredContainerInstancesCount(0),
|
|||
|
|
m_registeredContainerInstancesCountHasBeenSet(false),
|
|||
|
|
m_runningTasksCount(0),
|
|||
|
|
m_runningTasksCountHasBeenSet(false),
|
|||
|
|
m_pendingTasksCount(0),
|
|||
|
|
m_pendingTasksCountHasBeenSet(false),
|
|||
|
|
m_activeServicesCount(0),
|
|||
|
|
m_activeServicesCountHasBeenSet(false),
|
|||
|
|
m_statisticsHasBeenSet(false),
|
|||
|
|
m_tagsHasBeenSet(false),
|
|||
|
|
m_settingsHasBeenSet(false),
|
|||
|
|
m_capacityProvidersHasBeenSet(false),
|
|||
|
|
m_defaultCapacityProviderStrategyHasBeenSet(false),
|
|||
|
|
m_attachmentsHasBeenSet(false),
|
|||
|
|
m_attachmentsStatusHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
*this = jsonValue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Cluster& Cluster::operator =(JsonView jsonValue)
|
|||
|
|
{
|
|||
|
|
if(jsonValue.ValueExists("clusterArn"))
|
|||
|
|
{
|
|||
|
|
m_clusterArn = jsonValue.GetString("clusterArn");
|
|||
|
|
|
|||
|
|
m_clusterArnHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("clusterName"))
|
|||
|
|
{
|
|||
|
|
m_clusterName = jsonValue.GetString("clusterName");
|
|||
|
|
|
|||
|
|
m_clusterNameHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("status"))
|
|||
|
|
{
|
|||
|
|
m_status = jsonValue.GetString("status");
|
|||
|
|
|
|||
|
|
m_statusHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("registeredContainerInstancesCount"))
|
|||
|
|
{
|
|||
|
|
m_registeredContainerInstancesCount = jsonValue.GetInteger("registeredContainerInstancesCount");
|
|||
|
|
|
|||
|
|
m_registeredContainerInstancesCountHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("runningTasksCount"))
|
|||
|
|
{
|
|||
|
|
m_runningTasksCount = jsonValue.GetInteger("runningTasksCount");
|
|||
|
|
|
|||
|
|
m_runningTasksCountHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("pendingTasksCount"))
|
|||
|
|
{
|
|||
|
|
m_pendingTasksCount = jsonValue.GetInteger("pendingTasksCount");
|
|||
|
|
|
|||
|
|
m_pendingTasksCountHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("activeServicesCount"))
|
|||
|
|
{
|
|||
|
|
m_activeServicesCount = jsonValue.GetInteger("activeServicesCount");
|
|||
|
|
|
|||
|
|
m_activeServicesCountHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("statistics"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> statisticsJsonList = jsonValue.GetArray("statistics");
|
|||
|
|
for(unsigned statisticsIndex = 0; statisticsIndex < statisticsJsonList.GetLength(); ++statisticsIndex)
|
|||
|
|
{
|
|||
|
|
m_statistics.push_back(statisticsJsonList[statisticsIndex].AsObject());
|
|||
|
|
}
|
|||
|
|
m_statisticsHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("tags"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> tagsJsonList = jsonValue.GetArray("tags");
|
|||
|
|
for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex)
|
|||
|
|
{
|
|||
|
|
m_tags.push_back(tagsJsonList[tagsIndex].AsObject());
|
|||
|
|
}
|
|||
|
|
m_tagsHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("settings"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> settingsJsonList = jsonValue.GetArray("settings");
|
|||
|
|
for(unsigned settingsIndex = 0; settingsIndex < settingsJsonList.GetLength(); ++settingsIndex)
|
|||
|
|
{
|
|||
|
|
m_settings.push_back(settingsJsonList[settingsIndex].AsObject());
|
|||
|
|
}
|
|||
|
|
m_settingsHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("capacityProviders"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> capacityProvidersJsonList = jsonValue.GetArray("capacityProviders");
|
|||
|
|
for(unsigned capacityProvidersIndex = 0; capacityProvidersIndex < capacityProvidersJsonList.GetLength(); ++capacityProvidersIndex)
|
|||
|
|
{
|
|||
|
|
m_capacityProviders.push_back(capacityProvidersJsonList[capacityProvidersIndex].AsString());
|
|||
|
|
}
|
|||
|
|
m_capacityProvidersHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("defaultCapacityProviderStrategy"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> defaultCapacityProviderStrategyJsonList = jsonValue.GetArray("defaultCapacityProviderStrategy");
|
|||
|
|
for(unsigned defaultCapacityProviderStrategyIndex = 0; defaultCapacityProviderStrategyIndex < defaultCapacityProviderStrategyJsonList.GetLength(); ++defaultCapacityProviderStrategyIndex)
|
|||
|
|
{
|
|||
|
|
m_defaultCapacityProviderStrategy.push_back(defaultCapacityProviderStrategyJsonList[defaultCapacityProviderStrategyIndex].AsObject());
|
|||
|
|
}
|
|||
|
|
m_defaultCapacityProviderStrategyHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("attachments"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> attachmentsJsonList = jsonValue.GetArray("attachments");
|
|||
|
|
for(unsigned attachmentsIndex = 0; attachmentsIndex < attachmentsJsonList.GetLength(); ++attachmentsIndex)
|
|||
|
|
{
|
|||
|
|
m_attachments.push_back(attachmentsJsonList[attachmentsIndex].AsObject());
|
|||
|
|
}
|
|||
|
|
m_attachmentsHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("attachmentsStatus"))
|
|||
|
|
{
|
|||
|
|
m_attachmentsStatus = jsonValue.GetString("attachmentsStatus");
|
|||
|
|
|
|||
|
|
m_attachmentsStatusHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return *this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
JsonValue Cluster::Jsonize() const
|
|||
|
|
{
|
|||
|
|
JsonValue payload;
|
|||
|
|
|
|||
|
|
if(m_clusterArnHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("clusterArn", m_clusterArn);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_clusterNameHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("clusterName", m_clusterName);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_statusHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("status", m_status);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_registeredContainerInstancesCountHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithInteger("registeredContainerInstancesCount", m_registeredContainerInstancesCount);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_runningTasksCountHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithInteger("runningTasksCount", m_runningTasksCount);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_pendingTasksCountHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithInteger("pendingTasksCount", m_pendingTasksCount);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_activeServicesCountHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithInteger("activeServicesCount", m_activeServicesCount);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_statisticsHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> statisticsJsonList(m_statistics.size());
|
|||
|
|
for(unsigned statisticsIndex = 0; statisticsIndex < statisticsJsonList.GetLength(); ++statisticsIndex)
|
|||
|
|
{
|
|||
|
|
statisticsJsonList[statisticsIndex].AsObject(m_statistics[statisticsIndex].Jsonize());
|
|||
|
|
}
|
|||
|
|
payload.WithArray("statistics", std::move(statisticsJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
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_settingsHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> settingsJsonList(m_settings.size());
|
|||
|
|
for(unsigned settingsIndex = 0; settingsIndex < settingsJsonList.GetLength(); ++settingsIndex)
|
|||
|
|
{
|
|||
|
|
settingsJsonList[settingsIndex].AsObject(m_settings[settingsIndex].Jsonize());
|
|||
|
|
}
|
|||
|
|
payload.WithArray("settings", std::move(settingsJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_capacityProvidersHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> capacityProvidersJsonList(m_capacityProviders.size());
|
|||
|
|
for(unsigned capacityProvidersIndex = 0; capacityProvidersIndex < capacityProvidersJsonList.GetLength(); ++capacityProvidersIndex)
|
|||
|
|
{
|
|||
|
|
capacityProvidersJsonList[capacityProvidersIndex].AsString(m_capacityProviders[capacityProvidersIndex]);
|
|||
|
|
}
|
|||
|
|
payload.WithArray("capacityProviders", std::move(capacityProvidersJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_defaultCapacityProviderStrategyHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> defaultCapacityProviderStrategyJsonList(m_defaultCapacityProviderStrategy.size());
|
|||
|
|
for(unsigned defaultCapacityProviderStrategyIndex = 0; defaultCapacityProviderStrategyIndex < defaultCapacityProviderStrategyJsonList.GetLength(); ++defaultCapacityProviderStrategyIndex)
|
|||
|
|
{
|
|||
|
|
defaultCapacityProviderStrategyJsonList[defaultCapacityProviderStrategyIndex].AsObject(m_defaultCapacityProviderStrategy[defaultCapacityProviderStrategyIndex].Jsonize());
|
|||
|
|
}
|
|||
|
|
payload.WithArray("defaultCapacityProviderStrategy", std::move(defaultCapacityProviderStrategyJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_attachmentsHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> attachmentsJsonList(m_attachments.size());
|
|||
|
|
for(unsigned attachmentsIndex = 0; attachmentsIndex < attachmentsJsonList.GetLength(); ++attachmentsIndex)
|
|||
|
|
{
|
|||
|
|
attachmentsJsonList[attachmentsIndex].AsObject(m_attachments[attachmentsIndex].Jsonize());
|
|||
|
|
}
|
|||
|
|
payload.WithArray("attachments", std::move(attachmentsJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_attachmentsStatusHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("attachmentsStatus", m_attachmentsStatus);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return payload;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace ECS
|
|||
|
|
} // namespace Aws
|