Compare commits

..

3 Commits

Author SHA1 Message Date
haowei.yao
eea054f3c4 YUNDUN SDK Auto Released By shenshi,Version:1.34.35
Signed-off-by: haowei.yao <haowei.yao@alibaba-inc.com>
2019-03-15 18:02:59 +08:00
zhangzifa
619a7827de timeout support when create client or make request 2019-03-15 17:20:18 +08:00
haowei.yao
8c9353a007 UBSMS SDK Auto Released By shenshi,Version:1.34.34
Signed-off-by: haowei.yao <haowei.yao@alibaba-inc.com>
2019-03-15 16:33:42 +08:00
91 changed files with 4574 additions and 96 deletions

1
.gitignore vendored
View File

@@ -7,6 +7,7 @@ Testing/
ft_build/
ut_build/
sdk_build/
examples/build/
test/httpserver/node_modules
test/httpserver/package-lock.json
test/httpserver/nohup.out

View File

@@ -1,3 +1,9 @@
2019-03-15 Version: 1.34.35
1, Update Dependency
2019-03-15 Version: 1.34.34
1, Update Dependency
2019-03-15 Version: 1.34.33
1, Update Dependency

View File

@@ -37,9 +37,10 @@ if(BUILD_UNIT_TESTS)
endif()
if(BUILD_FUNCTION_TESTS)
enable_testing()
add_subdirectory(test/function_test/cdn)
enable_testing()
add_subdirectory(test/function_test/cdn)
add_subdirectory(test/function_test/core)
add_subdirectory(test/function_test/cs)
add_subdirectory(test/function_test/ecs)
add_subdirectory(test/function_test/nlp)
add_subdirectory(test/function_test/rds)
@@ -90,16 +91,19 @@ add_subdirectory(saf)
add_subdirectory(arms)
add_subdirectory(lubancloud)
add_subdirectory(alimt)
add_subdirectory(xspace)
add_subdirectory(jarvis-public)
add_subdirectory(cbn)
add_subdirectory(emr)
add_subdirectory(ram)
add_subdirectory(sts)
add_subdirectory(gpdb)
add_subdirectory(sas-api)
add_subdirectory(cr)
add_subdirectory(finmall)
add_subdirectory(openanalytics)
add_subdirectory(snsuapi)
add_subdirectory(ubsms)
add_subdirectory(xspace)
add_subdirectory(jarvis-public)
add_subdirectory(cbn)
add_subdirectory(emr)
add_subdirectory(ram)
add_subdirectory(sts)
add_subdirectory(gpdb)
add_subdirectory(sas-api)
add_subdirectory(cr)
add_subdirectory(finmall)
add_subdirectory(openanalytics)
add_subdirectory(snsuapi)
add_subdirectory(yundun)

View File

@@ -157,6 +157,73 @@ Copy the above to ecs_test.cc, then build with the following command.
~$
```
## Timeout Configuration
CPP SDK uses libcurl to do HTTP transfer.
- The following timeout parameters are used to for libcurl.
- `connectTimeout`: timeout for the connect phase. [Refer](https://curl.haxx.se/libcurl/c/CURLOPT_CONNECTTIMEOUT_MS.html).
- `readTimeout`: maximum time the request is allowed to take, [Refer](https://curl.haxx.se/libcurl/c/CURLOPT_TIMEOUT_MS.html)
- Default Value
- `connectTimeout`: 5000ms
- `readTimeout`: 10000ms
- You may specify `timeout` parameters when create a client or make a request.
- Request timeout has higher priority than client timeout.
- If you want to disable timeout feature, deliver `0` or `-1` to `setConnectTimeout` and `setReadTimeout`.
The following code shows hot to specify `timeout` parameters, and the final connectTimeout is 1000ms and readTimeout 6000ms.
```cpp
#include <iostream>
#include <alibabacloud/core/AlibabaCloud.h>
#include <alibabacloud/ecs/EcsClient.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Ecs;
int main(int argc, char** argv) {
// Initialize the SDK
AlibabaCloud::InitializeSdk();
// Configure the ECS instance
ClientConfiguration configuration("<your-region-id>");
// specify timeout when create client.
configuration.setConnectTimeout(1500);
configuration.setReadTimeout(4000);
EcsClient client("<your-access-key-id>", "<your-access-key-secret>", configuration);
// Create an API request and set parameters
Model::DescribeInstancesRequest request;
request.setPageSize(10);
// specify timeout when request
request.setConnectTimeout(1000);
request.setReadTimeout(6000);
auto outcome = client.describeInstances(request);
if (!outcome.isSuccess()) {
// Handle exceptions
std::cout << outcome.error().errorCode() << std::endl;
AlibabaCloud::ShutdownSdk();
return -1;
}
std::cout << "totalCount: " << outcome.result().getTotalCount() << std::endl;
// Close the SDK
AlibabaCloud::ShutdownSdk();
return 0;
}
```
**More [examples](https://github.com/aliyun/aliyun-openapi-cpp-sdk/tree/master/examples)**
## LICENSE

View File

@@ -165,6 +165,76 @@ Linux 下
~$
```
## Timeout 设置
CPP SDK 使用 libcurl 作为底层 HTTP 传输库。
- 下面两个参数用来传递超时参数到 libcurl。
- `connectTimeout`: 连接超时设置。 [参考](https://curl.haxx.se/libcurl/c/CURLOPT_CONNECTTIMEOUT_MS.html).
- `readTimeout`: 传输超时设置。[参考](https://curl.haxx.se/libcurl/c/CURLOPT_TIMEOUT_MS.html)
- 默认值
- connectTimeout: 5000ms
- readTimeout: 10000ms
- 可以在创建 Client 或者发 Requst 设置超时参数。
- Requst 设置优先级高于 Client 设置。
- 输入 0 或者 -1 到 `setConnectTimeout``setReadTimeout` 可以禁用此功能。
下面代码是设置超时参数的例子,由于 Request 优先级高于 Client所以最终 `ConnectTimeout``1000ms` `readTimeout``6000ms`
```cpp
#include <iostream>
#include <alibabacloud/core/AlibabaCloud.h>
#include <alibabacloud/ecs/EcsClient.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Ecs;
int main(int argc, char** argv) {
// Initialize the SDK
AlibabaCloud::InitializeSdk();
// Configure the ECS instance
ClientConfiguration configuration("<your-region-id>");
// specify timeout when create client.
configuration.setConnectTimeout(1500);
configuration.setReadTimeout(4000);
EcsClient client("<your-access-key-id>", "<your-access-key-secret>", configuration);
// Create an API request and set parameters
Model::DescribeInstancesRequest request;
request.setPageSize(10);
// specify timeout when request
request.setConnectTimeout(1000);
request.setReadTimeout(6000);
auto outcome = client.describeInstances(request);
if (!outcome.isSuccess()) {
// Handle exceptions
std::cout << outcome.error().errorCode() << std::endl;
AlibabaCloud::ShutdownSdk();
return -1;
}
std::cout << "totalCount: " << outcome.result().getTotalCount() << std::endl;
// Close the SDK
AlibabaCloud::ShutdownSdk();
return 0;
}
```
**更多 [例程](https://github.com/aliyun/aliyun-openapi-cpp-sdk/tree/master/examples) 请(参考)[https://github.com/aliyun/aliyun-openapi-cpp-sdk/blob/master/examples/README_zh.md]**
## 许可协议

View File

@@ -1 +1 @@
1.34.33
1.34.35

View File

@@ -18,8 +18,15 @@
#define CORE_INCLUDE_ALIBABACLOUD_CORE_ALIBABACLOUD_H_
#include "CoreExport.h"
#include <limits>
namespace AlibabaCloud {
const long kInvalidTimeout = (std::numeric_limits<long>::min)();
const long kDefaultConnectTimeout = 5000;
const long kDefaultReadTimeout = 10000;
ALIBABACLOUD_CORE_EXPORT void InitializeSdk();
ALIBABACLOUD_CORE_EXPORT bool IsSdkInitialized();
ALIBABACLOUD_CORE_EXPORT void ShutdownSdk();

View File

@@ -38,10 +38,17 @@ class ALIBABACLOUD_CORE_EXPORT ClientConfiguration {
void setProxy(const NetworkProxy &proxy);
void setRegionId(const std::string &regionId);
long connectTimeout() const;
long readTimeout() const;
void setConnectTimeout(const long connectTimeout);
void setReadTimeout(const long readTimeout);
private:
std::string endpoint_;
NetworkProxy proxy_;
std::string regionId_;
long connectTimeout_;
long readTimeout_;
};
} // namespace AlibabaCloud

View File

@@ -42,10 +42,16 @@ class ALIBABACLOUD_CORE_EXPORT HttpRequest : public HttpMessage {
void setMethod(Method method);
void setUrl(const Url &url);
Url url()const;
long connectTimeout() const;
long readTimeout() const;
void setConnectTimeout(const long connectTimeout);
void setReadTimeout(const long readTimeout);
private:
Method method_;
Url url_;
long connectTimeout_;
long readTimeout_;
};
} // namespace AlibabaCloud
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_

View File

@@ -39,6 +39,10 @@ class ALIBABACLOUD_CORE_EXPORT ServiceRequest {
std::string resourcePath() const;
std::string version() const;
std::string scheme() const;
long connectTimeout() const;
long readTimeout() const;
void setConnectTimeout(const long connectTimeout);
void setReadTimeout(const long readTimeout);
protected:
ServiceRequest(const std::string &product, const std::string &version);
@@ -68,6 +72,8 @@ class ALIBABACLOUD_CORE_EXPORT ServiceRequest {
std::string resourcePath_;
std::string version_;
std::string scheme_;
long connectTimeout_;
long readTimeout_;
};
} // namespace AlibabaCloud

View File

@@ -26,14 +26,13 @@ class ALIBABACLOUD_CORE_EXPORT ServiceResult {
public:
ServiceResult();
virtual ~ServiceResult();
std::string requestId()const;
protected:
void setRequestId(const std::string &requestId);
private:
std::string requestId_;
std::string requestId_;
};
} // namespace AlibabaCloud

View File

@@ -15,6 +15,7 @@
*/
#include <alibabacloud/core/ClientConfiguration.h>
#include <alibabacloud/core/AlibabaCloud.h>
namespace AlibabaCloud {
@@ -22,7 +23,9 @@ ClientConfiguration::ClientConfiguration(const std::string &regionId,
const NetworkProxy &proxy):
regionId_(regionId),
proxy_(proxy),
endpoint_() {
endpoint_(),
connectTimeout_(kDefaultConnectTimeout),
readTimeout_(kDefaultReadTimeout) {
}
ClientConfiguration::~ClientConfiguration() {
@@ -52,4 +55,20 @@ void ClientConfiguration::setRegionId(const std::string &regionId) {
regionId_ = regionId;
}
long ClientConfiguration::connectTimeout() const {
return connectTimeout_;
}
long ClientConfiguration::readTimeout() const {
return readTimeout_;
}
void ClientConfiguration::setConnectTimeout(const long connectTimeout) {
connectTimeout_ = connectTimeout;
}
void ClientConfiguration::setReadTimeout(const long readTimeout) {
readTimeout_ = readTimeout;
}
} // namespace AlibabaCloud

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <alibabacloud/core/AlibabaCloud.h>
#include <alibabacloud/core/CommonClient.h>
#include <alibabacloud/core/location/LocationClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
@@ -145,6 +146,19 @@ HttpRequest CommonClient::buildRoaHttpRequest(const std::string & endpoint,
HttpRequest request(url);
request.setMethod(method);
if (msg.connectTimeout() != kInvalidTimeout) {
request.setConnectTimeout(msg.connectTimeout());
} else {
request.setConnectTimeout(configuration().connectTimeout());
}
if (msg.readTimeout() != kInvalidTimeout) {
request.setReadTimeout(msg.readTimeout());
} else {
request.setReadTimeout(configuration().readTimeout());
}
if (msg.headerParameter("Accept").empty()) {
request.setHeader("Accept", "application/json");
} else {
@@ -260,6 +274,18 @@ HttpRequest CommonClient::buildRpcHttpRequest(const std::string & endpoint,
url.setQuery(queryString.str().substr(1));
HttpRequest request(url);
if (msg.connectTimeout() != kInvalidTimeout) {
request.setConnectTimeout(msg.connectTimeout());
} else {
request.setConnectTimeout(configuration().connectTimeout());
}
if (msg.readTimeout() != kInvalidTimeout) {
request.setReadTimeout(msg.readTimeout());
} else {
request.setReadTimeout(configuration().readTimeout());
}
request.setMethod(method);
request.setHeader("Host", url.host());
request.setHeader("x-sdk-client",

View File

@@ -20,12 +20,7 @@
#include <sstream>
#include <string>
#include <vector>
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
namespace AlibabaCloud {
@@ -56,7 +51,6 @@ static size_t readCallback(void *ptr, size_t size, size_t nmemb, void *stream) {
return len;
}
size_t recvBody(char *ptr, size_t size, size_t nmemb, void *userdata) {
std::ostringstream &out = *static_cast<std::ostringstream*>(userdata);
out << std::string(ptr, nmemb*size);
@@ -120,49 +114,52 @@ CurlHttpClient::makeRequest(const HttpRequest &request) {
curl_easy_reset(curlHandle_);
HttpResponse response(request);
long connect_timeout = request.connectTimeout();
long read_timeout = request.readTimeout();
std::string url = request.url().toString();
switch (request.method()) {
case HttpRequest::Method::Get:
break;
case HttpRequest::Method::Post: {
if (request.bodySize() > 0) {
curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, request.body());
} else {
curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, "");
case HttpRequest::Method::Get:
break;
case HttpRequest::Method::Post: {
if (request.bodySize() > 0) {
curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, request.body());
} else {
curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, "");
}
}
}
break;
break;
case HttpRequest::Method::Put: {
uploadContext* ctx = (uploadContext *)malloc(sizeof(uploadContext));
// this is impossible, as the size is 24 Bytes
if (ctx == nullptr) {
return HttpResponseOutcome(
Error("MemoryAllocateError",
"There is not enough memory for http transfer."));
case HttpRequest::Method::Put: {
uploadContext* ctx = (uploadContext *)malloc(sizeof(uploadContext));
// this is impossible, as the size is 24 Bytes
if (ctx == nullptr) {
return HttpResponseOutcome(
Error("MemoryAllocateError",
"There is not enough memory for http transfer."));
}
ctx->data = request.body();
ctx->pos = request.body();
ctx->last = ctx->pos + request.bodySize();
curl_easy_setopt(curlHandle_, CURLOPT_READFUNCTION, readCallback);
curl_easy_setopt(curlHandle_, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curlHandle_, CURLOPT_READDATA, ctx);
}
ctx->data = request.body();
ctx->pos = request.body();
ctx->last = ctx->pos + request.bodySize();
break;
curl_easy_setopt(curlHandle_, CURLOPT_READFUNCTION, readCallback);
curl_easy_setopt(curlHandle_, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curlHandle_, CURLOPT_READDATA, ctx);
}
break;
case HttpRequest::Method::Delete: {
curl_easy_setopt(curlHandle_, CURLOPT_CUSTOMREQUEST, "DELETE");
if (request.bodySize() > 0) {
curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, request.body());
} else {
curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, "");
case HttpRequest::Method::Delete: {
curl_easy_setopt(curlHandle_, CURLOPT_CUSTOMREQUEST, "DELETE");
if (request.bodySize() > 0) {
curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, request.body());
} else {
curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, "");
}
}
}
break;
break;
default:
break;
default:
break;
}
curl_easy_setopt(curlHandle_, CURLOPT_URL, url.c_str());
@@ -171,6 +168,14 @@ CurlHttpClient::makeRequest(const HttpRequest &request) {
curl_easy_setopt(curlHandle_, CURLOPT_HEADERDATA, &response);
curl_easy_setopt(curlHandle_, CURLOPT_HEADERFUNCTION, recvHeaders);
if (connect_timeout > 0) {
curl_easy_setopt(curlHandle_, CURLOPT_CONNECTTIMEOUT_MS, connect_timeout);
}
if (read_timeout > 0) {
curl_easy_setopt(curlHandle_, CURLOPT_TIMEOUT_MS, read_timeout);
}
curl_slist *list = nullptr;
auto headers = request.headers();
for (const auto &p : headers) {
@@ -190,22 +195,31 @@ CurlHttpClient::makeRequest(const HttpRequest &request) {
CURLcode res = curl_easy_perform(curlHandle_);
switch (res) {
case CURLE_OK: {
long response_code;
curl_easy_getinfo(curlHandle_, CURLINFO_RESPONSE_CODE, &response_code);
response.setStatusCode(response_code);
response.setBody(out.str().c_str(), out.str().length());
return HttpResponseOutcome(response);
}
case CURLE_SSL_CONNECT_ERROR:
return HttpResponseOutcome(
Error("SSLConnectError",
"A problem occurred somewhere in the SSL/TLS handshake."));
default:
return HttpResponseOutcome(
Error("NetworkError",
"Failed to connect to host or proxy: " +
HttpMethodToString(request.method()) + " " + request.url().toString()));
case CURLE_OK: {
long response_code;
curl_easy_getinfo(curlHandle_, CURLINFO_RESPONSE_CODE, &response_code);
response.setStatusCode(response_code);
response.setBody(out.str().c_str(), out.str().length());
return HttpResponseOutcome(response);
}
case CURLE_SSL_CONNECT_ERROR:
return HttpResponseOutcome(
Error("SSLConnectError",
"A problem occurred somewhere in the SSL/TLS handshake."));
case CURLE_OPERATION_TIMEDOUT:
return HttpResponseOutcome(
Error("OperationTimeoutError",
"Timeout (connectTimeout: " +
std::to_string(connect_timeout) + "ms, readTimeout: " +
std::to_string(read_timeout) + "ms) when connect or read data: " +
HttpMethodToString(request.method()) + " " + request.url().toString()));
default: {
return HttpResponseOutcome(
Error("NetworkError",
"Failed to connect to host or proxy: " +
HttpMethodToString(request.method()) + " " + request.url().toString()));
}
}
}

View File

@@ -15,13 +15,16 @@
*/
#include <alibabacloud/core/HttpRequest.h>
#include <alibabacloud/core/AlibabaCloud.h>
namespace AlibabaCloud {
HttpRequest::HttpRequest(const Url &url, Method method) :
HttpMessage(),
url_(url),
method_(method) {
method_(method),
connectTimeout_(kDefaultConnectTimeout),
readTimeout_(kDefaultReadTimeout) {
}
HttpRequest::~HttpRequest() {
@@ -44,4 +47,20 @@ Url HttpRequest::url()const {
return url_;
}
long HttpRequest::connectTimeout() const {
return connectTimeout_;
}
long HttpRequest::readTimeout() const {
return readTimeout_;
}
void HttpRequest::setConnectTimeout(const long connectTimeout) {
connectTimeout_ = connectTimeout;
}
void HttpRequest::setReadTimeout(const long readTimeout) {
readTimeout_ = readTimeout;
}
} // namespace AlibabaCloud

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <alibabacloud/core/AlibabaCloud.h>
#include <alibabacloud/core/RoaServiceClient.h>
#include <alibabacloud/core/HmacSha1Signer.h>
#include <algorithm>
@@ -85,6 +86,18 @@ HttpRequest RoaServiceClient::buildHttpRequest(const std::string & endpoint,
HttpRequest request(url);
request.setMethod(method);
if (msg.connectTimeout() != kInvalidTimeout) {
request.setConnectTimeout(msg.connectTimeout());
} else {
request.setConnectTimeout(configuration().connectTimeout());
}
if (msg.readTimeout() != kInvalidTimeout) {
request.setReadTimeout(msg.readTimeout());
} else {
request.setReadTimeout(configuration().readTimeout());
}
if (msg.parameter("Accept").empty()) {
request.setHeader("Accept", "application/json");
} else {

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <alibabacloud/core/AlibabaCloud.h>
#include <alibabacloud/core/RpcServiceClient.h>
#include <alibabacloud/core/HmacSha1Signer.h>
#include <algorithm>
@@ -107,6 +108,18 @@ HttpRequest RpcServiceClient::buildHttpRequest(const std::string & endpoint,
url.setQuery(queryString.str().substr(1));
HttpRequest request(url);
if (msg.connectTimeout() != kInvalidTimeout) {
request.setConnectTimeout(msg.connectTimeout());
} else {
request.setConnectTimeout(configuration().connectTimeout());
}
if (msg.readTimeout() != kInvalidTimeout) {
request.setReadTimeout(msg.readTimeout());
} else {
request.setReadTimeout(configuration().readTimeout());
}
request.setMethod(method);
request.setHeader("Host", url.host());
request.setHeader("x-sdk-client",

View File

@@ -31,7 +31,6 @@ std::string RpcServiceRequest::actionName()const {
return parameter("Action");
}
void RpcServiceRequest::setActionName(const std::string & name) {
setParameter("Action", name);
}

View File

@@ -15,6 +15,7 @@
*/
#include <alibabacloud/core/ServiceRequest.h>
#include <alibabacloud/core/AlibabaCloud.h>
namespace AlibabaCloud {
@@ -26,7 +27,9 @@ ServiceRequest::ServiceRequest(const std::string &product,
product_(product),
resourcePath_("/"),
version_(version),
scheme_("https") {
scheme_("https"),
connectTimeout_(kInvalidTimeout),
readTimeout_(kInvalidTimeout) {
}
ServiceRequest::ServiceRequest(const ServiceRequest &other) :
@@ -36,7 +39,9 @@ ServiceRequest::ServiceRequest(const ServiceRequest &other) :
product_(other.product_),
resourcePath_(other.resourcePath_),
version_(other.version_),
scheme_(other.scheme_) {
scheme_(other.scheme_),
connectTimeout_(other.connectTimeout_),
readTimeout_(other.readTimeout_) {
setContent(other.content_, other.contentSize_);
}
@@ -49,6 +54,8 @@ ServiceRequest& ServiceRequest::operator=(const ServiceRequest &other) {
content_ = nullptr;
contentSize_ = 0;
params_ = other.params_;
connectTimeout_ = other.connectTimeout_;
readTimeout_ = other.readTimeout_;
setContent(other.content_, other.contentSize_);
}
return *this;
@@ -152,4 +159,20 @@ std::string ServiceRequest::scheme() const {
return scheme_;
}
long ServiceRequest::connectTimeout() const{
return connectTimeout_;
}
long ServiceRequest::readTimeout() const{
return readTimeout_;
}
void ServiceRequest::setConnectTimeout(const long connectTimeout) {
connectTimeout_ = connectTimeout;
}
void ServiceRequest::setReadTimeout(const long readTimeout) {
readTimeout_ = readTimeout;
}
} // namespace AlibabaCloud

View File

@@ -15,7 +15,7 @@ rm -rf $FT_BUILD_DIR
mkdir $FT_BUILD_DIR
cd $FT_BUILD_DIR
cmake -DBUILD_FUNCTION_TESTS=ON -DBUILD_UNIT_TESTS=OFF ..
$MAKE cdn core ecs rds slb vpc cdn_ft core_ft ecs_ft nlp_ft rds_ft slb_ft vpc_ft
$MAKE cdn core cs ecs rds slb vpc cdn_ft core_ft cs_ft ecs_ft nlp_ft rds_ft slb_ft vpc_ft
echo '------- run function test -----------'

View File

@@ -77,7 +77,8 @@ add_executable(core_ut
sts_model_assumerole_result_ut.cc
sts_model_getcalleridentity_request_ut.cc
sts_model_getcalleridentity_result_ut.cc
)
timeout_ut.cc
)
set_target_properties(core_ut
PROPERTIES

View File

@@ -1,5 +1,6 @@
#include "gtest/gtest.h"
#include "alibabacloud/core/ClientConfiguration.h"
#include "alibabacloud/core/AlibabaCloud.h"
using namespace std;
using namespace AlibabaCloud;
@@ -28,4 +29,11 @@ TEST(ClientConfiguration, basic) {
EXPECT_TRUE(config.proxy().port() == port);
EXPECT_TRUE(config.proxy().user() == user);
EXPECT_TRUE(config.proxy().password() == password);
EXPECT_TRUE(config.connectTimeout() == kDefaultConnectTimeout);
EXPECT_TRUE(config.readTimeout() == kDefaultReadTimeout);
config.setConnectTimeout(1222);
config.setReadTimeout(23333);
EXPECT_TRUE(config.connectTimeout() == 1222);
EXPECT_TRUE(config.readTimeout() == 23333);
}

View File

@@ -10,10 +10,6 @@
#include "../src/CurlHttpClient.h"
using namespace std;
using ::testing::Return;
using ::testing::DoAll;
using ::testing::SetArgReferee;
using ::testing::ReturnPointee;
using ::testing::_;
using ::testing::NiceMock;
using ::testing::DefaultValue;
@@ -27,6 +23,64 @@ class mockCurlHttpClient : public CurlHttpClient {
MOCK_METHOD1(makeRequest, HttpResponseOutcome (const HttpRequest &request));
};
TEST(CurlHttpClient, connectTimeout) {
CurlHttpClient client;
HttpRequest request;
Url url;
url.setScheme("http");
url.setHost("192.168.100.100");
request.setMethod(HttpRequest::Method::Get);
request.setUrl(url);
request.setConnectTimeout(100);
request.setReadTimeout(1000);
request.setHeader("Content-Type", "text/html");
HttpClient::HttpResponseOutcome out = client.makeRequest(request);
string errmsg = "Timeout (connectTimeout: 100ms, readTimeout: 1000ms) when connect or read data: GET http://192.168.100.100/";
EXPECT_TRUE(out.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(out.error().errorMessage() == errmsg);
}
TEST(CurlHttpClient, defaultTimeout) {
CurlHttpClient client;
HttpRequest request;
Url url;
url.setScheme("http");
url.setHost("192.168.100.100");
request.setMethod(HttpRequest::Method::Get);
request.setUrl(url);
request.setHeader("Content-Type", "text/html");
HttpClient::HttpResponseOutcome out = client.makeRequest(request);
string errmsg = "Timeout (connectTimeout: 5000ms, readTimeout: 10000ms) when connect or read data: GET http://192.168.100.100/";
EXPECT_TRUE(out.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(out.error().errorMessage() == errmsg);
}
TEST(CurlHttpClient, readTimeout) {
CurlHttpClient client;
HttpRequest request;
Url url;
url.setScheme("http");
url.setHost("127.0.0.1");
url.setPort(8021);
url.setPath("/readTimeoutTest");
url.setQuery("timeout=500");
request.setMethod(HttpRequest::Method::Get);
request.setUrl(url);
request.setConnectTimeout(233);
request.setReadTimeout(500);
request.setHeader("Content-Type", "text/html");
HttpClient::HttpResponseOutcome out = client.makeRequest(request);
string errmsg = "Timeout (connectTimeout: 233ms, readTimeout: 500ms) when connect or read data: GET http://127.0.0.1:8021/readTimeoutTest?timeout=500";
EXPECT_TRUE(out.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(out.error().errorMessage() == errmsg);
}
TEST(CurlHttpClient, http_get) {
CurlHttpClient client;

View File

@@ -18,13 +18,20 @@ TEST(HttpRequest, basic) {
url.setQuery("key=value&key2=value2");
url.setFragment("fragid1");
HttpRequest http_request(url, HttpRequest::Method::Post);
HttpRequest req(url, HttpRequest::Method::Post);
EXPECT_TRUE(http_request.method() == HttpRequest::Method::Post);
http_request.setMethod(HttpRequest::Method::Get);
EXPECT_TRUE(http_request.method() == HttpRequest::Method::Get);
EXPECT_TRUE(req.method() == HttpRequest::Method::Post);
req.setMethod(HttpRequest::Method::Get);
EXPECT_TRUE(req.method() == HttpRequest::Method::Get);
http_request.setUrl(url);
Url rUrl = http_request.url();
req.setUrl(url);
Url rUrl = req.url();
EXPECT_TRUE(rUrl.toString() == src);
EXPECT_TRUE(req.connectTimeout() == 5000);
EXPECT_TRUE(req.readTimeout() == 10000);
req.setConnectTimeout(12345);
req.setReadTimeout(3335);
EXPECT_TRUE(req.connectTimeout() == 12345);
EXPECT_TRUE(req.readTimeout() == 3335);
}

View File

@@ -4,6 +4,7 @@
#include <string.h>
#include "gtest/gtest.h"
#include "alibabacloud/core/ServiceRequest.h"
#include "alibabacloud/core/AlibabaCloud.h"
using namespace std;
using namespace AlibabaCloud;
@@ -30,6 +31,7 @@ namespace {
using ServiceRequest::setResourcePath;
using ServiceRequest::setProduct;
using ServiceRequest::setVersion;
};
TEST(ServiceRequest, basic) {
@@ -81,5 +83,12 @@ namespace {
ServiceRequest::ParameterCollection pc = sr1.parameters();
EXPECT_TRUE(pc.at("km") == "vm");
EXPECT_TRUE(pc.at("kn") == "vn");
EXPECT_TRUE(sr1.connectTimeout() == kInvalidTimeout);
EXPECT_TRUE(sr1.readTimeout() == kInvalidTimeout);
sr1.setConnectTimeout(1234);
sr1.setReadTimeout(22233);
EXPECT_TRUE(sr1.connectTimeout() == 1234);
EXPECT_TRUE(sr1.readTimeout() == 22233);
}
}

277
test/core/timeout_ut.cc Normal file
View File

@@ -0,0 +1,277 @@
#include <iostream>
#include <stdio.h>
#include "gtest/gtest.h"
#include "../../core/src/Utils.h"
#include "alibabacloud/core/Config.h"
#include "alibabacloud/core/AlibabaCloud.h"
#include "alibabacloud/core/CommonClient.h"
#include "alibabacloud/core/CommonResponse.h"
#include "alibabacloud/core/CommonRequest.h"
#include "alibabacloud/core/SimpleCredentialsProvider.h"
#include "alibabacloud/core/RoaServiceClient.h"
#include "alibabacloud/core/RpcServiceClient.h"
using namespace std;
using namespace AlibabaCloud;
const std::string unreachableDomain = "192.168.111.111";
const std::string timeoutErrorCode = "OperationTimeoutError";
const std::string defaultErrorMessage =
"Timeout (connectTimeout: 5000ms, readTimeout: 10000ms) when connect or read data: GET http://192.168.111.111/";
long kClientConnectTimeout = 12;
long kClientReadTimeout = 234;
const std::string clientErrorMessage =
"Timeout (connectTimeout: 12ms, readTimeout: 234ms) when connect or read data: GET http://192.168.111.111/";
long kRequestConnectTimeout = 33;
long kRequestReadTimeout = 724;
const std::string requestErrorMessage =
"Timeout (connectTimeout: 33ms, readTimeout: 724ms) when connect or read data: GET http://192.168.111.111/";
TEST(timeout, DefaultCommonClientROA) {
ClientConfiguration configuration("cn-hangzhou");
CommonClient client("key", "secret", configuration);
CommonRequest request(CommonRequest::RoaPattern);
request.setScheme("http");
request.setDomain(unreachableDomain);
auto out = client.commonResponse(request);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage() == defaultErrorMessage);
}
TEST(timeout, DefaultCommonClientRPC) {
ClientConfiguration configuration("cn-hangzhou");
CommonClient client("key", "secret", configuration);
CommonRequest request(CommonRequest::RpcPattern);
request.setScheme("http");
request.setDomain(unreachableDomain);
auto out = client.commonResponse(request);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(defaultErrorMessage) == 0);
}
TEST(timeout, clientCommonClientROA) {
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(kClientConnectTimeout);
configuration.setReadTimeout(kClientReadTimeout);
CommonClient client("key", "secret", configuration);
CommonRequest request(CommonRequest::RoaPattern);
request.setScheme("http");
request.setDomain(unreachableDomain);
auto out = client.commonResponse(request);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage() == clientErrorMessage);
}
TEST(timeout, clientCommonClientRPC) {
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(kClientConnectTimeout);
configuration.setReadTimeout(kClientReadTimeout);
CommonClient client("key", "secret", configuration);
CommonRequest request(CommonRequest::RpcPattern);
request.setScheme("http");
request.setDomain(unreachableDomain);
auto out = client.commonResponse(request);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(clientErrorMessage) == 0);
}
TEST(timeout, requestCommonClientROA) {
ClientConfiguration configuration("cn-hangzhou");
CommonClient client("key", "secret", configuration);
CommonRequest request(CommonRequest::RoaPattern);
request.setScheme("http");
request.setDomain(unreachableDomain);
request.setConnectTimeout(kRequestConnectTimeout);
request.setReadTimeout(kRequestReadTimeout);
auto out = client.commonResponse(request);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage() == requestErrorMessage);
}
TEST(timeout, requestCommonClientRPC) {
ClientConfiguration configuration("cn-hangzhou");
CommonClient client("key", "secret", configuration);
CommonRequest request(CommonRequest::RpcPattern);
request.setScheme("http");
request.setDomain(unreachableDomain);
request.setConnectTimeout(kRequestConnectTimeout);
request.setReadTimeout(kRequestReadTimeout);
auto out = client.commonResponse(request);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(requestErrorMessage) == 0);
}
TEST(timeout, clientRequestCommonClientROA) {
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(kClientConnectTimeout);
configuration.setReadTimeout(kClientReadTimeout);
CommonClient client("key", "secret", configuration);
CommonRequest request(CommonRequest::RoaPattern);
request.setScheme("http");
request.setDomain(unreachableDomain);
request.setConnectTimeout(kRequestConnectTimeout);
request.setReadTimeout(kRequestReadTimeout);
auto out = client.commonResponse(request);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage() == requestErrorMessage);
}
TEST(timeout, clientRequestCommonClientRPC) {
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(kClientConnectTimeout);
configuration.setReadTimeout(kClientReadTimeout);
CommonClient client("key", "secret", configuration);
CommonRequest request(CommonRequest::RpcPattern);
request.setConnectTimeout(kRequestConnectTimeout);
request.setReadTimeout(kRequestReadTimeout);
request.setScheme("http");
request.setDomain(unreachableDomain);
auto out = client.commonResponse(request);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(requestErrorMessage) == 0);
}
class TestRoaClient : public RoaServiceClient {
public:
TestRoaClient(const std::string & servicename, const std::shared_ptr<CredentialsProvider> &credentialsProvider,
const ClientConfiguration &configuration,
const std::shared_ptr<Signer> &signer = std::make_shared<HmacSha1Signer>()):
RoaServiceClient(servicename, credentialsProvider, configuration, signer)
{}
JsonOutcome makeRequest(const std::string &endpoint, const RoaServiceRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get)const {
return RoaServiceClient::makeRequest(endpoint, msg, method);
}
};
TEST(timeout, roaClientDefault) {
ClientConfiguration configuration("cn-hangzhou");
const Credentials credentials("key", "secret");
TestRoaClient client("any-service", std::make_shared<SimpleCredentialsProvider>(credentials), configuration);
RoaServiceRequest request("product", "version");
request.setScheme("http");
auto out = client.makeRequest(unreachableDomain, request, HttpRequest::Method::Get);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(defaultErrorMessage) == 0);
}
TEST(timeout, roaClientclient) {
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(kClientConnectTimeout);
configuration.setReadTimeout(kClientReadTimeout);
const Credentials credentials("key", "secret");
TestRoaClient client("any-service", std::make_shared<SimpleCredentialsProvider>(credentials), configuration);
RoaServiceRequest request("product", "version");
request.setScheme("http");
auto out = client.makeRequest(unreachableDomain, request, HttpRequest::Method::Get);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(clientErrorMessage) == 0);
}
TEST(timeout, roaClientrequest) {
ClientConfiguration configuration("cn-hangzhou");
const Credentials credentials("key", "secret");
TestRoaClient client("any-service", std::make_shared<SimpleCredentialsProvider>(credentials), configuration);
RoaServiceRequest request("product", "version");
request.setScheme("http");
request.setConnectTimeout(kRequestConnectTimeout);
request.setReadTimeout(kRequestReadTimeout);
auto out = client.makeRequest(unreachableDomain, request, HttpRequest::Method::Get);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(requestErrorMessage) == 0);
}
TEST(timeout, roaClientclientrequest) {
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(kClientConnectTimeout);
configuration.setReadTimeout(kClientReadTimeout);
const Credentials credentials("key", "secret");
TestRoaClient client("any-service", std::make_shared<SimpleCredentialsProvider>(credentials), configuration);
RoaServiceRequest request("product", "version");
request.setScheme("http");
request.setConnectTimeout(kRequestConnectTimeout);
request.setReadTimeout(kRequestReadTimeout);
auto out = client.makeRequest(unreachableDomain, request, HttpRequest::Method::Get);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(requestErrorMessage) == 0);
}
class TestRpcClient : public RpcServiceClient {
public:
TestRpcClient(const std::string & servicename, const std::shared_ptr<CredentialsProvider> &credentialsProvider,
const ClientConfiguration &configuration,
const std::shared_ptr<Signer> &signer = std::make_shared<HmacSha1Signer>()):
RpcServiceClient(servicename, credentialsProvider, configuration, signer)
{}
JsonOutcome makeRequest(const std::string &endpoint, const RpcServiceRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get)const {
return RpcServiceClient::makeRequest(endpoint, msg, method);
}
};
TEST(timeout, rpcClientDefault) {
ClientConfiguration configuration("cn-hangzhou");
const Credentials credentials("key", "secret");
TestRpcClient client("any-service", std::make_shared<SimpleCredentialsProvider>(credentials), configuration);
RpcServiceRequest request("product", "version", "aciton");
request.setScheme("http");
auto out = client.makeRequest(unreachableDomain, request, HttpRequest::Method::Get);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(defaultErrorMessage) == 0);
}
TEST(timeout, rpcClientclient) {
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(kClientConnectTimeout);
configuration.setReadTimeout(kClientReadTimeout);
const Credentials credentials("key", "secret");
TestRpcClient client("any-service", std::make_shared<SimpleCredentialsProvider>(credentials), configuration);
RpcServiceRequest request("product", "version", "aciton");
request.setScheme("http");
auto out = client.makeRequest(unreachableDomain, request, HttpRequest::Method::Get);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(clientErrorMessage) == 0);
}
TEST(timeout, rpcClientrequest) {
ClientConfiguration configuration("cn-hangzhou");
const Credentials credentials("key", "secret");
TestRpcClient client("any-service", std::make_shared<SimpleCredentialsProvider>(credentials), configuration);
RpcServiceRequest request("product", "version", "aciton");
request.setScheme("http");
request.setConnectTimeout(kRequestConnectTimeout);
request.setReadTimeout(kRequestReadTimeout);
auto out = client.makeRequest(unreachableDomain, request, HttpRequest::Method::Get);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(requestErrorMessage) == 0);
}
TEST(timeout, rpcClientclientrequest) {
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(kClientConnectTimeout);
configuration.setReadTimeout(kClientReadTimeout);
const Credentials credentials("key", "secret");
TestRpcClient client("any-service", std::make_shared<SimpleCredentialsProvider>(credentials), configuration);
RpcServiceRequest request("product", "version", "aciton");
request.setScheme("http");
request.setConnectTimeout(kRequestConnectTimeout);
request.setReadTimeout(kRequestReadTimeout);
auto out = client.makeRequest(unreachableDomain, request, HttpRequest::Method::Get);
EXPECT_TRUE(out.error().errorCode() == timeoutErrorCode);
EXPECT_TRUE(out.error().errorMessage().find(requestErrorMessage) == 0);
}

View File

@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.0)
project(demo)
set(CMAKE_CXX_STANDARD 11)
if(CMAKE_HOST_WIN32)
include_directories("C:\\Program Files (x86)\\alibabacloud-sdk\\include")
link_directories("C:\\Program Files (x86)\\alibabacloud-sdk\\lib")
endif()
# note ft_build is the dir you build sdk
include_directories("../../../core/include/")
include_directories("../../../cs/include/")
link_directories(${CMAKE_SOURCE_DIR}/ft_build/lib)
add_executable(cs_ft cs_describetemplates_ut.cc)
target_link_libraries(cs_ft alibabacloud-sdk-core alibabacloud-sdk-cs)
target_link_libraries(cs_ft core gtest gmock_main)
set_target_properties(cs_ft
PROPERTIES
OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}cs_ft
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_test(NAME cs_ft COMMAND cs_ft)

View File

@@ -0,0 +1,88 @@
#include <iostream>
#include "../utils.h"
#include "gtest/gtest.h"
#include "alibabacloud/core/AlibabaCloud.h"
#include "alibabacloud/cs/CSClient.h"
#include "alibabacloud/cs/model/CreateTemplateRequest.h"
// #include "alibabacloud/core/CommonClient.h"
// #include "alibabacloud/core/CommonRequest.h"
#include "alibabacloud/core/sts/StsClient.h"
#include "alibabacloud/core/StsAssumeRoleCredentialsProvider.h"
using namespace std;
using namespace AlibabaCloud;
using namespace AlibabaCloud::CS;
namespace {
TEST(cs, describeTemplatesError) {
utUtils utils;
string key = utils.get_env("ENV_AccessKeyId");
string secret = utils.get_env("ENV_AccessKeySecret");
InitializeSdk();
ClientConfiguration configuration("cn-hangzhou");
CSClient client(key, secret, configuration);
Model::DescribeTemplatesRequest request;
auto outcome = client.describeTemplates(request);
EXPECT_TRUE(outcome.error().errorCode() == "InvalidAction.NotFound");
EXPECT_TRUE(outcome.error().errorMessage() == "Specified api is not found, please check your url and method.");
ShutdownSdk();
}
TEST(cs, describeTemplatesClientTimeout) {
utUtils utils;
string key = utils.get_env("ENV_AccessKeyId");
string secret = utils.get_env("ENV_AccessKeySecret");
InitializeSdk();
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(1);
configuration.setReadTimeout(123);
CSClient client(key, secret, configuration);
Model::DescribeTemplatesRequest request;
auto outcome = client.describeTemplates(request);
EXPECT_TRUE(outcome.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(outcome.error().errorMessage().find("Timeout (connectTimeout: 1ms, readTimeout: 123ms) when connect or read") == 0);
ShutdownSdk();
}
TEST(cs, describeTemplatesRequstTimeout) {
utUtils utils;
string key = utils.get_env("ENV_AccessKeyId");
string secret = utils.get_env("ENV_AccessKeySecret");
InitializeSdk();
ClientConfiguration configuration("cn-hangzhou");
CSClient client(key, secret, configuration);
Model::DescribeTemplatesRequest request;
request.setConnectTimeout(11);
request.setReadTimeout(213);
auto outcome = client.describeTemplates(request);
EXPECT_TRUE(outcome.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(outcome.error().errorMessage().find("Timeout (connectTimeout: 11ms, readTimeout: 213ms) when connect or read") == 0);
ShutdownSdk();
}
TEST(cs, describeTemplatesClientRequstTimeout) {
utUtils utils;
string key = utils.get_env("ENV_AccessKeyId");
string secret = utils.get_env("ENV_AccessKeySecret");
InitializeSdk();
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(1);
configuration.setReadTimeout(123);
CSClient client(key, secret, configuration);
Model::DescribeTemplatesRequest request;
request.setConnectTimeout(11);
request.setReadTimeout(213);
auto outcome = client.describeTemplates(request);
EXPECT_TRUE(outcome.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(outcome.error().errorMessage().find("Timeout (connectTimeout: 11ms, readTimeout: 213ms) when connect or read") == 0);
ShutdownSdk();
}
}

View File

@@ -47,8 +47,8 @@ namespace {
auto outcome = client.deleteInstance(delReq);
EXPECT_TRUE(outcome.error().errorCode() == "InvalidInstanceId.NotFound");
EXPECT_TRUE(outcome.error().errorMessage() == "The specified InstanceId does not exist.");
EXPECT_TRUE(outcome.error().errorCode() == "InvalidParameter");
EXPECT_TRUE(outcome.error().errorMessage() == "The specified parameter \"Force\" is not valid.");
ShutdownSdk();
}
@@ -111,4 +111,63 @@ namespace {
EXPECT_TRUE(outcome.result().payload().find("\"Instances\":") != string::npos);
ShutdownSdk();
}
TEST(ecs, describeInstancesClientTimeout) {
utUtils utils;
string key = utils.get_env("ENV_AccessKeyId");
string secret = utils.get_env("ENV_AccessKeySecret");
InitializeSdk();
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(1);
configuration.setReadTimeout(123);
EcsClient client(key, secret, configuration);
Model::DescribeInstancesRequest request;
request.setPageSize(10);
auto outcome = client.describeInstances(request);
EXPECT_TRUE(outcome.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(outcome.error().errorMessage().find("Timeout (connectTimeout: 1ms, readTimeout: 123ms) when connect or read") == 0);
ShutdownSdk();
}
TEST(ecs, describeInstancesRequestTimeout) {
utUtils utils;
string key = utils.get_env("ENV_AccessKeyId");
string secret = utils.get_env("ENV_AccessKeySecret");
InitializeSdk();
ClientConfiguration configuration("cn-hangzhou");
EcsClient client(key, secret, configuration);
Model::DescribeInstancesRequest request;
request.setPageSize(10);
request.setConnectTimeout(11);
request.setReadTimeout(213);
auto outcome = client.describeInstances(request);
EXPECT_TRUE(outcome.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(outcome.error().errorMessage().find("Timeout (connectTimeout: 11ms, readTimeout: 213ms) when connect or read") == 0);
ShutdownSdk();
}
TEST(ecs, describeInstancesClientRequestTimeout) {
utUtils utils;
string key = utils.get_env("ENV_AccessKeyId");
string secret = utils.get_env("ENV_AccessKeySecret");
InitializeSdk();
ClientConfiguration configuration("cn-hangzhou");
configuration.setConnectTimeout(1);
configuration.setReadTimeout(123);
EcsClient client(key, secret, configuration);
Model::DescribeInstancesRequest request;
request.setPageSize(10);
request.setConnectTimeout(11);
request.setReadTimeout(213);
auto outcome = client.describeInstances(request);
EXPECT_TRUE(outcome.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(outcome.error().errorMessage().find("Timeout (connectTimeout: 11ms, readTimeout: 213ms) when connect or read") == 0);
ShutdownSdk();
}
}

View File

@@ -29,7 +29,6 @@ namespace {
request.setContent(data, strlen(data));
request.setHeaderParameter("Content-Type", "application/json;chrset=utf-8");
request.setVersion("2018-04-08");
auto outcome = client.commonResponse(request);
EXPECT_TRUE(outcome.error().errorCode().empty());
const std::string expected = "{\"data\":[{\"id\":0,\"word\":\"Iphone\"},{\"id\":1,\"word\":\" \"},{\"id\":2,\"word\":\"is\"},{\"id\":3,\"word\":\" \"},{\"id\":4,\"word\":\"a\"},{\"id\":5,\"word\":\" \"},{\"id\":6,\"word\":\"good\"},{\"id\":7,\"word\":\" \"},{\"id\":8,\"word\":\"choice\"},{\"id\":9,\"word\":\" \"},{\"id\":10,\"word\":\"专用\"},{\"id\":11,\"word\":\"数据线\"}]}";
@@ -56,10 +55,94 @@ namespace {
request.setContent(data, strlen(data));
request.setHeaderParameter("Content-Type", "application/json;chrset=utf-8");
request.setVersion("2018-04-08");
auto outcome = client.commonResponse(request);
const string error = "{\"errorCode\":10007,\"errorMsg\":\"body json format invalid\"}";
EXPECT_TRUE(outcome.error().detail() == error);
AlibabaCloud::ShutdownSdk();
}
TEST(nlp, wordsegmentClientTimeout) {
utUtils utils;
string key = utils.get_env("ENV_AccessKeyId");
string secret = utils.get_env("ENV_AccessKeySecret");
AlibabaCloud::InitializeSdk();
ClientConfiguration configuration("cn-shanghai");
configuration.setConnectTimeout(1);
configuration.setReadTimeout(123);
CommonClient client(key, secret, configuration);
// create request and assign parameters
CommonRequest request(CommonRequest::RoaPattern);
request.setScheme("http");
request.setDomain("nlp.cn-shanghai.aliyuncs.com");
request.setResourcePath("/nlp/api/wordsegment/general");
request.setHttpMethod(HttpRequest::Post);
const char * data = "{\"lang\":\"ZH\",\"text\":\"Iphone is a good choice 专用数据线\"}";
request.setContent(data, strlen(data));
request.setHeaderParameter("Content-Type", "application/json;chrset=utf-8");
request.setVersion("2018-04-08");
auto outcome = client.commonResponse(request);
EXPECT_TRUE(outcome.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(outcome.error().errorMessage().find("Timeout (connectTimeout: 1ms, readTimeout: 123ms) when connect or read") == 0);
AlibabaCloud::ShutdownSdk();
}
TEST(nlp, wordsegmentRequestTimeout) {
utUtils utils;
string key = utils.get_env("ENV_AccessKeyId");
string secret = utils.get_env("ENV_AccessKeySecret");
AlibabaCloud::InitializeSdk();
ClientConfiguration configuration("cn-shanghai");
CommonClient client(key, secret, configuration);
// create request and assign parameters
CommonRequest request(CommonRequest::RoaPattern);
request.setScheme("http");
request.setDomain("nlp.cn-shanghai.aliyuncs.com");
request.setConnectTimeout(11);
request.setReadTimeout(213);
request.setResourcePath("/nlp/api/wordsegment/general");
request.setHttpMethod(HttpRequest::Post);
const char * data = "{\"lang\":\"ZH\",\"text\":\"Iphone is a good choice 专用数据线\"}";
request.setContent(data, strlen(data));
request.setHeaderParameter("Content-Type", "application/json;chrset=utf-8");
request.setVersion("2018-04-08");
auto outcome = client.commonResponse(request);
EXPECT_TRUE(outcome.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(outcome.error().errorMessage().find("Timeout (connectTimeout: 11ms, readTimeout: 213ms) when connect or read") == 0);
AlibabaCloud::ShutdownSdk();
}
TEST(nlp, wordsegmentClientRequestTimeout) {
utUtils utils;
string key = utils.get_env("ENV_AccessKeyId");
string secret = utils.get_env("ENV_AccessKeySecret");
AlibabaCloud::InitializeSdk();
ClientConfiguration configuration("cn-shanghai");
configuration.setConnectTimeout(1);
configuration.setReadTimeout(123);
CommonClient client(key, secret, configuration);
// create request and assign parameters
CommonRequest request(CommonRequest::RoaPattern);
request.setScheme("http");
request.setDomain("nlp.cn-shanghai.aliyuncs.com");
request.setConnectTimeout(11);
request.setReadTimeout(213);
request.setResourcePath("/nlp/api/wordsegment/general");
request.setHttpMethod(HttpRequest::Post);
const char * data = "{\"lang\":\"ZH\",\"text\":\"Iphone is a good choice 专用数据线\"}";
request.setContent(data, strlen(data));
request.setHeaderParameter("Content-Type", "application/json;chrset=utf-8");
request.setVersion("2018-04-08");
auto outcome = client.commonResponse(request);
EXPECT_TRUE(outcome.error().errorCode() == "OperationTimeoutError");
EXPECT_TRUE(outcome.error().errorMessage().find("Timeout (connectTimeout: 11ms, readTimeout: 213ms) when connect or read") == 0);
AlibabaCloud::ShutdownSdk();
}
}

View File

@@ -13,7 +13,13 @@ app.use(bodyParser.json({ type: 'application/*+json' }))
app.get('*', function (req, res) {
console.log('GET req.params: ', req.params);
console.log('GET req.query: ', req.query);
res.send(JSON.stringify(req.query));
if (req.params[0] === '/readTimeoutTest') {
setTimeout(function() {
res.send("something");
}, Number(req.query.timeout) + 100);
} else {
res.send(JSON.stringify(req.query));
}
});
app.post('*', function (req, res) {

94
ubsms/CMakeLists.txt Normal file
View File

@@ -0,0 +1,94 @@
#
# 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(ubsms_public_header
include/alibabacloud/ubsms/UbsmsClient.h
include/alibabacloud/ubsms/UbsmsExport.h )
set(ubsms_public_header_model
include/alibabacloud/ubsms/model/NotifyUserBusinessCommandRequest.h
include/alibabacloud/ubsms/model/NotifyUserBusinessCommandResult.h
include/alibabacloud/ubsms/model/DescribeBusinessStatusRequest.h
include/alibabacloud/ubsms/model/DescribeBusinessStatusResult.h
include/alibabacloud/ubsms/model/SetUserBusinessStatusRequest.h
include/alibabacloud/ubsms/model/SetUserBusinessStatusResult.h )
set(ubsms_src
src/UbsmsClient.cc
src/model/NotifyUserBusinessCommandRequest.cc
src/model/NotifyUserBusinessCommandResult.cc
src/model/DescribeBusinessStatusRequest.cc
src/model/DescribeBusinessStatusResult.cc
src/model/SetUserBusinessStatusRequest.cc
src/model/SetUserBusinessStatusResult.cc )
add_library(ubsms ${LIB_TYPE}
${ubsms_public_header}
${ubsms_public_header_model}
${ubsms_src})
set_target_properties(ubsms
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}ubsms
)
if(${LIB_TYPE} STREQUAL "SHARED")
set_target_properties(ubsms
PROPERTIES
DEFINE_SYMBOL ALIBABACLOUD_UBSMS_LIBRARY)
endif()
target_include_directories(ubsms
PRIVATE include
${CMAKE_SOURCE_DIR}/core/include
)
target_link_libraries(ubsms
core)
if(CMAKE_HOST_WIN32)
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
set(jsoncpp_install_dir ${INSTALL_DIR})
add_dependencies(ubsms
jsoncpp)
target_include_directories(ubsms
PRIVATE ${jsoncpp_install_dir}/include)
target_link_libraries(ubsms
${jsoncpp_install_dir}/lib/jsoncpp.lib)
set_target_properties(ubsms
PROPERTIES
COMPILE_OPTIONS "/bigobj")
else()
target_include_directories(ubsms
PRIVATE /usr/include/jsoncpp)
target_link_libraries(ubsms
jsoncpp)
endif()
install(FILES ${ubsms_public_header}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/ubsms)
install(FILES ${ubsms_public_header_model}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/ubsms/model)
install(TARGETS ubsms
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

View File

@@ -0,0 +1,70 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_UBSMS_UBSMSCLIENT_H_
#define ALIBABACLOUD_UBSMS_UBSMSCLIENT_H_
#include <future>
#include <alibabacloud/core/AsyncCallerContext.h>
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#include "UbsmsExport.h"
#include "model/NotifyUserBusinessCommandRequest.h"
#include "model/NotifyUserBusinessCommandResult.h"
#include "model/DescribeBusinessStatusRequest.h"
#include "model/DescribeBusinessStatusResult.h"
#include "model/SetUserBusinessStatusRequest.h"
#include "model/SetUserBusinessStatusResult.h"
namespace AlibabaCloud
{
namespace Ubsms
{
class ALIBABACLOUD_UBSMS_EXPORT UbsmsClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::NotifyUserBusinessCommandResult> NotifyUserBusinessCommandOutcome;
typedef std::future<NotifyUserBusinessCommandOutcome> NotifyUserBusinessCommandOutcomeCallable;
typedef std::function<void(const UbsmsClient*, const Model::NotifyUserBusinessCommandRequest&, const NotifyUserBusinessCommandOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> NotifyUserBusinessCommandAsyncHandler;
typedef Outcome<Error, Model::DescribeBusinessStatusResult> DescribeBusinessStatusOutcome;
typedef std::future<DescribeBusinessStatusOutcome> DescribeBusinessStatusOutcomeCallable;
typedef std::function<void(const UbsmsClient*, const Model::DescribeBusinessStatusRequest&, const DescribeBusinessStatusOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeBusinessStatusAsyncHandler;
typedef Outcome<Error, Model::SetUserBusinessStatusResult> SetUserBusinessStatusOutcome;
typedef std::future<SetUserBusinessStatusOutcome> SetUserBusinessStatusOutcomeCallable;
typedef std::function<void(const UbsmsClient*, const Model::SetUserBusinessStatusRequest&, const SetUserBusinessStatusOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SetUserBusinessStatusAsyncHandler;
UbsmsClient(const Credentials &credentials, const ClientConfiguration &configuration);
UbsmsClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
UbsmsClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~UbsmsClient();
NotifyUserBusinessCommandOutcome notifyUserBusinessCommand(const Model::NotifyUserBusinessCommandRequest &request)const;
void notifyUserBusinessCommandAsync(const Model::NotifyUserBusinessCommandRequest& request, const NotifyUserBusinessCommandAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
NotifyUserBusinessCommandOutcomeCallable notifyUserBusinessCommandCallable(const Model::NotifyUserBusinessCommandRequest& request) const;
DescribeBusinessStatusOutcome describeBusinessStatus(const Model::DescribeBusinessStatusRequest &request)const;
void describeBusinessStatusAsync(const Model::DescribeBusinessStatusRequest& request, const DescribeBusinessStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DescribeBusinessStatusOutcomeCallable describeBusinessStatusCallable(const Model::DescribeBusinessStatusRequest& request) const;
SetUserBusinessStatusOutcome setUserBusinessStatus(const Model::SetUserBusinessStatusRequest &request)const;
void setUserBusinessStatusAsync(const Model::SetUserBusinessStatusRequest& request, const SetUserBusinessStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
SetUserBusinessStatusOutcomeCallable setUserBusinessStatusCallable(const Model::SetUserBusinessStatusRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;
};
}
}
#endif // !ALIBABACLOUD_UBSMS_UBSMSCLIENT_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_UBSMS_UBSMSEXPORT_H_
#define ALIBABACLOUD_UBSMS_UBSMSEXPORT_H_
#include <alibabacloud/core/Global.h>
#if defined(ALIBABACLOUD_SHARED)
# if defined(ALIBABACLOUD_UBSMS_LIBRARY)
# define ALIBABACLOUD_UBSMS_EXPORT ALIBABACLOUD_DECL_EXPORT
# else
# define ALIBABACLOUD_UBSMS_EXPORT ALIBABACLOUD_DECL_IMPORT
# endif
#else
# define ALIBABACLOUD_UBSMS_EXPORT
#endif
#endif // !ALIBABACLOUD_UBSMS_UBSMSEXPORT_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_UBSMS_MODEL_DESCRIBEBUSINESSSTATUSREQUEST_H_
#define ALIBABACLOUD_UBSMS_MODEL_DESCRIBEBUSINESSSTATUSREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/ubsms/UbsmsExport.h>
namespace AlibabaCloud
{
namespace Ubsms
{
namespace Model
{
class ALIBABACLOUD_UBSMS_EXPORT DescribeBusinessStatusRequest : public RpcServiceRequest
{
public:
DescribeBusinessStatusRequest();
~DescribeBusinessStatusRequest();
std::string getPassword()const;
void setPassword(const std::string& password);
std::string getCallerBid()const;
void setCallerBid(const std::string& callerBid);
private:
std::string password_;
std::string callerBid_;
};
}
}
}
#endif // !ALIBABACLOUD_UBSMS_MODEL_DESCRIBEBUSINESSSTATUSREQUEST_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_UBSMS_MODEL_DESCRIBEBUSINESSSTATUSRESULT_H_
#define ALIBABACLOUD_UBSMS_MODEL_DESCRIBEBUSINESSSTATUSRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/ubsms/UbsmsExport.h>
namespace AlibabaCloud
{
namespace Ubsms
{
namespace Model
{
class ALIBABACLOUD_UBSMS_EXPORT DescribeBusinessStatusResult : public ServiceResult
{
public:
struct UserBusinessStatus
{
struct Status
{
std::string statusKey;
std::string statusValue;
};
std::string uid;
std::string serviceCode;
std::vector<UserBusinessStatus::Status> statuses;
};
DescribeBusinessStatusResult();
explicit DescribeBusinessStatusResult(const std::string &payload);
~DescribeBusinessStatusResult();
std::vector<UserBusinessStatus> getUserBusinessStatusList()const;
bool getSuccess()const;
protected:
void parse(const std::string &payload);
private:
std::vector<UserBusinessStatus> userBusinessStatusList_;
bool success_;
};
}
}
}
#endif // !ALIBABACLOUD_UBSMS_MODEL_DESCRIBEBUSINESSSTATUSRESULT_H_

View File

@@ -0,0 +1,66 @@
/*
* 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_UBSMS_MODEL_NOTIFYUSERBUSINESSCOMMANDREQUEST_H_
#define ALIBABACLOUD_UBSMS_MODEL_NOTIFYUSERBUSINESSCOMMANDREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/ubsms/UbsmsExport.h>
namespace AlibabaCloud
{
namespace Ubsms
{
namespace Model
{
class ALIBABACLOUD_UBSMS_EXPORT NotifyUserBusinessCommandRequest : public RpcServiceRequest
{
public:
NotifyUserBusinessCommandRequest();
~NotifyUserBusinessCommandRequest();
std::string getUid()const;
void setUid(const std::string& uid);
std::string getPassword()const;
void setPassword(const std::string& password);
std::string getInstanceId()const;
void setInstanceId(const std::string& instanceId);
std::string getServiceCode()const;
void setServiceCode(const std::string& serviceCode);
std::string getClientToken()const;
void setClientToken(const std::string& clientToken);
std::string getCmd()const;
void setCmd(const std::string& cmd);
std::string getRegion()const;
void setRegion(const std::string& region);
private:
std::string uid_;
std::string password_;
std::string instanceId_;
std::string serviceCode_;
std::string clientToken_;
std::string cmd_;
std::string region_;
};
}
}
}
#endif // !ALIBABACLOUD_UBSMS_MODEL_NOTIFYUSERBUSINESSCOMMANDREQUEST_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_UBSMS_MODEL_NOTIFYUSERBUSINESSCOMMANDRESULT_H_
#define ALIBABACLOUD_UBSMS_MODEL_NOTIFYUSERBUSINESSCOMMANDRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/ubsms/UbsmsExport.h>
namespace AlibabaCloud
{
namespace Ubsms
{
namespace Model
{
class ALIBABACLOUD_UBSMS_EXPORT NotifyUserBusinessCommandResult : public ServiceResult
{
public:
NotifyUserBusinessCommandResult();
explicit NotifyUserBusinessCommandResult(const std::string &payload);
~NotifyUserBusinessCommandResult();
bool getSuccess()const;
protected:
void parse(const std::string &payload);
private:
bool success_;
};
}
}
}
#endif // !ALIBABACLOUD_UBSMS_MODEL_NOTIFYUSERBUSINESSCOMMANDRESULT_H_

View File

@@ -0,0 +1,57 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_UBSMS_MODEL_SETUSERBUSINESSSTATUSREQUEST_H_
#define ALIBABACLOUD_UBSMS_MODEL_SETUSERBUSINESSSTATUSREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/ubsms/UbsmsExport.h>
namespace AlibabaCloud
{
namespace Ubsms
{
namespace Model
{
class ALIBABACLOUD_UBSMS_EXPORT SetUserBusinessStatusRequest : public RpcServiceRequest
{
public:
SetUserBusinessStatusRequest();
~SetUserBusinessStatusRequest();
std::string getUid()const;
void setUid(const std::string& uid);
std::string getStatusValue()const;
void setStatusValue(const std::string& statusValue);
std::string getService()const;
void setService(const std::string& service);
std::string getStatusKey()const;
void setStatusKey(const std::string& statusKey);
private:
std::string uid_;
std::string statusValue_;
std::string service_;
std::string statusKey_;
};
}
}
}
#endif // !ALIBABACLOUD_UBSMS_MODEL_SETUSERBUSINESSSTATUSREQUEST_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_UBSMS_MODEL_SETUSERBUSINESSSTATUSRESULT_H_
#define ALIBABACLOUD_UBSMS_MODEL_SETUSERBUSINESSSTATUSRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/ubsms/UbsmsExport.h>
namespace AlibabaCloud
{
namespace Ubsms
{
namespace Model
{
class ALIBABACLOUD_UBSMS_EXPORT SetUserBusinessStatusResult : public ServiceResult
{
public:
SetUserBusinessStatusResult();
explicit SetUserBusinessStatusResult(const std::string &payload);
~SetUserBusinessStatusResult();
bool getSuccess()const;
protected:
void parse(const std::string &payload);
private:
bool success_;
};
}
}
}
#endif // !ALIBABACLOUD_UBSMS_MODEL_SETUSERBUSINESSSTATUSRESULT_H_

161
ubsms/src/UbsmsClient.cc Normal file
View File

@@ -0,0 +1,161 @@
/*
* 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/ubsms/UbsmsClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::Ubsms;
using namespace AlibabaCloud::Ubsms::Model;
namespace
{
const std::string SERVICE_NAME = "Ubsms";
}
UbsmsClient::UbsmsClient(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, "ubsms");
}
UbsmsClient::UbsmsClient(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, "ubsms");
}
UbsmsClient::UbsmsClient(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, "ubsms");
}
UbsmsClient::~UbsmsClient()
{}
UbsmsClient::NotifyUserBusinessCommandOutcome UbsmsClient::notifyUserBusinessCommand(const NotifyUserBusinessCommandRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return NotifyUserBusinessCommandOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return NotifyUserBusinessCommandOutcome(NotifyUserBusinessCommandResult(outcome.result()));
else
return NotifyUserBusinessCommandOutcome(outcome.error());
}
void UbsmsClient::notifyUserBusinessCommandAsync(const NotifyUserBusinessCommandRequest& request, const NotifyUserBusinessCommandAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, notifyUserBusinessCommand(request), context);
};
asyncExecute(new Runnable(fn));
}
UbsmsClient::NotifyUserBusinessCommandOutcomeCallable UbsmsClient::notifyUserBusinessCommandCallable(const NotifyUserBusinessCommandRequest &request) const
{
auto task = std::make_shared<std::packaged_task<NotifyUserBusinessCommandOutcome()>>(
[this, request]()
{
return this->notifyUserBusinessCommand(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
UbsmsClient::DescribeBusinessStatusOutcome UbsmsClient::describeBusinessStatus(const DescribeBusinessStatusRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeBusinessStatusOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeBusinessStatusOutcome(DescribeBusinessStatusResult(outcome.result()));
else
return DescribeBusinessStatusOutcome(outcome.error());
}
void UbsmsClient::describeBusinessStatusAsync(const DescribeBusinessStatusRequest& request, const DescribeBusinessStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, describeBusinessStatus(request), context);
};
asyncExecute(new Runnable(fn));
}
UbsmsClient::DescribeBusinessStatusOutcomeCallable UbsmsClient::describeBusinessStatusCallable(const DescribeBusinessStatusRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DescribeBusinessStatusOutcome()>>(
[this, request]()
{
return this->describeBusinessStatus(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
UbsmsClient::SetUserBusinessStatusOutcome UbsmsClient::setUserBusinessStatus(const SetUserBusinessStatusRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return SetUserBusinessStatusOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return SetUserBusinessStatusOutcome(SetUserBusinessStatusResult(outcome.result()));
else
return SetUserBusinessStatusOutcome(outcome.error());
}
void UbsmsClient::setUserBusinessStatusAsync(const SetUserBusinessStatusRequest& request, const SetUserBusinessStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, setUserBusinessStatus(request), context);
};
asyncExecute(new Runnable(fn));
}
UbsmsClient::SetUserBusinessStatusOutcomeCallable UbsmsClient::setUserBusinessStatusCallable(const SetUserBusinessStatusRequest &request) const
{
auto task = std::make_shared<std::packaged_task<SetUserBusinessStatusOutcome()>>(
[this, request]()
{
return this->setUserBusinessStatus(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -0,0 +1,49 @@
/*
* 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/ubsms/model/DescribeBusinessStatusRequest.h>
using AlibabaCloud::Ubsms::Model::DescribeBusinessStatusRequest;
DescribeBusinessStatusRequest::DescribeBusinessStatusRequest() :
RpcServiceRequest("ubsms", "2015-06-23", "DescribeBusinessStatus")
{}
DescribeBusinessStatusRequest::~DescribeBusinessStatusRequest()
{}
std::string DescribeBusinessStatusRequest::getPassword()const
{
return password_;
}
void DescribeBusinessStatusRequest::setPassword(const std::string& password)
{
password_ = password;
setParameter("Password", password);
}
std::string DescribeBusinessStatusRequest::getCallerBid()const
{
return callerBid_;
}
void DescribeBusinessStatusRequest::setCallerBid(const std::string& callerBid)
{
callerBid_ = callerBid;
setParameter("CallerBid", callerBid);
}

View File

@@ -0,0 +1,77 @@
/*
* 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/ubsms/model/DescribeBusinessStatusResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ubsms;
using namespace AlibabaCloud::Ubsms::Model;
DescribeBusinessStatusResult::DescribeBusinessStatusResult() :
ServiceResult()
{}
DescribeBusinessStatusResult::DescribeBusinessStatusResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DescribeBusinessStatusResult::~DescribeBusinessStatusResult()
{}
void DescribeBusinessStatusResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allUserBusinessStatusList = value["UserBusinessStatusList"]["UserBusinessStatus"];
for (auto value : allUserBusinessStatusList)
{
UserBusinessStatus userBusinessStatusListObject;
if(!value["Uid"].isNull())
userBusinessStatusListObject.uid = value["Uid"].asString();
if(!value["ServiceCode"].isNull())
userBusinessStatusListObject.serviceCode = value["ServiceCode"].asString();
auto allStatuses = value["Statuses"]["Status"];
for (auto value : allStatuses)
{
UserBusinessStatus::Status statusesObject;
if(!value["StatusKey"].isNull())
statusesObject.statusKey = value["StatusKey"].asString();
if(!value["StatusValue"].isNull())
statusesObject.statusValue = value["StatusValue"].asString();
userBusinessStatusListObject.statuses.push_back(statusesObject);
}
userBusinessStatusList_.push_back(userBusinessStatusListObject);
}
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
}
std::vector<DescribeBusinessStatusResult::UserBusinessStatus> DescribeBusinessStatusResult::getUserBusinessStatusList()const
{
return userBusinessStatusList_;
}
bool DescribeBusinessStatusResult::getSuccess()const
{
return success_;
}

View File

@@ -0,0 +1,104 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/ubsms/model/NotifyUserBusinessCommandRequest.h>
using AlibabaCloud::Ubsms::Model::NotifyUserBusinessCommandRequest;
NotifyUserBusinessCommandRequest::NotifyUserBusinessCommandRequest() :
RpcServiceRequest("ubsms", "2015-06-23", "NotifyUserBusinessCommand")
{}
NotifyUserBusinessCommandRequest::~NotifyUserBusinessCommandRequest()
{}
std::string NotifyUserBusinessCommandRequest::getUid()const
{
return uid_;
}
void NotifyUserBusinessCommandRequest::setUid(const std::string& uid)
{
uid_ = uid;
setParameter("Uid", uid);
}
std::string NotifyUserBusinessCommandRequest::getPassword()const
{
return password_;
}
void NotifyUserBusinessCommandRequest::setPassword(const std::string& password)
{
password_ = password;
setParameter("Password", password);
}
std::string NotifyUserBusinessCommandRequest::getInstanceId()const
{
return instanceId_;
}
void NotifyUserBusinessCommandRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}
std::string NotifyUserBusinessCommandRequest::getServiceCode()const
{
return serviceCode_;
}
void NotifyUserBusinessCommandRequest::setServiceCode(const std::string& serviceCode)
{
serviceCode_ = serviceCode;
setParameter("ServiceCode", serviceCode);
}
std::string NotifyUserBusinessCommandRequest::getClientToken()const
{
return clientToken_;
}
void NotifyUserBusinessCommandRequest::setClientToken(const std::string& clientToken)
{
clientToken_ = clientToken;
setParameter("ClientToken", clientToken);
}
std::string NotifyUserBusinessCommandRequest::getCmd()const
{
return cmd_;
}
void NotifyUserBusinessCommandRequest::setCmd(const std::string& cmd)
{
cmd_ = cmd;
setParameter("Cmd", cmd);
}
std::string NotifyUserBusinessCommandRequest::getRegion()const
{
return region_;
}
void NotifyUserBusinessCommandRequest::setRegion(const std::string& region)
{
region_ = region;
setParameter("Region", region);
}

View File

@@ -0,0 +1,52 @@
/*
* 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/ubsms/model/NotifyUserBusinessCommandResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ubsms;
using namespace AlibabaCloud::Ubsms::Model;
NotifyUserBusinessCommandResult::NotifyUserBusinessCommandResult() :
ServiceResult()
{}
NotifyUserBusinessCommandResult::NotifyUserBusinessCommandResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
NotifyUserBusinessCommandResult::~NotifyUserBusinessCommandResult()
{}
void NotifyUserBusinessCommandResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
}
bool NotifyUserBusinessCommandResult::getSuccess()const
{
return success_;
}

View File

@@ -0,0 +1,71 @@
/*
* 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/ubsms/model/SetUserBusinessStatusRequest.h>
using AlibabaCloud::Ubsms::Model::SetUserBusinessStatusRequest;
SetUserBusinessStatusRequest::SetUserBusinessStatusRequest() :
RpcServiceRequest("ubsms", "2015-06-23", "SetUserBusinessStatus")
{}
SetUserBusinessStatusRequest::~SetUserBusinessStatusRequest()
{}
std::string SetUserBusinessStatusRequest::getUid()const
{
return uid_;
}
void SetUserBusinessStatusRequest::setUid(const std::string& uid)
{
uid_ = uid;
setParameter("Uid", uid);
}
std::string SetUserBusinessStatusRequest::getStatusValue()const
{
return statusValue_;
}
void SetUserBusinessStatusRequest::setStatusValue(const std::string& statusValue)
{
statusValue_ = statusValue;
setParameter("StatusValue", statusValue);
}
std::string SetUserBusinessStatusRequest::getService()const
{
return service_;
}
void SetUserBusinessStatusRequest::setService(const std::string& service)
{
service_ = service;
setParameter("Service", service);
}
std::string SetUserBusinessStatusRequest::getStatusKey()const
{
return statusKey_;
}
void SetUserBusinessStatusRequest::setStatusKey(const std::string& statusKey)
{
statusKey_ = statusKey;
setParameter("StatusKey", statusKey);
}

View File

@@ -0,0 +1,52 @@
/*
* 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/ubsms/model/SetUserBusinessStatusResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ubsms;
using namespace AlibabaCloud::Ubsms::Model;
SetUserBusinessStatusResult::SetUserBusinessStatusResult() :
ServiceResult()
{}
SetUserBusinessStatusResult::SetUserBusinessStatusResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
SetUserBusinessStatusResult::~SetUserBusinessStatusResult()
{}
void SetUserBusinessStatusResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
}
bool SetUserBusinessStatusResult::getSuccess()const
{
return success_;
}

122
yundun/CMakeLists.txt Normal file
View File

@@ -0,0 +1,122 @@
#
# 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(yundun_public_header
include/alibabacloud/yundun/YundunClient.h
include/alibabacloud/yundun/YundunExport.h )
set(yundun_public_header_model
include/alibabacloud/yundun/model/TodayqpsByRegionRequest.h
include/alibabacloud/yundun/model/TodayqpsByRegionResult.h
include/alibabacloud/yundun/model/TodayAllppsRequest.h
include/alibabacloud/yundun/model/TodayAllppsResult.h
include/alibabacloud/yundun/model/TodayBackdoorRequest.h
include/alibabacloud/yundun/model/TodayBackdoorResult.h
include/alibabacloud/yundun/model/TodayCrackInterceptRequest.h
include/alibabacloud/yundun/model/TodayCrackInterceptResult.h
include/alibabacloud/yundun/model/AllMalwareNumRequest.h
include/alibabacloud/yundun/model/AllMalwareNumResult.h
include/alibabacloud/yundun/model/TodayMalwareNumRequest.h
include/alibabacloud/yundun/model/TodayMalwareNumResult.h
include/alibabacloud/yundun/model/WebAttackNumRequest.h
include/alibabacloud/yundun/model/WebAttackNumResult.h
include/alibabacloud/yundun/model/TodayAegisOnlineRateRequest.h
include/alibabacloud/yundun/model/TodayAegisOnlineRateResult.h
include/alibabacloud/yundun/model/CurrentDdosAttackNumRequest.h
include/alibabacloud/yundun/model/CurrentDdosAttackNumResult.h
include/alibabacloud/yundun/model/TodayAllkbpsRequest.h
include/alibabacloud/yundun/model/TodayAllkbpsResult.h )
set(yundun_src
src/YundunClient.cc
src/model/TodayqpsByRegionRequest.cc
src/model/TodayqpsByRegionResult.cc
src/model/TodayAllppsRequest.cc
src/model/TodayAllppsResult.cc
src/model/TodayBackdoorRequest.cc
src/model/TodayBackdoorResult.cc
src/model/TodayCrackInterceptRequest.cc
src/model/TodayCrackInterceptResult.cc
src/model/AllMalwareNumRequest.cc
src/model/AllMalwareNumResult.cc
src/model/TodayMalwareNumRequest.cc
src/model/TodayMalwareNumResult.cc
src/model/WebAttackNumRequest.cc
src/model/WebAttackNumResult.cc
src/model/TodayAegisOnlineRateRequest.cc
src/model/TodayAegisOnlineRateResult.cc
src/model/CurrentDdosAttackNumRequest.cc
src/model/CurrentDdosAttackNumResult.cc
src/model/TodayAllkbpsRequest.cc
src/model/TodayAllkbpsResult.cc )
add_library(yundun ${LIB_TYPE}
${yundun_public_header}
${yundun_public_header_model}
${yundun_src})
set_target_properties(yundun
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}yundun
)
if(${LIB_TYPE} STREQUAL "SHARED")
set_target_properties(yundun
PROPERTIES
DEFINE_SYMBOL ALIBABACLOUD_YUNDUN_LIBRARY)
endif()
target_include_directories(yundun
PRIVATE include
${CMAKE_SOURCE_DIR}/core/include
)
target_link_libraries(yundun
core)
if(CMAKE_HOST_WIN32)
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
set(jsoncpp_install_dir ${INSTALL_DIR})
add_dependencies(yundun
jsoncpp)
target_include_directories(yundun
PRIVATE ${jsoncpp_install_dir}/include)
target_link_libraries(yundun
${jsoncpp_install_dir}/lib/jsoncpp.lib)
set_target_properties(yundun
PROPERTIES
COMPILE_OPTIONS "/bigobj")
else()
target_include_directories(yundun
PRIVATE /usr/include/jsoncpp)
target_link_libraries(yundun
jsoncpp)
endif()
install(FILES ${yundun_public_header}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/yundun)
install(FILES ${yundun_public_header_model}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/yundun/model)
install(TARGETS yundun
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

View File

@@ -0,0 +1,126 @@
/*
* 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_YUNDUN_YUNDUNCLIENT_H_
#define ALIBABACLOUD_YUNDUN_YUNDUNCLIENT_H_
#include <future>
#include <alibabacloud/core/AsyncCallerContext.h>
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#include "YundunExport.h"
#include "model/TodayqpsByRegionRequest.h"
#include "model/TodayqpsByRegionResult.h"
#include "model/TodayAllppsRequest.h"
#include "model/TodayAllppsResult.h"
#include "model/TodayBackdoorRequest.h"
#include "model/TodayBackdoorResult.h"
#include "model/TodayCrackInterceptRequest.h"
#include "model/TodayCrackInterceptResult.h"
#include "model/AllMalwareNumRequest.h"
#include "model/AllMalwareNumResult.h"
#include "model/TodayMalwareNumRequest.h"
#include "model/TodayMalwareNumResult.h"
#include "model/WebAttackNumRequest.h"
#include "model/WebAttackNumResult.h"
#include "model/TodayAegisOnlineRateRequest.h"
#include "model/TodayAegisOnlineRateResult.h"
#include "model/CurrentDdosAttackNumRequest.h"
#include "model/CurrentDdosAttackNumResult.h"
#include "model/TodayAllkbpsRequest.h"
#include "model/TodayAllkbpsResult.h"
namespace AlibabaCloud
{
namespace Yundun
{
class ALIBABACLOUD_YUNDUN_EXPORT YundunClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::TodayqpsByRegionResult> TodayqpsByRegionOutcome;
typedef std::future<TodayqpsByRegionOutcome> TodayqpsByRegionOutcomeCallable;
typedef std::function<void(const YundunClient*, const Model::TodayqpsByRegionRequest&, const TodayqpsByRegionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TodayqpsByRegionAsyncHandler;
typedef Outcome<Error, Model::TodayAllppsResult> TodayAllppsOutcome;
typedef std::future<TodayAllppsOutcome> TodayAllppsOutcomeCallable;
typedef std::function<void(const YundunClient*, const Model::TodayAllppsRequest&, const TodayAllppsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TodayAllppsAsyncHandler;
typedef Outcome<Error, Model::TodayBackdoorResult> TodayBackdoorOutcome;
typedef std::future<TodayBackdoorOutcome> TodayBackdoorOutcomeCallable;
typedef std::function<void(const YundunClient*, const Model::TodayBackdoorRequest&, const TodayBackdoorOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TodayBackdoorAsyncHandler;
typedef Outcome<Error, Model::TodayCrackInterceptResult> TodayCrackInterceptOutcome;
typedef std::future<TodayCrackInterceptOutcome> TodayCrackInterceptOutcomeCallable;
typedef std::function<void(const YundunClient*, const Model::TodayCrackInterceptRequest&, const TodayCrackInterceptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TodayCrackInterceptAsyncHandler;
typedef Outcome<Error, Model::AllMalwareNumResult> AllMalwareNumOutcome;
typedef std::future<AllMalwareNumOutcome> AllMalwareNumOutcomeCallable;
typedef std::function<void(const YundunClient*, const Model::AllMalwareNumRequest&, const AllMalwareNumOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> AllMalwareNumAsyncHandler;
typedef Outcome<Error, Model::TodayMalwareNumResult> TodayMalwareNumOutcome;
typedef std::future<TodayMalwareNumOutcome> TodayMalwareNumOutcomeCallable;
typedef std::function<void(const YundunClient*, const Model::TodayMalwareNumRequest&, const TodayMalwareNumOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TodayMalwareNumAsyncHandler;
typedef Outcome<Error, Model::WebAttackNumResult> WebAttackNumOutcome;
typedef std::future<WebAttackNumOutcome> WebAttackNumOutcomeCallable;
typedef std::function<void(const YundunClient*, const Model::WebAttackNumRequest&, const WebAttackNumOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> WebAttackNumAsyncHandler;
typedef Outcome<Error, Model::TodayAegisOnlineRateResult> TodayAegisOnlineRateOutcome;
typedef std::future<TodayAegisOnlineRateOutcome> TodayAegisOnlineRateOutcomeCallable;
typedef std::function<void(const YundunClient*, const Model::TodayAegisOnlineRateRequest&, const TodayAegisOnlineRateOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TodayAegisOnlineRateAsyncHandler;
typedef Outcome<Error, Model::CurrentDdosAttackNumResult> CurrentDdosAttackNumOutcome;
typedef std::future<CurrentDdosAttackNumOutcome> CurrentDdosAttackNumOutcomeCallable;
typedef std::function<void(const YundunClient*, const Model::CurrentDdosAttackNumRequest&, const CurrentDdosAttackNumOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CurrentDdosAttackNumAsyncHandler;
typedef Outcome<Error, Model::TodayAllkbpsResult> TodayAllkbpsOutcome;
typedef std::future<TodayAllkbpsOutcome> TodayAllkbpsOutcomeCallable;
typedef std::function<void(const YundunClient*, const Model::TodayAllkbpsRequest&, const TodayAllkbpsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TodayAllkbpsAsyncHandler;
YundunClient(const Credentials &credentials, const ClientConfiguration &configuration);
YundunClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
YundunClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~YundunClient();
TodayqpsByRegionOutcome todayqpsByRegion(const Model::TodayqpsByRegionRequest &request)const;
void todayqpsByRegionAsync(const Model::TodayqpsByRegionRequest& request, const TodayqpsByRegionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
TodayqpsByRegionOutcomeCallable todayqpsByRegionCallable(const Model::TodayqpsByRegionRequest& request) const;
TodayAllppsOutcome todayAllpps(const Model::TodayAllppsRequest &request)const;
void todayAllppsAsync(const Model::TodayAllppsRequest& request, const TodayAllppsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
TodayAllppsOutcomeCallable todayAllppsCallable(const Model::TodayAllppsRequest& request) const;
TodayBackdoorOutcome todayBackdoor(const Model::TodayBackdoorRequest &request)const;
void todayBackdoorAsync(const Model::TodayBackdoorRequest& request, const TodayBackdoorAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
TodayBackdoorOutcomeCallable todayBackdoorCallable(const Model::TodayBackdoorRequest& request) const;
TodayCrackInterceptOutcome todayCrackIntercept(const Model::TodayCrackInterceptRequest &request)const;
void todayCrackInterceptAsync(const Model::TodayCrackInterceptRequest& request, const TodayCrackInterceptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
TodayCrackInterceptOutcomeCallable todayCrackInterceptCallable(const Model::TodayCrackInterceptRequest& request) const;
AllMalwareNumOutcome allMalwareNum(const Model::AllMalwareNumRequest &request)const;
void allMalwareNumAsync(const Model::AllMalwareNumRequest& request, const AllMalwareNumAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
AllMalwareNumOutcomeCallable allMalwareNumCallable(const Model::AllMalwareNumRequest& request) const;
TodayMalwareNumOutcome todayMalwareNum(const Model::TodayMalwareNumRequest &request)const;
void todayMalwareNumAsync(const Model::TodayMalwareNumRequest& request, const TodayMalwareNumAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
TodayMalwareNumOutcomeCallable todayMalwareNumCallable(const Model::TodayMalwareNumRequest& request) const;
WebAttackNumOutcome webAttackNum(const Model::WebAttackNumRequest &request)const;
void webAttackNumAsync(const Model::WebAttackNumRequest& request, const WebAttackNumAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
WebAttackNumOutcomeCallable webAttackNumCallable(const Model::WebAttackNumRequest& request) const;
TodayAegisOnlineRateOutcome todayAegisOnlineRate(const Model::TodayAegisOnlineRateRequest &request)const;
void todayAegisOnlineRateAsync(const Model::TodayAegisOnlineRateRequest& request, const TodayAegisOnlineRateAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
TodayAegisOnlineRateOutcomeCallable todayAegisOnlineRateCallable(const Model::TodayAegisOnlineRateRequest& request) const;
CurrentDdosAttackNumOutcome currentDdosAttackNum(const Model::CurrentDdosAttackNumRequest &request)const;
void currentDdosAttackNumAsync(const Model::CurrentDdosAttackNumRequest& request, const CurrentDdosAttackNumAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
CurrentDdosAttackNumOutcomeCallable currentDdosAttackNumCallable(const Model::CurrentDdosAttackNumRequest& request) const;
TodayAllkbpsOutcome todayAllkbps(const Model::TodayAllkbpsRequest &request)const;
void todayAllkbpsAsync(const Model::TodayAllkbpsRequest& request, const TodayAllkbpsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
TodayAllkbpsOutcomeCallable todayAllkbpsCallable(const Model::TodayAllkbpsRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;
};
}
}
#endif // !ALIBABACLOUD_YUNDUN_YUNDUNCLIENT_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_YUNDUN_YUNDUNEXPORT_H_
#define ALIBABACLOUD_YUNDUN_YUNDUNEXPORT_H_
#include <alibabacloud/core/Global.h>
#if defined(ALIBABACLOUD_SHARED)
# if defined(ALIBABACLOUD_YUNDUN_LIBRARY)
# define ALIBABACLOUD_YUNDUN_EXPORT ALIBABACLOUD_DECL_EXPORT
# else
# define ALIBABACLOUD_YUNDUN_EXPORT ALIBABACLOUD_DECL_IMPORT
# endif
#else
# define ALIBABACLOUD_YUNDUN_EXPORT
#endif
#endif // !ALIBABACLOUD_YUNDUN_YUNDUNEXPORT_H_

View File

@@ -0,0 +1,45 @@
/*
* 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_YUNDUN_MODEL_ALLMALWARENUMREQUEST_H_
#define ALIBABACLOUD_YUNDUN_MODEL_ALLMALWARENUMREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT AllMalwareNumRequest : public RpcServiceRequest
{
public:
AllMalwareNumRequest();
~AllMalwareNumRequest();
private:
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_ALLMALWARENUMREQUEST_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_YUNDUN_MODEL_ALLMALWARENUMRESULT_H_
#define ALIBABACLOUD_YUNDUN_MODEL_ALLMALWARENUMRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT AllMalwareNumResult : public ServiceResult
{
public:
AllMalwareNumResult();
explicit AllMalwareNumResult(const std::string &payload);
~AllMalwareNumResult();
long getAllMalwareNum()const;
protected:
void parse(const std::string &payload);
private:
long allMalwareNum_;
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_ALLMALWARENUMRESULT_H_

View File

@@ -0,0 +1,45 @@
/*
* 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_YUNDUN_MODEL_CURRENTDDOSATTACKNUMREQUEST_H_
#define ALIBABACLOUD_YUNDUN_MODEL_CURRENTDDOSATTACKNUMREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT CurrentDdosAttackNumRequest : public RpcServiceRequest
{
public:
CurrentDdosAttackNumRequest();
~CurrentDdosAttackNumRequest();
private:
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_CURRENTDDOSATTACKNUMREQUEST_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_YUNDUN_MODEL_CURRENTDDOSATTACKNUMRESULT_H_
#define ALIBABACLOUD_YUNDUN_MODEL_CURRENTDDOSATTACKNUMRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT CurrentDdosAttackNumResult : public ServiceResult
{
public:
CurrentDdosAttackNumResult();
explicit CurrentDdosAttackNumResult(const std::string &payload);
~CurrentDdosAttackNumResult();
long getCurrentDdosAttackNum()const;
protected:
void parse(const std::string &payload);
private:
long currentDdosAttackNum_;
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_CURRENTDDOSATTACKNUMRESULT_H_

View File

@@ -0,0 +1,45 @@
/*
* 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_YUNDUN_MODEL_TODAYAEGISONLINERATEREQUEST_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYAEGISONLINERATEREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayAegisOnlineRateRequest : public RpcServiceRequest
{
public:
TodayAegisOnlineRateRequest();
~TodayAegisOnlineRateRequest();
private:
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYAEGISONLINERATEREQUEST_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_YUNDUN_MODEL_TODAYAEGISONLINERATERESULT_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYAEGISONLINERATERESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayAegisOnlineRateResult : public ServiceResult
{
public:
TodayAegisOnlineRateResult();
explicit TodayAegisOnlineRateResult(const std::string &payload);
~TodayAegisOnlineRateResult();
long getRate()const;
protected:
void parse(const std::string &payload);
private:
long rate_;
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYAEGISONLINERATERESULT_H_

View File

@@ -0,0 +1,45 @@
/*
* 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_YUNDUN_MODEL_TODAYALLKBPSREQUEST_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYALLKBPSREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayAllkbpsRequest : public RpcServiceRequest
{
public:
TodayAllkbpsRequest();
~TodayAllkbpsRequest();
private:
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYALLKBPSREQUEST_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_YUNDUN_MODEL_TODAYALLKBPSRESULT_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYALLKBPSRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayAllkbpsResult : public ServiceResult
{
public:
TodayAllkbpsResult();
explicit TodayAllkbpsResult(const std::string &payload);
~TodayAllkbpsResult();
long getKbps()const;
protected:
void parse(const std::string &payload);
private:
long kbps_;
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYALLKBPSRESULT_H_

View File

@@ -0,0 +1,45 @@
/*
* 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_YUNDUN_MODEL_TODAYALLPPSREQUEST_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYALLPPSREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayAllppsRequest : public RpcServiceRequest
{
public:
TodayAllppsRequest();
~TodayAllppsRequest();
private:
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYALLPPSREQUEST_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_YUNDUN_MODEL_TODAYALLPPSRESULT_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYALLPPSRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayAllppsResult : public ServiceResult
{
public:
TodayAllppsResult();
explicit TodayAllppsResult(const std::string &payload);
~TodayAllppsResult();
long getPps()const;
protected:
void parse(const std::string &payload);
private:
long pps_;
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYALLPPSRESULT_H_

View File

@@ -0,0 +1,45 @@
/*
* 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_YUNDUN_MODEL_TODAYBACKDOORREQUEST_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYBACKDOORREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayBackdoorRequest : public RpcServiceRequest
{
public:
TodayBackdoorRequest();
~TodayBackdoorRequest();
private:
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYBACKDOORREQUEST_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_YUNDUN_MODEL_TODAYBACKDOORRESULT_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYBACKDOORRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayBackdoorResult : public ServiceResult
{
public:
TodayBackdoorResult();
explicit TodayBackdoorResult(const std::string &payload);
~TodayBackdoorResult();
long getBackdoor()const;
protected:
void parse(const std::string &payload);
private:
long backdoor_;
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYBACKDOORRESULT_H_

View File

@@ -0,0 +1,45 @@
/*
* 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_YUNDUN_MODEL_TODAYCRACKINTERCEPTREQUEST_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYCRACKINTERCEPTREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayCrackInterceptRequest : public RpcServiceRequest
{
public:
TodayCrackInterceptRequest();
~TodayCrackInterceptRequest();
private:
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYCRACKINTERCEPTREQUEST_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_YUNDUN_MODEL_TODAYCRACKINTERCEPTRESULT_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYCRACKINTERCEPTRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayCrackInterceptResult : public ServiceResult
{
public:
TodayCrackInterceptResult();
explicit TodayCrackInterceptResult(const std::string &payload);
~TodayCrackInterceptResult();
long getInterceptNum()const;
protected:
void parse(const std::string &payload);
private:
long interceptNum_;
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYCRACKINTERCEPTRESULT_H_

View File

@@ -0,0 +1,45 @@
/*
* 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_YUNDUN_MODEL_TODAYMALWARENUMREQUEST_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYMALWARENUMREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayMalwareNumRequest : public RpcServiceRequest
{
public:
TodayMalwareNumRequest();
~TodayMalwareNumRequest();
private:
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYMALWARENUMREQUEST_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_YUNDUN_MODEL_TODAYMALWARENUMRESULT_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYMALWARENUMRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayMalwareNumResult : public ServiceResult
{
public:
TodayMalwareNumResult();
explicit TodayMalwareNumResult(const std::string &payload);
~TodayMalwareNumResult();
long getTodayMalwareNum()const;
protected:
void parse(const std::string &payload);
private:
long todayMalwareNum_;
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYMALWARENUMRESULT_H_

View File

@@ -0,0 +1,45 @@
/*
* 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_YUNDUN_MODEL_TODAYQPSBYREGIONREQUEST_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYQPSBYREGIONREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayqpsByRegionRequest : public RpcServiceRequest
{
public:
TodayqpsByRegionRequest();
~TodayqpsByRegionRequest();
private:
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYQPSBYREGIONREQUEST_H_

View File

@@ -0,0 +1,57 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_YUNDUN_MODEL_TODAYQPSBYREGIONRESULT_H_
#define ALIBABACLOUD_YUNDUN_MODEL_TODAYQPSBYREGIONRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT TodayqpsByRegionResult : public ServiceResult
{
public:
struct Region
{
long regionNumber;
long regionFlow;
std::string regionId;
};
TodayqpsByRegionResult();
explicit TodayqpsByRegionResult(const std::string &payload);
~TodayqpsByRegionResult();
std::vector<Region> getData()const;
protected:
void parse(const std::string &payload);
private:
std::vector<Region> data_;
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_TODAYQPSBYREGIONRESULT_H_

View File

@@ -0,0 +1,45 @@
/*
* 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_YUNDUN_MODEL_WEBATTACKNUMREQUEST_H_
#define ALIBABACLOUD_YUNDUN_MODEL_WEBATTACKNUMREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT WebAttackNumRequest : public RpcServiceRequest
{
public:
WebAttackNumRequest();
~WebAttackNumRequest();
private:
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_WEBATTACKNUMREQUEST_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_YUNDUN_MODEL_WEBATTACKNUMRESULT_H_
#define ALIBABACLOUD_YUNDUN_MODEL_WEBATTACKNUMRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/yundun/YundunExport.h>
namespace AlibabaCloud
{
namespace Yundun
{
namespace Model
{
class ALIBABACLOUD_YUNDUN_EXPORT WebAttackNumResult : public ServiceResult
{
public:
WebAttackNumResult();
explicit WebAttackNumResult(const std::string &payload);
~WebAttackNumResult();
long getWebAttackNum()const;
protected:
void parse(const std::string &payload);
private:
long webAttackNum_;
};
}
}
}
#endif // !ALIBABACLOUD_YUNDUN_MODEL_WEBATTACKNUMRESULT_H_

413
yundun/src/YundunClient.cc Normal file
View File

@@ -0,0 +1,413 @@
/*
* 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/yundun/YundunClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
namespace
{
const std::string SERVICE_NAME = "Yundun";
}
YundunClient::YundunClient(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, "yundun");
}
YundunClient::YundunClient(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, "yundun");
}
YundunClient::YundunClient(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, "yundun");
}
YundunClient::~YundunClient()
{}
YundunClient::TodayqpsByRegionOutcome YundunClient::todayqpsByRegion(const TodayqpsByRegionRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return TodayqpsByRegionOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return TodayqpsByRegionOutcome(TodayqpsByRegionResult(outcome.result()));
else
return TodayqpsByRegionOutcome(outcome.error());
}
void YundunClient::todayqpsByRegionAsync(const TodayqpsByRegionRequest& request, const TodayqpsByRegionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, todayqpsByRegion(request), context);
};
asyncExecute(new Runnable(fn));
}
YundunClient::TodayqpsByRegionOutcomeCallable YundunClient::todayqpsByRegionCallable(const TodayqpsByRegionRequest &request) const
{
auto task = std::make_shared<std::packaged_task<TodayqpsByRegionOutcome()>>(
[this, request]()
{
return this->todayqpsByRegion(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
YundunClient::TodayAllppsOutcome YundunClient::todayAllpps(const TodayAllppsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return TodayAllppsOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return TodayAllppsOutcome(TodayAllppsResult(outcome.result()));
else
return TodayAllppsOutcome(outcome.error());
}
void YundunClient::todayAllppsAsync(const TodayAllppsRequest& request, const TodayAllppsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, todayAllpps(request), context);
};
asyncExecute(new Runnable(fn));
}
YundunClient::TodayAllppsOutcomeCallable YundunClient::todayAllppsCallable(const TodayAllppsRequest &request) const
{
auto task = std::make_shared<std::packaged_task<TodayAllppsOutcome()>>(
[this, request]()
{
return this->todayAllpps(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
YundunClient::TodayBackdoorOutcome YundunClient::todayBackdoor(const TodayBackdoorRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return TodayBackdoorOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return TodayBackdoorOutcome(TodayBackdoorResult(outcome.result()));
else
return TodayBackdoorOutcome(outcome.error());
}
void YundunClient::todayBackdoorAsync(const TodayBackdoorRequest& request, const TodayBackdoorAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, todayBackdoor(request), context);
};
asyncExecute(new Runnable(fn));
}
YundunClient::TodayBackdoorOutcomeCallable YundunClient::todayBackdoorCallable(const TodayBackdoorRequest &request) const
{
auto task = std::make_shared<std::packaged_task<TodayBackdoorOutcome()>>(
[this, request]()
{
return this->todayBackdoor(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
YundunClient::TodayCrackInterceptOutcome YundunClient::todayCrackIntercept(const TodayCrackInterceptRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return TodayCrackInterceptOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return TodayCrackInterceptOutcome(TodayCrackInterceptResult(outcome.result()));
else
return TodayCrackInterceptOutcome(outcome.error());
}
void YundunClient::todayCrackInterceptAsync(const TodayCrackInterceptRequest& request, const TodayCrackInterceptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, todayCrackIntercept(request), context);
};
asyncExecute(new Runnable(fn));
}
YundunClient::TodayCrackInterceptOutcomeCallable YundunClient::todayCrackInterceptCallable(const TodayCrackInterceptRequest &request) const
{
auto task = std::make_shared<std::packaged_task<TodayCrackInterceptOutcome()>>(
[this, request]()
{
return this->todayCrackIntercept(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
YundunClient::AllMalwareNumOutcome YundunClient::allMalwareNum(const AllMalwareNumRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return AllMalwareNumOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return AllMalwareNumOutcome(AllMalwareNumResult(outcome.result()));
else
return AllMalwareNumOutcome(outcome.error());
}
void YundunClient::allMalwareNumAsync(const AllMalwareNumRequest& request, const AllMalwareNumAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, allMalwareNum(request), context);
};
asyncExecute(new Runnable(fn));
}
YundunClient::AllMalwareNumOutcomeCallable YundunClient::allMalwareNumCallable(const AllMalwareNumRequest &request) const
{
auto task = std::make_shared<std::packaged_task<AllMalwareNumOutcome()>>(
[this, request]()
{
return this->allMalwareNum(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
YundunClient::TodayMalwareNumOutcome YundunClient::todayMalwareNum(const TodayMalwareNumRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return TodayMalwareNumOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return TodayMalwareNumOutcome(TodayMalwareNumResult(outcome.result()));
else
return TodayMalwareNumOutcome(outcome.error());
}
void YundunClient::todayMalwareNumAsync(const TodayMalwareNumRequest& request, const TodayMalwareNumAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, todayMalwareNum(request), context);
};
asyncExecute(new Runnable(fn));
}
YundunClient::TodayMalwareNumOutcomeCallable YundunClient::todayMalwareNumCallable(const TodayMalwareNumRequest &request) const
{
auto task = std::make_shared<std::packaged_task<TodayMalwareNumOutcome()>>(
[this, request]()
{
return this->todayMalwareNum(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
YundunClient::WebAttackNumOutcome YundunClient::webAttackNum(const WebAttackNumRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return WebAttackNumOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return WebAttackNumOutcome(WebAttackNumResult(outcome.result()));
else
return WebAttackNumOutcome(outcome.error());
}
void YundunClient::webAttackNumAsync(const WebAttackNumRequest& request, const WebAttackNumAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, webAttackNum(request), context);
};
asyncExecute(new Runnable(fn));
}
YundunClient::WebAttackNumOutcomeCallable YundunClient::webAttackNumCallable(const WebAttackNumRequest &request) const
{
auto task = std::make_shared<std::packaged_task<WebAttackNumOutcome()>>(
[this, request]()
{
return this->webAttackNum(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
YundunClient::TodayAegisOnlineRateOutcome YundunClient::todayAegisOnlineRate(const TodayAegisOnlineRateRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return TodayAegisOnlineRateOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return TodayAegisOnlineRateOutcome(TodayAegisOnlineRateResult(outcome.result()));
else
return TodayAegisOnlineRateOutcome(outcome.error());
}
void YundunClient::todayAegisOnlineRateAsync(const TodayAegisOnlineRateRequest& request, const TodayAegisOnlineRateAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, todayAegisOnlineRate(request), context);
};
asyncExecute(new Runnable(fn));
}
YundunClient::TodayAegisOnlineRateOutcomeCallable YundunClient::todayAegisOnlineRateCallable(const TodayAegisOnlineRateRequest &request) const
{
auto task = std::make_shared<std::packaged_task<TodayAegisOnlineRateOutcome()>>(
[this, request]()
{
return this->todayAegisOnlineRate(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
YundunClient::CurrentDdosAttackNumOutcome YundunClient::currentDdosAttackNum(const CurrentDdosAttackNumRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CurrentDdosAttackNumOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CurrentDdosAttackNumOutcome(CurrentDdosAttackNumResult(outcome.result()));
else
return CurrentDdosAttackNumOutcome(outcome.error());
}
void YundunClient::currentDdosAttackNumAsync(const CurrentDdosAttackNumRequest& request, const CurrentDdosAttackNumAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, currentDdosAttackNum(request), context);
};
asyncExecute(new Runnable(fn));
}
YundunClient::CurrentDdosAttackNumOutcomeCallable YundunClient::currentDdosAttackNumCallable(const CurrentDdosAttackNumRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CurrentDdosAttackNumOutcome()>>(
[this, request]()
{
return this->currentDdosAttackNum(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
YundunClient::TodayAllkbpsOutcome YundunClient::todayAllkbps(const TodayAllkbpsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return TodayAllkbpsOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return TodayAllkbpsOutcome(TodayAllkbpsResult(outcome.result()));
else
return TodayAllkbpsOutcome(outcome.error());
}
void YundunClient::todayAllkbpsAsync(const TodayAllkbpsRequest& request, const TodayAllkbpsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, todayAllkbps(request), context);
};
asyncExecute(new Runnable(fn));
}
YundunClient::TodayAllkbpsOutcomeCallable YundunClient::todayAllkbpsCallable(const TodayAllkbpsRequest &request) const
{
auto task = std::make_shared<std::packaged_task<TodayAllkbpsOutcome()>>(
[this, request]()
{
return this->todayAllkbps(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/yundun/model/AllMalwareNumRequest.h>
using AlibabaCloud::Yundun::Model::AllMalwareNumRequest;
AllMalwareNumRequest::AllMalwareNumRequest() :
RpcServiceRequest("yundun", "2015-02-27", "AllMalwareNum")
{}
AllMalwareNumRequest::~AllMalwareNumRequest()
{}

View File

@@ -0,0 +1,52 @@
/*
* 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/yundun/model/AllMalwareNumResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
AllMalwareNumResult::AllMalwareNumResult() :
ServiceResult()
{}
AllMalwareNumResult::AllMalwareNumResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
AllMalwareNumResult::~AllMalwareNumResult()
{}
void AllMalwareNumResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["AllMalwareNum"].isNull())
allMalwareNum_ = std::stol(value["AllMalwareNum"].asString());
}
long AllMalwareNumResult::getAllMalwareNum()const
{
return allMalwareNum_;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/yundun/model/CurrentDdosAttackNumRequest.h>
using AlibabaCloud::Yundun::Model::CurrentDdosAttackNumRequest;
CurrentDdosAttackNumRequest::CurrentDdosAttackNumRequest() :
RpcServiceRequest("yundun", "2015-02-27", "CurrentDdosAttackNum")
{}
CurrentDdosAttackNumRequest::~CurrentDdosAttackNumRequest()
{}

View File

@@ -0,0 +1,52 @@
/*
* 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/yundun/model/CurrentDdosAttackNumResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
CurrentDdosAttackNumResult::CurrentDdosAttackNumResult() :
ServiceResult()
{}
CurrentDdosAttackNumResult::CurrentDdosAttackNumResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
CurrentDdosAttackNumResult::~CurrentDdosAttackNumResult()
{}
void CurrentDdosAttackNumResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["CurrentDdosAttackNum"].isNull())
currentDdosAttackNum_ = std::stol(value["CurrentDdosAttackNum"].asString());
}
long CurrentDdosAttackNumResult::getCurrentDdosAttackNum()const
{
return currentDdosAttackNum_;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/yundun/model/TodayAegisOnlineRateRequest.h>
using AlibabaCloud::Yundun::Model::TodayAegisOnlineRateRequest;
TodayAegisOnlineRateRequest::TodayAegisOnlineRateRequest() :
RpcServiceRequest("yundun", "2015-02-27", "TodayAegisOnlineRate")
{}
TodayAegisOnlineRateRequest::~TodayAegisOnlineRateRequest()
{}

View File

@@ -0,0 +1,52 @@
/*
* 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/yundun/model/TodayAegisOnlineRateResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
TodayAegisOnlineRateResult::TodayAegisOnlineRateResult() :
ServiceResult()
{}
TodayAegisOnlineRateResult::TodayAegisOnlineRateResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
TodayAegisOnlineRateResult::~TodayAegisOnlineRateResult()
{}
void TodayAegisOnlineRateResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Rate"].isNull())
rate_ = std::stol(value["Rate"].asString());
}
long TodayAegisOnlineRateResult::getRate()const
{
return rate_;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/yundun/model/TodayAllkbpsRequest.h>
using AlibabaCloud::Yundun::Model::TodayAllkbpsRequest;
TodayAllkbpsRequest::TodayAllkbpsRequest() :
RpcServiceRequest("yundun", "2015-02-27", "TodayAllkbps")
{}
TodayAllkbpsRequest::~TodayAllkbpsRequest()
{}

View File

@@ -0,0 +1,52 @@
/*
* 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/yundun/model/TodayAllkbpsResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
TodayAllkbpsResult::TodayAllkbpsResult() :
ServiceResult()
{}
TodayAllkbpsResult::TodayAllkbpsResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
TodayAllkbpsResult::~TodayAllkbpsResult()
{}
void TodayAllkbpsResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Kbps"].isNull())
kbps_ = std::stol(value["Kbps"].asString());
}
long TodayAllkbpsResult::getKbps()const
{
return kbps_;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/yundun/model/TodayAllppsRequest.h>
using AlibabaCloud::Yundun::Model::TodayAllppsRequest;
TodayAllppsRequest::TodayAllppsRequest() :
RpcServiceRequest("yundun", "2015-02-27", "TodayAllpps")
{}
TodayAllppsRequest::~TodayAllppsRequest()
{}

View File

@@ -0,0 +1,52 @@
/*
* 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/yundun/model/TodayAllppsResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
TodayAllppsResult::TodayAllppsResult() :
ServiceResult()
{}
TodayAllppsResult::TodayAllppsResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
TodayAllppsResult::~TodayAllppsResult()
{}
void TodayAllppsResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Pps"].isNull())
pps_ = std::stol(value["Pps"].asString());
}
long TodayAllppsResult::getPps()const
{
return pps_;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/yundun/model/TodayBackdoorRequest.h>
using AlibabaCloud::Yundun::Model::TodayBackdoorRequest;
TodayBackdoorRequest::TodayBackdoorRequest() :
RpcServiceRequest("yundun", "2015-02-27", "TodayBackdoor")
{}
TodayBackdoorRequest::~TodayBackdoorRequest()
{}

View File

@@ -0,0 +1,52 @@
/*
* 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/yundun/model/TodayBackdoorResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
TodayBackdoorResult::TodayBackdoorResult() :
ServiceResult()
{}
TodayBackdoorResult::TodayBackdoorResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
TodayBackdoorResult::~TodayBackdoorResult()
{}
void TodayBackdoorResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Backdoor"].isNull())
backdoor_ = std::stol(value["Backdoor"].asString());
}
long TodayBackdoorResult::getBackdoor()const
{
return backdoor_;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/yundun/model/TodayCrackInterceptRequest.h>
using AlibabaCloud::Yundun::Model::TodayCrackInterceptRequest;
TodayCrackInterceptRequest::TodayCrackInterceptRequest() :
RpcServiceRequest("yundun", "2015-02-27", "TodayCrackIntercept")
{}
TodayCrackInterceptRequest::~TodayCrackInterceptRequest()
{}

View File

@@ -0,0 +1,52 @@
/*
* 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/yundun/model/TodayCrackInterceptResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
TodayCrackInterceptResult::TodayCrackInterceptResult() :
ServiceResult()
{}
TodayCrackInterceptResult::TodayCrackInterceptResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
TodayCrackInterceptResult::~TodayCrackInterceptResult()
{}
void TodayCrackInterceptResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["InterceptNum"].isNull())
interceptNum_ = std::stol(value["InterceptNum"].asString());
}
long TodayCrackInterceptResult::getInterceptNum()const
{
return interceptNum_;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/yundun/model/TodayMalwareNumRequest.h>
using AlibabaCloud::Yundun::Model::TodayMalwareNumRequest;
TodayMalwareNumRequest::TodayMalwareNumRequest() :
RpcServiceRequest("yundun", "2015-02-27", "TodayMalwareNum")
{}
TodayMalwareNumRequest::~TodayMalwareNumRequest()
{}

View File

@@ -0,0 +1,52 @@
/*
* 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/yundun/model/TodayMalwareNumResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
TodayMalwareNumResult::TodayMalwareNumResult() :
ServiceResult()
{}
TodayMalwareNumResult::TodayMalwareNumResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
TodayMalwareNumResult::~TodayMalwareNumResult()
{}
void TodayMalwareNumResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["TodayMalwareNum"].isNull())
todayMalwareNum_ = std::stol(value["TodayMalwareNum"].asString());
}
long TodayMalwareNumResult::getTodayMalwareNum()const
{
return todayMalwareNum_;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/yundun/model/TodayqpsByRegionRequest.h>
using AlibabaCloud::Yundun::Model::TodayqpsByRegionRequest;
TodayqpsByRegionRequest::TodayqpsByRegionRequest() :
RpcServiceRequest("yundun", "2015-02-27", "TodayqpsByRegion")
{}
TodayqpsByRegionRequest::~TodayqpsByRegionRequest()
{}

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/yundun/model/TodayqpsByRegionResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
TodayqpsByRegionResult::TodayqpsByRegionResult() :
ServiceResult()
{}
TodayqpsByRegionResult::TodayqpsByRegionResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
TodayqpsByRegionResult::~TodayqpsByRegionResult()
{}
void TodayqpsByRegionResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allData = value["Data"]["Region"];
for (auto value : allData)
{
Region dataObject;
if(!value["RegionId"].isNull())
dataObject.regionId = value["RegionId"].asString();
if(!value["RegionNumber"].isNull())
dataObject.regionNumber = std::stol(value["RegionNumber"].asString());
if(!value["RegionFlow"].isNull())
dataObject.regionFlow = std::stol(value["RegionFlow"].asString());
data_.push_back(dataObject);
}
}
std::vector<TodayqpsByRegionResult::Region> TodayqpsByRegionResult::getData()const
{
return data_;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/yundun/model/WebAttackNumRequest.h>
using AlibabaCloud::Yundun::Model::WebAttackNumRequest;
WebAttackNumRequest::WebAttackNumRequest() :
RpcServiceRequest("yundun", "2015-02-27", "WebAttackNum")
{}
WebAttackNumRequest::~WebAttackNumRequest()
{}

View File

@@ -0,0 +1,52 @@
/*
* 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/yundun/model/WebAttackNumResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Yundun;
using namespace AlibabaCloud::Yundun::Model;
WebAttackNumResult::WebAttackNumResult() :
ServiceResult()
{}
WebAttackNumResult::WebAttackNumResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
WebAttackNumResult::~WebAttackNumResult()
{}
void WebAttackNumResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["WebAttackNum"].isNull())
webAttackNum_ = std::stol(value["WebAttackNum"].asString());
}
long WebAttackNumResult::getWebAttackNum()const
{
return webAttackNum_;
}