由鸿逸发起的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

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());
}