Rebuild sdk (#60)

* rebuild sdk

* fixed ut include Utils.h
This commit is contained in:
Axios
2019-08-14 14:34:09 +08:00
committed by GitHub
parent f3d9843e63
commit c43307bc80
11893 changed files with 462166 additions and 221301 deletions

View File

@@ -41,41 +41,41 @@ namespace AlibabaCloud
class ALIBABACLOUD_TESLADAM_EXPORT TeslaDamClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::ActionResult> ActionOutcome;
typedef std::future<ActionOutcome> ActionOutcomeCallable;
typedef Outcome<Error, Model::ActionResult> ActionOutcome;
typedef std::future<ActionOutcome> ActionOutcomeCallable;
typedef std::function<void(const TeslaDamClient*, const Model::ActionRequest&, const ActionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ActionAsyncHandler;
typedef Outcome<Error, Model::ActionDiskRmaResult> ActionDiskRmaOutcome;
typedef std::future<ActionDiskRmaOutcome> ActionDiskRmaOutcomeCallable;
typedef Outcome<Error, Model::ActionDiskRmaResult> ActionDiskRmaOutcome;
typedef std::future<ActionDiskRmaOutcome> ActionDiskRmaOutcomeCallable;
typedef std::function<void(const TeslaDamClient*, const Model::ActionDiskRmaRequest&, const ActionDiskRmaOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ActionDiskRmaAsyncHandler;
typedef Outcome<Error, Model::ActionDiskMaskResult> ActionDiskMaskOutcome;
typedef std::future<ActionDiskMaskOutcome> ActionDiskMaskOutcomeCallable;
typedef Outcome<Error, Model::ActionDiskMaskResult> ActionDiskMaskOutcome;
typedef std::future<ActionDiskMaskOutcome> ActionDiskMaskOutcomeCallable;
typedef std::function<void(const TeslaDamClient*, const Model::ActionDiskMaskRequest&, const ActionDiskMaskOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ActionDiskMaskAsyncHandler;
typedef Outcome<Error, Model::ActionDiskCheckResult> ActionDiskCheckOutcome;
typedef std::future<ActionDiskCheckOutcome> ActionDiskCheckOutcomeCallable;
typedef Outcome<Error, Model::ActionDiskCheckResult> ActionDiskCheckOutcome;
typedef std::future<ActionDiskCheckOutcome> ActionDiskCheckOutcomeCallable;
typedef std::function<void(const TeslaDamClient*, const Model::ActionDiskCheckRequest&, const ActionDiskCheckOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ActionDiskCheckAsyncHandler;
typedef Outcome<Error, Model::HostGetsResult> HostGetsOutcome;
typedef std::future<HostGetsOutcome> HostGetsOutcomeCallable;
typedef Outcome<Error, Model::HostGetsResult> HostGetsOutcome;
typedef std::future<HostGetsOutcome> HostGetsOutcomeCallable;
typedef std::function<void(const TeslaDamClient*, const Model::HostGetsRequest&, const HostGetsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> HostGetsAsyncHandler;
TeslaDamClient(const Credentials &credentials, const ClientConfiguration &configuration);
TeslaDamClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
TeslaDamClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~TeslaDamClient();
ActionOutcome action(const Model::ActionRequest &request)const;
void actionAsync(const Model::ActionRequest& request, const ActionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ActionOutcomeCallable actionCallable(const Model::ActionRequest& request) const;
ActionDiskRmaOutcome actionDiskRma(const Model::ActionDiskRmaRequest &request)const;
void actionDiskRmaAsync(const Model::ActionDiskRmaRequest& request, const ActionDiskRmaAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ActionDiskRmaOutcomeCallable actionDiskRmaCallable(const Model::ActionDiskRmaRequest& request) const;
ActionDiskMaskOutcome actionDiskMask(const Model::ActionDiskMaskRequest &request)const;
void actionDiskMaskAsync(const Model::ActionDiskMaskRequest& request, const ActionDiskMaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ActionDiskMaskOutcomeCallable actionDiskMaskCallable(const Model::ActionDiskMaskRequest& request) const;
ActionDiskCheckOutcome actionDiskCheck(const Model::ActionDiskCheckRequest &request)const;
void actionDiskCheckAsync(const Model::ActionDiskCheckRequest& request, const ActionDiskCheckAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ActionDiskCheckOutcomeCallable actionDiskCheckCallable(const Model::ActionDiskCheckRequest& request) const;
HostGetsOutcome hostGets(const Model::HostGetsRequest &request)const;
void hostGetsAsync(const Model::HostGetsRequest& request, const HostGetsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
HostGetsOutcomeCallable hostGetsCallable(const Model::HostGetsRequest& request) const;
ActionOutcome action(const Model::ActionRequest &request)const;
void actionAsync(const Model::ActionRequest& request, const ActionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ActionOutcomeCallable actionCallable(const Model::ActionRequest& request) const;
ActionDiskRmaOutcome actionDiskRma(const Model::ActionDiskRmaRequest &request)const;
void actionDiskRmaAsync(const Model::ActionDiskRmaRequest& request, const ActionDiskRmaAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ActionDiskRmaOutcomeCallable actionDiskRmaCallable(const Model::ActionDiskRmaRequest& request) const;
ActionDiskMaskOutcome actionDiskMask(const Model::ActionDiskMaskRequest &request)const;
void actionDiskMaskAsync(const Model::ActionDiskMaskRequest& request, const ActionDiskMaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ActionDiskMaskOutcomeCallable actionDiskMaskCallable(const Model::ActionDiskMaskRequest& request) const;
ActionDiskCheckOutcome actionDiskCheck(const Model::ActionDiskCheckRequest &request)const;
void actionDiskCheckAsync(const Model::ActionDiskCheckRequest& request, const ActionDiskCheckAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ActionDiskCheckOutcomeCallable actionDiskCheckCallable(const Model::ActionDiskCheckRequest& request) const;
HostGetsOutcome hostGets(const Model::HostGetsRequest &request)const;
void hostGetsAsync(const Model::HostGetsRequest& request, const HostGetsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
HostGetsOutcomeCallable hostGetsCallable(const Model::HostGetsRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;

View File

@@ -37,16 +37,16 @@ namespace AlibabaCloud
ActionDiskCheckResult();
explicit ActionDiskCheckResult(const std::string &payload);
~ActionDiskCheckResult();
bool getStatus()const;
std::string getMessage()const;
std::string getResult()const;
bool getStatus()const;
std::string getMessage()const;
std::string getResult()const;
protected:
void parse(const std::string &payload);
private:
bool status_;
std::string message_;
std::string result_;
bool status_;
std::string message_;
std::string result_;
};
}

View File

@@ -37,16 +37,16 @@ namespace AlibabaCloud
ActionDiskMaskResult();
explicit ActionDiskMaskResult(const std::string &payload);
~ActionDiskMaskResult();
bool getStatus()const;
std::string getMessage()const;
std::string getResult()const;
bool getStatus()const;
std::string getMessage()const;
std::string getResult()const;
protected:
void parse(const std::string &payload);
private:
bool status_;
std::string message_;
std::string result_;
bool status_;
std::string message_;
std::string result_;
};
}

View File

@@ -37,16 +37,16 @@ namespace AlibabaCloud
ActionDiskRmaResult();
explicit ActionDiskRmaResult(const std::string &payload);
~ActionDiskRmaResult();
bool getStatus()const;
std::string getMessage()const;
std::string getResult()const;
bool getStatus()const;
std::string getMessage()const;
std::string getResult()const;
protected:
void parse(const std::string &payload);
private:
bool status_;
std::string message_;
std::string result_;
bool status_;
std::string message_;
std::string result_;
};
}

View File

@@ -37,16 +37,16 @@ namespace AlibabaCloud
ActionResult();
explicit ActionResult(const std::string &payload);
~ActionResult();
bool getStatus()const;
std::string getMessage()const;
std::string getResult()const;
bool getStatus()const;
std::string getMessage()const;
std::string getResult()const;
protected:
void parse(const std::string &payload);
private:
bool status_;
std::string message_;
std::string result_;
bool status_;
std::string message_;
std::string result_;
};
}

View File

@@ -32,32 +32,32 @@ namespace AlibabaCloud
class ALIBABACLOUD_TESLADAM_EXPORT HostGetsResult : public ServiceResult
{
public:
struct DataItem
{
std::string appCode;
std::string clusterCode;
int healthScoreLast;
std::string ip;
std::string hostname;
std::string healthReasonLast;
int sshStatus;
int heartStatus;
};
struct DataItem
{
std::string appCode;
std::string clusterCode;
int healthScoreLast;
std::string ip;
std::string hostname;
std::string healthReasonLast;
int sshStatus;
int heartStatus;
};
HostGetsResult();
explicit HostGetsResult(const std::string &payload);
~HostGetsResult();
bool getStatus()const;
std::string getMessage()const;
std::vector<DataItem> getData()const;
bool getStatus()const;
std::string getMessage()const;
std::vector<DataItem> getData()const;
protected:
void parse(const std::string &payload);
private:
bool status_;
std::string message_;
std::vector<DataItem> data_;
bool status_;
std::string message_;
std::vector<DataItem> data_;
};
}

View File

@@ -24,28 +24,28 @@ using namespace AlibabaCloud::TeslaDam::Model;
namespace
{
const std::string SERVICE_NAME = "TeslaDam";
const std::string SERVICE_NAME = "TeslaDam";
}
TeslaDamClient::TeslaDamClient(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, "");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "tesladam");
}
TeslaDamClient::TeslaDamClient(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, "");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "tesladam");
}
TeslaDamClient::TeslaDamClient(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, "");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "tesladam");
}
TeslaDamClient::~TeslaDamClient()
@@ -86,7 +86,7 @@ TeslaDamClient::ActionOutcomeCallable TeslaDamClient::actionCallable(const Actio
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TeslaDamClient::ActionDiskRmaOutcome TeslaDamClient::actionDiskRma(const ActionDiskRmaRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -122,7 +122,7 @@ TeslaDamClient::ActionDiskRmaOutcomeCallable TeslaDamClient::actionDiskRmaCallab
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TeslaDamClient::ActionDiskMaskOutcome TeslaDamClient::actionDiskMask(const ActionDiskMaskRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -158,7 +158,7 @@ TeslaDamClient::ActionDiskMaskOutcomeCallable TeslaDamClient::actionDiskMaskCall
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TeslaDamClient::ActionDiskCheckOutcome TeslaDamClient::actionDiskCheck(const ActionDiskCheckRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -194,7 +194,7 @@ TeslaDamClient::ActionDiskCheckOutcomeCallable TeslaDamClient::actionDiskCheckCa
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TeslaDamClient::HostGetsOutcome TeslaDamClient::hostGets(const HostGetsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -230,4 +230,4 @@ TeslaDamClient::HostGetsOutcomeCallable TeslaDamClient::hostGetsCallable(const H
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -33,7 +33,7 @@ std::string ActionDiskCheckRequest::getDiskMount()const
void ActionDiskCheckRequest::setDiskMount(const std::string& diskMount)
{
diskMount_ = diskMount;
setParameter("DiskMount", diskMount);
setCoreParameter("DiskMount", diskMount);
}
std::string ActionDiskCheckRequest::getIp()const
@@ -44,6 +44,6 @@ std::string ActionDiskCheckRequest::getIp()const
void ActionDiskCheckRequest::setIp(const std::string& ip)
{
ip_ = ip;
setParameter("Ip", ip);
setCoreParameter("Ip", ip);
}

View File

@@ -35,32 +35,35 @@ ActionDiskCheckResult::~ActionDiskCheckResult()
void ActionDiskCheckResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::CharReaderBuilder builder;
Json::CharReader *reader = builder.newCharReader();
Json::Value *val;
Json::Value value;
reader.parse(payload, value);
JSONCPP_STRING *errs;
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
value = *val;
setRequestId(value["RequestId"].asString());
if(!value["Status"].isNull())
status_ = value["Status"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Result"].isNull())
result_ = value["Result"].asString();
if(!value["Status"].isNull())
status_ = value["Status"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Result"].isNull())
result_ = value["Result"].asString();
}
bool ActionDiskCheckResult::getStatus()const
{
return status_;
}
std::string ActionDiskCheckResult::getMessage()const
{
return message_;
}
std::string ActionDiskCheckResult::getResult()const
{
return result_;
}
bool ActionDiskCheckResult::getStatus()const
{
return status_;
}
std::string ActionDiskCheckResult::getMessage()const
{
return message_;
}
std::string ActionDiskCheckResult::getResult()const
{
return result_;
}

View File

@@ -33,7 +33,7 @@ std::string ActionDiskMaskRequest::getOp()const
void ActionDiskMaskRequest::setOp(const std::string& op)
{
op_ = op;
setParameter("Op", op);
setCoreParameter("Op", op);
}
std::string ActionDiskMaskRequest::getDiskMount()const
@@ -44,7 +44,7 @@ std::string ActionDiskMaskRequest::getDiskMount()const
void ActionDiskMaskRequest::setDiskMount(const std::string& diskMount)
{
diskMount_ = diskMount;
setParameter("DiskMount", diskMount);
setCoreParameter("DiskMount", diskMount);
}
std::string ActionDiskMaskRequest::getIp()const
@@ -55,6 +55,6 @@ std::string ActionDiskMaskRequest::getIp()const
void ActionDiskMaskRequest::setIp(const std::string& ip)
{
ip_ = ip;
setParameter("Ip", ip);
setCoreParameter("Ip", ip);
}

View File

@@ -35,32 +35,35 @@ ActionDiskMaskResult::~ActionDiskMaskResult()
void ActionDiskMaskResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::CharReaderBuilder builder;
Json::CharReader *reader = builder.newCharReader();
Json::Value *val;
Json::Value value;
reader.parse(payload, value);
JSONCPP_STRING *errs;
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
value = *val;
setRequestId(value["RequestId"].asString());
if(!value["Status"].isNull())
status_ = value["Status"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Result"].isNull())
result_ = value["Result"].asString();
if(!value["Status"].isNull())
status_ = value["Status"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Result"].isNull())
result_ = value["Result"].asString();
}
bool ActionDiskMaskResult::getStatus()const
{
return status_;
}
std::string ActionDiskMaskResult::getMessage()const
{
return message_;
}
std::string ActionDiskMaskResult::getResult()const
{
return result_;
}
bool ActionDiskMaskResult::getStatus()const
{
return status_;
}
std::string ActionDiskMaskResult::getMessage()const
{
return message_;
}
std::string ActionDiskMaskResult::getResult()const
{
return result_;
}

View File

@@ -33,7 +33,7 @@ std::string ActionDiskRmaRequest::getDiskName()const
void ActionDiskRmaRequest::setDiskName(const std::string& diskName)
{
diskName_ = diskName;
setParameter("DiskName", diskName);
setCoreParameter("DiskName", diskName);
}
std::string ActionDiskRmaRequest::getExecutionId()const
@@ -44,7 +44,7 @@ std::string ActionDiskRmaRequest::getExecutionId()const
void ActionDiskRmaRequest::setExecutionId(const std::string& executionId)
{
executionId_ = executionId;
setParameter("ExecutionId", executionId);
setCoreParameter("ExecutionId", executionId);
}
std::string ActionDiskRmaRequest::getDiskSlot()const
@@ -55,7 +55,7 @@ std::string ActionDiskRmaRequest::getDiskSlot()const
void ActionDiskRmaRequest::setDiskSlot(const std::string& diskSlot)
{
diskSlot_ = diskSlot;
setParameter("DiskSlot", diskSlot);
setCoreParameter("DiskSlot", diskSlot);
}
std::string ActionDiskRmaRequest::getHostname()const
@@ -66,7 +66,7 @@ std::string ActionDiskRmaRequest::getHostname()const
void ActionDiskRmaRequest::setHostname(const std::string& hostname)
{
hostname_ = hostname;
setParameter("Hostname", hostname);
setCoreParameter("Hostname", hostname);
}
std::string ActionDiskRmaRequest::getDiskMount()const
@@ -77,7 +77,7 @@ std::string ActionDiskRmaRequest::getDiskMount()const
void ActionDiskRmaRequest::setDiskMount(const std::string& diskMount)
{
diskMount_ = diskMount;
setParameter("DiskMount", diskMount);
setCoreParameter("DiskMount", diskMount);
}
std::string ActionDiskRmaRequest::getDiskReason()const
@@ -88,7 +88,7 @@ std::string ActionDiskRmaRequest::getDiskReason()const
void ActionDiskRmaRequest::setDiskReason(const std::string& diskReason)
{
diskReason_ = diskReason;
setParameter("DiskReason", diskReason);
setCoreParameter("DiskReason", diskReason);
}
std::string ActionDiskRmaRequest::getDiskSn()const
@@ -99,6 +99,6 @@ std::string ActionDiskRmaRequest::getDiskSn()const
void ActionDiskRmaRequest::setDiskSn(const std::string& diskSn)
{
diskSn_ = diskSn;
setParameter("DiskSn", diskSn);
setCoreParameter("DiskSn", diskSn);
}

View File

@@ -35,32 +35,35 @@ ActionDiskRmaResult::~ActionDiskRmaResult()
void ActionDiskRmaResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::CharReaderBuilder builder;
Json::CharReader *reader = builder.newCharReader();
Json::Value *val;
Json::Value value;
reader.parse(payload, value);
JSONCPP_STRING *errs;
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
value = *val;
setRequestId(value["RequestId"].asString());
if(!value["Status"].isNull())
status_ = value["Status"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Result"].isNull())
result_ = value["Result"].asString();
if(!value["Status"].isNull())
status_ = value["Status"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Result"].isNull())
result_ = value["Result"].asString();
}
bool ActionDiskRmaResult::getStatus()const
{
return status_;
}
std::string ActionDiskRmaResult::getMessage()const
{
return message_;
}
std::string ActionDiskRmaResult::getResult()const
{
return result_;
}
bool ActionDiskRmaResult::getStatus()const
{
return status_;
}
std::string ActionDiskRmaResult::getMessage()const
{
return message_;
}
std::string ActionDiskRmaResult::getResult()const
{
return result_;
}

View File

@@ -33,7 +33,7 @@ int ActionRequest::getOrderId()const
void ActionRequest::setOrderId(int orderId)
{
orderId_ = orderId;
setParameter("OrderId", std::to_string(orderId));
setCoreParameter("OrderId", std::to_string(orderId));
}
std::string ActionRequest::getStepCode()const
@@ -44,6 +44,6 @@ std::string ActionRequest::getStepCode()const
void ActionRequest::setStepCode(const std::string& stepCode)
{
stepCode_ = stepCode;
setParameter("StepCode", stepCode);
setCoreParameter("StepCode", stepCode);
}

View File

@@ -35,32 +35,35 @@ ActionResult::~ActionResult()
void ActionResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::CharReaderBuilder builder;
Json::CharReader *reader = builder.newCharReader();
Json::Value *val;
Json::Value value;
reader.parse(payload, value);
JSONCPP_STRING *errs;
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
value = *val;
setRequestId(value["RequestId"].asString());
if(!value["Status"].isNull())
status_ = value["Status"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Result"].isNull())
result_ = value["Result"].asString();
if(!value["Status"].isNull())
status_ = value["Status"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Result"].isNull())
result_ = value["Result"].asString();
}
bool ActionResult::getStatus()const
{
return status_;
}
std::string ActionResult::getMessage()const
{
return message_;
}
std::string ActionResult::getResult()const
{
return result_;
}
bool ActionResult::getStatus()const
{
return status_;
}
std::string ActionResult::getMessage()const
{
return message_;
}
std::string ActionResult::getResult()const
{
return result_;
}

View File

@@ -33,7 +33,7 @@ std::string HostGetsRequest::getQuery()const
void HostGetsRequest::setQuery(const std::string& query)
{
query_ = query;
setParameter("Query", query);
setCoreParameter("Query", query);
}
int HostGetsRequest::getEndTime()const
@@ -44,7 +44,7 @@ int HostGetsRequest::getEndTime()const
void HostGetsRequest::setEndTime(int endTime)
{
endTime_ = endTime;
setParameter("EndTime", std::to_string(endTime));
setCoreParameter("EndTime", std::to_string(endTime));
}
int HostGetsRequest::getStartTime()const
@@ -55,7 +55,7 @@ int HostGetsRequest::getStartTime()const
void HostGetsRequest::setStartTime(int startTime)
{
startTime_ = startTime;
setParameter("StartTime", std::to_string(startTime));
setCoreParameter("StartTime", std::to_string(startTime));
}
std::string HostGetsRequest::getQueryType()const
@@ -66,6 +66,6 @@ std::string HostGetsRequest::getQueryType()const
void HostGetsRequest::setQueryType(const std::string& queryType)
{
queryType_ = queryType;
setParameter("QueryType", queryType);
setCoreParameter("QueryType", queryType);
}

View File

@@ -35,52 +35,55 @@ HostGetsResult::~HostGetsResult()
void HostGetsResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::CharReaderBuilder builder;
Json::CharReader *reader = builder.newCharReader();
Json::Value *val;
Json::Value value;
reader.parse(payload, value);
JSONCPP_STRING *errs;
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
value = *val;
setRequestId(value["RequestId"].asString());
auto allData = value["Data"]["dataItem"];
for (auto value : allData)
{
DataItem dataObject;
if(!value["Hostname"].isNull())
dataObject.hostname = value["Hostname"].asString();
if(!value["Ip"].isNull())
dataObject.ip = value["Ip"].asString();
if(!value["AppCode"].isNull())
dataObject.appCode = value["AppCode"].asString();
if(!value["ClusterCode"].isNull())
dataObject.clusterCode = value["ClusterCode"].asString();
if(!value["SshStatus"].isNull())
dataObject.sshStatus = std::stoi(value["SshStatus"].asString());
if(!value["heartStatus"].isNull())
dataObject.heartStatus = std::stoi(value["heartStatus"].asString());
if(!value["HealthScoreLast"].isNull())
dataObject.healthScoreLast = std::stoi(value["HealthScoreLast"].asString());
if(!value["HealthReasonLast"].isNull())
dataObject.healthReasonLast = value["HealthReasonLast"].asString();
data_.push_back(dataObject);
}
if(!value["Status"].isNull())
status_ = value["Status"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
auto allData = value["Data"]["dataItem"];
for (auto value : allData)
{
DataItem dataObject;
if(!value["Hostname"].isNull())
dataObject.hostname = value["Hostname"].asString();
if(!value["Ip"].isNull())
dataObject.ip = value["Ip"].asString();
if(!value["AppCode"].isNull())
dataObject.appCode = value["AppCode"].asString();
if(!value["ClusterCode"].isNull())
dataObject.clusterCode = value["ClusterCode"].asString();
if(!value["SshStatus"].isNull())
dataObject.sshStatus = std::stoi(value["SshStatus"].asString());
if(!value["heartStatus"].isNull())
dataObject.heartStatus = std::stoi(value["heartStatus"].asString());
if(!value["HealthScoreLast"].isNull())
dataObject.healthScoreLast = std::stoi(value["HealthScoreLast"].asString());
if(!value["HealthReasonLast"].isNull())
dataObject.healthReasonLast = value["HealthReasonLast"].asString();
data_.push_back(dataObject);
}
if(!value["Status"].isNull())
status_ = value["Status"].asString() == "true";
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
bool HostGetsResult::getStatus()const
{
return status_;
}
std::string HostGetsResult::getMessage()const
{
return message_;
}
std::vector<HostGetsResult::DataItem> HostGetsResult::getData()const
{
return data_;
}
bool HostGetsResult::getStatus()const
{
return status_;
}
std::string HostGetsResult::getMessage()const
{
return message_;
}
std::vector<HostGetsResult::DataItem> HostGetsResult::getData()const
{
return data_;
}