169 lines
3.3 KiB
C++
169 lines
3.3 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/ce/model/EC2InstanceDetails.h>
|
|||
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|||
|
|
|
|||
|
|
#include <utility>
|
|||
|
|
|
|||
|
|
using namespace Aws::Utils::Json;
|
|||
|
|
using namespace Aws::Utils;
|
|||
|
|
|
|||
|
|
namespace Aws
|
|||
|
|
{
|
|||
|
|
namespace CostExplorer
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
EC2InstanceDetails::EC2InstanceDetails() :
|
|||
|
|
m_familyHasBeenSet(false),
|
|||
|
|
m_instanceTypeHasBeenSet(false),
|
|||
|
|
m_regionHasBeenSet(false),
|
|||
|
|
m_availabilityZoneHasBeenSet(false),
|
|||
|
|
m_platformHasBeenSet(false),
|
|||
|
|
m_tenancyHasBeenSet(false),
|
|||
|
|
m_currentGeneration(false),
|
|||
|
|
m_currentGenerationHasBeenSet(false),
|
|||
|
|
m_sizeFlexEligible(false),
|
|||
|
|
m_sizeFlexEligibleHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
EC2InstanceDetails::EC2InstanceDetails(JsonView jsonValue) :
|
|||
|
|
m_familyHasBeenSet(false),
|
|||
|
|
m_instanceTypeHasBeenSet(false),
|
|||
|
|
m_regionHasBeenSet(false),
|
|||
|
|
m_availabilityZoneHasBeenSet(false),
|
|||
|
|
m_platformHasBeenSet(false),
|
|||
|
|
m_tenancyHasBeenSet(false),
|
|||
|
|
m_currentGeneration(false),
|
|||
|
|
m_currentGenerationHasBeenSet(false),
|
|||
|
|
m_sizeFlexEligible(false),
|
|||
|
|
m_sizeFlexEligibleHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
*this = jsonValue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
EC2InstanceDetails& EC2InstanceDetails::operator =(JsonView jsonValue)
|
|||
|
|
{
|
|||
|
|
if(jsonValue.ValueExists("Family"))
|
|||
|
|
{
|
|||
|
|
m_family = jsonValue.GetString("Family");
|
|||
|
|
|
|||
|
|
m_familyHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("InstanceType"))
|
|||
|
|
{
|
|||
|
|
m_instanceType = jsonValue.GetString("InstanceType");
|
|||
|
|
|
|||
|
|
m_instanceTypeHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Region"))
|
|||
|
|
{
|
|||
|
|
m_region = jsonValue.GetString("Region");
|
|||
|
|
|
|||
|
|
m_regionHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("AvailabilityZone"))
|
|||
|
|
{
|
|||
|
|
m_availabilityZone = jsonValue.GetString("AvailabilityZone");
|
|||
|
|
|
|||
|
|
m_availabilityZoneHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Platform"))
|
|||
|
|
{
|
|||
|
|
m_platform = jsonValue.GetString("Platform");
|
|||
|
|
|
|||
|
|
m_platformHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Tenancy"))
|
|||
|
|
{
|
|||
|
|
m_tenancy = jsonValue.GetString("Tenancy");
|
|||
|
|
|
|||
|
|
m_tenancyHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("CurrentGeneration"))
|
|||
|
|
{
|
|||
|
|
m_currentGeneration = jsonValue.GetBool("CurrentGeneration");
|
|||
|
|
|
|||
|
|
m_currentGenerationHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("SizeFlexEligible"))
|
|||
|
|
{
|
|||
|
|
m_sizeFlexEligible = jsonValue.GetBool("SizeFlexEligible");
|
|||
|
|
|
|||
|
|
m_sizeFlexEligibleHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return *this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
JsonValue EC2InstanceDetails::Jsonize() const
|
|||
|
|
{
|
|||
|
|
JsonValue payload;
|
|||
|
|
|
|||
|
|
if(m_familyHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Family", m_family);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_instanceTypeHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("InstanceType", m_instanceType);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_regionHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Region", m_region);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_availabilityZoneHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("AvailabilityZone", m_availabilityZone);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_platformHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Platform", m_platform);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_tenancyHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Tenancy", m_tenancy);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_currentGenerationHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithBool("CurrentGeneration", m_currentGeneration);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_sizeFlexEligibleHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithBool("SizeFlexEligible", m_sizeFlexEligible);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return payload;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace CostExplorer
|
|||
|
|
} // namespace Aws
|