Add describe devices to return device status.

This commit is contained in:
sdk-team
2020-09-20 12:12:16 +00:00
parent d69766bdfd
commit c12d0267d7
20 changed files with 623 additions and 70 deletions

View File

@@ -1707,6 +1707,42 @@ VcsClient::ListCorpsOutcomeCallable VcsClient::listCorpsCallable(const ListCorps
return task->get_future();
}
VcsClient::ListDeviceGroupsOutcome VcsClient::listDeviceGroups(const ListDeviceGroupsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ListDeviceGroupsOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ListDeviceGroupsOutcome(ListDeviceGroupsResult(outcome.result()));
else
return ListDeviceGroupsOutcome(outcome.error());
}
void VcsClient::listDeviceGroupsAsync(const ListDeviceGroupsRequest& request, const ListDeviceGroupsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, listDeviceGroups(request), context);
};
asyncExecute(new Runnable(fn));
}
VcsClient::ListDeviceGroupsOutcomeCallable VcsClient::listDeviceGroupsCallable(const ListDeviceGroupsRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ListDeviceGroupsOutcome()>>(
[this, request]()
{
return this->listDeviceGroups(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
VcsClient::ListDevicesOutcome VcsClient::listDevices(const ListDevicesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -60,6 +60,50 @@ void AddMonitorRequest::setDescription(const std::string& description)
setBodyParameter("Description", description);
}
std::string AddMonitorRequest::getNotifierAppSecret()const
{
return notifierAppSecret_;
}
void AddMonitorRequest::setNotifierAppSecret(const std::string& notifierAppSecret)
{
notifierAppSecret_ = notifierAppSecret;
setBodyParameter("NotifierAppSecret", notifierAppSecret);
}
std::string AddMonitorRequest::getNotifierExtendValues()const
{
return notifierExtendValues_;
}
void AddMonitorRequest::setNotifierExtendValues(const std::string& notifierExtendValues)
{
notifierExtendValues_ = notifierExtendValues;
setBodyParameter("NotifierExtendValues", notifierExtendValues);
}
std::string AddMonitorRequest::getNotifierUrl()const
{
return notifierUrl_;
}
void AddMonitorRequest::setNotifierUrl(const std::string& notifierUrl)
{
notifierUrl_ = notifierUrl;
setBodyParameter("NotifierUrl", notifierUrl);
}
std::string AddMonitorRequest::getNotifierType()const
{
return notifierType_;
}
void AddMonitorRequest::setNotifierType(const std::string& notifierType)
{
notifierType_ = notifierType;
setBodyParameter("NotifierType", notifierType);
}
int AddMonitorRequest::getBatchIndicator()const
{
return batchIndicator_;
@@ -71,6 +115,17 @@ void AddMonitorRequest::setBatchIndicator(int batchIndicator)
setBodyParameter("BatchIndicator", std::to_string(batchIndicator));
}
int AddMonitorRequest::getNotifierTimeOut()const
{
return notifierTimeOut_;
}
void AddMonitorRequest::setNotifierTimeOut(int notifierTimeOut)
{
notifierTimeOut_ = notifierTimeOut;
setBodyParameter("NotifierTimeOut", std::to_string(notifierTimeOut));
}
std::string AddMonitorRequest::getAlgorithmVendor()const
{
return algorithmVendor_;

View File

@@ -71,6 +71,17 @@ void CreateCorpRequest::setDescription(const std::string& description)
setBodyParameter("Description", description);
}
std::string CreateCorpRequest::getIconPath()const
{
return iconPath_;
}
void CreateCorpRequest::setIconPath(const std::string& iconPath)
{
iconPath_ = iconPath;
setBodyParameter("IconPath", iconPath);
}
std::string CreateCorpRequest::getAppName()const
{
return appName_;

View File

@@ -68,6 +68,10 @@ void ListCorpsResult::parse(const std::string &payload)
recordObject.deviceCount = std::stoi(dataNodeRecordsRecord["DeviceCount"].asString());
if(!dataNodeRecordsRecord["IsvSubId"].isNull())
recordObject.isvSubId = dataNodeRecordsRecord["IsvSubId"].asString();
if(!dataNodeRecordsRecord["AcuUsed"].isNull())
recordObject.acuUsed = std::stoi(dataNodeRecordsRecord["AcuUsed"].asString());
if(!dataNodeRecordsRecord["IconPath"].isNull())
recordObject.iconPath = dataNodeRecordsRecord["IconPath"].asString();
data_.records.push_back(recordObject);
}
if(!value["Code"].isNull())

View File

@@ -0,0 +1,106 @@
/*
* 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/vcs/model/ListDeviceGroupsRequest.h>
using AlibabaCloud::Vcs::Model::ListDeviceGroupsRequest;
ListDeviceGroupsRequest::ListDeviceGroupsRequest() :
RpcServiceRequest("vcs", "2020-05-15", "ListDeviceGroups")
{
setMethod(HttpRequest::Method::Post);
}
ListDeviceGroupsRequest::~ListDeviceGroupsRequest()
{}
int ListDeviceGroupsRequest::getIsPage()const
{
return isPage_;
}
void ListDeviceGroupsRequest::setIsPage(int isPage)
{
isPage_ = isPage;
setBodyParameter("IsPage", std::to_string(isPage));
}
int ListDeviceGroupsRequest::getPageNum()const
{
return pageNum_;
}
void ListDeviceGroupsRequest::setPageNum(int pageNum)
{
pageNum_ = pageNum;
setBodyParameter("PageNum", std::to_string(pageNum));
}
std::string ListDeviceGroupsRequest::getCorpIdList()const
{
return corpIdList_;
}
void ListDeviceGroupsRequest::setCorpIdList(const std::string& corpIdList)
{
corpIdList_ = corpIdList;
setBodyParameter("CorpIdList", corpIdList);
}
std::string ListDeviceGroupsRequest::getDeviceCodeList()const
{
return deviceCodeList_;
}
void ListDeviceGroupsRequest::setDeviceCodeList(const std::string& deviceCodeList)
{
deviceCodeList_ = deviceCodeList;
setBodyParameter("DeviceCodeList", deviceCodeList);
}
std::string ListDeviceGroupsRequest::getName()const
{
return name_;
}
void ListDeviceGroupsRequest::setName(const std::string& name)
{
name_ = name;
setBodyParameter("Name", name);
}
int ListDeviceGroupsRequest::getPageSize()const
{
return pageSize_;
}
void ListDeviceGroupsRequest::setPageSize(int pageSize)
{
pageSize_ = pageSize;
setBodyParameter("PageSize", std::to_string(pageSize));
}
std::string ListDeviceGroupsRequest::getGroup()const
{
return group_;
}
void ListDeviceGroupsRequest::setGroup(const std::string& group)
{
group_ = group;
setBodyParameter("Group", group);
}

View File

@@ -0,0 +1,97 @@
/*
* 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/vcs/model/ListDeviceGroupsResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Vcs;
using namespace AlibabaCloud::Vcs::Model;
ListDeviceGroupsResult::ListDeviceGroupsResult() :
ServiceResult()
{}
ListDeviceGroupsResult::ListDeviceGroupsResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListDeviceGroupsResult::~ListDeviceGroupsResult()
{}
void ListDeviceGroupsResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allDataNode = value["Data"]["DataItem"];
for (auto valueDataDataItem : allDataNode)
{
DataItem dataObject;
if(!valueDataDataItem["TotalCount"].isNull())
dataObject.totalCount = valueDataDataItem["TotalCount"].asString();
auto allListNode = allDataNode["List"]["ListItem"];
for (auto allDataNodeListListItem : allListNode)
{
DataItem::ListItem listObject;
if(!allDataNodeListListItem["DeviceGroup"].isNull())
listObject.deviceGroup = allDataNodeListListItem["DeviceGroup"].asString();
if(!allDataNodeListListItem["DeviceName"].isNull())
listObject.deviceName = allDataNodeListListItem["DeviceName"].asString();
if(!allDataNodeListListItem["DeviceCode"].isNull())
listObject.deviceCode = allDataNodeListListItem["DeviceCode"].asString();
if(!allDataNodeListListItem["BitRate"].isNull())
listObject.bitRate = allDataNodeListListItem["BitRate"].asString();
if(!allDataNodeListListItem["CodingFormat"].isNull())
listObject.codingFormat = allDataNodeListListItem["CodingFormat"].asString();
if(!allDataNodeListListItem["ResolvingPower"].isNull())
listObject.resolvingPower = allDataNodeListListItem["ResolvingPower"].asString();
if(!allDataNodeListListItem["DataSourceType"].isNull())
listObject.dataSourceType = allDataNodeListListItem["DataSourceType"].asString();
if(!allDataNodeListListItem["RegionName"].isNull())
listObject.regionName = allDataNodeListListItem["RegionName"].asString();
if(!allDataNodeListListItem["RegionId"].isNull())
listObject.regionId = allDataNodeListListItem["RegionId"].asString();
if(!allDataNodeListListItem["InstallAddress"].isNull())
listObject.installAddress = allDataNodeListListItem["InstallAddress"].asString();
dataObject.list.push_back(listObject);
}
data_.push_back(dataObject);
}
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
std::string ListDeviceGroupsResult::getMessage()const
{
return message_;
}
std::vector<ListDeviceGroupsResult::DataItem> ListDeviceGroupsResult::getData()const
{
return data_;
}
std::string ListDeviceGroupsResult::getCode()const
{
return code_;
}

View File

@@ -27,6 +27,17 @@ SearchObjectRequest::SearchObjectRequest() :
SearchObjectRequest::~SearchObjectRequest()
{}
std::string SearchObjectRequest::getAlgorithmType()const
{
return algorithmType_;
}
void SearchObjectRequest::setAlgorithmType(const std::string& algorithmType)
{
algorithmType_ = algorithmType;
setBodyParameter("AlgorithmType", algorithmType);
}
std::string SearchObjectRequest::getCorpId()const
{
return corpId_;
@@ -38,6 +49,17 @@ void SearchObjectRequest::setCorpId(const std::string& corpId)
setBodyParameter("CorpId", corpId);
}
long SearchObjectRequest::getEndTime()const
{
return endTime_;
}
void SearchObjectRequest::setEndTime(long endTime)
{
endTime_ = endTime;
setBodyParameter("EndTime", std::to_string(endTime));
}
long SearchObjectRequest::getStartTime()const
{
return startTime_;
@@ -60,61 +82,6 @@ void SearchObjectRequest::setPageNumber(int pageNumber)
setBodyParameter("PageNumber", std::to_string(pageNumber));
}
std::string SearchObjectRequest::getPicContent()const
{
return picContent_;
}
void SearchObjectRequest::setPicContent(const std::string& picContent)
{
picContent_ = picContent;
setBodyParameter("PicContent", picContent);
}
int SearchObjectRequest::getPageSize()const
{
return pageSize_;
}
void SearchObjectRequest::setPageSize(int pageSize)
{
pageSize_ = pageSize;
setBodyParameter("PageSize", std::to_string(pageSize));
}
std::string SearchObjectRequest::getObjectType()const
{
return objectType_;
}
void SearchObjectRequest::setObjectType(const std::string& objectType)
{
objectType_ = objectType;
setBodyParameter("ObjectType", objectType);
}
std::string SearchObjectRequest::getAlgorithmType()const
{
return algorithmType_;
}
void SearchObjectRequest::setAlgorithmType(const std::string& algorithmType)
{
algorithmType_ = algorithmType;
setBodyParameter("AlgorithmType", algorithmType);
}
long SearchObjectRequest::getEndTime()const
{
return endTime_;
}
void SearchObjectRequest::setEndTime(long endTime)
{
endTime_ = endTime;
setBodyParameter("EndTime", std::to_string(endTime));
}
std::map<std::string, std::string> SearchObjectRequest::getDeviceList()const
{
return deviceList_;
@@ -148,6 +115,28 @@ void SearchObjectRequest::setImagePath(const std::string& imagePath)
setBodyParameter("ImagePath", imagePath);
}
int SearchObjectRequest::getPageSize()const
{
return pageSize_;
}
void SearchObjectRequest::setPageSize(int pageSize)
{
pageSize_ = pageSize;
setBodyParameter("PageSize", std::to_string(pageSize));
}
std::string SearchObjectRequest::getObjectType()const
{
return objectType_;
}
void SearchObjectRequest::setObjectType(const std::string& objectType)
{
objectType_ = objectType;
setBodyParameter("ObjectType", objectType);
}
std::string SearchObjectRequest::getConditions()const
{
return conditions_;

View File

@@ -71,6 +71,17 @@ void UpdateCorpRequest::setDescription(const std::string& description)
setBodyParameter("Description", description);
}
std::string UpdateCorpRequest::getIconPath()const
{
return iconPath_;
}
void UpdateCorpRequest::setIconPath(const std::string& iconPath)
{
iconPath_ = iconPath;
setBodyParameter("IconPath", iconPath);
}
std::string UpdateCorpRequest::getAppName()const
{
return appName_;

View File

@@ -104,6 +104,17 @@ void UpdateMonitorRequest::setRuleExpression(const std::string& ruleExpression)
setBodyParameter("RuleExpression", ruleExpression);
}
int UpdateMonitorRequest::getNotifierTimeOut()const
{
return notifierTimeOut_;
}
void UpdateMonitorRequest::setNotifierTimeOut(int notifierTimeOut)
{
notifierTimeOut_ = notifierTimeOut;
setBodyParameter("NotifierTimeOut", std::to_string(notifierTimeOut));
}
std::string UpdateMonitorRequest::getTaskId()const
{
return taskId_;
@@ -148,6 +159,28 @@ void UpdateMonitorRequest::setAttributeValueList(const std::string& attributeVal
setBodyParameter("AttributeValueList", attributeValueList);
}
std::string UpdateMonitorRequest::getNotifierAppSecret()const
{
return notifierAppSecret_;
}
void UpdateMonitorRequest::setNotifierAppSecret(const std::string& notifierAppSecret)
{
notifierAppSecret_ = notifierAppSecret;
setBodyParameter("NotifierAppSecret", notifierAppSecret);
}
std::string UpdateMonitorRequest::getNotifierExtendValues()const
{
return notifierExtendValues_;
}
void UpdateMonitorRequest::setNotifierExtendValues(const std::string& notifierExtendValues)
{
notifierExtendValues_ = notifierExtendValues;
setBodyParameter("NotifierExtendValues", notifierExtendValues);
}
std::string UpdateMonitorRequest::getDeviceList()const
{
return deviceList_;
@@ -159,6 +192,28 @@ void UpdateMonitorRequest::setDeviceList(const std::string& deviceList)
setBodyParameter("DeviceList", deviceList);
}
std::string UpdateMonitorRequest::getNotifierUrl()const
{
return notifierUrl_;
}
void UpdateMonitorRequest::setNotifierUrl(const std::string& notifierUrl)
{
notifierUrl_ = notifierUrl;
setBodyParameter("NotifierUrl", notifierUrl);
}
std::string UpdateMonitorRequest::getNotifierType()const
{
return notifierType_;
}
void UpdateMonitorRequest::setNotifierType(const std::string& notifierType)
{
notifierType_ = notifierType;
setBodyParameter("NotifierType", notifierType);
}
std::string UpdateMonitorRequest::getAlgorithmVendor()const
{
return algorithmVendor_;