Support groupId operations.

This commit is contained in:
sdk-team
2020-04-23 10:35:18 +08:00
parent 4d493b157c
commit e6cff897c5
30 changed files with 1756 additions and 1 deletions

View File

@@ -0,0 +1,269 @@
/*
* 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/onsmqtt/OnsMqttClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::OnsMqtt;
using namespace AlibabaCloud::OnsMqtt::Model;
namespace
{
const std::string SERVICE_NAME = "OnsMqtt";
}
OnsMqttClient::OnsMqttClient(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, "");
}
OnsMqttClient::OnsMqttClient(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, "");
}
OnsMqttClient::OnsMqttClient(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, "");
}
OnsMqttClient::~OnsMqttClient()
{}
OnsMqttClient::ApplyTokenOutcome OnsMqttClient::applyToken(const ApplyTokenRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ApplyTokenOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ApplyTokenOutcome(ApplyTokenResult(outcome.result()));
else
return ApplyTokenOutcome(outcome.error());
}
void OnsMqttClient::applyTokenAsync(const ApplyTokenRequest& request, const ApplyTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, applyToken(request), context);
};
asyncExecute(new Runnable(fn));
}
OnsMqttClient::ApplyTokenOutcomeCallable OnsMqttClient::applyTokenCallable(const ApplyTokenRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ApplyTokenOutcome()>>(
[this, request]()
{
return this->applyToken(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
OnsMqttClient::CreateGroupIdOutcome OnsMqttClient::createGroupId(const CreateGroupIdRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateGroupIdOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateGroupIdOutcome(CreateGroupIdResult(outcome.result()));
else
return CreateGroupIdOutcome(outcome.error());
}
void OnsMqttClient::createGroupIdAsync(const CreateGroupIdRequest& request, const CreateGroupIdAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createGroupId(request), context);
};
asyncExecute(new Runnable(fn));
}
OnsMqttClient::CreateGroupIdOutcomeCallable OnsMqttClient::createGroupIdCallable(const CreateGroupIdRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateGroupIdOutcome()>>(
[this, request]()
{
return this->createGroupId(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
OnsMqttClient::DeleteGroupIdOutcome OnsMqttClient::deleteGroupId(const DeleteGroupIdRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteGroupIdOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteGroupIdOutcome(DeleteGroupIdResult(outcome.result()));
else
return DeleteGroupIdOutcome(outcome.error());
}
void OnsMqttClient::deleteGroupIdAsync(const DeleteGroupIdRequest& request, const DeleteGroupIdAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteGroupId(request), context);
};
asyncExecute(new Runnable(fn));
}
OnsMqttClient::DeleteGroupIdOutcomeCallable OnsMqttClient::deleteGroupIdCallable(const DeleteGroupIdRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteGroupIdOutcome()>>(
[this, request]()
{
return this->deleteGroupId(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
OnsMqttClient::ListGroupIdOutcome OnsMqttClient::listGroupId(const ListGroupIdRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ListGroupIdOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ListGroupIdOutcome(ListGroupIdResult(outcome.result()));
else
return ListGroupIdOutcome(outcome.error());
}
void OnsMqttClient::listGroupIdAsync(const ListGroupIdRequest& request, const ListGroupIdAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, listGroupId(request), context);
};
asyncExecute(new Runnable(fn));
}
OnsMqttClient::ListGroupIdOutcomeCallable OnsMqttClient::listGroupIdCallable(const ListGroupIdRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ListGroupIdOutcome()>>(
[this, request]()
{
return this->listGroupId(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
OnsMqttClient::QueryTokenOutcome OnsMqttClient::queryToken(const QueryTokenRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return QueryTokenOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return QueryTokenOutcome(QueryTokenResult(outcome.result()));
else
return QueryTokenOutcome(outcome.error());
}
void OnsMqttClient::queryTokenAsync(const QueryTokenRequest& request, const QueryTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, queryToken(request), context);
};
asyncExecute(new Runnable(fn));
}
OnsMqttClient::QueryTokenOutcomeCallable OnsMqttClient::queryTokenCallable(const QueryTokenRequest &request) const
{
auto task = std::make_shared<std::packaged_task<QueryTokenOutcome()>>(
[this, request]()
{
return this->queryToken(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
OnsMqttClient::RevokeTokenOutcome OnsMqttClient::revokeToken(const RevokeTokenRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return RevokeTokenOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return RevokeTokenOutcome(RevokeTokenResult(outcome.result()));
else
return RevokeTokenOutcome(outcome.error());
}
void OnsMqttClient::revokeTokenAsync(const RevokeTokenRequest& request, const RevokeTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, revokeToken(request), context);
};
asyncExecute(new Runnable(fn));
}
OnsMqttClient::RevokeTokenOutcomeCallable OnsMqttClient::revokeTokenCallable(const RevokeTokenRequest &request) const
{
auto task = std::make_shared<std::packaged_task<RevokeTokenOutcome()>>(
[this, request]()
{
return this->revokeToken(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -0,0 +1,73 @@
/*
* 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/onsmqtt/model/ApplyTokenRequest.h>
using AlibabaCloud::OnsMqtt::Model::ApplyTokenRequest;
ApplyTokenRequest::ApplyTokenRequest() :
RpcServiceRequest("onsmqtt", "2020-04-20", "ApplyToken")
{
setMethod(HttpRequest::Method::Post);
}
ApplyTokenRequest::~ApplyTokenRequest()
{}
long ApplyTokenRequest::getExpireTime()const
{
return expireTime_;
}
void ApplyTokenRequest::setExpireTime(long expireTime)
{
expireTime_ = expireTime;
setParameter("ExpireTime", std::to_string(expireTime));
}
std::string ApplyTokenRequest::getResources()const
{
return resources_;
}
void ApplyTokenRequest::setResources(const std::string& resources)
{
resources_ = resources;
setParameter("Resources", resources);
}
std::string ApplyTokenRequest::getInstanceId()const
{
return instanceId_;
}
void ApplyTokenRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}
std::string ApplyTokenRequest::getActions()const
{
return actions_;
}
void ApplyTokenRequest::setActions(const std::string& actions)
{
actions_ = actions;
setParameter("Actions", actions);
}

View File

@@ -0,0 +1,51 @@
/*
* 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/onsmqtt/model/ApplyTokenResult.h>
#include <json/json.h>
using namespace AlibabaCloud::OnsMqtt;
using namespace AlibabaCloud::OnsMqtt::Model;
ApplyTokenResult::ApplyTokenResult() :
ServiceResult()
{}
ApplyTokenResult::ApplyTokenResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ApplyTokenResult::~ApplyTokenResult()
{}
void ApplyTokenResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Token"].isNull())
token_ = value["Token"].asString();
}
std::string ApplyTokenResult::getToken()const
{
return token_;
}

View File

@@ -0,0 +1,51 @@
/*
* 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/onsmqtt/model/CreateGroupIdRequest.h>
using AlibabaCloud::OnsMqtt::Model::CreateGroupIdRequest;
CreateGroupIdRequest::CreateGroupIdRequest() :
RpcServiceRequest("onsmqtt", "2020-04-20", "CreateGroupId")
{
setMethod(HttpRequest::Method::Post);
}
CreateGroupIdRequest::~CreateGroupIdRequest()
{}
std::string CreateGroupIdRequest::getGroupId()const
{
return groupId_;
}
void CreateGroupIdRequest::setGroupId(const std::string& groupId)
{
groupId_ = groupId;
setParameter("GroupId", groupId);
}
std::string CreateGroupIdRequest::getInstanceId()const
{
return instanceId_;
}
void CreateGroupIdRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}

View File

@@ -0,0 +1,51 @@
/*
* 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/onsmqtt/model/CreateGroupIdResult.h>
#include <json/json.h>
using namespace AlibabaCloud::OnsMqtt;
using namespace AlibabaCloud::OnsMqtt::Model;
CreateGroupIdResult::CreateGroupIdResult() :
ServiceResult()
{}
CreateGroupIdResult::CreateGroupIdResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
CreateGroupIdResult::~CreateGroupIdResult()
{}
void CreateGroupIdResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["HelpUrl"].isNull())
helpUrl_ = value["HelpUrl"].asString();
}
std::string CreateGroupIdResult::getHelpUrl()const
{
return helpUrl_;
}

View File

@@ -0,0 +1,51 @@
/*
* 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/onsmqtt/model/DeleteGroupIdRequest.h>
using AlibabaCloud::OnsMqtt::Model::DeleteGroupIdRequest;
DeleteGroupIdRequest::DeleteGroupIdRequest() :
RpcServiceRequest("onsmqtt", "2020-04-20", "DeleteGroupId")
{
setMethod(HttpRequest::Method::Post);
}
DeleteGroupIdRequest::~DeleteGroupIdRequest()
{}
std::string DeleteGroupIdRequest::getGroupId()const
{
return groupId_;
}
void DeleteGroupIdRequest::setGroupId(const std::string& groupId)
{
groupId_ = groupId;
setParameter("GroupId", groupId);
}
std::string DeleteGroupIdRequest::getInstanceId()const
{
return instanceId_;
}
void DeleteGroupIdRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}

View File

@@ -0,0 +1,51 @@
/*
* 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/onsmqtt/model/DeleteGroupIdResult.h>
#include <json/json.h>
using namespace AlibabaCloud::OnsMqtt;
using namespace AlibabaCloud::OnsMqtt::Model;
DeleteGroupIdResult::DeleteGroupIdResult() :
ServiceResult()
{}
DeleteGroupIdResult::DeleteGroupIdResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DeleteGroupIdResult::~DeleteGroupIdResult()
{}
void DeleteGroupIdResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["HelpUrl"].isNull())
helpUrl_ = value["HelpUrl"].asString();
}
std::string DeleteGroupIdResult::getHelpUrl()const
{
return helpUrl_;
}

View File

@@ -0,0 +1,40 @@
/*
* 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/onsmqtt/model/ListGroupIdRequest.h>
using AlibabaCloud::OnsMqtt::Model::ListGroupIdRequest;
ListGroupIdRequest::ListGroupIdRequest() :
RpcServiceRequest("onsmqtt", "2020-04-20", "ListGroupId")
{
setMethod(HttpRequest::Method::Post);
}
ListGroupIdRequest::~ListGroupIdRequest()
{}
std::string ListGroupIdRequest::getInstanceId()const
{
return instanceId_;
}
void ListGroupIdRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}

View 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/onsmqtt/model/ListGroupIdResult.h>
#include <json/json.h>
using namespace AlibabaCloud::OnsMqtt;
using namespace AlibabaCloud::OnsMqtt::Model;
ListGroupIdResult::ListGroupIdResult() :
ServiceResult()
{}
ListGroupIdResult::ListGroupIdResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListGroupIdResult::~ListGroupIdResult()
{}
void ListGroupIdResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allDataNode = value["Data"]["MqttGroupIdDo"];
for (auto valueDataMqttGroupIdDo : allDataNode)
{
MqttGroupIdDo dataObject;
if(!valueDataMqttGroupIdDo["CreateTime"].isNull())
dataObject.createTime = std::stol(valueDataMqttGroupIdDo["CreateTime"].asString());
if(!valueDataMqttGroupIdDo["GroupId"].isNull())
dataObject.groupId = valueDataMqttGroupIdDo["GroupId"].asString();
if(!valueDataMqttGroupIdDo["IndependentNaming"].isNull())
dataObject.independentNaming = valueDataMqttGroupIdDo["IndependentNaming"].asString() == "true";
if(!valueDataMqttGroupIdDo["InstanceId"].isNull())
dataObject.instanceId = valueDataMqttGroupIdDo["InstanceId"].asString();
if(!valueDataMqttGroupIdDo["UpdateTime"].isNull())
dataObject.updateTime = std::stol(valueDataMqttGroupIdDo["UpdateTime"].asString());
data_.push_back(dataObject);
}
}
std::vector<ListGroupIdResult::MqttGroupIdDo> ListGroupIdResult::getData()const
{
return data_;
}

View File

@@ -0,0 +1,51 @@
/*
* 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/onsmqtt/model/QueryTokenRequest.h>
using AlibabaCloud::OnsMqtt::Model::QueryTokenRequest;
QueryTokenRequest::QueryTokenRequest() :
RpcServiceRequest("onsmqtt", "2020-04-20", "QueryToken")
{
setMethod(HttpRequest::Method::Post);
}
QueryTokenRequest::~QueryTokenRequest()
{}
std::string QueryTokenRequest::getToken()const
{
return token_;
}
void QueryTokenRequest::setToken(const std::string& token)
{
token_ = token;
setParameter("Token", token);
}
std::string QueryTokenRequest::getInstanceId()const
{
return instanceId_;
}
void QueryTokenRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}

View File

@@ -0,0 +1,51 @@
/*
* 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/onsmqtt/model/QueryTokenResult.h>
#include <json/json.h>
using namespace AlibabaCloud::OnsMqtt;
using namespace AlibabaCloud::OnsMqtt::Model;
QueryTokenResult::QueryTokenResult() :
ServiceResult()
{}
QueryTokenResult::QueryTokenResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
QueryTokenResult::~QueryTokenResult()
{}
void QueryTokenResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["TokenStatus"].isNull())
tokenStatus_ = value["TokenStatus"].asString() == "true";
}
bool QueryTokenResult::getTokenStatus()const
{
return tokenStatus_;
}

View File

@@ -0,0 +1,51 @@
/*
* 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/onsmqtt/model/RevokeTokenRequest.h>
using AlibabaCloud::OnsMqtt::Model::RevokeTokenRequest;
RevokeTokenRequest::RevokeTokenRequest() :
RpcServiceRequest("onsmqtt", "2020-04-20", "RevokeToken")
{
setMethod(HttpRequest::Method::Post);
}
RevokeTokenRequest::~RevokeTokenRequest()
{}
std::string RevokeTokenRequest::getToken()const
{
return token_;
}
void RevokeTokenRequest::setToken(const std::string& token)
{
token_ = token;
setParameter("Token", token);
}
std::string RevokeTokenRequest::getInstanceId()const
{
return instanceId_;
}
void RevokeTokenRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}

View File

@@ -0,0 +1,44 @@
/*
* 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/onsmqtt/model/RevokeTokenResult.h>
#include <json/json.h>
using namespace AlibabaCloud::OnsMqtt;
using namespace AlibabaCloud::OnsMqtt::Model;
RevokeTokenResult::RevokeTokenResult() :
ServiceResult()
{}
RevokeTokenResult::RevokeTokenResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
RevokeTokenResult::~RevokeTokenResult()
{}
void RevokeTokenResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
}