diff --git a/VERSION b/VERSION index b47fcf3cb..36cab5f1f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1992 \ No newline at end of file +1.36.1993 \ No newline at end of file diff --git a/wss/CMakeLists.txt b/wss/CMakeLists.txt new file mode 100644 index 000000000..764d8ca34 --- /dev/null +++ b/wss/CMakeLists.txt @@ -0,0 +1,90 @@ +# +# 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. +# + +set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include) + +set(wss_public_header + include/alibabacloud/wss/WssClient.h + include/alibabacloud/wss/WssExport.h ) + +set(wss_public_header_model + include/alibabacloud/wss/model/DescribeDeliveryAddressRequest.h + include/alibabacloud/wss/model/DescribeDeliveryAddressResult.h + include/alibabacloud/wss/model/DescribePackageDeductionsRequest.h + include/alibabacloud/wss/model/DescribePackageDeductionsResult.h ) + +set(wss_src + src/WssClient.cc + src/model/DescribeDeliveryAddressRequest.cc + src/model/DescribeDeliveryAddressResult.cc + src/model/DescribePackageDeductionsRequest.cc + src/model/DescribePackageDeductionsResult.cc ) + +add_library(wss ${LIB_TYPE} + ${wss_public_header} + ${wss_public_header_model} + ${wss_src}) + +set_target_properties(wss + PROPERTIES + LINKER_LANGUAGE CXX + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}wss + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(wss + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_WSS_LIBRARY) +endif() + +target_include_directories(wss + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(wss + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(wss + jsoncpp) + target_include_directories(wss + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(wss + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(wss + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(wss + PRIVATE /usr/include/jsoncpp) + target_link_libraries(wss + jsoncpp) +endif() + +install(FILES ${wss_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/wss) +install(FILES ${wss_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/wss/model) +install(TARGETS wss + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/wss/include/alibabacloud/wss/WssClient.h b/wss/include/alibabacloud/wss/WssClient.h new file mode 100644 index 000000000..df90e2096 --- /dev/null +++ b/wss/include/alibabacloud/wss/WssClient.h @@ -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. + */ + +#ifndef ALIBABACLOUD_WSS_WSSCLIENT_H_ +#define ALIBABACLOUD_WSS_WSSCLIENT_H_ + +#include +#include +#include +#include +#include "WssExport.h" +#include "model/DescribeDeliveryAddressRequest.h" +#include "model/DescribeDeliveryAddressResult.h" +#include "model/DescribePackageDeductionsRequest.h" +#include "model/DescribePackageDeductionsResult.h" + + +namespace AlibabaCloud +{ + namespace Wss + { + class ALIBABACLOUD_WSS_EXPORT WssClient : public RpcServiceClient + { + public: + typedef Outcome DescribeDeliveryAddressOutcome; + typedef std::future DescribeDeliveryAddressOutcomeCallable; + typedef std::function&)> DescribeDeliveryAddressAsyncHandler; + typedef Outcome DescribePackageDeductionsOutcome; + typedef std::future DescribePackageDeductionsOutcomeCallable; + typedef std::function&)> DescribePackageDeductionsAsyncHandler; + + WssClient(const Credentials &credentials, const ClientConfiguration &configuration); + WssClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + WssClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~WssClient(); + DescribeDeliveryAddressOutcome describeDeliveryAddress(const Model::DescribeDeliveryAddressRequest &request)const; + void describeDeliveryAddressAsync(const Model::DescribeDeliveryAddressRequest& request, const DescribeDeliveryAddressAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeDeliveryAddressOutcomeCallable describeDeliveryAddressCallable(const Model::DescribeDeliveryAddressRequest& request) const; + DescribePackageDeductionsOutcome describePackageDeductions(const Model::DescribePackageDeductionsRequest &request)const; + void describePackageDeductionsAsync(const Model::DescribePackageDeductionsRequest& request, const DescribePackageDeductionsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribePackageDeductionsOutcomeCallable describePackageDeductionsCallable(const Model::DescribePackageDeductionsRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_WSS_WSSCLIENT_H_ diff --git a/wss/include/alibabacloud/wss/WssExport.h b/wss/include/alibabacloud/wss/WssExport.h new file mode 100644 index 000000000..0f47fd635 --- /dev/null +++ b/wss/include/alibabacloud/wss/WssExport.h @@ -0,0 +1,32 @@ +/* + * 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_WSS_WSSEXPORT_H_ +#define ALIBABACLOUD_WSS_WSSEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_WSS_LIBRARY) +# define ALIBABACLOUD_WSS_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_WSS_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_WSS_EXPORT +#endif + +#endif // !ALIBABACLOUD_WSS_WSSEXPORT_H_ \ No newline at end of file diff --git a/wss/include/alibabacloud/wss/model/DescribeDeliveryAddressRequest.h b/wss/include/alibabacloud/wss/model/DescribeDeliveryAddressRequest.h new file mode 100644 index 000000000..84b48cd51 --- /dev/null +++ b/wss/include/alibabacloud/wss/model/DescribeDeliveryAddressRequest.h @@ -0,0 +1,39 @@ +/* + * 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_WSS_MODEL_DESCRIBEDELIVERYADDRESSREQUEST_H_ +#define ALIBABACLOUD_WSS_MODEL_DESCRIBEDELIVERYADDRESSREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Wss { +namespace Model { +class ALIBABACLOUD_WSS_EXPORT DescribeDeliveryAddressRequest : public RpcServiceRequest { +public: + DescribeDeliveryAddressRequest(); + ~DescribeDeliveryAddressRequest(); + +private: +}; +} // namespace Model +} // namespace Wss +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_WSS_MODEL_DESCRIBEDELIVERYADDRESSREQUEST_H_ diff --git a/wss/include/alibabacloud/wss/model/DescribeDeliveryAddressResult.h b/wss/include/alibabacloud/wss/model/DescribeDeliveryAddressResult.h new file mode 100644 index 000000000..f4dc35751 --- /dev/null +++ b/wss/include/alibabacloud/wss/model/DescribeDeliveryAddressResult.h @@ -0,0 +1,85 @@ +/* + * 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_WSS_MODEL_DESCRIBEDELIVERYADDRESSRESULT_H_ +#define ALIBABACLOUD_WSS_MODEL_DESCRIBEDELIVERYADDRESSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Wss + { + namespace Model + { + class ALIBABACLOUD_WSS_EXPORT DescribeDeliveryAddressResult : public ServiceResult + { + public: + struct Address + { + struct Province + { + std::string provinceName; + long provinceId; + }; + struct City + { + long cityId; + std::string cityName; + }; + struct Area + { + std::string areaName; + long areaId; + }; + struct Town + { + long townId; + std::string townName; + }; + bool defaultAddress; + Area area; + std::string contacts; + Town town; + std::string postalCode; + City city; + std::string mobile; + Province province; + std::string detail; + }; + + + DescribeDeliveryAddressResult(); + explicit DescribeDeliveryAddressResult(const std::string &payload); + ~DescribeDeliveryAddressResult(); + std::vector
getAddresses()const; + int getTotalCount()const; + + protected: + void parse(const std::string &payload); + private: + std::vector
addresses_; + int totalCount_; + + }; + } + } +} +#endif // !ALIBABACLOUD_WSS_MODEL_DESCRIBEDELIVERYADDRESSRESULT_H_ \ No newline at end of file diff --git a/wss/include/alibabacloud/wss/model/DescribePackageDeductionsRequest.h b/wss/include/alibabacloud/wss/model/DescribePackageDeductionsRequest.h new file mode 100644 index 000000000..f0aa0c729 --- /dev/null +++ b/wss/include/alibabacloud/wss/model/DescribePackageDeductionsRequest.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_WSS_MODEL_DESCRIBEPACKAGEDEDUCTIONSREQUEST_H_ +#define ALIBABACLOUD_WSS_MODEL_DESCRIBEPACKAGEDEDUCTIONSREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Wss { +namespace Model { +class ALIBABACLOUD_WSS_EXPORT DescribePackageDeductionsRequest : public RpcServiceRequest { +public: + DescribePackageDeductionsRequest(); + ~DescribePackageDeductionsRequest(); + int getPageNum() const; + void setPageNum(int pageNum); + std::string getResourceType() const; + void setResourceType(const std::string &resourceType); + std::vector getPackageIds() const; + void setPackageIds(const std::vector &packageIds); + std::vector getInstanceIds() const; + void setInstanceIds(const std::vector &instanceIds); + int getPageSize() const; + void setPageSize(int pageSize); + +private: + int pageNum_; + std::string resourceType_; + std::vector packageIds_; + std::vector instanceIds_; + int pageSize_; +}; +} // namespace Model +} // namespace Wss +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_WSS_MODEL_DESCRIBEPACKAGEDEDUCTIONSREQUEST_H_ diff --git a/wss/include/alibabacloud/wss/model/DescribePackageDeductionsResult.h b/wss/include/alibabacloud/wss/model/DescribePackageDeductionsResult.h new file mode 100644 index 000000000..ed346a389 --- /dev/null +++ b/wss/include/alibabacloud/wss/model/DescribePackageDeductionsResult.h @@ -0,0 +1,74 @@ +/* + * 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_WSS_MODEL_DESCRIBEPACKAGEDEDUCTIONSRESULT_H_ +#define ALIBABACLOUD_WSS_MODEL_DESCRIBEPACKAGEDEDUCTIONSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Wss + { + namespace Model + { + class ALIBABACLOUD_WSS_EXPORT DescribePackageDeductionsResult : public ServiceResult + { + public: + struct Deduction + { + std::string endTime; + float usedCoreTime; + long memory; + std::string desktopName; + std::string desktopId; + int cpu; + std::string resourceType; + std::string gpu; + std::string instanceState; + std::string desktopType; + std::string osType; + long usedTime; + std::string regionId; + std::string staTime; + }; + + + DescribePackageDeductionsResult(); + explicit DescribePackageDeductionsResult(const std::string &payload); + ~DescribePackageDeductionsResult(); + long getTotalCount()const; + int getPageNum()const; + int getPageSize()const; + std::vector getDeductions()const; + + protected: + void parse(const std::string &payload); + private: + long totalCount_; + int pageNum_; + int pageSize_; + std::vector deductions_; + + }; + } + } +} +#endif // !ALIBABACLOUD_WSS_MODEL_DESCRIBEPACKAGEDEDUCTIONSRESULT_H_ \ No newline at end of file diff --git a/wss/src/WssClient.cc b/wss/src/WssClient.cc new file mode 100644 index 000000000..e632dbb87 --- /dev/null +++ b/wss/src/WssClient.cc @@ -0,0 +1,125 @@ +/* + * 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; +using namespace AlibabaCloud::Location; +using namespace AlibabaCloud::Wss; +using namespace AlibabaCloud::Wss::Model; + +namespace +{ + const std::string SERVICE_NAME = "wss"; +} + +WssClient::WssClient(const Credentials &credentials, const ClientConfiguration &configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); +} + +WssClient::WssClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); +} + +WssClient::WssClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) +{ + auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); +} + +WssClient::~WssClient() +{} + +WssClient::DescribeDeliveryAddressOutcome WssClient::describeDeliveryAddress(const DescribeDeliveryAddressRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeDeliveryAddressOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeDeliveryAddressOutcome(DescribeDeliveryAddressResult(outcome.result())); + else + return DescribeDeliveryAddressOutcome(outcome.error()); +} + +void WssClient::describeDeliveryAddressAsync(const DescribeDeliveryAddressRequest& request, const DescribeDeliveryAddressAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeDeliveryAddress(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +WssClient::DescribeDeliveryAddressOutcomeCallable WssClient::describeDeliveryAddressCallable(const DescribeDeliveryAddressRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeDeliveryAddress(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +WssClient::DescribePackageDeductionsOutcome WssClient::describePackageDeductions(const DescribePackageDeductionsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribePackageDeductionsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribePackageDeductionsOutcome(DescribePackageDeductionsResult(outcome.result())); + else + return DescribePackageDeductionsOutcome(outcome.error()); +} + +void WssClient::describePackageDeductionsAsync(const DescribePackageDeductionsRequest& request, const DescribePackageDeductionsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describePackageDeductions(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +WssClient::DescribePackageDeductionsOutcomeCallable WssClient::describePackageDeductionsCallable(const DescribePackageDeductionsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describePackageDeductions(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/wss/src/model/DescribeDeliveryAddressRequest.cc b/wss/src/model/DescribeDeliveryAddressRequest.cc new file mode 100644 index 000000000..910f8b117 --- /dev/null +++ b/wss/src/model/DescribeDeliveryAddressRequest.cc @@ -0,0 +1,27 @@ +/* + * 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::Wss::Model::DescribeDeliveryAddressRequest; + +DescribeDeliveryAddressRequest::DescribeDeliveryAddressRequest() + : RpcServiceRequest("wss", "2021-12-21", "DescribeDeliveryAddress") { + setMethod(HttpRequest::Method::Post); +} + +DescribeDeliveryAddressRequest::~DescribeDeliveryAddressRequest() {} + diff --git a/wss/src/model/DescribeDeliveryAddressResult.cc b/wss/src/model/DescribeDeliveryAddressResult.cc new file mode 100644 index 000000000..d8411073f --- /dev/null +++ b/wss/src/model/DescribeDeliveryAddressResult.cc @@ -0,0 +1,92 @@ +/* + * 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::Wss; +using namespace AlibabaCloud::Wss::Model; + +DescribeDeliveryAddressResult::DescribeDeliveryAddressResult() : + ServiceResult() +{} + +DescribeDeliveryAddressResult::DescribeDeliveryAddressResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeDeliveryAddressResult::~DescribeDeliveryAddressResult() +{} + +void DescribeDeliveryAddressResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allAddressesNode = value["Addresses"]["Address"]; + for (auto valueAddressesAddress : allAddressesNode) + { + Address addressesObject; + if(!valueAddressesAddress["PostalCode"].isNull()) + addressesObject.postalCode = valueAddressesAddress["PostalCode"].asString(); + if(!valueAddressesAddress["Contacts"].isNull()) + addressesObject.contacts = valueAddressesAddress["Contacts"].asString(); + if(!valueAddressesAddress["Mobile"].isNull()) + addressesObject.mobile = valueAddressesAddress["Mobile"].asString(); + if(!valueAddressesAddress["DefaultAddress"].isNull()) + addressesObject.defaultAddress = valueAddressesAddress["DefaultAddress"].asString() == "true"; + if(!valueAddressesAddress["Detail"].isNull()) + addressesObject.detail = valueAddressesAddress["Detail"].asString(); + auto provinceNode = value["Province"]; + if(!provinceNode["ProvinceId"].isNull()) + addressesObject.province.provinceId = std::stol(provinceNode["ProvinceId"].asString()); + if(!provinceNode["ProvinceName"].isNull()) + addressesObject.province.provinceName = provinceNode["ProvinceName"].asString(); + auto cityNode = value["City"]; + if(!cityNode["CityId"].isNull()) + addressesObject.city.cityId = std::stol(cityNode["CityId"].asString()); + if(!cityNode["CityName"].isNull()) + addressesObject.city.cityName = cityNode["CityName"].asString(); + auto areaNode = value["Area"]; + if(!areaNode["AreaName"].isNull()) + addressesObject.area.areaName = areaNode["AreaName"].asString(); + if(!areaNode["AreaId"].isNull()) + addressesObject.area.areaId = std::stol(areaNode["AreaId"].asString()); + auto townNode = value["Town"]; + if(!townNode["TownName"].isNull()) + addressesObject.town.townName = townNode["TownName"].asString(); + if(!townNode["TownId"].isNull()) + addressesObject.town.townId = std::stol(townNode["TownId"].asString()); + addresses_.push_back(addressesObject); + } + if(!value["TotalCount"].isNull()) + totalCount_ = std::stoi(value["TotalCount"].asString()); + +} + +std::vector DescribeDeliveryAddressResult::getAddresses()const +{ + return addresses_; +} + +int DescribeDeliveryAddressResult::getTotalCount()const +{ + return totalCount_; +} + diff --git a/wss/src/model/DescribePackageDeductionsRequest.cc b/wss/src/model/DescribePackageDeductionsRequest.cc new file mode 100644 index 000000000..e10b4880d --- /dev/null +++ b/wss/src/model/DescribePackageDeductionsRequest.cc @@ -0,0 +1,70 @@ +/* + * 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::Wss::Model::DescribePackageDeductionsRequest; + +DescribePackageDeductionsRequest::DescribePackageDeductionsRequest() + : RpcServiceRequest("wss", "2021-12-21", "DescribePackageDeductions") { + setMethod(HttpRequest::Method::Post); +} + +DescribePackageDeductionsRequest::~DescribePackageDeductionsRequest() {} + +int DescribePackageDeductionsRequest::getPageNum() const { + return pageNum_; +} + +void DescribePackageDeductionsRequest::setPageNum(int pageNum) { + pageNum_ = pageNum; + setParameter(std::string("PageNum"), std::to_string(pageNum)); +} + +std::string DescribePackageDeductionsRequest::getResourceType() const { + return resourceType_; +} + +void DescribePackageDeductionsRequest::setResourceType(const std::string &resourceType) { + resourceType_ = resourceType; + setParameter(std::string("ResourceType"), resourceType); +} + +std::vector DescribePackageDeductionsRequest::getPackageIds() const { + return packageIds_; +} + +void DescribePackageDeductionsRequest::setPackageIds(const std::vector &packageIds) { + packageIds_ = packageIds; +} + +std::vector DescribePackageDeductionsRequest::getInstanceIds() const { + return instanceIds_; +} + +void DescribePackageDeductionsRequest::setInstanceIds(const std::vector &instanceIds) { + instanceIds_ = instanceIds; +} + +int DescribePackageDeductionsRequest::getPageSize() const { + return pageSize_; +} + +void DescribePackageDeductionsRequest::setPageSize(int pageSize) { + pageSize_ = pageSize; + setParameter(std::string("PageSize"), std::to_string(pageSize)); +} + diff --git a/wss/src/model/DescribePackageDeductionsResult.cc b/wss/src/model/DescribePackageDeductionsResult.cc new file mode 100644 index 000000000..b4ceee43e --- /dev/null +++ b/wss/src/model/DescribePackageDeductionsResult.cc @@ -0,0 +1,104 @@ +/* + * 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::Wss; +using namespace AlibabaCloud::Wss::Model; + +DescribePackageDeductionsResult::DescribePackageDeductionsResult() : + ServiceResult() +{} + +DescribePackageDeductionsResult::DescribePackageDeductionsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribePackageDeductionsResult::~DescribePackageDeductionsResult() +{} + +void DescribePackageDeductionsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allDeductionsNode = value["Deductions"]["deduction"]; + for (auto valueDeductionsdeduction : allDeductionsNode) + { + Deduction deductionsObject; + if(!valueDeductionsdeduction["DesktopName"].isNull()) + deductionsObject.desktopName = valueDeductionsdeduction["DesktopName"].asString(); + if(!valueDeductionsdeduction["DesktopId"].isNull()) + deductionsObject.desktopId = valueDeductionsdeduction["DesktopId"].asString(); + if(!valueDeductionsdeduction["RegionId"].isNull()) + deductionsObject.regionId = valueDeductionsdeduction["RegionId"].asString(); + if(!valueDeductionsdeduction["DesktopType"].isNull()) + deductionsObject.desktopType = valueDeductionsdeduction["DesktopType"].asString(); + if(!valueDeductionsdeduction["OsType"].isNull()) + deductionsObject.osType = valueDeductionsdeduction["OsType"].asString(); + if(!valueDeductionsdeduction["StaTime"].isNull()) + deductionsObject.staTime = valueDeductionsdeduction["StaTime"].asString(); + if(!valueDeductionsdeduction["EndTime"].isNull()) + deductionsObject.endTime = valueDeductionsdeduction["EndTime"].asString(); + if(!valueDeductionsdeduction["ResourceType"].isNull()) + deductionsObject.resourceType = valueDeductionsdeduction["ResourceType"].asString(); + if(!valueDeductionsdeduction["UsedTime"].isNull()) + deductionsObject.usedTime = std::stol(valueDeductionsdeduction["UsedTime"].asString()); + if(!valueDeductionsdeduction["UsedCoreTime"].isNull()) + deductionsObject.usedCoreTime = std::stof(valueDeductionsdeduction["UsedCoreTime"].asString()); + if(!valueDeductionsdeduction["InstanceState"].isNull()) + deductionsObject.instanceState = valueDeductionsdeduction["InstanceState"].asString(); + if(!valueDeductionsdeduction["Memory"].isNull()) + deductionsObject.memory = std::stol(valueDeductionsdeduction["Memory"].asString()); + if(!valueDeductionsdeduction["Cpu"].isNull()) + deductionsObject.cpu = std::stoi(valueDeductionsdeduction["Cpu"].asString()); + if(!valueDeductionsdeduction["Gpu"].isNull()) + deductionsObject.gpu = valueDeductionsdeduction["Gpu"].asString(); + deductions_.push_back(deductionsObject); + } + if(!value["PageNum"].isNull()) + pageNum_ = std::stoi(value["PageNum"].asString()); + if(!value["PageSize"].isNull()) + pageSize_ = std::stoi(value["PageSize"].asString()); + if(!value["TotalCount"].isNull()) + totalCount_ = std::stol(value["TotalCount"].asString()); + +} + +long DescribePackageDeductionsResult::getTotalCount()const +{ + return totalCount_; +} + +int DescribePackageDeductionsResult::getPageNum()const +{ + return pageNum_; +} + +int DescribePackageDeductionsResult::getPageSize()const +{ + return pageSize_; +} + +std::vector DescribePackageDeductionsResult::getDeductions()const +{ + return deductions_; +} +