Add API OpenOnsService which can active ons service.

This commit is contained in:
sdk-team
2020-09-29 08:44:45 +00:00
parent 37c044aa31
commit e3b1009a94
10 changed files with 236 additions and 3 deletions

View File

@@ -54,6 +54,10 @@ void OnsInstanceBaseInfoResult::parse(const std::string &payload)
instanceBaseInfo_.independentNaming = instanceBaseInfoNode["IndependentNaming"].asString() == "true";
if(!instanceBaseInfoNode["Remark"].isNull())
instanceBaseInfo_.remark = instanceBaseInfoNode["Remark"].asString();
if(!instanceBaseInfoNode["TopicCapacity"].isNull())
instanceBaseInfo_.topicCapacity = std::stoi(instanceBaseInfoNode["TopicCapacity"].asString());
if(!instanceBaseInfoNode["MaxTps"].isNull())
instanceBaseInfo_.maxTps = std::stol(instanceBaseInfoNode["MaxTps"].asString());
auto endpointsNode = instanceBaseInfoNode["Endpoints"];
if(!endpointsNode["TcpEndpoint"].isNull())
instanceBaseInfo_.endpoints.tcpEndpoint = endpointsNode["TcpEndpoint"].asString();

View File

@@ -0,0 +1,29 @@
/*
* 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/ons/model/OpenOnsServiceRequest.h>
using AlibabaCloud::Ons::Model::OpenOnsServiceRequest;
OpenOnsServiceRequest::OpenOnsServiceRequest() :
RpcServiceRequest("ons", "2019-02-14", "OpenOnsService")
{
setMethod(HttpRequest::Method::Post);
}
OpenOnsServiceRequest::~OpenOnsServiceRequest()
{}

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/ons/model/OpenOnsServiceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ons;
using namespace AlibabaCloud::Ons::Model;
OpenOnsServiceResult::OpenOnsServiceResult() :
ServiceResult()
{}
OpenOnsServiceResult::OpenOnsServiceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
OpenOnsServiceResult::~OpenOnsServiceResult()
{}
void OpenOnsServiceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["OrderId"].isNull())
orderId_ = value["OrderId"].asString();
}
std::string OpenOnsServiceResult::getOrderId()const
{
return orderId_;
}