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

View File

@@ -1 +1 @@
1.36.1455 1.36.1456

94
viapi/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(viapi_public_header
include/alibabacloud/viapi/ViapiClient.h
include/alibabacloud/viapi/ViapiExport.h )
set(viapi_public_header_model
include/alibabacloud/viapi/model/CancelWaitingAsyncJobRequest.h
include/alibabacloud/viapi/model/CancelWaitingAsyncJobResult.h
include/alibabacloud/viapi/model/GetAsyncJobResultRequest.h
include/alibabacloud/viapi/model/GetAsyncJobResultResult.h
include/alibabacloud/viapi/model/QueryAsyncJobListRequest.h
include/alibabacloud/viapi/model/QueryAsyncJobListResult.h )
set(viapi_src
src/ViapiClient.cc
src/model/CancelWaitingAsyncJobRequest.cc
src/model/CancelWaitingAsyncJobResult.cc
src/model/GetAsyncJobResultRequest.cc
src/model/GetAsyncJobResultResult.cc
src/model/QueryAsyncJobListRequest.cc
src/model/QueryAsyncJobListResult.cc )
add_library(viapi ${LIB_TYPE}
${viapi_public_header}
${viapi_public_header_model}
${viapi_src})
set_target_properties(viapi
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}viapi
)
if(${LIB_TYPE} STREQUAL "SHARED")
set_target_properties(viapi
PROPERTIES
DEFINE_SYMBOL ALIBABACLOUD_VIAPI_LIBRARY)
endif()
target_include_directories(viapi
PRIVATE include
${CMAKE_SOURCE_DIR}/core/include
)
target_link_libraries(viapi
core)
if(CMAKE_HOST_WIN32)
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
set(jsoncpp_install_dir ${INSTALL_DIR})
add_dependencies(viapi
jsoncpp)
target_include_directories(viapi
PRIVATE ${jsoncpp_install_dir}/include)
target_link_libraries(viapi
${jsoncpp_install_dir}/lib/jsoncpp.lib)
set_target_properties(viapi
PROPERTIES
COMPILE_OPTIONS "/bigobj")
else()
target_include_directories(viapi
PRIVATE /usr/include/jsoncpp)
target_link_libraries(viapi
jsoncpp)
endif()
install(FILES ${viapi_public_header}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/viapi)
install(FILES ${viapi_public_header_model}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/viapi/model)
install(TARGETS viapi
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_VIAPI_VIAPICLIENT_H_
#define ALIBABACLOUD_VIAPI_VIAPICLIENT_H_
#include <future>
#include <alibabacloud/core/AsyncCallerContext.h>
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#include "ViapiExport.h"
#include "model/CancelWaitingAsyncJobRequest.h"
#include "model/CancelWaitingAsyncJobResult.h"
#include "model/GetAsyncJobResultRequest.h"
#include "model/GetAsyncJobResultResult.h"
#include "model/QueryAsyncJobListRequest.h"
#include "model/QueryAsyncJobListResult.h"
namespace AlibabaCloud
{
namespace Viapi
{
class ALIBABACLOUD_VIAPI_EXPORT ViapiClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::CancelWaitingAsyncJobResult> CancelWaitingAsyncJobOutcome;
typedef std::future<CancelWaitingAsyncJobOutcome> CancelWaitingAsyncJobOutcomeCallable;
typedef std::function<void(const ViapiClient*, const Model::CancelWaitingAsyncJobRequest&, const CancelWaitingAsyncJobOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CancelWaitingAsyncJobAsyncHandler;
typedef Outcome<Error, Model::GetAsyncJobResultResult> GetAsyncJobResultOutcome;
typedef std::future<GetAsyncJobResultOutcome> GetAsyncJobResultOutcomeCallable;
typedef std::function<void(const ViapiClient*, const Model::GetAsyncJobResultRequest&, const GetAsyncJobResultOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetAsyncJobResultAsyncHandler;
typedef Outcome<Error, Model::QueryAsyncJobListResult> QueryAsyncJobListOutcome;
typedef std::future<QueryAsyncJobListOutcome> QueryAsyncJobListOutcomeCallable;
typedef std::function<void(const ViapiClient*, const Model::QueryAsyncJobListRequest&, const QueryAsyncJobListOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> QueryAsyncJobListAsyncHandler;
ViapiClient(const Credentials &credentials, const ClientConfiguration &configuration);
ViapiClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
ViapiClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~ViapiClient();
CancelWaitingAsyncJobOutcome cancelWaitingAsyncJob(const Model::CancelWaitingAsyncJobRequest &request)const;
void cancelWaitingAsyncJobAsync(const Model::CancelWaitingAsyncJobRequest& request, const CancelWaitingAsyncJobAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
CancelWaitingAsyncJobOutcomeCallable cancelWaitingAsyncJobCallable(const Model::CancelWaitingAsyncJobRequest& request) const;
GetAsyncJobResultOutcome getAsyncJobResult(const Model::GetAsyncJobResultRequest &request)const;
void getAsyncJobResultAsync(const Model::GetAsyncJobResultRequest& request, const GetAsyncJobResultAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetAsyncJobResultOutcomeCallable getAsyncJobResultCallable(const Model::GetAsyncJobResultRequest& request) const;
QueryAsyncJobListOutcome queryAsyncJobList(const Model::QueryAsyncJobListRequest &request)const;
void queryAsyncJobListAsync(const Model::QueryAsyncJobListRequest& request, const QueryAsyncJobListAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
QueryAsyncJobListOutcomeCallable queryAsyncJobListCallable(const Model::QueryAsyncJobListRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;
};
}
}
#endif // !ALIBABACLOUD_VIAPI_VIAPICLIENT_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_VIAPI_VIAPIEXPORT_H_
#define ALIBABACLOUD_VIAPI_VIAPIEXPORT_H_
#include <alibabacloud/core/Global.h>
#if defined(ALIBABACLOUD_SHARED)
# if defined(ALIBABACLOUD_VIAPI_LIBRARY)
# define ALIBABACLOUD_VIAPI_EXPORT ALIBABACLOUD_DECL_EXPORT
# else
# define ALIBABACLOUD_VIAPI_EXPORT ALIBABACLOUD_DECL_IMPORT
# endif
#else
# define ALIBABACLOUD_VIAPI_EXPORT
#endif
#endif // !ALIBABACLOUD_VIAPI_VIAPIEXPORT_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_VIAPI_MODEL_CANCELWAITINGASYNCJOBREQUEST_H_
#define ALIBABACLOUD_VIAPI_MODEL_CANCELWAITINGASYNCJOBREQUEST_H_
#include <alibabacloud/viapi/ViapiExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace Viapi {
namespace Model {
class ALIBABACLOUD_VIAPI_EXPORT CancelWaitingAsyncJobRequest : public RpcServiceRequest {
public:
CancelWaitingAsyncJobRequest();
~CancelWaitingAsyncJobRequest();
std::string getJobId() const;
void setJobId(const std::string &jobId);
bool getAsync() const;
void setAsync(bool async);
private:
std::string jobId_;
bool async_;
};
} // namespace Model
} // namespace Viapi
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_VIAPI_MODEL_CANCELWAITINGASYNCJOBREQUEST_H_

View File

@@ -0,0 +1,55 @@
/*
* 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_VIAPI_MODEL_CANCELWAITINGASYNCJOBRESULT_H_
#define ALIBABACLOUD_VIAPI_MODEL_CANCELWAITINGASYNCJOBRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/viapi/ViapiExport.h>
namespace AlibabaCloud
{
namespace Viapi
{
namespace Model
{
class ALIBABACLOUD_VIAPI_EXPORT CancelWaitingAsyncJobResult : public ServiceResult
{
public:
CancelWaitingAsyncJobResult();
explicit CancelWaitingAsyncJobResult(const std::string &payload);
~CancelWaitingAsyncJobResult();
std::string getHttpCode()const;
std::string getMessage()const;
bool getSuccess()const;
protected:
void parse(const std::string &payload);
private:
std::string httpCode_;
std::string message_;
bool success_;
};
}
}
}
#endif // !ALIBABACLOUD_VIAPI_MODEL_CANCELWAITINGASYNCJOBRESULT_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_VIAPI_MODEL_GETASYNCJOBRESULTREQUEST_H_
#define ALIBABACLOUD_VIAPI_MODEL_GETASYNCJOBRESULTREQUEST_H_
#include <alibabacloud/viapi/ViapiExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace Viapi {
namespace Model {
class ALIBABACLOUD_VIAPI_EXPORT GetAsyncJobResultRequest : public RpcServiceRequest {
public:
GetAsyncJobResultRequest();
~GetAsyncJobResultRequest();
std::string getJobId() const;
void setJobId(const std::string &jobId);
bool getAsync() const;
void setAsync(bool async);
private:
std::string jobId_;
bool async_;
};
} // namespace Model
} // namespace Viapi
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_VIAPI_MODEL_GETASYNCJOBRESULTREQUEST_H_

View File

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

View File

@@ -0,0 +1,63 @@
/*
* 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_VIAPI_MODEL_QUERYASYNCJOBLISTREQUEST_H_
#define ALIBABACLOUD_VIAPI_MODEL_QUERYASYNCJOBLISTREQUEST_H_
#include <alibabacloud/viapi/ViapiExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace Viapi {
namespace Model {
class ALIBABACLOUD_VIAPI_EXPORT QueryAsyncJobListRequest : public RpcServiceRequest {
public:
QueryAsyncJobListRequest();
~QueryAsyncJobListRequest();
std::string getStartTime() const;
void setStartTime(const std::string &startTime);
std::string getPageNum() const;
void setPageNum(const std::string &pageNum);
std::string getJobId() const;
void setJobId(const std::string &jobId);
std::string getPopApiName() const;
void setPopApiName(const std::string &popApiName);
std::string getPageSize() const;
void setPageSize(const std::string &pageSize);
std::string getPopProduct() const;
void setPopProduct(const std::string &popProduct);
std::string getEndTime() const;
void setEndTime(const std::string &endTime);
std::string getStatus() const;
void setStatus(const std::string &status);
private:
std::string startTime_;
std::string pageNum_;
std::string jobId_;
std::string popApiName_;
std::string pageSize_;
std::string popProduct_;
std::string endTime_;
std::string status_;
};
} // namespace Model
} // namespace Viapi
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_VIAPI_MODEL_QUERYASYNCJOBLISTREQUEST_H_

View File

@@ -0,0 +1,76 @@
/*
* 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_VIAPI_MODEL_QUERYASYNCJOBLISTRESULT_H_
#define ALIBABACLOUD_VIAPI_MODEL_QUERYASYNCJOBLISTRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/viapi/ViapiExport.h>
namespace AlibabaCloud
{
namespace Viapi
{
namespace Model
{
class ALIBABACLOUD_VIAPI_EXPORT QueryAsyncJobListResult : public ServiceResult
{
public:
struct Data
{
struct ResultItem
{
std::string status;
std::string gmtCreate;
std::string endTime;
std::string callerParentId;
std::string popApiName;
std::string popProduct;
std::string startTime;
std::string jobId;
};
int pageSize;
int totalPage;
int currentPage;
int totalRecord;
std::vector<ResultItem> result;
};
QueryAsyncJobListResult();
explicit QueryAsyncJobListResult(const std::string &payload);
~QueryAsyncJobListResult();
std::string getHttpCode()const;
std::string getMessage()const;
Data getData()const;
bool getSuccess()const;
protected:
void parse(const std::string &payload);
private:
std::string httpCode_;
std::string message_;
Data data_;
bool success_;
};
}
}
}
#endif // !ALIBABACLOUD_VIAPI_MODEL_QUERYASYNCJOBLISTRESULT_H_

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_;
}