167 lines
3.5 KiB
C++
167 lines
3.5 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/gamelift/model/Instance.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace GameLift
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
Instance::Instance() :
|
|
m_fleetIdHasBeenSet(false),
|
|
m_instanceIdHasBeenSet(false),
|
|
m_ipAddressHasBeenSet(false),
|
|
m_dnsNameHasBeenSet(false),
|
|
m_operatingSystem(OperatingSystem::NOT_SET),
|
|
m_operatingSystemHasBeenSet(false),
|
|
m_type(EC2InstanceType::NOT_SET),
|
|
m_typeHasBeenSet(false),
|
|
m_status(InstanceStatus::NOT_SET),
|
|
m_statusHasBeenSet(false),
|
|
m_creationTimeHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
Instance::Instance(JsonView jsonValue) :
|
|
m_fleetIdHasBeenSet(false),
|
|
m_instanceIdHasBeenSet(false),
|
|
m_ipAddressHasBeenSet(false),
|
|
m_dnsNameHasBeenSet(false),
|
|
m_operatingSystem(OperatingSystem::NOT_SET),
|
|
m_operatingSystemHasBeenSet(false),
|
|
m_type(EC2InstanceType::NOT_SET),
|
|
m_typeHasBeenSet(false),
|
|
m_status(InstanceStatus::NOT_SET),
|
|
m_statusHasBeenSet(false),
|
|
m_creationTimeHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
Instance& Instance::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("FleetId"))
|
|
{
|
|
m_fleetId = jsonValue.GetString("FleetId");
|
|
|
|
m_fleetIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("InstanceId"))
|
|
{
|
|
m_instanceId = jsonValue.GetString("InstanceId");
|
|
|
|
m_instanceIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("IpAddress"))
|
|
{
|
|
m_ipAddress = jsonValue.GetString("IpAddress");
|
|
|
|
m_ipAddressHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("DnsName"))
|
|
{
|
|
m_dnsName = jsonValue.GetString("DnsName");
|
|
|
|
m_dnsNameHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("OperatingSystem"))
|
|
{
|
|
m_operatingSystem = OperatingSystemMapper::GetOperatingSystemForName(jsonValue.GetString("OperatingSystem"));
|
|
|
|
m_operatingSystemHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Type"))
|
|
{
|
|
m_type = EC2InstanceTypeMapper::GetEC2InstanceTypeForName(jsonValue.GetString("Type"));
|
|
|
|
m_typeHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Status"))
|
|
{
|
|
m_status = InstanceStatusMapper::GetInstanceStatusForName(jsonValue.GetString("Status"));
|
|
|
|
m_statusHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("CreationTime"))
|
|
{
|
|
m_creationTime = jsonValue.GetDouble("CreationTime");
|
|
|
|
m_creationTimeHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue Instance::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_fleetIdHasBeenSet)
|
|
{
|
|
payload.WithString("FleetId", m_fleetId);
|
|
|
|
}
|
|
|
|
if(m_instanceIdHasBeenSet)
|
|
{
|
|
payload.WithString("InstanceId", m_instanceId);
|
|
|
|
}
|
|
|
|
if(m_ipAddressHasBeenSet)
|
|
{
|
|
payload.WithString("IpAddress", m_ipAddress);
|
|
|
|
}
|
|
|
|
if(m_dnsNameHasBeenSet)
|
|
{
|
|
payload.WithString("DnsName", m_dnsName);
|
|
|
|
}
|
|
|
|
if(m_operatingSystemHasBeenSet)
|
|
{
|
|
payload.WithString("OperatingSystem", OperatingSystemMapper::GetNameForOperatingSystem(m_operatingSystem));
|
|
}
|
|
|
|
if(m_typeHasBeenSet)
|
|
{
|
|
payload.WithString("Type", EC2InstanceTypeMapper::GetNameForEC2InstanceType(m_type));
|
|
}
|
|
|
|
if(m_statusHasBeenSet)
|
|
{
|
|
payload.WithString("Status", InstanceStatusMapper::GetNameForInstanceStatus(m_status));
|
|
}
|
|
|
|
if(m_creationTimeHasBeenSet)
|
|
{
|
|
payload.WithDouble("CreationTime", m_creationTime.SecondsWithMSPrecision());
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace GameLift
|
|
} // namespace Aws
|