Add status operation api.

This commit is contained in:
sdk-team
2024-06-18 09:20:10 +00:00
parent 4a7816979a
commit 8c606d0357
18 changed files with 756 additions and 13 deletions

View File

@@ -375,3 +375,111 @@ ComputeNestClient::ListServiceInstancesOutcomeCallable ComputeNestClient::listSe
return task->get_future();
}
ComputeNestClient::RestartServiceInstanceOutcome ComputeNestClient::restartServiceInstance(const RestartServiceInstanceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return RestartServiceInstanceOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return RestartServiceInstanceOutcome(RestartServiceInstanceResult(outcome.result()));
else
return RestartServiceInstanceOutcome(outcome.error());
}
void ComputeNestClient::restartServiceInstanceAsync(const RestartServiceInstanceRequest& request, const RestartServiceInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, restartServiceInstance(request), context);
};
asyncExecute(new Runnable(fn));
}
ComputeNestClient::RestartServiceInstanceOutcomeCallable ComputeNestClient::restartServiceInstanceCallable(const RestartServiceInstanceRequest &request) const
{
auto task = std::make_shared<std::packaged_task<RestartServiceInstanceOutcome()>>(
[this, request]()
{
return this->restartServiceInstance(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ComputeNestClient::StartServiceInstanceOutcome ComputeNestClient::startServiceInstance(const StartServiceInstanceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return StartServiceInstanceOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return StartServiceInstanceOutcome(StartServiceInstanceResult(outcome.result()));
else
return StartServiceInstanceOutcome(outcome.error());
}
void ComputeNestClient::startServiceInstanceAsync(const StartServiceInstanceRequest& request, const StartServiceInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, startServiceInstance(request), context);
};
asyncExecute(new Runnable(fn));
}
ComputeNestClient::StartServiceInstanceOutcomeCallable ComputeNestClient::startServiceInstanceCallable(const StartServiceInstanceRequest &request) const
{
auto task = std::make_shared<std::packaged_task<StartServiceInstanceOutcome()>>(
[this, request]()
{
return this->startServiceInstance(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ComputeNestClient::StopServiceInstanceOutcome ComputeNestClient::stopServiceInstance(const StopServiceInstanceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return StopServiceInstanceOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return StopServiceInstanceOutcome(StopServiceInstanceResult(outcome.result()));
else
return StopServiceInstanceOutcome(outcome.error());
}
void ComputeNestClient::stopServiceInstanceAsync(const StopServiceInstanceRequest& request, const StopServiceInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, stopServiceInstance(request), context);
};
asyncExecute(new Runnable(fn));
}
ComputeNestClient::StopServiceInstanceOutcomeCallable ComputeNestClient::stopServiceInstanceCallable(const StopServiceInstanceRequest &request) const
{
auto task = std::make_shared<std::packaged_task<StopServiceInstanceOutcome()>>(
[this, request]()
{
return this->stopServiceInstance(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -87,6 +87,8 @@ void ListServiceInstancesResult::parse(const std::string &payload)
serviceInstancesObject.resourceGroupId = valueServiceInstancesServiceInstance["ResourceGroupId"].asString();
if(!valueServiceInstancesServiceInstance["BizStatus"].isNull())
serviceInstancesObject.bizStatus = valueServiceInstancesServiceInstance["BizStatus"].asString();
if(!valueServiceInstancesServiceInstance["OrderId"].isNull())
serviceInstancesObject.orderId = valueServiceInstancesServiceInstance["OrderId"].asString();
auto allTagsNode = valueServiceInstancesServiceInstance["Tags"]["Tag"];
for (auto valueServiceInstancesServiceInstanceTagsTag : allTagsNode)
{
@@ -130,6 +132,11 @@ void ListServiceInstancesResult::parse(const std::string &payload)
serviceInfoObject.shortDescription = serviceNodeServiceInfosServiceInfo["ShortDescription"].asString();
serviceInstancesObject.service.serviceInfos.push_back(serviceInfoObject);
}
auto commodityNode = serviceNode["Commodity"];
if(!commodityNode["SaasBoostMetadata"].isNull())
serviceInstancesObject.service.commodity.saasBoostMetadata = commodityNode["SaasBoostMetadata"].asString();
if(!commodityNode["Type"].isNull())
serviceInstancesObject.service.commodity.type = commodityNode["Type"].asString();
serviceInstances_.push_back(serviceInstancesObject);
}
if(!value["NextToken"].isNull())

View File

@@ -0,0 +1,54 @@
/*
* 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/computenest/model/RestartServiceInstanceRequest.h>
using AlibabaCloud::ComputeNest::Model::RestartServiceInstanceRequest;
RestartServiceInstanceRequest::RestartServiceInstanceRequest()
: RpcServiceRequest("computenest", "2021-06-01", "RestartServiceInstance") {
setMethod(HttpRequest::Method::Post);
}
RestartServiceInstanceRequest::~RestartServiceInstanceRequest() {}
std::string RestartServiceInstanceRequest::getClientToken() const {
return clientToken_;
}
void RestartServiceInstanceRequest::setClientToken(const std::string &clientToken) {
clientToken_ = clientToken;
setParameter(std::string("ClientToken"), clientToken);
}
std::string RestartServiceInstanceRequest::getRegionId() const {
return regionId_;
}
void RestartServiceInstanceRequest::setRegionId(const std::string &regionId) {
regionId_ = regionId;
setParameter(std::string("RegionId"), regionId);
}
std::string RestartServiceInstanceRequest::getServiceInstanceId() const {
return serviceInstanceId_;
}
void RestartServiceInstanceRequest::setServiceInstanceId(const std::string &serviceInstanceId) {
serviceInstanceId_ = serviceInstanceId;
setParameter(std::string("ServiceInstanceId"), serviceInstanceId);
}

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/computenest/model/RestartServiceInstanceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::ComputeNest;
using namespace AlibabaCloud::ComputeNest::Model;
RestartServiceInstanceResult::RestartServiceInstanceResult() :
ServiceResult()
{}
RestartServiceInstanceResult::RestartServiceInstanceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
RestartServiceInstanceResult::~RestartServiceInstanceResult()
{}
void RestartServiceInstanceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
}

View File

@@ -0,0 +1,54 @@
/*
* 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/computenest/model/StartServiceInstanceRequest.h>
using AlibabaCloud::ComputeNest::Model::StartServiceInstanceRequest;
StartServiceInstanceRequest::StartServiceInstanceRequest()
: RpcServiceRequest("computenest", "2021-06-01", "StartServiceInstance") {
setMethod(HttpRequest::Method::Post);
}
StartServiceInstanceRequest::~StartServiceInstanceRequest() {}
std::string StartServiceInstanceRequest::getClientToken() const {
return clientToken_;
}
void StartServiceInstanceRequest::setClientToken(const std::string &clientToken) {
clientToken_ = clientToken;
setParameter(std::string("ClientToken"), clientToken);
}
std::string StartServiceInstanceRequest::getRegionId() const {
return regionId_;
}
void StartServiceInstanceRequest::setRegionId(const std::string &regionId) {
regionId_ = regionId;
setParameter(std::string("RegionId"), regionId);
}
std::string StartServiceInstanceRequest::getServiceInstanceId() const {
return serviceInstanceId_;
}
void StartServiceInstanceRequest::setServiceInstanceId(const std::string &serviceInstanceId) {
serviceInstanceId_ = serviceInstanceId;
setParameter(std::string("ServiceInstanceId"), serviceInstanceId);
}

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/computenest/model/StartServiceInstanceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::ComputeNest;
using namespace AlibabaCloud::ComputeNest::Model;
StartServiceInstanceResult::StartServiceInstanceResult() :
ServiceResult()
{}
StartServiceInstanceResult::StartServiceInstanceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
StartServiceInstanceResult::~StartServiceInstanceResult()
{}
void StartServiceInstanceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
}

View File

@@ -0,0 +1,54 @@
/*
* 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/computenest/model/StopServiceInstanceRequest.h>
using AlibabaCloud::ComputeNest::Model::StopServiceInstanceRequest;
StopServiceInstanceRequest::StopServiceInstanceRequest()
: RpcServiceRequest("computenest", "2021-06-01", "StopServiceInstance") {
setMethod(HttpRequest::Method::Post);
}
StopServiceInstanceRequest::~StopServiceInstanceRequest() {}
std::string StopServiceInstanceRequest::getClientToken() const {
return clientToken_;
}
void StopServiceInstanceRequest::setClientToken(const std::string &clientToken) {
clientToken_ = clientToken;
setParameter(std::string("ClientToken"), clientToken);
}
std::string StopServiceInstanceRequest::getRegionId() const {
return regionId_;
}
void StopServiceInstanceRequest::setRegionId(const std::string &regionId) {
regionId_ = regionId;
setParameter(std::string("RegionId"), regionId);
}
std::string StopServiceInstanceRequest::getServiceInstanceId() const {
return serviceInstanceId_;
}
void StopServiceInstanceRequest::setServiceInstanceId(const std::string &serviceInstanceId) {
serviceInstanceId_ = serviceInstanceId;
setParameter(std::string("ServiceInstanceId"), serviceInstanceId);
}

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/computenest/model/StopServiceInstanceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::ComputeNest;
using namespace AlibabaCloud::ComputeNest::Model;
StopServiceInstanceResult::StopServiceInstanceResult() :
ServiceResult()
{}
StopServiceInstanceResult::StopServiceInstanceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
StopServiceInstanceResult::~StopServiceInstanceResult()
{}
void StopServiceInstanceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
}