sdk-team 6 роки тому
батько
коміт
e4502cf36b

+ 4 - 0
CHANGELOG

@@ -1,3 +1,7 @@
+2020-08-17 Version: 1.36.593
+- Add GetTrace api.
+- Edit Aler api.
+
 2020-08-17 Version: 1.36.592
 - Add pipeline status api.
 

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.36.592
+1.36.593

+ 4 - 0
arms/CMakeLists.txt

@@ -63,6 +63,8 @@ set(arms_public_header_model
 	include/alibabacloud/arms/model/GetStackResult.h
 	include/alibabacloud/arms/model/GetTraceRequest.h
 	include/alibabacloud/arms/model/GetTraceResult.h
+	include/alibabacloud/arms/model/GetTraceAppRequest.h
+	include/alibabacloud/arms/model/GetTraceAppResult.h
 	include/alibabacloud/arms/model/ImportAppAlertRulesRequest.h
 	include/alibabacloud/arms/model/ImportAppAlertRulesResult.h
 	include/alibabacloud/arms/model/ImportCustomAlertRulesRequest.h
@@ -158,6 +160,8 @@ set(arms_src
 	src/model/GetStackResult.cc
 	src/model/GetTraceRequest.cc
 	src/model/GetTraceResult.cc
+	src/model/GetTraceAppRequest.cc
+	src/model/GetTraceAppResult.cc
 	src/model/ImportAppAlertRulesRequest.cc
 	src/model/ImportAppAlertRulesResult.cc
 	src/model/ImportCustomAlertRulesRequest.cc

+ 8 - 0
arms/include/alibabacloud/arms/ARMSClient.h

@@ -64,6 +64,8 @@
 #include "model/GetStackResult.h"
 #include "model/GetTraceRequest.h"
 #include "model/GetTraceResult.h"
+#include "model/GetTraceAppRequest.h"
+#include "model/GetTraceAppResult.h"
 #include "model/ImportAppAlertRulesRequest.h"
 #include "model/ImportAppAlertRulesResult.h"
 #include "model/ImportCustomAlertRulesRequest.h"
@@ -186,6 +188,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::GetTraceResult> GetTraceOutcome;
 			typedef std::future<GetTraceOutcome> GetTraceOutcomeCallable;
 			typedef std::function<void(const ARMSClient*, const Model::GetTraceRequest&, const GetTraceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetTraceAsyncHandler;
+			typedef Outcome<Error, Model::GetTraceAppResult> GetTraceAppOutcome;
+			typedef std::future<GetTraceAppOutcome> GetTraceAppOutcomeCallable;
+			typedef std::function<void(const ARMSClient*, const Model::GetTraceAppRequest&, const GetTraceAppOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetTraceAppAsyncHandler;
 			typedef Outcome<Error, Model::ImportAppAlertRulesResult> ImportAppAlertRulesOutcome;
 			typedef std::future<ImportAppAlertRulesOutcome> ImportAppAlertRulesOutcomeCallable;
 			typedef std::function<void(const ARMSClient*, const Model::ImportAppAlertRulesRequest&, const ImportAppAlertRulesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ImportAppAlertRulesAsyncHandler;
@@ -329,6 +334,9 @@ namespace AlibabaCloud
 			GetTraceOutcome getTrace(const Model::GetTraceRequest &request)const;
 			void getTraceAsync(const Model::GetTraceRequest& request, const GetTraceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			GetTraceOutcomeCallable getTraceCallable(const Model::GetTraceRequest& request) const;
+			GetTraceAppOutcome getTraceApp(const Model::GetTraceAppRequest &request)const;
+			void getTraceAppAsync(const Model::GetTraceAppRequest& request, const GetTraceAppAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			GetTraceAppOutcomeCallable getTraceAppCallable(const Model::GetTraceAppRequest& request) const;
 			ImportAppAlertRulesOutcome importAppAlertRules(const Model::ImportAppAlertRulesRequest &request)const;
 			void importAppAlertRulesAsync(const Model::ImportAppAlertRulesRequest& request, const ImportAppAlertRulesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			ImportAppAlertRulesOutcomeCallable importAppAlertRulesCallable(const Model::ImportAppAlertRulesRequest& request) const;

+ 51 - 0
arms/include/alibabacloud/arms/model/GetTraceAppRequest.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_ARMS_MODEL_GETTRACEAPPREQUEST_H_
+#define ALIBABACLOUD_ARMS_MODEL_GETTRACEAPPREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/arms/ARMSExport.h>
+
+namespace AlibabaCloud
+{
+	namespace ARMS
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_ARMS_EXPORT GetTraceAppRequest : public RpcServiceRequest
+			{
+
+			public:
+				GetTraceAppRequest();
+				~GetTraceAppRequest();
+
+				std::string getRegionId()const;
+				void setRegionId(const std::string& regionId);
+				std::string getPid()const;
+				void setPid(const std::string& pid);
+
+            private:
+				std::string regionId_;
+				std::string pid_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_ARMS_MODEL_GETTRACEAPPREQUEST_H_

+ 64 - 0
arms/include/alibabacloud/arms/model/GetTraceAppResult.h

@@ -0,0 +1,64 @@
+/*
+ * 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_ARMS_MODEL_GETTRACEAPPRESULT_H_
+#define ALIBABACLOUD_ARMS_MODEL_GETTRACEAPPRESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/arms/ARMSExport.h>
+
+namespace AlibabaCloud
+{
+	namespace ARMS
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_ARMS_EXPORT GetTraceAppResult : public ServiceResult
+			{
+			public:
+				struct TraceApp
+				{
+					std::string type;
+					long appId;
+					std::string userId;
+					long createTime;
+					long updateTime;
+					std::string pid;
+					bool show;
+					std::vector<std::string> labels;
+					std::string regionId;
+					std::string appName;
+				};
+
+
+				GetTraceAppResult();
+				explicit GetTraceAppResult(const std::string &payload);
+				~GetTraceAppResult();
+				TraceApp getTraceApp()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				TraceApp traceApp_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_ARMS_MODEL_GETTRACEAPPRESULT_H_

+ 6 - 3
arms/include/alibabacloud/arms/model/ImportCustomAlertRulesRequest.h

@@ -37,21 +37,24 @@ namespace AlibabaCloud
 
 				bool getIsAutoStart()const;
 				void setIsAutoStart(bool isAutoStart);
+				std::string getProxyUserId()const;
+				void setProxyUserId(const std::string& proxyUserId);
 				std::string getRegionId()const;
 				void setRegionId(const std::string& regionId);
 				std::string getContactGroupIds()const;
 				void setContactGroupIds(const std::string& contactGroupIds);
 				std::string getTemplateAlertConfig()const;
 				void setTemplateAlertConfig(const std::string& templateAlertConfig);
-				std::string getProxyUserId()const;
-				void setProxyUserId(const std::string& proxyUserId);
+				std::string getTemplageAlertConfig()const;
+				void setTemplageAlertConfig(const std::string& templageAlertConfig);
 
             private:
 				bool isAutoStart_;
+				std::string proxyUserId_;
 				std::string regionId_;
 				std::string contactGroupIds_;
 				std::string templateAlertConfig_;
-				std::string proxyUserId_;
+				std::string templageAlertConfig_;
 
 			};
 		}

+ 13 - 0
arms/include/alibabacloud/arms/model/SearchAlertContactGroupResult.h

@@ -34,7 +34,20 @@ namespace AlibabaCloud
 			public:
 				struct ContactGroup
 				{
+					struct Contact
+					{
+						std::string email;
+						std::string phone;
+						std::string userId;
+						long createTime;
+						long updateTime;
+						long contactId;
+						std::string dingRobot;
+						std::string contactName;
+						bool systemNoc;
+					};
 					long contactGroupId;
+					std::vector<ContactGroup::Contact> contacts;
 					std::string contactGroupName;
 					std::string userId;
 					long createTime;

+ 1 - 1
arms/include/alibabacloud/arms/model/SearchEventsResult.h

@@ -37,7 +37,7 @@ namespace AlibabaCloud
 					struct EventItem
 					{
 						int alertType;
-						int eventLevel;
+						std::string eventLevel;
 						long alertId;
 						std::string alertName;
 						std::string message;

+ 36 - 0
arms/src/ARMSClient.cc

@@ -807,6 +807,42 @@ ARMSClient::GetTraceOutcomeCallable ARMSClient::getTraceCallable(const GetTraceR
 	return task->get_future();
 }
 
+ARMSClient::GetTraceAppOutcome ARMSClient::getTraceApp(const GetTraceAppRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return GetTraceAppOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return GetTraceAppOutcome(GetTraceAppResult(outcome.result()));
+	else
+		return GetTraceAppOutcome(outcome.error());
+}
+
+void ARMSClient::getTraceAppAsync(const GetTraceAppRequest& request, const GetTraceAppAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, getTraceApp(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+ARMSClient::GetTraceAppOutcomeCallable ARMSClient::getTraceAppCallable(const GetTraceAppRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<GetTraceAppOutcome()>>(
+			[this, request]()
+			{
+			return this->getTraceApp(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 ARMSClient::ImportAppAlertRulesOutcome ARMSClient::importAppAlertRules(const ImportAppAlertRulesRequest &request) const
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 51 - 0
arms/src/model/GetTraceAppRequest.cc

@@ -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.
+ */
+
+#include <alibabacloud/arms/model/GetTraceAppRequest.h>
+
+using AlibabaCloud::ARMS::Model::GetTraceAppRequest;
+
+GetTraceAppRequest::GetTraceAppRequest() :
+	RpcServiceRequest("arms", "2019-08-08", "GetTraceApp")
+{
+	setMethod(HttpRequest::Method::Post);
+}
+
+GetTraceAppRequest::~GetTraceAppRequest()
+{}
+
+std::string GetTraceAppRequest::getRegionId()const
+{
+	return regionId_;
+}
+
+void GetTraceAppRequest::setRegionId(const std::string& regionId)
+{
+	regionId_ = regionId;
+	setParameter("RegionId", regionId);
+}
+
+std::string GetTraceAppRequest::getPid()const
+{
+	return pid_;
+}
+
+void GetTraceAppRequest::setPid(const std::string& pid)
+{
+	pid_ = pid;
+	setParameter("Pid", pid);
+}
+

+ 71 - 0
arms/src/model/GetTraceAppResult.cc

@@ -0,0 +1,71 @@
+/*
+ * 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/arms/model/GetTraceAppResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::ARMS;
+using namespace AlibabaCloud::ARMS::Model;
+
+GetTraceAppResult::GetTraceAppResult() :
+	ServiceResult()
+{}
+
+GetTraceAppResult::GetTraceAppResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+GetTraceAppResult::~GetTraceAppResult()
+{}
+
+void GetTraceAppResult::parse(const std::string &payload)
+{
+	Json::Reader reader;
+	Json::Value value;
+	reader.parse(payload, value);
+	setRequestId(value["RequestId"].asString());
+	auto traceAppNode = value["TraceApp"];
+	if(!traceAppNode["AppId"].isNull())
+		traceApp_.appId = std::stol(traceAppNode["AppId"].asString());
+	if(!traceAppNode["Pid"].isNull())
+		traceApp_.pid = traceAppNode["Pid"].asString();
+	if(!traceAppNode["AppName"].isNull())
+		traceApp_.appName = traceAppNode["AppName"].asString();
+	if(!traceAppNode["Type"].isNull())
+		traceApp_.type = traceAppNode["Type"].asString();
+	if(!traceAppNode["UserId"].isNull())
+		traceApp_.userId = traceAppNode["UserId"].asString();
+	if(!traceAppNode["RegionId"].isNull())
+		traceApp_.regionId = traceAppNode["RegionId"].asString();
+	if(!traceAppNode["CreateTime"].isNull())
+		traceApp_.createTime = std::stol(traceAppNode["CreateTime"].asString());
+	if(!traceAppNode["UpdateTime"].isNull())
+		traceApp_.updateTime = std::stol(traceAppNode["UpdateTime"].asString());
+	if(!traceAppNode["Show"].isNull())
+		traceApp_.show = traceAppNode["Show"].asString() == "true";
+		auto allLabels = traceAppNode["Labels"]["Labels"];
+		for (auto value : allLabels)
+			traceApp_.labels.push_back(value.asString());
+
+}
+
+GetTraceAppResult::TraceApp GetTraceAppResult::getTraceApp()const
+{
+	return traceApp_;
+}
+

+ 16 - 5
arms/src/model/ImportCustomAlertRulesRequest.cc

@@ -38,6 +38,17 @@ void ImportCustomAlertRulesRequest::setIsAutoStart(bool isAutoStart)
 	setParameter("IsAutoStart", isAutoStart ? "true" : "false");
 }
 
+std::string ImportCustomAlertRulesRequest::getProxyUserId()const
+{
+	return proxyUserId_;
+}
+
+void ImportCustomAlertRulesRequest::setProxyUserId(const std::string& proxyUserId)
+{
+	proxyUserId_ = proxyUserId;
+	setParameter("ProxyUserId", proxyUserId);
+}
+
 std::string ImportCustomAlertRulesRequest::getRegionId()const
 {
 	return regionId_;
@@ -71,14 +82,14 @@ void ImportCustomAlertRulesRequest::setTemplateAlertConfig(const std::string& te
 	setParameter("TemplateAlertConfig", templateAlertConfig);
 }
 
-std::string ImportCustomAlertRulesRequest::getProxyUserId()const
+std::string ImportCustomAlertRulesRequest::getTemplageAlertConfig()const
 {
-	return proxyUserId_;
+	return templageAlertConfig_;
 }
 
-void ImportCustomAlertRulesRequest::setProxyUserId(const std::string& proxyUserId)
+void ImportCustomAlertRulesRequest::setTemplageAlertConfig(const std::string& templageAlertConfig)
 {
-	proxyUserId_ = proxyUserId;
-	setParameter("ProxyUserId", proxyUserId);
+	templageAlertConfig_ = templageAlertConfig;
+	setParameter("TemplageAlertConfig", templageAlertConfig);
 }
 

+ 24 - 0
arms/src/model/SearchAlertContactGroupResult.cc

@@ -53,6 +53,30 @@ void SearchAlertContactGroupResult::parse(const std::string &payload)
 			contactGroupsObject.createTime = std::stol(valueContactGroupsContactGroup["CreateTime"].asString());
 		if(!valueContactGroupsContactGroup["UpdateTime"].isNull())
 			contactGroupsObject.updateTime = std::stol(valueContactGroupsContactGroup["UpdateTime"].asString());
+		auto allContactsNode = allContactGroupsNode["Contacts"]["Contact"];
+		for (auto allContactGroupsNodeContactsContact : allContactsNode)
+		{
+			ContactGroup::Contact contactsObject;
+			if(!allContactGroupsNodeContactsContact["ContactId"].isNull())
+				contactsObject.contactId = std::stol(allContactGroupsNodeContactsContact["ContactId"].asString());
+			if(!allContactGroupsNodeContactsContact["ContactName"].isNull())
+				contactsObject.contactName = allContactGroupsNodeContactsContact["ContactName"].asString();
+			if(!allContactGroupsNodeContactsContact["Phone"].isNull())
+				contactsObject.phone = allContactGroupsNodeContactsContact["Phone"].asString();
+			if(!allContactGroupsNodeContactsContact["Email"].isNull())
+				contactsObject.email = allContactGroupsNodeContactsContact["Email"].asString();
+			if(!allContactGroupsNodeContactsContact["UserId"].isNull())
+				contactsObject.userId = allContactGroupsNodeContactsContact["UserId"].asString();
+			if(!allContactGroupsNodeContactsContact["DingRobot"].isNull())
+				contactsObject.dingRobot = allContactGroupsNodeContactsContact["DingRobot"].asString();
+			if(!allContactGroupsNodeContactsContact["CreateTime"].isNull())
+				contactsObject.createTime = std::stol(allContactGroupsNodeContactsContact["CreateTime"].asString());
+			if(!allContactGroupsNodeContactsContact["UpdateTime"].isNull())
+				contactsObject.updateTime = std::stol(allContactGroupsNodeContactsContact["UpdateTime"].asString());
+			if(!allContactGroupsNodeContactsContact["SystemNoc"].isNull())
+				contactsObject.systemNoc = allContactGroupsNodeContactsContact["SystemNoc"].asString() == "true";
+			contactGroupsObject.contacts.push_back(contactsObject);
+		}
 		contactGroups_.push_back(contactGroupsObject);
 	}
 

+ 1 - 1
arms/src/model/SearchAlertRulesResult.cc

@@ -145,7 +145,7 @@ void SearchAlertRulesResult::parse(const std::string &payload)
 		auto allAlertWays = value["AlertWays"]["AlertWay"];
 		for (auto value : allAlertWays)
 			alertRuleEntityObject.alertWays.push_back(value.asString());
-		auto allAlertWay = value["AlertWay"]["AlertWay"];
+		auto allAlertWay = value["AlertWay"]["NocWay"];
 		for (auto value : allAlertWay)
 			alertRuleEntityObject.alertWay.push_back(value.asString());
 		pageBean_.alertRules.push_back(alertRuleEntityObject);

+ 1 - 1
arms/src/model/SearchEventsResult.cc

@@ -57,7 +57,7 @@ void SearchEventsResult::parse(const std::string &payload)
 		if(!pageBeanNodeEventEventItem["AlertType"].isNull())
 			eventItemObject.alertType = std::stoi(pageBeanNodeEventEventItem["AlertType"].asString());
 		if(!pageBeanNodeEventEventItem["EventLevel"].isNull())
-			eventItemObject.eventLevel = std::stoi(pageBeanNodeEventEventItem["EventLevel"].asString());
+			eventItemObject.eventLevel = pageBeanNodeEventEventItem["EventLevel"].asString();
 		if(!pageBeanNodeEventEventItem["Message"].isNull())
 			eventItemObject.message = pageBeanNodeEventEventItem["Message"].asString();
 		if(!pageBeanNodeEventEventItem["AlertId"].isNull())