Skip to content

Commit 1e31c73

Browse files
committed
Supported delete snapshots.
1 parent 2a254b8 commit 1e31c73

12 files changed

+526
-1
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.36.1390
1+
1.36.1391

dbfs/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ set(dbfs_public_header_model
2525
include/alibabacloud/dbfs/model/AddTagsBatchResult.h
2626
include/alibabacloud/dbfs/model/AttachDbfsRequest.h
2727
include/alibabacloud/dbfs/model/AttachDbfsResult.h
28+
include/alibabacloud/dbfs/model/CancelAutoSnapshotPolicyRequest.h
29+
include/alibabacloud/dbfs/model/CancelAutoSnapshotPolicyResult.h
30+
include/alibabacloud/dbfs/model/CreateAutoSnapshotPolicyRequest.h
31+
include/alibabacloud/dbfs/model/CreateAutoSnapshotPolicyResult.h
2832
include/alibabacloud/dbfs/model/CreateDbfsRequest.h
2933
include/alibabacloud/dbfs/model/CreateDbfsResult.h
3034
include/alibabacloud/dbfs/model/CreateServiceLinkedRoleRequest.h
@@ -74,6 +78,10 @@ set(dbfs_src
7478
src/model/AddTagsBatchResult.cc
7579
src/model/AttachDbfsRequest.cc
7680
src/model/AttachDbfsResult.cc
81+
src/model/CancelAutoSnapshotPolicyRequest.cc
82+
src/model/CancelAutoSnapshotPolicyResult.cc
83+
src/model/CreateAutoSnapshotPolicyRequest.cc
84+
src/model/CreateAutoSnapshotPolicyResult.cc
7785
src/model/CreateDbfsRequest.cc
7886
src/model/CreateDbfsResult.cc
7987
src/model/CreateServiceLinkedRoleRequest.cc

dbfs/include/alibabacloud/dbfs/DBFSClient.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
#include "model/AddTagsBatchResult.h"
2727
#include "model/AttachDbfsRequest.h"
2828
#include "model/AttachDbfsResult.h"
29+
#include "model/CancelAutoSnapshotPolicyRequest.h"
30+
#include "model/CancelAutoSnapshotPolicyResult.h"
31+
#include "model/CreateAutoSnapshotPolicyRequest.h"
32+
#include "model/CreateAutoSnapshotPolicyResult.h"
2933
#include "model/CreateDbfsRequest.h"
3034
#include "model/CreateDbfsResult.h"
3135
#include "model/CreateServiceLinkedRoleRequest.h"
@@ -83,6 +87,12 @@ namespace AlibabaCloud
8387
typedef Outcome<Error, Model::AttachDbfsResult> AttachDbfsOutcome;
8488
typedef std::future<AttachDbfsOutcome> AttachDbfsOutcomeCallable;
8589
typedef std::function<void(const DBFSClient*, const Model::AttachDbfsRequest&, const AttachDbfsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> AttachDbfsAsyncHandler;
90+
typedef Outcome<Error, Model::CancelAutoSnapshotPolicyResult> CancelAutoSnapshotPolicyOutcome;
91+
typedef std::future<CancelAutoSnapshotPolicyOutcome> CancelAutoSnapshotPolicyOutcomeCallable;
92+
typedef std::function<void(const DBFSClient*, const Model::CancelAutoSnapshotPolicyRequest&, const CancelAutoSnapshotPolicyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CancelAutoSnapshotPolicyAsyncHandler;
93+
typedef Outcome<Error, Model::CreateAutoSnapshotPolicyResult> CreateAutoSnapshotPolicyOutcome;
94+
typedef std::future<CreateAutoSnapshotPolicyOutcome> CreateAutoSnapshotPolicyOutcomeCallable;
95+
typedef std::function<void(const DBFSClient*, const Model::CreateAutoSnapshotPolicyRequest&, const CreateAutoSnapshotPolicyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateAutoSnapshotPolicyAsyncHandler;
8696
typedef Outcome<Error, Model::CreateDbfsResult> CreateDbfsOutcome;
8797
typedef std::future<CreateDbfsOutcome> CreateDbfsOutcomeCallable;
8898
typedef std::function<void(const DBFSClient*, const Model::CreateDbfsRequest&, const CreateDbfsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateDbfsAsyncHandler;
@@ -157,6 +167,12 @@ namespace AlibabaCloud
157167
AttachDbfsOutcome attachDbfs(const Model::AttachDbfsRequest &request)const;
158168
void attachDbfsAsync(const Model::AttachDbfsRequest& request, const AttachDbfsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
159169
AttachDbfsOutcomeCallable attachDbfsCallable(const Model::AttachDbfsRequest& request) const;
170+
CancelAutoSnapshotPolicyOutcome cancelAutoSnapshotPolicy(const Model::CancelAutoSnapshotPolicyRequest &request)const;
171+
void cancelAutoSnapshotPolicyAsync(const Model::CancelAutoSnapshotPolicyRequest& request, const CancelAutoSnapshotPolicyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
172+
CancelAutoSnapshotPolicyOutcomeCallable cancelAutoSnapshotPolicyCallable(const Model::CancelAutoSnapshotPolicyRequest& request) const;
173+
CreateAutoSnapshotPolicyOutcome createAutoSnapshotPolicy(const Model::CreateAutoSnapshotPolicyRequest &request)const;
174+
void createAutoSnapshotPolicyAsync(const Model::CreateAutoSnapshotPolicyRequest& request, const CreateAutoSnapshotPolicyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
175+
CreateAutoSnapshotPolicyOutcomeCallable createAutoSnapshotPolicyCallable(const Model::CreateAutoSnapshotPolicyRequest& request) const;
160176
CreateDbfsOutcome createDbfs(const Model::CreateDbfsRequest &request)const;
161177
void createDbfsAsync(const Model::CreateDbfsRequest& request, const CreateDbfsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
162178
CreateDbfsOutcomeCallable createDbfsCallable(const Model::CreateDbfsRequest& request) const;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ALIBABACLOUD_DBFS_MODEL_CANCELAUTOSNAPSHOTPOLICYREQUEST_H_
18+
#define ALIBABACLOUD_DBFS_MODEL_CANCELAUTOSNAPSHOTPOLICYREQUEST_H_
19+
20+
#include <alibabacloud/dbfs/DBFSExport.h>
21+
#include <alibabacloud/core/RpcServiceRequest.h>
22+
#include <string>
23+
#include <vector>
24+
#include <map>
25+
26+
namespace AlibabaCloud {
27+
namespace DBFS {
28+
namespace Model {
29+
class ALIBABACLOUD_DBFS_EXPORT CancelAutoSnapshotPolicyRequest : public RpcServiceRequest {
30+
public:
31+
CancelAutoSnapshotPolicyRequest();
32+
~CancelAutoSnapshotPolicyRequest();
33+
std::vector<std::string> getDbfsIds() const;
34+
void setDbfsIds(const std::vector<std::string> &dbfsIds);
35+
std::string getPolicyId() const;
36+
void setPolicyId(const std::string &policyId);
37+
std::string getRegionId() const;
38+
void setRegionId(const std::string &regionId);
39+
40+
private:
41+
std::vector<std::string> dbfsIds_;
42+
std::string policyId_;
43+
std::string regionId_;
44+
};
45+
} // namespace Model
46+
} // namespace DBFS
47+
} // namespace AlibabaCloud
48+
#endif // !ALIBABACLOUD_DBFS_MODEL_CANCELAUTOSNAPSHOTPOLICYREQUEST_H_
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ALIBABACLOUD_DBFS_MODEL_CANCELAUTOSNAPSHOTPOLICYRESULT_H_
18+
#define ALIBABACLOUD_DBFS_MODEL_CANCELAUTOSNAPSHOTPOLICYRESULT_H_
19+
20+
#include <string>
21+
#include <vector>
22+
#include <utility>
23+
#include <alibabacloud/core/ServiceResult.h>
24+
#include <alibabacloud/dbfs/DBFSExport.h>
25+
26+
namespace AlibabaCloud
27+
{
28+
namespace DBFS
29+
{
30+
namespace Model
31+
{
32+
class ALIBABACLOUD_DBFS_EXPORT CancelAutoSnapshotPolicyResult : public ServiceResult
33+
{
34+
public:
35+
36+
37+
CancelAutoSnapshotPolicyResult();
38+
explicit CancelAutoSnapshotPolicyResult(const std::string &payload);
39+
~CancelAutoSnapshotPolicyResult();
40+
41+
protected:
42+
void parse(const std::string &payload);
43+
private:
44+
45+
};
46+
}
47+
}
48+
}
49+
#endif // !ALIBABACLOUD_DBFS_MODEL_CANCELAUTOSNAPSHOTPOLICYRESULT_H_
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ALIBABACLOUD_DBFS_MODEL_CREATEAUTOSNAPSHOTPOLICYREQUEST_H_
18+
#define ALIBABACLOUD_DBFS_MODEL_CREATEAUTOSNAPSHOTPOLICYREQUEST_H_
19+
20+
#include <alibabacloud/dbfs/DBFSExport.h>
21+
#include <alibabacloud/core/RpcServiceRequest.h>
22+
#include <string>
23+
#include <vector>
24+
#include <map>
25+
26+
namespace AlibabaCloud {
27+
namespace DBFS {
28+
namespace Model {
29+
class ALIBABACLOUD_DBFS_EXPORT CreateAutoSnapshotPolicyRequest : public RpcServiceRequest {
30+
public:
31+
CreateAutoSnapshotPolicyRequest();
32+
~CreateAutoSnapshotPolicyRequest();
33+
std::vector<std::string> getTimePoints() const;
34+
void setTimePoints(const std::vector<std::string> &timePoints);
35+
std::vector<std::string> getRepeatWeekdays() const;
36+
void setRepeatWeekdays(const std::vector<std::string> &repeatWeekdays);
37+
std::string getRegionId() const;
38+
void setRegionId(const std::string &regionId);
39+
std::string getPolicyName() const;
40+
void setPolicyName(const std::string &policyName);
41+
int getRetentionDays() const;
42+
void setRetentionDays(int retentionDays);
43+
44+
private:
45+
std::vector<std::string> timePoints_;
46+
std::vector<std::string> repeatWeekdays_;
47+
std::string regionId_;
48+
std::string policyName_;
49+
int retentionDays_;
50+
};
51+
} // namespace Model
52+
} // namespace DBFS
53+
} // namespace AlibabaCloud
54+
#endif // !ALIBABACLOUD_DBFS_MODEL_CREATEAUTOSNAPSHOTPOLICYREQUEST_H_
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ALIBABACLOUD_DBFS_MODEL_CREATEAUTOSNAPSHOTPOLICYRESULT_H_
18+
#define ALIBABACLOUD_DBFS_MODEL_CREATEAUTOSNAPSHOTPOLICYRESULT_H_
19+
20+
#include <string>
21+
#include <vector>
22+
#include <utility>
23+
#include <alibabacloud/core/ServiceResult.h>
24+
#include <alibabacloud/dbfs/DBFSExport.h>
25+
26+
namespace AlibabaCloud
27+
{
28+
namespace DBFS
29+
{
30+
namespace Model
31+
{
32+
class ALIBABACLOUD_DBFS_EXPORT CreateAutoSnapshotPolicyResult : public ServiceResult
33+
{
34+
public:
35+
36+
37+
CreateAutoSnapshotPolicyResult();
38+
explicit CreateAutoSnapshotPolicyResult(const std::string &payload);
39+
~CreateAutoSnapshotPolicyResult();
40+
std::string getPolicyId()const;
41+
42+
protected:
43+
void parse(const std::string &payload);
44+
private:
45+
std::string policyId_;
46+
47+
};
48+
}
49+
}
50+
}
51+
#endif // !ALIBABACLOUD_DBFS_MODEL_CREATEAUTOSNAPSHOTPOLICYRESULT_H_

dbfs/src/DBFSClient.cc

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,78 @@ DBFSClient::AttachDbfsOutcomeCallable DBFSClient::attachDbfsCallable(const Attac
123123
return task->get_future();
124124
}
125125

126+
DBFSClient::CancelAutoSnapshotPolicyOutcome DBFSClient::cancelAutoSnapshotPolicy(const CancelAutoSnapshotPolicyRequest &request) const
127+
{
128+
auto endpointOutcome = endpointProvider_->getEndpoint();
129+
if (!endpointOutcome.isSuccess())
130+
return CancelAutoSnapshotPolicyOutcome(endpointOutcome.error());
131+
132+
auto outcome = makeRequest(endpointOutcome.result(), request);
133+
134+
if (outcome.isSuccess())
135+
return CancelAutoSnapshotPolicyOutcome(CancelAutoSnapshotPolicyResult(outcome.result()));
136+
else
137+
return CancelAutoSnapshotPolicyOutcome(outcome.error());
138+
}
139+
140+
void DBFSClient::cancelAutoSnapshotPolicyAsync(const CancelAutoSnapshotPolicyRequest& request, const CancelAutoSnapshotPolicyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
141+
{
142+
auto fn = [this, request, handler, context]()
143+
{
144+
handler(this, request, cancelAutoSnapshotPolicy(request), context);
145+
};
146+
147+
asyncExecute(new Runnable(fn));
148+
}
149+
150+
DBFSClient::CancelAutoSnapshotPolicyOutcomeCallable DBFSClient::cancelAutoSnapshotPolicyCallable(const CancelAutoSnapshotPolicyRequest &request) const
151+
{
152+
auto task = std::make_shared<std::packaged_task<CancelAutoSnapshotPolicyOutcome()>>(
153+
[this, request]()
154+
{
155+
return this->cancelAutoSnapshotPolicy(request);
156+
});
157+
158+
asyncExecute(new Runnable([task]() { (*task)(); }));
159+
return task->get_future();
160+
}
161+
162+
DBFSClient::CreateAutoSnapshotPolicyOutcome DBFSClient::createAutoSnapshotPolicy(const CreateAutoSnapshotPolicyRequest &request) const
163+
{
164+
auto endpointOutcome = endpointProvider_->getEndpoint();
165+
if (!endpointOutcome.isSuccess())
166+
return CreateAutoSnapshotPolicyOutcome(endpointOutcome.error());
167+
168+
auto outcome = makeRequest(endpointOutcome.result(), request);
169+
170+
if (outcome.isSuccess())
171+
return CreateAutoSnapshotPolicyOutcome(CreateAutoSnapshotPolicyResult(outcome.result()));
172+
else
173+
return CreateAutoSnapshotPolicyOutcome(outcome.error());
174+
}
175+
176+
void DBFSClient::createAutoSnapshotPolicyAsync(const CreateAutoSnapshotPolicyRequest& request, const CreateAutoSnapshotPolicyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
177+
{
178+
auto fn = [this, request, handler, context]()
179+
{
180+
handler(this, request, createAutoSnapshotPolicy(request), context);
181+
};
182+
183+
asyncExecute(new Runnable(fn));
184+
}
185+
186+
DBFSClient::CreateAutoSnapshotPolicyOutcomeCallable DBFSClient::createAutoSnapshotPolicyCallable(const CreateAutoSnapshotPolicyRequest &request) const
187+
{
188+
auto task = std::make_shared<std::packaged_task<CreateAutoSnapshotPolicyOutcome()>>(
189+
[this, request]()
190+
{
191+
return this->createAutoSnapshotPolicy(request);
192+
});
193+
194+
asyncExecute(new Runnable([task]() { (*task)(); }));
195+
return task->get_future();
196+
}
197+
126198
DBFSClient::CreateDbfsOutcome DBFSClient::createDbfs(const CreateDbfsRequest &request) const
127199
{
128200
auto endpointOutcome = endpointProvider_->getEndpoint();

0 commit comments

Comments
 (0)