160 lines
3.8 KiB
C++
160 lines
3.8 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/codedeploy/model/CloudFormationTarget.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace CodeDeploy
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
CloudFormationTarget::CloudFormationTarget() :
|
|
m_deploymentIdHasBeenSet(false),
|
|
m_targetIdHasBeenSet(false),
|
|
m_lastUpdatedAtHasBeenSet(false),
|
|
m_lifecycleEventsHasBeenSet(false),
|
|
m_status(TargetStatus::NOT_SET),
|
|
m_statusHasBeenSet(false),
|
|
m_resourceTypeHasBeenSet(false),
|
|
m_targetVersionWeight(0.0),
|
|
m_targetVersionWeightHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
CloudFormationTarget::CloudFormationTarget(JsonView jsonValue) :
|
|
m_deploymentIdHasBeenSet(false),
|
|
m_targetIdHasBeenSet(false),
|
|
m_lastUpdatedAtHasBeenSet(false),
|
|
m_lifecycleEventsHasBeenSet(false),
|
|
m_status(TargetStatus::NOT_SET),
|
|
m_statusHasBeenSet(false),
|
|
m_resourceTypeHasBeenSet(false),
|
|
m_targetVersionWeight(0.0),
|
|
m_targetVersionWeightHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
CloudFormationTarget& CloudFormationTarget::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("deploymentId"))
|
|
{
|
|
m_deploymentId = jsonValue.GetString("deploymentId");
|
|
|
|
m_deploymentIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("targetId"))
|
|
{
|
|
m_targetId = jsonValue.GetString("targetId");
|
|
|
|
m_targetIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("lastUpdatedAt"))
|
|
{
|
|
m_lastUpdatedAt = jsonValue.GetDouble("lastUpdatedAt");
|
|
|
|
m_lastUpdatedAtHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("lifecycleEvents"))
|
|
{
|
|
Array<JsonView> lifecycleEventsJsonList = jsonValue.GetArray("lifecycleEvents");
|
|
for(unsigned lifecycleEventsIndex = 0; lifecycleEventsIndex < lifecycleEventsJsonList.GetLength(); ++lifecycleEventsIndex)
|
|
{
|
|
m_lifecycleEvents.push_back(lifecycleEventsJsonList[lifecycleEventsIndex].AsObject());
|
|
}
|
|
m_lifecycleEventsHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("status"))
|
|
{
|
|
m_status = TargetStatusMapper::GetTargetStatusForName(jsonValue.GetString("status"));
|
|
|
|
m_statusHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("resourceType"))
|
|
{
|
|
m_resourceType = jsonValue.GetString("resourceType");
|
|
|
|
m_resourceTypeHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("targetVersionWeight"))
|
|
{
|
|
m_targetVersionWeight = jsonValue.GetDouble("targetVersionWeight");
|
|
|
|
m_targetVersionWeightHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue CloudFormationTarget::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_deploymentIdHasBeenSet)
|
|
{
|
|
payload.WithString("deploymentId", m_deploymentId);
|
|
|
|
}
|
|
|
|
if(m_targetIdHasBeenSet)
|
|
{
|
|
payload.WithString("targetId", m_targetId);
|
|
|
|
}
|
|
|
|
if(m_lastUpdatedAtHasBeenSet)
|
|
{
|
|
payload.WithDouble("lastUpdatedAt", m_lastUpdatedAt.SecondsWithMSPrecision());
|
|
}
|
|
|
|
if(m_lifecycleEventsHasBeenSet)
|
|
{
|
|
Array<JsonValue> lifecycleEventsJsonList(m_lifecycleEvents.size());
|
|
for(unsigned lifecycleEventsIndex = 0; lifecycleEventsIndex < lifecycleEventsJsonList.GetLength(); ++lifecycleEventsIndex)
|
|
{
|
|
lifecycleEventsJsonList[lifecycleEventsIndex].AsObject(m_lifecycleEvents[lifecycleEventsIndex].Jsonize());
|
|
}
|
|
payload.WithArray("lifecycleEvents", std::move(lifecycleEventsJsonList));
|
|
|
|
}
|
|
|
|
if(m_statusHasBeenSet)
|
|
{
|
|
payload.WithString("status", TargetStatusMapper::GetNameForTargetStatus(m_status));
|
|
}
|
|
|
|
if(m_resourceTypeHasBeenSet)
|
|
{
|
|
payload.WithString("resourceType", m_resourceType);
|
|
|
|
}
|
|
|
|
if(m_targetVersionWeightHasBeenSet)
|
|
{
|
|
payload.WithDouble("targetVersionWeight", m_targetVersionWeight);
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace CodeDeploy
|
|
} // namespace Aws
|