Supported delete snapshots.

This commit is contained in:
sdk-team
2022-12-15 06:40:42 +00:00
parent 2a254b88e0
commit 1e31c73a54
12 changed files with 526 additions and 1 deletions

View File

@@ -123,6 +123,78 @@ DBFSClient::AttachDbfsOutcomeCallable DBFSClient::attachDbfsCallable(const Attac
return task->get_future();
}
DBFSClient::CancelAutoSnapshotPolicyOutcome DBFSClient::cancelAutoSnapshotPolicy(const CancelAutoSnapshotPolicyRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CancelAutoSnapshotPolicyOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CancelAutoSnapshotPolicyOutcome(CancelAutoSnapshotPolicyResult(outcome.result()));
else
return CancelAutoSnapshotPolicyOutcome(outcome.error());
}
void DBFSClient::cancelAutoSnapshotPolicyAsync(const CancelAutoSnapshotPolicyRequest& request, const CancelAutoSnapshotPolicyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, cancelAutoSnapshotPolicy(request), context);
};
asyncExecute(new Runnable(fn));
}
DBFSClient::CancelAutoSnapshotPolicyOutcomeCallable DBFSClient::cancelAutoSnapshotPolicyCallable(const CancelAutoSnapshotPolicyRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CancelAutoSnapshotPolicyOutcome()>>(
[this, request]()
{
return this->cancelAutoSnapshotPolicy(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
DBFSClient::CreateAutoSnapshotPolicyOutcome DBFSClient::createAutoSnapshotPolicy(const CreateAutoSnapshotPolicyRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateAutoSnapshotPolicyOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateAutoSnapshotPolicyOutcome(CreateAutoSnapshotPolicyResult(outcome.result()));
else
return CreateAutoSnapshotPolicyOutcome(outcome.error());
}
void DBFSClient::createAutoSnapshotPolicyAsync(const CreateAutoSnapshotPolicyRequest& request, const CreateAutoSnapshotPolicyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createAutoSnapshotPolicy(request), context);
};
asyncExecute(new Runnable(fn));
}
DBFSClient::CreateAutoSnapshotPolicyOutcomeCallable DBFSClient::createAutoSnapshotPolicyCallable(const CreateAutoSnapshotPolicyRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateAutoSnapshotPolicyOutcome()>>(
[this, request]()
{
return this->createAutoSnapshotPolicy(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
DBFSClient::CreateDbfsOutcome DBFSClient::createDbfs(const CreateDbfsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -0,0 +1,56 @@
/*
* 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/dbfs/model/CancelAutoSnapshotPolicyRequest.h>
using AlibabaCloud::DBFS::Model::CancelAutoSnapshotPolicyRequest;
CancelAutoSnapshotPolicyRequest::CancelAutoSnapshotPolicyRequest()
: RpcServiceRequest("dbfs", "2020-04-18", "CancelAutoSnapshotPolicy") {
setMethod(HttpRequest::Method::Post);
}
CancelAutoSnapshotPolicyRequest::~CancelAutoSnapshotPolicyRequest() {}
std::vector<CancelAutoSnapshotPolicyRequest::std::string> CancelAutoSnapshotPolicyRequest::getDbfsIds() const {
return dbfsIds_;
}
void CancelAutoSnapshotPolicyRequest::setDbfsIds(const std::vector<CancelAutoSnapshotPolicyRequest::std::string> &dbfsIds) {
dbfsIds_ = dbfsIds;
for(int dep1 = 0; dep1 != dbfsIds.size(); dep1++) {
setParameter(std::string("DbfsIds") + "." + std::to_string(dep1 + 1), dbfsIds[dep1]);
}
}
std::string CancelAutoSnapshotPolicyRequest::getPolicyId() const {
return policyId_;
}
void CancelAutoSnapshotPolicyRequest::setPolicyId(const std::string &policyId) {
policyId_ = policyId;
setParameter(std::string("PolicyId"), policyId);
}
std::string CancelAutoSnapshotPolicyRequest::getRegionId() const {
return regionId_;
}
void CancelAutoSnapshotPolicyRequest::setRegionId(const std::string &regionId) {
regionId_ = regionId;
setParameter(std::string("RegionId"), regionId);
}

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

View File

@@ -0,0 +1,76 @@
/*
* 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/dbfs/model/CreateAutoSnapshotPolicyRequest.h>
using AlibabaCloud::DBFS::Model::CreateAutoSnapshotPolicyRequest;
CreateAutoSnapshotPolicyRequest::CreateAutoSnapshotPolicyRequest()
: RpcServiceRequest("dbfs", "2020-04-18", "CreateAutoSnapshotPolicy") {
setMethod(HttpRequest::Method::Post);
}
CreateAutoSnapshotPolicyRequest::~CreateAutoSnapshotPolicyRequest() {}
std::vector<CreateAutoSnapshotPolicyRequest::std::string> CreateAutoSnapshotPolicyRequest::getTimePoints() const {
return timePoints_;
}
void CreateAutoSnapshotPolicyRequest::setTimePoints(const std::vector<CreateAutoSnapshotPolicyRequest::std::string> &timePoints) {
timePoints_ = timePoints;
for(int dep1 = 0; dep1 != timePoints.size(); dep1++) {
setParameter(std::string("TimePoints") + "." + std::to_string(dep1 + 1), timePoints[dep1]);
}
}
std::vector<CreateAutoSnapshotPolicyRequest::std::string> CreateAutoSnapshotPolicyRequest::getRepeatWeekdays() const {
return repeatWeekdays_;
}
void CreateAutoSnapshotPolicyRequest::setRepeatWeekdays(const std::vector<CreateAutoSnapshotPolicyRequest::std::string> &repeatWeekdays) {
repeatWeekdays_ = repeatWeekdays;
for(int dep1 = 0; dep1 != repeatWeekdays.size(); dep1++) {
setParameter(std::string("RepeatWeekdays") + "." + std::to_string(dep1 + 1), repeatWeekdays[dep1]);
}
}
std::string CreateAutoSnapshotPolicyRequest::getRegionId() const {
return regionId_;
}
void CreateAutoSnapshotPolicyRequest::setRegionId(const std::string &regionId) {
regionId_ = regionId;
setParameter(std::string("RegionId"), regionId);
}
std::string CreateAutoSnapshotPolicyRequest::getPolicyName() const {
return policyName_;
}
void CreateAutoSnapshotPolicyRequest::setPolicyName(const std::string &policyName) {
policyName_ = policyName;
setParameter(std::string("PolicyName"), policyName);
}
int CreateAutoSnapshotPolicyRequest::getRetentionDays() const {
return retentionDays_;
}
void CreateAutoSnapshotPolicyRequest::setRetentionDays(int retentionDays) {
retentionDays_ = retentionDays;
setParameter(std::string("RetentionDays"), std::to_string(retentionDays));
}

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