Compare commits

..

1 Commits

Author SHA1 Message Date
wb-hx510875
b32986689b test ci 2020-07-01 13:24:34 +08:00
17 changed files with 7 additions and 348 deletions

View File

@@ -1,6 +1,3 @@
2020-07-01 Version: 1.36.488
- Support Saf For ExecuteExtendService.
2020-06-30 Version: 1.36.487
- Add ListMetrics API.

View File

@@ -61,8 +61,6 @@ endif()
if(BUILD_PRODUCT STREQUAL "")
message(WARNING "Please set the value of 'BUILD_PRODUCT'")
elseif(BUILD_PRODUCT STREQUAL "core")
add_subdirectory(core)
else()
add_subdirectory(core)
add_subdirectory(${BUILD_PRODUCT})

View File

@@ -1 +1 @@
1.36.488
1.36.487

View File

@@ -43,16 +43,12 @@ class ALIBABACLOUD_CORE_EXPORT ClientConfiguration {
void setConnectTimeout(const long connectTimeout);
void setReadTimeout(const long readTimeout);
bool rejectUnauthorized() const;
void setRejectUnauthorized(const bool rejectUnauthorized);
private:
std::string endpoint_;
NetworkProxy proxy_;
std::string regionId_;
long connectTimeout_;
long readTimeout_;
bool rejectUnauthorized_ = true;
};
} // namespace AlibabaCloud

View File

@@ -34,12 +34,9 @@ class HttpClient {
virtual HttpResponseOutcome makeRequest(const HttpRequest &request) = 0;
NetworkProxy proxy()const;
void setProxy(const NetworkProxy &proxy);
bool rejectUnauthorized()const;
void setRejectUnauthorized(const bool &rejectUnauthorized);
private:
NetworkProxy proxy_;
bool rejectUnauthorized_;
};
} // namespace AlibabaCloud
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPCLIENT_H_

View File

@@ -71,12 +71,4 @@ void ClientConfiguration::setReadTimeout(const long readTimeout) {
readTimeout_ = readTimeout;
}
bool ClientConfiguration::rejectUnauthorized() const {
return rejectUnauthorized_;
}
void ClientConfiguration::setRejectUnauthorized(const bool rejectUnauthorized) {
rejectUnauthorized_ = rejectUnauthorized;
}
} // namespace AlibabaCloud

View File

@@ -33,7 +33,6 @@ CoreClient::CoreClient(const std::string &servicename,
: serviceName_(servicename), configuration_(configuration),
httpClient_(new CurlHttpClient) {
httpClient_->setProxy(configuration.proxy());
httpClient_->setRejectUnauthorized(configuration.rejectUnauthorized());
}
CoreClient::~CoreClient() { delete httpClient_; }

View File

@@ -163,13 +163,8 @@ CurlHttpClient::makeRequest(const HttpRequest &request) {
}
curl_easy_setopt(curlHandle_, CURLOPT_URL, url.c_str());
if (rejectUnauthorized()) {
curl_easy_setopt(curlHandle_, CURLOPT_SSL_VERIFYPEER, 1L);
curl_easy_setopt(curlHandle_, CURLOPT_SSL_VERIFYHOST, 2L);
} else {
curl_easy_setopt(curlHandle_, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curlHandle_, CURLOPT_SSL_VERIFYHOST, 0L);
}
curl_easy_setopt(curlHandle_, CURLOPT_SSL_VERIFYPEER, 1L);
curl_easy_setopt(curlHandle_, CURLOPT_SSL_VERIFYHOST, 2L);
curl_easy_setopt(curlHandle_, CURLOPT_HEADERDATA, &response);
curl_easy_setopt(curlHandle_, CURLOPT_HEADERFUNCTION, recvHeaders);

View File

@@ -36,12 +36,4 @@ void HttpClient::setProxy(const NetworkProxy &proxy) {
proxy_ = proxy;
}
bool HttpClient::rejectUnauthorized()const{
return rejectUnauthorized_;
}
void HttpClient::setRejectUnauthorized(const bool &rejectUnauthorized) {
rejectUnauthorized_ = rejectUnauthorized;
}
} // namespace AlibabaCloud

View File

@@ -12,7 +12,7 @@ echo $MAKE
rm -rf sdk_build
mkdir sdk_build
cd sdk_build
cmake -DBUILD_PRODUCT="$product" -DBUILD_FUNCTION_TESTS=OFF -DBUILD_UNIT_TESTS=OFF -DENABLE_COVERAGE=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
cmake -DBUILD_PRODUCT="$product" -DBUILD_FUNCTION_TESTS=OFF -DBUILD_UNIT_TESTS=OFF -DENABLE_COVERAGE=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/ ..
$MAKE
make install

View File

@@ -21,8 +21,6 @@ set(saf_public_header
include/alibabacloud/saf/SafExport.h )
set(saf_public_header_model
include/alibabacloud/saf/model/ExecuteExtendServiceRequest.h
include/alibabacloud/saf/model/ExecuteExtendServiceResult.h
include/alibabacloud/saf/model/ExecuteRequestRequest.h
include/alibabacloud/saf/model/ExecuteRequestResult.h
include/alibabacloud/saf/model/ExecuteRequestSGRequest.h
@@ -30,8 +28,6 @@ set(saf_public_header_model
set(saf_src
src/SafClient.cc
src/model/ExecuteExtendServiceRequest.cc
src/model/ExecuteExtendServiceResult.cc
src/model/ExecuteRequestRequest.cc
src/model/ExecuteRequestResult.cc
src/model/ExecuteRequestSGRequest.cc

View File

@@ -22,8 +22,6 @@
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#include "SafExport.h"
#include "model/ExecuteExtendServiceRequest.h"
#include "model/ExecuteExtendServiceResult.h"
#include "model/ExecuteRequestRequest.h"
#include "model/ExecuteRequestResult.h"
#include "model/ExecuteRequestSGRequest.h"
@@ -37,9 +35,6 @@ namespace AlibabaCloud
class ALIBABACLOUD_SAF_EXPORT SafClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::ExecuteExtendServiceResult> ExecuteExtendServiceOutcome;
typedef std::future<ExecuteExtendServiceOutcome> ExecuteExtendServiceOutcomeCallable;
typedef std::function<void(const SafClient*, const Model::ExecuteExtendServiceRequest&, const ExecuteExtendServiceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ExecuteExtendServiceAsyncHandler;
typedef Outcome<Error, Model::ExecuteRequestResult> ExecuteRequestOutcome;
typedef std::future<ExecuteRequestOutcome> ExecuteRequestOutcomeCallable;
typedef std::function<void(const SafClient*, const Model::ExecuteRequestRequest&, const ExecuteRequestOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ExecuteRequestAsyncHandler;
@@ -51,9 +46,6 @@ namespace AlibabaCloud
SafClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
SafClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~SafClient();
ExecuteExtendServiceOutcome executeExtendService(const Model::ExecuteExtendServiceRequest &request)const;
void executeExtendServiceAsync(const Model::ExecuteExtendServiceRequest& request, const ExecuteExtendServiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ExecuteExtendServiceOutcomeCallable executeExtendServiceCallable(const Model::ExecuteExtendServiceRequest& request) const;
ExecuteRequestOutcome executeRequest(const Model::ExecuteRequestRequest &request)const;
void executeRequestAsync(const Model::ExecuteRequestRequest& request, const ExecuteRequestAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ExecuteRequestOutcomeCallable executeRequestCallable(const Model::ExecuteRequestRequest& request) const;

View File

@@ -1,54 +0,0 @@
/*
* 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_SAF_MODEL_EXECUTEEXTENDSERVICEREQUEST_H_
#define ALIBABACLOUD_SAF_MODEL_EXECUTEEXTENDSERVICEREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/saf/SafExport.h>
namespace AlibabaCloud
{
namespace Saf
{
namespace Model
{
class ALIBABACLOUD_SAF_EXPORT ExecuteExtendServiceRequest : public RpcServiceRequest
{
public:
ExecuteExtendServiceRequest();
~ExecuteExtendServiceRequest();
std::string getServiceParameters()const;
void setServiceParameters(const std::string& serviceParameters);
std::string getService()const;
void setService(const std::string& service);
std::string getRegion()const;
void setRegion(const std::string& region);
private:
std::string serviceParameters_;
std::string service_;
std::string region_;
};
}
}
}
#endif // !ALIBABACLOUD_SAF_MODEL_EXECUTEEXTENDSERVICEREQUEST_H_

View File

@@ -1,63 +0,0 @@
/*
* 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_SAF_MODEL_EXECUTEEXTENDSERVICERESULT_H_
#define ALIBABACLOUD_SAF_MODEL_EXECUTEEXTENDSERVICERESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/saf/SafExport.h>
namespace AlibabaCloud
{
namespace Saf
{
namespace Model
{
class ALIBABACLOUD_SAF_EXPORT ExecuteExtendServiceResult : public ServiceResult
{
public:
struct Data
{
std::string invokeResult;
};
ExecuteExtendServiceResult();
explicit ExecuteExtendServiceResult(const std::string &payload);
~ExecuteExtendServiceResult();
std::string getMessage()const;
std::string getHttpStatusCode()const;
Data getData()const;
std::string getCode()const;
bool getSuccess()const;
protected:
void parse(const std::string &payload);
private:
std::string message_;
std::string httpStatusCode_;
Data data_;
std::string code_;
bool success_;
};
}
}
}
#endif // !ALIBABACLOUD_SAF_MODEL_EXECUTEEXTENDSERVICERESULT_H_

View File

@@ -31,62 +31,26 @@ SafClient::SafClient(const Credentials &credentials, const ClientConfiguration &
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, "SAF");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "saf");
}
SafClient::SafClient(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, "SAF");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "saf");
}
SafClient::SafClient(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, "SAF");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "saf");
}
SafClient::~SafClient()
{}
SafClient::ExecuteExtendServiceOutcome SafClient::executeExtendService(const ExecuteExtendServiceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ExecuteExtendServiceOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ExecuteExtendServiceOutcome(ExecuteExtendServiceResult(outcome.result()));
else
return ExecuteExtendServiceOutcome(outcome.error());
}
void SafClient::executeExtendServiceAsync(const ExecuteExtendServiceRequest& request, const ExecuteExtendServiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, executeExtendService(request), context);
};
asyncExecute(new Runnable(fn));
}
SafClient::ExecuteExtendServiceOutcomeCallable SafClient::executeExtendServiceCallable(const ExecuteExtendServiceRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ExecuteExtendServiceOutcome()>>(
[this, request]()
{
return this->executeExtendService(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
SafClient::ExecuteRequestOutcome SafClient::executeRequest(const ExecuteRequestRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -1,62 +0,0 @@
/*
* 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/saf/model/ExecuteExtendServiceRequest.h>
using AlibabaCloud::Saf::Model::ExecuteExtendServiceRequest;
ExecuteExtendServiceRequest::ExecuteExtendServiceRequest() :
RpcServiceRequest("saf", "2019-05-21", "ExecuteExtendService")
{
setMethod(HttpRequest::Method::Post);
}
ExecuteExtendServiceRequest::~ExecuteExtendServiceRequest()
{}
std::string ExecuteExtendServiceRequest::getServiceParameters()const
{
return serviceParameters_;
}
void ExecuteExtendServiceRequest::setServiceParameters(const std::string& serviceParameters)
{
serviceParameters_ = serviceParameters;
setParameter("ServiceParameters", serviceParameters);
}
std::string ExecuteExtendServiceRequest::getService()const
{
return service_;
}
void ExecuteExtendServiceRequest::setService(const std::string& service)
{
service_ = service;
setParameter("Service", service);
}
std::string ExecuteExtendServiceRequest::getRegion()const
{
return region_;
}
void ExecuteExtendServiceRequest::setRegion(const std::string& region)
{
region_ = region;
setParameter("Region", region);
}

View File

@@ -1,80 +0,0 @@
/*
* 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/saf/model/ExecuteExtendServiceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Saf;
using namespace AlibabaCloud::Saf::Model;
ExecuteExtendServiceResult::ExecuteExtendServiceResult() :
ServiceResult()
{}
ExecuteExtendServiceResult::ExecuteExtendServiceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ExecuteExtendServiceResult::~ExecuteExtendServiceResult()
{}
void ExecuteExtendServiceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
if(!dataNode["InvokeResult"].isNull())
data_.invokeResult = dataNode["InvokeResult"].asString();
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["HttpStatusCode"].isNull())
httpStatusCode_ = value["HttpStatusCode"].asString();
}
std::string ExecuteExtendServiceResult::getMessage()const
{
return message_;
}
std::string ExecuteExtendServiceResult::getHttpStatusCode()const
{
return httpStatusCode_;
}
ExecuteExtendServiceResult::Data ExecuteExtendServiceResult::getData()const
{
return data_;
}
std::string ExecuteExtendServiceResult::getCode()const
{
return code_;
}
bool ExecuteExtendServiceResult::getSuccess()const
{
return success_;
}