diff --git a/CHANGELOG b/CHANGELOG index 4793eabc9..4db6e5159 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2018-10-16 Version: 1.28.1 +1, This version add MetricQuery interface to support retcode and apm metric query. + 2018-10-16 Version: 1.28.0 1, Delete deprecated and unusable apis : AddIpRange, UnbindIpRange, BindIpRange, DescribeIntranetAttributeKb, DescribeIpRanges, ModifyIntranetBandwidthKb, DescribeEventDetail, CheckAutoSnapshotPolicy, CheckDiskEnableAutoSnapshotValidation, DescribeAutoSnapshotPolicy 2, Add instance topology api DescribeInstanceTopology diff --git a/CMakeLists.txt b/CMakeLists.txt index 5095092b2..8f668d36d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,4 +89,5 @@ add_subdirectory(ots) add_subdirectory(smartag) add_subdirectory(vod) add_subdirectory(ccs) -add_subdirectory(saf) \ No newline at end of file +add_subdirectory(saf) +add_subdirectory(arms) \ No newline at end of file diff --git a/VERSION b/VERSION index 3c71e4721..e787e4c52 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.28.0 \ No newline at end of file +1.28.1 \ No newline at end of file diff --git a/arms/CMakeLists.txt b/arms/CMakeLists.txt new file mode 100644 index 000000000..d6e6c5b79 --- /dev/null +++ b/arms/CMakeLists.txt @@ -0,0 +1,90 @@ +# +# 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. +# + +set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include) + +set(arms_public_header + include/alibabacloud/arms/ARMSClient.h + include/alibabacloud/arms/ARMSExport.h ) + +set(arms_public_header_model + include/alibabacloud/arms/model/ARMSQueryDataSetRequest.h + include/alibabacloud/arms/model/ARMSQueryDataSetResult.h + include/alibabacloud/arms/model/MetricQueryRequest.h + include/alibabacloud/arms/model/MetricQueryResult.h ) + +set(arms_src + src/ARMSClient.cc + src/model/ARMSQueryDataSetRequest.cc + src/model/ARMSQueryDataSetResult.cc + src/model/MetricQueryRequest.cc + src/model/MetricQueryResult.cc ) + +add_library(arms ${LIB_TYPE} + ${arms_public_header} + ${arms_public_header_model} + ${arms_src}) + +set_target_properties(arms + PROPERTIES + LINKER_LANGUAGE CXX + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}arms + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(arms + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_ARMS_LIBRARY) +endif() + +target_include_directories(arms + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(arms + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(arms + jsoncpp) + target_include_directories(arms + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(arms + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(arms + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(arms + PRIVATE /usr/include/jsoncpp) + target_link_libraries(arms + jsoncpp) +endif() + +install(FILES ${arms_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/arms) +install(FILES ${arms_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/arms/model) +install(TARGETS arms + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/ARMSClient.h b/arms/include/alibabacloud/arms/ARMSClient.h new file mode 100644 index 000000000..652df4dd5 --- /dev/null +++ b/arms/include/alibabacloud/arms/ARMSClient.h @@ -0,0 +1,62 @@ +/* + * 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_ARMSCLIENT_H_ +#define ALIBABACLOUD_ARMS_ARMSCLIENT_H_ + +#include +#include +#include +#include +#include "ARMSExport.h" +#include "model/ARMSQueryDataSetRequest.h" +#include "model/ARMSQueryDataSetResult.h" +#include "model/MetricQueryRequest.h" +#include "model/MetricQueryResult.h" + + +namespace AlibabaCloud +{ + namespace ARMS + { + class ALIBABACLOUD_ARMS_EXPORT ARMSClient : public RpcServiceClient + { + public: + typedef Outcome ARMSQueryDataSetOutcome; + typedef std::future ARMSQueryDataSetOutcomeCallable; + typedef std::function&)> ARMSQueryDataSetAsyncHandler; + typedef Outcome MetricQueryOutcome; + typedef std::future MetricQueryOutcomeCallable; + typedef std::function&)> MetricQueryAsyncHandler; + + ARMSClient(const Credentials &credentials, const ClientConfiguration &configuration); + ARMSClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + ARMSClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~ARMSClient(); + ARMSQueryDataSetOutcome aRMSQueryDataSet(const Model::ARMSQueryDataSetRequest &request)const; + void aRMSQueryDataSetAsync(const Model::ARMSQueryDataSetRequest& request, const ARMSQueryDataSetAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ARMSQueryDataSetOutcomeCallable aRMSQueryDataSetCallable(const Model::ARMSQueryDataSetRequest& request) const; + MetricQueryOutcome metricQuery(const Model::MetricQueryRequest &request)const; + void metricQueryAsync(const Model::MetricQueryRequest& request, const MetricQueryAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + MetricQueryOutcomeCallable metricQueryCallable(const Model::MetricQueryRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_ARMS_ARMSCLIENT_H_ diff --git a/arms/include/alibabacloud/arms/ARMSExport.h b/arms/include/alibabacloud/arms/ARMSExport.h new file mode 100644 index 000000000..6746ec690 --- /dev/null +++ b/arms/include/alibabacloud/arms/ARMSExport.h @@ -0,0 +1,32 @@ +/* + * 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_ARMSEXPORT_H_ +#define ALIBABACLOUD_ARMS_ARMSEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_ARMS_LIBRARY) +# define ALIBABACLOUD_ARMS_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_ARMS_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_ARMS_EXPORT +#endif + +#endif // !ALIBABACLOUD_ARMS_ARMSEXPORT_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/ARMSQueryDataSetRequest.h b/arms/include/alibabacloud/arms/model/ARMSQueryDataSetRequest.h new file mode 100644 index 000000000..488b9a53c --- /dev/null +++ b/arms/include/alibabacloud/arms/model/ARMSQueryDataSetRequest.h @@ -0,0 +1,114 @@ +/* + * 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_ARMSQUERYDATASETREQUEST_H_ +#define ALIBABACLOUD_ARMS_MODEL_ARMSQUERYDATASETREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT ARMSQueryDataSetRequest : public RpcServiceRequest + { + struct OptionalDims + { + std::string type; + std::string value; + std::string key; + }; + struct RequiredDims + { + std::string type; + std::string value; + std::string key; + }; + struct Dimensions + { + std::string type; + std::string value; + std::string key; + }; + + public: + ARMSQueryDataSetRequest(); + ~ARMSQueryDataSetRequest(); + + std::string getDateStr()const; + void setDateStr(const std::string& dateStr); + long getMinTime()const; + void setMinTime(long minTime); + bool getReduceTail()const; + void setReduceTail(bool reduceTail); + long getMaxTime()const; + void setMaxTime(long maxTime); + std::string getAccessKeyId()const; + void setAccessKeyId(const std::string& accessKeyId); + std::vector getOptionalDims()const; + void setOptionalDims(const std::vector& optionalDims); + std::vector getMeasures()const; + void setMeasures(const std::vector& measures); + int getIntervalInSec()const; + void setIntervalInSec(int intervalInSec); + bool getIsDrillDown()const; + void setIsDrillDown(bool isDrillDown); + bool getHungryMode()const; + void setHungryMode(bool hungryMode); + std::string getSecurityToken()const; + void setSecurityToken(const std::string& securityToken); + std::string getRegionId()const; + void setRegionId(const std::string& regionId); + std::string getOrderByKey()const; + void setOrderByKey(const std::string& orderByKey); + int getLimit()const; + void setLimit(int limit); + std::vector getRequiredDims()const; + void setRequiredDims(const std::vector& requiredDims); + long getDatasetId()const; + void setDatasetId(long datasetId); + std::vector getDimensions()const; + void setDimensions(const std::vector& dimensions); + + private: + std::string dateStr_; + long minTime_; + bool reduceTail_; + long maxTime_; + std::string accessKeyId_; + std::vector optionalDims_; + std::vector measures_; + int intervalInSec_; + bool isDrillDown_; + bool hungryMode_; + std::string securityToken_; + std::string regionId_; + std::string orderByKey_; + int limit_; + std::vector requiredDims_; + long datasetId_; + std::vector dimensions_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_ARMSQUERYDATASETREQUEST_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/ARMSQueryDataSetResult.h b/arms/include/alibabacloud/arms/model/ARMSQueryDataSetResult.h new file mode 100644 index 000000000..2fe4e8f39 --- /dev/null +++ b/arms/include/alibabacloud/arms/model/ARMSQueryDataSetResult.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_ARMSQUERYDATASETRESULT_H_ +#define ALIBABACLOUD_ARMS_MODEL_ARMSQUERYDATASETRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT ARMSQueryDataSetResult : public ServiceResult + { + public: + + + ARMSQueryDataSetResult(); + explicit ARMSQueryDataSetResult(const std::string &payload); + ~ARMSQueryDataSetResult(); + std::string getData()const; + + protected: + void parse(const std::string &payload); + private: + std::string data_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_ARMSQUERYDATASETRESULT_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/MetricQueryRequest.h b/arms/include/alibabacloud/arms/model/MetricQueryRequest.h new file mode 100644 index 000000000..fec639499 --- /dev/null +++ b/arms/include/alibabacloud/arms/model/MetricQueryRequest.h @@ -0,0 +1,86 @@ +/* + * 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_METRICQUERYREQUEST_H_ +#define ALIBABACLOUD_ARMS_MODEL_METRICQUERYREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT MetricQueryRequest : public RpcServiceRequest + { + struct Filters + { + std::string value; + std::string key; + }; + + public: + MetricQueryRequest(); + ~MetricQueryRequest(); + + int getIintervalInSec()const; + void setIintervalInSec(int iintervalInSec); + std::vector getMeasures()const; + void setMeasures(const std::vector& measures); + std::string getMetric()const; + void setMetric(const std::string& metric); + std::string getSecurityToken()const; + void setSecurityToken(const std::string& securityToken); + int getLimit()const; + void setLimit(int limit); + long getEndTime()const; + void setEndTime(long endTime); + std::string getOrderBy()const; + void setOrderBy(const std::string& orderBy); + long getStartTime()const; + void setStartTime(long startTime); + std::vector getFilters()const; + void setFilters(const std::vector& filters); + std::vector getDimensions()const; + void setDimensions(const std::vector& dimensions); + std::string getOrder()const; + void setOrder(const std::string& order); + std::string getAccessKeyId()const; + void setAccessKeyId(const std::string& accessKeyId); + + private: + int iintervalInSec_; + std::vector measures_; + std::string metric_; + std::string securityToken_; + int limit_; + long endTime_; + std::string orderBy_; + long startTime_; + std::vector filters_; + std::vector dimensions_; + std::string order_; + std::string accessKeyId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_METRICQUERYREQUEST_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/MetricQueryResult.h b/arms/include/alibabacloud/arms/model/MetricQueryResult.h new file mode 100644 index 000000000..db8761bbb --- /dev/null +++ b/arms/include/alibabacloud/arms/model/MetricQueryResult.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_METRICQUERYRESULT_H_ +#define ALIBABACLOUD_ARMS_MODEL_METRICQUERYRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT MetricQueryResult : public ServiceResult + { + public: + + + MetricQueryResult(); + explicit MetricQueryResult(const std::string &payload); + ~MetricQueryResult(); + std::string getData()const; + + protected: + void parse(const std::string &payload); + private: + std::string data_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_METRICQUERYRESULT_H_ \ No newline at end of file diff --git a/arms/src/ARMSClient.cc b/arms/src/ARMSClient.cc new file mode 100644 index 000000000..a014e3b60 --- /dev/null +++ b/arms/src/ARMSClient.cc @@ -0,0 +1,125 @@ +/* + * 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; +using namespace AlibabaCloud::Location; +using namespace AlibabaCloud::ARMS; +using namespace AlibabaCloud::ARMS::Model; + +namespace +{ + const std::string SERVICE_NAME = "ARMS"; +} + +ARMSClient::ARMSClient(const Credentials &credentials, const ClientConfiguration &configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); +} + +ARMSClient::ARMSClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); +} + +ARMSClient::ARMSClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) +{ + auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); +} + +ARMSClient::~ARMSClient() +{} + +ARMSClient::ARMSQueryDataSetOutcome ARMSClient::aRMSQueryDataSet(const ARMSQueryDataSetRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ARMSQueryDataSetOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ARMSQueryDataSetOutcome(ARMSQueryDataSetResult(outcome.result())); + else + return ARMSQueryDataSetOutcome(outcome.error()); +} + +void ARMSClient::aRMSQueryDataSetAsync(const ARMSQueryDataSetRequest& request, const ARMSQueryDataSetAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, aRMSQueryDataSet(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ARMSClient::ARMSQueryDataSetOutcomeCallable ARMSClient::aRMSQueryDataSetCallable(const ARMSQueryDataSetRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->aRMSQueryDataSet(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +ARMSClient::MetricQueryOutcome ARMSClient::metricQuery(const MetricQueryRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return MetricQueryOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return MetricQueryOutcome(MetricQueryResult(outcome.result())); + else + return MetricQueryOutcome(outcome.error()); +} + +void ARMSClient::metricQueryAsync(const MetricQueryRequest& request, const MetricQueryAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, metricQuery(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ARMSClient::MetricQueryOutcomeCallable ARMSClient::metricQueryCallable(const MetricQueryRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->metricQuery(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/arms/src/model/ARMSQueryDataSetRequest.cc b/arms/src/model/ARMSQueryDataSetRequest.cc new file mode 100644 index 000000000..699964a47 --- /dev/null +++ b/arms/src/model/ARMSQueryDataSetRequest.cc @@ -0,0 +1,236 @@ +/* + * 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::ARMSQueryDataSetRequest; + +ARMSQueryDataSetRequest::ARMSQueryDataSetRequest() : + RpcServiceRequest("arms", "2018-10-15", "ARMSQueryDataSet") +{} + +ARMSQueryDataSetRequest::~ARMSQueryDataSetRequest() +{} + +std::string ARMSQueryDataSetRequest::getDateStr()const +{ + return dateStr_; +} + +void ARMSQueryDataSetRequest::setDateStr(const std::string& dateStr) +{ + dateStr_ = dateStr; + setParameter("DateStr", dateStr); +} + +long ARMSQueryDataSetRequest::getMinTime()const +{ + return minTime_; +} + +void ARMSQueryDataSetRequest::setMinTime(long minTime) +{ + minTime_ = minTime; + setParameter("MinTime", std::to_string(minTime)); +} + +bool ARMSQueryDataSetRequest::getReduceTail()const +{ + return reduceTail_; +} + +void ARMSQueryDataSetRequest::setReduceTail(bool reduceTail) +{ + reduceTail_ = reduceTail; + setParameter("ReduceTail", std::to_string(reduceTail)); +} + +long ARMSQueryDataSetRequest::getMaxTime()const +{ + return maxTime_; +} + +void ARMSQueryDataSetRequest::setMaxTime(long maxTime) +{ + maxTime_ = maxTime; + setParameter("MaxTime", std::to_string(maxTime)); +} + +std::string ARMSQueryDataSetRequest::getAccessKeyId()const +{ + return accessKeyId_; +} + +void ARMSQueryDataSetRequest::setAccessKeyId(const std::string& accessKeyId) +{ + accessKeyId_ = accessKeyId; + setParameter("AccessKeyId", accessKeyId); +} + +std::vector ARMSQueryDataSetRequest::getOptionalDims()const +{ + return optionalDims_; +} + +void ARMSQueryDataSetRequest::setOptionalDims(const std::vector& optionalDims) +{ + optionalDims_ = optionalDims; + int i = 0; + for(int i = 0; i!= optionalDims.size(); i++) { + auto obj = optionalDims.at(i); + std::string str ="OptionalDims."+ std::to_string(i); + setParameter(str + ".Type", obj.type); + setParameter(str + ".Value", obj.value); + setParameter(str + ".Key", obj.key); + } +} + +std::vector ARMSQueryDataSetRequest::getMeasures()const +{ + return measures_; +} + +void ARMSQueryDataSetRequest::setMeasures(const std::vector& measures) +{ + measures_ = measures; + for(int i = 0; i!= measures.size(); i++) + setParameter("Measures."+ std::to_string(i), measures.at(i)); +} + +int ARMSQueryDataSetRequest::getIntervalInSec()const +{ + return intervalInSec_; +} + +void ARMSQueryDataSetRequest::setIntervalInSec(int intervalInSec) +{ + intervalInSec_ = intervalInSec; + setParameter("IntervalInSec", std::to_string(intervalInSec)); +} + +bool ARMSQueryDataSetRequest::getIsDrillDown()const +{ + return isDrillDown_; +} + +void ARMSQueryDataSetRequest::setIsDrillDown(bool isDrillDown) +{ + isDrillDown_ = isDrillDown; + setParameter("IsDrillDown", std::to_string(isDrillDown)); +} + +bool ARMSQueryDataSetRequest::getHungryMode()const +{ + return hungryMode_; +} + +void ARMSQueryDataSetRequest::setHungryMode(bool hungryMode) +{ + hungryMode_ = hungryMode; + setParameter("HungryMode", std::to_string(hungryMode)); +} + +std::string ARMSQueryDataSetRequest::getSecurityToken()const +{ + return securityToken_; +} + +void ARMSQueryDataSetRequest::setSecurityToken(const std::string& securityToken) +{ + securityToken_ = securityToken; + setParameter("SecurityToken", securityToken); +} + +std::string ARMSQueryDataSetRequest::getRegionId()const +{ + return regionId_; +} + +void ARMSQueryDataSetRequest::setRegionId(const std::string& regionId) +{ + regionId_ = regionId; + setParameter("RegionId", regionId); +} + +std::string ARMSQueryDataSetRequest::getOrderByKey()const +{ + return orderByKey_; +} + +void ARMSQueryDataSetRequest::setOrderByKey(const std::string& orderByKey) +{ + orderByKey_ = orderByKey; + setParameter("OrderByKey", orderByKey); +} + +int ARMSQueryDataSetRequest::getLimit()const +{ + return limit_; +} + +void ARMSQueryDataSetRequest::setLimit(int limit) +{ + limit_ = limit; + setParameter("Limit", std::to_string(limit)); +} + +std::vector ARMSQueryDataSetRequest::getRequiredDims()const +{ + return requiredDims_; +} + +void ARMSQueryDataSetRequest::setRequiredDims(const std::vector& requiredDims) +{ + requiredDims_ = requiredDims; + int i = 0; + for(int i = 0; i!= requiredDims.size(); i++) { + auto obj = requiredDims.at(i); + std::string str ="RequiredDims."+ std::to_string(i); + setParameter(str + ".Type", obj.type); + setParameter(str + ".Value", obj.value); + setParameter(str + ".Key", obj.key); + } +} + +long ARMSQueryDataSetRequest::getDatasetId()const +{ + return datasetId_; +} + +void ARMSQueryDataSetRequest::setDatasetId(long datasetId) +{ + datasetId_ = datasetId; + setParameter("DatasetId", std::to_string(datasetId)); +} + +std::vector ARMSQueryDataSetRequest::getDimensions()const +{ + return dimensions_; +} + +void ARMSQueryDataSetRequest::setDimensions(const std::vector& dimensions) +{ + dimensions_ = dimensions; + int i = 0; + for(int i = 0; i!= dimensions.size(); i++) { + auto obj = dimensions.at(i); + std::string str ="Dimensions."+ std::to_string(i); + setParameter(str + ".Type", obj.type); + setParameter(str + ".Value", obj.value); + setParameter(str + ".Key", obj.key); + } +} + diff --git a/arms/src/model/ARMSQueryDataSetResult.cc b/arms/src/model/ARMSQueryDataSetResult.cc new file mode 100644 index 000000000..25f4a9c74 --- /dev/null +++ b/arms/src/model/ARMSQueryDataSetResult.cc @@ -0,0 +1,52 @@ +/* + * 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; + +ARMSQueryDataSetResult::ARMSQueryDataSetResult() : + ServiceResult() +{} + +ARMSQueryDataSetResult::ARMSQueryDataSetResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ARMSQueryDataSetResult::~ARMSQueryDataSetResult() +{} + +void ARMSQueryDataSetResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + if(!value["Data"].isNull()) + data_ = value["Data"].asString(); + +} + +std::string ARMSQueryDataSetResult::getData()const +{ + return data_; +} + diff --git a/arms/src/model/MetricQueryRequest.cc b/arms/src/model/MetricQueryRequest.cc new file mode 100644 index 000000000..4642b50f1 --- /dev/null +++ b/arms/src/model/MetricQueryRequest.cc @@ -0,0 +1,167 @@ +/* + * 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::MetricQueryRequest; + +MetricQueryRequest::MetricQueryRequest() : + RpcServiceRequest("arms", "2018-10-15", "MetricQuery") +{} + +MetricQueryRequest::~MetricQueryRequest() +{} + +int MetricQueryRequest::getIintervalInSec()const +{ + return iintervalInSec_; +} + +void MetricQueryRequest::setIintervalInSec(int iintervalInSec) +{ + iintervalInSec_ = iintervalInSec; + setParameter("IintervalInSec", std::to_string(iintervalInSec)); +} + +std::vector MetricQueryRequest::getMeasures()const +{ + return measures_; +} + +void MetricQueryRequest::setMeasures(const std::vector& measures) +{ + measures_ = measures; + for(int i = 0; i!= measures.size(); i++) + setParameter("Measures."+ std::to_string(i), measures.at(i)); +} + +std::string MetricQueryRequest::getMetric()const +{ + return metric_; +} + +void MetricQueryRequest::setMetric(const std::string& metric) +{ + metric_ = metric; + setParameter("Metric", metric); +} + +std::string MetricQueryRequest::getSecurityToken()const +{ + return securityToken_; +} + +void MetricQueryRequest::setSecurityToken(const std::string& securityToken) +{ + securityToken_ = securityToken; + setParameter("SecurityToken", securityToken); +} + +int MetricQueryRequest::getLimit()const +{ + return limit_; +} + +void MetricQueryRequest::setLimit(int limit) +{ + limit_ = limit; + setParameter("Limit", std::to_string(limit)); +} + +long MetricQueryRequest::getEndTime()const +{ + return endTime_; +} + +void MetricQueryRequest::setEndTime(long endTime) +{ + endTime_ = endTime; + setParameter("EndTime", std::to_string(endTime)); +} + +std::string MetricQueryRequest::getOrderBy()const +{ + return orderBy_; +} + +void MetricQueryRequest::setOrderBy(const std::string& orderBy) +{ + orderBy_ = orderBy; + setParameter("OrderBy", orderBy); +} + +long MetricQueryRequest::getStartTime()const +{ + return startTime_; +} + +void MetricQueryRequest::setStartTime(long startTime) +{ + startTime_ = startTime; + setParameter("StartTime", std::to_string(startTime)); +} + +std::vector MetricQueryRequest::getFilters()const +{ + return filters_; +} + +void MetricQueryRequest::setFilters(const std::vector& filters) +{ + filters_ = filters; + int i = 0; + for(int i = 0; i!= filters.size(); i++) { + auto obj = filters.at(i); + std::string str ="Filters."+ std::to_string(i); + setParameter(str + ".Value", obj.value); + setParameter(str + ".Key", obj.key); + } +} + +std::vector MetricQueryRequest::getDimensions()const +{ + return dimensions_; +} + +void MetricQueryRequest::setDimensions(const std::vector& dimensions) +{ + dimensions_ = dimensions; + for(int i = 0; i!= dimensions.size(); i++) + setParameter("Dimensions."+ std::to_string(i), dimensions.at(i)); +} + +std::string MetricQueryRequest::getOrder()const +{ + return order_; +} + +void MetricQueryRequest::setOrder(const std::string& order) +{ + order_ = order; + setParameter("Order", order); +} + +std::string MetricQueryRequest::getAccessKeyId()const +{ + return accessKeyId_; +} + +void MetricQueryRequest::setAccessKeyId(const std::string& accessKeyId) +{ + accessKeyId_ = accessKeyId; + setParameter("AccessKeyId", accessKeyId); +} + diff --git a/arms/src/model/MetricQueryResult.cc b/arms/src/model/MetricQueryResult.cc new file mode 100644 index 000000000..faec5c30d --- /dev/null +++ b/arms/src/model/MetricQueryResult.cc @@ -0,0 +1,52 @@ +/* + * 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; + +MetricQueryResult::MetricQueryResult() : + ServiceResult() +{} + +MetricQueryResult::MetricQueryResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +MetricQueryResult::~MetricQueryResult() +{} + +void MetricQueryResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + if(!value["Data"].isNull()) + data_ = value["Data"].asString(); + +} + +std::string MetricQueryResult::getData()const +{ + return data_; +} +