164 lines
3.2 KiB
C++
164 lines
3.2 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/ram/model/Resource.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace RAM
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
Resource::Resource() :
|
|
m_arnHasBeenSet(false),
|
|
m_typeHasBeenSet(false),
|
|
m_resourceShareArnHasBeenSet(false),
|
|
m_resourceGroupArnHasBeenSet(false),
|
|
m_status(ResourceStatus::NOT_SET),
|
|
m_statusHasBeenSet(false),
|
|
m_statusMessageHasBeenSet(false),
|
|
m_creationTimeHasBeenSet(false),
|
|
m_lastUpdatedTimeHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
Resource::Resource(JsonView jsonValue) :
|
|
m_arnHasBeenSet(false),
|
|
m_typeHasBeenSet(false),
|
|
m_resourceShareArnHasBeenSet(false),
|
|
m_resourceGroupArnHasBeenSet(false),
|
|
m_status(ResourceStatus::NOT_SET),
|
|
m_statusHasBeenSet(false),
|
|
m_statusMessageHasBeenSet(false),
|
|
m_creationTimeHasBeenSet(false),
|
|
m_lastUpdatedTimeHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
Resource& Resource::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("arn"))
|
|
{
|
|
m_arn = jsonValue.GetString("arn");
|
|
|
|
m_arnHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("type"))
|
|
{
|
|
m_type = jsonValue.GetString("type");
|
|
|
|
m_typeHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("resourceShareArn"))
|
|
{
|
|
m_resourceShareArn = jsonValue.GetString("resourceShareArn");
|
|
|
|
m_resourceShareArnHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("resourceGroupArn"))
|
|
{
|
|
m_resourceGroupArn = jsonValue.GetString("resourceGroupArn");
|
|
|
|
m_resourceGroupArnHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("status"))
|
|
{
|
|
m_status = ResourceStatusMapper::GetResourceStatusForName(jsonValue.GetString("status"));
|
|
|
|
m_statusHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("statusMessage"))
|
|
{
|
|
m_statusMessage = jsonValue.GetString("statusMessage");
|
|
|
|
m_statusMessageHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("creationTime"))
|
|
{
|
|
m_creationTime = jsonValue.GetDouble("creationTime");
|
|
|
|
m_creationTimeHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("lastUpdatedTime"))
|
|
{
|
|
m_lastUpdatedTime = jsonValue.GetDouble("lastUpdatedTime");
|
|
|
|
m_lastUpdatedTimeHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue Resource::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_arnHasBeenSet)
|
|
{
|
|
payload.WithString("arn", m_arn);
|
|
|
|
}
|
|
|
|
if(m_typeHasBeenSet)
|
|
{
|
|
payload.WithString("type", m_type);
|
|
|
|
}
|
|
|
|
if(m_resourceShareArnHasBeenSet)
|
|
{
|
|
payload.WithString("resourceShareArn", m_resourceShareArn);
|
|
|
|
}
|
|
|
|
if(m_resourceGroupArnHasBeenSet)
|
|
{
|
|
payload.WithString("resourceGroupArn", m_resourceGroupArn);
|
|
|
|
}
|
|
|
|
if(m_statusHasBeenSet)
|
|
{
|
|
payload.WithString("status", ResourceStatusMapper::GetNameForResourceStatus(m_status));
|
|
}
|
|
|
|
if(m_statusMessageHasBeenSet)
|
|
{
|
|
payload.WithString("statusMessage", m_statusMessage);
|
|
|
|
}
|
|
|
|
if(m_creationTimeHasBeenSet)
|
|
{
|
|
payload.WithDouble("creationTime", m_creationTime.SecondsWithMSPrecision());
|
|
}
|
|
|
|
if(m_lastUpdatedTimeHasBeenSet)
|
|
{
|
|
payload.WithDouble("lastUpdatedTime", m_lastUpdatedTime.SecondsWithMSPrecision());
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace RAM
|
|
} // namespace Aws
|