From 636e24a33f78cc568840f86b7d042f686cc9ded5 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Fri, 3 Apr 2020 19:52:25 +0800 Subject: [PATCH] Add trace api. --- CHANGELOG | 4 + VERSION | 2 +- arms/CMakeLists.txt | 16 ++ arms/include/alibabacloud/arms/ARMSClient.h | 32 ++++ .../arms/model/GetPrometheusApiTokenRequest.h | 48 ++++++ .../arms/model/GetPrometheusApiTokenResult.h | 51 +++++++ .../alibabacloud/arms/model/GetTraceRequest.h | 51 +++++++ .../alibabacloud/arms/model/GetTraceResult.h | 80 ++++++++++ .../model/ListClusterFromGrafanaRequest.h | 48 ++++++ .../arms/model/ListClusterFromGrafanaResult.h | 72 +++++++++ .../arms/model/SearchTracesRequest.h | 78 ++++++++++ .../arms/model/SearchTracesResult.h | 60 ++++++++ arms/src/ARMSClient.cc | 144 ++++++++++++++++++ .../src/model/GetPrometheusApiTokenRequest.cc | 40 +++++ arms/src/model/GetPrometheusApiTokenResult.cc | 51 +++++++ arms/src/model/GetTraceRequest.cc | 51 +++++++ arms/src/model/GetTraceResult.cc | 101 ++++++++++++ .../model/ListClusterFromGrafanaRequest.cc | 40 +++++ .../src/model/ListClusterFromGrafanaResult.cc | 91 +++++++++++ arms/src/model/SearchTracesRequest.cc | 133 ++++++++++++++++ arms/src/model/SearchTracesResult.cc | 67 ++++++++ 21 files changed, 1259 insertions(+), 1 deletion(-) create mode 100644 arms/include/alibabacloud/arms/model/GetPrometheusApiTokenRequest.h create mode 100644 arms/include/alibabacloud/arms/model/GetPrometheusApiTokenResult.h create mode 100644 arms/include/alibabacloud/arms/model/GetTraceRequest.h create mode 100644 arms/include/alibabacloud/arms/model/GetTraceResult.h create mode 100644 arms/include/alibabacloud/arms/model/ListClusterFromGrafanaRequest.h create mode 100644 arms/include/alibabacloud/arms/model/ListClusterFromGrafanaResult.h create mode 100644 arms/include/alibabacloud/arms/model/SearchTracesRequest.h create mode 100644 arms/include/alibabacloud/arms/model/SearchTracesResult.h create mode 100644 arms/src/model/GetPrometheusApiTokenRequest.cc create mode 100644 arms/src/model/GetPrometheusApiTokenResult.cc create mode 100644 arms/src/model/GetTraceRequest.cc create mode 100644 arms/src/model/GetTraceResult.cc create mode 100644 arms/src/model/ListClusterFromGrafanaRequest.cc create mode 100644 arms/src/model/ListClusterFromGrafanaResult.cc create mode 100644 arms/src/model/SearchTracesRequest.cc create mode 100644 arms/src/model/SearchTracesResult.cc diff --git a/CHANGELOG b/CHANGELOG index 966657de8..ef43cdf21 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +2020-04-03 Version: 1.36.340 +- Add trace api. +- Add prometheus api. + 2020-04-03 Version: 1.36.339 - Support shelf type for planogram position. diff --git a/VERSION b/VERSION index a80383f25..adb8b5ea5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.339 \ No newline at end of file +1.36.340 \ No newline at end of file diff --git a/arms/CMakeLists.txt b/arms/CMakeLists.txt index 31661a31f..d6853b0a0 100644 --- a/arms/CMakeLists.txt +++ b/arms/CMakeLists.txt @@ -35,12 +35,18 @@ set(arms_public_header_model include/alibabacloud/arms/model/DeleteAlertRulesResult.h include/alibabacloud/arms/model/DeleteRetcodeAppRequest.h include/alibabacloud/arms/model/DeleteRetcodeAppResult.h + include/alibabacloud/arms/model/GetPrometheusApiTokenRequest.h + include/alibabacloud/arms/model/GetPrometheusApiTokenResult.h include/alibabacloud/arms/model/GetRetcodeShareUrlRequest.h include/alibabacloud/arms/model/GetRetcodeShareUrlResult.h + include/alibabacloud/arms/model/GetTraceRequest.h + include/alibabacloud/arms/model/GetTraceResult.h include/alibabacloud/arms/model/ImportAppAlertRulesRequest.h include/alibabacloud/arms/model/ImportAppAlertRulesResult.h include/alibabacloud/arms/model/ImportCustomAlertRulesRequest.h include/alibabacloud/arms/model/ImportCustomAlertRulesResult.h + include/alibabacloud/arms/model/ListClusterFromGrafanaRequest.h + include/alibabacloud/arms/model/ListClusterFromGrafanaResult.h include/alibabacloud/arms/model/ListPromClustersRequest.h include/alibabacloud/arms/model/ListPromClustersResult.h include/alibabacloud/arms/model/ListRetcodeAppsRequest.h @@ -67,6 +73,8 @@ set(arms_public_header_model include/alibabacloud/arms/model/SearchTraceAppByNameResult.h include/alibabacloud/arms/model/SearchTraceAppByPageRequest.h include/alibabacloud/arms/model/SearchTraceAppByPageResult.h + include/alibabacloud/arms/model/SearchTracesRequest.h + include/alibabacloud/arms/model/SearchTracesResult.h include/alibabacloud/arms/model/SetRetcodeShareStatusRequest.h include/alibabacloud/arms/model/SetRetcodeShareStatusResult.h include/alibabacloud/arms/model/StartAlertRequest.h @@ -96,12 +104,18 @@ set(arms_src src/model/DeleteAlertRulesResult.cc src/model/DeleteRetcodeAppRequest.cc src/model/DeleteRetcodeAppResult.cc + src/model/GetPrometheusApiTokenRequest.cc + src/model/GetPrometheusApiTokenResult.cc src/model/GetRetcodeShareUrlRequest.cc src/model/GetRetcodeShareUrlResult.cc + src/model/GetTraceRequest.cc + src/model/GetTraceResult.cc src/model/ImportAppAlertRulesRequest.cc src/model/ImportAppAlertRulesResult.cc src/model/ImportCustomAlertRulesRequest.cc src/model/ImportCustomAlertRulesResult.cc + src/model/ListClusterFromGrafanaRequest.cc + src/model/ListClusterFromGrafanaResult.cc src/model/ListPromClustersRequest.cc src/model/ListPromClustersResult.cc src/model/ListRetcodeAppsRequest.cc @@ -128,6 +142,8 @@ set(arms_src src/model/SearchTraceAppByNameResult.cc src/model/SearchTraceAppByPageRequest.cc src/model/SearchTraceAppByPageResult.cc + src/model/SearchTracesRequest.cc + src/model/SearchTracesResult.cc src/model/SetRetcodeShareStatusRequest.cc src/model/SetRetcodeShareStatusResult.cc src/model/StartAlertRequest.cc diff --git a/arms/include/alibabacloud/arms/ARMSClient.h b/arms/include/alibabacloud/arms/ARMSClient.h index b0c9e2f33..fe94e9182 100644 --- a/arms/include/alibabacloud/arms/ARMSClient.h +++ b/arms/include/alibabacloud/arms/ARMSClient.h @@ -36,12 +36,18 @@ #include "model/DeleteAlertRulesResult.h" #include "model/DeleteRetcodeAppRequest.h" #include "model/DeleteRetcodeAppResult.h" +#include "model/GetPrometheusApiTokenRequest.h" +#include "model/GetPrometheusApiTokenResult.h" #include "model/GetRetcodeShareUrlRequest.h" #include "model/GetRetcodeShareUrlResult.h" +#include "model/GetTraceRequest.h" +#include "model/GetTraceResult.h" #include "model/ImportAppAlertRulesRequest.h" #include "model/ImportAppAlertRulesResult.h" #include "model/ImportCustomAlertRulesRequest.h" #include "model/ImportCustomAlertRulesResult.h" +#include "model/ListClusterFromGrafanaRequest.h" +#include "model/ListClusterFromGrafanaResult.h" #include "model/ListPromClustersRequest.h" #include "model/ListPromClustersResult.h" #include "model/ListRetcodeAppsRequest.h" @@ -68,6 +74,8 @@ #include "model/SearchTraceAppByNameResult.h" #include "model/SearchTraceAppByPageRequest.h" #include "model/SearchTraceAppByPageResult.h" +#include "model/SearchTracesRequest.h" +#include "model/SearchTracesResult.h" #include "model/SetRetcodeShareStatusRequest.h" #include "model/SetRetcodeShareStatusResult.h" #include "model/StartAlertRequest.h" @@ -110,15 +118,24 @@ namespace AlibabaCloud typedef Outcome DeleteRetcodeAppOutcome; typedef std::future DeleteRetcodeAppOutcomeCallable; typedef std::function&)> DeleteRetcodeAppAsyncHandler; + typedef Outcome GetPrometheusApiTokenOutcome; + typedef std::future GetPrometheusApiTokenOutcomeCallable; + typedef std::function&)> GetPrometheusApiTokenAsyncHandler; typedef Outcome GetRetcodeShareUrlOutcome; typedef std::future GetRetcodeShareUrlOutcomeCallable; typedef std::function&)> GetRetcodeShareUrlAsyncHandler; + typedef Outcome GetTraceOutcome; + typedef std::future GetTraceOutcomeCallable; + typedef std::function&)> GetTraceAsyncHandler; typedef Outcome ImportAppAlertRulesOutcome; typedef std::future ImportAppAlertRulesOutcomeCallable; typedef std::function&)> ImportAppAlertRulesAsyncHandler; typedef Outcome ImportCustomAlertRulesOutcome; typedef std::future ImportCustomAlertRulesOutcomeCallable; typedef std::function&)> ImportCustomAlertRulesAsyncHandler; + typedef Outcome ListClusterFromGrafanaOutcome; + typedef std::future ListClusterFromGrafanaOutcomeCallable; + typedef std::function&)> ListClusterFromGrafanaAsyncHandler; typedef Outcome ListPromClustersOutcome; typedef std::future ListPromClustersOutcomeCallable; typedef std::function&)> ListPromClustersAsyncHandler; @@ -158,6 +175,9 @@ namespace AlibabaCloud typedef Outcome SearchTraceAppByPageOutcome; typedef std::future SearchTraceAppByPageOutcomeCallable; typedef std::function&)> SearchTraceAppByPageAsyncHandler; + typedef Outcome SearchTracesOutcome; + typedef std::future SearchTracesOutcomeCallable; + typedef std::function&)> SearchTracesAsyncHandler; typedef Outcome SetRetcodeShareStatusOutcome; typedef std::future SetRetcodeShareStatusOutcomeCallable; typedef std::function&)> SetRetcodeShareStatusAsyncHandler; @@ -202,15 +222,24 @@ namespace AlibabaCloud DeleteRetcodeAppOutcome deleteRetcodeApp(const Model::DeleteRetcodeAppRequest &request)const; void deleteRetcodeAppAsync(const Model::DeleteRetcodeAppRequest& request, const DeleteRetcodeAppAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DeleteRetcodeAppOutcomeCallable deleteRetcodeAppCallable(const Model::DeleteRetcodeAppRequest& request) const; + GetPrometheusApiTokenOutcome getPrometheusApiToken(const Model::GetPrometheusApiTokenRequest &request)const; + void getPrometheusApiTokenAsync(const Model::GetPrometheusApiTokenRequest& request, const GetPrometheusApiTokenAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetPrometheusApiTokenOutcomeCallable getPrometheusApiTokenCallable(const Model::GetPrometheusApiTokenRequest& request) const; GetRetcodeShareUrlOutcome getRetcodeShareUrl(const Model::GetRetcodeShareUrlRequest &request)const; void getRetcodeShareUrlAsync(const Model::GetRetcodeShareUrlRequest& request, const GetRetcodeShareUrlAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetRetcodeShareUrlOutcomeCallable getRetcodeShareUrlCallable(const Model::GetRetcodeShareUrlRequest& request) const; + GetTraceOutcome getTrace(const Model::GetTraceRequest &request)const; + void getTraceAsync(const Model::GetTraceRequest& request, const GetTraceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetTraceOutcomeCallable getTraceCallable(const Model::GetTraceRequest& request) const; ImportAppAlertRulesOutcome importAppAlertRules(const Model::ImportAppAlertRulesRequest &request)const; void importAppAlertRulesAsync(const Model::ImportAppAlertRulesRequest& request, const ImportAppAlertRulesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ImportAppAlertRulesOutcomeCallable importAppAlertRulesCallable(const Model::ImportAppAlertRulesRequest& request) const; ImportCustomAlertRulesOutcome importCustomAlertRules(const Model::ImportCustomAlertRulesRequest &request)const; void importCustomAlertRulesAsync(const Model::ImportCustomAlertRulesRequest& request, const ImportCustomAlertRulesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ImportCustomAlertRulesOutcomeCallable importCustomAlertRulesCallable(const Model::ImportCustomAlertRulesRequest& request) const; + ListClusterFromGrafanaOutcome listClusterFromGrafana(const Model::ListClusterFromGrafanaRequest &request)const; + void listClusterFromGrafanaAsync(const Model::ListClusterFromGrafanaRequest& request, const ListClusterFromGrafanaAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ListClusterFromGrafanaOutcomeCallable listClusterFromGrafanaCallable(const Model::ListClusterFromGrafanaRequest& request) const; ListPromClustersOutcome listPromClusters(const Model::ListPromClustersRequest &request)const; void listPromClustersAsync(const Model::ListPromClustersRequest& request, const ListPromClustersAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListPromClustersOutcomeCallable listPromClustersCallable(const Model::ListPromClustersRequest& request) const; @@ -250,6 +279,9 @@ namespace AlibabaCloud SearchTraceAppByPageOutcome searchTraceAppByPage(const Model::SearchTraceAppByPageRequest &request)const; void searchTraceAppByPageAsync(const Model::SearchTraceAppByPageRequest& request, const SearchTraceAppByPageAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; SearchTraceAppByPageOutcomeCallable searchTraceAppByPageCallable(const Model::SearchTraceAppByPageRequest& request) const; + SearchTracesOutcome searchTraces(const Model::SearchTracesRequest &request)const; + void searchTracesAsync(const Model::SearchTracesRequest& request, const SearchTracesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + SearchTracesOutcomeCallable searchTracesCallable(const Model::SearchTracesRequest& request) const; SetRetcodeShareStatusOutcome setRetcodeShareStatus(const Model::SetRetcodeShareStatusRequest &request)const; void setRetcodeShareStatusAsync(const Model::SetRetcodeShareStatusRequest& request, const SetRetcodeShareStatusAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; SetRetcodeShareStatusOutcomeCallable setRetcodeShareStatusCallable(const Model::SetRetcodeShareStatusRequest& request) const; diff --git a/arms/include/alibabacloud/arms/model/GetPrometheusApiTokenRequest.h b/arms/include/alibabacloud/arms/model/GetPrometheusApiTokenRequest.h new file mode 100644 index 000000000..f361fb968 --- /dev/null +++ b/arms/include/alibabacloud/arms/model/GetPrometheusApiTokenRequest.h @@ -0,0 +1,48 @@ +/* + * 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_GETPROMETHEUSAPITOKENREQUEST_H_ +#define ALIBABACLOUD_ARMS_MODEL_GETPROMETHEUSAPITOKENREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT GetPrometheusApiTokenRequest : public RpcServiceRequest + { + + public: + GetPrometheusApiTokenRequest(); + ~GetPrometheusApiTokenRequest(); + + std::string getRegionId()const; + void setRegionId(const std::string& regionId); + + private: + std::string regionId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_GETPROMETHEUSAPITOKENREQUEST_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/GetPrometheusApiTokenResult.h b/arms/include/alibabacloud/arms/model/GetPrometheusApiTokenResult.h new file mode 100644 index 000000000..d8a26576e --- /dev/null +++ b/arms/include/alibabacloud/arms/model/GetPrometheusApiTokenResult.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_GETPROMETHEUSAPITOKENRESULT_H_ +#define ALIBABACLOUD_ARMS_MODEL_GETPROMETHEUSAPITOKENRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT GetPrometheusApiTokenResult : public ServiceResult + { + public: + + + GetPrometheusApiTokenResult(); + explicit GetPrometheusApiTokenResult(const std::string &payload); + ~GetPrometheusApiTokenResult(); + std::string getToken()const; + + protected: + void parse(const std::string &payload); + private: + std::string token_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_GETPROMETHEUSAPITOKENRESULT_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/GetTraceRequest.h b/arms/include/alibabacloud/arms/model/GetTraceRequest.h new file mode 100644 index 000000000..2174e7de0 --- /dev/null +++ b/arms/include/alibabacloud/arms/model/GetTraceRequest.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_GETTRACEREQUEST_H_ +#define ALIBABACLOUD_ARMS_MODEL_GETTRACEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT GetTraceRequest : public RpcServiceRequest + { + + public: + GetTraceRequest(); + ~GetTraceRequest(); + + std::string getTraceID()const; + void setTraceID(const std::string& traceID); + std::string getRegionId()const; + void setRegionId(const std::string& regionId); + + private: + std::string traceID_; + std::string regionId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_GETTRACEREQUEST_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/GetTraceResult.h b/arms/include/alibabacloud/arms/model/GetTraceResult.h new file mode 100644 index 000000000..ea1d7e4ca --- /dev/null +++ b/arms/include/alibabacloud/arms/model/GetTraceResult.h @@ -0,0 +1,80 @@ +/* + * 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_GETTRACERESULT_H_ +#define ALIBABACLOUD_ARMS_MODEL_GETTRACERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT GetTraceResult : public ServiceResult + { + public: + struct Span + { + struct TagEntry + { + std::string value; + std::string key; + }; + struct LogEvent + { + struct TagEntry2 + { + std::string value; + std::string key; + }; + std::vector tagEntryList1; + long timestamp; + }; + bool haveStack; + std::string serviceIp; + std::vector logEventList; + std::string operationName; + std::string serviceName; + std::string rpcId; + std::string traceID; + long duration; + std::vector tagEntryList; + long timestamp; + std::string resultCode; + }; + + + GetTraceResult(); + explicit GetTraceResult(const std::string &payload); + ~GetTraceResult(); + std::vector getSpans()const; + + protected: + void parse(const std::string &payload); + private: + std::vector spans_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_GETTRACERESULT_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/ListClusterFromGrafanaRequest.h b/arms/include/alibabacloud/arms/model/ListClusterFromGrafanaRequest.h new file mode 100644 index 000000000..10436e5f3 --- /dev/null +++ b/arms/include/alibabacloud/arms/model/ListClusterFromGrafanaRequest.h @@ -0,0 +1,48 @@ +/* + * 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_LISTCLUSTERFROMGRAFANAREQUEST_H_ +#define ALIBABACLOUD_ARMS_MODEL_LISTCLUSTERFROMGRAFANAREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT ListClusterFromGrafanaRequest : public RpcServiceRequest + { + + public: + ListClusterFromGrafanaRequest(); + ~ListClusterFromGrafanaRequest(); + + std::string getRegionId()const; + void setRegionId(const std::string& regionId); + + private: + std::string regionId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_LISTCLUSTERFROMGRAFANAREQUEST_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/ListClusterFromGrafanaResult.h b/arms/include/alibabacloud/arms/model/ListClusterFromGrafanaResult.h new file mode 100644 index 000000000..46883a1f0 --- /dev/null +++ b/arms/include/alibabacloud/arms/model/ListClusterFromGrafanaResult.h @@ -0,0 +1,72 @@ +/* + * 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_LISTCLUSTERFROMGRAFANARESULT_H_ +#define ALIBABACLOUD_ARMS_MODEL_LISTCLUSTERFROMGRAFANARESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT ListClusterFromGrafanaResult : public ServiceResult + { + public: + struct PromCluster + { + bool isControllerInstalled; + std::string stateJson; + std::string options; + int nodeNum; + std::string clusterId; + long installTime; + long createTime; + std::string controllerId; + std::string pluginsJsonArray; + std::string clusterType; + std::string agentStatus; + std::string extra; + std::string userId; + long lastHeartBeatTime; + long updateTime; + std::string clusterName; + long id; + std::string regionId; + }; + + + ListClusterFromGrafanaResult(); + explicit ListClusterFromGrafanaResult(const std::string &payload); + ~ListClusterFromGrafanaResult(); + std::vector getPromClusterList()const; + + protected: + void parse(const std::string &payload); + private: + std::vector promClusterList_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_LISTCLUSTERFROMGRAFANARESULT_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/SearchTracesRequest.h b/arms/include/alibabacloud/arms/model/SearchTracesRequest.h new file mode 100644 index 000000000..303c04e85 --- /dev/null +++ b/arms/include/alibabacloud/arms/model/SearchTracesRequest.h @@ -0,0 +1,78 @@ +/* + * 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_SEARCHTRACESREQUEST_H_ +#define ALIBABACLOUD_ARMS_MODEL_SEARCHTRACESREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT SearchTracesRequest : public RpcServiceRequest + { + public: + struct Tag + { + std::string value; + std::string key; + }; + + public: + SearchTracesRequest(); + ~SearchTracesRequest(); + + long getEndTime()const; + void setEndTime(long endTime); + long getStartTime()const; + void setStartTime(long startTime); + bool getReverse()const; + void setReverse(bool reverse); + long getMinDuration()const; + void setMinDuration(long minDuration); + std::string getServiceIp()const; + void setServiceIp(const std::string& serviceIp); + std::string getRegionId()const; + void setRegionId(const std::string& regionId); + std::string getOperationName()const; + void setOperationName(const std::string& operationName); + std::string getServiceName()const; + void setServiceName(const std::string& serviceName); + std::vector getTag()const; + void setTag(const std::vector& tag); + + private: + long endTime_; + long startTime_; + bool reverse_; + long minDuration_; + std::string serviceIp_; + std::string regionId_; + std::string operationName_; + std::string serviceName_; + std::vector tag_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_SEARCHTRACESREQUEST_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/SearchTracesResult.h b/arms/include/alibabacloud/arms/model/SearchTracesResult.h new file mode 100644 index 000000000..70e0a69a1 --- /dev/null +++ b/arms/include/alibabacloud/arms/model/SearchTracesResult.h @@ -0,0 +1,60 @@ +/* + * 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_SEARCHTRACESRESULT_H_ +#define ALIBABACLOUD_ARMS_MODEL_SEARCHTRACESRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT SearchTracesResult : public ServiceResult + { + public: + struct TraceInfo + { + std::string serviceIp; + std::string operationName; + std::string serviceName; + std::string traceID; + long duration; + long timestamp; + }; + + + SearchTracesResult(); + explicit SearchTracesResult(const std::string &payload); + ~SearchTracesResult(); + std::vector getTraceInfos()const; + + protected: + void parse(const std::string &payload); + private: + std::vector traceInfos_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_SEARCHTRACESRESULT_H_ \ No newline at end of file diff --git a/arms/src/ARMSClient.cc b/arms/src/ARMSClient.cc index ba0d181aa..9fd4e2cd9 100644 --- a/arms/src/ARMSClient.cc +++ b/arms/src/ARMSClient.cc @@ -303,6 +303,42 @@ ARMSClient::DeleteRetcodeAppOutcomeCallable ARMSClient::deleteRetcodeAppCallable return task->get_future(); } +ARMSClient::GetPrometheusApiTokenOutcome ARMSClient::getPrometheusApiToken(const GetPrometheusApiTokenRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetPrometheusApiTokenOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetPrometheusApiTokenOutcome(GetPrometheusApiTokenResult(outcome.result())); + else + return GetPrometheusApiTokenOutcome(outcome.error()); +} + +void ARMSClient::getPrometheusApiTokenAsync(const GetPrometheusApiTokenRequest& request, const GetPrometheusApiTokenAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getPrometheusApiToken(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ARMSClient::GetPrometheusApiTokenOutcomeCallable ARMSClient::getPrometheusApiTokenCallable(const GetPrometheusApiTokenRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getPrometheusApiToken(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ARMSClient::GetRetcodeShareUrlOutcome ARMSClient::getRetcodeShareUrl(const GetRetcodeShareUrlRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -339,6 +375,42 @@ ARMSClient::GetRetcodeShareUrlOutcomeCallable ARMSClient::getRetcodeShareUrlCall return task->get_future(); } +ARMSClient::GetTraceOutcome ARMSClient::getTrace(const GetTraceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetTraceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetTraceOutcome(GetTraceResult(outcome.result())); + else + return GetTraceOutcome(outcome.error()); +} + +void ARMSClient::getTraceAsync(const GetTraceRequest& request, const GetTraceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getTrace(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ARMSClient::GetTraceOutcomeCallable ARMSClient::getTraceCallable(const GetTraceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getTrace(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ARMSClient::ImportAppAlertRulesOutcome ARMSClient::importAppAlertRules(const ImportAppAlertRulesRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -411,6 +483,42 @@ ARMSClient::ImportCustomAlertRulesOutcomeCallable ARMSClient::importCustomAlertR return task->get_future(); } +ARMSClient::ListClusterFromGrafanaOutcome ARMSClient::listClusterFromGrafana(const ListClusterFromGrafanaRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ListClusterFromGrafanaOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ListClusterFromGrafanaOutcome(ListClusterFromGrafanaResult(outcome.result())); + else + return ListClusterFromGrafanaOutcome(outcome.error()); +} + +void ARMSClient::listClusterFromGrafanaAsync(const ListClusterFromGrafanaRequest& request, const ListClusterFromGrafanaAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, listClusterFromGrafana(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ARMSClient::ListClusterFromGrafanaOutcomeCallable ARMSClient::listClusterFromGrafanaCallable(const ListClusterFromGrafanaRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->listClusterFromGrafana(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ARMSClient::ListPromClustersOutcome ARMSClient::listPromClusters(const ListPromClustersRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -879,6 +987,42 @@ ARMSClient::SearchTraceAppByPageOutcomeCallable ARMSClient::searchTraceAppByPage return task->get_future(); } +ARMSClient::SearchTracesOutcome ARMSClient::searchTraces(const SearchTracesRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return SearchTracesOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return SearchTracesOutcome(SearchTracesResult(outcome.result())); + else + return SearchTracesOutcome(outcome.error()); +} + +void ARMSClient::searchTracesAsync(const SearchTracesRequest& request, const SearchTracesAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, searchTraces(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ARMSClient::SearchTracesOutcomeCallable ARMSClient::searchTracesCallable(const SearchTracesRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->searchTraces(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ARMSClient::SetRetcodeShareStatusOutcome ARMSClient::setRetcodeShareStatus(const SetRetcodeShareStatusRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/arms/src/model/GetPrometheusApiTokenRequest.cc b/arms/src/model/GetPrometheusApiTokenRequest.cc new file mode 100644 index 000000000..98492f274 --- /dev/null +++ b/arms/src/model/GetPrometheusApiTokenRequest.cc @@ -0,0 +1,40 @@ +/* + * 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::ARMS::Model::GetPrometheusApiTokenRequest; + +GetPrometheusApiTokenRequest::GetPrometheusApiTokenRequest() : + RpcServiceRequest("arms", "2019-08-08", "GetPrometheusApiToken") +{ + setMethod(HttpRequest::Method::Post); +} + +GetPrometheusApiTokenRequest::~GetPrometheusApiTokenRequest() +{} + +std::string GetPrometheusApiTokenRequest::getRegionId()const +{ + return regionId_; +} + +void GetPrometheusApiTokenRequest::setRegionId(const std::string& regionId) +{ + regionId_ = regionId; + setParameter("RegionId", regionId); +} + diff --git a/arms/src/model/GetPrometheusApiTokenResult.cc b/arms/src/model/GetPrometheusApiTokenResult.cc new file mode 100644 index 000000000..6299c55bc --- /dev/null +++ b/arms/src/model/GetPrometheusApiTokenResult.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 +#include + +using namespace AlibabaCloud::ARMS; +using namespace AlibabaCloud::ARMS::Model; + +GetPrometheusApiTokenResult::GetPrometheusApiTokenResult() : + ServiceResult() +{} + +GetPrometheusApiTokenResult::GetPrometheusApiTokenResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetPrometheusApiTokenResult::~GetPrometheusApiTokenResult() +{} + +void GetPrometheusApiTokenResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["Token"].isNull()) + token_ = value["Token"].asString(); + +} + +std::string GetPrometheusApiTokenResult::getToken()const +{ + return token_; +} + diff --git a/arms/src/model/GetTraceRequest.cc b/arms/src/model/GetTraceRequest.cc new file mode 100644 index 000000000..b702cafd2 --- /dev/null +++ b/arms/src/model/GetTraceRequest.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 + +using AlibabaCloud::ARMS::Model::GetTraceRequest; + +GetTraceRequest::GetTraceRequest() : + RpcServiceRequest("arms", "2019-08-08", "GetTrace") +{ + setMethod(HttpRequest::Method::Post); +} + +GetTraceRequest::~GetTraceRequest() +{} + +std::string GetTraceRequest::getTraceID()const +{ + return traceID_; +} + +void GetTraceRequest::setTraceID(const std::string& traceID) +{ + traceID_ = traceID; + setParameter("TraceID", traceID); +} + +std::string GetTraceRequest::getRegionId()const +{ + return regionId_; +} + +void GetTraceRequest::setRegionId(const std::string& regionId) +{ + regionId_ = regionId; + setParameter("RegionId", regionId); +} + diff --git a/arms/src/model/GetTraceResult.cc b/arms/src/model/GetTraceResult.cc new file mode 100644 index 000000000..5731d0c33 --- /dev/null +++ b/arms/src/model/GetTraceResult.cc @@ -0,0 +1,101 @@ +/* + * 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::ARMS; +using namespace AlibabaCloud::ARMS::Model; + +GetTraceResult::GetTraceResult() : + ServiceResult() +{} + +GetTraceResult::GetTraceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetTraceResult::~GetTraceResult() +{} + +void GetTraceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allSpansNode = value["Spans"]["Span"]; + for (auto valueSpansSpan : allSpansNode) + { + Span spansObject; + if(!valueSpansSpan["TraceID"].isNull()) + spansObject.traceID = valueSpansSpan["TraceID"].asString(); + if(!valueSpansSpan["OperationName"].isNull()) + spansObject.operationName = valueSpansSpan["OperationName"].asString(); + if(!valueSpansSpan["Duration"].isNull()) + spansObject.duration = std::stol(valueSpansSpan["Duration"].asString()); + if(!valueSpansSpan["ServiceName"].isNull()) + spansObject.serviceName = valueSpansSpan["ServiceName"].asString(); + if(!valueSpansSpan["ServiceIp"].isNull()) + spansObject.serviceIp = valueSpansSpan["ServiceIp"].asString(); + if(!valueSpansSpan["Timestamp"].isNull()) + spansObject.timestamp = std::stol(valueSpansSpan["Timestamp"].asString()); + if(!valueSpansSpan["RpcId"].isNull()) + spansObject.rpcId = valueSpansSpan["RpcId"].asString(); + if(!valueSpansSpan["ResultCode"].isNull()) + spansObject.resultCode = valueSpansSpan["ResultCode"].asString(); + if(!valueSpansSpan["HaveStack"].isNull()) + spansObject.haveStack = valueSpansSpan["HaveStack"].asString() == "true"; + auto allTagEntryListNode = allSpansNode["TagEntryList"]["TagEntry"]; + for (auto allSpansNodeTagEntryListTagEntry : allTagEntryListNode) + { + Span::TagEntry tagEntryListObject; + if(!allSpansNodeTagEntryListTagEntry["Key"].isNull()) + tagEntryListObject.key = allSpansNodeTagEntryListTagEntry["Key"].asString(); + if(!allSpansNodeTagEntryListTagEntry["Value"].isNull()) + tagEntryListObject.value = allSpansNodeTagEntryListTagEntry["Value"].asString(); + spansObject.tagEntryList.push_back(tagEntryListObject); + } + auto allLogEventListNode = allSpansNode["LogEventList"]["LogEvent"]; + for (auto allSpansNodeLogEventListLogEvent : allLogEventListNode) + { + Span::LogEvent logEventListObject; + if(!allSpansNodeLogEventListLogEvent["Timestamp"].isNull()) + logEventListObject.timestamp = std::stol(allSpansNodeLogEventListLogEvent["Timestamp"].asString()); + auto allTagEntryList1Node = allLogEventListNode["TagEntryList"]["TagEntry"]; + for (auto allLogEventListNodeTagEntryListTagEntry : allTagEntryList1Node) + { + Span::LogEvent::TagEntry2 tagEntryList1Object; + if(!allLogEventListNodeTagEntryListTagEntry["Key"].isNull()) + tagEntryList1Object.key = allLogEventListNodeTagEntryListTagEntry["Key"].asString(); + if(!allLogEventListNodeTagEntryListTagEntry["Value"].isNull()) + tagEntryList1Object.value = allLogEventListNodeTagEntryListTagEntry["Value"].asString(); + logEventListObject.tagEntryList1.push_back(tagEntryList1Object); + } + spansObject.logEventList.push_back(logEventListObject); + } + spans_.push_back(spansObject); + } + +} + +std::vector GetTraceResult::getSpans()const +{ + return spans_; +} + diff --git a/arms/src/model/ListClusterFromGrafanaRequest.cc b/arms/src/model/ListClusterFromGrafanaRequest.cc new file mode 100644 index 000000000..35cd1b3ac --- /dev/null +++ b/arms/src/model/ListClusterFromGrafanaRequest.cc @@ -0,0 +1,40 @@ +/* + * 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::ARMS::Model::ListClusterFromGrafanaRequest; + +ListClusterFromGrafanaRequest::ListClusterFromGrafanaRequest() : + RpcServiceRequest("arms", "2019-08-08", "ListClusterFromGrafana") +{ + setMethod(HttpRequest::Method::Post); +} + +ListClusterFromGrafanaRequest::~ListClusterFromGrafanaRequest() +{} + +std::string ListClusterFromGrafanaRequest::getRegionId()const +{ + return regionId_; +} + +void ListClusterFromGrafanaRequest::setRegionId(const std::string& regionId) +{ + regionId_ = regionId; + setParameter("RegionId", regionId); +} + diff --git a/arms/src/model/ListClusterFromGrafanaResult.cc b/arms/src/model/ListClusterFromGrafanaResult.cc new file mode 100644 index 000000000..472a6b5ba --- /dev/null +++ b/arms/src/model/ListClusterFromGrafanaResult.cc @@ -0,0 +1,91 @@ +/* + * 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::ARMS; +using namespace AlibabaCloud::ARMS::Model; + +ListClusterFromGrafanaResult::ListClusterFromGrafanaResult() : + ServiceResult() +{} + +ListClusterFromGrafanaResult::ListClusterFromGrafanaResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ListClusterFromGrafanaResult::~ListClusterFromGrafanaResult() +{} + +void ListClusterFromGrafanaResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allPromClusterListNode = value["PromClusterList"]["PromCluster"]; + for (auto valuePromClusterListPromCluster : allPromClusterListNode) + { + PromCluster promClusterListObject; + if(!valuePromClusterListPromCluster["Id"].isNull()) + promClusterListObject.id = std::stol(valuePromClusterListPromCluster["Id"].asString()); + if(!valuePromClusterListPromCluster["ClusterId"].isNull()) + promClusterListObject.clusterId = valuePromClusterListPromCluster["ClusterId"].asString(); + if(!valuePromClusterListPromCluster["ClusterName"].isNull()) + promClusterListObject.clusterName = valuePromClusterListPromCluster["ClusterName"].asString(); + if(!valuePromClusterListPromCluster["AgentStatus"].isNull()) + promClusterListObject.agentStatus = valuePromClusterListPromCluster["AgentStatus"].asString(); + if(!valuePromClusterListPromCluster["ClusterType"].isNull()) + promClusterListObject.clusterType = valuePromClusterListPromCluster["ClusterType"].asString(); + if(!valuePromClusterListPromCluster["ControllerId"].isNull()) + promClusterListObject.controllerId = valuePromClusterListPromCluster["ControllerId"].asString(); + if(!valuePromClusterListPromCluster["IsControllerInstalled"].isNull()) + promClusterListObject.isControllerInstalled = valuePromClusterListPromCluster["IsControllerInstalled"].asString() == "true"; + if(!valuePromClusterListPromCluster["UserId"].isNull()) + promClusterListObject.userId = valuePromClusterListPromCluster["UserId"].asString(); + if(!valuePromClusterListPromCluster["RegionId"].isNull()) + promClusterListObject.regionId = valuePromClusterListPromCluster["RegionId"].asString(); + if(!valuePromClusterListPromCluster["PluginsJsonArray"].isNull()) + promClusterListObject.pluginsJsonArray = valuePromClusterListPromCluster["PluginsJsonArray"].asString(); + if(!valuePromClusterListPromCluster["StateJson"].isNull()) + promClusterListObject.stateJson = valuePromClusterListPromCluster["StateJson"].asString(); + if(!valuePromClusterListPromCluster["NodeNum"].isNull()) + promClusterListObject.nodeNum = std::stoi(valuePromClusterListPromCluster["NodeNum"].asString()); + if(!valuePromClusterListPromCluster["CreateTime"].isNull()) + promClusterListObject.createTime = std::stol(valuePromClusterListPromCluster["CreateTime"].asString()); + if(!valuePromClusterListPromCluster["UpdateTime"].isNull()) + promClusterListObject.updateTime = std::stol(valuePromClusterListPromCluster["UpdateTime"].asString()); + if(!valuePromClusterListPromCluster["LastHeartBeatTime"].isNull()) + promClusterListObject.lastHeartBeatTime = std::stol(valuePromClusterListPromCluster["LastHeartBeatTime"].asString()); + if(!valuePromClusterListPromCluster["InstallTime"].isNull()) + promClusterListObject.installTime = std::stol(valuePromClusterListPromCluster["InstallTime"].asString()); + if(!valuePromClusterListPromCluster["Extra"].isNull()) + promClusterListObject.extra = valuePromClusterListPromCluster["Extra"].asString(); + if(!valuePromClusterListPromCluster["Options"].isNull()) + promClusterListObject.options = valuePromClusterListPromCluster["Options"].asString(); + promClusterList_.push_back(promClusterListObject); + } + +} + +std::vector ListClusterFromGrafanaResult::getPromClusterList()const +{ + return promClusterList_; +} + diff --git a/arms/src/model/SearchTracesRequest.cc b/arms/src/model/SearchTracesRequest.cc new file mode 100644 index 000000000..846162026 --- /dev/null +++ b/arms/src/model/SearchTracesRequest.cc @@ -0,0 +1,133 @@ +/* + * 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::ARMS::Model::SearchTracesRequest; + +SearchTracesRequest::SearchTracesRequest() : + RpcServiceRequest("arms", "2019-08-08", "SearchTraces") +{ + setMethod(HttpRequest::Method::Post); +} + +SearchTracesRequest::~SearchTracesRequest() +{} + +long SearchTracesRequest::getEndTime()const +{ + return endTime_; +} + +void SearchTracesRequest::setEndTime(long endTime) +{ + endTime_ = endTime; + setParameter("EndTime", std::to_string(endTime)); +} + +long SearchTracesRequest::getStartTime()const +{ + return startTime_; +} + +void SearchTracesRequest::setStartTime(long startTime) +{ + startTime_ = startTime; + setParameter("StartTime", std::to_string(startTime)); +} + +bool SearchTracesRequest::getReverse()const +{ + return reverse_; +} + +void SearchTracesRequest::setReverse(bool reverse) +{ + reverse_ = reverse; + setParameter("Reverse", reverse ? "true" : "false"); +} + +long SearchTracesRequest::getMinDuration()const +{ + return minDuration_; +} + +void SearchTracesRequest::setMinDuration(long minDuration) +{ + minDuration_ = minDuration; + setParameter("MinDuration", std::to_string(minDuration)); +} + +std::string SearchTracesRequest::getServiceIp()const +{ + return serviceIp_; +} + +void SearchTracesRequest::setServiceIp(const std::string& serviceIp) +{ + serviceIp_ = serviceIp; + setParameter("ServiceIp", serviceIp); +} + +std::string SearchTracesRequest::getRegionId()const +{ + return regionId_; +} + +void SearchTracesRequest::setRegionId(const std::string& regionId) +{ + regionId_ = regionId; + setParameter("RegionId", regionId); +} + +std::string SearchTracesRequest::getOperationName()const +{ + return operationName_; +} + +void SearchTracesRequest::setOperationName(const std::string& operationName) +{ + operationName_ = operationName; + setParameter("OperationName", operationName); +} + +std::string SearchTracesRequest::getServiceName()const +{ + return serviceName_; +} + +void SearchTracesRequest::setServiceName(const std::string& serviceName) +{ + serviceName_ = serviceName; + setParameter("ServiceName", serviceName); +} + +std::vector SearchTracesRequest::getTag()const +{ + return tag_; +} + +void SearchTracesRequest::setTag(const std::vector& tag) +{ + tag_ = tag; + for(int dep1 = 0; dep1!= tag.size(); dep1++) { + auto tagObj = tag.at(dep1); + std::string tagObjStr = "Tag." + std::to_string(dep1 + 1); + setParameter(tagObjStr + ".Value", tagObj.value); + setParameter(tagObjStr + ".Key", tagObj.key); + } +} + diff --git a/arms/src/model/SearchTracesResult.cc b/arms/src/model/SearchTracesResult.cc new file mode 100644 index 000000000..2dee08791 --- /dev/null +++ b/arms/src/model/SearchTracesResult.cc @@ -0,0 +1,67 @@ +/* + * 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::ARMS; +using namespace AlibabaCloud::ARMS::Model; + +SearchTracesResult::SearchTracesResult() : + ServiceResult() +{} + +SearchTracesResult::SearchTracesResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +SearchTracesResult::~SearchTracesResult() +{} + +void SearchTracesResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allTraceInfosNode = value["TraceInfos"]["TraceInfo"]; + for (auto valueTraceInfosTraceInfo : allTraceInfosNode) + { + TraceInfo traceInfosObject; + if(!valueTraceInfosTraceInfo["TraceID"].isNull()) + traceInfosObject.traceID = valueTraceInfosTraceInfo["TraceID"].asString(); + if(!valueTraceInfosTraceInfo["OperationName"].isNull()) + traceInfosObject.operationName = valueTraceInfosTraceInfo["OperationName"].asString(); + if(!valueTraceInfosTraceInfo["ServiceName"].isNull()) + traceInfosObject.serviceName = valueTraceInfosTraceInfo["ServiceName"].asString(); + if(!valueTraceInfosTraceInfo["ServiceIp"].isNull()) + traceInfosObject.serviceIp = valueTraceInfosTraceInfo["ServiceIp"].asString(); + if(!valueTraceInfosTraceInfo["Duration"].isNull()) + traceInfosObject.duration = std::stol(valueTraceInfosTraceInfo["Duration"].asString()); + if(!valueTraceInfosTraceInfo["Timestamp"].isNull()) + traceInfosObject.timestamp = std::stol(valueTraceInfosTraceInfo["Timestamp"].asString()); + traceInfos_.push_back(traceInfosObject); + } + +} + +std::vector SearchTracesResult::getTraceInfos()const +{ + return traceInfos_; +} +