diff --git a/VERSION b/VERSION index 5890ffb0f..bc2ca3aed 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1455 \ No newline at end of file +1.36.1456 \ No newline at end of file diff --git a/viapi/CMakeLists.txt b/viapi/CMakeLists.txt new file mode 100644 index 000000000..29f8bb4d7 --- /dev/null +++ b/viapi/CMakeLists.txt @@ -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} + ) \ No newline at end of file diff --git a/viapi/include/alibabacloud/viapi/ViapiClient.h b/viapi/include/alibabacloud/viapi/ViapiClient.h new file mode 100644 index 000000000..f6cffe33c --- /dev/null +++ b/viapi/include/alibabacloud/viapi/ViapiClient.h @@ -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 +#include +#include +#include +#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 CancelWaitingAsyncJobOutcome; + typedef std::future CancelWaitingAsyncJobOutcomeCallable; + typedef std::function&)> CancelWaitingAsyncJobAsyncHandler; + typedef Outcome GetAsyncJobResultOutcome; + typedef std::future GetAsyncJobResultOutcomeCallable; + typedef std::function&)> GetAsyncJobResultAsyncHandler; + typedef Outcome QueryAsyncJobListOutcome; + typedef std::future QueryAsyncJobListOutcomeCallable; + typedef std::function&)> QueryAsyncJobListAsyncHandler; + + ViapiClient(const Credentials &credentials, const ClientConfiguration &configuration); + ViapiClient(const std::shared_ptr &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& 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& 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& context = nullptr) const; + QueryAsyncJobListOutcomeCallable queryAsyncJobListCallable(const Model::QueryAsyncJobListRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_VIAPI_VIAPICLIENT_H_ diff --git a/viapi/include/alibabacloud/viapi/ViapiExport.h b/viapi/include/alibabacloud/viapi/ViapiExport.h new file mode 100644 index 000000000..cffe47ca3 --- /dev/null +++ b/viapi/include/alibabacloud/viapi/ViapiExport.h @@ -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 + +#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_ \ No newline at end of file diff --git a/viapi/include/alibabacloud/viapi/model/CancelWaitingAsyncJobRequest.h b/viapi/include/alibabacloud/viapi/model/CancelWaitingAsyncJobRequest.h new file mode 100644 index 000000000..c39e37696 --- /dev/null +++ b/viapi/include/alibabacloud/viapi/model/CancelWaitingAsyncJobRequest.h @@ -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 +#include +#include +#include +#include + +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_ diff --git a/viapi/include/alibabacloud/viapi/model/CancelWaitingAsyncJobResult.h b/viapi/include/alibabacloud/viapi/model/CancelWaitingAsyncJobResult.h new file mode 100644 index 000000000..442bc222f --- /dev/null +++ b/viapi/include/alibabacloud/viapi/model/CancelWaitingAsyncJobResult.h @@ -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 +#include +#include +#include +#include + +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_ \ No newline at end of file diff --git a/viapi/include/alibabacloud/viapi/model/GetAsyncJobResultRequest.h b/viapi/include/alibabacloud/viapi/model/GetAsyncJobResultRequest.h new file mode 100644 index 000000000..013189245 --- /dev/null +++ b/viapi/include/alibabacloud/viapi/model/GetAsyncJobResultRequest.h @@ -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 +#include +#include +#include +#include + +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_ diff --git a/viapi/include/alibabacloud/viapi/model/GetAsyncJobResultResult.h b/viapi/include/alibabacloud/viapi/model/GetAsyncJobResultResult.h new file mode 100644 index 000000000..336f2db94 --- /dev/null +++ b/viapi/include/alibabacloud/viapi/model/GetAsyncJobResultResult.h @@ -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 +#include +#include +#include +#include + +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_ \ No newline at end of file diff --git a/viapi/include/alibabacloud/viapi/model/QueryAsyncJobListRequest.h b/viapi/include/alibabacloud/viapi/model/QueryAsyncJobListRequest.h new file mode 100644 index 000000000..bfee9998d --- /dev/null +++ b/viapi/include/alibabacloud/viapi/model/QueryAsyncJobListRequest.h @@ -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 +#include +#include +#include +#include + +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_ diff --git a/viapi/include/alibabacloud/viapi/model/QueryAsyncJobListResult.h b/viapi/include/alibabacloud/viapi/model/QueryAsyncJobListResult.h new file mode 100644 index 000000000..5cb6645e4 --- /dev/null +++ b/viapi/include/alibabacloud/viapi/model/QueryAsyncJobListResult.h @@ -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 +#include +#include +#include +#include + +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 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_ \ No newline at end of file diff --git a/viapi/src/ViapiClient.cc b/viapi/src/ViapiClient.cc new file mode 100644 index 000000000..347a472f0 --- /dev/null +++ b/viapi/src/ViapiClient.cc @@ -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 +#include + +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(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "viapi"); +} + +ViapiClient::ViapiClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(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(accessKeyId, accessKeySecret), configuration) +{ + auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); + endpointProvider_ = std::make_shared(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& 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>( + [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& 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>( + [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& 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>( + [this, request]() + { + return this->queryAsyncJobList(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/viapi/src/model/CancelWaitingAsyncJobRequest.cc b/viapi/src/model/CancelWaitingAsyncJobRequest.cc new file mode 100644 index 000000000..363aac336 --- /dev/null +++ b/viapi/src/model/CancelWaitingAsyncJobRequest.cc @@ -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 + +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"); +} + diff --git a/viapi/src/model/CancelWaitingAsyncJobResult.cc b/viapi/src/model/CancelWaitingAsyncJobResult.cc new file mode 100644 index 000000000..b52e1b7b0 --- /dev/null +++ b/viapi/src/model/CancelWaitingAsyncJobResult.cc @@ -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 +#include + +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_; +} + diff --git a/viapi/src/model/GetAsyncJobResultRequest.cc b/viapi/src/model/GetAsyncJobResultRequest.cc new file mode 100644 index 000000000..c6c42f4dd --- /dev/null +++ b/viapi/src/model/GetAsyncJobResultRequest.cc @@ -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 + +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"); +} + diff --git a/viapi/src/model/GetAsyncJobResultResult.cc b/viapi/src/model/GetAsyncJobResultResult.cc new file mode 100644 index 000000000..25fa64103 --- /dev/null +++ b/viapi/src/model/GetAsyncJobResultResult.cc @@ -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 +#include + +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_; +} + diff --git a/viapi/src/model/QueryAsyncJobListRequest.cc b/viapi/src/model/QueryAsyncJobListRequest.cc new file mode 100644 index 000000000..5a9f0256e --- /dev/null +++ b/viapi/src/model/QueryAsyncJobListRequest.cc @@ -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 + +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); +} + diff --git a/viapi/src/model/QueryAsyncJobListResult.cc b/viapi/src/model/QueryAsyncJobListResult.cc new file mode 100644 index 000000000..a708bf9f5 --- /dev/null +++ b/viapi/src/model/QueryAsyncJobListResult.cc @@ -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 +#include + +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_; +} +