75 lines
1.5 KiB
C++
75 lines
1.5 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/iotsecuretunneling/model/ConnectionState.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace IoTSecureTunneling
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
ConnectionState::ConnectionState() :
|
|
m_status(ConnectionStatus::NOT_SET),
|
|
m_statusHasBeenSet(false),
|
|
m_lastUpdatedAtHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
ConnectionState::ConnectionState(JsonView jsonValue) :
|
|
m_status(ConnectionStatus::NOT_SET),
|
|
m_statusHasBeenSet(false),
|
|
m_lastUpdatedAtHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
ConnectionState& ConnectionState::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("status"))
|
|
{
|
|
m_status = ConnectionStatusMapper::GetConnectionStatusForName(jsonValue.GetString("status"));
|
|
|
|
m_statusHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("lastUpdatedAt"))
|
|
{
|
|
m_lastUpdatedAt = jsonValue.GetDouble("lastUpdatedAt");
|
|
|
|
m_lastUpdatedAtHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue ConnectionState::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_statusHasBeenSet)
|
|
{
|
|
payload.WithString("status", ConnectionStatusMapper::GetNameForConnectionStatus(m_status));
|
|
}
|
|
|
|
if(m_lastUpdatedAtHasBeenSet)
|
|
{
|
|
payload.WithDouble("lastUpdatedAt", m_lastUpdatedAt.SecondsWithMSPrecision());
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace IoTSecureTunneling
|
|
} // namespace Aws
|