diff --git a/CHANGELOG b/CHANGELOG index eba70b4d1..2e4d54074 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +2018-04-27 Version: 1.7.1 +1, release hsm open api +2, hsm open api includes DescribeRegions, DescribeInstances, ModityInstance, ConfigNetwork, ConfigWhiteList + 2018-04-26 Version: 1.7.0 1, Add apis for domain group. 3, Add fields for QueryDomainList. diff --git a/CMakeLists.txt b/CMakeLists.txt index 520401e0f..15259a365 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,4 +68,5 @@ add_subdirectory(teslamaxcompute) add_subdirectory(push) add_subdirectory(csb) add_subdirectory(domain) -add_subdirectory(green) \ No newline at end of file +add_subdirectory(green) +add_subdirectory(hsm) \ No newline at end of file diff --git a/VERSION b/VERSION index 9dbb0c005..081af9a10 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.7.0 \ No newline at end of file +1.7.1 \ No newline at end of file diff --git a/hsm/CMakeLists.txt b/hsm/CMakeLists.txt new file mode 100644 index 000000000..b819ee9cf --- /dev/null +++ b/hsm/CMakeLists.txt @@ -0,0 +1,114 @@ +# +# Copyright 2009-2017 Alibaba Cloud All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include) + +set(hsm_public_header + include/alibabacloud/hsm/HsmClient.h + include/alibabacloud/hsm/HsmExport.h ) + +set(hsm_public_header_model + include/alibabacloud/hsm/model/ConfigWhiteListRequest.h + include/alibabacloud/hsm/model/ConfigWhiteListResult.h + include/alibabacloud/hsm/model/ConfigNetworkRequest.h + include/alibabacloud/hsm/model/ConfigNetworkResult.h + include/alibabacloud/hsm/model/ReleaseInstanceRequest.h + include/alibabacloud/hsm/model/ReleaseInstanceResult.h + include/alibabacloud/hsm/model/DescribeInstancesRequest.h + include/alibabacloud/hsm/model/DescribeInstancesResult.h + include/alibabacloud/hsm/model/DescribeRegionsRequest.h + include/alibabacloud/hsm/model/DescribeRegionsResult.h + include/alibabacloud/hsm/model/CreateInstanceRequest.h + include/alibabacloud/hsm/model/CreateInstanceResult.h + include/alibabacloud/hsm/model/ModifyInstanceRequest.h + include/alibabacloud/hsm/model/ModifyInstanceResult.h + include/alibabacloud/hsm/model/RenewInstanceRequest.h + include/alibabacloud/hsm/model/RenewInstanceResult.h ) + +set(hsm_src + src/HsmClient.cc + src/model/ConfigWhiteListRequest.cc + src/model/ConfigWhiteListResult.cc + src/model/ConfigNetworkRequest.cc + src/model/ConfigNetworkResult.cc + src/model/ReleaseInstanceRequest.cc + src/model/ReleaseInstanceResult.cc + src/model/DescribeInstancesRequest.cc + src/model/DescribeInstancesResult.cc + src/model/DescribeRegionsRequest.cc + src/model/DescribeRegionsResult.cc + src/model/CreateInstanceRequest.cc + src/model/CreateInstanceResult.cc + src/model/ModifyInstanceRequest.cc + src/model/ModifyInstanceResult.cc + src/model/RenewInstanceRequest.cc + src/model/RenewInstanceResult.cc ) + +add_library(hsm ${LIB_TYPE} + ${hsm_public_header} + ${hsm_public_header_model} + ${hsm_src}) + +set_target_properties(hsm + 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}hsm + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(hsm + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_HSM_LIBRARY) +endif() + +target_include_directories(hsm + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(hsm + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(hsm + jsoncpp) + target_include_directories(hsm + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(hsm + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(hsm + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(hsm + PRIVATE /usr/include/jsoncpp) + target_link_libraries(hsm + jsoncpp) +endif() + +install(FILES ${hsm_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/hsm) +install(FILES ${hsm_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/hsm/model) +install(TARGETS hsm + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/HsmClient.h b/hsm/include/alibabacloud/hsm/HsmClient.h new file mode 100644 index 000000000..75b377cfb --- /dev/null +++ b/hsm/include/alibabacloud/hsm/HsmClient.h @@ -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. + */ + +#ifndef ALIBABACLOUD_HSM_HSMCLIENT_H_ +#define ALIBABACLOUD_HSM_HSMCLIENT_H_ + +#include +#include +#include +#include +#include "HsmExport.h" +#include "model/ConfigWhiteListRequest.h" +#include "model/ConfigWhiteListResult.h" +#include "model/ConfigNetworkRequest.h" +#include "model/ConfigNetworkResult.h" +#include "model/ReleaseInstanceRequest.h" +#include "model/ReleaseInstanceResult.h" +#include "model/DescribeInstancesRequest.h" +#include "model/DescribeInstancesResult.h" +#include "model/DescribeRegionsRequest.h" +#include "model/DescribeRegionsResult.h" +#include "model/CreateInstanceRequest.h" +#include "model/CreateInstanceResult.h" +#include "model/ModifyInstanceRequest.h" +#include "model/ModifyInstanceResult.h" +#include "model/RenewInstanceRequest.h" +#include "model/RenewInstanceResult.h" + + +namespace AlibabaCloud +{ + namespace Hsm + { + class ALIBABACLOUD_HSM_EXPORT HsmClient : public RpcServiceClient + { + public: + typedef Outcome ConfigWhiteListOutcome; + typedef std::future ConfigWhiteListOutcomeCallable; + typedef std::function&)> ConfigWhiteListAsyncHandler; + typedef Outcome ConfigNetworkOutcome; + typedef std::future ConfigNetworkOutcomeCallable; + typedef std::function&)> ConfigNetworkAsyncHandler; + typedef Outcome ReleaseInstanceOutcome; + typedef std::future ReleaseInstanceOutcomeCallable; + typedef std::function&)> ReleaseInstanceAsyncHandler; + typedef Outcome DescribeInstancesOutcome; + typedef std::future DescribeInstancesOutcomeCallable; + typedef std::function&)> DescribeInstancesAsyncHandler; + typedef Outcome DescribeRegionsOutcome; + typedef std::future DescribeRegionsOutcomeCallable; + typedef std::function&)> DescribeRegionsAsyncHandler; + typedef Outcome CreateInstanceOutcome; + typedef std::future CreateInstanceOutcomeCallable; + typedef std::function&)> CreateInstanceAsyncHandler; + typedef Outcome ModifyInstanceOutcome; + typedef std::future ModifyInstanceOutcomeCallable; + typedef std::function&)> ModifyInstanceAsyncHandler; + typedef Outcome RenewInstanceOutcome; + typedef std::future RenewInstanceOutcomeCallable; + typedef std::function&)> RenewInstanceAsyncHandler; + + HsmClient(const Credentials &credentials, const ClientConfiguration &configuration); + HsmClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + HsmClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~HsmClient(); + ConfigWhiteListOutcome configWhiteList(const Model::ConfigWhiteListRequest &request)const; + void configWhiteListAsync(const Model::ConfigWhiteListRequest& request, const ConfigWhiteListAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ConfigWhiteListOutcomeCallable configWhiteListCallable(const Model::ConfigWhiteListRequest& request) const; + ConfigNetworkOutcome configNetwork(const Model::ConfigNetworkRequest &request)const; + void configNetworkAsync(const Model::ConfigNetworkRequest& request, const ConfigNetworkAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ConfigNetworkOutcomeCallable configNetworkCallable(const Model::ConfigNetworkRequest& request) const; + ReleaseInstanceOutcome releaseInstance(const Model::ReleaseInstanceRequest &request)const; + void releaseInstanceAsync(const Model::ReleaseInstanceRequest& request, const ReleaseInstanceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ReleaseInstanceOutcomeCallable releaseInstanceCallable(const Model::ReleaseInstanceRequest& request) const; + DescribeInstancesOutcome describeInstances(const Model::DescribeInstancesRequest &request)const; + void describeInstancesAsync(const Model::DescribeInstancesRequest& request, const DescribeInstancesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeInstancesOutcomeCallable describeInstancesCallable(const Model::DescribeInstancesRequest& request) const; + DescribeRegionsOutcome describeRegions(const Model::DescribeRegionsRequest &request)const; + void describeRegionsAsync(const Model::DescribeRegionsRequest& request, const DescribeRegionsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeRegionsOutcomeCallable describeRegionsCallable(const Model::DescribeRegionsRequest& request) const; + CreateInstanceOutcome createInstance(const Model::CreateInstanceRequest &request)const; + void createInstanceAsync(const Model::CreateInstanceRequest& request, const CreateInstanceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + CreateInstanceOutcomeCallable createInstanceCallable(const Model::CreateInstanceRequest& request) const; + ModifyInstanceOutcome modifyInstance(const Model::ModifyInstanceRequest &request)const; + void modifyInstanceAsync(const Model::ModifyInstanceRequest& request, const ModifyInstanceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ModifyInstanceOutcomeCallable modifyInstanceCallable(const Model::ModifyInstanceRequest& request) const; + RenewInstanceOutcome renewInstance(const Model::RenewInstanceRequest &request)const; + void renewInstanceAsync(const Model::RenewInstanceRequest& request, const RenewInstanceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + RenewInstanceOutcomeCallable renewInstanceCallable(const Model::RenewInstanceRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_HSM_HSMCLIENT_H_ diff --git a/hsm/include/alibabacloud/hsm/HsmExport.h b/hsm/include/alibabacloud/hsm/HsmExport.h new file mode 100644 index 000000000..524fe8019 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/HsmExport.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_HSM_HSMEXPORT_H_ +#define ALIBABACLOUD_HSM_HSMEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_HSM_LIBRARY) +# define ALIBABACLOUD_HSM_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_HSM_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_HSM_EXPORT +#endif + +#endif // !ALIBABACLOUD_HSM_HSMEXPORT_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/ConfigNetworkRequest.h b/hsm/include/alibabacloud/hsm/model/ConfigNetworkRequest.h new file mode 100644 index 000000000..342752ed9 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/ConfigNetworkRequest.h @@ -0,0 +1,63 @@ +/* + * 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_HSM_MODEL_CONFIGNETWORKREQUEST_H_ +#define ALIBABACLOUD_HSM_MODEL_CONFIGNETWORKREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT ConfigNetworkRequest : public RpcServiceRequest + { + + public: + ConfigNetworkRequest(); + ~ConfigNetworkRequest(); + + std::string getVSwitchId()const; + void setVSwitchId(const std::string& vSwitchId); + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + std::string getSourceIp()const; + void setSourceIp(const std::string& sourceIp); + std::string getVpcId()const; + void setVpcId(const std::string& vpcId); + std::string getIp()const; + void setIp(const std::string& ip); + + private: + std::string vSwitchId_; + long resourceOwnerId_; + std::string instanceId_; + std::string sourceIp_; + std::string vpcId_; + std::string ip_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_CONFIGNETWORKREQUEST_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/ConfigNetworkResult.h b/hsm/include/alibabacloud/hsm/model/ConfigNetworkResult.h new file mode 100644 index 000000000..1b7f2789f --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/ConfigNetworkResult.h @@ -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. + */ + +#ifndef ALIBABACLOUD_HSM_MODEL_CONFIGNETWORKRESULT_H_ +#define ALIBABACLOUD_HSM_MODEL_CONFIGNETWORKRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT ConfigNetworkResult : public ServiceResult + { + public: + + + ConfigNetworkResult(); + explicit ConfigNetworkResult(const std::string &payload); + ~ConfigNetworkResult(); + + protected: + void parse(const std::string &payload); + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_CONFIGNETWORKRESULT_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/ConfigWhiteListRequest.h b/hsm/include/alibabacloud/hsm/model/ConfigWhiteListRequest.h new file mode 100644 index 000000000..0efc5a349 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/ConfigWhiteListRequest.h @@ -0,0 +1,57 @@ +/* + * 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_HSM_MODEL_CONFIGWHITELISTREQUEST_H_ +#define ALIBABACLOUD_HSM_MODEL_CONFIGWHITELISTREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT ConfigWhiteListRequest : public RpcServiceRequest + { + + public: + ConfigWhiteListRequest(); + ~ConfigWhiteListRequest(); + + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + std::string getSourceIp()const; + void setSourceIp(const std::string& sourceIp); + std::string getWhiteList()const; + void setWhiteList(const std::string& whiteList); + + private: + long resourceOwnerId_; + std::string instanceId_; + std::string sourceIp_; + std::string whiteList_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_CONFIGWHITELISTREQUEST_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/ConfigWhiteListResult.h b/hsm/include/alibabacloud/hsm/model/ConfigWhiteListResult.h new file mode 100644 index 000000000..aa314e2cf --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/ConfigWhiteListResult.h @@ -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. + */ + +#ifndef ALIBABACLOUD_HSM_MODEL_CONFIGWHITELISTRESULT_H_ +#define ALIBABACLOUD_HSM_MODEL_CONFIGWHITELISTRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT ConfigWhiteListResult : public ServiceResult + { + public: + + + ConfigWhiteListResult(); + explicit ConfigWhiteListResult(const std::string &payload); + ~ConfigWhiteListResult(); + + protected: + void parse(const std::string &payload); + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_CONFIGWHITELISTRESULT_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/CreateInstanceRequest.h b/hsm/include/alibabacloud/hsm/model/CreateInstanceRequest.h new file mode 100644 index 000000000..77cc83ad5 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/CreateInstanceRequest.h @@ -0,0 +1,69 @@ +/* + * 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_HSM_MODEL_CREATEINSTANCEREQUEST_H_ +#define ALIBABACLOUD_HSM_MODEL_CREATEINSTANCEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT CreateInstanceRequest : public RpcServiceRequest + { + + public: + CreateInstanceRequest(); + ~CreateInstanceRequest(); + + int getPeriod()const; + void setPeriod(int period); + std::string getPeriodUnit()const; + void setPeriodUnit(const std::string& periodUnit); + std::string getResourceOwnerId()const; + void setResourceOwnerId(const std::string& resourceOwnerId); + int getQuantity()const; + void setQuantity(int quantity); + std::string getHsmDeviceType()const; + void setHsmDeviceType(const std::string& hsmDeviceType); + std::string getClientToken()const; + void setClientToken(const std::string& clientToken); + std::string getZoneId()const; + void setZoneId(const std::string& zoneId); + std::string getHsmOem()const; + void setHsmOem(const std::string& hsmOem); + + private: + int period_; + std::string periodUnit_; + std::string resourceOwnerId_; + int quantity_; + std::string hsmDeviceType_; + std::string clientToken_; + std::string zoneId_; + std::string hsmOem_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_CREATEINSTANCEREQUEST_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/CreateInstanceResult.h b/hsm/include/alibabacloud/hsm/model/CreateInstanceResult.h new file mode 100644 index 000000000..a50a20307 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/CreateInstanceResult.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_HSM_MODEL_CREATEINSTANCERESULT_H_ +#define ALIBABACLOUD_HSM_MODEL_CREATEINSTANCERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT CreateInstanceResult : public ServiceResult + { + public: + + + CreateInstanceResult(); + explicit CreateInstanceResult(const std::string &payload); + ~CreateInstanceResult(); + std::vector getInstanceIds()const; + + protected: + void parse(const std::string &payload); + private: + std::vector instanceIds_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_CREATEINSTANCERESULT_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/DescribeInstancesRequest.h b/hsm/include/alibabacloud/hsm/model/DescribeInstancesRequest.h new file mode 100644 index 000000000..5c319cbf0 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/DescribeInstancesRequest.h @@ -0,0 +1,63 @@ +/* + * 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_HSM_MODEL_DESCRIBEINSTANCESREQUEST_H_ +#define ALIBABACLOUD_HSM_MODEL_DESCRIBEINSTANCESREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT DescribeInstancesRequest : public RpcServiceRequest + { + + public: + DescribeInstancesRequest(); + ~DescribeInstancesRequest(); + + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + std::string getSourceIp()const; + void setSourceIp(const std::string& sourceIp); + int getPageSize()const; + void setPageSize(int pageSize); + int getCurrentPage()const; + void setCurrentPage(int currentPage); + int getHsmStatus()const; + void setHsmStatus(int hsmStatus); + + private: + long resourceOwnerId_; + std::string instanceId_; + std::string sourceIp_; + int pageSize_; + int currentPage_; + int hsmStatus_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_DESCRIBEINSTANCESREQUEST_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/DescribeInstancesResult.h b/hsm/include/alibabacloud/hsm/model/DescribeInstancesResult.h new file mode 100644 index 000000000..7c9ca75a5 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/DescribeInstancesResult.h @@ -0,0 +1,69 @@ +/* + * 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_HSM_MODEL_DESCRIBEINSTANCESRESULT_H_ +#define ALIBABACLOUD_HSM_MODEL_DESCRIBEINSTANCESRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT DescribeInstancesResult : public ServiceResult + { + public: + struct Instance + { + std::string zoneId; + std::string instanceId; + std::string ip; + long createTime; + std::vector whiteList; + std::string vswitchId; + std::string remark; + std::string hsmOem; + int hsmStatus; + std::string vpcId; + long expiredTime; + std::string regionId; + std::string hsmDeviceType; + }; + + + DescribeInstancesResult(); + explicit DescribeInstancesResult(const std::string &payload); + ~DescribeInstancesResult(); + std::vector getInstances()const; + int getTotalCount()const; + + protected: + void parse(const std::string &payload); + private: + std::vector instances_; + int totalCount_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_DESCRIBEINSTANCESRESULT_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/DescribeRegionsRequest.h b/hsm/include/alibabacloud/hsm/model/DescribeRegionsRequest.h new file mode 100644 index 000000000..dc4c79102 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/DescribeRegionsRequest.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_HSM_MODEL_DESCRIBEREGIONSREQUEST_H_ +#define ALIBABACLOUD_HSM_MODEL_DESCRIBEREGIONSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT DescribeRegionsRequest : public RpcServiceRequest + { + + public: + DescribeRegionsRequest(); + ~DescribeRegionsRequest(); + + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getSourceIp()const; + void setSourceIp(const std::string& sourceIp); + + private: + long resourceOwnerId_; + std::string sourceIp_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_DESCRIBEREGIONSREQUEST_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/DescribeRegionsResult.h b/hsm/include/alibabacloud/hsm/model/DescribeRegionsResult.h new file mode 100644 index 000000000..1cd215737 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/DescribeRegionsResult.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_HSM_MODEL_DESCRIBEREGIONSRESULT_H_ +#define ALIBABACLOUD_HSM_MODEL_DESCRIBEREGIONSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT DescribeRegionsResult : public ServiceResult + { + public: + struct Region + { + struct Zone + { + std::string zoneId; + }; + std::string regionId; + std::vector zones; + }; + + + DescribeRegionsResult(); + explicit DescribeRegionsResult(const std::string &payload); + ~DescribeRegionsResult(); + std::vector getRegions()const; + + protected: + void parse(const std::string &payload); + private: + std::vector regions_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_DESCRIBEREGIONSRESULT_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/ModifyInstanceRequest.h b/hsm/include/alibabacloud/hsm/model/ModifyInstanceRequest.h new file mode 100644 index 000000000..b36afb68c --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/ModifyInstanceRequest.h @@ -0,0 +1,57 @@ +/* + * 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_HSM_MODEL_MODIFYINSTANCEREQUEST_H_ +#define ALIBABACLOUD_HSM_MODEL_MODIFYINSTANCEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT ModifyInstanceRequest : public RpcServiceRequest + { + + public: + ModifyInstanceRequest(); + ~ModifyInstanceRequest(); + + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + std::string getSourceIp()const; + void setSourceIp(const std::string& sourceIp); + std::string getRemark()const; + void setRemark(const std::string& remark); + + private: + long resourceOwnerId_; + std::string instanceId_; + std::string sourceIp_; + std::string remark_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_MODIFYINSTANCEREQUEST_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/ModifyInstanceResult.h b/hsm/include/alibabacloud/hsm/model/ModifyInstanceResult.h new file mode 100644 index 000000000..d4da8e10b --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/ModifyInstanceResult.h @@ -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. + */ + +#ifndef ALIBABACLOUD_HSM_MODEL_MODIFYINSTANCERESULT_H_ +#define ALIBABACLOUD_HSM_MODEL_MODIFYINSTANCERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT ModifyInstanceResult : public ServiceResult + { + public: + + + ModifyInstanceResult(); + explicit ModifyInstanceResult(const std::string &payload); + ~ModifyInstanceResult(); + + protected: + void parse(const std::string &payload); + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_MODIFYINSTANCERESULT_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/ReleaseInstanceRequest.h b/hsm/include/alibabacloud/hsm/model/ReleaseInstanceRequest.h new file mode 100644 index 000000000..727ba4608 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/ReleaseInstanceRequest.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_HSM_MODEL_RELEASEINSTANCEREQUEST_H_ +#define ALIBABACLOUD_HSM_MODEL_RELEASEINSTANCEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT ReleaseInstanceRequest : public RpcServiceRequest + { + + public: + ReleaseInstanceRequest(); + ~ReleaseInstanceRequest(); + + std::string getResourceOwnerId()const; + void setResourceOwnerId(const std::string& resourceOwnerId); + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + + private: + std::string resourceOwnerId_; + std::string instanceId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_RELEASEINSTANCEREQUEST_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/ReleaseInstanceResult.h b/hsm/include/alibabacloud/hsm/model/ReleaseInstanceResult.h new file mode 100644 index 000000000..4fe91fd63 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/ReleaseInstanceResult.h @@ -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. + */ + +#ifndef ALIBABACLOUD_HSM_MODEL_RELEASEINSTANCERESULT_H_ +#define ALIBABACLOUD_HSM_MODEL_RELEASEINSTANCERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT ReleaseInstanceResult : public ServiceResult + { + public: + + + ReleaseInstanceResult(); + explicit ReleaseInstanceResult(const std::string &payload); + ~ReleaseInstanceResult(); + + protected: + void parse(const std::string &payload); + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_RELEASEINSTANCERESULT_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/RenewInstanceRequest.h b/hsm/include/alibabacloud/hsm/model/RenewInstanceRequest.h new file mode 100644 index 000000000..e09774222 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/RenewInstanceRequest.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_HSM_MODEL_RENEWINSTANCEREQUEST_H_ +#define ALIBABACLOUD_HSM_MODEL_RENEWINSTANCEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT RenewInstanceRequest : public RpcServiceRequest + { + + public: + RenewInstanceRequest(); + ~RenewInstanceRequest(); + + int getPeriod()const; + void setPeriod(int period); + std::string getPeriodUnit()const; + void setPeriodUnit(const std::string& periodUnit); + std::string getResourceOwnerId()const; + void setResourceOwnerId(const std::string& resourceOwnerId); + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + std::string getClientToken()const; + void setClientToken(const std::string& clientToken); + + private: + int period_; + std::string periodUnit_; + std::string resourceOwnerId_; + std::string instanceId_; + std::string clientToken_; + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_RENEWINSTANCEREQUEST_H_ \ No newline at end of file diff --git a/hsm/include/alibabacloud/hsm/model/RenewInstanceResult.h b/hsm/include/alibabacloud/hsm/model/RenewInstanceResult.h new file mode 100644 index 000000000..50685c354 --- /dev/null +++ b/hsm/include/alibabacloud/hsm/model/RenewInstanceResult.h @@ -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. + */ + +#ifndef ALIBABACLOUD_HSM_MODEL_RENEWINSTANCERESULT_H_ +#define ALIBABACLOUD_HSM_MODEL_RENEWINSTANCERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Hsm + { + namespace Model + { + class ALIBABACLOUD_HSM_EXPORT RenewInstanceResult : public ServiceResult + { + public: + + + RenewInstanceResult(); + explicit RenewInstanceResult(const std::string &payload); + ~RenewInstanceResult(); + + protected: + void parse(const std::string &payload); + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_HSM_MODEL_RENEWINSTANCERESULT_H_ \ No newline at end of file diff --git a/hsm/src/HsmClient.cc b/hsm/src/HsmClient.cc new file mode 100644 index 000000000..cc003351a --- /dev/null +++ b/hsm/src/HsmClient.cc @@ -0,0 +1,341 @@ +/* + * 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::Hsm; +using namespace AlibabaCloud::Hsm::Model; + +namespace +{ + const std::string SERVICE_NAME = "hsm"; +} + +HsmClient::HsmClient(const Credentials &credentials, const ClientConfiguration &configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "hsm"); +} + +HsmClient::HsmClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "hsm"); +} + +HsmClient::HsmClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) +{ + auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "hsm"); +} + +HsmClient::~HsmClient() +{} + +HsmClient::ConfigWhiteListOutcome HsmClient::configWhiteList(const ConfigWhiteListRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ConfigWhiteListOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ConfigWhiteListOutcome(ConfigWhiteListResult(outcome.result())); + else + return ConfigWhiteListOutcome(outcome.error()); +} + +void HsmClient::configWhiteListAsync(const ConfigWhiteListRequest& request, const ConfigWhiteListAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, configWhiteList(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +HsmClient::ConfigWhiteListOutcomeCallable HsmClient::configWhiteListCallable(const ConfigWhiteListRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->configWhiteList(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +HsmClient::ConfigNetworkOutcome HsmClient::configNetwork(const ConfigNetworkRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ConfigNetworkOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ConfigNetworkOutcome(ConfigNetworkResult(outcome.result())); + else + return ConfigNetworkOutcome(outcome.error()); +} + +void HsmClient::configNetworkAsync(const ConfigNetworkRequest& request, const ConfigNetworkAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, configNetwork(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +HsmClient::ConfigNetworkOutcomeCallable HsmClient::configNetworkCallable(const ConfigNetworkRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->configNetwork(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +HsmClient::ReleaseInstanceOutcome HsmClient::releaseInstance(const ReleaseInstanceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ReleaseInstanceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ReleaseInstanceOutcome(ReleaseInstanceResult(outcome.result())); + else + return ReleaseInstanceOutcome(outcome.error()); +} + +void HsmClient::releaseInstanceAsync(const ReleaseInstanceRequest& request, const ReleaseInstanceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, releaseInstance(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +HsmClient::ReleaseInstanceOutcomeCallable HsmClient::releaseInstanceCallable(const ReleaseInstanceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->releaseInstance(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +HsmClient::DescribeInstancesOutcome HsmClient::describeInstances(const DescribeInstancesRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeInstancesOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeInstancesOutcome(DescribeInstancesResult(outcome.result())); + else + return DescribeInstancesOutcome(outcome.error()); +} + +void HsmClient::describeInstancesAsync(const DescribeInstancesRequest& request, const DescribeInstancesAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeInstances(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +HsmClient::DescribeInstancesOutcomeCallable HsmClient::describeInstancesCallable(const DescribeInstancesRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeInstances(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +HsmClient::DescribeRegionsOutcome HsmClient::describeRegions(const DescribeRegionsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeRegionsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeRegionsOutcome(DescribeRegionsResult(outcome.result())); + else + return DescribeRegionsOutcome(outcome.error()); +} + +void HsmClient::describeRegionsAsync(const DescribeRegionsRequest& request, const DescribeRegionsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeRegions(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +HsmClient::DescribeRegionsOutcomeCallable HsmClient::describeRegionsCallable(const DescribeRegionsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeRegions(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +HsmClient::CreateInstanceOutcome HsmClient::createInstance(const CreateInstanceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return CreateInstanceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return CreateInstanceOutcome(CreateInstanceResult(outcome.result())); + else + return CreateInstanceOutcome(outcome.error()); +} + +void HsmClient::createInstanceAsync(const CreateInstanceRequest& request, const CreateInstanceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, createInstance(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +HsmClient::CreateInstanceOutcomeCallable HsmClient::createInstanceCallable(const CreateInstanceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->createInstance(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +HsmClient::ModifyInstanceOutcome HsmClient::modifyInstance(const ModifyInstanceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ModifyInstanceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ModifyInstanceOutcome(ModifyInstanceResult(outcome.result())); + else + return ModifyInstanceOutcome(outcome.error()); +} + +void HsmClient::modifyInstanceAsync(const ModifyInstanceRequest& request, const ModifyInstanceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, modifyInstance(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +HsmClient::ModifyInstanceOutcomeCallable HsmClient::modifyInstanceCallable(const ModifyInstanceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->modifyInstance(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +HsmClient::RenewInstanceOutcome HsmClient::renewInstance(const RenewInstanceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return RenewInstanceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return RenewInstanceOutcome(RenewInstanceResult(outcome.result())); + else + return RenewInstanceOutcome(outcome.error()); +} + +void HsmClient::renewInstanceAsync(const RenewInstanceRequest& request, const RenewInstanceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, renewInstance(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +HsmClient::RenewInstanceOutcomeCallable HsmClient::renewInstanceCallable(const RenewInstanceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->renewInstance(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/hsm/src/model/ConfigNetworkRequest.cc b/hsm/src/model/ConfigNetworkRequest.cc new file mode 100644 index 000000000..d9d744f71 --- /dev/null +++ b/hsm/src/model/ConfigNetworkRequest.cc @@ -0,0 +1,93 @@ +/* + * 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::Hsm::Model::ConfigNetworkRequest; + +ConfigNetworkRequest::ConfigNetworkRequest() : + RpcServiceRequest("hsm", "2018-01-11", "ConfigNetwork") +{} + +ConfigNetworkRequest::~ConfigNetworkRequest() +{} + +std::string ConfigNetworkRequest::getVSwitchId()const +{ + return vSwitchId_; +} + +void ConfigNetworkRequest::setVSwitchId(const std::string& vSwitchId) +{ + vSwitchId_ = vSwitchId; + setParameter("VSwitchId", vSwitchId); +} + +long ConfigNetworkRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void ConfigNetworkRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string ConfigNetworkRequest::getInstanceId()const +{ + return instanceId_; +} + +void ConfigNetworkRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string ConfigNetworkRequest::getSourceIp()const +{ + return sourceIp_; +} + +void ConfigNetworkRequest::setSourceIp(const std::string& sourceIp) +{ + sourceIp_ = sourceIp; + setParameter("SourceIp", sourceIp); +} + +std::string ConfigNetworkRequest::getVpcId()const +{ + return vpcId_; +} + +void ConfigNetworkRequest::setVpcId(const std::string& vpcId) +{ + vpcId_ = vpcId; + setParameter("VpcId", vpcId); +} + +std::string ConfigNetworkRequest::getIp()const +{ + return ip_; +} + +void ConfigNetworkRequest::setIp(const std::string& ip) +{ + ip_ = ip; + setParameter("Ip", ip); +} + diff --git a/hsm/src/model/ConfigNetworkResult.cc b/hsm/src/model/ConfigNetworkResult.cc new file mode 100644 index 000000000..11f4eacb8 --- /dev/null +++ b/hsm/src/model/ConfigNetworkResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::Hsm; +using namespace AlibabaCloud::Hsm::Model; + +ConfigNetworkResult::ConfigNetworkResult() : + ServiceResult() +{} + +ConfigNetworkResult::ConfigNetworkResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ConfigNetworkResult::~ConfigNetworkResult() +{} + +void ConfigNetworkResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + +} + diff --git a/hsm/src/model/ConfigWhiteListRequest.cc b/hsm/src/model/ConfigWhiteListRequest.cc new file mode 100644 index 000000000..6bdc9fa8f --- /dev/null +++ b/hsm/src/model/ConfigWhiteListRequest.cc @@ -0,0 +1,71 @@ +/* + * 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::Hsm::Model::ConfigWhiteListRequest; + +ConfigWhiteListRequest::ConfigWhiteListRequest() : + RpcServiceRequest("hsm", "2018-01-11", "ConfigWhiteList") +{} + +ConfigWhiteListRequest::~ConfigWhiteListRequest() +{} + +long ConfigWhiteListRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void ConfigWhiteListRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string ConfigWhiteListRequest::getInstanceId()const +{ + return instanceId_; +} + +void ConfigWhiteListRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string ConfigWhiteListRequest::getSourceIp()const +{ + return sourceIp_; +} + +void ConfigWhiteListRequest::setSourceIp(const std::string& sourceIp) +{ + sourceIp_ = sourceIp; + setParameter("SourceIp", sourceIp); +} + +std::string ConfigWhiteListRequest::getWhiteList()const +{ + return whiteList_; +} + +void ConfigWhiteListRequest::setWhiteList(const std::string& whiteList) +{ + whiteList_ = whiteList; + setParameter("WhiteList", whiteList); +} + diff --git a/hsm/src/model/ConfigWhiteListResult.cc b/hsm/src/model/ConfigWhiteListResult.cc new file mode 100644 index 000000000..68eac0cb9 --- /dev/null +++ b/hsm/src/model/ConfigWhiteListResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::Hsm; +using namespace AlibabaCloud::Hsm::Model; + +ConfigWhiteListResult::ConfigWhiteListResult() : + ServiceResult() +{} + +ConfigWhiteListResult::ConfigWhiteListResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ConfigWhiteListResult::~ConfigWhiteListResult() +{} + +void ConfigWhiteListResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + +} + diff --git a/hsm/src/model/CreateInstanceRequest.cc b/hsm/src/model/CreateInstanceRequest.cc new file mode 100644 index 000000000..6fecc574f --- /dev/null +++ b/hsm/src/model/CreateInstanceRequest.cc @@ -0,0 +1,115 @@ +/* + * 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::Hsm::Model::CreateInstanceRequest; + +CreateInstanceRequest::CreateInstanceRequest() : + RpcServiceRequest("hsm", "2018-01-11", "CreateInstance") +{} + +CreateInstanceRequest::~CreateInstanceRequest() +{} + +int CreateInstanceRequest::getPeriod()const +{ + return period_; +} + +void CreateInstanceRequest::setPeriod(int period) +{ + period_ = period; + setParameter("Period", std::to_string(period)); +} + +std::string CreateInstanceRequest::getPeriodUnit()const +{ + return periodUnit_; +} + +void CreateInstanceRequest::setPeriodUnit(const std::string& periodUnit) +{ + periodUnit_ = periodUnit; + setParameter("PeriodUnit", periodUnit); +} + +std::string CreateInstanceRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void CreateInstanceRequest::setResourceOwnerId(const std::string& resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", resourceOwnerId); +} + +int CreateInstanceRequest::getQuantity()const +{ + return quantity_; +} + +void CreateInstanceRequest::setQuantity(int quantity) +{ + quantity_ = quantity; + setParameter("Quantity", std::to_string(quantity)); +} + +std::string CreateInstanceRequest::getHsmDeviceType()const +{ + return hsmDeviceType_; +} + +void CreateInstanceRequest::setHsmDeviceType(const std::string& hsmDeviceType) +{ + hsmDeviceType_ = hsmDeviceType; + setParameter("HsmDeviceType", hsmDeviceType); +} + +std::string CreateInstanceRequest::getClientToken()const +{ + return clientToken_; +} + +void CreateInstanceRequest::setClientToken(const std::string& clientToken) +{ + clientToken_ = clientToken; + setParameter("ClientToken", clientToken); +} + +std::string CreateInstanceRequest::getZoneId()const +{ + return zoneId_; +} + +void CreateInstanceRequest::setZoneId(const std::string& zoneId) +{ + zoneId_ = zoneId; + setParameter("ZoneId", zoneId); +} + +std::string CreateInstanceRequest::getHsmOem()const +{ + return hsmOem_; +} + +void CreateInstanceRequest::setHsmOem(const std::string& hsmOem) +{ + hsmOem_ = hsmOem; + setParameter("HsmOem", hsmOem); +} + diff --git a/hsm/src/model/CreateInstanceResult.cc b/hsm/src/model/CreateInstanceResult.cc new file mode 100644 index 000000000..a2ffa0c90 --- /dev/null +++ b/hsm/src/model/CreateInstanceResult.cc @@ -0,0 +1,53 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Hsm; +using namespace AlibabaCloud::Hsm::Model; + +CreateInstanceResult::CreateInstanceResult() : + ServiceResult() +{} + +CreateInstanceResult::CreateInstanceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +CreateInstanceResult::~CreateInstanceResult() +{} + +void CreateInstanceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allInstanceIds = value["InstanceIds"]["InstanceId"]; + for (const auto &item : allInstanceIds) + instanceIds_.push_back(item.asString()); + +} + +std::vector CreateInstanceResult::getInstanceIds()const +{ + return instanceIds_; +} + diff --git a/hsm/src/model/DescribeInstancesRequest.cc b/hsm/src/model/DescribeInstancesRequest.cc new file mode 100644 index 000000000..8a24e490c --- /dev/null +++ b/hsm/src/model/DescribeInstancesRequest.cc @@ -0,0 +1,93 @@ +/* + * 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::Hsm::Model::DescribeInstancesRequest; + +DescribeInstancesRequest::DescribeInstancesRequest() : + RpcServiceRequest("hsm", "2018-01-11", "DescribeInstances") +{} + +DescribeInstancesRequest::~DescribeInstancesRequest() +{} + +long DescribeInstancesRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void DescribeInstancesRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string DescribeInstancesRequest::getInstanceId()const +{ + return instanceId_; +} + +void DescribeInstancesRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string DescribeInstancesRequest::getSourceIp()const +{ + return sourceIp_; +} + +void DescribeInstancesRequest::setSourceIp(const std::string& sourceIp) +{ + sourceIp_ = sourceIp; + setParameter("SourceIp", sourceIp); +} + +int DescribeInstancesRequest::getPageSize()const +{ + return pageSize_; +} + +void DescribeInstancesRequest::setPageSize(int pageSize) +{ + pageSize_ = pageSize; + setParameter("PageSize", std::to_string(pageSize)); +} + +int DescribeInstancesRequest::getCurrentPage()const +{ + return currentPage_; +} + +void DescribeInstancesRequest::setCurrentPage(int currentPage) +{ + currentPage_ = currentPage; + setParameter("CurrentPage", std::to_string(currentPage)); +} + +int DescribeInstancesRequest::getHsmStatus()const +{ + return hsmStatus_; +} + +void DescribeInstancesRequest::setHsmStatus(int hsmStatus) +{ + hsmStatus_ = hsmStatus; + setParameter("HsmStatus", std::to_string(hsmStatus)); +} + diff --git a/hsm/src/model/DescribeInstancesResult.cc b/hsm/src/model/DescribeInstancesResult.cc new file mode 100644 index 000000000..30e9688c4 --- /dev/null +++ b/hsm/src/model/DescribeInstancesResult.cc @@ -0,0 +1,90 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Hsm; +using namespace AlibabaCloud::Hsm::Model; + +DescribeInstancesResult::DescribeInstancesResult() : + ServiceResult() +{} + +DescribeInstancesResult::DescribeInstancesResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeInstancesResult::~DescribeInstancesResult() +{} + +void DescribeInstancesResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allInstances = value["Instances"]["Instance"]; + for (auto value : allInstances) + { + Instance instancesObject; + if(!value["InstanceId"].isNull()) + instancesObject.instanceId = value["InstanceId"].asString(); + if(!value["RegionId"].isNull()) + instancesObject.regionId = value["RegionId"].asString(); + if(!value["ZoneId"].isNull()) + instancesObject.zoneId = value["ZoneId"].asString(); + if(!value["HsmStatus"].isNull()) + instancesObject.hsmStatus = std::stoi(value["HsmStatus"].asString()); + if(!value["HsmOem"].isNull()) + instancesObject.hsmOem = value["HsmOem"].asString(); + if(!value["HsmDeviceType"].isNull()) + instancesObject.hsmDeviceType = value["HsmDeviceType"].asString(); + if(!value["VpcId"].isNull()) + instancesObject.vpcId = value["VpcId"].asString(); + if(!value["VswitchId"].isNull()) + instancesObject.vswitchId = value["VswitchId"].asString(); + if(!value["Ip"].isNull()) + instancesObject.ip = value["Ip"].asString(); + if(!value["Remark"].isNull()) + instancesObject.remark = value["Remark"].asString(); + if(!value["ExpiredTime"].isNull()) + instancesObject.expiredTime = std::stol(value["ExpiredTime"].asString()); + if(!value["CreateTime"].isNull()) + instancesObject.createTime = std::stol(value["CreateTime"].asString()); + auto allWhiteList = value["WhiteList"]["WhiteListItem"]; + for (auto value : allWhiteList) + instancesObject.whiteList.push_back(value.asString()); + instances_.push_back(instancesObject); + } + if(!value["TotalCount"].isNull()) + totalCount_ = std::stoi(value["TotalCount"].asString()); + +} + +std::vector DescribeInstancesResult::getInstances()const +{ + return instances_; +} + +int DescribeInstancesResult::getTotalCount()const +{ + return totalCount_; +} + diff --git a/hsm/src/model/DescribeRegionsRequest.cc b/hsm/src/model/DescribeRegionsRequest.cc new file mode 100644 index 000000000..7899e5a12 --- /dev/null +++ b/hsm/src/model/DescribeRegionsRequest.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::Hsm::Model::DescribeRegionsRequest; + +DescribeRegionsRequest::DescribeRegionsRequest() : + RpcServiceRequest("hsm", "2018-01-11", "DescribeRegions") +{} + +DescribeRegionsRequest::~DescribeRegionsRequest() +{} + +long DescribeRegionsRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void DescribeRegionsRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string DescribeRegionsRequest::getSourceIp()const +{ + return sourceIp_; +} + +void DescribeRegionsRequest::setSourceIp(const std::string& sourceIp) +{ + sourceIp_ = sourceIp; + setParameter("SourceIp", sourceIp); +} + diff --git a/hsm/src/model/DescribeRegionsResult.cc b/hsm/src/model/DescribeRegionsResult.cc new file mode 100644 index 000000000..edb3fadff --- /dev/null +++ b/hsm/src/model/DescribeRegionsResult.cc @@ -0,0 +1,66 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Hsm; +using namespace AlibabaCloud::Hsm::Model; + +DescribeRegionsResult::DescribeRegionsResult() : + ServiceResult() +{} + +DescribeRegionsResult::DescribeRegionsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeRegionsResult::~DescribeRegionsResult() +{} + +void DescribeRegionsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allRegions = value["Regions"]["Region"]; + for (auto value : allRegions) + { + Region regionsObject; + if(!value["RegionId"].isNull()) + regionsObject.regionId = value["RegionId"].asString(); + auto allZones = value["Zones"]["Zone"]; + for (auto value : allZones) + { + Region::Zone zonesObject; + if(!value["ZoneId"].isNull()) + zonesObject.zoneId = value["ZoneId"].asString(); + regionsObject.zones.push_back(zonesObject); + } + regions_.push_back(regionsObject); + } + +} + +std::vector DescribeRegionsResult::getRegions()const +{ + return regions_; +} + diff --git a/hsm/src/model/ModifyInstanceRequest.cc b/hsm/src/model/ModifyInstanceRequest.cc new file mode 100644 index 000000000..b20427915 --- /dev/null +++ b/hsm/src/model/ModifyInstanceRequest.cc @@ -0,0 +1,71 @@ +/* + * 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::Hsm::Model::ModifyInstanceRequest; + +ModifyInstanceRequest::ModifyInstanceRequest() : + RpcServiceRequest("hsm", "2018-01-11", "ModifyInstance") +{} + +ModifyInstanceRequest::~ModifyInstanceRequest() +{} + +long ModifyInstanceRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void ModifyInstanceRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string ModifyInstanceRequest::getInstanceId()const +{ + return instanceId_; +} + +void ModifyInstanceRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string ModifyInstanceRequest::getSourceIp()const +{ + return sourceIp_; +} + +void ModifyInstanceRequest::setSourceIp(const std::string& sourceIp) +{ + sourceIp_ = sourceIp; + setParameter("SourceIp", sourceIp); +} + +std::string ModifyInstanceRequest::getRemark()const +{ + return remark_; +} + +void ModifyInstanceRequest::setRemark(const std::string& remark) +{ + remark_ = remark; + setParameter("Remark", remark); +} + diff --git a/hsm/src/model/ModifyInstanceResult.cc b/hsm/src/model/ModifyInstanceResult.cc new file mode 100644 index 000000000..fe4e6ed9f --- /dev/null +++ b/hsm/src/model/ModifyInstanceResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::Hsm; +using namespace AlibabaCloud::Hsm::Model; + +ModifyInstanceResult::ModifyInstanceResult() : + ServiceResult() +{} + +ModifyInstanceResult::ModifyInstanceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ModifyInstanceResult::~ModifyInstanceResult() +{} + +void ModifyInstanceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + +} + diff --git a/hsm/src/model/ReleaseInstanceRequest.cc b/hsm/src/model/ReleaseInstanceRequest.cc new file mode 100644 index 000000000..0b7871409 --- /dev/null +++ b/hsm/src/model/ReleaseInstanceRequest.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::Hsm::Model::ReleaseInstanceRequest; + +ReleaseInstanceRequest::ReleaseInstanceRequest() : + RpcServiceRequest("hsm", "2018-01-11", "ReleaseInstance") +{} + +ReleaseInstanceRequest::~ReleaseInstanceRequest() +{} + +std::string ReleaseInstanceRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void ReleaseInstanceRequest::setResourceOwnerId(const std::string& resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", resourceOwnerId); +} + +std::string ReleaseInstanceRequest::getInstanceId()const +{ + return instanceId_; +} + +void ReleaseInstanceRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + diff --git a/hsm/src/model/ReleaseInstanceResult.cc b/hsm/src/model/ReleaseInstanceResult.cc new file mode 100644 index 000000000..2b44ddbfb --- /dev/null +++ b/hsm/src/model/ReleaseInstanceResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::Hsm; +using namespace AlibabaCloud::Hsm::Model; + +ReleaseInstanceResult::ReleaseInstanceResult() : + ServiceResult() +{} + +ReleaseInstanceResult::ReleaseInstanceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ReleaseInstanceResult::~ReleaseInstanceResult() +{} + +void ReleaseInstanceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + +} + diff --git a/hsm/src/model/RenewInstanceRequest.cc b/hsm/src/model/RenewInstanceRequest.cc new file mode 100644 index 000000000..86190bc27 --- /dev/null +++ b/hsm/src/model/RenewInstanceRequest.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::Hsm::Model::RenewInstanceRequest; + +RenewInstanceRequest::RenewInstanceRequest() : + RpcServiceRequest("hsm", "2018-01-11", "RenewInstance") +{} + +RenewInstanceRequest::~RenewInstanceRequest() +{} + +int RenewInstanceRequest::getPeriod()const +{ + return period_; +} + +void RenewInstanceRequest::setPeriod(int period) +{ + period_ = period; + setParameter("Period", std::to_string(period)); +} + +std::string RenewInstanceRequest::getPeriodUnit()const +{ + return periodUnit_; +} + +void RenewInstanceRequest::setPeriodUnit(const std::string& periodUnit) +{ + periodUnit_ = periodUnit; + setParameter("PeriodUnit", periodUnit); +} + +std::string RenewInstanceRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void RenewInstanceRequest::setResourceOwnerId(const std::string& resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", resourceOwnerId); +} + +std::string RenewInstanceRequest::getInstanceId()const +{ + return instanceId_; +} + +void RenewInstanceRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string RenewInstanceRequest::getClientToken()const +{ + return clientToken_; +} + +void RenewInstanceRequest::setClientToken(const std::string& clientToken) +{ + clientToken_ = clientToken; + setParameter("ClientToken", clientToken); +} + diff --git a/hsm/src/model/RenewInstanceResult.cc b/hsm/src/model/RenewInstanceResult.cc new file mode 100644 index 000000000..ec766245f --- /dev/null +++ b/hsm/src/model/RenewInstanceResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::Hsm; +using namespace AlibabaCloud::Hsm::Model; + +RenewInstanceResult::RenewInstanceResult() : + ServiceResult() +{} + +RenewInstanceResult::RenewInstanceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +RenewInstanceResult::~RenewInstanceResult() +{} + +void RenewInstanceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + +} +