Iot_20180120 build sdk.
This commit is contained in:
@@ -31,21 +31,21 @@ IotClient::IotClient(const Credentials &credentials, const ClientConfiguration &
|
||||
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, "iot");
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
IotClient::IotClient(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, "iot");
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
IotClient::IotClient(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, "iot");
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
IotClient::~IotClient()
|
||||
@@ -4767,42 +4767,6 @@ IotClient::GetLoraNodesTaskOutcomeCallable IotClient::getLoraNodesTaskCallable(c
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IotClient::GetNodesAddingTaskOutcome IotClient::getNodesAddingTask(const GetNodesAddingTaskRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetNodesAddingTaskOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetNodesAddingTaskOutcome(GetNodesAddingTaskResult(outcome.result()));
|
||||
else
|
||||
return GetNodesAddingTaskOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void IotClient::getNodesAddingTaskAsync(const GetNodesAddingTaskRequest& request, const GetNodesAddingTaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getNodesAddingTask(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
IotClient::GetNodesAddingTaskOutcomeCallable IotClient::getNodesAddingTaskCallable(const GetNodesAddingTaskRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetNodesAddingTaskOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getNodesAddingTask(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IotClient::GetRuleOutcome IotClient::getRule(const GetRuleRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* 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/GetNodesAddingTaskRequest.h>
|
||||
|
||||
using AlibabaCloud::Iot::Model::GetNodesAddingTaskRequest;
|
||||
|
||||
GetNodesAddingTaskRequest::GetNodesAddingTaskRequest() :
|
||||
RpcServiceRequest("iot", "2018-01-20", "GetNodesAddingTask")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetNodesAddingTaskRequest::~GetNodesAddingTaskRequest()
|
||||
{}
|
||||
|
||||
std::string GetNodesAddingTaskRequest::getAccessKeyId()const
|
||||
{
|
||||
return accessKeyId_;
|
||||
}
|
||||
|
||||
void GetNodesAddingTaskRequest::setAccessKeyId(const std::string& accessKeyId)
|
||||
{
|
||||
accessKeyId_ = accessKeyId;
|
||||
setParameter("AccessKeyId", accessKeyId);
|
||||
}
|
||||
|
||||
std::string GetNodesAddingTaskRequest::getIotInstanceId()const
|
||||
{
|
||||
return iotInstanceId_;
|
||||
}
|
||||
|
||||
void GetNodesAddingTaskRequest::setIotInstanceId(const std::string& iotInstanceId)
|
||||
{
|
||||
iotInstanceId_ = iotInstanceId;
|
||||
setParameter("IotInstanceId", iotInstanceId);
|
||||
}
|
||||
|
||||
std::string GetNodesAddingTaskRequest::getTaskId()const
|
||||
{
|
||||
return taskId_;
|
||||
}
|
||||
|
||||
void GetNodesAddingTaskRequest::setTaskId(const std::string& taskId)
|
||||
{
|
||||
taskId_ = taskId;
|
||||
setParameter("TaskId", taskId);
|
||||
}
|
||||
|
||||
std::string GetNodesAddingTaskRequest::getApiProduct()const
|
||||
{
|
||||
return apiProduct_;
|
||||
}
|
||||
|
||||
void GetNodesAddingTaskRequest::setApiProduct(const std::string& apiProduct)
|
||||
{
|
||||
apiProduct_ = apiProduct;
|
||||
setBodyParameter("ApiProduct", apiProduct);
|
||||
}
|
||||
|
||||
std::string GetNodesAddingTaskRequest::getApiRevision()const
|
||||
{
|
||||
return apiRevision_;
|
||||
}
|
||||
|
||||
void GetNodesAddingTaskRequest::setApiRevision(const std::string& apiRevision)
|
||||
{
|
||||
apiRevision_ = apiRevision;
|
||||
setBodyParameter("ApiRevision", apiRevision);
|
||||
}
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* 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/GetNodesAddingTaskResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Iot;
|
||||
using namespace AlibabaCloud::Iot::Model;
|
||||
|
||||
GetNodesAddingTaskResult::GetNodesAddingTaskResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetNodesAddingTaskResult::GetNodesAddingTaskResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetNodesAddingTaskResult::~GetNodesAddingTaskResult()
|
||||
{}
|
||||
|
||||
void GetNodesAddingTaskResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allSuccessDevEuis = value["SuccessDevEuis"]["SuccessDevEui"];
|
||||
for (const auto &item : allSuccessDevEuis)
|
||||
successDevEuis_.push_back(item.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();
|
||||
if(!value["TaskId"].isNull())
|
||||
taskId_ = value["TaskId"].asString();
|
||||
if(!value["TaskState"].isNull())
|
||||
taskState_ = value["TaskState"].asString();
|
||||
if(!value["TotalCount"].isNull())
|
||||
totalCount_ = std::stol(value["TotalCount"].asString());
|
||||
if(!value["SuccessCount"].isNull())
|
||||
successCount_ = std::stol(value["SuccessCount"].asString());
|
||||
|
||||
}
|
||||
|
||||
std::vector<std::string> GetNodesAddingTaskResult::getSuccessDevEuis()const
|
||||
{
|
||||
return successDevEuis_;
|
||||
}
|
||||
|
||||
long GetNodesAddingTaskResult::getTotalCount()const
|
||||
{
|
||||
return totalCount_;
|
||||
}
|
||||
|
||||
std::string GetNodesAddingTaskResult::getTaskId()const
|
||||
{
|
||||
return taskId_;
|
||||
}
|
||||
|
||||
std::string GetNodesAddingTaskResult::getErrorMessage()const
|
||||
{
|
||||
return errorMessage_;
|
||||
}
|
||||
|
||||
long GetNodesAddingTaskResult::getSuccessCount()const
|
||||
{
|
||||
return successCount_;
|
||||
}
|
||||
|
||||
std::string GetNodesAddingTaskResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
std::string GetNodesAddingTaskResult::getTaskState()const
|
||||
{
|
||||
return taskState_;
|
||||
}
|
||||
|
||||
bool GetNodesAddingTaskResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user