Supported C#.
This commit is contained in:
89
dybaseapi/src/DybaseapiClient.cc
Normal file
89
dybaseapi/src/DybaseapiClient.cc
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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/dybaseapi/DybaseapiClient.h>
|
||||
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||
|
||||
using namespace AlibabaCloud;
|
||||
using namespace AlibabaCloud::Location;
|
||||
using namespace AlibabaCloud::Dybaseapi;
|
||||
using namespace AlibabaCloud::Dybaseapi::Model;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string SERVICE_NAME = "Dybaseapi";
|
||||
}
|
||||
|
||||
DybaseapiClient::DybaseapiClient(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, "");
|
||||
}
|
||||
|
||||
DybaseapiClient::DybaseapiClient(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, "");
|
||||
}
|
||||
|
||||
DybaseapiClient::DybaseapiClient(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, "");
|
||||
}
|
||||
|
||||
DybaseapiClient::~DybaseapiClient()
|
||||
{}
|
||||
|
||||
DybaseapiClient::QueryTokenForMnsQueueOutcome DybaseapiClient::queryTokenForMnsQueue(const QueryTokenForMnsQueueRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return QueryTokenForMnsQueueOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return QueryTokenForMnsQueueOutcome(QueryTokenForMnsQueueResult(outcome.result()));
|
||||
else
|
||||
return QueryTokenForMnsQueueOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void DybaseapiClient::queryTokenForMnsQueueAsync(const QueryTokenForMnsQueueRequest& request, const QueryTokenForMnsQueueAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, queryTokenForMnsQueue(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
DybaseapiClient::QueryTokenForMnsQueueOutcomeCallable DybaseapiClient::queryTokenForMnsQueueCallable(const QueryTokenForMnsQueueRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<QueryTokenForMnsQueueOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->queryTokenForMnsQueue(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
81
dybaseapi/src/model/QueryTokenForMnsQueueRequest.cc
Normal file
81
dybaseapi/src/model/QueryTokenForMnsQueueRequest.cc
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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/dybaseapi/model/QueryTokenForMnsQueueRequest.h>
|
||||
|
||||
using AlibabaCloud::Dybaseapi::Model::QueryTokenForMnsQueueRequest;
|
||||
|
||||
QueryTokenForMnsQueueRequest::QueryTokenForMnsQueueRequest()
|
||||
: RpcServiceRequest("dybaseapi", "2017-05-25", "QueryTokenForMnsQueue") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
QueryTokenForMnsQueueRequest::~QueryTokenForMnsQueueRequest() {}
|
||||
|
||||
std::string QueryTokenForMnsQueueRequest::getQueueName() const {
|
||||
return queueName_;
|
||||
}
|
||||
|
||||
void QueryTokenForMnsQueueRequest::setQueueName(const std::string &queueName) {
|
||||
queueName_ = queueName;
|
||||
setParameter(std::string("QueueName"), queueName);
|
||||
}
|
||||
|
||||
long QueryTokenForMnsQueueRequest::getResourceOwnerId() const {
|
||||
return resourceOwnerId_;
|
||||
}
|
||||
|
||||
void QueryTokenForMnsQueueRequest::setResourceOwnerId(long resourceOwnerId) {
|
||||
resourceOwnerId_ = resourceOwnerId;
|
||||
setParameter(std::string("ResourceOwnerId"), std::to_string(resourceOwnerId));
|
||||
}
|
||||
|
||||
std::string QueryTokenForMnsQueueRequest::getResourceOwnerAccount() const {
|
||||
return resourceOwnerAccount_;
|
||||
}
|
||||
|
||||
void QueryTokenForMnsQueueRequest::setResourceOwnerAccount(const std::string &resourceOwnerAccount) {
|
||||
resourceOwnerAccount_ = resourceOwnerAccount;
|
||||
setParameter(std::string("ResourceOwnerAccount"), resourceOwnerAccount);
|
||||
}
|
||||
|
||||
std::string QueryTokenForMnsQueueRequest::getMessageType() const {
|
||||
return messageType_;
|
||||
}
|
||||
|
||||
void QueryTokenForMnsQueueRequest::setMessageType(const std::string &messageType) {
|
||||
messageType_ = messageType;
|
||||
setParameter(std::string("MessageType"), messageType);
|
||||
}
|
||||
|
||||
long QueryTokenForMnsQueueRequest::getOwnerId() const {
|
||||
return ownerId_;
|
||||
}
|
||||
|
||||
void QueryTokenForMnsQueueRequest::setOwnerId(long ownerId) {
|
||||
ownerId_ = ownerId;
|
||||
setParameter(std::string("OwnerId"), std::to_string(ownerId));
|
||||
}
|
||||
|
||||
std::string QueryTokenForMnsQueueRequest::getAccessKeyId() const {
|
||||
return accessKeyId_;
|
||||
}
|
||||
|
||||
void QueryTokenForMnsQueueRequest::setAccessKeyId(const std::string &accessKeyId) {
|
||||
accessKeyId_ = accessKeyId;
|
||||
setParameter(std::string("AccessKeyId"), accessKeyId);
|
||||
}
|
||||
|
||||
74
dybaseapi/src/model/QueryTokenForMnsQueueResult.cc
Normal file
74
dybaseapi/src/model/QueryTokenForMnsQueueResult.cc
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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/dybaseapi/model/QueryTokenForMnsQueueResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Dybaseapi;
|
||||
using namespace AlibabaCloud::Dybaseapi::Model;
|
||||
|
||||
QueryTokenForMnsQueueResult::QueryTokenForMnsQueueResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
QueryTokenForMnsQueueResult::QueryTokenForMnsQueueResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
QueryTokenForMnsQueueResult::~QueryTokenForMnsQueueResult()
|
||||
{}
|
||||
|
||||
void QueryTokenForMnsQueueResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto messageTokenDTONode = value["MessageTokenDTO"];
|
||||
if(!messageTokenDTONode["AccessKeySecret"].isNull())
|
||||
messageTokenDTO_.accessKeySecret = messageTokenDTONode["AccessKeySecret"].asString();
|
||||
if(!messageTokenDTONode["ExpireTime"].isNull())
|
||||
messageTokenDTO_.expireTime = messageTokenDTONode["ExpireTime"].asString();
|
||||
if(!messageTokenDTONode["SecurityToken"].isNull())
|
||||
messageTokenDTO_.securityToken = messageTokenDTONode["SecurityToken"].asString();
|
||||
if(!messageTokenDTONode["AccessKeyId"].isNull())
|
||||
messageTokenDTO_.accessKeyId = messageTokenDTONode["AccessKeyId"].asString();
|
||||
if(!messageTokenDTONode["CreateTime"].isNull())
|
||||
messageTokenDTO_.createTime = messageTokenDTONode["CreateTime"].asString();
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
QueryTokenForMnsQueueResult::MessageTokenDTO QueryTokenForMnsQueueResult::getMessageTokenDTO()const
|
||||
{
|
||||
return messageTokenDTO_;
|
||||
}
|
||||
|
||||
std::string QueryTokenForMnsQueueResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
std::string QueryTokenForMnsQueueResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user