159 lines
3.5 KiB
C++
159 lines
3.5 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/ssm/model/MaintenanceWindowTarget.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace SSM
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
MaintenanceWindowTarget::MaintenanceWindowTarget() :
|
|
m_windowIdHasBeenSet(false),
|
|
m_windowTargetIdHasBeenSet(false),
|
|
m_resourceType(MaintenanceWindowResourceType::NOT_SET),
|
|
m_resourceTypeHasBeenSet(false),
|
|
m_targetsHasBeenSet(false),
|
|
m_ownerInformationHasBeenSet(false),
|
|
m_nameHasBeenSet(false),
|
|
m_descriptionHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
MaintenanceWindowTarget::MaintenanceWindowTarget(JsonView jsonValue) :
|
|
m_windowIdHasBeenSet(false),
|
|
m_windowTargetIdHasBeenSet(false),
|
|
m_resourceType(MaintenanceWindowResourceType::NOT_SET),
|
|
m_resourceTypeHasBeenSet(false),
|
|
m_targetsHasBeenSet(false),
|
|
m_ownerInformationHasBeenSet(false),
|
|
m_nameHasBeenSet(false),
|
|
m_descriptionHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
MaintenanceWindowTarget& MaintenanceWindowTarget::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("WindowId"))
|
|
{
|
|
m_windowId = jsonValue.GetString("WindowId");
|
|
|
|
m_windowIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("WindowTargetId"))
|
|
{
|
|
m_windowTargetId = jsonValue.GetString("WindowTargetId");
|
|
|
|
m_windowTargetIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("ResourceType"))
|
|
{
|
|
m_resourceType = MaintenanceWindowResourceTypeMapper::GetMaintenanceWindowResourceTypeForName(jsonValue.GetString("ResourceType"));
|
|
|
|
m_resourceTypeHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Targets"))
|
|
{
|
|
Array<JsonView> targetsJsonList = jsonValue.GetArray("Targets");
|
|
for(unsigned targetsIndex = 0; targetsIndex < targetsJsonList.GetLength(); ++targetsIndex)
|
|
{
|
|
m_targets.push_back(targetsJsonList[targetsIndex].AsObject());
|
|
}
|
|
m_targetsHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("OwnerInformation"))
|
|
{
|
|
m_ownerInformation = jsonValue.GetString("OwnerInformation");
|
|
|
|
m_ownerInformationHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Name"))
|
|
{
|
|
m_name = jsonValue.GetString("Name");
|
|
|
|
m_nameHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Description"))
|
|
{
|
|
m_description = jsonValue.GetString("Description");
|
|
|
|
m_descriptionHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue MaintenanceWindowTarget::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_windowIdHasBeenSet)
|
|
{
|
|
payload.WithString("WindowId", m_windowId);
|
|
|
|
}
|
|
|
|
if(m_windowTargetIdHasBeenSet)
|
|
{
|
|
payload.WithString("WindowTargetId", m_windowTargetId);
|
|
|
|
}
|
|
|
|
if(m_resourceTypeHasBeenSet)
|
|
{
|
|
payload.WithString("ResourceType", MaintenanceWindowResourceTypeMapper::GetNameForMaintenanceWindowResourceType(m_resourceType));
|
|
}
|
|
|
|
if(m_targetsHasBeenSet)
|
|
{
|
|
Array<JsonValue> targetsJsonList(m_targets.size());
|
|
for(unsigned targetsIndex = 0; targetsIndex < targetsJsonList.GetLength(); ++targetsIndex)
|
|
{
|
|
targetsJsonList[targetsIndex].AsObject(m_targets[targetsIndex].Jsonize());
|
|
}
|
|
payload.WithArray("Targets", std::move(targetsJsonList));
|
|
|
|
}
|
|
|
|
if(m_ownerInformationHasBeenSet)
|
|
{
|
|
payload.WithString("OwnerInformation", m_ownerInformation);
|
|
|
|
}
|
|
|
|
if(m_nameHasBeenSet)
|
|
{
|
|
payload.WithString("Name", m_name);
|
|
|
|
}
|
|
|
|
if(m_descriptionHasBeenSet)
|
|
{
|
|
payload.WithString("Description", m_description);
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace SSM
|
|
} // namespace Aws
|