Support for deploy.

This commit is contained in:
sdk-team
2023-02-17 12:30:27 +00:00
parent ecf1fc42a2
commit 53da02f63b
17 changed files with 1116 additions and 1 deletions

161
viapi/src/ViapiClient.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/viapi/ViapiClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::Viapi;
using namespace AlibabaCloud::Viapi::Model;
namespace
{
const std::string SERVICE_NAME = "viapi";
}
ViapiClient::ViapiClient(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, "viapi");
}
ViapiClient::ViapiClient(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, "viapi");
}
ViapiClient::ViapiClient(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, "viapi");
}
ViapiClient::~ViapiClient()
{}
ViapiClient::CancelWaitingAsyncJobOutcome ViapiClient::cancelWaitingAsyncJob(const CancelWaitingAsyncJobRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CancelWaitingAsyncJobOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CancelWaitingAsyncJobOutcome(CancelWaitingAsyncJobResult(outcome.result()));
else
return CancelWaitingAsyncJobOutcome(outcome.error());
}
void ViapiClient::cancelWaitingAsyncJobAsync(const CancelWaitingAsyncJobRequest& request, const CancelWaitingAsyncJobAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, cancelWaitingAsyncJob(request), context);
};
asyncExecute(new Runnable(fn));
}
ViapiClient::CancelWaitingAsyncJobOutcomeCallable ViapiClient::cancelWaitingAsyncJobCallable(const CancelWaitingAsyncJobRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CancelWaitingAsyncJobOutcome()>>(
[this, request]()
{
return this->cancelWaitingAsyncJob(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ViapiClient::GetAsyncJobResultOutcome ViapiClient::getAsyncJobResult(const GetAsyncJobResultRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetAsyncJobResultOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetAsyncJobResultOutcome(GetAsyncJobResultResult(outcome.result()));
else
return GetAsyncJobResultOutcome(outcome.error());
}
void ViapiClient::getAsyncJobResultAsync(const GetAsyncJobResultRequest& request, const GetAsyncJobResultAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getAsyncJobResult(request), context);
};
asyncExecute(new Runnable(fn));
}
ViapiClient::GetAsyncJobResultOutcomeCallable ViapiClient::getAsyncJobResultCallable(const GetAsyncJobResultRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetAsyncJobResultOutcome()>>(
[this, request]()
{
return this->getAsyncJobResult(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ViapiClient::QueryAsyncJobListOutcome ViapiClient::queryAsyncJobList(const QueryAsyncJobListRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return QueryAsyncJobListOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return QueryAsyncJobListOutcome(QueryAsyncJobListResult(outcome.result()));
else
return QueryAsyncJobListOutcome(outcome.error());
}
void ViapiClient::queryAsyncJobListAsync(const QueryAsyncJobListRequest& request, const QueryAsyncJobListAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, queryAsyncJobList(request), context);
};
asyncExecute(new Runnable(fn));
}
ViapiClient::QueryAsyncJobListOutcomeCallable ViapiClient::queryAsyncJobListCallable(const QueryAsyncJobListRequest &request) const
{
auto task = std::make_shared<std::packaged_task<QueryAsyncJobListOutcome()>>(
[this, request]()
{
return this->queryAsyncJobList(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

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.
*/
#include <alibabacloud/viapi/model/CancelWaitingAsyncJobRequest.h>
using AlibabaCloud::Viapi::Model::CancelWaitingAsyncJobRequest;
CancelWaitingAsyncJobRequest::CancelWaitingAsyncJobRequest()
: RpcServiceRequest("viapi", "2023-01-17", "CancelWaitingAsyncJob") {
setMethod(HttpRequest::Method::Post);
}
CancelWaitingAsyncJobRequest::~CancelWaitingAsyncJobRequest() {}
std::string CancelWaitingAsyncJobRequest::getJobId() const {
return jobId_;
}
void CancelWaitingAsyncJobRequest::setJobId(const std::string &jobId) {
jobId_ = jobId;
setBodyParameter(std::string("JobId"), jobId);
}
bool CancelWaitingAsyncJobRequest::getAsync() const {
return async_;
}
void CancelWaitingAsyncJobRequest::setAsync(bool async) {
async_ = async;
setBodyParameter(std::string("Async"), async ? "true" : "false");
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/viapi/model/CancelWaitingAsyncJobResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Viapi;
using namespace AlibabaCloud::Viapi::Model;
CancelWaitingAsyncJobResult::CancelWaitingAsyncJobResult() :
ServiceResult()
{}
CancelWaitingAsyncJobResult::CancelWaitingAsyncJobResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
CancelWaitingAsyncJobResult::~CancelWaitingAsyncJobResult()
{}
void CancelWaitingAsyncJobResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["HttpCode"].isNull())
httpCode_ = value["HttpCode"].asString();
}
std::string CancelWaitingAsyncJobResult::getHttpCode()const
{
return httpCode_;
}
std::string CancelWaitingAsyncJobResult::getMessage()const
{
return message_;
}
bool CancelWaitingAsyncJobResult::getSuccess()const
{
return success_;
}

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.
*/
#include <alibabacloud/viapi/model/GetAsyncJobResultRequest.h>
using AlibabaCloud::Viapi::Model::GetAsyncJobResultRequest;
GetAsyncJobResultRequest::GetAsyncJobResultRequest()
: RpcServiceRequest("viapi", "2023-01-17", "GetAsyncJobResult") {
setMethod(HttpRequest::Method::Post);
}
GetAsyncJobResultRequest::~GetAsyncJobResultRequest() {}
std::string GetAsyncJobResultRequest::getJobId() const {
return jobId_;
}
void GetAsyncJobResultRequest::setJobId(const std::string &jobId) {
jobId_ = jobId;
setBodyParameter(std::string("JobId"), jobId);
}
bool GetAsyncJobResultRequest::getAsync() const {
return async_;
}
void GetAsyncJobResultRequest::setAsync(bool async) {
async_ = async;
setBodyParameter(std::string("Async"), async ? "true" : "false");
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/viapi/model/GetAsyncJobResultResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Viapi;
using namespace AlibabaCloud::Viapi::Model;
GetAsyncJobResultResult::GetAsyncJobResultResult() :
ServiceResult()
{}
GetAsyncJobResultResult::GetAsyncJobResultResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetAsyncJobResultResult::~GetAsyncJobResultResult()
{}
void GetAsyncJobResultResult::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["Status"].isNull())
data_.status = dataNode["Status"].asString();
if(!dataNode["ErrorMessage"].isNull())
data_.errorMessage = dataNode["ErrorMessage"].asString();
if(!dataNode["Result"].isNull())
data_.result = dataNode["Result"].asString();
if(!dataNode["ErrorCode"].isNull())
data_.errorCode = dataNode["ErrorCode"].asString();
if(!dataNode["JobId"].isNull())
data_.jobId = dataNode["JobId"].asString();
}
GetAsyncJobResultResult::Data GetAsyncJobResultResult::getData()const
{
return data_;
}

View File

@@ -0,0 +1,99 @@
/*
* 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/viapi/model/QueryAsyncJobListRequest.h>
using AlibabaCloud::Viapi::Model::QueryAsyncJobListRequest;
QueryAsyncJobListRequest::QueryAsyncJobListRequest()
: RpcServiceRequest("viapi", "2023-01-17", "QueryAsyncJobList") {
setMethod(HttpRequest::Method::Post);
}
QueryAsyncJobListRequest::~QueryAsyncJobListRequest() {}
std::string QueryAsyncJobListRequest::getStartTime() const {
return startTime_;
}
void QueryAsyncJobListRequest::setStartTime(const std::string &startTime) {
startTime_ = startTime;
setBodyParameter(std::string("StartTime"), startTime);
}
std::string QueryAsyncJobListRequest::getPageNum() const {
return pageNum_;
}
void QueryAsyncJobListRequest::setPageNum(const std::string &pageNum) {
pageNum_ = pageNum;
setBodyParameter(std::string("PageNum"), pageNum);
}
std::string QueryAsyncJobListRequest::getJobId() const {
return jobId_;
}
void QueryAsyncJobListRequest::setJobId(const std::string &jobId) {
jobId_ = jobId;
setBodyParameter(std::string("JobId"), jobId);
}
std::string QueryAsyncJobListRequest::getPopApiName() const {
return popApiName_;
}
void QueryAsyncJobListRequest::setPopApiName(const std::string &popApiName) {
popApiName_ = popApiName;
setBodyParameter(std::string("PopApiName"), popApiName);
}
std::string QueryAsyncJobListRequest::getPageSize() const {
return pageSize_;
}
void QueryAsyncJobListRequest::setPageSize(const std::string &pageSize) {
pageSize_ = pageSize;
setBodyParameter(std::string("PageSize"), pageSize);
}
std::string QueryAsyncJobListRequest::getPopProduct() const {
return popProduct_;
}
void QueryAsyncJobListRequest::setPopProduct(const std::string &popProduct) {
popProduct_ = popProduct;
setBodyParameter(std::string("PopProduct"), popProduct);
}
std::string QueryAsyncJobListRequest::getEndTime() const {
return endTime_;
}
void QueryAsyncJobListRequest::setEndTime(const std::string &endTime) {
endTime_ = endTime;
setBodyParameter(std::string("EndTime"), endTime);
}
std::string QueryAsyncJobListRequest::getStatus() const {
return status_;
}
void QueryAsyncJobListRequest::setStatus(const std::string &status) {
status_ = status;
setBodyParameter(std::string("Status"), status);
}

View File

@@ -0,0 +1,101 @@
/*
* 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/viapi/model/QueryAsyncJobListResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Viapi;
using namespace AlibabaCloud::Viapi::Model;
QueryAsyncJobListResult::QueryAsyncJobListResult() :
ServiceResult()
{}
QueryAsyncJobListResult::QueryAsyncJobListResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
QueryAsyncJobListResult::~QueryAsyncJobListResult()
{}
void QueryAsyncJobListResult::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["CurrentPage"].isNull())
data_.currentPage = std::stoi(dataNode["CurrentPage"].asString());
if(!dataNode["PageSize"].isNull())
data_.pageSize = std::stoi(dataNode["PageSize"].asString());
if(!dataNode["TotalPage"].isNull())
data_.totalPage = std::stoi(dataNode["TotalPage"].asString());
if(!dataNode["TotalRecord"].isNull())
data_.totalRecord = std::stoi(dataNode["TotalRecord"].asString());
auto allResultNode = dataNode["Result"]["resultItem"];
for (auto dataNodeResultresultItem : allResultNode)
{
Data::ResultItem resultItemObject;
if(!dataNodeResultresultItem["CallerParentId"].isNull())
resultItemObject.callerParentId = dataNodeResultresultItem["CallerParentId"].asString();
if(!dataNodeResultresultItem["EndTime"].isNull())
resultItemObject.endTime = dataNodeResultresultItem["EndTime"].asString();
if(!dataNodeResultresultItem["GmtCreate"].isNull())
resultItemObject.gmtCreate = dataNodeResultresultItem["GmtCreate"].asString();
if(!dataNodeResultresultItem["JobId"].isNull())
resultItemObject.jobId = dataNodeResultresultItem["JobId"].asString();
if(!dataNodeResultresultItem["PopApiName"].isNull())
resultItemObject.popApiName = dataNodeResultresultItem["PopApiName"].asString();
if(!dataNodeResultresultItem["PopProduct"].isNull())
resultItemObject.popProduct = dataNodeResultresultItem["PopProduct"].asString();
if(!dataNodeResultresultItem["StartTime"].isNull())
resultItemObject.startTime = dataNodeResultresultItem["StartTime"].asString();
if(!dataNodeResultresultItem["Status"].isNull())
resultItemObject.status = dataNodeResultresultItem["Status"].asString();
data_.result.push_back(resultItemObject);
}
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["HttpCode"].isNull())
httpCode_ = value["HttpCode"].asString();
}
std::string QueryAsyncJobListResult::getHttpCode()const
{
return httpCode_;
}
std::string QueryAsyncJobListResult::getMessage()const
{
return message_;
}
QueryAsyncJobListResult::Data QueryAsyncJobListResult::getData()const
{
return data_;
}
bool QueryAsyncJobListResult::getSuccess()const
{
return success_;
}