Supported Get Worker List.
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<Error, Model::GetWorkFlowResult> GetWorkFlowOutcome;
|
||||
typedef std::future<GetWorkFlowOutcome> GetWorkFlowOutcomeCallable;
|
||||
typedef std::function<void(const Schedulerx2Client*, const Model::GetWorkFlowRequest&, const GetWorkFlowOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetWorkFlowAsyncHandler;
|
||||
typedef Outcome<Error, Model::GetWorkerListResult> GetWorkerListOutcome;
|
||||
typedef std::future<GetWorkerListOutcome> GetWorkerListOutcomeCallable;
|
||||
typedef std::function<void(const Schedulerx2Client*, const Model::GetWorkerListRequest&, const GetWorkerListOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetWorkerListAsyncHandler;
|
||||
typedef Outcome<Error, Model::GrantPermissionResult> GrantPermissionOutcome;
|
||||
typedef std::future<GrantPermissionOutcome> GrantPermissionOutcomeCallable;
|
||||
typedef std::function<void(const Schedulerx2Client*, const Model::GrantPermissionRequest&, const GrantPermissionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& context = nullptr) const;
|
||||
GrantPermissionOutcomeCallable grantPermissionCallable(const Model::GrantPermissionRequest& request) const;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <alibabacloud/schedulerx2/Schedulerx2Export.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
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_
|
||||
@@ -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 <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/schedulerx2/Schedulerx2Export.h>
|
||||
|
||||
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<WorkerInfo> 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_
|
||||
@@ -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<const AsyncCallerContext>& 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<std::packaged_task<GetWorkerListOutcome()>>(
|
||||
[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();
|
||||
|
||||
@@ -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_;
|
||||
}
|
||||
|
||||
63
schedulerx2/src/model/GetWorkerListRequest.cc
Normal file
63
schedulerx2/src/model/GetWorkerListRequest.cc
Normal 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.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/schedulerx2/model/GetWorkerListRequest.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
89
schedulerx2/src/model/GetWorkerListResult.cc
Normal file
89
schedulerx2/src/model/GetWorkerListResult.cc
Normal file
@@ -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 <alibabacloud/schedulerx2/model/GetWorkerListResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user