由鸿逸发起的HSM SDK自动发布, 版本号:1.7.1

Signed-off-by: haowei.yao <haowei.yao@alibaba-inc.com>
This commit is contained in:
haowei.yao
2018-04-27 19:48:27 +08:00
parent 6ecfd8332a
commit 339cf28edd
39 changed files with 2557 additions and 2 deletions

View File

@@ -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.

View File

@@ -68,4 +68,5 @@ add_subdirectory(teslamaxcompute)
add_subdirectory(push)
add_subdirectory(csb)
add_subdirectory(domain)
add_subdirectory(green)
add_subdirectory(green)
add_subdirectory(hsm)

View File

@@ -1 +1 @@
1.7.0
1.7.1

114
hsm/CMakeLists.txt Normal file
View File

@@ -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}
)

View File

@@ -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 <future>
#include <alibabacloud/core/AsyncCallerContext.h>
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#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<Error, Model::ConfigWhiteListResult> ConfigWhiteListOutcome;
typedef std::future<ConfigWhiteListOutcome> ConfigWhiteListOutcomeCallable;
typedef std::function<void(const HsmClient*, const Model::ConfigWhiteListRequest&, const ConfigWhiteListOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ConfigWhiteListAsyncHandler;
typedef Outcome<Error, Model::ConfigNetworkResult> ConfigNetworkOutcome;
typedef std::future<ConfigNetworkOutcome> ConfigNetworkOutcomeCallable;
typedef std::function<void(const HsmClient*, const Model::ConfigNetworkRequest&, const ConfigNetworkOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ConfigNetworkAsyncHandler;
typedef Outcome<Error, Model::ReleaseInstanceResult> ReleaseInstanceOutcome;
typedef std::future<ReleaseInstanceOutcome> ReleaseInstanceOutcomeCallable;
typedef std::function<void(const HsmClient*, const Model::ReleaseInstanceRequest&, const ReleaseInstanceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ReleaseInstanceAsyncHandler;
typedef Outcome<Error, Model::DescribeInstancesResult> DescribeInstancesOutcome;
typedef std::future<DescribeInstancesOutcome> DescribeInstancesOutcomeCallable;
typedef std::function<void(const HsmClient*, const Model::DescribeInstancesRequest&, const DescribeInstancesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeInstancesAsyncHandler;
typedef Outcome<Error, Model::DescribeRegionsResult> DescribeRegionsOutcome;
typedef std::future<DescribeRegionsOutcome> DescribeRegionsOutcomeCallable;
typedef std::function<void(const HsmClient*, const Model::DescribeRegionsRequest&, const DescribeRegionsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeRegionsAsyncHandler;
typedef Outcome<Error, Model::CreateInstanceResult> CreateInstanceOutcome;
typedef std::future<CreateInstanceOutcome> CreateInstanceOutcomeCallable;
typedef std::function<void(const HsmClient*, const Model::CreateInstanceRequest&, const CreateInstanceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateInstanceAsyncHandler;
typedef Outcome<Error, Model::ModifyInstanceResult> ModifyInstanceOutcome;
typedef std::future<ModifyInstanceOutcome> ModifyInstanceOutcomeCallable;
typedef std::function<void(const HsmClient*, const Model::ModifyInstanceRequest&, const ModifyInstanceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ModifyInstanceAsyncHandler;
typedef Outcome<Error, Model::RenewInstanceResult> RenewInstanceOutcome;
typedef std::future<RenewInstanceOutcome> RenewInstanceOutcomeCallable;
typedef std::function<void(const HsmClient*, const Model::RenewInstanceRequest&, const RenewInstanceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RenewInstanceAsyncHandler;
HsmClient(const Credentials &credentials, const ClientConfiguration &configuration);
HsmClient(const std::shared_ptr<CredentialsProvider> &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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& context = nullptr) const;
RenewInstanceOutcomeCallable renewInstanceCallable(const Model::RenewInstanceRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;
};
}
}
#endif // !ALIBABACLOUD_HSM_HSMCLIENT_H_

View File

@@ -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 <alibabacloud/core/Global.h>
#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_

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/hsm/HsmExport.h>
namespace AlibabaCloud
{
namespace Hsm
{
namespace Model
{
class ALIBABACLOUD_HSM_EXPORT CreateInstanceResult : public ServiceResult
{
public:
CreateInstanceResult();
explicit CreateInstanceResult(const std::string &payload);
~CreateInstanceResult();
std::vector<std::string> getInstanceIds()const;
protected:
void parse(const std::string &payload);
private:
std::vector<std::string> instanceIds_;
};
}
}
}
#endif // !ALIBABACLOUD_HSM_MODEL_CREATEINSTANCERESULT_H_

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/hsm/HsmExport.h>
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<std::string> 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<Instance> getInstances()const;
int getTotalCount()const;
protected:
void parse(const std::string &payload);
private:
std::vector<Instance> instances_;
int totalCount_;
};
}
}
}
#endif // !ALIBABACLOUD_HSM_MODEL_DESCRIBEINSTANCESRESULT_H_

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/hsm/HsmExport.h>
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<Region::Zone> zones;
};
DescribeRegionsResult();
explicit DescribeRegionsResult(const std::string &payload);
~DescribeRegionsResult();
std::vector<Region> getRegions()const;
protected:
void parse(const std::string &payload);
private:
std::vector<Region> regions_;
};
}
}
}
#endif // !ALIBABACLOUD_HSM_MODEL_DESCRIBEREGIONSRESULT_H_

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/hsm/HsmExport.h>
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_

341
hsm/src/HsmClient.cc Normal file
View File

@@ -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 <alibabacloud/hsm/HsmClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
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<SimpleCredentialsProvider>(credentials), configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "hsm");
}
HsmClient::HsmClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(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<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(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<const AsyncCallerContext>& 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<std::packaged_task<ConfigWhiteListOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<ConfigNetworkOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<ReleaseInstanceOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<DescribeInstancesOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<DescribeRegionsOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<CreateInstanceOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<ModifyInstanceOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<RenewInstanceOutcome()>>(
[this, request]()
{
return this->renewInstance(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -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 <alibabacloud/hsm/model/ConfigNetworkRequest.h>
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);
}

View File

@@ -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 <alibabacloud/hsm/model/ConfigNetworkResult.h>
#include <json/json.h>
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());
}

View File

@@ -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 <alibabacloud/hsm/model/ConfigWhiteListRequest.h>
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);
}

View File

@@ -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 <alibabacloud/hsm/model/ConfigWhiteListResult.h>
#include <json/json.h>
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());
}

View File

@@ -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 <alibabacloud/hsm/model/CreateInstanceRequest.h>
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);
}

View File

@@ -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 <alibabacloud/hsm/model/CreateInstanceResult.h>
#include <json/json.h>
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<std::string> CreateInstanceResult::getInstanceIds()const
{
return instanceIds_;
}

View File

@@ -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 <alibabacloud/hsm/model/DescribeInstancesRequest.h>
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));
}

View File

@@ -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 <alibabacloud/hsm/model/DescribeInstancesResult.h>
#include <json/json.h>
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::Instance> DescribeInstancesResult::getInstances()const
{
return instances_;
}
int DescribeInstancesResult::getTotalCount()const
{
return totalCount_;
}

View File

@@ -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 <alibabacloud/hsm/model/DescribeRegionsRequest.h>
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);
}

View File

@@ -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 <alibabacloud/hsm/model/DescribeRegionsResult.h>
#include <json/json.h>
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::Region> DescribeRegionsResult::getRegions()const
{
return regions_;
}

View File

@@ -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 <alibabacloud/hsm/model/ModifyInstanceRequest.h>
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);
}

View File

@@ -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 <alibabacloud/hsm/model/ModifyInstanceResult.h>
#include <json/json.h>
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());
}

View File

@@ -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 <alibabacloud/hsm/model/ReleaseInstanceRequest.h>
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);
}

View File

@@ -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 <alibabacloud/hsm/model/ReleaseInstanceResult.h>
#include <json/json.h>
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());
}

View File

@@ -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 <alibabacloud/hsm/model/RenewInstanceRequest.h>
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);
}

View File

@@ -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 <alibabacloud/hsm/model/RenewInstanceResult.h>
#include <json/json.h>
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());
}