173 lines
3.4 KiB
C++
173 lines
3.4 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/dataexchange/model/JobEntry.h>
|
|||
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|||
|
|
|
|||
|
|
#include <utility>
|
|||
|
|
|
|||
|
|
using namespace Aws::Utils::Json;
|
|||
|
|
using namespace Aws::Utils;
|
|||
|
|
|
|||
|
|
namespace Aws
|
|||
|
|
{
|
|||
|
|
namespace DataExchange
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
JobEntry::JobEntry() :
|
|||
|
|
m_arnHasBeenSet(false),
|
|||
|
|
m_createdAtHasBeenSet(false),
|
|||
|
|
m_detailsHasBeenSet(false),
|
|||
|
|
m_errorsHasBeenSet(false),
|
|||
|
|
m_idHasBeenSet(false),
|
|||
|
|
m_state(State::NOT_SET),
|
|||
|
|
m_stateHasBeenSet(false),
|
|||
|
|
m_type(Type::NOT_SET),
|
|||
|
|
m_typeHasBeenSet(false),
|
|||
|
|
m_updatedAtHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
JobEntry::JobEntry(JsonView jsonValue) :
|
|||
|
|
m_arnHasBeenSet(false),
|
|||
|
|
m_createdAtHasBeenSet(false),
|
|||
|
|
m_detailsHasBeenSet(false),
|
|||
|
|
m_errorsHasBeenSet(false),
|
|||
|
|
m_idHasBeenSet(false),
|
|||
|
|
m_state(State::NOT_SET),
|
|||
|
|
m_stateHasBeenSet(false),
|
|||
|
|
m_type(Type::NOT_SET),
|
|||
|
|
m_typeHasBeenSet(false),
|
|||
|
|
m_updatedAtHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
*this = jsonValue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
JobEntry& JobEntry::operator =(JsonView jsonValue)
|
|||
|
|
{
|
|||
|
|
if(jsonValue.ValueExists("Arn"))
|
|||
|
|
{
|
|||
|
|
m_arn = jsonValue.GetString("Arn");
|
|||
|
|
|
|||
|
|
m_arnHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("CreatedAt"))
|
|||
|
|
{
|
|||
|
|
m_createdAt = jsonValue.GetString("CreatedAt");
|
|||
|
|
|
|||
|
|
m_createdAtHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Details"))
|
|||
|
|
{
|
|||
|
|
m_details = jsonValue.GetObject("Details");
|
|||
|
|
|
|||
|
|
m_detailsHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Errors"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> errorsJsonList = jsonValue.GetArray("Errors");
|
|||
|
|
for(unsigned errorsIndex = 0; errorsIndex < errorsJsonList.GetLength(); ++errorsIndex)
|
|||
|
|
{
|
|||
|
|
m_errors.push_back(errorsJsonList[errorsIndex].AsObject());
|
|||
|
|
}
|
|||
|
|
m_errorsHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Id"))
|
|||
|
|
{
|
|||
|
|
m_id = jsonValue.GetString("Id");
|
|||
|
|
|
|||
|
|
m_idHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("State"))
|
|||
|
|
{
|
|||
|
|
m_state = StateMapper::GetStateForName(jsonValue.GetString("State"));
|
|||
|
|
|
|||
|
|
m_stateHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Type"))
|
|||
|
|
{
|
|||
|
|
m_type = TypeMapper::GetTypeForName(jsonValue.GetString("Type"));
|
|||
|
|
|
|||
|
|
m_typeHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("UpdatedAt"))
|
|||
|
|
{
|
|||
|
|
m_updatedAt = jsonValue.GetString("UpdatedAt");
|
|||
|
|
|
|||
|
|
m_updatedAtHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return *this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
JsonValue JobEntry::Jsonize() const
|
|||
|
|
{
|
|||
|
|
JsonValue payload;
|
|||
|
|
|
|||
|
|
if(m_arnHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Arn", m_arn);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_createdAtHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("CreatedAt", m_createdAt.ToGmtString(DateFormat::ISO_8601));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_detailsHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithObject("Details", m_details.Jsonize());
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_errorsHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> errorsJsonList(m_errors.size());
|
|||
|
|
for(unsigned errorsIndex = 0; errorsIndex < errorsJsonList.GetLength(); ++errorsIndex)
|
|||
|
|
{
|
|||
|
|
errorsJsonList[errorsIndex].AsObject(m_errors[errorsIndex].Jsonize());
|
|||
|
|
}
|
|||
|
|
payload.WithArray("Errors", std::move(errorsJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_idHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Id", m_id);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_stateHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("State", StateMapper::GetNameForState(m_state));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_typeHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Type", TypeMapper::GetNameForType(m_type));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_updatedAtHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("UpdatedAt", m_updatedAt.ToGmtString(DateFormat::ISO_8601));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return payload;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace DataExchange
|
|||
|
|
} // namespace Aws
|