From 82ce70d07f85c3261cbde77b9bda7089edf16549 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Tue, 3 Mar 2020 11:44:05 +0800 Subject: [PATCH] GeoIP Databases SDK initial release. --- CHANGELOG | 3 + VERSION | 2 +- geoip/CMakeLists.txt | 98 +++++++++ .../include/alibabacloud/geoip/GeoipClient.h | 78 +++++++ .../include/alibabacloud/geoip/GeoipExport.h | 32 +++ .../model/DescribeGeoipInstanceRequest.h | 54 +++++ .../geoip/model/DescribeGeoipInstanceResult.h | 69 ++++++ .../DescribeGeoipInstanceStatisticsRequest.h | 60 ++++++ .../DescribeGeoipInstanceStatisticsResult.h | 56 +++++ .../model/DescribeGeoipInstancesRequest.h | 51 +++++ .../model/DescribeGeoipInstancesResult.h | 64 ++++++ .../geoip/model/DescribeIpv6LocationRequest.h | 54 +++++ .../geoip/model/DescribeIpv6LocationResult.h | 61 ++++++ geoip/src/GeoipClient.cc | 197 ++++++++++++++++++ .../src/model/DescribeGeoipInstanceRequest.cc | 62 ++++++ .../src/model/DescribeGeoipInstanceResult.cc | 114 ++++++++++ .../DescribeGeoipInstanceStatisticsRequest.cc | 84 ++++++++ .../DescribeGeoipInstanceStatisticsResult.cc | 59 ++++++ .../model/DescribeGeoipInstancesRequest.cc | 51 +++++ .../src/model/DescribeGeoipInstancesResult.cc | 75 +++++++ .../src/model/DescribeIpv6LocationRequest.cc | 62 ++++++ geoip/src/model/DescribeIpv6LocationResult.cc | 86 ++++++++ 22 files changed, 1471 insertions(+), 1 deletion(-) create mode 100644 geoip/CMakeLists.txt create mode 100644 geoip/include/alibabacloud/geoip/GeoipClient.h create mode 100644 geoip/include/alibabacloud/geoip/GeoipExport.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceRequest.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceResult.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsRequest.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsResult.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeGeoipInstancesRequest.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeGeoipInstancesResult.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeIpv6LocationRequest.h create mode 100644 geoip/include/alibabacloud/geoip/model/DescribeIpv6LocationResult.h create mode 100644 geoip/src/GeoipClient.cc create mode 100644 geoip/src/model/DescribeGeoipInstanceRequest.cc create mode 100644 geoip/src/model/DescribeGeoipInstanceResult.cc create mode 100644 geoip/src/model/DescribeGeoipInstanceStatisticsRequest.cc create mode 100644 geoip/src/model/DescribeGeoipInstanceStatisticsResult.cc create mode 100644 geoip/src/model/DescribeGeoipInstancesRequest.cc create mode 100644 geoip/src/model/DescribeGeoipInstancesResult.cc create mode 100644 geoip/src/model/DescribeIpv6LocationRequest.cc create mode 100644 geoip/src/model/DescribeIpv6LocationResult.cc diff --git a/CHANGELOG b/CHANGELOG index 60289e849..04a84c6df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2020-03-03 Version: 1.36.297 +- GeoIP Databases SDK initial release. + 2020-03-03 Version: 1.36.296 - Supported secretmanager for kms. diff --git a/VERSION b/VERSION index db889f6e5..b2b3682e5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.296 \ No newline at end of file +1.36.297 \ No newline at end of file diff --git a/geoip/CMakeLists.txt b/geoip/CMakeLists.txt new file mode 100644 index 000000000..04b6aa409 --- /dev/null +++ b/geoip/CMakeLists.txt @@ -0,0 +1,98 @@ +# +# 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(geoip_public_header + include/alibabacloud/geoip/GeoipClient.h + include/alibabacloud/geoip/GeoipExport.h ) + +set(geoip_public_header_model + include/alibabacloud/geoip/model/DescribeGeoipInstanceRequest.h + include/alibabacloud/geoip/model/DescribeGeoipInstanceResult.h + include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsRequest.h + include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsResult.h + include/alibabacloud/geoip/model/DescribeGeoipInstancesRequest.h + include/alibabacloud/geoip/model/DescribeGeoipInstancesResult.h + include/alibabacloud/geoip/model/DescribeIpv6LocationRequest.h + include/alibabacloud/geoip/model/DescribeIpv6LocationResult.h ) + +set(geoip_src + src/GeoipClient.cc + src/model/DescribeGeoipInstanceRequest.cc + src/model/DescribeGeoipInstanceResult.cc + src/model/DescribeGeoipInstanceStatisticsRequest.cc + src/model/DescribeGeoipInstanceStatisticsResult.cc + src/model/DescribeGeoipInstancesRequest.cc + src/model/DescribeGeoipInstancesResult.cc + src/model/DescribeIpv6LocationRequest.cc + src/model/DescribeIpv6LocationResult.cc ) + +add_library(geoip ${LIB_TYPE} + ${geoip_public_header} + ${geoip_public_header_model} + ${geoip_src}) + +set_target_properties(geoip + 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}geoip + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(geoip + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_GEOIP_LIBRARY) +endif() + +target_include_directories(geoip + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(geoip + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(geoip + jsoncpp) + target_include_directories(geoip + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(geoip + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(geoip + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(geoip + PRIVATE /usr/include/jsoncpp) + target_link_libraries(geoip + jsoncpp) +endif() + +install(FILES ${geoip_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/geoip) +install(FILES ${geoip_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/geoip/model) +install(TARGETS geoip + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/GeoipClient.h b/geoip/include/alibabacloud/geoip/GeoipClient.h new file mode 100644 index 000000000..68116b954 --- /dev/null +++ b/geoip/include/alibabacloud/geoip/GeoipClient.h @@ -0,0 +1,78 @@ +/* + * 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_GEOIPCLIENT_H_ +#define ALIBABACLOUD_GEOIP_GEOIPCLIENT_H_ + +#include +#include +#include +#include +#include "GeoipExport.h" +#include "model/DescribeGeoipInstanceRequest.h" +#include "model/DescribeGeoipInstanceResult.h" +#include "model/DescribeGeoipInstanceStatisticsRequest.h" +#include "model/DescribeGeoipInstanceStatisticsResult.h" +#include "model/DescribeGeoipInstancesRequest.h" +#include "model/DescribeGeoipInstancesResult.h" +#include "model/DescribeIpv6LocationRequest.h" +#include "model/DescribeIpv6LocationResult.h" + + +namespace AlibabaCloud +{ + namespace Geoip + { + class ALIBABACLOUD_GEOIP_EXPORT GeoipClient : public RpcServiceClient + { + public: + typedef Outcome DescribeGeoipInstanceOutcome; + typedef std::future DescribeGeoipInstanceOutcomeCallable; + typedef std::function&)> DescribeGeoipInstanceAsyncHandler; + typedef Outcome DescribeGeoipInstanceStatisticsOutcome; + typedef std::future DescribeGeoipInstanceStatisticsOutcomeCallable; + typedef std::function&)> DescribeGeoipInstanceStatisticsAsyncHandler; + typedef Outcome DescribeGeoipInstancesOutcome; + typedef std::future DescribeGeoipInstancesOutcomeCallable; + typedef std::function&)> DescribeGeoipInstancesAsyncHandler; + typedef Outcome DescribeIpv6LocationOutcome; + typedef std::future DescribeIpv6LocationOutcomeCallable; + typedef std::function&)> DescribeIpv6LocationAsyncHandler; + + GeoipClient(const Credentials &credentials, const ClientConfiguration &configuration); + GeoipClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + GeoipClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~GeoipClient(); + 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; + 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; + DescribeGeoipInstancesOutcome describeGeoipInstances(const Model::DescribeGeoipInstancesRequest &request)const; + void describeGeoipInstancesAsync(const Model::DescribeGeoipInstancesRequest& request, const DescribeGeoipInstancesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeGeoipInstancesOutcomeCallable describeGeoipInstancesCallable(const Model::DescribeGeoipInstancesRequest& request) const; + DescribeIpv6LocationOutcome describeIpv6Location(const Model::DescribeIpv6LocationRequest &request)const; + void describeIpv6LocationAsync(const Model::DescribeIpv6LocationRequest& request, const DescribeIpv6LocationAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeIpv6LocationOutcomeCallable describeIpv6LocationCallable(const Model::DescribeIpv6LocationRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_GEOIP_GEOIPCLIENT_H_ diff --git a/geoip/include/alibabacloud/geoip/GeoipExport.h b/geoip/include/alibabacloud/geoip/GeoipExport.h new file mode 100644 index 000000000..ada34056b --- /dev/null +++ b/geoip/include/alibabacloud/geoip/GeoipExport.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_GEOIP_GEOIPEXPORT_H_ +#define ALIBABACLOUD_GEOIP_GEOIPEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_GEOIP_LIBRARY) +# define ALIBABACLOUD_GEOIP_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_GEOIP_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_GEOIP_EXPORT +#endif + +#endif // !ALIBABACLOUD_GEOIP_GEOIPEXPORT_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceRequest.h b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceRequest.h new file mode 100644 index 000000000..8eb41c6af --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceRequest.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_DESCRIBEGEOIPINSTANCEREQUEST_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeGeoipInstanceRequest : public RpcServiceRequest + { + + public: + DescribeGeoipInstanceRequest(); + ~DescribeGeoipInstanceRequest(); + + 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_DESCRIBEGEOIPINSTANCEREQUEST_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceResult.h b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceResult.h new file mode 100644 index 000000000..1023a3fda --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceResult.h @@ -0,0 +1,69 @@ +/* + * 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_DESCRIBEGEOIPINSTANCERESULT_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeGeoipInstanceResult : public ServiceResult + { + public: + + + DescribeGeoipInstanceResult(); + explicit DescribeGeoipInstanceResult(const std::string &payload); + ~DescribeGeoipInstanceResult(); + std::string getVersionCode()const; + long getExpireTimestamp()const; + long getMaxQpd()const; + long getMaxQps()const; + std::string getProductCode()const; + std::string getInstanceId()const; + std::string getCreateTime()const; + long getQueryCount()const; + std::string getExpireTime()const; + long getCreateTimestamp()const; + + protected: + void parse(const std::string &payload); + private: + std::string versionCode_; + long expireTimestamp_; + long maxQpd_; + long maxQps_; + std::string productCode_; + std::string instanceId_; + std::string createTime_; + long queryCount_; + std::string expireTime_; + long createTimestamp_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCERESULT_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsRequest.h b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsRequest.h new file mode 100644 index 000000000..365dc3cad --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsRequest.h @@ -0,0 +1,60 @@ +/* + * 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_DESCRIBEGEOIPINSTANCESTATISTICSREQUEST_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCESTATISTICSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeGeoipInstanceStatisticsRequest : public RpcServiceRequest + { + + public: + DescribeGeoipInstanceStatisticsRequest(); + ~DescribeGeoipInstanceStatisticsRequest(); + + std::string getStartDate()const; + void setStartDate(const std::string& startDate); + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + std::string getEndDate()const; + void setEndDate(const std::string& endDate); + std::string getUserClientIp()const; + void setUserClientIp(const std::string& userClientIp); + std::string getLang()const; + void setLang(const std::string& lang); + + private: + std::string startDate_; + std::string instanceId_; + std::string endDate_; + std::string userClientIp_; + std::string lang_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCESTATISTICSREQUEST_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsResult.h b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsResult.h new file mode 100644 index 000000000..260753326 --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsResult.h @@ -0,0 +1,56 @@ +/* + * 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_DESCRIBEGEOIPINSTANCESTATISTICSRESULT_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCESTATISTICSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeGeoipInstanceStatisticsResult : public ServiceResult + { + public: + struct Statistic + { + long count; + long timestamp; + }; + + + DescribeGeoipInstanceStatisticsResult(); + explicit DescribeGeoipInstanceStatisticsResult(const std::string &payload); + ~DescribeGeoipInstanceStatisticsResult(); + std::vector getStatistics()const; + + protected: + void parse(const std::string &payload); + private: + std::vector statistics_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCESTATISTICSRESULT_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstancesRequest.h b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstancesRequest.h new file mode 100644 index 000000000..659d65044 --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstancesRequest.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_DESCRIBEGEOIPINSTANCESREQUEST_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCESREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeGeoipInstancesRequest : public RpcServiceRequest + { + + public: + DescribeGeoipInstancesRequest(); + ~DescribeGeoipInstancesRequest(); + + std::string getUserClientIp()const; + void setUserClientIp(const std::string& userClientIp); + std::string getLang()const; + void setLang(const std::string& lang); + + private: + std::string userClientIp_; + std::string lang_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCESREQUEST_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstancesResult.h b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstancesResult.h new file mode 100644 index 000000000..502983eab --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeGeoipInstancesResult.h @@ -0,0 +1,64 @@ +/* + * 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_DESCRIBEGEOIPINSTANCESRESULT_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCESRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeGeoipInstancesResult : public ServiceResult + { + public: + struct GeoipInstance + { + std::string status; + std::string versionCode; + long expireTimestamp; + long maxQpd; + long maxQps; + std::string productCode; + std::string instanceId; + std::string createTime; + std::string expireTime; + long createTimestamp; + }; + + + DescribeGeoipInstancesResult(); + explicit DescribeGeoipInstancesResult(const std::string &payload); + ~DescribeGeoipInstancesResult(); + std::vector getGeoipInstances()const; + + protected: + void parse(const std::string &payload); + private: + std::vector geoipInstances_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCESRESULT_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeIpv6LocationRequest.h b/geoip/include/alibabacloud/geoip/model/DescribeIpv6LocationRequest.h new file mode 100644 index 000000000..1eb48f688 --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeIpv6LocationRequest.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_DESCRIBEIPV6LOCATIONREQUEST_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEIPV6LOCATIONREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeIpv6LocationRequest : public RpcServiceRequest + { + + public: + DescribeIpv6LocationRequest(); + ~DescribeIpv6LocationRequest(); + + std::string getIp()const; + void setIp(const std::string& ip); + std::string getUserClientIp()const; + void setUserClientIp(const std::string& userClientIp); + std::string getLang()const; + void setLang(const std::string& lang); + + private: + std::string ip_; + std::string userClientIp_; + std::string lang_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEIPV6LOCATIONREQUEST_H_ \ No newline at end of file diff --git a/geoip/include/alibabacloud/geoip/model/DescribeIpv6LocationResult.h b/geoip/include/alibabacloud/geoip/model/DescribeIpv6LocationResult.h new file mode 100644 index 000000000..9559ba17a --- /dev/null +++ b/geoip/include/alibabacloud/geoip/model/DescribeIpv6LocationResult.h @@ -0,0 +1,61 @@ +/* + * 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_DESCRIBEIPV6LOCATIONRESULT_H_ +#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEIPV6LOCATIONRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Geoip + { + namespace Model + { + class ALIBABACLOUD_GEOIP_EXPORT DescribeIpv6LocationResult : public ServiceResult + { + public: + + + DescribeIpv6LocationResult(); + explicit DescribeIpv6LocationResult(const std::string &payload); + ~DescribeIpv6LocationResult(); + std::string getIp()const; + std::string getIsp()const; + std::string getCountry()const; + std::string getCity()const; + std::string getCounty()const; + std::string getProvince()const; + + protected: + void parse(const std::string &payload); + private: + std::string ip_; + std::string isp_; + std::string country_; + std::string city_; + std::string county_; + std::string province_; + + }; + } + } +} +#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEIPV6LOCATIONRESULT_H_ \ No newline at end of file diff --git a/geoip/src/GeoipClient.cc b/geoip/src/GeoipClient.cc new file mode 100644 index 000000000..5bc24a5dd --- /dev/null +++ b/geoip/src/GeoipClient.cc @@ -0,0 +1,197 @@ +/* + * 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::Geoip; +using namespace AlibabaCloud::Geoip::Model; + +namespace +{ + const std::string SERVICE_NAME = "geoip"; +} + +GeoipClient::GeoipClient(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, "geoip"); +} + +GeoipClient::GeoipClient(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, "geoip"); +} + +GeoipClient::GeoipClient(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, "geoip"); +} + +GeoipClient::~GeoipClient() +{} + +GeoipClient::DescribeGeoipInstanceOutcome GeoipClient::describeGeoipInstance(const DescribeGeoipInstanceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeGeoipInstanceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeGeoipInstanceOutcome(DescribeGeoipInstanceResult(outcome.result())); + else + return DescribeGeoipInstanceOutcome(outcome.error()); +} + +void GeoipClient::describeGeoipInstanceAsync(const DescribeGeoipInstanceRequest& request, const DescribeGeoipInstanceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeGeoipInstance(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +GeoipClient::DescribeGeoipInstanceOutcomeCallable GeoipClient::describeGeoipInstanceCallable(const DescribeGeoipInstanceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeGeoipInstance(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +GeoipClient::DescribeGeoipInstanceStatisticsOutcome GeoipClient::describeGeoipInstanceStatistics(const DescribeGeoipInstanceStatisticsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeGeoipInstanceStatisticsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeGeoipInstanceStatisticsOutcome(DescribeGeoipInstanceStatisticsResult(outcome.result())); + else + return DescribeGeoipInstanceStatisticsOutcome(outcome.error()); +} + +void GeoipClient::describeGeoipInstanceStatisticsAsync(const DescribeGeoipInstanceStatisticsRequest& request, const DescribeGeoipInstanceStatisticsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeGeoipInstanceStatistics(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +GeoipClient::DescribeGeoipInstanceStatisticsOutcomeCallable GeoipClient::describeGeoipInstanceStatisticsCallable(const DescribeGeoipInstanceStatisticsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeGeoipInstanceStatistics(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +GeoipClient::DescribeGeoipInstancesOutcome GeoipClient::describeGeoipInstances(const DescribeGeoipInstancesRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeGeoipInstancesOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeGeoipInstancesOutcome(DescribeGeoipInstancesResult(outcome.result())); + else + return DescribeGeoipInstancesOutcome(outcome.error()); +} + +void GeoipClient::describeGeoipInstancesAsync(const DescribeGeoipInstancesRequest& request, const DescribeGeoipInstancesAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeGeoipInstances(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +GeoipClient::DescribeGeoipInstancesOutcomeCallable GeoipClient::describeGeoipInstancesCallable(const DescribeGeoipInstancesRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeGeoipInstances(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +GeoipClient::DescribeIpv6LocationOutcome GeoipClient::describeIpv6Location(const DescribeIpv6LocationRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeIpv6LocationOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeIpv6LocationOutcome(DescribeIpv6LocationResult(outcome.result())); + else + return DescribeIpv6LocationOutcome(outcome.error()); +} + +void GeoipClient::describeIpv6LocationAsync(const DescribeIpv6LocationRequest& request, const DescribeIpv6LocationAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeIpv6Location(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +GeoipClient::DescribeIpv6LocationOutcomeCallable GeoipClient::describeIpv6LocationCallable(const DescribeIpv6LocationRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeIpv6Location(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/geoip/src/model/DescribeGeoipInstanceRequest.cc b/geoip/src/model/DescribeGeoipInstanceRequest.cc new file mode 100644 index 000000000..ccb89dc89 --- /dev/null +++ b/geoip/src/model/DescribeGeoipInstanceRequest.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::DescribeGeoipInstanceRequest; + +DescribeGeoipInstanceRequest::DescribeGeoipInstanceRequest() : + RpcServiceRequest("geoip", "2020-01-01", "DescribeGeoipInstance") +{ + setMethod(HttpRequest::Method::POST); +} + +DescribeGeoipInstanceRequest::~DescribeGeoipInstanceRequest() +{} + +std::string DescribeGeoipInstanceRequest::getInstanceId()const +{ + return instanceId_; +} + +void DescribeGeoipInstanceRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string DescribeGeoipInstanceRequest::getUserClientIp()const +{ + return userClientIp_; +} + +void DescribeGeoipInstanceRequest::setUserClientIp(const std::string& userClientIp) +{ + userClientIp_ = userClientIp; + setParameter("UserClientIp", userClientIp); +} + +std::string DescribeGeoipInstanceRequest::getLang()const +{ + return lang_; +} + +void DescribeGeoipInstanceRequest::setLang(const std::string& lang) +{ + lang_ = lang; + setParameter("Lang", lang); +} + diff --git a/geoip/src/model/DescribeGeoipInstanceResult.cc b/geoip/src/model/DescribeGeoipInstanceResult.cc new file mode 100644 index 000000000..c4547b47d --- /dev/null +++ b/geoip/src/model/DescribeGeoipInstanceResult.cc @@ -0,0 +1,114 @@ +/* + * 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; + +DescribeGeoipInstanceResult::DescribeGeoipInstanceResult() : + ServiceResult() +{} + +DescribeGeoipInstanceResult::DescribeGeoipInstanceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeGeoipInstanceResult::~DescribeGeoipInstanceResult() +{} + +void DescribeGeoipInstanceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["ProductCode"].isNull()) + productCode_ = value["ProductCode"].asString(); + if(!value["InstanceId"].isNull()) + instanceId_ = value["InstanceId"].asString(); + if(!value["VersionCode"].isNull()) + versionCode_ = value["VersionCode"].asString(); + if(!value["MaxQps"].isNull()) + maxQps_ = std::stol(value["MaxQps"].asString()); + if(!value["MaxQpd"].isNull()) + maxQpd_ = std::stol(value["MaxQpd"].asString()); + if(!value["QueryCount"].isNull()) + queryCount_ = std::stol(value["QueryCount"].asString()); + if(!value["CreateTime"].isNull()) + createTime_ = value["CreateTime"].asString(); + if(!value["CreateTimestamp"].isNull()) + createTimestamp_ = std::stol(value["CreateTimestamp"].asString()); + if(!value["ExpireTime"].isNull()) + expireTime_ = value["ExpireTime"].asString(); + if(!value["ExpireTimestamp"].isNull()) + expireTimestamp_ = std::stol(value["ExpireTimestamp"].asString()); + +} + +std::string DescribeGeoipInstanceResult::getVersionCode()const +{ + return versionCode_; +} + +long DescribeGeoipInstanceResult::getExpireTimestamp()const +{ + return expireTimestamp_; +} + +long DescribeGeoipInstanceResult::getMaxQpd()const +{ + return maxQpd_; +} + +long DescribeGeoipInstanceResult::getMaxQps()const +{ + return maxQps_; +} + +std::string DescribeGeoipInstanceResult::getProductCode()const +{ + return productCode_; +} + +std::string DescribeGeoipInstanceResult::getInstanceId()const +{ + return instanceId_; +} + +std::string DescribeGeoipInstanceResult::getCreateTime()const +{ + return createTime_; +} + +long DescribeGeoipInstanceResult::getQueryCount()const +{ + return queryCount_; +} + +std::string DescribeGeoipInstanceResult::getExpireTime()const +{ + return expireTime_; +} + +long DescribeGeoipInstanceResult::getCreateTimestamp()const +{ + return createTimestamp_; +} + diff --git a/geoip/src/model/DescribeGeoipInstanceStatisticsRequest.cc b/geoip/src/model/DescribeGeoipInstanceStatisticsRequest.cc new file mode 100644 index 000000000..98252069d --- /dev/null +++ b/geoip/src/model/DescribeGeoipInstanceStatisticsRequest.cc @@ -0,0 +1,84 @@ +/* + * 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::DescribeGeoipInstanceStatisticsRequest; + +DescribeGeoipInstanceStatisticsRequest::DescribeGeoipInstanceStatisticsRequest() : + RpcServiceRequest("geoip", "2020-01-01", "DescribeGeoipInstanceStatistics") +{ + setMethod(HttpRequest::Method::POST); +} + +DescribeGeoipInstanceStatisticsRequest::~DescribeGeoipInstanceStatisticsRequest() +{} + +std::string DescribeGeoipInstanceStatisticsRequest::getStartDate()const +{ + return startDate_; +} + +void DescribeGeoipInstanceStatisticsRequest::setStartDate(const std::string& startDate) +{ + startDate_ = startDate; + setParameter("StartDate", startDate); +} + +std::string DescribeGeoipInstanceStatisticsRequest::getInstanceId()const +{ + return instanceId_; +} + +void DescribeGeoipInstanceStatisticsRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string DescribeGeoipInstanceStatisticsRequest::getEndDate()const +{ + return endDate_; +} + +void DescribeGeoipInstanceStatisticsRequest::setEndDate(const std::string& endDate) +{ + endDate_ = endDate; + setParameter("EndDate", endDate); +} + +std::string DescribeGeoipInstanceStatisticsRequest::getUserClientIp()const +{ + return userClientIp_; +} + +void DescribeGeoipInstanceStatisticsRequest::setUserClientIp(const std::string& userClientIp) +{ + userClientIp_ = userClientIp; + setParameter("UserClientIp", userClientIp); +} + +std::string DescribeGeoipInstanceStatisticsRequest::getLang()const +{ + return lang_; +} + +void DescribeGeoipInstanceStatisticsRequest::setLang(const std::string& lang) +{ + lang_ = lang; + setParameter("Lang", lang); +} + diff --git a/geoip/src/model/DescribeGeoipInstanceStatisticsResult.cc b/geoip/src/model/DescribeGeoipInstanceStatisticsResult.cc new file mode 100644 index 000000000..2bb0d91bc --- /dev/null +++ b/geoip/src/model/DescribeGeoipInstanceStatisticsResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::Geoip; +using namespace AlibabaCloud::Geoip::Model; + +DescribeGeoipInstanceStatisticsResult::DescribeGeoipInstanceStatisticsResult() : + ServiceResult() +{} + +DescribeGeoipInstanceStatisticsResult::DescribeGeoipInstanceStatisticsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeGeoipInstanceStatisticsResult::~DescribeGeoipInstanceStatisticsResult() +{} + +void DescribeGeoipInstanceStatisticsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allStatisticsNode = value["Statistics"]["Statistic"]; + for (auto valueStatisticsStatistic : allStatisticsNode) + { + Statistic statisticsObject; + if(!valueStatisticsStatistic["Timestamp"].isNull()) + statisticsObject.timestamp = std::stol(valueStatisticsStatistic["Timestamp"].asString()); + if(!valueStatisticsStatistic["Count"].isNull()) + statisticsObject.count = std::stol(valueStatisticsStatistic["Count"].asString()); + statistics_.push_back(statisticsObject); + } + +} + +std::vector DescribeGeoipInstanceStatisticsResult::getStatistics()const +{ + return statistics_; +} + diff --git a/geoip/src/model/DescribeGeoipInstancesRequest.cc b/geoip/src/model/DescribeGeoipInstancesRequest.cc new file mode 100644 index 000000000..32675990d --- /dev/null +++ b/geoip/src/model/DescribeGeoipInstancesRequest.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 + +using AlibabaCloud::Geoip::Model::DescribeGeoipInstancesRequest; + +DescribeGeoipInstancesRequest::DescribeGeoipInstancesRequest() : + RpcServiceRequest("geoip", "2020-01-01", "DescribeGeoipInstances") +{ + setMethod(HttpRequest::Method::POST); +} + +DescribeGeoipInstancesRequest::~DescribeGeoipInstancesRequest() +{} + +std::string DescribeGeoipInstancesRequest::getUserClientIp()const +{ + return userClientIp_; +} + +void DescribeGeoipInstancesRequest::setUserClientIp(const std::string& userClientIp) +{ + userClientIp_ = userClientIp; + setParameter("UserClientIp", userClientIp); +} + +std::string DescribeGeoipInstancesRequest::getLang()const +{ + return lang_; +} + +void DescribeGeoipInstancesRequest::setLang(const std::string& lang) +{ + lang_ = lang; + setParameter("Lang", lang); +} + diff --git a/geoip/src/model/DescribeGeoipInstancesResult.cc b/geoip/src/model/DescribeGeoipInstancesResult.cc new file mode 100644 index 000000000..eca77c48d --- /dev/null +++ b/geoip/src/model/DescribeGeoipInstancesResult.cc @@ -0,0 +1,75 @@ +/* + * 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; + +DescribeGeoipInstancesResult::DescribeGeoipInstancesResult() : + ServiceResult() +{} + +DescribeGeoipInstancesResult::DescribeGeoipInstancesResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeGeoipInstancesResult::~DescribeGeoipInstancesResult() +{} + +void DescribeGeoipInstancesResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allGeoipInstancesNode = value["GeoipInstances"]["GeoipInstance"]; + for (auto valueGeoipInstancesGeoipInstance : allGeoipInstancesNode) + { + GeoipInstance geoipInstancesObject; + if(!valueGeoipInstancesGeoipInstance["ProductCode"].isNull()) + geoipInstancesObject.productCode = valueGeoipInstancesGeoipInstance["ProductCode"].asString(); + if(!valueGeoipInstancesGeoipInstance["InstanceId"].isNull()) + geoipInstancesObject.instanceId = valueGeoipInstancesGeoipInstance["InstanceId"].asString(); + if(!valueGeoipInstancesGeoipInstance["VersionCode"].isNull()) + geoipInstancesObject.versionCode = valueGeoipInstancesGeoipInstance["VersionCode"].asString(); + if(!valueGeoipInstancesGeoipInstance["Status"].isNull()) + geoipInstancesObject.status = valueGeoipInstancesGeoipInstance["Status"].asString(); + if(!valueGeoipInstancesGeoipInstance["CreateTime"].isNull()) + geoipInstancesObject.createTime = valueGeoipInstancesGeoipInstance["CreateTime"].asString(); + if(!valueGeoipInstancesGeoipInstance["CreateTimestamp"].isNull()) + geoipInstancesObject.createTimestamp = std::stol(valueGeoipInstancesGeoipInstance["CreateTimestamp"].asString()); + if(!valueGeoipInstancesGeoipInstance["ExpireTime"].isNull()) + geoipInstancesObject.expireTime = valueGeoipInstancesGeoipInstance["ExpireTime"].asString(); + if(!valueGeoipInstancesGeoipInstance["ExpireTimestamp"].isNull()) + geoipInstancesObject.expireTimestamp = std::stol(valueGeoipInstancesGeoipInstance["ExpireTimestamp"].asString()); + if(!valueGeoipInstancesGeoipInstance["MaxQps"].isNull()) + geoipInstancesObject.maxQps = std::stol(valueGeoipInstancesGeoipInstance["MaxQps"].asString()); + if(!valueGeoipInstancesGeoipInstance["MaxQpd"].isNull()) + geoipInstancesObject.maxQpd = std::stol(valueGeoipInstancesGeoipInstance["MaxQpd"].asString()); + geoipInstances_.push_back(geoipInstancesObject); + } + +} + +std::vector DescribeGeoipInstancesResult::getGeoipInstances()const +{ + return geoipInstances_; +} + diff --git a/geoip/src/model/DescribeIpv6LocationRequest.cc b/geoip/src/model/DescribeIpv6LocationRequest.cc new file mode 100644 index 000000000..a13af26ef --- /dev/null +++ b/geoip/src/model/DescribeIpv6LocationRequest.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::DescribeIpv6LocationRequest; + +DescribeIpv6LocationRequest::DescribeIpv6LocationRequest() : + RpcServiceRequest("geoip", "2020-01-01", "DescribeIpv6Location") +{ + setMethod(HttpRequest::Method::POST); +} + +DescribeIpv6LocationRequest::~DescribeIpv6LocationRequest() +{} + +std::string DescribeIpv6LocationRequest::getIp()const +{ + return ip_; +} + +void DescribeIpv6LocationRequest::setIp(const std::string& ip) +{ + ip_ = ip; + setParameter("Ip", ip); +} + +std::string DescribeIpv6LocationRequest::getUserClientIp()const +{ + return userClientIp_; +} + +void DescribeIpv6LocationRequest::setUserClientIp(const std::string& userClientIp) +{ + userClientIp_ = userClientIp; + setParameter("UserClientIp", userClientIp); +} + +std::string DescribeIpv6LocationRequest::getLang()const +{ + return lang_; +} + +void DescribeIpv6LocationRequest::setLang(const std::string& lang) +{ + lang_ = lang; + setParameter("Lang", lang); +} + diff --git a/geoip/src/model/DescribeIpv6LocationResult.cc b/geoip/src/model/DescribeIpv6LocationResult.cc new file mode 100644 index 000000000..b0aac4932 --- /dev/null +++ b/geoip/src/model/DescribeIpv6LocationResult.cc @@ -0,0 +1,86 @@ +/* + * 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; + +DescribeIpv6LocationResult::DescribeIpv6LocationResult() : + ServiceResult() +{} + +DescribeIpv6LocationResult::DescribeIpv6LocationResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeIpv6LocationResult::~DescribeIpv6LocationResult() +{} + +void DescribeIpv6LocationResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["Ip"].isNull()) + ip_ = value["Ip"].asString(); + if(!value["Country"].isNull()) + country_ = value["Country"].asString(); + if(!value["Province"].isNull()) + province_ = value["Province"].asString(); + if(!value["City"].isNull()) + city_ = value["City"].asString(); + if(!value["County"].isNull()) + county_ = value["County"].asString(); + if(!value["Isp"].isNull()) + isp_ = value["Isp"].asString(); + +} + +std::string DescribeIpv6LocationResult::getIp()const +{ + return ip_; +} + +std::string DescribeIpv6LocationResult::getIsp()const +{ + return isp_; +} + +std::string DescribeIpv6LocationResult::getCountry()const +{ + return country_; +} + +std::string DescribeIpv6LocationResult::getCity()const +{ + return city_; +} + +std::string DescribeIpv6LocationResult::getCounty()const +{ + return county_; +} + +std::string DescribeIpv6LocationResult::getProvince()const +{ + return province_; +} +