diff --git a/CHANGELOG b/CHANGELOG index 604934b52..7c9c4f446 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +2020-04-09 Version: 1.36.343 +- Generated 2015-01-01 for `R-kvstore`. +- Add DescribePrice API. + 2020-04-08 Version: 1.36.342 - Add SubCode for DescribeFaceVerify. diff --git a/VERSION b/VERSION index c4b18efb9..267ca32e1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.342 \ No newline at end of file +1.36.343 \ No newline at end of file diff --git a/r-kvstore/CMakeLists.txt b/r-kvstore/CMakeLists.txt index 2221b7334..2c127f0f3 100644 --- a/r-kvstore/CMakeLists.txt +++ b/r-kvstore/CMakeLists.txt @@ -83,6 +83,8 @@ set(r-kvstore_public_header_model include/alibabacloud/r-kvstore/model/DescribeMonitorItemsResult.h include/alibabacloud/r-kvstore/model/DescribeParametersRequest.h include/alibabacloud/r-kvstore/model/DescribeParametersResult.h + include/alibabacloud/r-kvstore/model/DescribePriceRequest.h + include/alibabacloud/r-kvstore/model/DescribePriceResult.h include/alibabacloud/r-kvstore/model/DescribeRegionsRequest.h include/alibabacloud/r-kvstore/model/DescribeRegionsResult.h include/alibabacloud/r-kvstore/model/DescribeRunningLogRecordsRequest.h @@ -234,6 +236,8 @@ set(r-kvstore_src src/model/DescribeMonitorItemsResult.cc src/model/DescribeParametersRequest.cc src/model/DescribeParametersResult.cc + src/model/DescribePriceRequest.cc + src/model/DescribePriceResult.cc src/model/DescribeRegionsRequest.cc src/model/DescribeRegionsResult.cc src/model/DescribeRunningLogRecordsRequest.cc diff --git a/r-kvstore/include/alibabacloud/r-kvstore/R_kvstoreClient.h b/r-kvstore/include/alibabacloud/r-kvstore/R_kvstoreClient.h index 8b68ca693..1ad30ac1d 100644 --- a/r-kvstore/include/alibabacloud/r-kvstore/R_kvstoreClient.h +++ b/r-kvstore/include/alibabacloud/r-kvstore/R_kvstoreClient.h @@ -84,6 +84,8 @@ #include "model/DescribeMonitorItemsResult.h" #include "model/DescribeParametersRequest.h" #include "model/DescribeParametersResult.h" +#include "model/DescribePriceRequest.h" +#include "model/DescribePriceResult.h" #include "model/DescribeRegionsRequest.h" #include "model/DescribeRegionsResult.h" #include "model/DescribeRunningLogRecordsRequest.h" @@ -272,6 +274,9 @@ namespace AlibabaCloud typedef Outcome DescribeParametersOutcome; typedef std::future DescribeParametersOutcomeCallable; typedef std::function&)> DescribeParametersAsyncHandler; + typedef Outcome DescribePriceOutcome; + typedef std::future DescribePriceOutcomeCallable; + typedef std::function&)> DescribePriceAsyncHandler; typedef Outcome DescribeRegionsOutcome; typedef std::future DescribeRegionsOutcomeCallable; typedef std::function&)> DescribeRegionsAsyncHandler; @@ -499,6 +504,9 @@ namespace AlibabaCloud DescribeParametersOutcome describeParameters(const Model::DescribeParametersRequest &request)const; void describeParametersAsync(const Model::DescribeParametersRequest& request, const DescribeParametersAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeParametersOutcomeCallable describeParametersCallable(const Model::DescribeParametersRequest& request) const; + DescribePriceOutcome describePrice(const Model::DescribePriceRequest &request)const; + void describePriceAsync(const Model::DescribePriceRequest& request, const DescribePriceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribePriceOutcomeCallable describePriceCallable(const Model::DescribePriceRequest& request) const; DescribeRegionsOutcome describeRegions(const Model::DescribeRegionsRequest &request)const; void describeRegionsAsync(const Model::DescribeRegionsRequest& request, const DescribeRegionsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeRegionsOutcomeCallable describeRegionsCallable(const Model::DescribeRegionsRequest& request) const; diff --git a/r-kvstore/include/alibabacloud/r-kvstore/model/DescribePriceRequest.h b/r-kvstore/include/alibabacloud/r-kvstore/model/DescribePriceRequest.h new file mode 100644 index 000000000..9b02cd99b --- /dev/null +++ b/r-kvstore/include/alibabacloud/r-kvstore/model/DescribePriceRequest.h @@ -0,0 +1,105 @@ +/* + * 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_R_KVSTORE_MODEL_DESCRIBEPRICEREQUEST_H_ +#define ALIBABACLOUD_R_KVSTORE_MODEL_DESCRIBEPRICEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace R_kvstore + { + namespace Model + { + class ALIBABACLOUD_R_KVSTORE_EXPORT DescribePriceRequest : public RpcServiceRequest + { + + public: + DescribePriceRequest(); + ~DescribePriceRequest(); + + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getNodeType()const; + void setNodeType(const std::string& nodeType); + std::string getInstances()const; + void setInstances(const std::string& instances); + std::string getCouponNo()const; + void setCouponNo(const std::string& couponNo); + std::string getInstanceClass()const; + void setInstanceClass(const std::string& instanceClass); + std::string getAccessKeyId()const; + void setAccessKeyId(const std::string& accessKeyId); + long getCapacity()const; + void setCapacity(long capacity); + std::string getSecurityToken()const; + void setSecurityToken(const std::string& securityToken); + std::string getBusinessInfo()const; + void setBusinessInfo(const std::string& businessInfo); + long getPeriod()const; + void setPeriod(long period); + long getQuantity()const; + void setQuantity(long quantity); + std::string getResourceOwnerAccount()const; + void setResourceOwnerAccount(const std::string& resourceOwnerAccount); + std::string getOwnerAccount()const; + void setOwnerAccount(const std::string& ownerAccount); + std::string getOrderParamOut()const; + void setOrderParamOut(const std::string& orderParamOut); + long getOwnerId()const; + void setOwnerId(long ownerId); + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + std::string getZoneId()const; + void setZoneId(const std::string& zoneId); + std::string getChargeType()const; + void setChargeType(const std::string& chargeType); + bool getForceUpgrade()const; + void setForceUpgrade(bool forceUpgrade); + std::string getOrderType()const; + void setOrderType(const std::string& orderType); + + private: + long resourceOwnerId_; + std::string nodeType_; + std::string instances_; + std::string couponNo_; + std::string instanceClass_; + std::string accessKeyId_; + long capacity_; + std::string securityToken_; + std::string businessInfo_; + long period_; + long quantity_; + std::string resourceOwnerAccount_; + std::string ownerAccount_; + std::string orderParamOut_; + long ownerId_; + std::string instanceId_; + std::string zoneId_; + std::string chargeType_; + bool forceUpgrade_; + std::string orderType_; + + }; + } + } +} +#endif // !ALIBABACLOUD_R_KVSTORE_MODEL_DESCRIBEPRICEREQUEST_H_ \ No newline at end of file diff --git a/r-kvstore/include/alibabacloud/r-kvstore/model/DescribePriceResult.h b/r-kvstore/include/alibabacloud/r-kvstore/model/DescribePriceResult.h new file mode 100644 index 000000000..79263e439 --- /dev/null +++ b/r-kvstore/include/alibabacloud/r-kvstore/model/DescribePriceResult.h @@ -0,0 +1,87 @@ +/* + * 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_R_KVSTORE_MODEL_DESCRIBEPRICERESULT_H_ +#define ALIBABACLOUD_R_KVSTORE_MODEL_DESCRIBEPRICERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace R_kvstore + { + namespace Model + { + class ALIBABACLOUD_R_KVSTORE_EXPORT DescribePriceResult : public ServiceResult + { + public: + struct Order + { + struct Coupon + { + std::string couponNo; + std::string description; + std::string isSelected; + std::string name; + }; + std::vector ruleIds1; + std::string currency; + float tradeAmount; + std::vector coupons; + float originalAmount; + float discountAmount; + }; + struct Rule + { + long ruleDescId; + std::string title; + std::string name; + }; + struct SubOrder + { + std::string instanceId; + std::vector ruleIds; + float tradeAmount; + float originalAmount; + float discountAmount; + }; + + + DescribePriceResult(); + explicit DescribePriceResult(const std::string &payload); + ~DescribePriceResult(); + Order getOrder()const; + std::vector getSubOrders()const; + std::string getOrderParams()const; + std::vector getRules()const; + + protected: + void parse(const std::string &payload); + private: + Order order_; + std::vector subOrders_; + std::string orderParams_; + std::vector rules_; + + }; + } + } +} +#endif // !ALIBABACLOUD_R_KVSTORE_MODEL_DESCRIBEPRICERESULT_H_ \ No newline at end of file diff --git a/r-kvstore/src/R-kvstoreClient.cc b/r-kvstore/src/R-kvstoreClient.cc index 1941b981a..7928507ca 100644 --- a/r-kvstore/src/R-kvstoreClient.cc +++ b/r-kvstore/src/R-kvstoreClient.cc @@ -1167,6 +1167,42 @@ R_kvstoreClient::DescribeParametersOutcomeCallable R_kvstoreClient::describePara return task->get_future(); } +R_kvstoreClient::DescribePriceOutcome R_kvstoreClient::describePrice(const DescribePriceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribePriceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribePriceOutcome(DescribePriceResult(outcome.result())); + else + return DescribePriceOutcome(outcome.error()); +} + +void R_kvstoreClient::describePriceAsync(const DescribePriceRequest& request, const DescribePriceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describePrice(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +R_kvstoreClient::DescribePriceOutcomeCallable R_kvstoreClient::describePriceCallable(const DescribePriceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describePrice(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + R_kvstoreClient::DescribeRegionsOutcome R_kvstoreClient::describeRegions(const DescribeRegionsRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/r-kvstore/src/model/DescribePriceRequest.cc b/r-kvstore/src/model/DescribePriceRequest.cc new file mode 100644 index 000000000..be186cd4f --- /dev/null +++ b/r-kvstore/src/model/DescribePriceRequest.cc @@ -0,0 +1,249 @@ +/* + * 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::R_kvstore::Model::DescribePriceRequest; + +DescribePriceRequest::DescribePriceRequest() : + RpcServiceRequest("r-kvstore", "2015-01-01", "DescribePrice") +{ + setMethod(HttpRequest::Method::Post); +} + +DescribePriceRequest::~DescribePriceRequest() +{} + +long DescribePriceRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void DescribePriceRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string DescribePriceRequest::getNodeType()const +{ + return nodeType_; +} + +void DescribePriceRequest::setNodeType(const std::string& nodeType) +{ + nodeType_ = nodeType; + setParameter("NodeType", nodeType); +} + +std::string DescribePriceRequest::getInstances()const +{ + return instances_; +} + +void DescribePriceRequest::setInstances(const std::string& instances) +{ + instances_ = instances; + setParameter("Instances", instances); +} + +std::string DescribePriceRequest::getCouponNo()const +{ + return couponNo_; +} + +void DescribePriceRequest::setCouponNo(const std::string& couponNo) +{ + couponNo_ = couponNo; + setParameter("CouponNo", couponNo); +} + +std::string DescribePriceRequest::getInstanceClass()const +{ + return instanceClass_; +} + +void DescribePriceRequest::setInstanceClass(const std::string& instanceClass) +{ + instanceClass_ = instanceClass; + setParameter("InstanceClass", instanceClass); +} + +std::string DescribePriceRequest::getAccessKeyId()const +{ + return accessKeyId_; +} + +void DescribePriceRequest::setAccessKeyId(const std::string& accessKeyId) +{ + accessKeyId_ = accessKeyId; + setParameter("AccessKeyId", accessKeyId); +} + +long DescribePriceRequest::getCapacity()const +{ + return capacity_; +} + +void DescribePriceRequest::setCapacity(long capacity) +{ + capacity_ = capacity; + setParameter("Capacity", std::to_string(capacity)); +} + +std::string DescribePriceRequest::getSecurityToken()const +{ + return securityToken_; +} + +void DescribePriceRequest::setSecurityToken(const std::string& securityToken) +{ + securityToken_ = securityToken; + setParameter("SecurityToken", securityToken); +} + +std::string DescribePriceRequest::getBusinessInfo()const +{ + return businessInfo_; +} + +void DescribePriceRequest::setBusinessInfo(const std::string& businessInfo) +{ + businessInfo_ = businessInfo; + setParameter("BusinessInfo", businessInfo); +} + +long DescribePriceRequest::getPeriod()const +{ + return period_; +} + +void DescribePriceRequest::setPeriod(long period) +{ + period_ = period; + setParameter("Period", std::to_string(period)); +} + +long DescribePriceRequest::getQuantity()const +{ + return quantity_; +} + +void DescribePriceRequest::setQuantity(long quantity) +{ + quantity_ = quantity; + setParameter("Quantity", std::to_string(quantity)); +} + +std::string DescribePriceRequest::getResourceOwnerAccount()const +{ + return resourceOwnerAccount_; +} + +void DescribePriceRequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount) +{ + resourceOwnerAccount_ = resourceOwnerAccount; + setParameter("ResourceOwnerAccount", resourceOwnerAccount); +} + +std::string DescribePriceRequest::getOwnerAccount()const +{ + return ownerAccount_; +} + +void DescribePriceRequest::setOwnerAccount(const std::string& ownerAccount) +{ + ownerAccount_ = ownerAccount; + setParameter("OwnerAccount", ownerAccount); +} + +std::string DescribePriceRequest::getOrderParamOut()const +{ + return orderParamOut_; +} + +void DescribePriceRequest::setOrderParamOut(const std::string& orderParamOut) +{ + orderParamOut_ = orderParamOut; + setParameter("OrderParamOut", orderParamOut); +} + +long DescribePriceRequest::getOwnerId()const +{ + return ownerId_; +} + +void DescribePriceRequest::setOwnerId(long ownerId) +{ + ownerId_ = ownerId; + setParameter("OwnerId", std::to_string(ownerId)); +} + +std::string DescribePriceRequest::getInstanceId()const +{ + return instanceId_; +} + +void DescribePriceRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string DescribePriceRequest::getZoneId()const +{ + return zoneId_; +} + +void DescribePriceRequest::setZoneId(const std::string& zoneId) +{ + zoneId_ = zoneId; + setParameter("ZoneId", zoneId); +} + +std::string DescribePriceRequest::getChargeType()const +{ + return chargeType_; +} + +void DescribePriceRequest::setChargeType(const std::string& chargeType) +{ + chargeType_ = chargeType; + setParameter("ChargeType", chargeType); +} + +bool DescribePriceRequest::getForceUpgrade()const +{ + return forceUpgrade_; +} + +void DescribePriceRequest::setForceUpgrade(bool forceUpgrade) +{ + forceUpgrade_ = forceUpgrade; + setParameter("ForceUpgrade", forceUpgrade ? "true" : "false"); +} + +std::string DescribePriceRequest::getOrderType()const +{ + return orderType_; +} + +void DescribePriceRequest::setOrderType(const std::string& orderType) +{ + orderType_ = orderType; + setParameter("OrderType", orderType); +} + diff --git a/r-kvstore/src/model/DescribePriceResult.cc b/r-kvstore/src/model/DescribePriceResult.cc new file mode 100644 index 000000000..cb239dfbb --- /dev/null +++ b/r-kvstore/src/model/DescribePriceResult.cc @@ -0,0 +1,121 @@ +/* + * 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::R_kvstore; +using namespace AlibabaCloud::R_kvstore::Model; + +DescribePriceResult::DescribePriceResult() : + ServiceResult() +{} + +DescribePriceResult::DescribePriceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribePriceResult::~DescribePriceResult() +{} + +void DescribePriceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allRulesNode = value["Rules"]["Rule"]; + for (auto valueRulesRule : allRulesNode) + { + Rule rulesObject; + if(!valueRulesRule["RuleDescId"].isNull()) + rulesObject.ruleDescId = std::stol(valueRulesRule["RuleDescId"].asString()); + if(!valueRulesRule["Name"].isNull()) + rulesObject.name = valueRulesRule["Name"].asString(); + if(!valueRulesRule["Title"].isNull()) + rulesObject.title = valueRulesRule["Title"].asString(); + rules_.push_back(rulesObject); + } + auto allSubOrdersNode = value["SubOrders"]["SubOrder"]; + for (auto valueSubOrdersSubOrder : allSubOrdersNode) + { + SubOrder subOrdersObject; + if(!valueSubOrdersSubOrder["OriginalAmount"].isNull()) + subOrdersObject.originalAmount = std::stof(valueSubOrdersSubOrder["OriginalAmount"].asString()); + if(!valueSubOrdersSubOrder["TradeAmount"].isNull()) + subOrdersObject.tradeAmount = std::stof(valueSubOrdersSubOrder["TradeAmount"].asString()); + if(!valueSubOrdersSubOrder["DiscountAmount"].isNull()) + subOrdersObject.discountAmount = std::stof(valueSubOrdersSubOrder["DiscountAmount"].asString()); + if(!valueSubOrdersSubOrder["InstanceId"].isNull()) + subOrdersObject.instanceId = valueSubOrdersSubOrder["InstanceId"].asString(); + auto allRuleIds = value["RuleIds"]["RuleId"]; + for (auto value : allRuleIds) + subOrdersObject.ruleIds.push_back(value.asString()); + subOrders_.push_back(subOrdersObject); + } + auto orderNode = value["Order"]; + if(!orderNode["OriginalAmount"].isNull()) + order_.originalAmount = std::stof(orderNode["OriginalAmount"].asString()); + if(!orderNode["TradeAmount"].isNull()) + order_.tradeAmount = std::stof(orderNode["TradeAmount"].asString()); + if(!orderNode["DiscountAmount"].isNull()) + order_.discountAmount = std::stof(orderNode["DiscountAmount"].asString()); + if(!orderNode["Currency"].isNull()) + order_.currency = orderNode["Currency"].asString(); + auto allCouponsNode = orderNode["Coupons"]["Coupon"]; + for (auto orderNodeCouponsCoupon : allCouponsNode) + { + Order::Coupon couponObject; + if(!orderNodeCouponsCoupon["CouponNo"].isNull()) + couponObject.couponNo = orderNodeCouponsCoupon["CouponNo"].asString(); + if(!orderNodeCouponsCoupon["Name"].isNull()) + couponObject.name = orderNodeCouponsCoupon["Name"].asString(); + if(!orderNodeCouponsCoupon["Description"].isNull()) + couponObject.description = orderNodeCouponsCoupon["Description"].asString(); + if(!orderNodeCouponsCoupon["IsSelected"].isNull()) + couponObject.isSelected = orderNodeCouponsCoupon["IsSelected"].asString(); + order_.coupons.push_back(couponObject); + } + auto allRuleIds1 = orderNode["RuleIds"]["RuleId"]; + for (auto value : allRuleIds1) + order_.ruleIds1.push_back(value.asString()); + if(!value["OrderParams"].isNull()) + orderParams_ = value["OrderParams"].asString(); + +} + +DescribePriceResult::Order DescribePriceResult::getOrder()const +{ + return order_; +} + +std::vector DescribePriceResult::getSubOrders()const +{ + return subOrders_; +} + +std::string DescribePriceResult::getOrderParams()const +{ + return orderParams_; +} + +std::vector DescribePriceResult::getRules()const +{ + return rules_; +} +