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 | bucket_name = "" |
20 | directory_maps = [] |
21 | fileobjects = [] |
22 |
|
23 | def __init__(self, bucket_name): |
24 | self.bucket_name = bucket_name |
25 |
|
26 | def create_dirmap( |
27 | self, |
28 | local_path, |
29 | s3_prefix, |
30 | gz_compress=0, |
31 | recursive=True, |
32 | gpg_enabled=False, |
33 | gpg_email="", |
34 | ): |
35 | dirmap = sync_directory_map() |
36 | dirmap.local_path = local_path |
37 | dirmap.s3_prefix = s3_prefix |
38 | dirmap.gz_compress = gz_compress |
39 | dirmap.recursive = recursive |
40 | dirmap.gpg_enabled = gpg_enabled |
41 | dirmap.gpg_email = gpg_email |
42 | self.directory_maps.append(dirmap) |
43 |
|
44 | def create_fileobject(self, key, modified, etag, size): |
45 | fileobject = sync_fileobject() |
46 | fileobject.key = None |
47 | fileobject.modified = 0 |
48 | fileobject.etag = None |
49 | fileobject.size = 0 |
50 | self.fileobjects.append(fileobject) |
51 |
|