120 lines
2.2 KiB
C++
120 lines
2.2 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/iotthingsgraph/model/EntityDescription.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace IoTThingsGraph
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
EntityDescription::EntityDescription() :
|
|
m_idHasBeenSet(false),
|
|
m_arnHasBeenSet(false),
|
|
m_type(EntityType::NOT_SET),
|
|
m_typeHasBeenSet(false),
|
|
m_createdAtHasBeenSet(false),
|
|
m_definitionHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
EntityDescription::EntityDescription(JsonView jsonValue) :
|
|
m_idHasBeenSet(false),
|
|
m_arnHasBeenSet(false),
|
|
m_type(EntityType::NOT_SET),
|
|
m_typeHasBeenSet(false),
|
|
m_createdAtHasBeenSet(false),
|
|
m_definitionHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
EntityDescription& EntityDescription::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("id"))
|
|
{
|
|
m_id = jsonValue.GetString("id");
|
|
|
|
m_idHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("arn"))
|
|
{
|
|
m_arn = jsonValue.GetString("arn");
|
|
|
|
m_arnHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("type"))
|
|
{
|
|
m_type = EntityTypeMapper::GetEntityTypeForName(jsonValue.GetString("type"));
|
|
|
|
m_typeHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("createdAt"))
|
|
{
|
|
m_createdAt = jsonValue.GetDouble("createdAt");
|
|
|
|
m_createdAtHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("definition"))
|
|
{
|
|
m_definition = jsonValue.GetObject("definition");
|
|
|
|
m_definitionHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue EntityDescription::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_idHasBeenSet)
|
|
{
|
|
payload.WithString("id", m_id);
|
|
|
|
}
|
|
|
|
if(m_arnHasBeenSet)
|
|
{
|
|
payload.WithString("arn", m_arn);
|
|
|
|
}
|
|
|
|
if(m_typeHasBeenSet)
|
|
{
|
|
payload.WithString("type", EntityTypeMapper::GetNameForEntityType(m_type));
|
|
}
|
|
|
|
if(m_createdAtHasBeenSet)
|
|
{
|
|
payload.WithDouble("createdAt", m_createdAt.SecondsWithMSPrecision());
|
|
}
|
|
|
|
if(m_definitionHasBeenSet)
|
|
{
|
|
payload.WithObject("definition", m_definition.Jsonize());
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace IoTThingsGraph
|
|
} // namespace Aws
|