diff --git a/CHANGELOG b/CHANGELOG index 631f2b4bf..ec884df51 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2018-02-27 Version: 1.2.3 +1, Add query topology API. + 2018-02-27 Version: 1.2.2 1, Add new API: ListRecordingsByContactId. diff --git a/CMakeLists.txt b/CMakeLists.txt index b116daa83..4062b5a5a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,4 +63,5 @@ add_subdirectory(afs) add_subdirectory(aegis) add_subdirectory(ehpc) add_subdirectory(cs) -add_subdirectory(ccc) \ No newline at end of file +add_subdirectory(ccc) +add_subdirectory(teslamaxcompute) \ No newline at end of file diff --git a/VERSION b/VERSION index d2d61a7e8..e2cac26c1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.2 \ No newline at end of file +1.2.3 \ No newline at end of file diff --git a/teslamaxcompute/CMakeLists.txt b/teslamaxcompute/CMakeLists.txt new file mode 100644 index 000000000..4c24cde91 --- /dev/null +++ b/teslamaxcompute/CMakeLists.txt @@ -0,0 +1,110 @@ +# +# 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(teslamaxcompute_public_header + include/alibabacloud/teslamaxcompute/TeslaMaxComputeClient.h + include/alibabacloud/teslamaxcompute/TeslaMaxComputeExport.h ) + +set(teslamaxcompute_public_header_model + include/alibabacloud/teslamaxcompute/model/GetUserInstanceRequest.h + include/alibabacloud/teslamaxcompute/model/GetUserInstanceResult.h + include/alibabacloud/teslamaxcompute/model/GetProjectInstanceRequest.h + include/alibabacloud/teslamaxcompute/model/GetProjectInstanceResult.h + include/alibabacloud/teslamaxcompute/model/QueryTopologyRequest.h + include/alibabacloud/teslamaxcompute/model/QueryTopologyResult.h + include/alibabacloud/teslamaxcompute/model/GetInstancesStatusCountRequest.h + include/alibabacloud/teslamaxcompute/model/GetInstancesStatusCountResult.h + include/alibabacloud/teslamaxcompute/model/GetQuotaInstanceRequest.h + include/alibabacloud/teslamaxcompute/model/GetQuotaInstanceResult.h + include/alibabacloud/teslamaxcompute/model/GetClusterInstanceRequest.h + include/alibabacloud/teslamaxcompute/model/GetClusterInstanceResult.h + include/alibabacloud/teslamaxcompute/model/GetQuotaHistoryInfoRequest.h + include/alibabacloud/teslamaxcompute/model/GetQuotaHistoryInfoResult.h ) + +set(teslamaxcompute_src + src/TeslaMaxComputeClient.cc + src/model/GetUserInstanceRequest.cc + src/model/GetUserInstanceResult.cc + src/model/GetProjectInstanceRequest.cc + src/model/GetProjectInstanceResult.cc + src/model/QueryTopologyRequest.cc + src/model/QueryTopologyResult.cc + src/model/GetInstancesStatusCountRequest.cc + src/model/GetInstancesStatusCountResult.cc + src/model/GetQuotaInstanceRequest.cc + src/model/GetQuotaInstanceResult.cc + src/model/GetClusterInstanceRequest.cc + src/model/GetClusterInstanceResult.cc + src/model/GetQuotaHistoryInfoRequest.cc + src/model/GetQuotaHistoryInfoResult.cc ) + +add_library(teslamaxcompute ${LIB_TYPE} + ${teslamaxcompute_public_header} + ${teslamaxcompute_public_header_model} + ${teslamaxcompute_src}) + +set_target_properties(teslamaxcompute + 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}teslamaxcompute + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(teslamaxcompute + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_TESLAMAXCOMPUTE_LIBRARY) +endif() + +target_include_directories(teslamaxcompute + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(teslamaxcompute + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(teslamaxcompute + jsoncpp) + target_include_directories(teslamaxcompute + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(teslamaxcompute + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(teslamaxcompute + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(teslamaxcompute + PRIVATE /usr/include/jsoncpp) + target_link_libraries(teslamaxcompute + jsoncpp) +endif() + +install(FILES ${teslamaxcompute_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/teslamaxcompute) +install(FILES ${teslamaxcompute_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/teslamaxcompute/model) +install(TARGETS teslamaxcompute + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/TeslaMaxComputeClient.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/TeslaMaxComputeClient.h new file mode 100644 index 000000000..504fd9b97 --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/TeslaMaxComputeClient.h @@ -0,0 +1,103 @@ +/* + * 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_TESLAMAXCOMPUTE_TESLAMAXCOMPUTECLIENT_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_TESLAMAXCOMPUTECLIENT_H_ + +#include +#include +#include +#include +#include "TeslaMaxComputeExport.h" +#include "model/GetUserInstanceRequest.h" +#include "model/GetUserInstanceResult.h" +#include "model/GetProjectInstanceRequest.h" +#include "model/GetProjectInstanceResult.h" +#include "model/QueryTopologyRequest.h" +#include "model/QueryTopologyResult.h" +#include "model/GetInstancesStatusCountRequest.h" +#include "model/GetInstancesStatusCountResult.h" +#include "model/GetQuotaInstanceRequest.h" +#include "model/GetQuotaInstanceResult.h" +#include "model/GetClusterInstanceRequest.h" +#include "model/GetClusterInstanceResult.h" +#include "model/GetQuotaHistoryInfoRequest.h" +#include "model/GetQuotaHistoryInfoResult.h" + + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT TeslaMaxComputeClient : public RpcServiceClient + { + public: + typedef Outcome GetUserInstanceOutcome; + typedef std::future GetUserInstanceOutcomeCallable; + typedef std::function&)> GetUserInstanceAsyncHandler; + typedef Outcome GetProjectInstanceOutcome; + typedef std::future GetProjectInstanceOutcomeCallable; + typedef std::function&)> GetProjectInstanceAsyncHandler; + typedef Outcome QueryTopologyOutcome; + typedef std::future QueryTopologyOutcomeCallable; + typedef std::function&)> QueryTopologyAsyncHandler; + typedef Outcome GetInstancesStatusCountOutcome; + typedef std::future GetInstancesStatusCountOutcomeCallable; + typedef std::function&)> GetInstancesStatusCountAsyncHandler; + typedef Outcome GetQuotaInstanceOutcome; + typedef std::future GetQuotaInstanceOutcomeCallable; + typedef std::function&)> GetQuotaInstanceAsyncHandler; + typedef Outcome GetClusterInstanceOutcome; + typedef std::future GetClusterInstanceOutcomeCallable; + typedef std::function&)> GetClusterInstanceAsyncHandler; + typedef Outcome GetQuotaHistoryInfoOutcome; + typedef std::future GetQuotaHistoryInfoOutcomeCallable; + typedef std::function&)> GetQuotaHistoryInfoAsyncHandler; + + TeslaMaxComputeClient(const Credentials &credentials, const ClientConfiguration &configuration); + TeslaMaxComputeClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + TeslaMaxComputeClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~TeslaMaxComputeClient(); + GetUserInstanceOutcome getUserInstance(const Model::GetUserInstanceRequest &request)const; + void getUserInstanceAsync(const Model::GetUserInstanceRequest& request, const GetUserInstanceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetUserInstanceOutcomeCallable getUserInstanceCallable(const Model::GetUserInstanceRequest& request) const; + GetProjectInstanceOutcome getProjectInstance(const Model::GetProjectInstanceRequest &request)const; + void getProjectInstanceAsync(const Model::GetProjectInstanceRequest& request, const GetProjectInstanceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetProjectInstanceOutcomeCallable getProjectInstanceCallable(const Model::GetProjectInstanceRequest& request) const; + QueryTopologyOutcome queryTopology(const Model::QueryTopologyRequest &request)const; + void queryTopologyAsync(const Model::QueryTopologyRequest& request, const QueryTopologyAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + QueryTopologyOutcomeCallable queryTopologyCallable(const Model::QueryTopologyRequest& request) const; + GetInstancesStatusCountOutcome getInstancesStatusCount(const Model::GetInstancesStatusCountRequest &request)const; + void getInstancesStatusCountAsync(const Model::GetInstancesStatusCountRequest& request, const GetInstancesStatusCountAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetInstancesStatusCountOutcomeCallable getInstancesStatusCountCallable(const Model::GetInstancesStatusCountRequest& request) const; + GetQuotaInstanceOutcome getQuotaInstance(const Model::GetQuotaInstanceRequest &request)const; + void getQuotaInstanceAsync(const Model::GetQuotaInstanceRequest& request, const GetQuotaInstanceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetQuotaInstanceOutcomeCallable getQuotaInstanceCallable(const Model::GetQuotaInstanceRequest& request) const; + GetClusterInstanceOutcome getClusterInstance(const Model::GetClusterInstanceRequest &request)const; + void getClusterInstanceAsync(const Model::GetClusterInstanceRequest& request, const GetClusterInstanceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetClusterInstanceOutcomeCallable getClusterInstanceCallable(const Model::GetClusterInstanceRequest& request) const; + GetQuotaHistoryInfoOutcome getQuotaHistoryInfo(const Model::GetQuotaHistoryInfoRequest &request)const; + void getQuotaHistoryInfoAsync(const Model::GetQuotaHistoryInfoRequest& request, const GetQuotaHistoryInfoAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetQuotaHistoryInfoOutcomeCallable getQuotaHistoryInfoCallable(const Model::GetQuotaHistoryInfoRequest& request) const; + + private: + virtual EndpointOutcome endpoint()const override; + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_TESLAMAXCOMPUTECLIENT_H_ diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/TeslaMaxComputeExport.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/TeslaMaxComputeExport.h new file mode 100644 index 000000000..1659762c5 --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/TeslaMaxComputeExport.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_TESLAMAXCOMPUTE_TESLAMAXCOMPUTEEXPORT_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_TESLAMAXCOMPUTEEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_TESLAMAXCOMPUTE_LIBRARY) +# define ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT +#endif + +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_TESLAMAXCOMPUTEEXPORT_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetClusterInstanceRequest.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetClusterInstanceRequest.h new file mode 100644 index 000000000..637d95436 --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetClusterInstanceRequest.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_TESLAMAXCOMPUTE_MODEL_GETCLUSTERINSTANCEREQUEST_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETCLUSTERINSTANCEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetClusterInstanceRequest : public RpcServiceRequest + { + + public: + GetClusterInstanceRequest(); + ~GetClusterInstanceRequest(); + + std::string getCluster()const; + void setCluster(const std::string& cluster); + int getPageSize()const; + void setPageSize(int pageSize); + int getPageNum()const; + void setPageNum(int pageNum); + std::string getRegion()const; + void setRegion(const std::string& region); + std::string getStatus()const; + void setStatus(const std::string& status); + + private: + std::string cluster_; + int pageSize_; + int pageNum_; + std::string region_; + std::string status_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETCLUSTERINSTANCEREQUEST_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetClusterInstanceResult.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetClusterInstanceResult.h new file mode 100644 index 000000000..bb4f72375 --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetClusterInstanceResult.h @@ -0,0 +1,84 @@ +/* + * 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_TESLAMAXCOMPUTE_MODEL_GETCLUSTERINSTANCERESULT_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETCLUSTERINSTANCERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetClusterInstanceResult : public ServiceResult + { + public: + struct Data + { + struct Instance + { + std::string status; + int quotaId; + float cpuUsedRatioMin; + std::string runTime; + std::string skynetId; + long memRequest; + std::string instanceId; + std::string cluster; + float memUsedRatioMax; + std::string nickName; + long memUsedTotal; + float cpuUsedRatioMax; + std::string project; + std::string quotaName; + long memUsed; + long cpuUsedTotal; + std::string taskType; + float memUsedRatioMin; + long cpuUsed; + std::string userAccount; + long cpuRequest; + }; + int total; + std::vector detail; + }; + + + GetClusterInstanceResult(); + explicit GetClusterInstanceResult(const std::string &payload); + ~GetClusterInstanceResult(); + std::string getMessage()const; + std::vector getData()const; + int getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + std::vector data_; + int code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETCLUSTERINSTANCERESULT_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetInstancesStatusCountRequest.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetInstancesStatusCountRequest.h new file mode 100644 index 000000000..81557d38e --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetInstancesStatusCountRequest.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_TESLAMAXCOMPUTE_MODEL_GETINSTANCESSTATUSCOUNTREQUEST_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETINSTANCESSTATUSCOUNTREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetInstancesStatusCountRequest : public RpcServiceRequest + { + + public: + GetInstancesStatusCountRequest(); + ~GetInstancesStatusCountRequest(); + + std::string getCluster()const; + void setCluster(const std::string& cluster); + std::string getRegion()const; + void setRegion(const std::string& region); + + private: + std::string cluster_; + std::string region_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETINSTANCESSTATUSCOUNTREQUEST_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetInstancesStatusCountResult.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetInstancesStatusCountResult.h new file mode 100644 index 000000000..412c748fa --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetInstancesStatusCountResult.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_TESLAMAXCOMPUTE_MODEL_GETINSTANCESSTATUSCOUNTRESULT_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETINSTANCESSTATUSCOUNTRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetInstancesStatusCountResult : public ServiceResult + { + public: + struct DataItem + { + std::string status; + int size; + }; + + + GetInstancesStatusCountResult(); + explicit GetInstancesStatusCountResult(const std::string &payload); + ~GetInstancesStatusCountResult(); + std::string getMessage()const; + std::vector getData()const; + int getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + std::vector data_; + int code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETINSTANCESSTATUSCOUNTRESULT_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetProjectInstanceRequest.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetProjectInstanceRequest.h new file mode 100644 index 000000000..68c9501ca --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetProjectInstanceRequest.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_TESLAMAXCOMPUTE_MODEL_GETPROJECTINSTANCEREQUEST_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETPROJECTINSTANCEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetProjectInstanceRequest : public RpcServiceRequest + { + + public: + GetProjectInstanceRequest(); + ~GetProjectInstanceRequest(); + + int getPageSize()const; + void setPageSize(int pageSize); + std::string getProject()const; + void setProject(const std::string& project); + int getPageNum()const; + void setPageNum(int pageNum); + std::string getRegion()const; + void setRegion(const std::string& region); + std::string getStatus()const; + void setStatus(const std::string& status); + + private: + int pageSize_; + std::string project_; + int pageNum_; + std::string region_; + std::string status_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETPROJECTINSTANCEREQUEST_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetProjectInstanceResult.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetProjectInstanceResult.h new file mode 100644 index 000000000..16ed4da31 --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetProjectInstanceResult.h @@ -0,0 +1,84 @@ +/* + * 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_TESLAMAXCOMPUTE_MODEL_GETPROJECTINSTANCERESULT_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETPROJECTINSTANCERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetProjectInstanceResult : public ServiceResult + { + public: + struct Data + { + struct Instance + { + std::string status; + int quotaId; + float cpuUsedRatioMin; + std::string runTime; + std::string skynetId; + long memRequest; + std::string instanceId; + std::string cluster; + float memUsedRatioMax; + std::string nickName; + long memUsedTotal; + float cpuUsedRatioMax; + std::string project; + std::string quotaName; + long memUsed; + long cpuUsedTotal; + std::string taskType; + float memUsedRatioMin; + long cpuUsed; + std::string userAccount; + long cpuRequest; + }; + int total; + std::vector detail; + }; + + + GetProjectInstanceResult(); + explicit GetProjectInstanceResult(const std::string &payload); + ~GetProjectInstanceResult(); + std::string getMessage()const; + std::vector getData()const; + int getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + std::vector data_; + int code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETPROJECTINSTANCERESULT_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaHistoryInfoRequest.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaHistoryInfoRequest.h new file mode 100644 index 000000000..b0b16994b --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaHistoryInfoRequest.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_TESLAMAXCOMPUTE_MODEL_GETQUOTAHISTORYINFOREQUEST_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETQUOTAHISTORYINFOREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetQuotaHistoryInfoRequest : public RpcServiceRequest + { + + public: + GetQuotaHistoryInfoRequest(); + ~GetQuotaHistoryInfoRequest(); + + std::string getCluster()const; + void setCluster(const std::string& cluster); + int getEndTime()const; + void setEndTime(int endTime); + int getStartTime()const; + void setStartTime(int startTime); + std::string getRegion()const; + void setRegion(const std::string& region); + std::string getQuotaName()const; + void setQuotaName(const std::string& quotaName); + + private: + std::string cluster_; + int endTime_; + int startTime_; + std::string region_; + std::string quotaName_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETQUOTAHISTORYINFOREQUEST_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaHistoryInfoResult.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaHistoryInfoResult.h new file mode 100644 index 000000000..dc627a95f --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaHistoryInfoResult.h @@ -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. + */ + +#ifndef ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETQUOTAHISTORYINFORESULT_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETQUOTAHISTORYINFORESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetQuotaHistoryInfoResult : public ServiceResult + { + public: + struct DataItem + { + struct Point + { + struct CpuMaxQuota + { + int min; + int avg; + int max; + }; + struct CpuMinQuota + { + int min; + int avg; + int max; + }; + struct MemUsed + { + int min; + int avg; + int max; + }; + struct CpuUsed + { + int min; + int avg; + int max; + }; + std::vector cpuMinQuota; + std::vector memUsed; + std::vector cpuMaxQuota; + std::vector cpuUsed; + }; + int times; + std::vector point; + }; + + + GetQuotaHistoryInfoResult(); + explicit GetQuotaHistoryInfoResult(const std::string &payload); + ~GetQuotaHistoryInfoResult(); + std::string getMessage()const; + std::vector getData()const; + int getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + std::vector data_; + int code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETQUOTAHISTORYINFORESULT_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaInstanceRequest.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaInstanceRequest.h new file mode 100644 index 000000000..f26536be1 --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaInstanceRequest.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_TESLAMAXCOMPUTE_MODEL_GETQUOTAINSTANCEREQUEST_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETQUOTAINSTANCEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetQuotaInstanceRequest : public RpcServiceRequest + { + + public: + GetQuotaInstanceRequest(); + ~GetQuotaInstanceRequest(); + + std::string getCluster()const; + void setCluster(const std::string& cluster); + int getPageSize()const; + void setPageSize(int pageSize); + std::string getQuotaId()const; + void setQuotaId(const std::string& quotaId); + int getPageNum()const; + void setPageNum(int pageNum); + std::string getStatus()const; + void setStatus(const std::string& status); + + private: + std::string cluster_; + int pageSize_; + std::string quotaId_; + int pageNum_; + std::string status_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETQUOTAINSTANCEREQUEST_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaInstanceResult.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaInstanceResult.h new file mode 100644 index 000000000..9878ca852 --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetQuotaInstanceResult.h @@ -0,0 +1,84 @@ +/* + * 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_TESLAMAXCOMPUTE_MODEL_GETQUOTAINSTANCERESULT_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETQUOTAINSTANCERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetQuotaInstanceResult : public ServiceResult + { + public: + struct Data + { + struct Instance + { + std::string status; + int quotaId; + float cpuUsedRatioMin; + std::string runTime; + std::string skynetId; + long memRequest; + std::string instanceId; + std::string cluster; + float memUsedRatioMax; + std::string nickName; + long memUsedTotal; + float cpuUsedRatioMax; + std::string project; + std::string quotaName; + long memUsed; + long cpuUsedTotal; + std::string taskType; + float memUsedRatioMin; + long cpuUsed; + std::string userAccount; + long cpuRequest; + }; + int total; + std::vector detail; + }; + + + GetQuotaInstanceResult(); + explicit GetQuotaInstanceResult(const std::string &payload); + ~GetQuotaInstanceResult(); + std::string getMessage()const; + std::vector getData()const; + int getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + std::vector data_; + int code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETQUOTAINSTANCERESULT_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetUserInstanceRequest.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetUserInstanceRequest.h new file mode 100644 index 000000000..c3d05e2d8 --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetUserInstanceRequest.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_TESLAMAXCOMPUTE_MODEL_GETUSERINSTANCEREQUEST_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETUSERINSTANCEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetUserInstanceRequest : public RpcServiceRequest + { + + public: + GetUserInstanceRequest(); + ~GetUserInstanceRequest(); + + int getPageSize()const; + void setPageSize(int pageSize); + int getPageNum()const; + void setPageNum(int pageNum); + std::string getRegion()const; + void setRegion(const std::string& region); + std::string getUser()const; + void setUser(const std::string& user); + std::string getStatus()const; + void setStatus(const std::string& status); + + private: + int pageSize_; + int pageNum_; + std::string region_; + std::string user_; + std::string status_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETUSERINSTANCEREQUEST_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetUserInstanceResult.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetUserInstanceResult.h new file mode 100644 index 000000000..945f4bdaa --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/GetUserInstanceResult.h @@ -0,0 +1,84 @@ +/* + * 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_TESLAMAXCOMPUTE_MODEL_GETUSERINSTANCERESULT_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETUSERINSTANCERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT GetUserInstanceResult : public ServiceResult + { + public: + struct Data + { + struct Instance + { + std::string status; + int quotaId; + float cpuUsedRatioMin; + std::string runTime; + std::string skynetId; + long memRequest; + std::string instanceId; + std::string cluster; + float memUsedRatioMax; + std::string nickName; + long memUsedTotal; + float cpuUsedRatioMax; + std::string project; + std::string quotaName; + long memUsed; + long cpuUsedTotal; + std::string taskType; + float memUsedRatioMin; + long cpuUsed; + std::string userAccount; + long cpuRequest; + }; + int total; + std::vector detail; + }; + + + GetUserInstanceResult(); + explicit GetUserInstanceResult(const std::string &payload); + ~GetUserInstanceResult(); + std::string getMessage()const; + std::vector getData()const; + int getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + std::vector data_; + int code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_GETUSERINSTANCERESULT_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/QueryTopologyRequest.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/QueryTopologyRequest.h new file mode 100644 index 000000000..216c2dc2a --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/QueryTopologyRequest.h @@ -0,0 +1,45 @@ +/* + * 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_TESLAMAXCOMPUTE_MODEL_QUERYTOPOLOGYREQUEST_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_QUERYTOPOLOGYREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT QueryTopologyRequest : public RpcServiceRequest + { + + public: + QueryTopologyRequest(); + ~QueryTopologyRequest(); + + + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_QUERYTOPOLOGYREQUEST_H_ \ No newline at end of file diff --git a/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/QueryTopologyResult.h b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/QueryTopologyResult.h new file mode 100644 index 000000000..94312fd1e --- /dev/null +++ b/teslamaxcompute/include/alibabacloud/teslamaxcompute/model/QueryTopologyResult.h @@ -0,0 +1,77 @@ +/* + * 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_TESLAMAXCOMPUTE_MODEL_QUERYTOPOLOGYRESULT_H_ +#define ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_QUERYTOPOLOGYRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace TeslaMaxCompute + { + namespace Model + { + class ALIBABACLOUD_TESLAMAXCOMPUTE_EXPORT QueryTopologyResult : public ServiceResult + { + public: + struct Result + { + struct Regions + { + struct Clusters + { + std::string netArch; + std::string netCode; + std::string cluster; + std::string machineRoom; + std::string productClass; + std::string productLine; + std::string business; + }; + std::vector clusters; + std::string regionEnName; + std::string region; + std::string regionCnName; + }; + std::string lastUpdate; + std::vector regions; + }; + + + QueryTopologyResult(); + explicit QueryTopologyResult(const std::string &payload); + ~QueryTopologyResult(); + std::string getMessage()const; + int getCode()const; + std::vector getResult()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + int code_; + std::vector result_; + + }; + } + } +} +#endif // !ALIBABACLOUD_TESLAMAXCOMPUTE_MODEL_QUERYTOPOLOGYRESULT_H_ \ No newline at end of file diff --git a/teslamaxcompute/src/TeslaMaxComputeClient.cc b/teslamaxcompute/src/TeslaMaxComputeClient.cc new file mode 100644 index 000000000..58fd4155a --- /dev/null +++ b/teslamaxcompute/src/TeslaMaxComputeClient.cc @@ -0,0 +1,313 @@ +/* + * 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::TeslaMaxCompute; +using namespace AlibabaCloud::TeslaMaxCompute::Model; + +TeslaMaxComputeClient::TeslaMaxComputeClient(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(), ""); +} + +TeslaMaxComputeClient::TeslaMaxComputeClient(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(), ""); +} + +TeslaMaxComputeClient::TeslaMaxComputeClient(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(), ""); +} + +TeslaMaxComputeClient::~TeslaMaxComputeClient() +{} + +CoreClient::EndpointOutcome TeslaMaxComputeClient::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); +} + +TeslaMaxComputeClient::GetUserInstanceOutcome TeslaMaxComputeClient::getUserInstance(const GetUserInstanceRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return GetUserInstanceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetUserInstanceOutcome(GetUserInstanceResult(outcome.result())); + else + return GetUserInstanceOutcome(outcome.error()); +} + +void TeslaMaxComputeClient::getUserInstanceAsync(const GetUserInstanceRequest& request, const GetUserInstanceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getUserInstance(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaMaxComputeClient::GetUserInstanceOutcomeCallable TeslaMaxComputeClient::getUserInstanceCallable(const GetUserInstanceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getUserInstance(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +TeslaMaxComputeClient::GetProjectInstanceOutcome TeslaMaxComputeClient::getProjectInstance(const GetProjectInstanceRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return GetProjectInstanceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetProjectInstanceOutcome(GetProjectInstanceResult(outcome.result())); + else + return GetProjectInstanceOutcome(outcome.error()); +} + +void TeslaMaxComputeClient::getProjectInstanceAsync(const GetProjectInstanceRequest& request, const GetProjectInstanceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getProjectInstance(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaMaxComputeClient::GetProjectInstanceOutcomeCallable TeslaMaxComputeClient::getProjectInstanceCallable(const GetProjectInstanceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getProjectInstance(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +TeslaMaxComputeClient::QueryTopologyOutcome TeslaMaxComputeClient::queryTopology(const QueryTopologyRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return QueryTopologyOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return QueryTopologyOutcome(QueryTopologyResult(outcome.result())); + else + return QueryTopologyOutcome(outcome.error()); +} + +void TeslaMaxComputeClient::queryTopologyAsync(const QueryTopologyRequest& request, const QueryTopologyAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, queryTopology(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaMaxComputeClient::QueryTopologyOutcomeCallable TeslaMaxComputeClient::queryTopologyCallable(const QueryTopologyRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->queryTopology(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +TeslaMaxComputeClient::GetInstancesStatusCountOutcome TeslaMaxComputeClient::getInstancesStatusCount(const GetInstancesStatusCountRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return GetInstancesStatusCountOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetInstancesStatusCountOutcome(GetInstancesStatusCountResult(outcome.result())); + else + return GetInstancesStatusCountOutcome(outcome.error()); +} + +void TeslaMaxComputeClient::getInstancesStatusCountAsync(const GetInstancesStatusCountRequest& request, const GetInstancesStatusCountAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getInstancesStatusCount(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaMaxComputeClient::GetInstancesStatusCountOutcomeCallable TeslaMaxComputeClient::getInstancesStatusCountCallable(const GetInstancesStatusCountRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getInstancesStatusCount(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +TeslaMaxComputeClient::GetQuotaInstanceOutcome TeslaMaxComputeClient::getQuotaInstance(const GetQuotaInstanceRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return GetQuotaInstanceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetQuotaInstanceOutcome(GetQuotaInstanceResult(outcome.result())); + else + return GetQuotaInstanceOutcome(outcome.error()); +} + +void TeslaMaxComputeClient::getQuotaInstanceAsync(const GetQuotaInstanceRequest& request, const GetQuotaInstanceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getQuotaInstance(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaMaxComputeClient::GetQuotaInstanceOutcomeCallable TeslaMaxComputeClient::getQuotaInstanceCallable(const GetQuotaInstanceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getQuotaInstance(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +TeslaMaxComputeClient::GetClusterInstanceOutcome TeslaMaxComputeClient::getClusterInstance(const GetClusterInstanceRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return GetClusterInstanceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetClusterInstanceOutcome(GetClusterInstanceResult(outcome.result())); + else + return GetClusterInstanceOutcome(outcome.error()); +} + +void TeslaMaxComputeClient::getClusterInstanceAsync(const GetClusterInstanceRequest& request, const GetClusterInstanceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getClusterInstance(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaMaxComputeClient::GetClusterInstanceOutcomeCallable TeslaMaxComputeClient::getClusterInstanceCallable(const GetClusterInstanceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getClusterInstance(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +TeslaMaxComputeClient::GetQuotaHistoryInfoOutcome TeslaMaxComputeClient::getQuotaHistoryInfo(const GetQuotaHistoryInfoRequest &request) const +{ + auto endpointOutcome = endpoint(); + if (!endpointOutcome.isSuccess()) + return GetQuotaHistoryInfoOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetQuotaHistoryInfoOutcome(GetQuotaHistoryInfoResult(outcome.result())); + else + return GetQuotaHistoryInfoOutcome(outcome.error()); +} + +void TeslaMaxComputeClient::getQuotaHistoryInfoAsync(const GetQuotaHistoryInfoRequest& request, const GetQuotaHistoryInfoAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getQuotaHistoryInfo(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +TeslaMaxComputeClient::GetQuotaHistoryInfoOutcomeCallable TeslaMaxComputeClient::getQuotaHistoryInfoCallable(const GetQuotaHistoryInfoRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getQuotaHistoryInfo(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/teslamaxcompute/src/model/GetClusterInstanceRequest.cc b/teslamaxcompute/src/model/GetClusterInstanceRequest.cc new file mode 100644 index 000000000..8d522dfb3 --- /dev/null +++ b/teslamaxcompute/src/model/GetClusterInstanceRequest.cc @@ -0,0 +1,82 @@ +/* + * 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::TeslaMaxCompute::Model::GetClusterInstanceRequest; + +GetClusterInstanceRequest::GetClusterInstanceRequest() : + RpcServiceRequest("teslamaxcompute", "2018-01-04", "GetClusterInstance") +{} + +GetClusterInstanceRequest::~GetClusterInstanceRequest() +{} + +std::string GetClusterInstanceRequest::getCluster()const +{ + return cluster_; +} + +void GetClusterInstanceRequest::setCluster(const std::string& cluster) +{ + cluster_ = cluster; + setParameter("Cluster", cluster); +} + +int GetClusterInstanceRequest::getPageSize()const +{ + return pageSize_; +} + +void GetClusterInstanceRequest::setPageSize(int pageSize) +{ + pageSize_ = pageSize; + setParameter("PageSize", std::to_string(pageSize)); +} + +int GetClusterInstanceRequest::getPageNum()const +{ + return pageNum_; +} + +void GetClusterInstanceRequest::setPageNum(int pageNum) +{ + pageNum_ = pageNum; + setParameter("PageNum", std::to_string(pageNum)); +} + +std::string GetClusterInstanceRequest::getRegion()const +{ + return region_; +} + +void GetClusterInstanceRequest::setRegion(const std::string& region) +{ + region_ = region; + setParameter("Region", region); +} + +std::string GetClusterInstanceRequest::getStatus()const +{ + return status_; +} + +void GetClusterInstanceRequest::setStatus(const std::string& status) +{ + status_ = status; + setParameter("Status", status); +} + diff --git a/teslamaxcompute/src/model/GetClusterInstanceResult.cc b/teslamaxcompute/src/model/GetClusterInstanceResult.cc new file mode 100644 index 000000000..911be77bd --- /dev/null +++ b/teslamaxcompute/src/model/GetClusterInstanceResult.cc @@ -0,0 +1,120 @@ +/* + * 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::TeslaMaxCompute; +using namespace AlibabaCloud::TeslaMaxCompute::Model; + +GetClusterInstanceResult::GetClusterInstanceResult() : + ServiceResult() +{} + +GetClusterInstanceResult::GetClusterInstanceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetClusterInstanceResult::~GetClusterInstanceResult() +{} + +void GetClusterInstanceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allData = value["Data"]; + for (auto value : allData) + { + Data dataObject; + if(!value["Total"].isNull()) + dataObject.total = std::stoi(value["Total"].asString()); + auto allDetail = value["Detail"]["instance"]; + for (auto value : allDetail) + { + Data::Instance instanceObject; + if(!value["Project"].isNull()) + instanceObject.project = value["Project"].asString(); + if(!value["InstanceId"].isNull()) + instanceObject.instanceId = value["InstanceId"].asString(); + if(!value["Status"].isNull()) + instanceObject.status = value["Status"].asString(); + if(!value["UserAccount"].isNull()) + instanceObject.userAccount = value["UserAccount"].asString(); + if(!value["NickName"].isNull()) + instanceObject.nickName = value["NickName"].asString(); + if(!value["Cluster"].isNull()) + instanceObject.cluster = value["Cluster"].asString(); + if(!value["RunTime"].isNull()) + instanceObject.runTime = value["RunTime"].asString(); + if(!value["CpuUsed"].isNull()) + instanceObject.cpuUsed = std::stol(value["CpuUsed"].asString()); + if(!value["CpuRequest"].isNull()) + instanceObject.cpuRequest = std::stol(value["CpuRequest"].asString()); + if(!value["CpuUsedTotal"].isNull()) + instanceObject.cpuUsedTotal = std::stol(value["CpuUsedTotal"].asString()); + if(!value["CpuUsedRatioMax"].isNull()) + instanceObject.cpuUsedRatioMax = std::stof(value["CpuUsedRatioMax"].asString()); + if(!value["CpuUsedRatioMin"].isNull()) + instanceObject.cpuUsedRatioMin = std::stof(value["CpuUsedRatioMin"].asString()); + if(!value["MemUsed"].isNull()) + instanceObject.memUsed = std::stol(value["MemUsed"].asString()); + if(!value["MemRequest"].isNull()) + instanceObject.memRequest = std::stol(value["MemRequest"].asString()); + if(!value["MemUsedTotal"].isNull()) + instanceObject.memUsedTotal = std::stol(value["MemUsedTotal"].asString()); + if(!value["MemUsedRatioMax"].isNull()) + instanceObject.memUsedRatioMax = std::stof(value["MemUsedRatioMax"].asString()); + if(!value["MemUsedRatioMin"].isNull()) + instanceObject.memUsedRatioMin = std::stof(value["MemUsedRatioMin"].asString()); + if(!value["TaskType"].isNull()) + instanceObject.taskType = value["TaskType"].asString(); + if(!value["SkynetId"].isNull()) + instanceObject.skynetId = value["SkynetId"].asString(); + if(!value["QuotaName"].isNull()) + instanceObject.quotaName = value["QuotaName"].asString(); + if(!value["QuotaId"].isNull()) + instanceObject.quotaId = std::stoi(value["QuotaId"].asString()); + dataObject.detail.push_back(instanceObject); + } + data_.push_back(dataObject); + } + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string GetClusterInstanceResult::getMessage()const +{ + return message_; +} + +std::vector GetClusterInstanceResult::getData()const +{ + return data_; +} + +int GetClusterInstanceResult::getCode()const +{ + return code_; +} + diff --git a/teslamaxcompute/src/model/GetInstancesStatusCountRequest.cc b/teslamaxcompute/src/model/GetInstancesStatusCountRequest.cc new file mode 100644 index 000000000..4450885bd --- /dev/null +++ b/teslamaxcompute/src/model/GetInstancesStatusCountRequest.cc @@ -0,0 +1,49 @@ +/* + * 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::TeslaMaxCompute::Model::GetInstancesStatusCountRequest; + +GetInstancesStatusCountRequest::GetInstancesStatusCountRequest() : + RpcServiceRequest("teslamaxcompute", "2018-01-04", "GetInstancesStatusCount") +{} + +GetInstancesStatusCountRequest::~GetInstancesStatusCountRequest() +{} + +std::string GetInstancesStatusCountRequest::getCluster()const +{ + return cluster_; +} + +void GetInstancesStatusCountRequest::setCluster(const std::string& cluster) +{ + cluster_ = cluster; + setParameter("Cluster", cluster); +} + +std::string GetInstancesStatusCountRequest::getRegion()const +{ + return region_; +} + +void GetInstancesStatusCountRequest::setRegion(const std::string& region) +{ + region_ = region; + setParameter("Region", region); +} + diff --git a/teslamaxcompute/src/model/GetInstancesStatusCountResult.cc b/teslamaxcompute/src/model/GetInstancesStatusCountResult.cc new file mode 100644 index 000000000..0dbaa7705 --- /dev/null +++ b/teslamaxcompute/src/model/GetInstancesStatusCountResult.cc @@ -0,0 +1,74 @@ +/* + * 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::TeslaMaxCompute; +using namespace AlibabaCloud::TeslaMaxCompute::Model; + +GetInstancesStatusCountResult::GetInstancesStatusCountResult() : + ServiceResult() +{} + +GetInstancesStatusCountResult::GetInstancesStatusCountResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetInstancesStatusCountResult::~GetInstancesStatusCountResult() +{} + +void GetInstancesStatusCountResult::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["Status"].isNull()) + dataObject.status = value["Status"].asString(); + if(!value["Size"].isNull()) + dataObject.size = std::stoi(value["Size"].asString()); + data_.push_back(dataObject); + } + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string GetInstancesStatusCountResult::getMessage()const +{ + return message_; +} + +std::vector GetInstancesStatusCountResult::getData()const +{ + return data_; +} + +int GetInstancesStatusCountResult::getCode()const +{ + return code_; +} + diff --git a/teslamaxcompute/src/model/GetProjectInstanceRequest.cc b/teslamaxcompute/src/model/GetProjectInstanceRequest.cc new file mode 100644 index 000000000..8cdb3d116 --- /dev/null +++ b/teslamaxcompute/src/model/GetProjectInstanceRequest.cc @@ -0,0 +1,82 @@ +/* + * 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::TeslaMaxCompute::Model::GetProjectInstanceRequest; + +GetProjectInstanceRequest::GetProjectInstanceRequest() : + RpcServiceRequest("teslamaxcompute", "2018-01-04", "GetProjectInstance") +{} + +GetProjectInstanceRequest::~GetProjectInstanceRequest() +{} + +int GetProjectInstanceRequest::getPageSize()const +{ + return pageSize_; +} + +void GetProjectInstanceRequest::setPageSize(int pageSize) +{ + pageSize_ = pageSize; + setParameter("PageSize", std::to_string(pageSize)); +} + +std::string GetProjectInstanceRequest::getProject()const +{ + return project_; +} + +void GetProjectInstanceRequest::setProject(const std::string& project) +{ + project_ = project; + setParameter("Project", project); +} + +int GetProjectInstanceRequest::getPageNum()const +{ + return pageNum_; +} + +void GetProjectInstanceRequest::setPageNum(int pageNum) +{ + pageNum_ = pageNum; + setParameter("PageNum", std::to_string(pageNum)); +} + +std::string GetProjectInstanceRequest::getRegion()const +{ + return region_; +} + +void GetProjectInstanceRequest::setRegion(const std::string& region) +{ + region_ = region; + setParameter("Region", region); +} + +std::string GetProjectInstanceRequest::getStatus()const +{ + return status_; +} + +void GetProjectInstanceRequest::setStatus(const std::string& status) +{ + status_ = status; + setParameter("Status", status); +} + diff --git a/teslamaxcompute/src/model/GetProjectInstanceResult.cc b/teslamaxcompute/src/model/GetProjectInstanceResult.cc new file mode 100644 index 000000000..eadb744df --- /dev/null +++ b/teslamaxcompute/src/model/GetProjectInstanceResult.cc @@ -0,0 +1,120 @@ +/* + * 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::TeslaMaxCompute; +using namespace AlibabaCloud::TeslaMaxCompute::Model; + +GetProjectInstanceResult::GetProjectInstanceResult() : + ServiceResult() +{} + +GetProjectInstanceResult::GetProjectInstanceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetProjectInstanceResult::~GetProjectInstanceResult() +{} + +void GetProjectInstanceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allData = value["Data"]; + for (auto value : allData) + { + Data dataObject; + if(!value["Total"].isNull()) + dataObject.total = std::stoi(value["Total"].asString()); + auto allDetail = value["Detail"]["instance"]; + for (auto value : allDetail) + { + Data::Instance instanceObject; + if(!value["Project"].isNull()) + instanceObject.project = value["Project"].asString(); + if(!value["InstanceId"].isNull()) + instanceObject.instanceId = value["InstanceId"].asString(); + if(!value["Status"].isNull()) + instanceObject.status = value["Status"].asString(); + if(!value["UserAccount"].isNull()) + instanceObject.userAccount = value["UserAccount"].asString(); + if(!value["NickName"].isNull()) + instanceObject.nickName = value["NickName"].asString(); + if(!value["Cluster"].isNull()) + instanceObject.cluster = value["Cluster"].asString(); + if(!value["RunTime"].isNull()) + instanceObject.runTime = value["RunTime"].asString(); + if(!value["CpuUsed"].isNull()) + instanceObject.cpuUsed = std::stol(value["CpuUsed"].asString()); + if(!value["CpuRequest"].isNull()) + instanceObject.cpuRequest = std::stol(value["CpuRequest"].asString()); + if(!value["CpuUsedTotal"].isNull()) + instanceObject.cpuUsedTotal = std::stol(value["CpuUsedTotal"].asString()); + if(!value["CpuUsedRatioMax"].isNull()) + instanceObject.cpuUsedRatioMax = std::stof(value["CpuUsedRatioMax"].asString()); + if(!value["CpuUsedRatioMin"].isNull()) + instanceObject.cpuUsedRatioMin = std::stof(value["CpuUsedRatioMin"].asString()); + if(!value["MemUsed"].isNull()) + instanceObject.memUsed = std::stol(value["MemUsed"].asString()); + if(!value["MemRequest"].isNull()) + instanceObject.memRequest = std::stol(value["MemRequest"].asString()); + if(!value["MemUsedTotal"].isNull()) + instanceObject.memUsedTotal = std::stol(value["MemUsedTotal"].asString()); + if(!value["MemUsedRatioMax"].isNull()) + instanceObject.memUsedRatioMax = std::stof(value["MemUsedRatioMax"].asString()); + if(!value["MemUsedRatioMin"].isNull()) + instanceObject.memUsedRatioMin = std::stof(value["MemUsedRatioMin"].asString()); + if(!value["TaskType"].isNull()) + instanceObject.taskType = value["TaskType"].asString(); + if(!value["SkynetId"].isNull()) + instanceObject.skynetId = value["SkynetId"].asString(); + if(!value["QuotaName"].isNull()) + instanceObject.quotaName = value["QuotaName"].asString(); + if(!value["QuotaId"].isNull()) + instanceObject.quotaId = std::stoi(value["QuotaId"].asString()); + dataObject.detail.push_back(instanceObject); + } + data_.push_back(dataObject); + } + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string GetProjectInstanceResult::getMessage()const +{ + return message_; +} + +std::vector GetProjectInstanceResult::getData()const +{ + return data_; +} + +int GetProjectInstanceResult::getCode()const +{ + return code_; +} + diff --git a/teslamaxcompute/src/model/GetQuotaHistoryInfoRequest.cc b/teslamaxcompute/src/model/GetQuotaHistoryInfoRequest.cc new file mode 100644 index 000000000..971f6b383 --- /dev/null +++ b/teslamaxcompute/src/model/GetQuotaHistoryInfoRequest.cc @@ -0,0 +1,82 @@ +/* + * 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::TeslaMaxCompute::Model::GetQuotaHistoryInfoRequest; + +GetQuotaHistoryInfoRequest::GetQuotaHistoryInfoRequest() : + RpcServiceRequest("teslamaxcompute", "2018-01-04", "GetQuotaHistoryInfo") +{} + +GetQuotaHistoryInfoRequest::~GetQuotaHistoryInfoRequest() +{} + +std::string GetQuotaHistoryInfoRequest::getCluster()const +{ + return cluster_; +} + +void GetQuotaHistoryInfoRequest::setCluster(const std::string& cluster) +{ + cluster_ = cluster; + setParameter("Cluster", cluster); +} + +int GetQuotaHistoryInfoRequest::getEndTime()const +{ + return endTime_; +} + +void GetQuotaHistoryInfoRequest::setEndTime(int endTime) +{ + endTime_ = endTime; + setParameter("EndTime", std::to_string(endTime)); +} + +int GetQuotaHistoryInfoRequest::getStartTime()const +{ + return startTime_; +} + +void GetQuotaHistoryInfoRequest::setStartTime(int startTime) +{ + startTime_ = startTime; + setParameter("StartTime", std::to_string(startTime)); +} + +std::string GetQuotaHistoryInfoRequest::getRegion()const +{ + return region_; +} + +void GetQuotaHistoryInfoRequest::setRegion(const std::string& region) +{ + region_ = region; + setParameter("Region", region); +} + +std::string GetQuotaHistoryInfoRequest::getQuotaName()const +{ + return quotaName_; +} + +void GetQuotaHistoryInfoRequest::setQuotaName(const std::string& quotaName) +{ + quotaName_ = quotaName; + setParameter("QuotaName", quotaName); +} + diff --git a/teslamaxcompute/src/model/GetQuotaHistoryInfoResult.cc b/teslamaxcompute/src/model/GetQuotaHistoryInfoResult.cc new file mode 100644 index 000000000..c832722da --- /dev/null +++ b/teslamaxcompute/src/model/GetQuotaHistoryInfoResult.cc @@ -0,0 +1,126 @@ +/* + * 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::TeslaMaxCompute; +using namespace AlibabaCloud::TeslaMaxCompute::Model; + +GetQuotaHistoryInfoResult::GetQuotaHistoryInfoResult() : + ServiceResult() +{} + +GetQuotaHistoryInfoResult::GetQuotaHistoryInfoResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetQuotaHistoryInfoResult::~GetQuotaHistoryInfoResult() +{} + +void GetQuotaHistoryInfoResult::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["Times"].isNull()) + dataObject.times = std::stoi(value["Times"].asString()); + auto allPoint = value["Point"]; + for (auto value : allPoint) + { + DataItem::Point pointObject; + auto allCpuMaxQuota = value["CpuMaxQuota"]; + for (auto value : allCpuMaxQuota) + { + DataItem::Point::CpuMaxQuota cpuMaxQuotaObject; + if(!value["Min"].isNull()) + cpuMaxQuotaObject.min = std::stoi(value["Min"].asString()); + if(!value["Max"].isNull()) + cpuMaxQuotaObject.max = std::stoi(value["Max"].asString()); + if(!value["Avg"].isNull()) + cpuMaxQuotaObject.avg = std::stoi(value["Avg"].asString()); + pointObject.cpuMaxQuota.push_back(cpuMaxQuotaObject); + } + auto allCpuMinQuota = value["CpuMinQuota"]; + for (auto value : allCpuMinQuota) + { + DataItem::Point::CpuMinQuota cpuMinQuotaObject; + if(!value["Min"].isNull()) + cpuMinQuotaObject.min = std::stoi(value["Min"].asString()); + if(!value["Max"].isNull()) + cpuMinQuotaObject.max = std::stoi(value["Max"].asString()); + if(!value["Avg"].isNull()) + cpuMinQuotaObject.avg = std::stoi(value["Avg"].asString()); + pointObject.cpuMinQuota.push_back(cpuMinQuotaObject); + } + auto allMemUsed = value["MemUsed"]; + for (auto value : allMemUsed) + { + DataItem::Point::MemUsed memUsedObject; + if(!value["Min"].isNull()) + memUsedObject.min = std::stoi(value["Min"].asString()); + if(!value["Max"].isNull()) + memUsedObject.max = std::stoi(value["Max"].asString()); + if(!value["Avg"].isNull()) + memUsedObject.avg = std::stoi(value["Avg"].asString()); + pointObject.memUsed.push_back(memUsedObject); + } + auto allCpuUsed = value["CpuUsed"]; + for (auto value : allCpuUsed) + { + DataItem::Point::CpuUsed cpuUsedObject; + if(!value["Min"].isNull()) + cpuUsedObject.min = std::stoi(value["Min"].asString()); + if(!value["Max"].isNull()) + cpuUsedObject.max = std::stoi(value["Max"].asString()); + if(!value["Avg"].isNull()) + cpuUsedObject.avg = std::stoi(value["Avg"].asString()); + pointObject.cpuUsed.push_back(cpuUsedObject); + } + dataObject.point.push_back(pointObject); + } + data_.push_back(dataObject); + } + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string GetQuotaHistoryInfoResult::getMessage()const +{ + return message_; +} + +std::vector GetQuotaHistoryInfoResult::getData()const +{ + return data_; +} + +int GetQuotaHistoryInfoResult::getCode()const +{ + return code_; +} + diff --git a/teslamaxcompute/src/model/GetQuotaInstanceRequest.cc b/teslamaxcompute/src/model/GetQuotaInstanceRequest.cc new file mode 100644 index 000000000..063f6666f --- /dev/null +++ b/teslamaxcompute/src/model/GetQuotaInstanceRequest.cc @@ -0,0 +1,82 @@ +/* + * 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::TeslaMaxCompute::Model::GetQuotaInstanceRequest; + +GetQuotaInstanceRequest::GetQuotaInstanceRequest() : + RpcServiceRequest("teslamaxcompute", "2018-01-04", "GetQuotaInstance") +{} + +GetQuotaInstanceRequest::~GetQuotaInstanceRequest() +{} + +std::string GetQuotaInstanceRequest::getCluster()const +{ + return cluster_; +} + +void GetQuotaInstanceRequest::setCluster(const std::string& cluster) +{ + cluster_ = cluster; + setParameter("Cluster", cluster); +} + +int GetQuotaInstanceRequest::getPageSize()const +{ + return pageSize_; +} + +void GetQuotaInstanceRequest::setPageSize(int pageSize) +{ + pageSize_ = pageSize; + setParameter("PageSize", std::to_string(pageSize)); +} + +std::string GetQuotaInstanceRequest::getQuotaId()const +{ + return quotaId_; +} + +void GetQuotaInstanceRequest::setQuotaId(const std::string& quotaId) +{ + quotaId_ = quotaId; + setParameter("QuotaId", quotaId); +} + +int GetQuotaInstanceRequest::getPageNum()const +{ + return pageNum_; +} + +void GetQuotaInstanceRequest::setPageNum(int pageNum) +{ + pageNum_ = pageNum; + setParameter("PageNum", std::to_string(pageNum)); +} + +std::string GetQuotaInstanceRequest::getStatus()const +{ + return status_; +} + +void GetQuotaInstanceRequest::setStatus(const std::string& status) +{ + status_ = status; + setParameter("Status", status); +} + diff --git a/teslamaxcompute/src/model/GetQuotaInstanceResult.cc b/teslamaxcompute/src/model/GetQuotaInstanceResult.cc new file mode 100644 index 000000000..2136ffaf6 --- /dev/null +++ b/teslamaxcompute/src/model/GetQuotaInstanceResult.cc @@ -0,0 +1,120 @@ +/* + * 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::TeslaMaxCompute; +using namespace AlibabaCloud::TeslaMaxCompute::Model; + +GetQuotaInstanceResult::GetQuotaInstanceResult() : + ServiceResult() +{} + +GetQuotaInstanceResult::GetQuotaInstanceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetQuotaInstanceResult::~GetQuotaInstanceResult() +{} + +void GetQuotaInstanceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allData = value["Data"]; + for (auto value : allData) + { + Data dataObject; + if(!value["Total"].isNull()) + dataObject.total = std::stoi(value["Total"].asString()); + auto allDetail = value["Detail"]["instance"]; + for (auto value : allDetail) + { + Data::Instance instanceObject; + if(!value["Project"].isNull()) + instanceObject.project = value["Project"].asString(); + if(!value["InstanceId"].isNull()) + instanceObject.instanceId = value["InstanceId"].asString(); + if(!value["Status"].isNull()) + instanceObject.status = value["Status"].asString(); + if(!value["UserAccount"].isNull()) + instanceObject.userAccount = value["UserAccount"].asString(); + if(!value["NickName"].isNull()) + instanceObject.nickName = value["NickName"].asString(); + if(!value["Cluster"].isNull()) + instanceObject.cluster = value["Cluster"].asString(); + if(!value["RunTime"].isNull()) + instanceObject.runTime = value["RunTime"].asString(); + if(!value["CpuUsed"].isNull()) + instanceObject.cpuUsed = std::stol(value["CpuUsed"].asString()); + if(!value["CpuRequest"].isNull()) + instanceObject.cpuRequest = std::stol(value["CpuRequest"].asString()); + if(!value["CpuUsedTotal"].isNull()) + instanceObject.cpuUsedTotal = std::stol(value["CpuUsedTotal"].asString()); + if(!value["CpuUsedRatioMax"].isNull()) + instanceObject.cpuUsedRatioMax = std::stof(value["CpuUsedRatioMax"].asString()); + if(!value["CpuUsedRatioMin"].isNull()) + instanceObject.cpuUsedRatioMin = std::stof(value["CpuUsedRatioMin"].asString()); + if(!value["MemUsed"].isNull()) + instanceObject.memUsed = std::stol(value["MemUsed"].asString()); + if(!value["MemRequest"].isNull()) + instanceObject.memRequest = std::stol(value["MemRequest"].asString()); + if(!value["MemUsedTotal"].isNull()) + instanceObject.memUsedTotal = std::stol(value["MemUsedTotal"].asString()); + if(!value["MemUsedRatioMax"].isNull()) + instanceObject.memUsedRatioMax = std::stof(value["MemUsedRatioMax"].asString()); + if(!value["MemUsedRatioMin"].isNull()) + instanceObject.memUsedRatioMin = std::stof(value["MemUsedRatioMin"].asString()); + if(!value["TaskType"].isNull()) + instanceObject.taskType = value["TaskType"].asString(); + if(!value["SkynetId"].isNull()) + instanceObject.skynetId = value["SkynetId"].asString(); + if(!value["QuotaName"].isNull()) + instanceObject.quotaName = value["QuotaName"].asString(); + if(!value["QuotaId"].isNull()) + instanceObject.quotaId = std::stoi(value["QuotaId"].asString()); + dataObject.detail.push_back(instanceObject); + } + data_.push_back(dataObject); + } + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string GetQuotaInstanceResult::getMessage()const +{ + return message_; +} + +std::vector GetQuotaInstanceResult::getData()const +{ + return data_; +} + +int GetQuotaInstanceResult::getCode()const +{ + return code_; +} + diff --git a/teslamaxcompute/src/model/GetUserInstanceRequest.cc b/teslamaxcompute/src/model/GetUserInstanceRequest.cc new file mode 100644 index 000000000..f1eab1d48 --- /dev/null +++ b/teslamaxcompute/src/model/GetUserInstanceRequest.cc @@ -0,0 +1,82 @@ +/* + * 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::TeslaMaxCompute::Model::GetUserInstanceRequest; + +GetUserInstanceRequest::GetUserInstanceRequest() : + RpcServiceRequest("teslamaxcompute", "2018-01-04", "GetUserInstance") +{} + +GetUserInstanceRequest::~GetUserInstanceRequest() +{} + +int GetUserInstanceRequest::getPageSize()const +{ + return pageSize_; +} + +void GetUserInstanceRequest::setPageSize(int pageSize) +{ + pageSize_ = pageSize; + setParameter("PageSize", std::to_string(pageSize)); +} + +int GetUserInstanceRequest::getPageNum()const +{ + return pageNum_; +} + +void GetUserInstanceRequest::setPageNum(int pageNum) +{ + pageNum_ = pageNum; + setParameter("PageNum", std::to_string(pageNum)); +} + +std::string GetUserInstanceRequest::getRegion()const +{ + return region_; +} + +void GetUserInstanceRequest::setRegion(const std::string& region) +{ + region_ = region; + setParameter("Region", region); +} + +std::string GetUserInstanceRequest::getUser()const +{ + return user_; +} + +void GetUserInstanceRequest::setUser(const std::string& user) +{ + user_ = user; + setParameter("User", user); +} + +std::string GetUserInstanceRequest::getStatus()const +{ + return status_; +} + +void GetUserInstanceRequest::setStatus(const std::string& status) +{ + status_ = status; + setParameter("Status", status); +} + diff --git a/teslamaxcompute/src/model/GetUserInstanceResult.cc b/teslamaxcompute/src/model/GetUserInstanceResult.cc new file mode 100644 index 000000000..95dd4b732 --- /dev/null +++ b/teslamaxcompute/src/model/GetUserInstanceResult.cc @@ -0,0 +1,120 @@ +/* + * 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::TeslaMaxCompute; +using namespace AlibabaCloud::TeslaMaxCompute::Model; + +GetUserInstanceResult::GetUserInstanceResult() : + ServiceResult() +{} + +GetUserInstanceResult::GetUserInstanceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetUserInstanceResult::~GetUserInstanceResult() +{} + +void GetUserInstanceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allData = value["Data"]; + for (auto value : allData) + { + Data dataObject; + if(!value["Total"].isNull()) + dataObject.total = std::stoi(value["Total"].asString()); + auto allDetail = value["Detail"]["instance"]; + for (auto value : allDetail) + { + Data::Instance instanceObject; + if(!value["Project"].isNull()) + instanceObject.project = value["Project"].asString(); + if(!value["InstanceId"].isNull()) + instanceObject.instanceId = value["InstanceId"].asString(); + if(!value["Status"].isNull()) + instanceObject.status = value["Status"].asString(); + if(!value["UserAccount"].isNull()) + instanceObject.userAccount = value["UserAccount"].asString(); + if(!value["NickName"].isNull()) + instanceObject.nickName = value["NickName"].asString(); + if(!value["Cluster"].isNull()) + instanceObject.cluster = value["Cluster"].asString(); + if(!value["RunTime"].isNull()) + instanceObject.runTime = value["RunTime"].asString(); + if(!value["CpuUsed"].isNull()) + instanceObject.cpuUsed = std::stol(value["CpuUsed"].asString()); + if(!value["CpuRequest"].isNull()) + instanceObject.cpuRequest = std::stol(value["CpuRequest"].asString()); + if(!value["CpuUsedTotal"].isNull()) + instanceObject.cpuUsedTotal = std::stol(value["CpuUsedTotal"].asString()); + if(!value["CpuUsedRatioMax"].isNull()) + instanceObject.cpuUsedRatioMax = std::stof(value["CpuUsedRatioMax"].asString()); + if(!value["CpuUsedRatioMin"].isNull()) + instanceObject.cpuUsedRatioMin = std::stof(value["CpuUsedRatioMin"].asString()); + if(!value["MemUsed"].isNull()) + instanceObject.memUsed = std::stol(value["MemUsed"].asString()); + if(!value["MemRequest"].isNull()) + instanceObject.memRequest = std::stol(value["MemRequest"].asString()); + if(!value["MemUsedTotal"].isNull()) + instanceObject.memUsedTotal = std::stol(value["MemUsedTotal"].asString()); + if(!value["MemUsedRatioMax"].isNull()) + instanceObject.memUsedRatioMax = std::stof(value["MemUsedRatioMax"].asString()); + if(!value["MemUsedRatioMin"].isNull()) + instanceObject.memUsedRatioMin = std::stof(value["MemUsedRatioMin"].asString()); + if(!value["TaskType"].isNull()) + instanceObject.taskType = value["TaskType"].asString(); + if(!value["SkynetId"].isNull()) + instanceObject.skynetId = value["SkynetId"].asString(); + if(!value["QuotaName"].isNull()) + instanceObject.quotaName = value["QuotaName"].asString(); + if(!value["QuotaId"].isNull()) + instanceObject.quotaId = std::stoi(value["QuotaId"].asString()); + dataObject.detail.push_back(instanceObject); + } + data_.push_back(dataObject); + } + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string GetUserInstanceResult::getMessage()const +{ + return message_; +} + +std::vector GetUserInstanceResult::getData()const +{ + return data_; +} + +int GetUserInstanceResult::getCode()const +{ + return code_; +} + diff --git a/teslamaxcompute/src/model/QueryTopologyRequest.cc b/teslamaxcompute/src/model/QueryTopologyRequest.cc new file mode 100644 index 000000000..1f7a35ef9 --- /dev/null +++ b/teslamaxcompute/src/model/QueryTopologyRequest.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 AlibabaCloud::TeslaMaxCompute::Model::QueryTopologyRequest; + +QueryTopologyRequest::QueryTopologyRequest() : + RpcServiceRequest("teslamaxcompute", "2018-01-04", "QueryTopology") +{} + +QueryTopologyRequest::~QueryTopologyRequest() +{} + diff --git a/teslamaxcompute/src/model/QueryTopologyResult.cc b/teslamaxcompute/src/model/QueryTopologyResult.cc new file mode 100644 index 000000000..773af48eb --- /dev/null +++ b/teslamaxcompute/src/model/QueryTopologyResult.cc @@ -0,0 +1,104 @@ +/* + * 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::TeslaMaxCompute; +using namespace AlibabaCloud::TeslaMaxCompute::Model; + +QueryTopologyResult::QueryTopologyResult() : + ServiceResult() +{} + +QueryTopologyResult::QueryTopologyResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +QueryTopologyResult::~QueryTopologyResult() +{} + +void QueryTopologyResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allResult = value["Result"]; + for (auto value : allResult) + { + Result resultObject; + if(!value["LastUpdate"].isNull()) + resultObject.lastUpdate = value["LastUpdate"].asString(); + auto allRegions = value["Regions"]; + for (auto value : allRegions) + { + Result::Regions regionsObject; + if(!value["Region"].isNull()) + regionsObject.region = value["Region"].asString(); + if(!value["RegionEnName"].isNull()) + regionsObject.regionEnName = value["RegionEnName"].asString(); + if(!value["RegionCnName"].isNull()) + regionsObject.regionCnName = value["RegionCnName"].asString(); + auto allClusters = value["Clusters"]; + for (auto value : allClusters) + { + Result::Regions::Clusters clustersObject; + if(!value["Cluster"].isNull()) + clustersObject.cluster = value["Cluster"].asString(); + if(!value["ProductLine"].isNull()) + clustersObject.productLine = value["ProductLine"].asString(); + if(!value["ProductClass"].isNull()) + clustersObject.productClass = value["ProductClass"].asString(); + if(!value["NetCode"].isNull()) + clustersObject.netCode = value["NetCode"].asString(); + if(!value["Business"].isNull()) + clustersObject.business = value["Business"].asString(); + if(!value["MachineRoom"].isNull()) + clustersObject.machineRoom = value["MachineRoom"].asString(); + if(!value["NetArch"].isNull()) + clustersObject.netArch = value["NetArch"].asString(); + regionsObject.clusters.push_back(clustersObject); + } + resultObject.regions.push_back(regionsObject); + } + result_.push_back(resultObject); + } + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string QueryTopologyResult::getMessage()const +{ + return message_; +} + +int QueryTopologyResult::getCode()const +{ + return code_; +} + +std::vector QueryTopologyResult::getResult()const +{ + return result_; +} +