CreateDataSourceItem.
This commit is contained in:
@@ -1743,6 +1743,42 @@ IotClient::CreateDataAPIServiceOutcomeCallable IotClient::createDataAPIServiceCa
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IotClient::CreateDataSourceItemOutcome IotClient::createDataSourceItem(const CreateDataSourceItemRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return CreateDataSourceItemOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return CreateDataSourceItemOutcome(CreateDataSourceItemResult(outcome.result()));
|
||||
else
|
||||
return CreateDataSourceItemOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void IotClient::createDataSourceItemAsync(const CreateDataSourceItemRequest& request, const CreateDataSourceItemAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, createDataSourceItem(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
IotClient::CreateDataSourceItemOutcomeCallable IotClient::createDataSourceItemCallable(const CreateDataSourceItemRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<CreateDataSourceItemOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->createDataSourceItem(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IotClient::CreateDeviceDistributeJobOutcome IotClient::createDeviceDistributeJob(const CreateDeviceDistributeJobRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
@@ -5451,6 +5487,42 @@ IotClient::ListAnalyticsDataOutcomeCallable IotClient::listAnalyticsDataCallable
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IotClient::ListDataSourceItemOutcome IotClient::listDataSourceItem(const ListDataSourceItemRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ListDataSourceItemOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ListDataSourceItemOutcome(ListDataSourceItemResult(outcome.result()));
|
||||
else
|
||||
return ListDataSourceItemOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void IotClient::listDataSourceItemAsync(const ListDataSourceItemRequest& request, const ListDataSourceItemAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, listDataSourceItem(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
IotClient::ListDataSourceItemOutcomeCallable IotClient::listDataSourceItemCallable(const ListDataSourceItemRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ListDataSourceItemOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->listDataSourceItem(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IotClient::ListDeviceDistributeJobOutcome IotClient::listDeviceDistributeJob(const ListDeviceDistributeJobRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
84
iot/src/model/CreateDataSourceItemRequest.cc
Normal file
84
iot/src/model/CreateDataSourceItemRequest.cc
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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/iot/model/CreateDataSourceItemRequest.h>
|
||||
|
||||
using AlibabaCloud::Iot::Model::CreateDataSourceItemRequest;
|
||||
|
||||
CreateDataSourceItemRequest::CreateDataSourceItemRequest() :
|
||||
RpcServiceRequest("iot", "2018-01-20", "CreateDataSourceItem")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
CreateDataSourceItemRequest::~CreateDataSourceItemRequest()
|
||||
{}
|
||||
|
||||
std::string CreateDataSourceItemRequest::getIotInstanceId()const
|
||||
{
|
||||
return iotInstanceId_;
|
||||
}
|
||||
|
||||
void CreateDataSourceItemRequest::setIotInstanceId(const std::string& iotInstanceId)
|
||||
{
|
||||
iotInstanceId_ = iotInstanceId;
|
||||
setParameter("IotInstanceId", iotInstanceId);
|
||||
}
|
||||
|
||||
std::string CreateDataSourceItemRequest::getApiProduct()const
|
||||
{
|
||||
return apiProduct_;
|
||||
}
|
||||
|
||||
void CreateDataSourceItemRequest::setApiProduct(const std::string& apiProduct)
|
||||
{
|
||||
apiProduct_ = apiProduct;
|
||||
setBodyParameter("ApiProduct", apiProduct);
|
||||
}
|
||||
|
||||
long CreateDataSourceItemRequest::getDataSourceId()const
|
||||
{
|
||||
return dataSourceId_;
|
||||
}
|
||||
|
||||
void CreateDataSourceItemRequest::setDataSourceId(long dataSourceId)
|
||||
{
|
||||
dataSourceId_ = dataSourceId;
|
||||
setParameter("DataSourceId", std::to_string(dataSourceId));
|
||||
}
|
||||
|
||||
std::string CreateDataSourceItemRequest::getTopic()const
|
||||
{
|
||||
return topic_;
|
||||
}
|
||||
|
||||
void CreateDataSourceItemRequest::setTopic(const std::string& topic)
|
||||
{
|
||||
topic_ = topic;
|
||||
setParameter("Topic", topic);
|
||||
}
|
||||
|
||||
std::string CreateDataSourceItemRequest::getApiRevision()const
|
||||
{
|
||||
return apiRevision_;
|
||||
}
|
||||
|
||||
void CreateDataSourceItemRequest::setApiRevision(const std::string& apiRevision)
|
||||
{
|
||||
apiRevision_ = apiRevision;
|
||||
setBodyParameter("ApiRevision", apiRevision);
|
||||
}
|
||||
|
||||
65
iot/src/model/CreateDataSourceItemResult.cc
Normal file
65
iot/src/model/CreateDataSourceItemResult.cc
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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/iot/model/CreateDataSourceItemResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Iot;
|
||||
using namespace AlibabaCloud::Iot::Model;
|
||||
|
||||
CreateDataSourceItemResult::CreateDataSourceItemResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
CreateDataSourceItemResult::CreateDataSourceItemResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
CreateDataSourceItemResult::~CreateDataSourceItemResult()
|
||||
{}
|
||||
|
||||
void CreateDataSourceItemResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
if(!value["Success"].isNull())
|
||||
success_ = value["Success"].asString() == "true";
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
if(!value["ErrorMessage"].isNull())
|
||||
errorMessage_ = value["ErrorMessage"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string CreateDataSourceItemResult::getErrorMessage()const
|
||||
{
|
||||
return errorMessage_;
|
||||
}
|
||||
|
||||
std::string CreateDataSourceItemResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
bool CreateDataSourceItemResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
106
iot/src/model/ListDataSourceItemRequest.cc
Normal file
106
iot/src/model/ListDataSourceItemRequest.cc
Normal 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/iot/model/ListDataSourceItemRequest.h>
|
||||
|
||||
using AlibabaCloud::Iot::Model::ListDataSourceItemRequest;
|
||||
|
||||
ListDataSourceItemRequest::ListDataSourceItemRequest() :
|
||||
RpcServiceRequest("iot", "2018-01-20", "ListDataSourceItem")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
ListDataSourceItemRequest::~ListDataSourceItemRequest()
|
||||
{}
|
||||
|
||||
std::string ListDataSourceItemRequest::getSearchName()const
|
||||
{
|
||||
return searchName_;
|
||||
}
|
||||
|
||||
void ListDataSourceItemRequest::setSearchName(const std::string& searchName)
|
||||
{
|
||||
searchName_ = searchName;
|
||||
setParameter("SearchName", searchName);
|
||||
}
|
||||
|
||||
std::string ListDataSourceItemRequest::getIotInstanceId()const
|
||||
{
|
||||
return iotInstanceId_;
|
||||
}
|
||||
|
||||
void ListDataSourceItemRequest::setIotInstanceId(const std::string& iotInstanceId)
|
||||
{
|
||||
iotInstanceId_ = iotInstanceId;
|
||||
setParameter("IotInstanceId", iotInstanceId);
|
||||
}
|
||||
|
||||
int ListDataSourceItemRequest::getPageSize()const
|
||||
{
|
||||
return pageSize_;
|
||||
}
|
||||
|
||||
void ListDataSourceItemRequest::setPageSize(int pageSize)
|
||||
{
|
||||
pageSize_ = pageSize;
|
||||
setParameter("PageSize", std::to_string(pageSize));
|
||||
}
|
||||
|
||||
std::string ListDataSourceItemRequest::getApiProduct()const
|
||||
{
|
||||
return apiProduct_;
|
||||
}
|
||||
|
||||
void ListDataSourceItemRequest::setApiProduct(const std::string& apiProduct)
|
||||
{
|
||||
apiProduct_ = apiProduct;
|
||||
setBodyParameter("ApiProduct", apiProduct);
|
||||
}
|
||||
|
||||
long ListDataSourceItemRequest::getDataSourceId()const
|
||||
{
|
||||
return dataSourceId_;
|
||||
}
|
||||
|
||||
void ListDataSourceItemRequest::setDataSourceId(long dataSourceId)
|
||||
{
|
||||
dataSourceId_ = dataSourceId;
|
||||
setParameter("DataSourceId", std::to_string(dataSourceId));
|
||||
}
|
||||
|
||||
std::string ListDataSourceItemRequest::getApiRevision()const
|
||||
{
|
||||
return apiRevision_;
|
||||
}
|
||||
|
||||
void ListDataSourceItemRequest::setApiRevision(const std::string& apiRevision)
|
||||
{
|
||||
apiRevision_ = apiRevision;
|
||||
setBodyParameter("ApiRevision", apiRevision);
|
||||
}
|
||||
|
||||
int ListDataSourceItemRequest::getPage()const
|
||||
{
|
||||
return page_;
|
||||
}
|
||||
|
||||
void ListDataSourceItemRequest::setPage(int page)
|
||||
{
|
||||
page_ = page;
|
||||
setParameter("Page", std::to_string(page));
|
||||
}
|
||||
|
||||
101
iot/src/model/ListDataSourceItemResult.cc
Normal file
101
iot/src/model/ListDataSourceItemResult.cc
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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/iot/model/ListDataSourceItemResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Iot;
|
||||
using namespace AlibabaCloud::Iot::Model;
|
||||
|
||||
ListDataSourceItemResult::ListDataSourceItemResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
ListDataSourceItemResult::ListDataSourceItemResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
ListDataSourceItemResult::~ListDataSourceItemResult()
|
||||
{}
|
||||
|
||||
void ListDataSourceItemResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allDataSourceItemsNode = value["DataSourceItems"]["dataSourceItem"];
|
||||
for (auto valueDataSourceItemsdataSourceItem : allDataSourceItemsNode)
|
||||
{
|
||||
DataSourceItem dataSourceItemsObject;
|
||||
if(!valueDataSourceItemsdataSourceItem["DataSourceItemId"].isNull())
|
||||
dataSourceItemsObject.dataSourceItemId = std::stol(valueDataSourceItemsdataSourceItem["DataSourceItemId"].asString());
|
||||
if(!valueDataSourceItemsdataSourceItem["Topic"].isNull())
|
||||
dataSourceItemsObject.topic = valueDataSourceItemsdataSourceItem["Topic"].asString();
|
||||
dataSourceItems_.push_back(dataSourceItemsObject);
|
||||
}
|
||||
if(!value["Success"].isNull())
|
||||
success_ = value["Success"].asString() == "true";
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
if(!value["ErrorMessage"].isNull())
|
||||
errorMessage_ = value["ErrorMessage"].asString();
|
||||
if(!value["Page"].isNull())
|
||||
page_ = std::stoi(value["Page"].asString());
|
||||
if(!value["PageSize"].isNull())
|
||||
pageSize_ = std::stoi(value["PageSize"].asString());
|
||||
if(!value["Total"].isNull())
|
||||
total_ = std::stoi(value["Total"].asString());
|
||||
|
||||
}
|
||||
|
||||
std::vector<ListDataSourceItemResult::DataSourceItem> ListDataSourceItemResult::getDataSourceItems()const
|
||||
{
|
||||
return dataSourceItems_;
|
||||
}
|
||||
|
||||
int ListDataSourceItemResult::getPageSize()const
|
||||
{
|
||||
return pageSize_;
|
||||
}
|
||||
|
||||
int ListDataSourceItemResult::getTotal()const
|
||||
{
|
||||
return total_;
|
||||
}
|
||||
|
||||
int ListDataSourceItemResult::getPage()const
|
||||
{
|
||||
return page_;
|
||||
}
|
||||
|
||||
std::string ListDataSourceItemResult::getErrorMessage()const
|
||||
{
|
||||
return errorMessage_;
|
||||
}
|
||||
|
||||
std::string ListDataSourceItemResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
bool ListDataSourceItemResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void ListDistributedProductResult::parse(const std::string &payload)
|
||||
if(!dataNodeInfoitems["TargetInstanceId"].isNull())
|
||||
itemsObject.targetInstanceId = dataNodeInfoitems["TargetInstanceId"].asString();
|
||||
if(!dataNodeInfoitems["GmtCreate"].isNull())
|
||||
itemsObject.gmtCreate = std::stoi(dataNodeInfoitems["GmtCreate"].asString());
|
||||
itemsObject.gmtCreate = std::stol(dataNodeInfoitems["GmtCreate"].asString());
|
||||
if(!dataNodeInfoitems["TargetAliyunId"].isNull())
|
||||
itemsObject.targetAliyunId = dataNodeInfoitems["TargetAliyunId"].asString();
|
||||
if(!dataNodeInfoitems["SourceRegion"].isNull())
|
||||
|
||||
Reference in New Issue
Block a user