GeoIP Databases SDK initial release.

This commit is contained in:
sdk-team
2020-03-03 11:44:05 +08:00
parent 2c8cadba25
commit 82ce70d07f
22 changed files with 1471 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
2020-03-03 Version: 1.36.297
- GeoIP Databases SDK initial release.
2020-03-03 Version: 1.36.296 2020-03-03 Version: 1.36.296
- Supported secretmanager for kms. - Supported secretmanager for kms.

View File

@@ -1 +1 @@
1.36.296 1.36.297

98
geoip/CMakeLists.txt Normal file
View File

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

View File

@@ -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 <future>
#include <alibabacloud/core/AsyncCallerContext.h>
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#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<Error, Model::DescribeGeoipInstanceResult> DescribeGeoipInstanceOutcome;
typedef std::future<DescribeGeoipInstanceOutcome> DescribeGeoipInstanceOutcomeCallable;
typedef std::function<void(const GeoipClient*, const Model::DescribeGeoipInstanceRequest&, const DescribeGeoipInstanceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeGeoipInstanceAsyncHandler;
typedef Outcome<Error, Model::DescribeGeoipInstanceStatisticsResult> DescribeGeoipInstanceStatisticsOutcome;
typedef std::future<DescribeGeoipInstanceStatisticsOutcome> DescribeGeoipInstanceStatisticsOutcomeCallable;
typedef std::function<void(const GeoipClient*, const Model::DescribeGeoipInstanceStatisticsRequest&, const DescribeGeoipInstanceStatisticsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeGeoipInstanceStatisticsAsyncHandler;
typedef Outcome<Error, Model::DescribeGeoipInstancesResult> DescribeGeoipInstancesOutcome;
typedef std::future<DescribeGeoipInstancesOutcome> DescribeGeoipInstancesOutcomeCallable;
typedef std::function<void(const GeoipClient*, const Model::DescribeGeoipInstancesRequest&, const DescribeGeoipInstancesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeGeoipInstancesAsyncHandler;
typedef Outcome<Error, Model::DescribeIpv6LocationResult> DescribeIpv6LocationOutcome;
typedef std::future<DescribeIpv6LocationOutcome> DescribeIpv6LocationOutcomeCallable;
typedef std::function<void(const GeoipClient*, const Model::DescribeIpv6LocationRequest&, const DescribeIpv6LocationOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeIpv6LocationAsyncHandler;
GeoipClient(const Credentials &credentials, const ClientConfiguration &configuration);
GeoipClient(const std::shared_ptr<CredentialsProvider> &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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& context = nullptr) const;
DescribeIpv6LocationOutcomeCallable describeIpv6LocationCallable(const Model::DescribeIpv6LocationRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;
};
}
}
#endif // !ALIBABACLOUD_GEOIP_GEOIPCLIENT_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_GEOIP_GEOIPEXPORT_H_
#define ALIBABACLOUD_GEOIP_GEOIPEXPORT_H_
#include <alibabacloud/core/Global.h>
#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_

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_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEREQUEST_H_
#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCEREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/geoip/GeoipExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/geoip/GeoipExport.h>
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_

View File

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

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/geoip/GeoipExport.h>
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<Statistic> getStatistics()const;
protected:
void parse(const std::string &payload);
private:
std::vector<Statistic> statistics_;
};
}
}
}
#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCESTATISTICSRESULT_H_

View File

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

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/geoip/GeoipExport.h>
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<GeoipInstance> getGeoipInstances()const;
protected:
void parse(const std::string &payload);
private:
std::vector<GeoipInstance> geoipInstances_;
};
}
}
}
#endif // !ALIBABACLOUD_GEOIP_MODEL_DESCRIBEGEOIPINSTANCESRESULT_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_GEOIP_MODEL_DESCRIBEIPV6LOCATIONREQUEST_H_
#define ALIBABACLOUD_GEOIP_MODEL_DESCRIBEIPV6LOCATIONREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/geoip/GeoipExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/geoip/GeoipExport.h>
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_

197
geoip/src/GeoipClient.cc Normal file
View File

@@ -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 <alibabacloud/geoip/GeoipClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
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<SimpleCredentialsProvider>(credentials), configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "geoip");
}
GeoipClient::GeoipClient(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, "geoip");
}
GeoipClient::GeoipClient(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, "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<const AsyncCallerContext>& 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<std::packaged_task<DescribeGeoipInstanceOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<DescribeGeoipInstanceStatisticsOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<DescribeGeoipInstancesOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<DescribeIpv6LocationOutcome()>>(
[this, request]()
{
return this->describeIpv6Location(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

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.
*/
#include <alibabacloud/geoip/model/DescribeGeoipInstanceRequest.h>
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);
}

View File

@@ -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 <alibabacloud/geoip/model/DescribeGeoipInstanceResult.h>
#include <json/json.h>
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_;
}

View File

@@ -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 <alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsRequest.h>
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);
}

View File

@@ -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 <alibabacloud/geoip/model/DescribeGeoipInstanceStatisticsResult.h>
#include <json/json.h>
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::Statistic> DescribeGeoipInstanceStatisticsResult::getStatistics()const
{
return statistics_;
}

View File

@@ -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 <alibabacloud/geoip/model/DescribeGeoipInstancesRequest.h>
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);
}

View File

@@ -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 <alibabacloud/geoip/model/DescribeGeoipInstancesResult.h>
#include <json/json.h>
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::GeoipInstance> DescribeGeoipInstancesResult::getGeoipInstances()const
{
return geoipInstances_;
}

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.
*/
#include <alibabacloud/geoip/model/DescribeIpv6LocationRequest.h>
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);
}

View File

@@ -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 <alibabacloud/geoip/model/DescribeIpv6LocationResult.h>
#include <json/json.h>
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_;
}