Update DescribeCdnUserBillHistory API.
This commit is contained in:
62
cdn/src/model/DescribeCdnUserBillHistoryRequest.cc
Normal file
62
cdn/src/model/DescribeCdnUserBillHistoryRequest.cc
Normal file
@@ -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 <alibabacloud/cdn/model/DescribeCdnUserBillHistoryRequest.h>
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
77
cdn/src/model/DescribeCdnUserBillHistoryResult.cc
Normal file
77
cdn/src/model/DescribeCdnUserBillHistoryResult.cc
Normal file
@@ -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 <alibabacloud/cdn/model/DescribeCdnUserBillHistoryResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
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::BillHistoryDataItem> DescribeCdnUserBillHistoryResult::getBillHistoryData()const
|
||||
{
|
||||
return billHistoryData_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user