Skip to content

Commit 8dd35cb

Browse files
dataclasses for file lock and retention
1 parent ff12bba commit 8dd35cb

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

b2sdk/file_lock.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import enum
2+
3+
4+
@enum.unique
5+
class RetentionMode(enum.Enum):
6+
COMPLIANCE = "compliance" # TODO: docs
7+
GOVERNANCE = "governance" # TODO: docs
8+
9+
10+
class RetentionPeriod:
11+
"""
12+
"period": {
13+
"duration": 2,
14+
"unit": "years"
15+
}
16+
"""
17+
def __init__(self, *, years=None, days=None):
18+
assert (years is None) != (days is None)
19+
if years is not None:
20+
self.duration = years
21+
self.unit = 'years'
22+
else:
23+
self.duration = days
24+
self.unit = 'days'
25+
26+
27+
class RetentionSetting:
28+
"""
29+
"defaultRetention": {
30+
"mode": "compliance",
31+
"period": {
32+
"duration": 7,
33+
"unit": "days"
34+
}
35+
}
36+
"""
37+
38+
39+
class FileRetention:
40+
pass
41+
42+
43+
class FileLockConfiguration:
44+
"""
45+
"fileLockConfiguration": {
46+
"isClientAuthorizedToRead": true,
47+
"value": {
48+
"defaultRetention": {
49+
"mode": "governance",
50+
"period": {
51+
"duration": 2,
52+
"unit": "years"
53+
}
54+
},
55+
"isFileLockEnabled": true
56+
}
57+
}
58+
59+
"fileLockConfiguration": {
60+
"isClientAuthorizedToRead": false,
61+
"value": null
62+
}
63+
"""
64+
pass

0 commit comments

Comments
 (0)