diff --git a/CMakeLists.txt b/CMakeLists.txt index cfc53cbf4..c9af7cc43 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,4 +56,5 @@ add_subdirectory(vpc) add_subdirectory(cdn) add_subdirectory(rds) add_subdirectory(cloudphoto) -add_subdirectory(ess) \ No newline at end of file +add_subdirectory(ess) +add_subdirectory(tesladam) \ No newline at end of file diff --git a/VERSION b/VERSION index 1464c521f..ece61c601 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.5 \ No newline at end of file +1.0.6 \ No newline at end of file diff --git a/tesladam/CMakeLists.txt b/tesladam/CMakeLists.txt new file mode 100644 index 000000000..06adb48f9 --- /dev/null +++ b/tesladam/CMakeLists.txt @@ -0,0 +1,94 @@ +# +# 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(tesladam_public_header + include/alibabacloud/tesladam/model/ActionDiskRmaRequest.h + include/alibabacloud/tesladam/model/ActionDiskRmaResult.h + include/alibabacloud/tesladam/model/ActionDiskMaskRequest.h + include/alibabacloud/tesladam/model/ActionDiskMaskResult.h + include/alibabacloud/tesladam/model/ActionDiskCheckRequest.h + include/alibabacloud/tesladam/model/ActionDiskCheckResult.h + include/alibabacloud/tesladam/model/HostGetsRequest.h + include/alibabacloud/tesladam/model/HostGetsResult.h + include/alibabacloud/tesladam/TeslaDamClient.h + include/alibabacloud/tesladam/TeslaDamExport.h + include/alibabacloud/tesladam/TeslaDamRequest.h + ) + +set(tesladam_src + src/model/ActionDiskRmaRequest.cc + src/model/ActionDiskRmaResult.cc + src/model/ActionDiskMaskRequest.cc + src/model/ActionDiskMaskResult.cc + src/model/ActionDiskCheckRequest.cc + src/model/ActionDiskCheckResult.cc + src/model/HostGetsRequest.cc + src/model/HostGetsResult.cc + src/TeslaDamClient.cc + src/TeslaDamRequest.cc + ) + +add_library(tesladam ${LIB_TYPE} ${tesladam_public_header} ${tesladam_src}) + +set_target_properties(tesladam + 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}tesladam + PUBLIC_HEADER "${tesladam_public_header}" + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(tesladam + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_TESLADAM_LIBRARY) +endif() + +target_include_directories(tesladam + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(tesladam + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(tesladam + jsoncpp) + target_include_directories(tesladam + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(tesladam + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(tesladam + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(tesladam + PRIVATE /usr/include/jsoncpp) + target_link_libraries(tesladam + jsoncpp) +endif() + +install(TARGETS tesladam + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/tesladam + ) diff --git a/tesladam/ChangeLog.txt b/tesladam/ChangeLog.txt new file mode 100644 index 000000000..e263ad197 --- /dev/null +++ b/tesladam/ChangeLog.txt @@ -0,0 +1,4 @@ +2018-01-23 Version: 1.0.6 +1, Tesla Dam API release. +2, Add ActionDiskCheck, ActionDiskMask, ActionDiskRma, HostGets. + diff --git a/tesladam/include/alibabacloud/tesladam/TeslaDamClient.h b/tesladam/include/alibabacloud/tesladam/TeslaDamClient.h new file mode 100644 index 000000000..91c84b8a0 --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/TeslaDamClient.h @@ -0,0 +1,81 @@ +/* + * 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_TESLADAM_TESLADAMCLIENT_H_ +#define ALIBABACLOUD_TESLADAM_TESLADAMCLIENT_H_ + +#include +#include +#include +#include +#include "TeslaDamExport.h" +#include "model/ActionDiskRmaRequest.h" +#include "model/ActionDiskRmaResult.h" +#include "model/ActionDiskMaskRequest.h" +#include "model/ActionDiskMaskResult.h" +#include "model/ActionDiskCheckRequest.h" +#include "model/ActionDiskCheckResult.h" +#include "model/HostGetsRequest.h" +#include "model/HostGetsResult.h" + + +namespace AlibabaCloud +{ + namespace TeslaDam + { + class ALIBABACLOUD_TESLADAM_EXPORT TeslaDamClient : public RpcServiceClient + { + public: + typedef Outcome ActionDiskRmaOutcome; + typedef std::future ActionDiskRmaOutcomeCallable; + typedef std::function&)> ActionDiskRmaAsyncHandler; + typedef Outcome ActionDiskMaskOutcome; + typedef std::future ActionDiskMaskOutcomeCallable; + typedef std::function&)> ActionDiskMaskAsyncHandler; + typedef Outcome ActionDiskCheckOutcome; + typedef std::future ActionDiskCheckOutcomeCallable; + typedef std::function&)> ActionDiskCheckAsyncHandler; + typedef Outcome HostGetsOutcome; + typedef std::future HostGetsOutcomeCallable; + typedef std::function&)> HostGetsAsyncHandler; + + + TeslaDamClient(const Credentials &credentials, const ClientConfiguration &configuration); + TeslaDamClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + TeslaDamClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~TeslaDamClient(); + + ActionDiskRmaOutcome actionDiskRma(const Model::ActionDiskRmaRequest &request)const; + void actionDiskRmaAsync(const Model::ActionDiskRmaRequest& request, const ActionDiskRmaAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ActionDiskRmaOutcomeCallable actionDiskRmaCallable(const Model::ActionDiskRmaRequest& request) const; + ActionDiskMaskOutcome actionDiskMask(const Model::ActionDiskMaskRequest &request)const; + void actionDiskMaskAsync(const Model::ActionDiskMaskRequest& request, const ActionDiskMaskAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ActionDiskMaskOutcomeCallable actionDiskMaskCallable(const Model::ActionDiskMaskRequest& request) const; + ActionDiskCheckOutcome actionDiskCheck(const Model::ActionDiskCheckRequest &request)const; + void actionDiskCheckAsync(const Model::ActionDiskCheckRequest& request, const ActionDiskCheckAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ActionDiskCheckOutcomeCallable actionDiskCheckCallable(const Model::ActionDiskCheckRequest& request) const; + HostGetsOutcome hostGets(const Model::HostGetsRequest &request)const; + void hostGetsAsync(const Model::HostGetsRequest& request, const HostGetsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + HostGetsOutcomeCallable hostGetsCallable(const Model::HostGetsRequest& request) const; + + private: + virtual EndpointOutcome endpoint()const override; + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_TESLADAM_TESLADAMCLIENT_H_ diff --git a/tesladam/include/alibabacloud/tesladam/TeslaDamExport.h b/tesladam/include/alibabacloud/tesladam/TeslaDamExport.h new file mode 100644 index 000000000..65f28b861 --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/TeslaDamExport.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_TESLADAM_TESLADAMEXPORT_H_ +#define ALIBABACLOUD_TESLADAM_TESLADAMEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_TESLADAM_LIBRARY) +# define ALIBABACLOUD_TESLADAM_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_TESLADAM_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_TESLADAM_EXPORT +#endif + +#endif // !ALIBABACLOUD_TESLADAM_TESLADAMEXPORT_H_ \ No newline at end of file diff --git a/tesladam/include/alibabacloud/tesladam/TeslaDamRequest.h b/tesladam/include/alibabacloud/tesladam/TeslaDamRequest.h new file mode 100644 index 000000000..d34e2f7ce --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/TeslaDamRequest.h @@ -0,0 +1,39 @@ +/* + * 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_TESLADAM_TESLADAMREQUEST_H_ +#define ALIBABACLOUD_TESLADAM_TESLADAMREQUEST_H_ + +#include +#include "TeslaDamExport.h" + +namespace AlibabaCloud +{ + namespace TeslaDam + { + class ALIBABACLOUD_TESLADAM_EXPORT TeslaDamRequest : public RpcServiceRequest + { + public: + explicit TeslaDamRequest(const std::string & action); + virtual ~TeslaDamRequest(); + + private: + + }; + } +} + +#endif // !ALIBABACLOUD_TESLADAM_TESLADAMREQUEST_H_ \ No newline at end of file diff --git a/tesladam/include/alibabacloud/tesladam/model/ActionDiskCheckRequest.h b/tesladam/include/alibabacloud/tesladam/model/ActionDiskCheckRequest.h new file mode 100644 index 000000000..4be3b468d --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/model/ActionDiskCheckRequest.h @@ -0,0 +1,50 @@ +/* + * 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_TESLADAM_MODEL_ACTIONDISKCHECKREQUEST_H_ +#define ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKCHECKREQUEST_H_ + +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaDam + { + namespace Model + { + class ALIBABACLOUD_TESLADAM_EXPORT ActionDiskCheckRequest : public TeslaDamRequest + { + + public: + ActionDiskCheckRequest(); + ~ActionDiskCheckRequest(); + + std::string getDiskMount()const; + void setDiskMount(const std::string& diskMount); + std::string getIp()const; + void setIp(const std::string& ip); + + private: + std::string diskMount_; + std::string ip_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKCHECKREQUEST_H_ \ No newline at end of file diff --git a/tesladam/include/alibabacloud/tesladam/model/ActionDiskCheckResult.h b/tesladam/include/alibabacloud/tesladam/model/ActionDiskCheckResult.h new file mode 100644 index 000000000..b411ab676 --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/model/ActionDiskCheckResult.h @@ -0,0 +1,55 @@ +/* + * 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_TESLADAM_MODEL_ACTIONDISKCHECKRESULT_H_ +#define ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKCHECKRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaDam + { + namespace Model + { + class ALIBABACLOUD_TESLADAM_EXPORT ActionDiskCheckResult : public ServiceResult + { + public: + + + ActionDiskCheckResult(); + explicit ActionDiskCheckResult(const std::string &payload); + ~ActionDiskCheckResult(); + bool getStatus()const; + std::string getMessage()const; + std::string getResult()const; + + protected: + void parse(const std::string &payload); + private: + bool status_; + std::string message_; + std::string result_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKCHECKRESULT_H_ \ No newline at end of file diff --git a/tesladam/include/alibabacloud/tesladam/model/ActionDiskMaskRequest.h b/tesladam/include/alibabacloud/tesladam/model/ActionDiskMaskRequest.h new file mode 100644 index 000000000..44e797ce4 --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/model/ActionDiskMaskRequest.h @@ -0,0 +1,53 @@ +/* + * 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_TESLADAM_MODEL_ACTIONDISKMASKREQUEST_H_ +#define ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKMASKREQUEST_H_ + +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaDam + { + namespace Model + { + class ALIBABACLOUD_TESLADAM_EXPORT ActionDiskMaskRequest : public TeslaDamRequest + { + + public: + ActionDiskMaskRequest(); + ~ActionDiskMaskRequest(); + + std::string getOp()const; + void setOp(const std::string& op); + std::string getDiskMount()const; + void setDiskMount(const std::string& diskMount); + std::string getIp()const; + void setIp(const std::string& ip); + + private: + std::string op_; + std::string diskMount_; + std::string ip_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKMASKREQUEST_H_ \ No newline at end of file diff --git a/tesladam/include/alibabacloud/tesladam/model/ActionDiskMaskResult.h b/tesladam/include/alibabacloud/tesladam/model/ActionDiskMaskResult.h new file mode 100644 index 000000000..32de75321 --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/model/ActionDiskMaskResult.h @@ -0,0 +1,55 @@ +/* + * 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_TESLADAM_MODEL_ACTIONDISKMASKRESULT_H_ +#define ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKMASKRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaDam + { + namespace Model + { + class ALIBABACLOUD_TESLADAM_EXPORT ActionDiskMaskResult : public ServiceResult + { + public: + + + ActionDiskMaskResult(); + explicit ActionDiskMaskResult(const std::string &payload); + ~ActionDiskMaskResult(); + bool getStatus()const; + std::string getMessage()const; + std::string getResult()const; + + protected: + void parse(const std::string &payload); + private: + bool status_; + std::string message_; + std::string result_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKMASKRESULT_H_ \ No newline at end of file diff --git a/tesladam/include/alibabacloud/tesladam/model/ActionDiskRmaRequest.h b/tesladam/include/alibabacloud/tesladam/model/ActionDiskRmaRequest.h new file mode 100644 index 000000000..1d04b8392 --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/model/ActionDiskRmaRequest.h @@ -0,0 +1,65 @@ +/* + * 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_TESLADAM_MODEL_ACTIONDISKRMAREQUEST_H_ +#define ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKRMAREQUEST_H_ + +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaDam + { + namespace Model + { + class ALIBABACLOUD_TESLADAM_EXPORT ActionDiskRmaRequest : public TeslaDamRequest + { + + public: + ActionDiskRmaRequest(); + ~ActionDiskRmaRequest(); + + std::string getDiskName()const; + void setDiskName(const std::string& diskName); + std::string getExecutionId()const; + void setExecutionId(const std::string& executionId); + std::string getDiskSlot()const; + void setDiskSlot(const std::string& diskSlot); + std::string getHostname()const; + void setHostname(const std::string& hostname); + std::string getDiskMount()const; + void setDiskMount(const std::string& diskMount); + std::string getDiskReason()const; + void setDiskReason(const std::string& diskReason); + std::string getDiskSn()const; + void setDiskSn(const std::string& diskSn); + + private: + std::string diskName_; + std::string executionId_; + std::string diskSlot_; + std::string hostname_; + std::string diskMount_; + std::string diskReason_; + std::string diskSn_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKRMAREQUEST_H_ \ No newline at end of file diff --git a/tesladam/include/alibabacloud/tesladam/model/ActionDiskRmaResult.h b/tesladam/include/alibabacloud/tesladam/model/ActionDiskRmaResult.h new file mode 100644 index 000000000..314024a27 --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/model/ActionDiskRmaResult.h @@ -0,0 +1,55 @@ +/* + * 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_TESLADAM_MODEL_ACTIONDISKRMARESULT_H_ +#define ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKRMARESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaDam + { + namespace Model + { + class ALIBABACLOUD_TESLADAM_EXPORT ActionDiskRmaResult : public ServiceResult + { + public: + + + ActionDiskRmaResult(); + explicit ActionDiskRmaResult(const std::string &payload); + ~ActionDiskRmaResult(); + bool getStatus()const; + std::string getMessage()const; + std::string getResult()const; + + protected: + void parse(const std::string &payload); + private: + bool status_; + std::string message_; + std::string result_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLADAM_MODEL_ACTIONDISKRMARESULT_H_ \ No newline at end of file diff --git a/tesladam/include/alibabacloud/tesladam/model/HostGetsRequest.h b/tesladam/include/alibabacloud/tesladam/model/HostGetsRequest.h new file mode 100644 index 000000000..5dd0872cd --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/model/HostGetsRequest.h @@ -0,0 +1,56 @@ +/* + * 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_TESLADAM_MODEL_HOSTGETSREQUEST_H_ +#define ALIBABACLOUD_TESLADAM_MODEL_HOSTGETSREQUEST_H_ + +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaDam + { + namespace Model + { + class ALIBABACLOUD_TESLADAM_EXPORT HostGetsRequest : public TeslaDamRequest + { + + public: + HostGetsRequest(); + ~HostGetsRequest(); + + std::string getQuery()const; + void setQuery(const std::string& query); + int getEndTime()const; + void setEndTime(int endTime); + int getStartTime()const; + void setStartTime(int startTime); + std::string getQueryType()const; + void setQueryType(const std::string& queryType); + + private: + std::string query_; + int endTime_; + int startTime_; + std::string queryType_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLADAM_MODEL_HOSTGETSREQUEST_H_ \ No newline at end of file diff --git a/tesladam/include/alibabacloud/tesladam/model/HostGetsResult.h b/tesladam/include/alibabacloud/tesladam/model/HostGetsResult.h new file mode 100644 index 000000000..d912a8b89 --- /dev/null +++ b/tesladam/include/alibabacloud/tesladam/model/HostGetsResult.h @@ -0,0 +1,66 @@ +/* + * 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_TESLADAM_MODEL_HOSTGETSRESULT_H_ +#define ALIBABACLOUD_TESLADAM_MODEL_HOSTGETSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaDam + { + namespace Model + { + class ALIBABACLOUD_TESLADAM_EXPORT HostGetsResult : public ServiceResult + { + public: + struct DataItem + { + std::string appCode; + std::string clusterCode; + int healthScoreLast; + std::string ip; + std::string hostname; + std::string healthReasonLast; + int sshStatus; + int heartStatus; + }; + + + HostGetsResult(); + explicit HostGetsResult(const std::string &payload); + ~HostGetsResult(); + bool getStatus()const; + std::string getMessage()const; + std::vector getData()const; + + protected: + void parse(const std::string &payload); + private: + bool status_; + std::string message_; + std::vector data_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLADAM_MODEL_HOSTGETSRESULT_H_ \ No newline at end of file diff --git a/tesladam/src/TeslaDamClient.cc b/tesladam/src/TeslaDamClient.cc new file mode 100644 index 000000000..3bfd07d3e --- /dev/null +++ b/tesladam/src/TeslaDamClient.cc @@ -0,0 +1,205 @@ +/* + * 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::TeslaDam; +using namespace AlibabaCloud::TeslaDam::Model; + +TeslaDamClient::TeslaDamClient(const Credentials &credentials, const ClientConfiguration &configuration) : + RpcServiceClient(std::make_shared(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), ""); +} + +TeslaDamClient::TeslaDamClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RpcServiceClient(credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), ""); +} + +TeslaDamClient::TeslaDamClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : + RpcServiceClient(std::make_shared(accessKeyId, accessKeySecret), configuration) +{ + auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), ""); +} + +TeslaDamClient::~TeslaDamClient() +{} + +CoreClient::EndpointOutcome TeslaDamClient::endpoint()const +{ + if(!configuration().endpoint().empty()) + return CoreClient::EndpointOutcome(configuration().endpoint()); + + auto endpoint = endpointProvider_->getEndpoint(); + + if (endpoint.empty()) + return CoreClient::EndpointOutcome(Error("InvalidEndpoint","")); + else + return CoreClient::EndpointOutcome(endpoint); +} + +TeslaDamClient::ActionDiskRmaOutcome TeslaDamClient::actionDiskRma(const ActionDiskRmaRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return ActionDiskRmaOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ActionDiskRmaOutcome(ActionDiskRmaResult(outcome.result())); + else + return ActionDiskRmaOutcome(outcome.error()); +} + +void TeslaDamClient::actionDiskRmaAsync(const ActionDiskRmaRequest& request, const ActionDiskRmaAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, actionDiskRma(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaDamClient::ActionDiskRmaOutcomeCallable TeslaDamClient::actionDiskRmaCallable(const ActionDiskRmaRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->actionDiskRma(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +TeslaDamClient::ActionDiskMaskOutcome TeslaDamClient::actionDiskMask(const ActionDiskMaskRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return ActionDiskMaskOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ActionDiskMaskOutcome(ActionDiskMaskResult(outcome.result())); + else + return ActionDiskMaskOutcome(outcome.error()); +} + +void TeslaDamClient::actionDiskMaskAsync(const ActionDiskMaskRequest& request, const ActionDiskMaskAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, actionDiskMask(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaDamClient::ActionDiskMaskOutcomeCallable TeslaDamClient::actionDiskMaskCallable(const ActionDiskMaskRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->actionDiskMask(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +TeslaDamClient::ActionDiskCheckOutcome TeslaDamClient::actionDiskCheck(const ActionDiskCheckRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return ActionDiskCheckOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ActionDiskCheckOutcome(ActionDiskCheckResult(outcome.result())); + else + return ActionDiskCheckOutcome(outcome.error()); +} + +void TeslaDamClient::actionDiskCheckAsync(const ActionDiskCheckRequest& request, const ActionDiskCheckAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, actionDiskCheck(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaDamClient::ActionDiskCheckOutcomeCallable TeslaDamClient::actionDiskCheckCallable(const ActionDiskCheckRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->actionDiskCheck(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +TeslaDamClient::HostGetsOutcome TeslaDamClient::hostGets(const HostGetsRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return HostGetsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return HostGetsOutcome(HostGetsResult(outcome.result())); + else + return HostGetsOutcome(outcome.error()); +} + +void TeslaDamClient::hostGetsAsync(const HostGetsRequest& request, const HostGetsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, hostGets(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaDamClient::HostGetsOutcomeCallable TeslaDamClient::hostGetsCallable(const HostGetsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->hostGets(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/tesladam/src/TeslaDamRequest.cc b/tesladam/src/TeslaDamRequest.cc new file mode 100644 index 000000000..e1830d001 --- /dev/null +++ b/tesladam/src/TeslaDamRequest.cc @@ -0,0 +1,27 @@ +/* + * 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 namespace AlibabaCloud; +using namespace AlibabaCloud::TeslaDam; + +TeslaDamRequest::TeslaDamRequest(const std::string & action) : + RpcServiceRequest("tesladam", "2018-01-18", action) +{ } + +TeslaDamRequest::~TeslaDamRequest() +{ } \ No newline at end of file diff --git a/tesladam/src/model/ActionDiskCheckRequest.cc b/tesladam/src/model/ActionDiskCheckRequest.cc new file mode 100644 index 000000000..6dcb09c14 --- /dev/null +++ b/tesladam/src/model/ActionDiskCheckRequest.cc @@ -0,0 +1,50 @@ +/* + * 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 namespace AlibabaCloud::TeslaDam; +using namespace AlibabaCloud::TeslaDam::Model; + +ActionDiskCheckRequest::ActionDiskCheckRequest() : + TeslaDamRequest("ActionDiskCheck") +{} + +ActionDiskCheckRequest::~ActionDiskCheckRequest() +{} + +std::string ActionDiskCheckRequest::getDiskMount()const +{ + return diskMount_; +} + +void ActionDiskCheckRequest::setDiskMount(const std::string& diskMount) +{ + diskMount_ = diskMount; + setParameter("DiskMount", diskMount); +} + +std::string ActionDiskCheckRequest::getIp()const +{ + return ip_; +} + +void ActionDiskCheckRequest::setIp(const std::string& ip) +{ + ip_ = ip; + setParameter("Ip", ip); +} + diff --git a/tesladam/src/model/ActionDiskCheckResult.cc b/tesladam/src/model/ActionDiskCheckResult.cc new file mode 100644 index 000000000..adb6506b2 --- /dev/null +++ b/tesladam/src/model/ActionDiskCheckResult.cc @@ -0,0 +1,66 @@ +/* + * 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::TeslaDam; +using namespace AlibabaCloud::TeslaDam::Model; + +ActionDiskCheckResult::ActionDiskCheckResult() : + ServiceResult() +{} + +ActionDiskCheckResult::ActionDiskCheckResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ActionDiskCheckResult::~ActionDiskCheckResult() +{} + +void ActionDiskCheckResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + if(!value["Status"].isNull()) + status_ = value["Status"].asString() == "true"; + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + if(!value["Result"].isNull()) + result_ = value["Result"].asString(); + +} + +bool ActionDiskCheckResult::getStatus()const +{ + return status_; +} + +std::string ActionDiskCheckResult::getMessage()const +{ + return message_; +} + +std::string ActionDiskCheckResult::getResult()const +{ + return result_; +} + diff --git a/tesladam/src/model/ActionDiskMaskRequest.cc b/tesladam/src/model/ActionDiskMaskRequest.cc new file mode 100644 index 000000000..9b16af0a9 --- /dev/null +++ b/tesladam/src/model/ActionDiskMaskRequest.cc @@ -0,0 +1,61 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using namespace AlibabaCloud::TeslaDam; +using namespace AlibabaCloud::TeslaDam::Model; + +ActionDiskMaskRequest::ActionDiskMaskRequest() : + TeslaDamRequest("ActionDiskMask") +{} + +ActionDiskMaskRequest::~ActionDiskMaskRequest() +{} + +std::string ActionDiskMaskRequest::getOp()const +{ + return op_; +} + +void ActionDiskMaskRequest::setOp(const std::string& op) +{ + op_ = op; + setParameter("Op", op); +} + +std::string ActionDiskMaskRequest::getDiskMount()const +{ + return diskMount_; +} + +void ActionDiskMaskRequest::setDiskMount(const std::string& diskMount) +{ + diskMount_ = diskMount; + setParameter("DiskMount", diskMount); +} + +std::string ActionDiskMaskRequest::getIp()const +{ + return ip_; +} + +void ActionDiskMaskRequest::setIp(const std::string& ip) +{ + ip_ = ip; + setParameter("Ip", ip); +} + diff --git a/tesladam/src/model/ActionDiskMaskResult.cc b/tesladam/src/model/ActionDiskMaskResult.cc new file mode 100644 index 000000000..397bd086b --- /dev/null +++ b/tesladam/src/model/ActionDiskMaskResult.cc @@ -0,0 +1,66 @@ +/* + * 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::TeslaDam; +using namespace AlibabaCloud::TeslaDam::Model; + +ActionDiskMaskResult::ActionDiskMaskResult() : + ServiceResult() +{} + +ActionDiskMaskResult::ActionDiskMaskResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ActionDiskMaskResult::~ActionDiskMaskResult() +{} + +void ActionDiskMaskResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + if(!value["Status"].isNull()) + status_ = value["Status"].asString() == "true"; + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + if(!value["Result"].isNull()) + result_ = value["Result"].asString(); + +} + +bool ActionDiskMaskResult::getStatus()const +{ + return status_; +} + +std::string ActionDiskMaskResult::getMessage()const +{ + return message_; +} + +std::string ActionDiskMaskResult::getResult()const +{ + return result_; +} + diff --git a/tesladam/src/model/ActionDiskRmaRequest.cc b/tesladam/src/model/ActionDiskRmaRequest.cc new file mode 100644 index 000000000..8034d7171 --- /dev/null +++ b/tesladam/src/model/ActionDiskRmaRequest.cc @@ -0,0 +1,105 @@ +/* + * 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 namespace AlibabaCloud::TeslaDam; +using namespace AlibabaCloud::TeslaDam::Model; + +ActionDiskRmaRequest::ActionDiskRmaRequest() : + TeslaDamRequest("ActionDiskRma") +{} + +ActionDiskRmaRequest::~ActionDiskRmaRequest() +{} + +std::string ActionDiskRmaRequest::getDiskName()const +{ + return diskName_; +} + +void ActionDiskRmaRequest::setDiskName(const std::string& diskName) +{ + diskName_ = diskName; + setParameter("DiskName", diskName); +} + +std::string ActionDiskRmaRequest::getExecutionId()const +{ + return executionId_; +} + +void ActionDiskRmaRequest::setExecutionId(const std::string& executionId) +{ + executionId_ = executionId; + setParameter("ExecutionId", executionId); +} + +std::string ActionDiskRmaRequest::getDiskSlot()const +{ + return diskSlot_; +} + +void ActionDiskRmaRequest::setDiskSlot(const std::string& diskSlot) +{ + diskSlot_ = diskSlot; + setParameter("DiskSlot", diskSlot); +} + +std::string ActionDiskRmaRequest::getHostname()const +{ + return hostname_; +} + +void ActionDiskRmaRequest::setHostname(const std::string& hostname) +{ + hostname_ = hostname; + setParameter("Hostname", hostname); +} + +std::string ActionDiskRmaRequest::getDiskMount()const +{ + return diskMount_; +} + +void ActionDiskRmaRequest::setDiskMount(const std::string& diskMount) +{ + diskMount_ = diskMount; + setParameter("DiskMount", diskMount); +} + +std::string ActionDiskRmaRequest::getDiskReason()const +{ + return diskReason_; +} + +void ActionDiskRmaRequest::setDiskReason(const std::string& diskReason) +{ + diskReason_ = diskReason; + setParameter("DiskReason", diskReason); +} + +std::string ActionDiskRmaRequest::getDiskSn()const +{ + return diskSn_; +} + +void ActionDiskRmaRequest::setDiskSn(const std::string& diskSn) +{ + diskSn_ = diskSn; + setParameter("DiskSn", diskSn); +} + diff --git a/tesladam/src/model/ActionDiskRmaResult.cc b/tesladam/src/model/ActionDiskRmaResult.cc new file mode 100644 index 000000000..2e7015f30 --- /dev/null +++ b/tesladam/src/model/ActionDiskRmaResult.cc @@ -0,0 +1,66 @@ +/* + * 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::TeslaDam; +using namespace AlibabaCloud::TeslaDam::Model; + +ActionDiskRmaResult::ActionDiskRmaResult() : + ServiceResult() +{} + +ActionDiskRmaResult::ActionDiskRmaResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ActionDiskRmaResult::~ActionDiskRmaResult() +{} + +void ActionDiskRmaResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + if(!value["Status"].isNull()) + status_ = value["Status"].asString() == "true"; + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + if(!value["Result"].isNull()) + result_ = value["Result"].asString(); + +} + +bool ActionDiskRmaResult::getStatus()const +{ + return status_; +} + +std::string ActionDiskRmaResult::getMessage()const +{ + return message_; +} + +std::string ActionDiskRmaResult::getResult()const +{ + return result_; +} + diff --git a/tesladam/src/model/HostGetsRequest.cc b/tesladam/src/model/HostGetsRequest.cc new file mode 100644 index 000000000..ca45215a1 --- /dev/null +++ b/tesladam/src/model/HostGetsRequest.cc @@ -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. + */ + +#include + +using namespace AlibabaCloud::TeslaDam; +using namespace AlibabaCloud::TeslaDam::Model; + +HostGetsRequest::HostGetsRequest() : + TeslaDamRequest("HostGets") +{} + +HostGetsRequest::~HostGetsRequest() +{} + +std::string HostGetsRequest::getQuery()const +{ + return query_; +} + +void HostGetsRequest::setQuery(const std::string& query) +{ + query_ = query; + setParameter("Query", query); +} + +int HostGetsRequest::getEndTime()const +{ + return endTime_; +} + +void HostGetsRequest::setEndTime(int endTime) +{ + endTime_ = endTime; + setParameter("EndTime", std::to_string(endTime)); +} + +int HostGetsRequest::getStartTime()const +{ + return startTime_; +} + +void HostGetsRequest::setStartTime(int startTime) +{ + startTime_ = startTime; + setParameter("StartTime", std::to_string(startTime)); +} + +std::string HostGetsRequest::getQueryType()const +{ + return queryType_; +} + +void HostGetsRequest::setQueryType(const std::string& queryType) +{ + queryType_ = queryType; + setParameter("QueryType", queryType); +} + diff --git a/tesladam/src/model/HostGetsResult.cc b/tesladam/src/model/HostGetsResult.cc new file mode 100644 index 000000000..cb0186d32 --- /dev/null +++ b/tesladam/src/model/HostGetsResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::TeslaDam; +using namespace AlibabaCloud::TeslaDam::Model; + +HostGetsResult::HostGetsResult() : + ServiceResult() +{} + +HostGetsResult::HostGetsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +HostGetsResult::~HostGetsResult() +{} + +void HostGetsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allData = value["Data"]["dataItem"]; + for (auto value : allData) + { + DataItem dataObject; + if(!value["Hostname"].isNull()) + dataObject.hostname = value["Hostname"].asString(); + if(!value["Ip"].isNull()) + dataObject.ip = value["Ip"].asString(); + if(!value["AppCode"].isNull()) + dataObject.appCode = value["AppCode"].asString(); + if(!value["ClusterCode"].isNull()) + dataObject.clusterCode = value["ClusterCode"].asString(); + if(!value["SshStatus"].isNull()) + dataObject.sshStatus = std::stoi(value["SshStatus"].asString()); + if(!value["heartStatus"].isNull()) + dataObject.heartStatus = std::stoi(value["heartStatus"].asString()); + if(!value["HealthScoreLast"].isNull()) + dataObject.healthScoreLast = std::stoi(value["HealthScoreLast"].asString()); + if(!value["HealthReasonLast"].isNull()) + dataObject.healthReasonLast = value["HealthReasonLast"].asString(); + data_.push_back(dataObject); + } + if(!value["Status"].isNull()) + status_ = value["Status"].asString() == "true"; + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +bool HostGetsResult::getStatus()const +{ + return status_; +} + +std::string HostGetsResult::getMessage()const +{ + return message_; +} + +std::vector HostGetsResult::getData()const +{ + return data_; +} +