diff --git a/CHANGELOG b/CHANGELOG index eeb27fefe..7610cbaf9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2020-10-09 Version: patch +- Update DescribeCdnUserBillHistory API. + 2020-10-09 Version: patch - Update SetVideoSeekConfig API. diff --git a/cdn/CMakeLists.txt b/cdn/CMakeLists.txt index fc8898e67..a52d1ed2b 100644 --- a/cdn/CMakeLists.txt +++ b/cdn/CMakeLists.txt @@ -103,6 +103,8 @@ set(cdn_public_header_model include/alibabacloud/cdn/model/DescribeCdnServiceResult.h include/alibabacloud/cdn/model/DescribeCdnTypesRequest.h include/alibabacloud/cdn/model/DescribeCdnTypesResult.h + include/alibabacloud/cdn/model/DescribeCdnUserBillHistoryRequest.h + include/alibabacloud/cdn/model/DescribeCdnUserBillHistoryResult.h include/alibabacloud/cdn/model/DescribeCdnUserBillPredictionRequest.h include/alibabacloud/cdn/model/DescribeCdnUserBillPredictionResult.h include/alibabacloud/cdn/model/DescribeCdnUserBillTypeRequest.h @@ -500,6 +502,8 @@ set(cdn_src src/model/DescribeCdnServiceResult.cc src/model/DescribeCdnTypesRequest.cc src/model/DescribeCdnTypesResult.cc + src/model/DescribeCdnUserBillHistoryRequest.cc + src/model/DescribeCdnUserBillHistoryResult.cc src/model/DescribeCdnUserBillPredictionRequest.cc src/model/DescribeCdnUserBillPredictionResult.cc src/model/DescribeCdnUserBillTypeRequest.cc diff --git a/cdn/include/alibabacloud/cdn/CdnClient.h b/cdn/include/alibabacloud/cdn/CdnClient.h index 8e12bbd6a..7de9dc3c1 100644 --- a/cdn/include/alibabacloud/cdn/CdnClient.h +++ b/cdn/include/alibabacloud/cdn/CdnClient.h @@ -104,6 +104,8 @@ #include "model/DescribeCdnServiceResult.h" #include "model/DescribeCdnTypesRequest.h" #include "model/DescribeCdnTypesResult.h" +#include "model/DescribeCdnUserBillHistoryRequest.h" +#include "model/DescribeCdnUserBillHistoryResult.h" #include "model/DescribeCdnUserBillPredictionRequest.h" #include "model/DescribeCdnUserBillPredictionResult.h" #include "model/DescribeCdnUserBillTypeRequest.h" @@ -548,6 +550,9 @@ namespace AlibabaCloud typedef Outcome DescribeCdnTypesOutcome; typedef std::future DescribeCdnTypesOutcomeCallable; typedef std::function&)> DescribeCdnTypesAsyncHandler; + typedef Outcome DescribeCdnUserBillHistoryOutcome; + typedef std::future DescribeCdnUserBillHistoryOutcomeCallable; + typedef std::function&)> DescribeCdnUserBillHistoryAsyncHandler; typedef Outcome DescribeCdnUserBillPredictionOutcome; typedef std::future DescribeCdnUserBillPredictionOutcomeCallable; typedef std::function&)> DescribeCdnUserBillPredictionAsyncHandler; @@ -1144,6 +1149,9 @@ namespace AlibabaCloud DescribeCdnTypesOutcome describeCdnTypes(const Model::DescribeCdnTypesRequest &request)const; void describeCdnTypesAsync(const Model::DescribeCdnTypesRequest& request, const DescribeCdnTypesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeCdnTypesOutcomeCallable describeCdnTypesCallable(const Model::DescribeCdnTypesRequest& request) const; + DescribeCdnUserBillHistoryOutcome describeCdnUserBillHistory(const Model::DescribeCdnUserBillHistoryRequest &request)const; + void describeCdnUserBillHistoryAsync(const Model::DescribeCdnUserBillHistoryRequest& request, const DescribeCdnUserBillHistoryAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeCdnUserBillHistoryOutcomeCallable describeCdnUserBillHistoryCallable(const Model::DescribeCdnUserBillHistoryRequest& request) const; DescribeCdnUserBillPredictionOutcome describeCdnUserBillPrediction(const Model::DescribeCdnUserBillPredictionRequest &request)const; void describeCdnUserBillPredictionAsync(const Model::DescribeCdnUserBillPredictionRequest& request, const DescribeCdnUserBillPredictionAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeCdnUserBillPredictionOutcomeCallable describeCdnUserBillPredictionCallable(const Model::DescribeCdnUserBillPredictionRequest& request) const; diff --git a/cdn/include/alibabacloud/cdn/model/DescribeCdnUserBillHistoryRequest.h b/cdn/include/alibabacloud/cdn/model/DescribeCdnUserBillHistoryRequest.h new file mode 100644 index 000000000..a9df2f685 --- /dev/null +++ b/cdn/include/alibabacloud/cdn/model/DescribeCdnUserBillHistoryRequest.h @@ -0,0 +1,54 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_CDN_MODEL_DESCRIBECDNUSERBILLHISTORYREQUEST_H_ +#define ALIBABACLOUD_CDN_MODEL_DESCRIBECDNUSERBILLHISTORYREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cdn + { + namespace Model + { + class ALIBABACLOUD_CDN_EXPORT DescribeCdnUserBillHistoryRequest : public RpcServiceRequest + { + + public: + DescribeCdnUserBillHistoryRequest(); + ~DescribeCdnUserBillHistoryRequest(); + + std::string getStartTime()const; + void setStartTime(const std::string& startTime); + std::string getEndTime()const; + void setEndTime(const std::string& endTime); + long getOwnerId()const; + void setOwnerId(long ownerId); + + private: + std::string startTime_; + std::string endTime_; + long ownerId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CDN_MODEL_DESCRIBECDNUSERBILLHISTORYREQUEST_H_ \ No newline at end of file diff --git a/cdn/include/alibabacloud/cdn/model/DescribeCdnUserBillHistoryResult.h b/cdn/include/alibabacloud/cdn/model/DescribeCdnUserBillHistoryResult.h new file mode 100644 index 000000000..9dff0263d --- /dev/null +++ b/cdn/include/alibabacloud/cdn/model/DescribeCdnUserBillHistoryResult.h @@ -0,0 +1,66 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_CDN_MODEL_DESCRIBECDNUSERBILLHISTORYRESULT_H_ +#define ALIBABACLOUD_CDN_MODEL_DESCRIBECDNUSERBILLHISTORYRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cdn + { + namespace Model + { + class ALIBABACLOUD_CDN_EXPORT DescribeCdnUserBillHistoryResult : public ServiceResult + { + public: + struct BillHistoryDataItem + { + struct BillingDataItem + { + std::string chargeType; + float bandwidth; + std::string cdnRegion; + float count; + float flow; + }; + std::string billType; + std::string billTime; + std::vector billingData; + std::string dimension; + }; + + + DescribeCdnUserBillHistoryResult(); + explicit DescribeCdnUserBillHistoryResult(const std::string &payload); + ~DescribeCdnUserBillHistoryResult(); + std::vector getBillHistoryData()const; + + protected: + void parse(const std::string &payload); + private: + std::vector billHistoryData_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CDN_MODEL_DESCRIBECDNUSERBILLHISTORYRESULT_H_ \ No newline at end of file diff --git a/cdn/src/CdnClient.cc b/cdn/src/CdnClient.cc index 59b9e299d..fa1ac2a88 100644 --- a/cdn/src/CdnClient.cc +++ b/cdn/src/CdnClient.cc @@ -1527,6 +1527,42 @@ CdnClient::DescribeCdnTypesOutcomeCallable CdnClient::describeCdnTypesCallable(c return task->get_future(); } +CdnClient::DescribeCdnUserBillHistoryOutcome CdnClient::describeCdnUserBillHistory(const DescribeCdnUserBillHistoryRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeCdnUserBillHistoryOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeCdnUserBillHistoryOutcome(DescribeCdnUserBillHistoryResult(outcome.result())); + else + return DescribeCdnUserBillHistoryOutcome(outcome.error()); +} + +void CdnClient::describeCdnUserBillHistoryAsync(const DescribeCdnUserBillHistoryRequest& request, const DescribeCdnUserBillHistoryAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeCdnUserBillHistory(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CdnClient::DescribeCdnUserBillHistoryOutcomeCallable CdnClient::describeCdnUserBillHistoryCallable(const DescribeCdnUserBillHistoryRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeCdnUserBillHistory(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + CdnClient::DescribeCdnUserBillPredictionOutcome CdnClient::describeCdnUserBillPrediction(const DescribeCdnUserBillPredictionRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/cdn/src/model/DescribeCdnUserBillHistoryRequest.cc b/cdn/src/model/DescribeCdnUserBillHistoryRequest.cc new file mode 100644 index 000000000..f2e49ee6d --- /dev/null +++ b/cdn/src/model/DescribeCdnUserBillHistoryRequest.cc @@ -0,0 +1,62 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Cdn::Model::DescribeCdnUserBillHistoryRequest; + +DescribeCdnUserBillHistoryRequest::DescribeCdnUserBillHistoryRequest() : + RpcServiceRequest("cdn", "2018-05-10", "DescribeCdnUserBillHistory") +{ + setMethod(HttpRequest::Method::Post); +} + +DescribeCdnUserBillHistoryRequest::~DescribeCdnUserBillHistoryRequest() +{} + +std::string DescribeCdnUserBillHistoryRequest::getStartTime()const +{ + return startTime_; +} + +void DescribeCdnUserBillHistoryRequest::setStartTime(const std::string& startTime) +{ + startTime_ = startTime; + setParameter("StartTime", startTime); +} + +std::string DescribeCdnUserBillHistoryRequest::getEndTime()const +{ + return endTime_; +} + +void DescribeCdnUserBillHistoryRequest::setEndTime(const std::string& endTime) +{ + endTime_ = endTime; + setParameter("EndTime", endTime); +} + +long DescribeCdnUserBillHistoryRequest::getOwnerId()const +{ + return ownerId_; +} + +void DescribeCdnUserBillHistoryRequest::setOwnerId(long ownerId) +{ + ownerId_ = ownerId; + setParameter("OwnerId", std::to_string(ownerId)); +} + diff --git a/cdn/src/model/DescribeCdnUserBillHistoryResult.cc b/cdn/src/model/DescribeCdnUserBillHistoryResult.cc new file mode 100644 index 000000000..83eb51dbb --- /dev/null +++ b/cdn/src/model/DescribeCdnUserBillHistoryResult.cc @@ -0,0 +1,77 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Cdn; +using namespace AlibabaCloud::Cdn::Model; + +DescribeCdnUserBillHistoryResult::DescribeCdnUserBillHistoryResult() : + ServiceResult() +{} + +DescribeCdnUserBillHistoryResult::DescribeCdnUserBillHistoryResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeCdnUserBillHistoryResult::~DescribeCdnUserBillHistoryResult() +{} + +void DescribeCdnUserBillHistoryResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allBillHistoryDataNode = value["BillHistoryData"]["BillHistoryDataItem"]; + for (auto valueBillHistoryDataBillHistoryDataItem : allBillHistoryDataNode) + { + BillHistoryDataItem billHistoryDataObject; + if(!valueBillHistoryDataBillHistoryDataItem["Dimension"].isNull()) + billHistoryDataObject.dimension = valueBillHistoryDataBillHistoryDataItem["Dimension"].asString(); + if(!valueBillHistoryDataBillHistoryDataItem["BillType"].isNull()) + billHistoryDataObject.billType = valueBillHistoryDataBillHistoryDataItem["BillType"].asString(); + if(!valueBillHistoryDataBillHistoryDataItem["BillTime"].isNull()) + billHistoryDataObject.billTime = valueBillHistoryDataBillHistoryDataItem["BillTime"].asString(); + auto allBillingDataNode = allBillHistoryDataNode["BillingData"]["BillingDataItem"]; + for (auto allBillHistoryDataNodeBillingDataBillingDataItem : allBillingDataNode) + { + BillHistoryDataItem::BillingDataItem billingDataObject; + if(!allBillHistoryDataNodeBillingDataBillingDataItem["ChargeType"].isNull()) + billingDataObject.chargeType = allBillHistoryDataNodeBillingDataBillingDataItem["ChargeType"].asString(); + if(!allBillHistoryDataNodeBillingDataBillingDataItem["CdnRegion"].isNull()) + billingDataObject.cdnRegion = allBillHistoryDataNodeBillingDataBillingDataItem["CdnRegion"].asString(); + if(!allBillHistoryDataNodeBillingDataBillingDataItem["Bandwidth"].isNull()) + billingDataObject.bandwidth = std::stof(allBillHistoryDataNodeBillingDataBillingDataItem["Bandwidth"].asString()); + if(!allBillHistoryDataNodeBillingDataBillingDataItem["Flow"].isNull()) + billingDataObject.flow = std::stof(allBillHistoryDataNodeBillingDataBillingDataItem["Flow"].asString()); + if(!allBillHistoryDataNodeBillingDataBillingDataItem["Count"].isNull()) + billingDataObject.count = std::stof(allBillHistoryDataNodeBillingDataBillingDataItem["Count"].asString()); + billHistoryDataObject.billingData.push_back(billingDataObject); + } + billHistoryData_.push_back(billHistoryDataObject); + } + +} + +std::vector DescribeCdnUserBillHistoryResult::getBillHistoryData()const +{ + return billHistoryData_; +} +