1 | # s3-bsync Copyright (c) 2021 Joshua Stockin |
2 | # <https://joshstock.in> |
3 | # <https://git.joshstock.in/s3-bsync> |
4 | # |
5 | # This software is licensed and distributed under the terms of the MIT License. |
6 | # See the MIT License in the LICENSE file of this project's root folder. |
7 | # |
8 | # This comment block and its contents, including this disclaimer, MUST be |
9 | # preserved in all copies or distributions of this software's source. |
10 |
|
11 |
|
12 | from .sync_directory_map import sync_directory_map |
13 | from .sync_fileobject import sync_fileobject |
14 |
|
15 | __all__ = ["sync_managed_bucket"] |
16 |
|
17 |
|
18 | class sync_managed_bucket: |
19 | def __init__(self, bucket_name): |
20 | self.bucket_name = bucket_name |
21 | self.directory_maps = [] |
22 | self.fileobjects = [] |
23 |
|
24 | def create_dirmap( |
25 | self, |
26 | local_path, |
27 | s3_prefix, |
28 | gz_compress=0, |
29 | recursive=True, |
30 | gpg_enabled=False, |
31 | gpg_email="", |
32 | ): |
33 | dirmap = sync_directory_map() |
34 | dirmap.local_path = local_path |
35 | dirmap.s3_prefix = s3_prefix |
36 | dirmap.gz_compress = gz_compress |
37 | dirmap.recursive = recursive |
38 | dirmap.gpg_enabled = gpg_enabled |
39 | dirmap.gpg_email = gpg_email |
40 | self.directory_maps.append(dirmap) |
41 |
|
42 | def create_fileobject(self, key, modified, etag, size): |
43 | fileobject = sync_fileobject() |
44 | fileobject.key = None |
45 | fileobject.modified = 0 |
46 | fileobject.etag = None |
47 | fileobject.size = 0 |
48 | self.fileobjects.append(fileobject) |
49 |
|