diff --git a/CHANGELOG b/CHANGELOG index 1f3f18038..de357784d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +2021-12-30 Version: 1.36.1008 +- Supported Get Worker List. +- Execute Job Support Designate Machine. + 2021-12-30 Version: 1.36.1007 - Create Lindorm Open api. diff --git a/VERSION b/VERSION index 82456112b..83626cfe2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1007 \ No newline at end of file +1.36.1008 \ No newline at end of file diff --git a/schedulerx2/CMakeLists.txt b/schedulerx2/CMakeLists.txt index 5a3ceaf79..f640a831d 100644 --- a/schedulerx2/CMakeLists.txt +++ b/schedulerx2/CMakeLists.txt @@ -59,6 +59,8 @@ set(schedulerx2_public_header_model include/alibabacloud/schedulerx2/model/GetJobInstanceListResult.h include/alibabacloud/schedulerx2/model/GetWorkFlowRequest.h include/alibabacloud/schedulerx2/model/GetWorkFlowResult.h + include/alibabacloud/schedulerx2/model/GetWorkerListRequest.h + include/alibabacloud/schedulerx2/model/GetWorkerListResult.h include/alibabacloud/schedulerx2/model/GrantPermissionRequest.h include/alibabacloud/schedulerx2/model/GrantPermissionResult.h include/alibabacloud/schedulerx2/model/ListGroupsRequest.h @@ -114,6 +116,8 @@ set(schedulerx2_src src/model/GetJobInstanceListResult.cc src/model/GetWorkFlowRequest.cc src/model/GetWorkFlowResult.cc + src/model/GetWorkerListRequest.cc + src/model/GetWorkerListResult.cc src/model/GrantPermissionRequest.cc src/model/GrantPermissionResult.cc src/model/ListGroupsRequest.cc diff --git a/schedulerx2/include/alibabacloud/schedulerx2/Schedulerx2Client.h b/schedulerx2/include/alibabacloud/schedulerx2/Schedulerx2Client.h index 1b1d0d8a9..570f910a1 100644 --- a/schedulerx2/include/alibabacloud/schedulerx2/Schedulerx2Client.h +++ b/schedulerx2/include/alibabacloud/schedulerx2/Schedulerx2Client.h @@ -60,6 +60,8 @@ #include "model/GetJobInstanceListResult.h" #include "model/GetWorkFlowRequest.h" #include "model/GetWorkFlowResult.h" +#include "model/GetWorkerListRequest.h" +#include "model/GetWorkerListResult.h" #include "model/GrantPermissionRequest.h" #include "model/GrantPermissionResult.h" #include "model/ListGroupsRequest.h" @@ -140,6 +142,9 @@ namespace AlibabaCloud typedef Outcome GetWorkFlowOutcome; typedef std::future GetWorkFlowOutcomeCallable; typedef std::function&)> GetWorkFlowAsyncHandler; + typedef Outcome GetWorkerListOutcome; + typedef std::future GetWorkerListOutcomeCallable; + typedef std::function&)> GetWorkerListAsyncHandler; typedef Outcome GrantPermissionOutcome; typedef std::future GrantPermissionOutcomeCallable; typedef std::function&)> GrantPermissionAsyncHandler; @@ -223,6 +228,9 @@ namespace AlibabaCloud GetWorkFlowOutcome getWorkFlow(const Model::GetWorkFlowRequest &request)const; void getWorkFlowAsync(const Model::GetWorkFlowRequest& request, const GetWorkFlowAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetWorkFlowOutcomeCallable getWorkFlowCallable(const Model::GetWorkFlowRequest& request) const; + GetWorkerListOutcome getWorkerList(const Model::GetWorkerListRequest &request)const; + void getWorkerListAsync(const Model::GetWorkerListRequest& request, const GetWorkerListAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetWorkerListOutcomeCallable getWorkerListCallable(const Model::GetWorkerListRequest& request) const; GrantPermissionOutcome grantPermission(const Model::GrantPermissionRequest &request)const; void grantPermissionAsync(const Model::GrantPermissionRequest& request, const GrantPermissionAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GrantPermissionOutcomeCallable grantPermissionCallable(const Model::GrantPermissionRequest& request) const; diff --git a/schedulerx2/include/alibabacloud/schedulerx2/model/ExecuteJobRequest.h b/schedulerx2/include/alibabacloud/schedulerx2/model/ExecuteJobRequest.h index 6f4ce4125..4213b45b1 100644 --- a/schedulerx2/include/alibabacloud/schedulerx2/model/ExecuteJobRequest.h +++ b/schedulerx2/include/alibabacloud/schedulerx2/model/ExecuteJobRequest.h @@ -36,12 +36,18 @@ public: void setCheckJobStatus(bool checkJobStatus); std::string getGroupId() const; void setGroupId(const std::string &groupId); + std::string getLabel() const; + void setLabel(const std::string &label); + int getDesignateType() const; + void setDesignateType(int designateType); long getJobId() const; void setJobId(long jobId); std::string getRegionId() const; void setRegionId(const std::string ®ionId); std::string get_Namespace() const; void set_Namespace(const std::string &_namespace); + std::string getWorker() const; + void setWorker(const std::string &worker); std::string getInstanceParameters() const; void setInstanceParameters(const std::string &instanceParameters); @@ -49,9 +55,12 @@ private: std::string namespaceSource_; bool checkJobStatus_; std::string groupId_; + std::string label_; + int designateType_; long jobId_; std::string regionId_; std::string _namespace_; + std::string worker_; std::string instanceParameters_; }; } // namespace Model diff --git a/schedulerx2/include/alibabacloud/schedulerx2/model/GetWorkerListRequest.h b/schedulerx2/include/alibabacloud/schedulerx2/model/GetWorkerListRequest.h new file mode 100644 index 000000000..cbc405731 --- /dev/null +++ b/schedulerx2/include/alibabacloud/schedulerx2/model/GetWorkerListRequest.h @@ -0,0 +1,51 @@ +/* + * 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_SCHEDULERX2_MODEL_GETWORKERLISTREQUEST_H_ +#define ALIBABACLOUD_SCHEDULERX2_MODEL_GETWORKERLISTREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Schedulerx2 { +namespace Model { +class ALIBABACLOUD_SCHEDULERX2_EXPORT GetWorkerListRequest : public RpcServiceRequest { +public: + GetWorkerListRequest(); + ~GetWorkerListRequest(); + std::string getNamespaceSource() const; + void setNamespaceSource(const std::string &namespaceSource); + std::string getRegionId() const; + void setRegionId(const std::string ®ionId); + std::string getGroupId() const; + void setGroupId(const std::string &groupId); + std::string get_Namespace() const; + void set_Namespace(const std::string &_namespace); + +private: + std::string namespaceSource_; + std::string regionId_; + std::string groupId_; + std::string _namespace_; +}; +} // namespace Model +} // namespace Schedulerx2 +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_SCHEDULERX2_MODEL_GETWORKERLISTREQUEST_H_ diff --git a/schedulerx2/include/alibabacloud/schedulerx2/model/GetWorkerListResult.h b/schedulerx2/include/alibabacloud/schedulerx2/model/GetWorkerListResult.h new file mode 100644 index 000000000..d551ef9d4 --- /dev/null +++ b/schedulerx2/include/alibabacloud/schedulerx2/model/GetWorkerListResult.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_SCHEDULERX2_MODEL_GETWORKERLISTRESULT_H_ +#define ALIBABACLOUD_SCHEDULERX2_MODEL_GETWORKERLISTRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Schedulerx2 + { + namespace Model + { + class ALIBABACLOUD_SCHEDULERX2_EXPORT GetWorkerListResult : public ServiceResult + { + public: + struct Data + { + struct WorkerInfo + { + std::string version; + std::string ip; + int port; + std::string label; + std::string workerAddress; + std::string starter; + }; + std::vector workerInfos; + }; + + + GetWorkerListResult(); + explicit GetWorkerListResult(const std::string &payload); + ~GetWorkerListResult(); + std::string getMessage()const; + Data getData()const; + int getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + int code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_SCHEDULERX2_MODEL_GETWORKERLISTRESULT_H_ \ No newline at end of file diff --git a/schedulerx2/src/Schedulerx2Client.cc b/schedulerx2/src/Schedulerx2Client.cc index 3c6b31d1d..cd9264f7d 100644 --- a/schedulerx2/src/Schedulerx2Client.cc +++ b/schedulerx2/src/Schedulerx2Client.cc @@ -735,6 +735,42 @@ Schedulerx2Client::GetWorkFlowOutcomeCallable Schedulerx2Client::getWorkFlowCall return task->get_future(); } +Schedulerx2Client::GetWorkerListOutcome Schedulerx2Client::getWorkerList(const GetWorkerListRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetWorkerListOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetWorkerListOutcome(GetWorkerListResult(outcome.result())); + else + return GetWorkerListOutcome(outcome.error()); +} + +void Schedulerx2Client::getWorkerListAsync(const GetWorkerListRequest& request, const GetWorkerListAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getWorkerList(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Schedulerx2Client::GetWorkerListOutcomeCallable Schedulerx2Client::getWorkerListCallable(const GetWorkerListRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getWorkerList(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + Schedulerx2Client::GrantPermissionOutcome Schedulerx2Client::grantPermission(const GrantPermissionRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/schedulerx2/src/model/ExecuteJobRequest.cc b/schedulerx2/src/model/ExecuteJobRequest.cc index 6899f3135..25b43fcd3 100644 --- a/schedulerx2/src/model/ExecuteJobRequest.cc +++ b/schedulerx2/src/model/ExecuteJobRequest.cc @@ -52,6 +52,24 @@ void ExecuteJobRequest::setGroupId(const std::string &groupId) { setParameter(std::string("GroupId"), groupId); } +std::string ExecuteJobRequest::getLabel() const { + return label_; +} + +void ExecuteJobRequest::setLabel(const std::string &label) { + label_ = label; + setParameter(std::string("Label"), label); +} + +int ExecuteJobRequest::getDesignateType() const { + return designateType_; +} + +void ExecuteJobRequest::setDesignateType(int designateType) { + designateType_ = designateType; + setParameter(std::string("DesignateType"), std::to_string(designateType)); +} + long ExecuteJobRequest::getJobId() const { return jobId_; } @@ -79,6 +97,15 @@ void ExecuteJobRequest::set_Namespace(const std::string &_namespace) { setParameter(std::string("Namespace"), _namespace); } +std::string ExecuteJobRequest::getWorker() const { + return worker_; +} + +void ExecuteJobRequest::setWorker(const std::string &worker) { + worker_ = worker; + setParameter(std::string("Worker"), worker); +} + std::string ExecuteJobRequest::getInstanceParameters() const { return instanceParameters_; } diff --git a/schedulerx2/src/model/GetWorkerListRequest.cc b/schedulerx2/src/model/GetWorkerListRequest.cc new file mode 100644 index 000000000..8de3d3573 --- /dev/null +++ b/schedulerx2/src/model/GetWorkerListRequest.cc @@ -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. + */ + +#include + +using AlibabaCloud::Schedulerx2::Model::GetWorkerListRequest; + +GetWorkerListRequest::GetWorkerListRequest() + : RpcServiceRequest("schedulerx2", "2019-04-30", "GetWorkerList") { + setMethod(HttpRequest::Method::Get); +} + +GetWorkerListRequest::~GetWorkerListRequest() {} + +std::string GetWorkerListRequest::getNamespaceSource() const { + return namespaceSource_; +} + +void GetWorkerListRequest::setNamespaceSource(const std::string &namespaceSource) { + namespaceSource_ = namespaceSource; + setParameter(std::string("NamespaceSource"), namespaceSource); +} + +std::string GetWorkerListRequest::getRegionId() const { + return regionId_; +} + +void GetWorkerListRequest::setRegionId(const std::string ®ionId) { + regionId_ = regionId; + setParameter(std::string("RegionId"), regionId); +} + +std::string GetWorkerListRequest::getGroupId() const { + return groupId_; +} + +void GetWorkerListRequest::setGroupId(const std::string &groupId) { + groupId_ = groupId; + setParameter(std::string("GroupId"), groupId); +} + +std::string GetWorkerListRequest::get_Namespace() const { + return _namespace_; +} + +void GetWorkerListRequest::set_Namespace(const std::string &_namespace) { + _namespace_ = _namespace; + setParameter(std::string("Namespace"), _namespace); +} + diff --git a/schedulerx2/src/model/GetWorkerListResult.cc b/schedulerx2/src/model/GetWorkerListResult.cc new file mode 100644 index 000000000..0e09533c4 --- /dev/null +++ b/schedulerx2/src/model/GetWorkerListResult.cc @@ -0,0 +1,89 @@ +/* + * 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::Schedulerx2; +using namespace AlibabaCloud::Schedulerx2::Model; + +GetWorkerListResult::GetWorkerListResult() : + ServiceResult() +{} + +GetWorkerListResult::GetWorkerListResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetWorkerListResult::~GetWorkerListResult() +{} + +void GetWorkerListResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + auto allWorkerInfosNode = dataNode["WorkerInfos"]["WorkerInfo"]; + for (auto dataNodeWorkerInfosWorkerInfo : allWorkerInfosNode) + { + Data::WorkerInfo workerInfoObject; + if(!dataNodeWorkerInfosWorkerInfo["Ip"].isNull()) + workerInfoObject.ip = dataNodeWorkerInfosWorkerInfo["Ip"].asString(); + if(!dataNodeWorkerInfosWorkerInfo["Port"].isNull()) + workerInfoObject.port = std::stoi(dataNodeWorkerInfosWorkerInfo["Port"].asString()); + if(!dataNodeWorkerInfosWorkerInfo["WorkerAddress"].isNull()) + workerInfoObject.workerAddress = dataNodeWorkerInfosWorkerInfo["WorkerAddress"].asString(); + if(!dataNodeWorkerInfosWorkerInfo["Label"].isNull()) + workerInfoObject.label = dataNodeWorkerInfosWorkerInfo["Label"].asString(); + if(!dataNodeWorkerInfosWorkerInfo["Version"].isNull()) + workerInfoObject.version = dataNodeWorkerInfosWorkerInfo["Version"].asString(); + if(!dataNodeWorkerInfosWorkerInfo["Starter"].isNull()) + workerInfoObject.starter = dataNodeWorkerInfosWorkerInfo["Starter"].asString(); + data_.workerInfos.push_back(workerInfoObject); + } + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + +} + +std::string GetWorkerListResult::getMessage()const +{ + return message_; +} + +GetWorkerListResult::Data GetWorkerListResult::getData()const +{ + return data_; +} + +int GetWorkerListResult::getCode()const +{ + return code_; +} + +bool GetWorkerListResult::getSuccess()const +{ + return success_; +} +