/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace GameLift { namespace Model { Instance::Instance() : m_fleetIdHasBeenSet(false), m_fleetArnHasBeenSet(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), m_locationHasBeenSet(false) { } Instance::Instance(JsonView jsonValue) : m_fleetIdHasBeenSet(false), m_fleetArnHasBeenSet(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), m_locationHasBeenSet(false) { *this = jsonValue; } Instance& Instance::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("FleetId")) { m_fleetId = jsonValue.GetString("FleetId"); m_fleetIdHasBeenSet = true; } if(jsonValue.ValueExists("FleetArn")) { m_fleetArn = jsonValue.GetString("FleetArn"); m_fleetArnHasBeenSet = 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; } if(jsonValue.ValueExists("Location")) { m_location = jsonValue.GetString("Location"); m_locationHasBeenSet = true; } return *this; } JsonValue Instance::Jsonize() const { JsonValue payload; if(m_fleetIdHasBeenSet) { payload.WithString("FleetId", m_fleetId); } if(m_fleetArnHasBeenSet) { payload.WithString("FleetArn", m_fleetArn); } 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()); } if(m_locationHasBeenSet) { payload.WithString("Location", m_location); } return payload; } } // namespace Model } // namespace GameLift } // namespace Aws