files-com 1.6.15__py3-none-any.whl → 1.6.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of files-com might be problematic. Click here for more details.

_VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.15
1
+ 1.6.16
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: files_com
3
- Version: 1.6.15
3
+ Version: 1.6.16
4
4
  Summary: Python bindings for the Files.com API
5
5
  License: MIT
6
6
  Requires-Python: >=3.5
@@ -1,14 +1,14 @@
1
1
  README.md,sha256=dJpTjuJA-JJIQ4CKgQhlbqyxanVatHk0RXgCD6KFl3A,28758
2
- _VERSION,sha256=aQ3gGXbABeiPbSK36EPl1m0vIDf5gq8yLv7vbCuTFDc,7
3
- files_com-1.6.15.dist-info/licenses/LICENSE,sha256=ziANl9OTD-5-iE8XYIZNm6IYBDxOCHwQ-mdhci7lNew,1102
4
- files_sdk/__init__.py,sha256=Q6F4oQVja92ZvjpkpdThfmJEbgdUyhxOyR4J3AhLOYE,12464
2
+ _VERSION,sha256=MUJXu48xkoNV6r2Yd-lvy5TYajweETPleRA8nQHVToU,7
3
+ files_com-1.6.16.dist-info/licenses/LICENSE,sha256=ziANl9OTD-5-iE8XYIZNm6IYBDxOCHwQ-mdhci7lNew,1102
4
+ files_sdk/__init__.py,sha256=ivTwxKA9zNFRe2MaGlWIP2KsAkHw2WaeLdKbrQ1eMoM,12631
5
5
  files_sdk/api.py,sha256=HOLk50HLQCbnHwnAr9OElQEWvdA_BABBSEvvFSt1S4A,1846
6
6
  files_sdk/api_client.py,sha256=cfFvm-o4Ao8SWADiJv7t7qnJfG_LJmWV3l6ALTC-Opo,11264
7
7
  files_sdk/error.py,sha256=lZKht6lYj9i99CzRbHschmdSs6T2Y51-YrZX_5Y_o7A,64945
8
8
  files_sdk/list_obj.py,sha256=MWgmESLAmfh1uaSw76PWxmnf9f6_08TLUHe8_mCYKL4,1157
9
9
  files_sdk/path_util.py,sha256=7x8X3JLoMkcqNefCaBeHYXD8MGvPby4AOy-xnBX_LNk,1694
10
10
  files_sdk/util.py,sha256=6aA4N0Wq_ykINW7eMrs2ntFAL2hRLM6IvJf6n_yP34c,962
11
- files_sdk/models/__init__.py,sha256=1kGlrFYXRNv6LCEAMgYrPBb1lZ9_AIUm5HZFn3wV8bI,5609
11
+ files_sdk/models/__init__.py,sha256=LvKT5Ya05LG2dz0X1-9lO6UGtL0Us8AeZub0Bwxs1cU,5694
12
12
  files_sdk/models/account_line_item.py,sha256=8FLg83Aqpz4y_QYy3fZ_KZsZFWv1f1KGD9T5CH1WSGs,1929
13
13
  files_sdk/models/action.py,sha256=M1lyMybE7SKht2nGXtYWp2l8b4oVkeImo6KF8DLiCos,2034
14
14
  files_sdk/models/action_notification_export.py,sha256=4cdEo2ZCDV3RH3GLSqHV7RWyJ2ONRSUq0glCEi94zd0,6636
@@ -92,12 +92,14 @@ files_sdk/models/sftp_host_key.py,sha256=3r5noHhRg-Hn3TLGBUDQYayKIw_Dn5waB9YmGSf
92
92
  files_sdk/models/share_group.py,sha256=rw-W2x5XFBPc48rvazaro28HfjOli885417i702Mowc,9066
93
93
  files_sdk/models/share_group_member.py,sha256=m0BUE4AhClJIoaV-_kU0yryCOwQ5EloZlyHQ4WaCVdU,1248
94
94
  files_sdk/models/siem_http_destination.py,sha256=BDExKltNMH8q3ZoKJO_fBRtjVliqzjnj1KHEKycXiCw,49945
95
- files_sdk/models/site.py,sha256=hnWiYy9wF3tDhpSf3DDsufwmAFC_cJ7ifwi13gga5ec,69437
95
+ files_sdk/models/site.py,sha256=CmUvexrJNjra8kg_EvYpqUWmNmxUE-pC8IbJrorYzFg,69964
96
96
  files_sdk/models/snapshot.py,sha256=zmdQWKR8EhUkF1mFQHFzWfreaEVXG1p_jEtmY4j3cKA,9840
97
97
  files_sdk/models/sso_strategy.py,sha256=vWNCPfot8z15xUhAoFsS52W-1vg8IpKIqAALZ6pBwd0,9112
98
98
  files_sdk/models/status.py,sha256=IIY3RiJ2RZ2yPByAAh8eIq_cgZFTj13eR4UpqHTANQI,1363
99
99
  files_sdk/models/style.py,sha256=KZY0fZ4kP4AtwZpCi24EtNXL8WFLhE9a1Jme1gA6Kkw,5201
100
+ files_sdk/models/sync.py,sha256=rUov2eV6VdWhm-QVqQmJFl9FTW-s4U7rcd0mfgUiAEM,23150
100
101
  files_sdk/models/sync_log.py,sha256=N8hRyRNkvKYJhQkSlwre47aFL_JWLlvj_bVrvHBVPsE,40135
102
+ files_sdk/models/sync_run.py,sha256=oFseCvj_aEZh4lShhc8utzVX1yusYzv33tR-Apr8VP4,5391
101
103
  files_sdk/models/usage_by_top_level_dir.py,sha256=o_dETvzcgEA9lsdES_yzwPVAZVFk4ZcnsCTugR8O8eY,1185
102
104
  files_sdk/models/usage_daily_snapshot.py,sha256=rWf6GaTlN9spkUPwfF4IJ0Y6z-JTV9TAWjsFrxI-UFg,5477
103
105
  files_sdk/models/usage_snapshot.py,sha256=3GzMIxBjKelgNP7ksWq4XlrRlAFcYxzd_J6vAgb52qc,4005
@@ -108,7 +110,7 @@ files_sdk/models/user_request.py,sha256=ykA5Lq0MYB7qTDOMMFBuyKa_R_LgQwGVorC-q-6q
108
110
  files_sdk/models/user_sftp_client_use.py,sha256=VnOo3ll6fwSc8grG5ZqGK8o3grYKg5P9b5B_hGS4vCs,2827
109
111
  files_sdk/models/web_dav_action_log.py,sha256=7__LZvb_fInvXwy90ur7IrcRSxKOwF8L6OwpjJbS73Y,355354
110
112
  files_sdk/models/webhook_test.py,sha256=AWGH8ULsgltBJL2YtTYGnAJ80cCVekrjZ2sUP0UlWgc,5018
111
- files_com-1.6.15.dist-info/METADATA,sha256=x5OLyFIq5zDiG_8Q8R69WFebcarnnk-u2BAKzG6jSkM,29050
112
- files_com-1.6.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
113
- files_com-1.6.15.dist-info/top_level.txt,sha256=p_2P-gluT_8boeXQNixTP3x-tFd1-la2NedKOiln21I,10
114
- files_com-1.6.15.dist-info/RECORD,,
113
+ files_com-1.6.16.dist-info/METADATA,sha256=wR8yE4tWxx0pVvlUjhskfWz9nYYyu0Z3RLRi_BIZMH0,29050
114
+ files_com-1.6.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
115
+ files_com-1.6.16.dist-info/top_level.txt,sha256=p_2P-gluT_8boeXQNixTP3x-tFd1-la2NedKOiln21I,10
116
+ files_com-1.6.16.dist-info/RECORD,,
files_sdk/__init__.py CHANGED
@@ -87,7 +87,9 @@ import files_sdk.models.snapshot as snapshot
87
87
  import files_sdk.models.sso_strategy as sso_strategy
88
88
  import files_sdk.models.status as status
89
89
  import files_sdk.models.style as style
90
+ import files_sdk.models.sync as sync
90
91
  import files_sdk.models.sync_log as sync_log
92
+ import files_sdk.models.sync_run as sync_run
91
93
  import files_sdk.models.usage_by_top_level_dir as usage_by_top_level_dir
92
94
  import files_sdk.models.usage_daily_snapshot as usage_daily_snapshot
93
95
  import files_sdk.models.usage_snapshot as usage_snapshot
@@ -193,7 +195,9 @@ from files_sdk.models.snapshot import Snapshot
193
195
  from files_sdk.models.sso_strategy import SsoStrategy
194
196
  from files_sdk.models.status import Status
195
197
  from files_sdk.models.style import Style
198
+ from files_sdk.models.sync import Sync
196
199
  from files_sdk.models.sync_log import SyncLog
200
+ from files_sdk.models.sync_run import SyncRun
197
201
  from files_sdk.models.usage_by_top_level_dir import UsageByTopLevelDir
198
202
  from files_sdk.models.usage_daily_snapshot import UsageDailySnapshot
199
203
  from files_sdk.models.usage_snapshot import UsageSnapshot
@@ -215,7 +219,7 @@ session_id = None
215
219
  source_ip = None
216
220
  base_url = "https://app.files.com"
217
221
  base_path = "api/rest/v1"
218
- version = "1.6.15"
222
+ version = "1.6.16"
219
223
 
220
224
  __version__ = version
221
225
 
@@ -92,7 +92,9 @@ from files_sdk.models.snapshot import Snapshot
92
92
  from files_sdk.models.sso_strategy import SsoStrategy
93
93
  from files_sdk.models.status import Status
94
94
  from files_sdk.models.style import Style
95
+ from files_sdk.models.sync import Sync
95
96
  from files_sdk.models.sync_log import SyncLog
97
+ from files_sdk.models.sync_run import SyncRun
96
98
  from files_sdk.models.usage_by_top_level_dir import UsageByTopLevelDir
97
99
  from files_sdk.models.usage_daily_snapshot import UsageDailySnapshot
98
100
  from files_sdk.models.usage_snapshot import UsageSnapshot
files_sdk/models/site.py CHANGED
@@ -65,6 +65,7 @@ class Site:
65
65
  "desktop_app_session_ip_pinning": None, # boolean - Is desktop app session IP pinning enabled?
66
66
  "desktop_app_session_lifetime": None, # int64 - Desktop app session lifetime (in hours)
67
67
  "legacy_checksums_mode": None, # boolean - Use legacy checksums mode?
68
+ "migrate_remote_server_sync_to_sync": None, # boolean - If true, we will migrate all remote server syncs to the new Sync model.
68
69
  "mobile_app": None, # boolean - Is the mobile app enabled?
69
70
  "mobile_app_session_ip_pinning": None, # boolean - Is mobile app session IP pinning enabled?
70
71
  "mobile_app_session_lifetime": None, # int64 - Mobile app session lifetime (in hours)
@@ -263,6 +264,7 @@ def get_usage(params=None, options=None):
263
264
  # calculate_file_checksums_sha1 - boolean - Calculate SHA1 checksums for files?
264
265
  # calculate_file_checksums_sha256 - boolean - Calculate SHA256 checksums for files?
265
266
  # legacy_checksums_mode - boolean - Use legacy checksums mode?
267
+ # migrate_remote_server_sync_to_sync - boolean - If true, we will migrate all remote server syncs to the new Sync model.
266
268
  # session_expiry - double - Session expiry in hours
267
269
  # ssl_required - boolean - Is SSL required? Disabling this is insecure.
268
270
  # tls_disabled - boolean - DO NOT ENABLE. This setting allows TLSv1.0 and TLSv1.1 to be used on your site. We intend to remove this capability entirely in early 2024. If set, the `sftp_insecure_ciphers` flag will be automatically set to true.
@@ -614,6 +616,12 @@ def update(params=None, options=None):
614
616
  raise InvalidParameterError(
615
617
  "Bad parameter: legacy_checksums_mode must be an bool"
616
618
  )
619
+ if "migrate_remote_server_sync_to_sync" in params and not isinstance(
620
+ params["migrate_remote_server_sync_to_sync"], bool
621
+ ):
622
+ raise InvalidParameterError(
623
+ "Bad parameter: migrate_remote_server_sync_to_sync must be an bool"
624
+ )
617
625
  if "session_expiry" in params and not isinstance(
618
626
  params["session_expiry"], float
619
627
  ):
@@ -0,0 +1,470 @@
1
+ import builtins # noqa: F401
2
+ from files_sdk.api import Api # noqa: F401
3
+ from files_sdk.list_obj import ListObj
4
+ from files_sdk.error import ( # noqa: F401
5
+ InvalidParameterError,
6
+ MissingParameterError,
7
+ NotImplementedError,
8
+ )
9
+
10
+
11
+ class Sync:
12
+ default_attributes = {
13
+ "id": None, # int64 - Sync ID
14
+ "name": None, # string - Name for this sync job
15
+ "description": None, # string - Description for this sync job
16
+ "site_id": None, # int64 - Site ID this sync belongs to
17
+ "user_id": None, # int64 - User who created or owns this sync
18
+ "src_path": None, # string - Absolute source path for the sync
19
+ "dest_path": None, # string - Absolute destination path for the sync
20
+ "src_remote_server_id": None, # int64 - Remote server ID for the source (if remote)
21
+ "dest_remote_server_id": None, # int64 - Remote server ID for the destination (if remote)
22
+ "two_way": None, # boolean - Is this a two-way sync?
23
+ "keep_after_copy": None, # boolean - Keep files after copying?
24
+ "delete_empty_folders": None, # boolean - Delete empty folders after sync?
25
+ "disabled": None, # boolean - Is this sync disabled?
26
+ "interval": None, # string - If trigger is `daily`, this specifies how often to run this sync. One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`
27
+ "trigger": None, # string - Trigger type: daily, custom_schedule, or manual
28
+ "trigger_file": None, # string - Some MFT services request an empty file (known as a trigger file) to signal the sync is complete and they can begin further processing. If trigger_file is set, a zero-byte file will be sent at the end of the sync.
29
+ "include_patterns": None, # array(array) - Array of glob patterns to include
30
+ "exclude_patterns": None, # array(array) - Array of glob patterns to exclude
31
+ "created_at": None, # date-time - When this sync was created
32
+ "updated_at": None, # date-time - When this sync was last updated
33
+ "sync_interval_minutes": None, # int64 - Frequency in minutes between syncs. If set, this value must be greater than or equal to the `remote_sync_interval` value for the site's plan. If left blank, the plan's `remote_sync_interval` will be used. This setting is only used if `trigger` is empty.
34
+ "recurring_day": None, # int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
35
+ "schedule_days_of_week": None, # array(int64) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. 0-based days of the week. 0 is Sunday, 1 is Monday, etc.
36
+ "schedule_times_of_day": None, # array(string) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. Times of day in HH:MM format.
37
+ "schedule_time_zone": None, # string - If trigger is `custom_schedule`, Custom schedule Time Zone for when the sync should be run.
38
+ }
39
+
40
+ def __init__(self, attributes=None, options=None):
41
+ if not isinstance(attributes, dict):
42
+ attributes = {}
43
+ if not isinstance(options, dict):
44
+ options = {}
45
+ self.set_attributes(attributes)
46
+ self.options = options
47
+
48
+ def set_attributes(self, attributes):
49
+ for attribute, default_value in Sync.default_attributes.items():
50
+ setattr(self, attribute, attributes.get(attribute, default_value))
51
+
52
+ def get_attributes(self):
53
+ return {
54
+ k: getattr(self, k, None)
55
+ for k in Sync.default_attributes
56
+ if getattr(self, k, None) is not None
57
+ }
58
+
59
+ # Parameters:
60
+ # name - string - Name for this sync job
61
+ # description - string - Description for this sync job
62
+ # src_path - string - Absolute source path
63
+ # dest_path - string - Absolute destination path
64
+ # src_remote_server_id - int64 - Remote server ID for the source
65
+ # dest_remote_server_id - int64 - Remote server ID for the destination
66
+ # two_way - boolean - Is this a two-way sync?
67
+ # keep_after_copy - boolean - Keep files after copying?
68
+ # delete_empty_folders - boolean - Delete empty folders after sync?
69
+ # disabled - boolean - Is this sync disabled?
70
+ # interval - int64 - Interval in minutes for sync (if scheduled)
71
+ # trigger - string - Trigger type: daily, custom_schedule, or manual
72
+ # trigger_file - string - Some MFT services request an empty file (known as a trigger file) to signal the sync is complete and they can begin further processing. If trigger_file is set, a zero-byte file will be sent at the end of the sync.
73
+ # recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
74
+ # schedule_time_zone - string - If trigger is `custom_schedule`, Custom schedule Time Zone for when the sync should be run.
75
+ # schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. 0-based days of the week. 0 is Sunday, 1 is Monday, etc.
76
+ # schedule_times_of_day - array(string) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. Times of day in HH:MM format.
77
+ def update(self, params=None):
78
+ if not isinstance(params, dict):
79
+ params = {}
80
+
81
+ if hasattr(self, "id") and self.id:
82
+ params["id"] = self.id
83
+ else:
84
+ raise MissingParameterError("Current object doesn't have a id")
85
+ if "id" not in params:
86
+ raise MissingParameterError("Parameter missing: id")
87
+ if "id" in params and not isinstance(params["id"], int):
88
+ raise InvalidParameterError("Bad parameter: id must be an int")
89
+ if "name" in params and not isinstance(params["name"], str):
90
+ raise InvalidParameterError("Bad parameter: name must be an str")
91
+ if "description" in params and not isinstance(
92
+ params["description"], str
93
+ ):
94
+ raise InvalidParameterError(
95
+ "Bad parameter: description must be an str"
96
+ )
97
+ if "src_path" in params and not isinstance(params["src_path"], str):
98
+ raise InvalidParameterError(
99
+ "Bad parameter: src_path must be an str"
100
+ )
101
+ if "dest_path" in params and not isinstance(params["dest_path"], str):
102
+ raise InvalidParameterError(
103
+ "Bad parameter: dest_path must be an str"
104
+ )
105
+ if "src_remote_server_id" in params and not isinstance(
106
+ params["src_remote_server_id"], int
107
+ ):
108
+ raise InvalidParameterError(
109
+ "Bad parameter: src_remote_server_id must be an int"
110
+ )
111
+ if "dest_remote_server_id" in params and not isinstance(
112
+ params["dest_remote_server_id"], int
113
+ ):
114
+ raise InvalidParameterError(
115
+ "Bad parameter: dest_remote_server_id must be an int"
116
+ )
117
+ if "interval" in params and not isinstance(params["interval"], int):
118
+ raise InvalidParameterError(
119
+ "Bad parameter: interval must be an int"
120
+ )
121
+ if "trigger" in params and not isinstance(params["trigger"], str):
122
+ raise InvalidParameterError(
123
+ "Bad parameter: trigger must be an str"
124
+ )
125
+ if "trigger_file" in params and not isinstance(
126
+ params["trigger_file"], str
127
+ ):
128
+ raise InvalidParameterError(
129
+ "Bad parameter: trigger_file must be an str"
130
+ )
131
+ if "recurring_day" in params and not isinstance(
132
+ params["recurring_day"], int
133
+ ):
134
+ raise InvalidParameterError(
135
+ "Bad parameter: recurring_day must be an int"
136
+ )
137
+ if "schedule_time_zone" in params and not isinstance(
138
+ params["schedule_time_zone"], str
139
+ ):
140
+ raise InvalidParameterError(
141
+ "Bad parameter: schedule_time_zone must be an str"
142
+ )
143
+ if "schedule_days_of_week" in params and not isinstance(
144
+ params["schedule_days_of_week"], builtins.list
145
+ ):
146
+ raise InvalidParameterError(
147
+ "Bad parameter: schedule_days_of_week must be an list"
148
+ )
149
+ if "schedule_times_of_day" in params and not isinstance(
150
+ params["schedule_times_of_day"], builtins.list
151
+ ):
152
+ raise InvalidParameterError(
153
+ "Bad parameter: schedule_times_of_day must be an list"
154
+ )
155
+ response, _options = Api.send_request(
156
+ "PATCH",
157
+ "/syncs/{id}".format(id=params["id"]),
158
+ params,
159
+ self.options,
160
+ )
161
+ return response.data
162
+
163
+ def delete(self, params=None):
164
+ if not isinstance(params, dict):
165
+ params = {}
166
+
167
+ if hasattr(self, "id") and self.id:
168
+ params["id"] = self.id
169
+ else:
170
+ raise MissingParameterError("Current object doesn't have a id")
171
+ if "id" not in params:
172
+ raise MissingParameterError("Parameter missing: id")
173
+ if "id" in params and not isinstance(params["id"], int):
174
+ raise InvalidParameterError("Bad parameter: id must be an int")
175
+ Api.send_request(
176
+ "DELETE",
177
+ "/syncs/{id}".format(id=params["id"]),
178
+ params,
179
+ self.options,
180
+ )
181
+
182
+ def destroy(self, params=None):
183
+ self.delete(params)
184
+
185
+ def save(self):
186
+ if hasattr(self, "id") and self.id:
187
+ new_obj = self.update(self.get_attributes())
188
+ self.set_attributes(new_obj.get_attributes())
189
+ return True
190
+ else:
191
+ new_obj = create(self.get_attributes(), self.options)
192
+ self.set_attributes(new_obj.get_attributes())
193
+ return True
194
+
195
+
196
+ # Parameters:
197
+ # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
198
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
199
+ def list(params=None, options=None):
200
+ if not isinstance(params, dict):
201
+ params = {}
202
+ if not isinstance(options, dict):
203
+ options = {}
204
+ if "cursor" in params and not isinstance(params["cursor"], str):
205
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
206
+ if "per_page" in params and not isinstance(params["per_page"], int):
207
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
208
+ return ListObj(Sync, "GET", "/syncs", params, options)
209
+
210
+
211
+ def all(params=None, options=None):
212
+ list(params, options)
213
+
214
+
215
+ # Parameters:
216
+ # id (required) - int64 - Sync ID.
217
+ def find(id, params=None, options=None):
218
+ if not isinstance(params, dict):
219
+ params = {}
220
+ if not isinstance(options, dict):
221
+ options = {}
222
+ params["id"] = id
223
+ if "id" in params and not isinstance(params["id"], int):
224
+ raise InvalidParameterError("Bad parameter: id must be an int")
225
+ if "id" not in params:
226
+ raise MissingParameterError("Parameter missing: id")
227
+ response, options = Api.send_request(
228
+ "GET", "/syncs/{id}".format(id=params["id"]), params, options
229
+ )
230
+ return Sync(response.data, options)
231
+
232
+
233
+ def get(id, params=None, options=None):
234
+ find(id, params, options)
235
+
236
+
237
+ # Parameters:
238
+ # name - string - Name for this sync job
239
+ # description - string - Description for this sync job
240
+ # src_path - string - Absolute source path
241
+ # dest_path - string - Absolute destination path
242
+ # src_remote_server_id - int64 - Remote server ID for the source
243
+ # dest_remote_server_id - int64 - Remote server ID for the destination
244
+ # two_way - boolean - Is this a two-way sync?
245
+ # keep_after_copy - boolean - Keep files after copying?
246
+ # delete_empty_folders - boolean - Delete empty folders after sync?
247
+ # disabled - boolean - Is this sync disabled?
248
+ # interval - int64 - Interval in minutes for sync (if scheduled)
249
+ # trigger - string - Trigger type: daily, custom_schedule, or manual
250
+ # trigger_file - string - Some MFT services request an empty file (known as a trigger file) to signal the sync is complete and they can begin further processing. If trigger_file is set, a zero-byte file will be sent at the end of the sync.
251
+ # recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
252
+ # schedule_time_zone - string - If trigger is `custom_schedule`, Custom schedule Time Zone for when the sync should be run.
253
+ # schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. 0-based days of the week. 0 is Sunday, 1 is Monday, etc.
254
+ # schedule_times_of_day - array(string) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. Times of day in HH:MM format.
255
+ def create(params=None, options=None):
256
+ if not isinstance(params, dict):
257
+ params = {}
258
+ if not isinstance(options, dict):
259
+ options = {}
260
+ if "name" in params and not isinstance(params["name"], str):
261
+ raise InvalidParameterError("Bad parameter: name must be an str")
262
+ if "description" in params and not isinstance(params["description"], str):
263
+ raise InvalidParameterError(
264
+ "Bad parameter: description must be an str"
265
+ )
266
+ if "src_path" in params and not isinstance(params["src_path"], str):
267
+ raise InvalidParameterError("Bad parameter: src_path must be an str")
268
+ if "dest_path" in params and not isinstance(params["dest_path"], str):
269
+ raise InvalidParameterError("Bad parameter: dest_path must be an str")
270
+ if "src_remote_server_id" in params and not isinstance(
271
+ params["src_remote_server_id"], int
272
+ ):
273
+ raise InvalidParameterError(
274
+ "Bad parameter: src_remote_server_id must be an int"
275
+ )
276
+ if "dest_remote_server_id" in params and not isinstance(
277
+ params["dest_remote_server_id"], int
278
+ ):
279
+ raise InvalidParameterError(
280
+ "Bad parameter: dest_remote_server_id must be an int"
281
+ )
282
+ if "two_way" in params and not isinstance(params["two_way"], bool):
283
+ raise InvalidParameterError("Bad parameter: two_way must be an bool")
284
+ if "keep_after_copy" in params and not isinstance(
285
+ params["keep_after_copy"], bool
286
+ ):
287
+ raise InvalidParameterError(
288
+ "Bad parameter: keep_after_copy must be an bool"
289
+ )
290
+ if "delete_empty_folders" in params and not isinstance(
291
+ params["delete_empty_folders"], bool
292
+ ):
293
+ raise InvalidParameterError(
294
+ "Bad parameter: delete_empty_folders must be an bool"
295
+ )
296
+ if "disabled" in params and not isinstance(params["disabled"], bool):
297
+ raise InvalidParameterError("Bad parameter: disabled must be an bool")
298
+ if "interval" in params and not isinstance(params["interval"], int):
299
+ raise InvalidParameterError("Bad parameter: interval must be an int")
300
+ if "trigger" in params and not isinstance(params["trigger"], str):
301
+ raise InvalidParameterError("Bad parameter: trigger must be an str")
302
+ if "trigger_file" in params and not isinstance(
303
+ params["trigger_file"], str
304
+ ):
305
+ raise InvalidParameterError(
306
+ "Bad parameter: trigger_file must be an str"
307
+ )
308
+ if "recurring_day" in params and not isinstance(
309
+ params["recurring_day"], int
310
+ ):
311
+ raise InvalidParameterError(
312
+ "Bad parameter: recurring_day must be an int"
313
+ )
314
+ if "schedule_time_zone" in params and not isinstance(
315
+ params["schedule_time_zone"], str
316
+ ):
317
+ raise InvalidParameterError(
318
+ "Bad parameter: schedule_time_zone must be an str"
319
+ )
320
+ if "schedule_days_of_week" in params and not isinstance(
321
+ params["schedule_days_of_week"], builtins.list
322
+ ):
323
+ raise InvalidParameterError(
324
+ "Bad parameter: schedule_days_of_week must be an list"
325
+ )
326
+ if "schedule_times_of_day" in params and not isinstance(
327
+ params["schedule_times_of_day"], builtins.list
328
+ ):
329
+ raise InvalidParameterError(
330
+ "Bad parameter: schedule_times_of_day must be an list"
331
+ )
332
+ response, options = Api.send_request("POST", "/syncs", params, options)
333
+ return Sync(response.data, options)
334
+
335
+
336
+ def create_migrate_to(params=None, options=None):
337
+ if not isinstance(params, dict):
338
+ params = {}
339
+ if not isinstance(options, dict):
340
+ options = {}
341
+ Api.send_request("POST", "/syncs/migrate_to_syncs", params, options)
342
+
343
+
344
+ # Parameters:
345
+ # name - string - Name for this sync job
346
+ # description - string - Description for this sync job
347
+ # src_path - string - Absolute source path
348
+ # dest_path - string - Absolute destination path
349
+ # src_remote_server_id - int64 - Remote server ID for the source
350
+ # dest_remote_server_id - int64 - Remote server ID for the destination
351
+ # two_way - boolean - Is this a two-way sync?
352
+ # keep_after_copy - boolean - Keep files after copying?
353
+ # delete_empty_folders - boolean - Delete empty folders after sync?
354
+ # disabled - boolean - Is this sync disabled?
355
+ # interval - int64 - Interval in minutes for sync (if scheduled)
356
+ # trigger - string - Trigger type: daily, custom_schedule, or manual
357
+ # trigger_file - string - Some MFT services request an empty file (known as a trigger file) to signal the sync is complete and they can begin further processing. If trigger_file is set, a zero-byte file will be sent at the end of the sync.
358
+ # recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
359
+ # schedule_time_zone - string - If trigger is `custom_schedule`, Custom schedule Time Zone for when the sync should be run.
360
+ # schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. 0-based days of the week. 0 is Sunday, 1 is Monday, etc.
361
+ # schedule_times_of_day - array(string) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. Times of day in HH:MM format.
362
+ def update(id, params=None, options=None):
363
+ if not isinstance(params, dict):
364
+ params = {}
365
+ if not isinstance(options, dict):
366
+ options = {}
367
+ params["id"] = id
368
+ if "id" in params and not isinstance(params["id"], int):
369
+ raise InvalidParameterError("Bad parameter: id must be an int")
370
+ if "name" in params and not isinstance(params["name"], str):
371
+ raise InvalidParameterError("Bad parameter: name must be an str")
372
+ if "description" in params and not isinstance(params["description"], str):
373
+ raise InvalidParameterError(
374
+ "Bad parameter: description must be an str"
375
+ )
376
+ if "src_path" in params and not isinstance(params["src_path"], str):
377
+ raise InvalidParameterError("Bad parameter: src_path must be an str")
378
+ if "dest_path" in params and not isinstance(params["dest_path"], str):
379
+ raise InvalidParameterError("Bad parameter: dest_path must be an str")
380
+ if "src_remote_server_id" in params and not isinstance(
381
+ params["src_remote_server_id"], int
382
+ ):
383
+ raise InvalidParameterError(
384
+ "Bad parameter: src_remote_server_id must be an int"
385
+ )
386
+ if "dest_remote_server_id" in params and not isinstance(
387
+ params["dest_remote_server_id"], int
388
+ ):
389
+ raise InvalidParameterError(
390
+ "Bad parameter: dest_remote_server_id must be an int"
391
+ )
392
+ if "two_way" in params and not isinstance(params["two_way"], bool):
393
+ raise InvalidParameterError("Bad parameter: two_way must be an bool")
394
+ if "keep_after_copy" in params and not isinstance(
395
+ params["keep_after_copy"], bool
396
+ ):
397
+ raise InvalidParameterError(
398
+ "Bad parameter: keep_after_copy must be an bool"
399
+ )
400
+ if "delete_empty_folders" in params and not isinstance(
401
+ params["delete_empty_folders"], bool
402
+ ):
403
+ raise InvalidParameterError(
404
+ "Bad parameter: delete_empty_folders must be an bool"
405
+ )
406
+ if "disabled" in params and not isinstance(params["disabled"], bool):
407
+ raise InvalidParameterError("Bad parameter: disabled must be an bool")
408
+ if "interval" in params and not isinstance(params["interval"], int):
409
+ raise InvalidParameterError("Bad parameter: interval must be an int")
410
+ if "trigger" in params and not isinstance(params["trigger"], str):
411
+ raise InvalidParameterError("Bad parameter: trigger must be an str")
412
+ if "trigger_file" in params and not isinstance(
413
+ params["trigger_file"], str
414
+ ):
415
+ raise InvalidParameterError(
416
+ "Bad parameter: trigger_file must be an str"
417
+ )
418
+ if "recurring_day" in params and not isinstance(
419
+ params["recurring_day"], int
420
+ ):
421
+ raise InvalidParameterError(
422
+ "Bad parameter: recurring_day must be an int"
423
+ )
424
+ if "schedule_time_zone" in params and not isinstance(
425
+ params["schedule_time_zone"], str
426
+ ):
427
+ raise InvalidParameterError(
428
+ "Bad parameter: schedule_time_zone must be an str"
429
+ )
430
+ if "schedule_days_of_week" in params and not isinstance(
431
+ params["schedule_days_of_week"], builtins.list
432
+ ):
433
+ raise InvalidParameterError(
434
+ "Bad parameter: schedule_days_of_week must be an list"
435
+ )
436
+ if "schedule_times_of_day" in params and not isinstance(
437
+ params["schedule_times_of_day"], builtins.list
438
+ ):
439
+ raise InvalidParameterError(
440
+ "Bad parameter: schedule_times_of_day must be an list"
441
+ )
442
+ if "id" not in params:
443
+ raise MissingParameterError("Parameter missing: id")
444
+ response, options = Api.send_request(
445
+ "PATCH", "/syncs/{id}".format(id=params["id"]), params, options
446
+ )
447
+ return Sync(response.data, options)
448
+
449
+
450
+ def delete(id, params=None, options=None):
451
+ if not isinstance(params, dict):
452
+ params = {}
453
+ if not isinstance(options, dict):
454
+ options = {}
455
+ params["id"] = id
456
+ if "id" in params and not isinstance(params["id"], int):
457
+ raise InvalidParameterError("Bad parameter: id must be an int")
458
+ if "id" not in params:
459
+ raise MissingParameterError("Parameter missing: id")
460
+ Api.send_request(
461
+ "DELETE", "/syncs/{id}".format(id=params["id"]), params, options
462
+ )
463
+
464
+
465
+ def destroy(id, params=None, options=None):
466
+ delete(id, params, options)
467
+
468
+
469
+ def new(*args, **kwargs):
470
+ return Sync(*args, **kwargs)
@@ -0,0 +1,110 @@
1
+ import builtins # noqa: F401
2
+ from files_sdk.api import Api # noqa: F401
3
+ from files_sdk.list_obj import ListObj
4
+ from files_sdk.error import ( # noqa: F401
5
+ InvalidParameterError,
6
+ MissingParameterError,
7
+ NotImplementedError,
8
+ )
9
+
10
+
11
+ class SyncRun:
12
+ default_attributes = {
13
+ "id": None, # int64 - SyncRun ID
14
+ "sync_id": None, # int64 - ID of the Sync this run belongs to
15
+ "site_id": None, # int64 - Site ID
16
+ "status": None, # string - Status of the sync run (success, failure, partial_failure, in_progress, skipped)
17
+ "remote_server_type": None, # string - Type of remote server used, if any
18
+ "body": None, # string - Log or summary body for this run
19
+ "event_errors": None, # array(array) - Array of errors encountered during the run
20
+ "bytes_synced": None, # int64 - Total bytes synced in this run
21
+ "compared_files": None, # int64 - Number of files compared
22
+ "compared_folders": None, # int64 - Number of folders compared
23
+ "errored_files": None, # int64 - Number of files that errored
24
+ "successful_files": None, # int64 - Number of files successfully synced
25
+ "runtime": None, # float - Total runtime in seconds
26
+ "s3_body_path": None, # string - S3 path to the main log file
27
+ "s3_internal_body_path": None, # string - S3 path to the internal log file
28
+ "completed_at": None, # date-time - When this run was completed
29
+ "notified": None, # boolean - Whether notifications were sent for this run
30
+ "created_at": None, # date-time - When this run was created
31
+ "updated_at": None, # date-time - When this run was last updated
32
+ }
33
+
34
+ def __init__(self, attributes=None, options=None):
35
+ if not isinstance(attributes, dict):
36
+ attributes = {}
37
+ if not isinstance(options, dict):
38
+ options = {}
39
+ self.set_attributes(attributes)
40
+ self.options = options
41
+
42
+ def set_attributes(self, attributes):
43
+ for attribute, default_value in SyncRun.default_attributes.items():
44
+ setattr(self, attribute, attributes.get(attribute, default_value))
45
+
46
+ def get_attributes(self):
47
+ return {
48
+ k: getattr(self, k, None)
49
+ for k in SyncRun.default_attributes
50
+ if getattr(self, k, None) is not None
51
+ }
52
+
53
+
54
+ # Parameters:
55
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
56
+ # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
57
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
58
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `sync_id`, `created_at` or `status`.
59
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `status` and `sync_id`. Valid field combinations are `[ sync_id, status ]`.
60
+ # sync_id (required) - int64 - ID of the Sync this run belongs to
61
+ def list(params=None, options=None):
62
+ if not isinstance(params, dict):
63
+ params = {}
64
+ if not isinstance(options, dict):
65
+ options = {}
66
+ if "user_id" in params and not isinstance(params["user_id"], int):
67
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
68
+ if "cursor" in params and not isinstance(params["cursor"], str):
69
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
70
+ if "per_page" in params and not isinstance(params["per_page"], int):
71
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
72
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
73
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
74
+ if "filter" in params and not isinstance(params["filter"], dict):
75
+ raise InvalidParameterError("Bad parameter: filter must be an dict")
76
+ if "sync_id" in params and not isinstance(params["sync_id"], int):
77
+ raise InvalidParameterError("Bad parameter: sync_id must be an int")
78
+ if "sync_id" not in params:
79
+ raise MissingParameterError("Parameter missing: sync_id")
80
+ return ListObj(SyncRun, "GET", "/sync_runs", params, options)
81
+
82
+
83
+ def all(params=None, options=None):
84
+ list(params, options)
85
+
86
+
87
+ # Parameters:
88
+ # id (required) - int64 - Sync Run ID.
89
+ def find(id, params=None, options=None):
90
+ if not isinstance(params, dict):
91
+ params = {}
92
+ if not isinstance(options, dict):
93
+ options = {}
94
+ params["id"] = id
95
+ if "id" in params and not isinstance(params["id"], int):
96
+ raise InvalidParameterError("Bad parameter: id must be an int")
97
+ if "id" not in params:
98
+ raise MissingParameterError("Parameter missing: id")
99
+ response, options = Api.send_request(
100
+ "GET", "/sync_runs/{id}".format(id=params["id"]), params, options
101
+ )
102
+ return SyncRun(response.data, options)
103
+
104
+
105
+ def get(id, params=None, options=None):
106
+ find(id, params, options)
107
+
108
+
109
+ def new(*args, **kwargs):
110
+ return SyncRun(*args, **kwargs)