feat(hos_client_create, hos_client_destory): 多次调用destory不会导致重复释放

This commit is contained in:
彭宣正
2020-12-14 17:24:58 +08:00
parent 505d529c32
commit 10b370e486
55976 changed files with 8544395 additions and 2 deletions

View File

@@ -0,0 +1,76 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/forecastquery/model/DataPoint.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace ForecastQueryService
{
namespace Model
{
DataPoint::DataPoint() :
m_timestampHasBeenSet(false),
m_value(0.0),
m_valueHasBeenSet(false)
{
}
DataPoint::DataPoint(JsonView jsonValue) :
m_timestampHasBeenSet(false),
m_value(0.0),
m_valueHasBeenSet(false)
{
*this = jsonValue;
}
DataPoint& DataPoint::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Timestamp"))
{
m_timestamp = jsonValue.GetString("Timestamp");
m_timestampHasBeenSet = true;
}
if(jsonValue.ValueExists("Value"))
{
m_value = jsonValue.GetDouble("Value");
m_valueHasBeenSet = true;
}
return *this;
}
JsonValue DataPoint::Jsonize() const
{
JsonValue payload;
if(m_timestampHasBeenSet)
{
payload.WithString("Timestamp", m_timestamp);
}
if(m_valueHasBeenSet)
{
payload.WithDouble("Value", m_value);
}
return payload;
}
} // namespace Model
} // namespace ForecastQueryService
} // namespace Aws

View File

@@ -0,0 +1,79 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/forecastquery/model/Forecast.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace ForecastQueryService
{
namespace Model
{
Forecast::Forecast() :
m_predictionsHasBeenSet(false)
{
}
Forecast::Forecast(JsonView jsonValue) :
m_predictionsHasBeenSet(false)
{
*this = jsonValue;
}
Forecast& Forecast::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Predictions"))
{
Aws::Map<Aws::String, JsonView> predictionsJsonMap = jsonValue.GetObject("Predictions").GetAllObjects();
for(auto& predictionsItem : predictionsJsonMap)
{
Array<JsonView> timeSeriesJsonList = predictionsItem.second.AsArray();
Aws::Vector<DataPoint> timeSeriesList;
timeSeriesList.reserve((size_t)timeSeriesJsonList.GetLength());
for(unsigned timeSeriesIndex = 0; timeSeriesIndex < timeSeriesJsonList.GetLength(); ++timeSeriesIndex)
{
timeSeriesList.push_back(timeSeriesJsonList[timeSeriesIndex].AsObject());
}
m_predictions[predictionsItem.first] = std::move(timeSeriesList);
}
m_predictionsHasBeenSet = true;
}
return *this;
}
JsonValue Forecast::Jsonize() const
{
JsonValue payload;
if(m_predictionsHasBeenSet)
{
JsonValue predictionsJsonMap;
for(auto& predictionsItem : m_predictions)
{
Array<JsonValue> timeSeriesJsonList(predictionsItem.second.size());
for(unsigned timeSeriesIndex = 0; timeSeriesIndex < timeSeriesJsonList.GetLength(); ++timeSeriesIndex)
{
timeSeriesJsonList[timeSeriesIndex].AsObject(predictionsItem.second[timeSeriesIndex].Jsonize());
}
predictionsJsonMap.WithArray(predictionsItem.first, std::move(timeSeriesJsonList));
}
payload.WithObject("Predictions", std::move(predictionsJsonMap));
}
return payload;
}
} // namespace Model
} // namespace ForecastQueryService
} // namespace Aws

View File

@@ -0,0 +1,76 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/forecastquery/model/QueryForecastRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::ForecastQueryService::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
QueryForecastRequest::QueryForecastRequest() :
m_forecastArnHasBeenSet(false),
m_startDateHasBeenSet(false),
m_endDateHasBeenSet(false),
m_filtersHasBeenSet(false),
m_nextTokenHasBeenSet(false)
{
}
Aws::String QueryForecastRequest::SerializePayload() const
{
JsonValue payload;
if(m_forecastArnHasBeenSet)
{
payload.WithString("ForecastArn", m_forecastArn);
}
if(m_startDateHasBeenSet)
{
payload.WithString("StartDate", m_startDate);
}
if(m_endDateHasBeenSet)
{
payload.WithString("EndDate", m_endDate);
}
if(m_filtersHasBeenSet)
{
JsonValue filtersJsonMap;
for(auto& filtersItem : m_filters)
{
filtersJsonMap.WithString(filtersItem.first, filtersItem.second);
}
payload.WithObject("Filters", std::move(filtersJsonMap));
}
if(m_nextTokenHasBeenSet)
{
payload.WithString("NextToken", m_nextToken);
}
return payload.View().WriteReadable();
}
Aws::Http::HeaderValueCollection QueryForecastRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AmazonForecastRuntime.QueryForecast"));
return headers;
}

View File

@@ -0,0 +1,40 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/forecastquery/model/QueryForecastResult.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::ForecastQueryService::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
QueryForecastResult::QueryForecastResult()
{
}
QueryForecastResult::QueryForecastResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
QueryForecastResult& QueryForecastResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("Forecast"))
{
m_forecast = jsonValue.GetObject("Forecast");
}
return *this;
}