Add DistributionProducts API.
This commit is contained in:
@@ -29,6 +29,8 @@ set(market_public_header_model
|
||||
include/alibabacloud/market/model/CreateOrderResult.h
|
||||
include/alibabacloud/market/model/CrossAccountVerifyTokenRequest.h
|
||||
include/alibabacloud/market/model/CrossAccountVerifyTokenResult.h
|
||||
include/alibabacloud/market/model/DescribeApiMeteringRequest.h
|
||||
include/alibabacloud/market/model/DescribeApiMeteringResult.h
|
||||
include/alibabacloud/market/model/DescribeCurrentNodeInfoRequest.h
|
||||
include/alibabacloud/market/model/DescribeCurrentNodeInfoResult.h
|
||||
include/alibabacloud/market/model/DescribeDistributionProductsRequest.h
|
||||
@@ -80,6 +82,8 @@ set(market_src
|
||||
src/model/CreateOrderResult.cc
|
||||
src/model/CrossAccountVerifyTokenRequest.cc
|
||||
src/model/CrossAccountVerifyTokenResult.cc
|
||||
src/model/DescribeApiMeteringRequest.cc
|
||||
src/model/DescribeApiMeteringResult.cc
|
||||
src/model/DescribeCurrentNodeInfoRequest.cc
|
||||
src/model/DescribeCurrentNodeInfoResult.cc
|
||||
src/model/DescribeDistributionProductsRequest.cc
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "model/CreateOrderResult.h"
|
||||
#include "model/CrossAccountVerifyTokenRequest.h"
|
||||
#include "model/CrossAccountVerifyTokenResult.h"
|
||||
#include "model/DescribeApiMeteringRequest.h"
|
||||
#include "model/DescribeApiMeteringResult.h"
|
||||
#include "model/DescribeCurrentNodeInfoRequest.h"
|
||||
#include "model/DescribeCurrentNodeInfoResult.h"
|
||||
#include "model/DescribeDistributionProductsRequest.h"
|
||||
@@ -91,6 +93,9 @@ namespace AlibabaCloud
|
||||
typedef Outcome<Error, Model::CrossAccountVerifyTokenResult> CrossAccountVerifyTokenOutcome;
|
||||
typedef std::future<CrossAccountVerifyTokenOutcome> CrossAccountVerifyTokenOutcomeCallable;
|
||||
typedef std::function<void(const MarketClient*, const Model::CrossAccountVerifyTokenRequest&, const CrossAccountVerifyTokenOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CrossAccountVerifyTokenAsyncHandler;
|
||||
typedef Outcome<Error, Model::DescribeApiMeteringResult> DescribeApiMeteringOutcome;
|
||||
typedef std::future<DescribeApiMeteringOutcome> DescribeApiMeteringOutcomeCallable;
|
||||
typedef std::function<void(const MarketClient*, const Model::DescribeApiMeteringRequest&, const DescribeApiMeteringOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeApiMeteringAsyncHandler;
|
||||
typedef Outcome<Error, Model::DescribeCurrentNodeInfoResult> DescribeCurrentNodeInfoOutcome;
|
||||
typedef std::future<DescribeCurrentNodeInfoOutcome> DescribeCurrentNodeInfoOutcomeCallable;
|
||||
typedef std::function<void(const MarketClient*, const Model::DescribeCurrentNodeInfoRequest&, const DescribeCurrentNodeInfoOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeCurrentNodeInfoAsyncHandler;
|
||||
@@ -168,6 +173,9 @@ namespace AlibabaCloud
|
||||
CrossAccountVerifyTokenOutcome crossAccountVerifyToken(const Model::CrossAccountVerifyTokenRequest &request)const;
|
||||
void crossAccountVerifyTokenAsync(const Model::CrossAccountVerifyTokenRequest& request, const CrossAccountVerifyTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
CrossAccountVerifyTokenOutcomeCallable crossAccountVerifyTokenCallable(const Model::CrossAccountVerifyTokenRequest& request) const;
|
||||
DescribeApiMeteringOutcome describeApiMetering(const Model::DescribeApiMeteringRequest &request)const;
|
||||
void describeApiMeteringAsync(const Model::DescribeApiMeteringRequest& request, const DescribeApiMeteringAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
DescribeApiMeteringOutcomeCallable describeApiMeteringCallable(const Model::DescribeApiMeteringRequest& request) const;
|
||||
DescribeCurrentNodeInfoOutcome describeCurrentNodeInfo(const Model::DescribeCurrentNodeInfoRequest &request)const;
|
||||
void describeCurrentNodeInfoAsync(const Model::DescribeCurrentNodeInfoRequest& request, const DescribeCurrentNodeInfoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
DescribeCurrentNodeInfoOutcomeCallable describeCurrentNodeInfoCallable(const Model::DescribeCurrentNodeInfoRequest& request) const;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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_MARKET_MODEL_DESCRIBEAPIMETERINGREQUEST_H_
|
||||
#define ALIBABACLOUD_MARKET_MODEL_DESCRIBEAPIMETERINGREQUEST_H_
|
||||
|
||||
#include <alibabacloud/market/MarketExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace Market {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_MARKET_EXPORT DescribeApiMeteringRequest : public RpcServiceRequest {
|
||||
public:
|
||||
DescribeApiMeteringRequest();
|
||||
~DescribeApiMeteringRequest();
|
||||
std::string getProductCode() const;
|
||||
void setProductCode(const std::string &productCode);
|
||||
int getType() const;
|
||||
void setType(int type);
|
||||
int getPageNum() const;
|
||||
void setPageNum(int pageNum);
|
||||
|
||||
private:
|
||||
std::string productCode_;
|
||||
int type_;
|
||||
int pageNum_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Market
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_MARKET_MODEL_DESCRIBEAPIMETERINGREQUEST_H_
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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_MARKET_MODEL_DESCRIBEAPIMETERINGRESULT_H_
|
||||
#define ALIBABACLOUD_MARKET_MODEL_DESCRIBEAPIMETERINGRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/market/MarketExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Market
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_MARKET_EXPORT DescribeApiMeteringResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct ResultItem
|
||||
{
|
||||
std::string productName;
|
||||
long aliyunPk;
|
||||
std::string productCode;
|
||||
long totalQuota;
|
||||
long totalUsage;
|
||||
std::string unit;
|
||||
};
|
||||
|
||||
|
||||
DescribeApiMeteringResult();
|
||||
explicit DescribeApiMeteringResult(const std::string &payload);
|
||||
~DescribeApiMeteringResult();
|
||||
long getPageSize()const;
|
||||
std::string getMessage()const;
|
||||
long getPageNumber()const;
|
||||
std::string getVersion()const;
|
||||
long getCount()const;
|
||||
bool getFatal()const;
|
||||
std::string getCode()const;
|
||||
bool getSuccess()const;
|
||||
std::vector<ResultItem> getResult()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
long pageSize_;
|
||||
std::string message_;
|
||||
long pageNumber_;
|
||||
std::string version_;
|
||||
long count_;
|
||||
bool fatal_;
|
||||
std::string code_;
|
||||
bool success_;
|
||||
std::vector<ResultItem> result_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_MARKET_MODEL_DESCRIBEAPIMETERINGRESULT_H_
|
||||
@@ -195,6 +195,42 @@ MarketClient::CrossAccountVerifyTokenOutcomeCallable MarketClient::crossAccountV
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
MarketClient::DescribeApiMeteringOutcome MarketClient::describeApiMetering(const DescribeApiMeteringRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return DescribeApiMeteringOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return DescribeApiMeteringOutcome(DescribeApiMeteringResult(outcome.result()));
|
||||
else
|
||||
return DescribeApiMeteringOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void MarketClient::describeApiMeteringAsync(const DescribeApiMeteringRequest& request, const DescribeApiMeteringAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, describeApiMetering(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
MarketClient::DescribeApiMeteringOutcomeCallable MarketClient::describeApiMeteringCallable(const DescribeApiMeteringRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<DescribeApiMeteringOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->describeApiMetering(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
MarketClient::DescribeCurrentNodeInfoOutcome MarketClient::describeCurrentNodeInfo(const DescribeCurrentNodeInfoRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
54
market/src/model/DescribeApiMeteringRequest.cc
Normal file
54
market/src/model/DescribeApiMeteringRequest.cc
Normal file
@@ -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.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/market/model/DescribeApiMeteringRequest.h>
|
||||
|
||||
using AlibabaCloud::Market::Model::DescribeApiMeteringRequest;
|
||||
|
||||
DescribeApiMeteringRequest::DescribeApiMeteringRequest()
|
||||
: RpcServiceRequest("market", "2015-11-01", "DescribeApiMetering") {
|
||||
setMethod(HttpRequest::Method::Get);
|
||||
}
|
||||
|
||||
DescribeApiMeteringRequest::~DescribeApiMeteringRequest() {}
|
||||
|
||||
std::string DescribeApiMeteringRequest::getProductCode() const {
|
||||
return productCode_;
|
||||
}
|
||||
|
||||
void DescribeApiMeteringRequest::setProductCode(const std::string &productCode) {
|
||||
productCode_ = productCode;
|
||||
setParameter(std::string("productCode"), productCode);
|
||||
}
|
||||
|
||||
int DescribeApiMeteringRequest::getType() const {
|
||||
return type_;
|
||||
}
|
||||
|
||||
void DescribeApiMeteringRequest::setType(int type) {
|
||||
type_ = type;
|
||||
setParameter(std::string("type"), std::to_string(type));
|
||||
}
|
||||
|
||||
int DescribeApiMeteringRequest::getPageNum() const {
|
||||
return pageNum_;
|
||||
}
|
||||
|
||||
void DescribeApiMeteringRequest::setPageNum(int pageNum) {
|
||||
pageNum_ = pageNum;
|
||||
setParameter(std::string("pageNum"), std::to_string(pageNum));
|
||||
}
|
||||
|
||||
123
market/src/model/DescribeApiMeteringResult.cc
Normal file
123
market/src/model/DescribeApiMeteringResult.cc
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* 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/market/model/DescribeApiMeteringResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Market;
|
||||
using namespace AlibabaCloud::Market::Model;
|
||||
|
||||
DescribeApiMeteringResult::DescribeApiMeteringResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
DescribeApiMeteringResult::DescribeApiMeteringResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
DescribeApiMeteringResult::~DescribeApiMeteringResult()
|
||||
{}
|
||||
|
||||
void DescribeApiMeteringResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allResultNode = value["Result"]["resultItem"];
|
||||
for (auto valueResultresultItem : allResultNode)
|
||||
{
|
||||
ResultItem resultObject;
|
||||
if(!valueResultresultItem["AliyunPk"].isNull())
|
||||
resultObject.aliyunPk = std::stol(valueResultresultItem["AliyunPk"].asString());
|
||||
if(!valueResultresultItem["ProductCode"].isNull())
|
||||
resultObject.productCode = valueResultresultItem["ProductCode"].asString();
|
||||
if(!valueResultresultItem["ProductName"].isNull())
|
||||
resultObject.productName = valueResultresultItem["ProductName"].asString();
|
||||
if(!valueResultresultItem["TotalQuota"].isNull())
|
||||
resultObject.totalQuota = std::stol(valueResultresultItem["TotalQuota"].asString());
|
||||
if(!valueResultresultItem["TotalUsage"].isNull())
|
||||
resultObject.totalUsage = std::stol(valueResultresultItem["TotalUsage"].asString());
|
||||
if(!valueResultresultItem["Unit"].isNull())
|
||||
resultObject.unit = valueResultresultItem["Unit"].asString();
|
||||
result_.push_back(resultObject);
|
||||
}
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
if(!value["PageNumber"].isNull())
|
||||
pageNumber_ = std::stol(value["PageNumber"].asString());
|
||||
if(!value["Success"].isNull())
|
||||
success_ = value["Success"].asString() == "true";
|
||||
if(!value["Count"].isNull())
|
||||
count_ = std::stol(value["Count"].asString());
|
||||
if(!value["PageSize"].isNull())
|
||||
pageSize_ = std::stol(value["PageSize"].asString());
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
if(!value["Version"].isNull())
|
||||
version_ = value["Version"].asString();
|
||||
if(!value["Fatal"].isNull())
|
||||
fatal_ = value["Fatal"].asString() == "true";
|
||||
|
||||
}
|
||||
|
||||
long DescribeApiMeteringResult::getPageSize()const
|
||||
{
|
||||
return pageSize_;
|
||||
}
|
||||
|
||||
std::string DescribeApiMeteringResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
long DescribeApiMeteringResult::getPageNumber()const
|
||||
{
|
||||
return pageNumber_;
|
||||
}
|
||||
|
||||
std::string DescribeApiMeteringResult::getVersion()const
|
||||
{
|
||||
return version_;
|
||||
}
|
||||
|
||||
long DescribeApiMeteringResult::getCount()const
|
||||
{
|
||||
return count_;
|
||||
}
|
||||
|
||||
bool DescribeApiMeteringResult::getFatal()const
|
||||
{
|
||||
return fatal_;
|
||||
}
|
||||
|
||||
std::string DescribeApiMeteringResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
bool DescribeApiMeteringResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
std::vector<DescribeApiMeteringResult::ResultItem> DescribeApiMeteringResult::getResult()const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@ void DescribeDistributionProductsLinkResult::parse(const std::string &payload)
|
||||
for (auto valueResultitem : allResultNode)
|
||||
{
|
||||
Item resultObject;
|
||||
if(!valueResultitem["url"].isNull())
|
||||
resultObject.url = valueResultitem["url"].asString();
|
||||
if(!valueResultitem["code"].isNull())
|
||||
resultObject.code = valueResultitem["code"].asString();
|
||||
if(!valueResultitem["name"].isNull())
|
||||
resultObject.name = valueResultitem["name"].asString();
|
||||
if(!valueResultitem["Url"].isNull())
|
||||
resultObject.url = valueResultitem["Url"].asString();
|
||||
if(!valueResultitem["Code"].isNull())
|
||||
resultObject.code = valueResultitem["Code"].asString();
|
||||
if(!valueResultitem["Name"].isNull())
|
||||
resultObject.name = valueResultitem["Name"].asString();
|
||||
result_.push_back(resultObject);
|
||||
}
|
||||
if(!value["TotalCount"].isNull())
|
||||
|
||||
Reference in New Issue
Block a user