202 lines
4.3 KiB
C++
202 lines
4.3 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/ssm/model/Association.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
|
|
{
|
|
|
|
Association::Association() :
|
|
m_nameHasBeenSet(false),
|
|
m_instanceIdHasBeenSet(false),
|
|
m_associationIdHasBeenSet(false),
|
|
m_associationVersionHasBeenSet(false),
|
|
m_documentVersionHasBeenSet(false),
|
|
m_targetsHasBeenSet(false),
|
|
m_lastExecutionDateHasBeenSet(false),
|
|
m_overviewHasBeenSet(false),
|
|
m_scheduleExpressionHasBeenSet(false),
|
|
m_associationNameHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
Association::Association(JsonView jsonValue) :
|
|
m_nameHasBeenSet(false),
|
|
m_instanceIdHasBeenSet(false),
|
|
m_associationIdHasBeenSet(false),
|
|
m_associationVersionHasBeenSet(false),
|
|
m_documentVersionHasBeenSet(false),
|
|
m_targetsHasBeenSet(false),
|
|
m_lastExecutionDateHasBeenSet(false),
|
|
m_overviewHasBeenSet(false),
|
|
m_scheduleExpressionHasBeenSet(false),
|
|
m_associationNameHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
Association& Association::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("Name"))
|
|
{
|
|
m_name = jsonValue.GetString("Name");
|
|
|
|
m_nameHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("InstanceId"))
|
|
{
|
|
m_instanceId = jsonValue.GetString("InstanceId");
|
|
|
|
m_instanceIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("AssociationId"))
|
|
{
|
|
m_associationId = jsonValue.GetString("AssociationId");
|
|
|
|
m_associationIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("AssociationVersion"))
|
|
{
|
|
m_associationVersion = jsonValue.GetString("AssociationVersion");
|
|
|
|
m_associationVersionHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("DocumentVersion"))
|
|
{
|
|
m_documentVersion = jsonValue.GetString("DocumentVersion");
|
|
|
|
m_documentVersionHasBeenSet = 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("LastExecutionDate"))
|
|
{
|
|
m_lastExecutionDate = jsonValue.GetDouble("LastExecutionDate");
|
|
|
|
m_lastExecutionDateHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Overview"))
|
|
{
|
|
m_overview = jsonValue.GetObject("Overview");
|
|
|
|
m_overviewHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("ScheduleExpression"))
|
|
{
|
|
m_scheduleExpression = jsonValue.GetString("ScheduleExpression");
|
|
|
|
m_scheduleExpressionHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("AssociationName"))
|
|
{
|
|
m_associationName = jsonValue.GetString("AssociationName");
|
|
|
|
m_associationNameHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue Association::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_nameHasBeenSet)
|
|
{
|
|
payload.WithString("Name", m_name);
|
|
|
|
}
|
|
|
|
if(m_instanceIdHasBeenSet)
|
|
{
|
|
payload.WithString("InstanceId", m_instanceId);
|
|
|
|
}
|
|
|
|
if(m_associationIdHasBeenSet)
|
|
{
|
|
payload.WithString("AssociationId", m_associationId);
|
|
|
|
}
|
|
|
|
if(m_associationVersionHasBeenSet)
|
|
{
|
|
payload.WithString("AssociationVersion", m_associationVersion);
|
|
|
|
}
|
|
|
|
if(m_documentVersionHasBeenSet)
|
|
{
|
|
payload.WithString("DocumentVersion", m_documentVersion);
|
|
|
|
}
|
|
|
|
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_lastExecutionDateHasBeenSet)
|
|
{
|
|
payload.WithDouble("LastExecutionDate", m_lastExecutionDate.SecondsWithMSPrecision());
|
|
}
|
|
|
|
if(m_overviewHasBeenSet)
|
|
{
|
|
payload.WithObject("Overview", m_overview.Jsonize());
|
|
|
|
}
|
|
|
|
if(m_scheduleExpressionHasBeenSet)
|
|
{
|
|
payload.WithString("ScheduleExpression", m_scheduleExpression);
|
|
|
|
}
|
|
|
|
if(m_associationNameHasBeenSet)
|
|
{
|
|
payload.WithString("AssociationName", m_associationName);
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace SSM
|
|
} // namespace Aws
|