From 68ed8881499e696444370216539573f4bd87eebe Mon Sep 17 00:00:00 2001 From: sdk-team Date: Thu, 21 Apr 2022 02:40:30 +0000 Subject: [PATCH] Add API OfflineTaskFlow. --- CHANGELOG | 3 + VERSION | 2 +- dms-enterprise/CMakeLists.txt | 4 ++ .../dms-enterprise/Dms_enterpriseClient.h | 8 +++ .../model/OfflineTaskFlowRequest.h | 45 +++++++++++++ .../model/OfflineTaskFlowResult.h | 55 ++++++++++++++++ dms-enterprise/src/Dms-enterpriseClient.cc | 36 ++++++++++ .../src/model/OfflineTaskFlowRequest.cc | 45 +++++++++++++ .../src/model/OfflineTaskFlowResult.cc | 65 +++++++++++++++++++ 9 files changed, 262 insertions(+), 1 deletion(-) create mode 100644 dms-enterprise/include/alibabacloud/dms-enterprise/model/OfflineTaskFlowRequest.h create mode 100644 dms-enterprise/include/alibabacloud/dms-enterprise/model/OfflineTaskFlowResult.h create mode 100644 dms-enterprise/src/model/OfflineTaskFlowRequest.cc create mode 100644 dms-enterprise/src/model/OfflineTaskFlowResult.cc diff --git a/CHANGELOG b/CHANGELOG index 08df66d75..a88dec305 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2022-04-21 Version: 1.36.1109 +- Add API OfflineTaskFlow. + 2022-04-19 Version: 1.36.1108 - Generated 2018-12-03 for `Sas`. diff --git a/VERSION b/VERSION index c9248fd55..2257c7113 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1108 \ No newline at end of file +1.36.1109 \ No newline at end of file diff --git a/dms-enterprise/CMakeLists.txt b/dms-enterprise/CMakeLists.txt index 4e6a9b476..365148694 100644 --- a/dms-enterprise/CMakeLists.txt +++ b/dms-enterprise/CMakeLists.txt @@ -237,6 +237,8 @@ set(dms-enterprise_public_header_model include/alibabacloud/dms-enterprise/model/ListWorkFlowTemplatesResult.h include/alibabacloud/dms-enterprise/model/ModifyDataCorrectExecSQLRequest.h include/alibabacloud/dms-enterprise/model/ModifyDataCorrectExecSQLResult.h + include/alibabacloud/dms-enterprise/model/OfflineTaskFlowRequest.h + include/alibabacloud/dms-enterprise/model/OfflineTaskFlowResult.h include/alibabacloud/dms-enterprise/model/PauseDataCorrectSQLJobRequest.h include/alibabacloud/dms-enterprise/model/PauseDataCorrectSQLJobResult.h include/alibabacloud/dms-enterprise/model/ReDeployLhDagVersionRequest.h @@ -488,6 +490,8 @@ set(dms-enterprise_src src/model/ListWorkFlowTemplatesResult.cc src/model/ModifyDataCorrectExecSQLRequest.cc src/model/ModifyDataCorrectExecSQLResult.cc + src/model/OfflineTaskFlowRequest.cc + src/model/OfflineTaskFlowResult.cc src/model/PauseDataCorrectSQLJobRequest.cc src/model/PauseDataCorrectSQLJobResult.cc src/model/ReDeployLhDagVersionRequest.cc diff --git a/dms-enterprise/include/alibabacloud/dms-enterprise/Dms_enterpriseClient.h b/dms-enterprise/include/alibabacloud/dms-enterprise/Dms_enterpriseClient.h index e2086f2ae..75cfd9506 100644 --- a/dms-enterprise/include/alibabacloud/dms-enterprise/Dms_enterpriseClient.h +++ b/dms-enterprise/include/alibabacloud/dms-enterprise/Dms_enterpriseClient.h @@ -238,6 +238,8 @@ #include "model/ListWorkFlowTemplatesResult.h" #include "model/ModifyDataCorrectExecSQLRequest.h" #include "model/ModifyDataCorrectExecSQLResult.h" +#include "model/OfflineTaskFlowRequest.h" +#include "model/OfflineTaskFlowResult.h" #include "model/PauseDataCorrectSQLJobRequest.h" #include "model/PauseDataCorrectSQLJobResult.h" #include "model/ReDeployLhDagVersionRequest.h" @@ -603,6 +605,9 @@ namespace AlibabaCloud typedef Outcome ModifyDataCorrectExecSQLOutcome; typedef std::future ModifyDataCorrectExecSQLOutcomeCallable; typedef std::function&)> ModifyDataCorrectExecSQLAsyncHandler; + typedef Outcome OfflineTaskFlowOutcome; + typedef std::future OfflineTaskFlowOutcomeCallable; + typedef std::function&)> OfflineTaskFlowAsyncHandler; typedef Outcome PauseDataCorrectSQLJobOutcome; typedef std::future PauseDataCorrectSQLJobOutcomeCallable; typedef std::function&)> PauseDataCorrectSQLJobAsyncHandler; @@ -980,6 +985,9 @@ namespace AlibabaCloud ModifyDataCorrectExecSQLOutcome modifyDataCorrectExecSQL(const Model::ModifyDataCorrectExecSQLRequest &request)const; void modifyDataCorrectExecSQLAsync(const Model::ModifyDataCorrectExecSQLRequest& request, const ModifyDataCorrectExecSQLAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ModifyDataCorrectExecSQLOutcomeCallable modifyDataCorrectExecSQLCallable(const Model::ModifyDataCorrectExecSQLRequest& request) const; + OfflineTaskFlowOutcome offlineTaskFlow(const Model::OfflineTaskFlowRequest &request)const; + void offlineTaskFlowAsync(const Model::OfflineTaskFlowRequest& request, const OfflineTaskFlowAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + OfflineTaskFlowOutcomeCallable offlineTaskFlowCallable(const Model::OfflineTaskFlowRequest& request) const; PauseDataCorrectSQLJobOutcome pauseDataCorrectSQLJob(const Model::PauseDataCorrectSQLJobRequest &request)const; void pauseDataCorrectSQLJobAsync(const Model::PauseDataCorrectSQLJobRequest& request, const PauseDataCorrectSQLJobAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; PauseDataCorrectSQLJobOutcomeCallable pauseDataCorrectSQLJobCallable(const Model::PauseDataCorrectSQLJobRequest& request) const; diff --git a/dms-enterprise/include/alibabacloud/dms-enterprise/model/OfflineTaskFlowRequest.h b/dms-enterprise/include/alibabacloud/dms-enterprise/model/OfflineTaskFlowRequest.h new file mode 100644 index 000000000..619e141a4 --- /dev/null +++ b/dms-enterprise/include/alibabacloud/dms-enterprise/model/OfflineTaskFlowRequest.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_DMS_ENTERPRISE_MODEL_OFFLINETASKFLOWREQUEST_H_ +#define ALIBABACLOUD_DMS_ENTERPRISE_MODEL_OFFLINETASKFLOWREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Dms_enterprise { +namespace Model { +class ALIBABACLOUD_DMS_ENTERPRISE_EXPORT OfflineTaskFlowRequest : public RpcServiceRequest { +public: + OfflineTaskFlowRequest(); + ~OfflineTaskFlowRequest(); + long getDagId() const; + void setDagId(long dagId); + long getTid() const; + void setTid(long tid); + +private: + long dagId_; + long tid_; +}; +} // namespace Model +} // namespace Dms_enterprise +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_DMS_ENTERPRISE_MODEL_OFFLINETASKFLOWREQUEST_H_ diff --git a/dms-enterprise/include/alibabacloud/dms-enterprise/model/OfflineTaskFlowResult.h b/dms-enterprise/include/alibabacloud/dms-enterprise/model/OfflineTaskFlowResult.h new file mode 100644 index 000000000..322a42962 --- /dev/null +++ b/dms-enterprise/include/alibabacloud/dms-enterprise/model/OfflineTaskFlowResult.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_DMS_ENTERPRISE_MODEL_OFFLINETASKFLOWRESULT_H_ +#define ALIBABACLOUD_DMS_ENTERPRISE_MODEL_OFFLINETASKFLOWRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Dms_enterprise + { + namespace Model + { + class ALIBABACLOUD_DMS_ENTERPRISE_EXPORT OfflineTaskFlowResult : public ServiceResult + { + public: + + + OfflineTaskFlowResult(); + explicit OfflineTaskFlowResult(const std::string &payload); + ~OfflineTaskFlowResult(); + std::string getErrorCode()const; + std::string getErrorMessage()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::string errorCode_; + std::string errorMessage_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DMS_ENTERPRISE_MODEL_OFFLINETASKFLOWRESULT_H_ \ No newline at end of file diff --git a/dms-enterprise/src/Dms-enterpriseClient.cc b/dms-enterprise/src/Dms-enterpriseClient.cc index 41e1567a3..61acb5ca3 100644 --- a/dms-enterprise/src/Dms-enterpriseClient.cc +++ b/dms-enterprise/src/Dms-enterpriseClient.cc @@ -3939,6 +3939,42 @@ Dms_enterpriseClient::ModifyDataCorrectExecSQLOutcomeCallable Dms_enterpriseClie return task->get_future(); } +Dms_enterpriseClient::OfflineTaskFlowOutcome Dms_enterpriseClient::offlineTaskFlow(const OfflineTaskFlowRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return OfflineTaskFlowOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return OfflineTaskFlowOutcome(OfflineTaskFlowResult(outcome.result())); + else + return OfflineTaskFlowOutcome(outcome.error()); +} + +void Dms_enterpriseClient::offlineTaskFlowAsync(const OfflineTaskFlowRequest& request, const OfflineTaskFlowAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, offlineTaskFlow(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Dms_enterpriseClient::OfflineTaskFlowOutcomeCallable Dms_enterpriseClient::offlineTaskFlowCallable(const OfflineTaskFlowRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->offlineTaskFlow(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + Dms_enterpriseClient::PauseDataCorrectSQLJobOutcome Dms_enterpriseClient::pauseDataCorrectSQLJob(const PauseDataCorrectSQLJobRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/dms-enterprise/src/model/OfflineTaskFlowRequest.cc b/dms-enterprise/src/model/OfflineTaskFlowRequest.cc new file mode 100644 index 000000000..236b04c16 --- /dev/null +++ b/dms-enterprise/src/model/OfflineTaskFlowRequest.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::Dms_enterprise::Model::OfflineTaskFlowRequest; + +OfflineTaskFlowRequest::OfflineTaskFlowRequest() + : RpcServiceRequest("dms-enterprise", "2018-11-01", "OfflineTaskFlow") { + setMethod(HttpRequest::Method::Post); +} + +OfflineTaskFlowRequest::~OfflineTaskFlowRequest() {} + +long OfflineTaskFlowRequest::getDagId() const { + return dagId_; +} + +void OfflineTaskFlowRequest::setDagId(long dagId) { + dagId_ = dagId; + setParameter(std::string("DagId"), std::to_string(dagId)); +} + +long OfflineTaskFlowRequest::getTid() const { + return tid_; +} + +void OfflineTaskFlowRequest::setTid(long tid) { + tid_ = tid; + setParameter(std::string("Tid"), std::to_string(tid)); +} + diff --git a/dms-enterprise/src/model/OfflineTaskFlowResult.cc b/dms-enterprise/src/model/OfflineTaskFlowResult.cc new file mode 100644 index 000000000..3258829c6 --- /dev/null +++ b/dms-enterprise/src/model/OfflineTaskFlowResult.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::Dms_enterprise; +using namespace AlibabaCloud::Dms_enterprise::Model; + +OfflineTaskFlowResult::OfflineTaskFlowResult() : + ServiceResult() +{} + +OfflineTaskFlowResult::OfflineTaskFlowResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +OfflineTaskFlowResult::~OfflineTaskFlowResult() +{} + +void OfflineTaskFlowResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["ErrorCode"].isNull()) + errorCode_ = value["ErrorCode"].asString(); + if(!value["ErrorMessage"].isNull()) + errorMessage_ = value["ErrorMessage"].asString(); + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + +} + +std::string OfflineTaskFlowResult::getErrorCode()const +{ + return errorCode_; +} + +std::string OfflineTaskFlowResult::getErrorMessage()const +{ + return errorMessage_; +} + +bool OfflineTaskFlowResult::getSuccess()const +{ + return success_; +} +