111 lines
2.4 KiB
C++
111 lines
2.4 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/medialive/model/DescribeOfferingResult.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
#include <aws/core/AmazonWebServiceResult.h>
|
|
#include <aws/core/utils/StringUtils.h>
|
|
#include <aws/core/utils/UnreferencedParam.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::MediaLive::Model;
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
using namespace Aws;
|
|
|
|
DescribeOfferingResult::DescribeOfferingResult() :
|
|
m_duration(0),
|
|
m_durationUnits(OfferingDurationUnits::NOT_SET),
|
|
m_fixedPrice(0.0),
|
|
m_offeringType(OfferingType::NOT_SET),
|
|
m_usagePrice(0.0)
|
|
{
|
|
}
|
|
|
|
DescribeOfferingResult::DescribeOfferingResult(const Aws::AmazonWebServiceResult<JsonValue>& result) :
|
|
m_duration(0),
|
|
m_durationUnits(OfferingDurationUnits::NOT_SET),
|
|
m_fixedPrice(0.0),
|
|
m_offeringType(OfferingType::NOT_SET),
|
|
m_usagePrice(0.0)
|
|
{
|
|
*this = result;
|
|
}
|
|
|
|
DescribeOfferingResult& DescribeOfferingResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
|
|
{
|
|
JsonView jsonValue = result.GetPayload().View();
|
|
if(jsonValue.ValueExists("arn"))
|
|
{
|
|
m_arn = jsonValue.GetString("arn");
|
|
|
|
}
|
|
|
|
if(jsonValue.ValueExists("currencyCode"))
|
|
{
|
|
m_currencyCode = jsonValue.GetString("currencyCode");
|
|
|
|
}
|
|
|
|
if(jsonValue.ValueExists("duration"))
|
|
{
|
|
m_duration = jsonValue.GetInteger("duration");
|
|
|
|
}
|
|
|
|
if(jsonValue.ValueExists("durationUnits"))
|
|
{
|
|
m_durationUnits = OfferingDurationUnitsMapper::GetOfferingDurationUnitsForName(jsonValue.GetString("durationUnits"));
|
|
|
|
}
|
|
|
|
if(jsonValue.ValueExists("fixedPrice"))
|
|
{
|
|
m_fixedPrice = jsonValue.GetDouble("fixedPrice");
|
|
|
|
}
|
|
|
|
if(jsonValue.ValueExists("offeringDescription"))
|
|
{
|
|
m_offeringDescription = jsonValue.GetString("offeringDescription");
|
|
|
|
}
|
|
|
|
if(jsonValue.ValueExists("offeringId"))
|
|
{
|
|
m_offeringId = jsonValue.GetString("offeringId");
|
|
|
|
}
|
|
|
|
if(jsonValue.ValueExists("offeringType"))
|
|
{
|
|
m_offeringType = OfferingTypeMapper::GetOfferingTypeForName(jsonValue.GetString("offeringType"));
|
|
|
|
}
|
|
|
|
if(jsonValue.ValueExists("region"))
|
|
{
|
|
m_region = jsonValue.GetString("region");
|
|
|
|
}
|
|
|
|
if(jsonValue.ValueExists("resourceSpecification"))
|
|
{
|
|
m_resourceSpecification = jsonValue.GetObject("resourceSpecification");
|
|
|
|
}
|
|
|
|
if(jsonValue.ValueExists("usagePrice"))
|
|
{
|
|
m_usagePrice = jsonValue.GetDouble("usagePrice");
|
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
}
|