diff --git a/CHANGELOG b/CHANGELOG index f5a0cbfae..e78dc3c1b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +2022-03-21 Version: 1.36.1087 +- Get Job Support Query By Job Name. +- Add Api Create Namespace. +- Create App Support Set User Defined App Key. + 2022-03-18 Version: 1.36.1086 - Supported CreateStandardGroup, ListStandardGroups API. diff --git a/VERSION b/VERSION index 172313587..f159a573a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1086 \ No newline at end of file +1.36.1087 \ No newline at end of file diff --git a/schedulerx2/CMakeLists.txt b/schedulerx2/CMakeLists.txt index f640a831d..a2798ea90 100644 --- a/schedulerx2/CMakeLists.txt +++ b/schedulerx2/CMakeLists.txt @@ -31,6 +31,8 @@ set(schedulerx2_public_header_model include/alibabacloud/schedulerx2/model/CreateAppGroupResult.h include/alibabacloud/schedulerx2/model/CreateJobRequest.h include/alibabacloud/schedulerx2/model/CreateJobResult.h + include/alibabacloud/schedulerx2/model/CreateNamespaceRequest.h + include/alibabacloud/schedulerx2/model/CreateNamespaceResult.h include/alibabacloud/schedulerx2/model/DeleteJobRequest.h include/alibabacloud/schedulerx2/model/DeleteJobResult.h include/alibabacloud/schedulerx2/model/DeleteWorkflowRequest.h @@ -88,6 +90,8 @@ set(schedulerx2_src src/model/CreateAppGroupResult.cc src/model/CreateJobRequest.cc src/model/CreateJobResult.cc + src/model/CreateNamespaceRequest.cc + src/model/CreateNamespaceResult.cc src/model/DeleteJobRequest.cc src/model/DeleteJobResult.cc src/model/DeleteWorkflowRequest.cc diff --git a/schedulerx2/include/alibabacloud/schedulerx2/Schedulerx2Client.h b/schedulerx2/include/alibabacloud/schedulerx2/Schedulerx2Client.h index 570f910a1..3d1e62e30 100644 --- a/schedulerx2/include/alibabacloud/schedulerx2/Schedulerx2Client.h +++ b/schedulerx2/include/alibabacloud/schedulerx2/Schedulerx2Client.h @@ -32,6 +32,8 @@ #include "model/CreateAppGroupResult.h" #include "model/CreateJobRequest.h" #include "model/CreateJobResult.h" +#include "model/CreateNamespaceRequest.h" +#include "model/CreateNamespaceResult.h" #include "model/DeleteJobRequest.h" #include "model/DeleteJobResult.h" #include "model/DeleteWorkflowRequest.h" @@ -100,6 +102,9 @@ namespace AlibabaCloud typedef Outcome CreateJobOutcome; typedef std::future CreateJobOutcomeCallable; typedef std::function&)> CreateJobAsyncHandler; + typedef Outcome CreateNamespaceOutcome; + typedef std::future CreateNamespaceOutcomeCallable; + typedef std::function&)> CreateNamespaceAsyncHandler; typedef Outcome DeleteJobOutcome; typedef std::future DeleteJobOutcomeCallable; typedef std::function&)> DeleteJobAsyncHandler; @@ -186,6 +191,9 @@ namespace AlibabaCloud CreateJobOutcome createJob(const Model::CreateJobRequest &request)const; void createJobAsync(const Model::CreateJobRequest& request, const CreateJobAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; CreateJobOutcomeCallable createJobCallable(const Model::CreateJobRequest& request) const; + CreateNamespaceOutcome createNamespace(const Model::CreateNamespaceRequest &request)const; + void createNamespaceAsync(const Model::CreateNamespaceRequest& request, const CreateNamespaceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + CreateNamespaceOutcomeCallable createNamespaceCallable(const Model::CreateNamespaceRequest& request) const; DeleteJobOutcome deleteJob(const Model::DeleteJobRequest &request)const; void deleteJobAsync(const Model::DeleteJobRequest& request, const DeleteJobAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DeleteJobOutcomeCallable deleteJobCallable(const Model::DeleteJobRequest& request) const; diff --git a/schedulerx2/include/alibabacloud/schedulerx2/model/CreateAppGroupRequest.h b/schedulerx2/include/alibabacloud/schedulerx2/model/CreateAppGroupRequest.h index 4c35d1bb0..4348fc71a 100644 --- a/schedulerx2/include/alibabacloud/schedulerx2/model/CreateAppGroupRequest.h +++ b/schedulerx2/include/alibabacloud/schedulerx2/model/CreateAppGroupRequest.h @@ -42,6 +42,8 @@ public: void setGroupId(const std::string &groupId); std::string getDescription() const; void setDescription(const std::string &description); + std::string getMonitorConfigJson() const; + void setMonitorConfigJson(const std::string &monitorConfigJson); std::string getAppName() const; void setAppName(const std::string &appName); std::string getRegionId() const; @@ -50,6 +52,10 @@ public: void set_Namespace(const std::string &_namespace); std::string getAlarmJson() const; void setAlarmJson(const std::string &alarmJson); + std::string getAppKey() const; + void setAppKey(const std::string &appKey); + std::string getMonitorContactsJson() const; + void setMonitorContactsJson(const std::string &monitorContactsJson); private: int maxJobs_; @@ -58,10 +64,13 @@ private: std::string metricsThresholdJson_; std::string groupId_; std::string description_; + std::string monitorConfigJson_; std::string appName_; std::string regionId_; std::string _namespace_; std::string alarmJson_; + std::string appKey_; + std::string monitorContactsJson_; }; } // namespace Model } // namespace Schedulerx2 diff --git a/schedulerx2/include/alibabacloud/schedulerx2/model/CreateAppGroupResult.h b/schedulerx2/include/alibabacloud/schedulerx2/model/CreateAppGroupResult.h index c4cb6b4c1..b4c0bc9aa 100644 --- a/schedulerx2/include/alibabacloud/schedulerx2/model/CreateAppGroupResult.h +++ b/schedulerx2/include/alibabacloud/schedulerx2/model/CreateAppGroupResult.h @@ -35,6 +35,7 @@ namespace AlibabaCloud struct Data { long appGroupId; + std::string appKey; }; diff --git a/schedulerx2/include/alibabacloud/schedulerx2/model/CreateNamespaceRequest.h b/schedulerx2/include/alibabacloud/schedulerx2/model/CreateNamespaceRequest.h new file mode 100644 index 000000000..52343059e --- /dev/null +++ b/schedulerx2/include/alibabacloud/schedulerx2/model/CreateNamespaceRequest.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_CREATENAMESPACEREQUEST_H_ +#define ALIBABACLOUD_SCHEDULERX2_MODEL_CREATENAMESPACEREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Schedulerx2 { +namespace Model { +class ALIBABACLOUD_SCHEDULERX2_EXPORT CreateNamespaceRequest : public RpcServiceRequest { +public: + CreateNamespaceRequest(); + ~CreateNamespaceRequest(); + std::string getUid() const; + void setUid(const std::string &uid); + std::string getRegionId() const; + void setRegionId(const std::string ®ionId); + std::string getName() const; + void setName(const std::string &name); + std::string getDescription() const; + void setDescription(const std::string &description); + +private: + std::string uid_; + std::string regionId_; + std::string name_; + std::string description_; +}; +} // namespace Model +} // namespace Schedulerx2 +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_SCHEDULERX2_MODEL_CREATENAMESPACEREQUEST_H_ diff --git a/schedulerx2/include/alibabacloud/schedulerx2/model/CreateNamespaceResult.h b/schedulerx2/include/alibabacloud/schedulerx2/model/CreateNamespaceResult.h new file mode 100644 index 000000000..ac2fbde85 --- /dev/null +++ b/schedulerx2/include/alibabacloud/schedulerx2/model/CreateNamespaceResult.h @@ -0,0 +1,61 @@ +/* + * 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_CREATENAMESPACERESULT_H_ +#define ALIBABACLOUD_SCHEDULERX2_MODEL_CREATENAMESPACERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Schedulerx2 + { + namespace Model + { + class ALIBABACLOUD_SCHEDULERX2_EXPORT CreateNamespaceResult : public ServiceResult + { + public: + struct Data + { + std::string namespaceUid; + }; + + + CreateNamespaceResult(); + explicit CreateNamespaceResult(const std::string &payload); + ~CreateNamespaceResult(); + 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_CREATENAMESPACERESULT_H_ \ No newline at end of file diff --git a/schedulerx2/include/alibabacloud/schedulerx2/model/GetJobInfoRequest.h b/schedulerx2/include/alibabacloud/schedulerx2/model/GetJobInfoRequest.h index 421c0fbe8..bdbfb289d 100644 --- a/schedulerx2/include/alibabacloud/schedulerx2/model/GetJobInfoRequest.h +++ b/schedulerx2/include/alibabacloud/schedulerx2/model/GetJobInfoRequest.h @@ -40,6 +40,8 @@ public: void setRegionId(const std::string ®ionId); std::string get_Namespace() const; void set_Namespace(const std::string &_namespace); + std::string getJobName() const; + void setJobName(const std::string &jobName); private: std::string namespaceSource_; @@ -47,6 +49,7 @@ private: long jobId_; std::string regionId_; std::string _namespace_; + std::string jobName_; }; } // namespace Model } // namespace Schedulerx2 diff --git a/schedulerx2/include/alibabacloud/schedulerx2/model/GetJobInfoResult.h b/schedulerx2/include/alibabacloud/schedulerx2/model/GetJobInfoResult.h index 7e0bc84ae..7b816a5b2 100644 --- a/schedulerx2/include/alibabacloud/schedulerx2/model/GetJobInfoResult.h +++ b/schedulerx2/include/alibabacloud/schedulerx2/model/GetJobInfoResult.h @@ -87,6 +87,7 @@ namespace AlibabaCloud std::string className; int attemptInterval; std::string executeMode; + long jobId; }; JobConfigInfo jobConfigInfo; }; diff --git a/schedulerx2/src/Schedulerx2Client.cc b/schedulerx2/src/Schedulerx2Client.cc index cd9264f7d..60ad6d362 100644 --- a/schedulerx2/src/Schedulerx2Client.cc +++ b/schedulerx2/src/Schedulerx2Client.cc @@ -231,6 +231,42 @@ Schedulerx2Client::CreateJobOutcomeCallable Schedulerx2Client::createJobCallable return task->get_future(); } +Schedulerx2Client::CreateNamespaceOutcome Schedulerx2Client::createNamespace(const CreateNamespaceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return CreateNamespaceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return CreateNamespaceOutcome(CreateNamespaceResult(outcome.result())); + else + return CreateNamespaceOutcome(outcome.error()); +} + +void Schedulerx2Client::createNamespaceAsync(const CreateNamespaceRequest& request, const CreateNamespaceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, createNamespace(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Schedulerx2Client::CreateNamespaceOutcomeCallable Schedulerx2Client::createNamespaceCallable(const CreateNamespaceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->createNamespace(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + Schedulerx2Client::DeleteJobOutcome Schedulerx2Client::deleteJob(const DeleteJobRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/schedulerx2/src/model/CreateAppGroupRequest.cc b/schedulerx2/src/model/CreateAppGroupRequest.cc index f5e4ff4e2..66ed621c5 100644 --- a/schedulerx2/src/model/CreateAppGroupRequest.cc +++ b/schedulerx2/src/model/CreateAppGroupRequest.cc @@ -79,6 +79,15 @@ void CreateAppGroupRequest::setDescription(const std::string &description) { setParameter(std::string("Description"), description); } +std::string CreateAppGroupRequest::getMonitorConfigJson() const { + return monitorConfigJson_; +} + +void CreateAppGroupRequest::setMonitorConfigJson(const std::string &monitorConfigJson) { + monitorConfigJson_ = monitorConfigJson; + setParameter(std::string("MonitorConfigJson"), monitorConfigJson); +} + std::string CreateAppGroupRequest::getAppName() const { return appName_; } @@ -115,3 +124,21 @@ void CreateAppGroupRequest::setAlarmJson(const std::string &alarmJson) { setParameter(std::string("AlarmJson"), alarmJson); } +std::string CreateAppGroupRequest::getAppKey() const { + return appKey_; +} + +void CreateAppGroupRequest::setAppKey(const std::string &appKey) { + appKey_ = appKey; + setParameter(std::string("AppKey"), appKey); +} + +std::string CreateAppGroupRequest::getMonitorContactsJson() const { + return monitorContactsJson_; +} + +void CreateAppGroupRequest::setMonitorContactsJson(const std::string &monitorContactsJson) { + monitorContactsJson_ = monitorContactsJson; + setParameter(std::string("MonitorContactsJson"), monitorContactsJson); +} + diff --git a/schedulerx2/src/model/CreateAppGroupResult.cc b/schedulerx2/src/model/CreateAppGroupResult.cc index f545da925..3d2354195 100644 --- a/schedulerx2/src/model/CreateAppGroupResult.cc +++ b/schedulerx2/src/model/CreateAppGroupResult.cc @@ -42,6 +42,8 @@ void CreateAppGroupResult::parse(const std::string &payload) auto dataNode = value["Data"]; if(!dataNode["AppGroupId"].isNull()) data_.appGroupId = std::stol(dataNode["AppGroupId"].asString()); + if(!dataNode["AppKey"].isNull()) + data_.appKey = dataNode["AppKey"].asString(); if(!value["Code"].isNull()) code_ = std::stoi(value["Code"].asString()); if(!value["Message"].isNull()) diff --git a/schedulerx2/src/model/CreateNamespaceRequest.cc b/schedulerx2/src/model/CreateNamespaceRequest.cc new file mode 100644 index 000000000..9ae77a3cd --- /dev/null +++ b/schedulerx2/src/model/CreateNamespaceRequest.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::CreateNamespaceRequest; + +CreateNamespaceRequest::CreateNamespaceRequest() + : RpcServiceRequest("schedulerx2", "2019-04-30", "CreateNamespace") { + setMethod(HttpRequest::Method::Post); +} + +CreateNamespaceRequest::~CreateNamespaceRequest() {} + +std::string CreateNamespaceRequest::getUid() const { + return uid_; +} + +void CreateNamespaceRequest::setUid(const std::string &uid) { + uid_ = uid; + setParameter(std::string("Uid"), uid); +} + +std::string CreateNamespaceRequest::getRegionId() const { + return regionId_; +} + +void CreateNamespaceRequest::setRegionId(const std::string ®ionId) { + regionId_ = regionId; + setParameter(std::string("RegionId"), regionId); +} + +std::string CreateNamespaceRequest::getName() const { + return name_; +} + +void CreateNamespaceRequest::setName(const std::string &name) { + name_ = name; + setParameter(std::string("Name"), name); +} + +std::string CreateNamespaceRequest::getDescription() const { + return description_; +} + +void CreateNamespaceRequest::setDescription(const std::string &description) { + description_ = description; + setParameter(std::string("Description"), description); +} + diff --git a/schedulerx2/src/model/CreateNamespaceResult.cc b/schedulerx2/src/model/CreateNamespaceResult.cc new file mode 100644 index 000000000..7aa941b82 --- /dev/null +++ b/schedulerx2/src/model/CreateNamespaceResult.cc @@ -0,0 +1,73 @@ +/* + * 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; + +CreateNamespaceResult::CreateNamespaceResult() : + ServiceResult() +{} + +CreateNamespaceResult::CreateNamespaceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +CreateNamespaceResult::~CreateNamespaceResult() +{} + +void CreateNamespaceResult::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["NamespaceUid"].isNull()) + data_.namespaceUid = dataNode["NamespaceUid"].asString(); + 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 CreateNamespaceResult::getMessage()const +{ + return message_; +} + +CreateNamespaceResult::Data CreateNamespaceResult::getData()const +{ + return data_; +} + +int CreateNamespaceResult::getCode()const +{ + return code_; +} + +bool CreateNamespaceResult::getSuccess()const +{ + return success_; +} + diff --git a/schedulerx2/src/model/GetJobInfoRequest.cc b/schedulerx2/src/model/GetJobInfoRequest.cc index 77469310b..9c81d080e 100644 --- a/schedulerx2/src/model/GetJobInfoRequest.cc +++ b/schedulerx2/src/model/GetJobInfoRequest.cc @@ -70,3 +70,12 @@ void GetJobInfoRequest::set_Namespace(const std::string &_namespace) { setParameter(std::string("Namespace"), _namespace); } +std::string GetJobInfoRequest::getJobName() const { + return jobName_; +} + +void GetJobInfoRequest::setJobName(const std::string &jobName) { + jobName_ = jobName; + setParameter(std::string("JobName"), jobName); +} + diff --git a/schedulerx2/src/model/GetJobInfoResult.cc b/schedulerx2/src/model/GetJobInfoResult.cc index 764d3cfb5..58ca83102 100644 --- a/schedulerx2/src/model/GetJobInfoResult.cc +++ b/schedulerx2/src/model/GetJobInfoResult.cc @@ -41,6 +41,8 @@ void GetJobInfoResult::parse(const std::string &payload) setRequestId(value["RequestId"].asString()); auto dataNode = value["Data"]; auto jobConfigInfoNode = dataNode["JobConfigInfo"]; + if(!jobConfigInfoNode["JobId"].isNull()) + data_.jobConfigInfo.jobId = std::stol(jobConfigInfoNode["JobId"].asString()); if(!jobConfigInfoNode["Status"].isNull()) data_.jobConfigInfo.status = std::stoi(jobConfigInfoNode["Status"].asString()); if(!jobConfigInfoNode["Parameters"].isNull())