Explorar o código

Bugfix QueryMoniter.

sdk-team %!s(int64=4) %!d(string=hai) anos
pai
achega
d42d229efb

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+2022-02-21 Version: 1.36.1061
+- Bugfix QueryMoniter.
+
 2022-02-21 Version: 1.36.1060
 - Add DleteNacosInstance.
 - Change CreateCluster parameter.

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.36.1060
+1.36.1061

+ 8 - 2
mse/include/alibabacloud/mse/model/QueryMonitorResult.h

@@ -32,13 +32,19 @@ namespace AlibabaCloud
 			class ALIBABACLOUD_MSE_EXPORT QueryMonitorResult : public ServiceResult
 			{
 			public:
+				struct DataItem
+				{
+					std::string podName;
+					std::string clusterNamePrefix;
+					std::vector<std::string> values;
+				};
 
 
 				QueryMonitorResult();
 				explicit QueryMonitorResult(const std::string &payload);
 				~QueryMonitorResult();
 				std::string getMessage()const;
-				std::string getData()const;
+				std::vector<DataItem> getData()const;
 				std::string getErrorCode()const;
 				bool getSuccess()const;
 
@@ -46,7 +52,7 @@ namespace AlibabaCloud
 				void parse(const std::string &payload);
 			private:
 				std::string message_;
-				std::string data_;
+				std::vector<DataItem> data_;
 				std::string errorCode_;
 				bool success_;
 

+ 14 - 3
mse/src/model/QueryMonitorResult.cc

@@ -39,10 +39,21 @@ void QueryMonitorResult::parse(const std::string &payload)
 	Json::Value value;
 	reader.parse(payload, value);
 	setRequestId(value["RequestId"].asString());
+	auto allDataNode = value["Data"]["dataItem"];
+	for (auto valueDatadataItem : allDataNode)
+	{
+		DataItem dataObject;
+		if(!valueDatadataItem["podName"].isNull())
+			dataObject.podName = valueDatadataItem["podName"].asString();
+		if(!valueDatadataItem["clusterNamePrefix"].isNull())
+			dataObject.clusterNamePrefix = valueDatadataItem["clusterNamePrefix"].asString();
+		auto allValues = value["values"]["values"];
+		for (auto value : allValues)
+			dataObject.values.push_back(value.asString());
+		data_.push_back(dataObject);
+	}
 	if(!value["Message"].isNull())
 		message_ = value["Message"].asString();
-	if(!value["Data"].isNull())
-		data_ = value["Data"].asString();
 	if(!value["ErrorCode"].isNull())
 		errorCode_ = value["ErrorCode"].asString();
 	if(!value["Success"].isNull())
@@ -55,7 +66,7 @@ std::string QueryMonitorResult::getMessage()const
 	return message_;
 }
 
-std::string QueryMonitorResult::getData()const
+std::vector<QueryMonitorResult::DataItem> QueryMonitorResult::getData()const
 {
 	return data_;
 }