Generated 2021-12-21 for wss.

This commit is contained in:
sdk-team
2024-09-29 14:43:53 +00:00
parent f0133be6a9
commit 179314c9fe
13 changed files with 855 additions and 1 deletions

View File

@@ -1 +1 @@
1.36.1992
1.36.1993

90
wss/CMakeLists.txt Normal file
View File

@@ -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}
)

View 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.
*/
#ifndef ALIBABACLOUD_WSS_WSSCLIENT_H_
#define ALIBABACLOUD_WSS_WSSCLIENT_H_
#include <future>
#include <alibabacloud/core/AsyncCallerContext.h>
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#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<Error, Model::DescribeDeliveryAddressResult> DescribeDeliveryAddressOutcome;
typedef std::future<DescribeDeliveryAddressOutcome> DescribeDeliveryAddressOutcomeCallable;
typedef std::function<void(const WssClient*, const Model::DescribeDeliveryAddressRequest&, const DescribeDeliveryAddressOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeDeliveryAddressAsyncHandler;
typedef Outcome<Error, Model::DescribePackageDeductionsResult> DescribePackageDeductionsOutcome;
typedef std::future<DescribePackageDeductionsOutcome> DescribePackageDeductionsOutcomeCallable;
typedef std::function<void(const WssClient*, const Model::DescribePackageDeductionsRequest&, const DescribePackageDeductionsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribePackageDeductionsAsyncHandler;
WssClient(const Credentials &credentials, const ClientConfiguration &configuration);
WssClient(const std::shared_ptr<CredentialsProvider> &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<const AsyncCallerContext>& 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<const AsyncCallerContext>& context = nullptr) const;
DescribePackageDeductionsOutcomeCallable describePackageDeductionsCallable(const Model::DescribePackageDeductionsRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;
};
}
}
#endif // !ALIBABACLOUD_WSS_WSSCLIENT_H_

View File

@@ -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 <alibabacloud/core/Global.h>
#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_

View File

@@ -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 <alibabacloud/wss/WssExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/wss/WssExport.h>
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<Address> getAddresses()const;
int getTotalCount()const;
protected:
void parse(const std::string &payload);
private:
std::vector<Address> addresses_;
int totalCount_;
};
}
}
}
#endif // !ALIBABACLOUD_WSS_MODEL_DESCRIBEDELIVERYADDRESSRESULT_H_

View 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.
*/
#ifndef ALIBABACLOUD_WSS_MODEL_DESCRIBEPACKAGEDEDUCTIONSREQUEST_H_
#define ALIBABACLOUD_WSS_MODEL_DESCRIBEPACKAGEDEDUCTIONSREQUEST_H_
#include <alibabacloud/wss/WssExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
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<std::string> getPackageIds() const;
void setPackageIds(const std::vector<std::string> &packageIds);
std::vector<std::string> getInstanceIds() const;
void setInstanceIds(const std::vector<std::string> &instanceIds);
int getPageSize() const;
void setPageSize(int pageSize);
private:
int pageNum_;
std::string resourceType_;
std::vector<std::string> packageIds_;
std::vector<std::string> instanceIds_;
int pageSize_;
};
} // namespace Model
} // namespace Wss
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_WSS_MODEL_DESCRIBEPACKAGEDEDUCTIONSREQUEST_H_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/wss/WssExport.h>
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<Deduction> getDeductions()const;
protected:
void parse(const std::string &payload);
private:
long totalCount_;
int pageNum_;
int pageSize_;
std::vector<Deduction> deductions_;
};
}
}
}
#endif // !ALIBABACLOUD_WSS_MODEL_DESCRIBEPACKAGEDEDUCTIONSRESULT_H_

125
wss/src/WssClient.cc Normal file
View File

@@ -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 <alibabacloud/wss/WssClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
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<SimpleCredentialsProvider>(credentials), configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
WssClient::WssClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
WssClient::WssClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(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<const AsyncCallerContext>& 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<std::packaged_task<DescribeDeliveryAddressOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<DescribePackageDeductionsOutcome()>>(
[this, request]()
{
return this->describePackageDeductions(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -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 <alibabacloud/wss/model/DescribeDeliveryAddressRequest.h>
using AlibabaCloud::Wss::Model::DescribeDeliveryAddressRequest;
DescribeDeliveryAddressRequest::DescribeDeliveryAddressRequest()
: RpcServiceRequest("wss", "2021-12-21", "DescribeDeliveryAddress") {
setMethod(HttpRequest::Method::Post);
}
DescribeDeliveryAddressRequest::~DescribeDeliveryAddressRequest() {}

View File

@@ -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 <alibabacloud/wss/model/DescribeDeliveryAddressResult.h>
#include <json/json.h>
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::Address> DescribeDeliveryAddressResult::getAddresses()const
{
return addresses_;
}
int DescribeDeliveryAddressResult::getTotalCount()const
{
return totalCount_;
}

View File

@@ -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 <alibabacloud/wss/model/DescribePackageDeductionsRequest.h>
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<std::string> DescribePackageDeductionsRequest::getPackageIds() const {
return packageIds_;
}
void DescribePackageDeductionsRequest::setPackageIds(const std::vector<std::string> &packageIds) {
packageIds_ = packageIds;
}
std::vector<std::string> DescribePackageDeductionsRequest::getInstanceIds() const {
return instanceIds_;
}
void DescribePackageDeductionsRequest::setInstanceIds(const std::vector<std::string> &instanceIds) {
instanceIds_ = instanceIds;
}
int DescribePackageDeductionsRequest::getPageSize() const {
return pageSize_;
}
void DescribePackageDeductionsRequest::setPageSize(int pageSize) {
pageSize_ = pageSize;
setParameter(std::string("PageSize"), std::to_string(pageSize));
}

View File

@@ -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 <alibabacloud/wss/model/DescribePackageDeductionsResult.h>
#include <json/json.h>
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::Deduction> DescribePackageDeductionsResult::getDeductions()const
{
return deductions_;
}