From 84659b3f3e719597b7b84f8d20858a7b654414b4 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Mon, 8 Jun 2020 12:59:33 +0800 Subject: [PATCH] Support offline instance. --- CHANGELOG | 3 + VERSION | 2 +- geoip/CMakeLists.txt | 8 ++ .../include/alibabacloud/geoip/GeoipClient.h | 16 ++++ .../DescribeGeoipInstanceDataInfosRequest.h | 54 ++++++++++++++ .../DescribeGeoipInstanceDataInfosResult.h | 59 +++++++++++++++ .../DescribeGeoipInstanceDataUrlRequest.h | 57 +++++++++++++++ .../DescribeGeoipInstanceDataUrlResult.h | 51 +++++++++++++ geoip/src/GeoipClient.cc | 72 ++++++++++++++++++ .../DescribeGeoipInstanceDataInfosRequest.cc | 62 ++++++++++++++++ .../DescribeGeoipInstanceDataInfosResult.cc | 65 +++++++++++++++++ .../DescribeGeoipInstanceDataUrlRequest.cc | 73 +++++++++++++++++++ .../DescribeGeoipInstanceDataUrlResult.cc | 51 +++++++++++++ 13 files changed, 572 insertions(+), 1 deletion(-) create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataInfosRequest.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataInfosResult.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataUrlRequest.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataUrlResult.h create mode 100644 geoip/src/model/DescribeGeoipInstanceDataInfosRequest.cc create mode 100644 geoip/src/model/DescribeGeoipInstanceDataInfosResult.cc create mode 100644 geoip/src/model/DescribeGeoipInstanceDataUrlRequest.cc create mode 100644 geoip/src/model/DescribeGeoipInstanceDataUrlResult.cc diff --git a/CHANGELOG b/CHANGELOG index d198cd9ef..1f5131c91 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2020-06-08 Version: 1.36.452 +- Support offline instance. + 2020-06-04 Version: 1.36.451 - Support for addrp. diff --git a/VERSION b/VERSION index a81595bed..b46514107 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.451 \ No newline at end of file +1.36.452 \ No newline at end of file diff --git a/geoip/CMakeLists.txt b/geoip/CMakeLists.txt index d98affbc5..92e38510c 100644 --- a/geoip/CMakeLists.txt +++ b/geoip/CMakeLists.txt @@ -23,6 +23,10 @@ set(geoip_public_header set(geoip_public_header_model include/alibabacloud/geoip/model/DescribeGeoipInstanceRequest.h include/alibabacloud/geoip/model/DescribeGeoipInstanceResult.h + include/alibabacloud/geoip/model/DescribeGeoipInstanceDataInfosRequest.h + include/alibabacloud/geoip/model/DescribeGeoipInstanceDataInfosResult.h + include/alibabacloud/geoip/model/DescribeGeoipInstanceDataUrlRequest.h + include/alibabacloud/geoip/model/DescribeGeoipInstanceDataUrlResult.h include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsRequest.h include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsResult.h include/alibabacloud/geoip/model/DescribeGeoipInstancesRequest.h @@ -36,6 +40,10 @@ set(geoip_src src/GeoipClient.cc src/model/DescribeGeoipInstanceRequest.cc src/model/DescribeGeoipInstanceResult.cc + src/model/DescribeGeoipInstanceDataInfosRequest.cc + src/model/DescribeGeoipInstanceDataInfosResult.cc + src/model/DescribeGeoipInstanceDataUrlRequest.cc + src/model/DescribeGeoipInstanceDataUrlResult.cc src/model/DescribeGeoipInstanceStatisticsRequest.cc src/model/DescribeGeoipInstanceStatisticsResult.cc src/model/DescribeGeoipInstancesRequest.cc diff --git a/geoip/include/alibabacloud/geoip/GeoipClient.h b/geoip/include/alibabacloud/geoip/GeoipClient.h index b966647d2..cbb9e5721 100644 --- a/geoip/include/alibabacloud/geoip/GeoipClient.h +++ b/geoip/include/alibabacloud/geoip/GeoipClient.h @@ -24,6 +24,10 @@ #include "GeoipExport.h" #include "model/DescribeGeoipInstanceRequest.h" #include "model/DescribeGeoipInstanceResult.h" +#include "model/DescribeGeoipInstanceDataInfosRequest.h" +#include "model/DescribeGeoipInstanceDataInfosResult.h" +#include "model/DescribeGeoipInstanceDataUrlRequest.h" +#include "model/DescribeGeoipInstanceDataUrlResult.h" #include "model/DescribeGeoipInstanceStatisticsRequest.h" #include "model/DescribeGeoipInstanceStatisticsResult.h" #include "model/DescribeGeoipInstancesRequest.h" @@ -44,6 +48,12 @@ namespace AlibabaCloud typedef Outcome DescribeGeoipInstanceOutcome; typedef std::future DescribeGeoipInstanceOutcomeCallable; typedef std::function&)> DescribeGeoipInstanceAsyncHandler; + typedef Outcome DescribeGeoipInstanceDataInfosOutcome; + typedef std::future DescribeGeoipInstanceDataInfosOutcomeCallable; + typedef std::function&)> DescribeGeoipInstanceDataInfosAsyncHandler; + typedef Outcome DescribeGeoipInstanceDataUrlOutcome; + typedef std::future DescribeGeoipInstanceDataUrlOutcomeCallable; + typedef std::function&)> DescribeGeoipInstanceDataUrlAsyncHandler; typedef Outcome DescribeGeoipInstanceStatisticsOutcome; typedef std::future DescribeGeoipInstanceStatisticsOutcomeCallable; typedef std::function&)> DescribeGeoipInstanceStatisticsAsyncHandler; @@ -64,6 +74,12 @@ namespace AlibabaCloud DescribeGeoipInstanceOutcome describeGeoipInstance(const Model::DescribeGeoipInstanceRequest &request)const; void describeGeoipInstanceAsync(const Model::DescribeGeoipInstanceRequest& request, const DescribeGeoipInstanceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeGeoipInstanceOutcomeCallable describeGeoipInstanceCallable(const Model::DescribeGeoipInstanceRequest& request) const; + DescribeGeoipInstanceDataInfosOutcome describeGeoipInstanceDataInfos(const Model::DescribeGeoipInstanceDataInfosRequest &request)const; + void describeGeoipInstanceDataInfosAsync(const Model::DescribeGeoipInstanceDataInfosRequest& request, const DescribeGeoipInstanceDataInfosAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeGeoipInstanceDataInfosOutcomeCallable describeGeoipInstanceDataInfosCallable(const Model::DescribeGeoipInstanceDataInfosRequest& request) const; + DescribeGeoipInstanceDataUrlOutcome describeGeoipInstanceDataUrl(const Model::DescribeGeoipInstanceDataUrlRequest &request)const; + void describeGeoipInstanceDataUrlAsync(const Model::DescribeGeoipInstanceDataUrlRequest& request, const DescribeGeoipInstanceDataUrlAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeGeoipInstanceDataUrlOutcomeCallable describeGeoipInstanceDataUrlCallable(const Model::DescribeGeoipInstanceDataUrlRequest& request) const; DescribeGeoipInstanceStatisticsOutcome describeGeoipInstanceStatistics(const Model::DescribeGeoipInstanceStatisticsRequest &request)const; void describeGeoipInstanceStatisticsAsync(const Model::DescribeGeoipInstanceStatisticsRequest& request, const DescribeGeoipInstanceStatisticsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeGeoipInstanceStatisticsOutcomeCallable describeGeoipInstanceStatisticsCallable(const Model::DescribeGeoipInstanceStatisticsRequest& request) const; diff --git a/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataInfosRequest.h b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataInfosRequest.h new file mode 100644 index 000000000..71c1130e0 --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataInfosRequest.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_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAINFOSREQUEST_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAINFOSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeGeoipInstanceDataInfosRequest : public RpcServiceRequest + { + + public: + DescribeGeoipInstanceDataInfosRequest(); + ~DescribeGeoipInstanceDataInfosRequest(); + + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + std::string getUserClientIp()const; + void setUserClientIp(const std::string& userClientIp); + std::string getLang()const; + void setLang(const std::string& lang); + + private: + std::string instanceId_; + std::string userClientIp_; + std::string lang_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAINFOSREQUEST_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataInfosResult.h b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataInfosResult.h new file mode 100644 index 000000000..31b84c748 --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataInfosResult.h @@ -0,0 +1,59 @@ +/* + * 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_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAINFOSRESULT_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAINFOSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeGeoipInstanceDataInfosResult : public ServiceResult + { + public: + struct DataInfo + { + std::string type; + std::string version; + std::string updateTime; + long updateTimestamp; + long downloadCount; + }; + + + DescribeGeoipInstanceDataInfosResult(); + explicit DescribeGeoipInstanceDataInfosResult(const std::string &payload); + ~DescribeGeoipInstanceDataInfosResult(); + std::vector getDataInfos()const; + + protected: + void parse(const std::string &payload); + private: + std::vector dataInfos_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAINFOSRESULT_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataUrlRequest.h b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataUrlRequest.h new file mode 100644 index 000000000..f8a364346 --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataUrlRequest.h @@ -0,0 +1,57 @@ +/* + * 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_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAURLREQUEST_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAURLREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeGeoipInstanceDataUrlRequest : public RpcServiceRequest + { + + public: + DescribeGeoipInstanceDataUrlRequest(); + ~DescribeGeoipInstanceDataUrlRequest(); + + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + std::string getDataType()const; + void setDataType(const std::string& dataType); + std::string getUserClientIp()const; + void setUserClientIp(const std::string& userClientIp); + std::string getLang()const; + void setLang(const std::string& lang); + + private: + std::string instanceId_; + std::string dataType_; + std::string userClientIp_; + std::string lang_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAURLREQUEST_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataUrlResult.h b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataUrlResult.h new file mode 100644 index 000000000..ef91982b3 --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceDataUrlResult.h @@ -0,0 +1,51 @@ +/* + * 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_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAURLRESULT_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAURLRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeGeoipInstanceDataUrlResult : public ServiceResult + { + public: + + + DescribeGeoipInstanceDataUrlResult(); + explicit DescribeGeoipInstanceDataUrlResult(const std::string &payload); + ~DescribeGeoipInstanceDataUrlResult(); + std::string getDownloadUrl()const; + + protected: + void parse(const std::string &payload); + private: + std::string downloadUrl_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEDATAURLRESULT_H_ \ No newline at end of file diff --git a/geoip/src/GeoipClient.cc b/geoip/src/GeoipClient.cc index 1a2e8b633..abd2a14a2 100644 --- a/geoip/src/GeoipClient.cc +++ b/geoip/src/GeoipClient.cc @@ -87,6 +87,78 @@ GeoipClient::DescribeGeoipInstanceOutcomeCallable GeoipClient::describeGeoipInst return task->get_future(); } +GeoipClient::DescribeGeoipInstanceDataInfosOutcome GeoipClient::describeGeoipInstanceDataInfos(const DescribeGeoipInstanceDataInfosRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeGeoipInstanceDataInfosOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeGeoipInstanceDataInfosOutcome(DescribeGeoipInstanceDataInfosResult(outcome.result())); + else + return DescribeGeoipInstanceDataInfosOutcome(outcome.error()); +} + +void GeoipClient::describeGeoipInstanceDataInfosAsync(const DescribeGeoipInstanceDataInfosRequest& request, const DescribeGeoipInstanceDataInfosAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeGeoipInstanceDataInfos(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +GeoipClient::DescribeGeoipInstanceDataInfosOutcomeCallable GeoipClient::describeGeoipInstanceDataInfosCallable(const DescribeGeoipInstanceDataInfosRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeGeoipInstanceDataInfos(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +GeoipClient::DescribeGeoipInstanceDataUrlOutcome GeoipClient::describeGeoipInstanceDataUrl(const DescribeGeoipInstanceDataUrlRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeGeoipInstanceDataUrlOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeGeoipInstanceDataUrlOutcome(DescribeGeoipInstanceDataUrlResult(outcome.result())); + else + return DescribeGeoipInstanceDataUrlOutcome(outcome.error()); +} + +void GeoipClient::describeGeoipInstanceDataUrlAsync(const DescribeGeoipInstanceDataUrlRequest& request, const DescribeGeoipInstanceDataUrlAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeGeoipInstanceDataUrl(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +GeoipClient::DescribeGeoipInstanceDataUrlOutcomeCallable GeoipClient::describeGeoipInstanceDataUrlCallable(const DescribeGeoipInstanceDataUrlRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeGeoipInstanceDataUrl(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + GeoipClient::DescribeGeoipInstanceStatisticsOutcome GeoipClient::describeGeoipInstanceStatistics(const DescribeGeoipInstanceStatisticsRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/geoip/src/model/DescribeGeoipInstanceDataInfosRequest.cc b/geoip/src/model/DescribeGeoipInstanceDataInfosRequest.cc new file mode 100644 index 000000000..19201fc78 --- /dev/null +++ b/geoip/src/model/DescribeGeoipInstanceDataInfosRequest.cc @@ -0,0 +1,62 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Geoip::Model::DescribeGeoipInstanceDataInfosRequest; + +DescribeGeoipInstanceDataInfosRequest::DescribeGeoipInstanceDataInfosRequest() : + RpcServiceRequest("geoip", "2020-01-01", "DescribeGeoipInstanceDataInfos") +{ + setMethod(HttpRequest::Method::Post); +} + +DescribeGeoipInstanceDataInfosRequest::~DescribeGeoipInstanceDataInfosRequest() +{} + +std::string DescribeGeoipInstanceDataInfosRequest::getInstanceId()const +{ + return instanceId_; +} + +void DescribeGeoipInstanceDataInfosRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string DescribeGeoipInstanceDataInfosRequest::getUserClientIp()const +{ + return userClientIp_; +} + +void DescribeGeoipInstanceDataInfosRequest::setUserClientIp(const std::string& userClientIp) +{ + userClientIp_ = userClientIp; + setParameter("UserClientIp", userClientIp); +} + +std::string DescribeGeoipInstanceDataInfosRequest::getLang()const +{ + return lang_; +} + +void DescribeGeoipInstanceDataInfosRequest::setLang(const std::string& lang) +{ + lang_ = lang; + setParameter("Lang", lang); +} + diff --git a/geoip/src/model/DescribeGeoipInstanceDataInfosResult.cc b/geoip/src/model/DescribeGeoipInstanceDataInfosResult.cc new file mode 100644 index 000000000..2bc6005c7 --- /dev/null +++ b/geoip/src/model/DescribeGeoipInstanceDataInfosResult.cc @@ -0,0 +1,65 @@ +/* + * 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::Geoip; +using namespace AlibabaCloud::Geoip::Model; + +DescribeGeoipInstanceDataInfosResult::DescribeGeoipInstanceDataInfosResult() : + ServiceResult() +{} + +DescribeGeoipInstanceDataInfosResult::DescribeGeoipInstanceDataInfosResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeGeoipInstanceDataInfosResult::~DescribeGeoipInstanceDataInfosResult() +{} + +void DescribeGeoipInstanceDataInfosResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allDataInfosNode = value["DataInfos"]["DataInfo"]; + for (auto valueDataInfosDataInfo : allDataInfosNode) + { + DataInfo dataInfosObject; + if(!valueDataInfosDataInfo["Type"].isNull()) + dataInfosObject.type = valueDataInfosDataInfo["Type"].asString(); + if(!valueDataInfosDataInfo["Version"].isNull()) + dataInfosObject.version = valueDataInfosDataInfo["Version"].asString(); + if(!valueDataInfosDataInfo["UpdateTime"].isNull()) + dataInfosObject.updateTime = valueDataInfosDataInfo["UpdateTime"].asString(); + if(!valueDataInfosDataInfo["UpdateTimestamp"].isNull()) + dataInfosObject.updateTimestamp = std::stol(valueDataInfosDataInfo["UpdateTimestamp"].asString()); + if(!valueDataInfosDataInfo["DownloadCount"].isNull()) + dataInfosObject.downloadCount = std::stol(valueDataInfosDataInfo["DownloadCount"].asString()); + dataInfos_.push_back(dataInfosObject); + } + +} + +std::vector DescribeGeoipInstanceDataInfosResult::getDataInfos()const +{ + return dataInfos_; +} + diff --git a/geoip/src/model/DescribeGeoipInstanceDataUrlRequest.cc b/geoip/src/model/DescribeGeoipInstanceDataUrlRequest.cc new file mode 100644 index 000000000..e823a12e8 --- /dev/null +++ b/geoip/src/model/DescribeGeoipInstanceDataUrlRequest.cc @@ -0,0 +1,73 @@ +/* + * 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::Geoip::Model::DescribeGeoipInstanceDataUrlRequest; + +DescribeGeoipInstanceDataUrlRequest::DescribeGeoipInstanceDataUrlRequest() : + RpcServiceRequest("geoip", "2020-01-01", "DescribeGeoipInstanceDataUrl") +{ + setMethod(HttpRequest::Method::Post); +} + +DescribeGeoipInstanceDataUrlRequest::~DescribeGeoipInstanceDataUrlRequest() +{} + +std::string DescribeGeoipInstanceDataUrlRequest::getInstanceId()const +{ + return instanceId_; +} + +void DescribeGeoipInstanceDataUrlRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string DescribeGeoipInstanceDataUrlRequest::getDataType()const +{ + return dataType_; +} + +void DescribeGeoipInstanceDataUrlRequest::setDataType(const std::string& dataType) +{ + dataType_ = dataType; + setParameter("DataType", dataType); +} + +std::string DescribeGeoipInstanceDataUrlRequest::getUserClientIp()const +{ + return userClientIp_; +} + +void DescribeGeoipInstanceDataUrlRequest::setUserClientIp(const std::string& userClientIp) +{ + userClientIp_ = userClientIp; + setParameter("UserClientIp", userClientIp); +} + +std::string DescribeGeoipInstanceDataUrlRequest::getLang()const +{ + return lang_; +} + +void DescribeGeoipInstanceDataUrlRequest::setLang(const std::string& lang) +{ + lang_ = lang; + setParameter("Lang", lang); +} + diff --git a/geoip/src/model/DescribeGeoipInstanceDataUrlResult.cc b/geoip/src/model/DescribeGeoipInstanceDataUrlResult.cc new file mode 100644 index 000000000..dbcee055f --- /dev/null +++ b/geoip/src/model/DescribeGeoipInstanceDataUrlResult.cc @@ -0,0 +1,51 @@ +/* + * 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::Geoip; +using namespace AlibabaCloud::Geoip::Model; + +DescribeGeoipInstanceDataUrlResult::DescribeGeoipInstanceDataUrlResult() : + ServiceResult() +{} + +DescribeGeoipInstanceDataUrlResult::DescribeGeoipInstanceDataUrlResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeGeoipInstanceDataUrlResult::~DescribeGeoipInstanceDataUrlResult() +{} + +void DescribeGeoipInstanceDataUrlResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["DownloadUrl"].isNull()) + downloadUrl_ = value["DownloadUrl"].asString(); + +} + +std::string DescribeGeoipInstanceDataUrlResult::getDownloadUrl()const +{ + return downloadUrl_; +} +