files-com 1.6.7__py3-none-any.whl → 1.6.113__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.
- README.md +80 -18
- _VERSION +1 -1
- {files_com-1.6.7.dist-info → files_com-1.6.113.dist-info}/METADATA +81 -19
- {files_com-1.6.7.dist-info → files_com-1.6.113.dist-info}/RECORD +53 -46
- files_sdk/__init__.py +17 -1
- files_sdk/error.py +98 -23
- files_sdk/models/__init__.py +9 -0
- files_sdk/models/api_key.py +10 -0
- files_sdk/models/api_request_log.py +21 -3
- files_sdk/models/as2_partner.py +31 -9
- files_sdk/models/as2_station.py +1 -1
- files_sdk/models/automation.py +65 -5
- files_sdk/models/automation_log.py +20 -3
- files_sdk/models/behavior.py +2 -16
- files_sdk/models/bundle.py +1 -1
- files_sdk/models/bundle_action.py +5 -1
- files_sdk/models/bundle_registration.py +1 -1
- files_sdk/models/child_site_management_policy.py +278 -0
- files_sdk/models/email_log.py +17 -7
- files_sdk/models/exavault_api_request_log.py +20 -3
- files_sdk/models/file.py +8 -0
- files_sdk/models/file_migration_log.py +17 -7
- files_sdk/models/folder.py +11 -1
- files_sdk/models/ftp_action_log.py +20 -3
- files_sdk/models/gpg_key.py +61 -9
- files_sdk/models/history_export.py +4 -4
- files_sdk/models/history_export_result.py +2 -2
- files_sdk/models/holiday_region.py +58 -0
- files_sdk/models/inbox_registration.py +1 -1
- files_sdk/models/invoice_line_item.py +5 -0
- files_sdk/models/outbound_connection_log.py +20 -3
- files_sdk/models/partner.py +296 -0
- files_sdk/models/permission.py +10 -2
- files_sdk/models/public_hosting_request_log.py +27 -8
- files_sdk/models/public_key.py +59 -3
- files_sdk/models/remote_mount_backend.py +438 -0
- files_sdk/models/remote_server.py +19 -91
- files_sdk/models/remote_server_configuration_file.py +1 -0
- files_sdk/models/scim_log.py +88 -0
- files_sdk/models/sftp_action_log.py +20 -3
- files_sdk/models/siem_http_destination.py +98 -19
- files_sdk/models/site.py +37 -31
- files_sdk/models/sso_strategy.py +2 -1
- files_sdk/models/sync.py +574 -0
- files_sdk/models/sync_log.py +19 -8
- files_sdk/models/sync_run.py +123 -0
- files_sdk/models/user.py +105 -12
- files_sdk/models/user_cipher_use.py +24 -1
- files_sdk/models/user_lifecycle_rule.py +94 -39
- files_sdk/models/web_dav_action_log.py +20 -3
- {files_com-1.6.7.dist-info → files_com-1.6.113.dist-info}/WHEEL +0 -0
- {files_com-1.6.7.dist-info → files_com-1.6.113.dist-info}/licenses/LICENSE +0 -0
- {files_com-1.6.7.dist-info → files_com-1.6.113.dist-info}/top_level.txt +0 -0
files_sdk/models/sync.py
ADDED
|
@@ -0,0 +1,574 @@
|
|
|
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
|
+
"trigger": None, # string - Trigger type: daily, custom_schedule, or manual
|
|
27
|
+
"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.
|
|
28
|
+
"include_patterns": None, # array(string) - Array of glob patterns to include
|
|
29
|
+
"exclude_patterns": None, # array(string) - Array of glob patterns to exclude
|
|
30
|
+
"created_at": None, # date-time - When this sync was created
|
|
31
|
+
"updated_at": None, # date-time - When this sync was last updated
|
|
32
|
+
"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.
|
|
33
|
+
"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`
|
|
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
|
+
"holiday_region": None, # string - If trigger is `custom_schedule`, the sync will check if there is a formal, observed holiday for the region, and if so, it will not run.
|
|
39
|
+
"latest_sync_run": None, # SyncRun - The latest run of this sync
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
def __init__(self, attributes=None, options=None):
|
|
43
|
+
if not isinstance(attributes, dict):
|
|
44
|
+
attributes = {}
|
|
45
|
+
if not isinstance(options, dict):
|
|
46
|
+
options = {}
|
|
47
|
+
self.set_attributes(attributes)
|
|
48
|
+
self.options = options
|
|
49
|
+
|
|
50
|
+
def set_attributes(self, attributes):
|
|
51
|
+
for attribute, default_value in Sync.default_attributes.items():
|
|
52
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
53
|
+
|
|
54
|
+
def get_attributes(self):
|
|
55
|
+
return {
|
|
56
|
+
k: getattr(self, k, None)
|
|
57
|
+
for k in Sync.default_attributes
|
|
58
|
+
if getattr(self, k, None) is not None
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# Dry Run Sync
|
|
62
|
+
def dry_run(self, params=None):
|
|
63
|
+
if not isinstance(params, dict):
|
|
64
|
+
params = {}
|
|
65
|
+
|
|
66
|
+
if hasattr(self, "id") and self.id:
|
|
67
|
+
params["id"] = self.id
|
|
68
|
+
else:
|
|
69
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
70
|
+
if "id" not in params:
|
|
71
|
+
raise MissingParameterError("Parameter missing: id")
|
|
72
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
73
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
74
|
+
Api.send_request(
|
|
75
|
+
"POST",
|
|
76
|
+
"/syncs/{id}/dry_run".format(id=params["id"]),
|
|
77
|
+
params,
|
|
78
|
+
self.options,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
# Manually Run Sync
|
|
82
|
+
def manual_run(self, params=None):
|
|
83
|
+
if not isinstance(params, dict):
|
|
84
|
+
params = {}
|
|
85
|
+
|
|
86
|
+
if hasattr(self, "id") and self.id:
|
|
87
|
+
params["id"] = self.id
|
|
88
|
+
else:
|
|
89
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
90
|
+
if "id" not in params:
|
|
91
|
+
raise MissingParameterError("Parameter missing: id")
|
|
92
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
93
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
94
|
+
Api.send_request(
|
|
95
|
+
"POST",
|
|
96
|
+
"/syncs/{id}/manual_run".format(id=params["id"]),
|
|
97
|
+
params,
|
|
98
|
+
self.options,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Parameters:
|
|
102
|
+
# name - string - Name for this sync job
|
|
103
|
+
# description - string - Description for this sync job
|
|
104
|
+
# src_path - string - Absolute source path
|
|
105
|
+
# dest_path - string - Absolute destination path
|
|
106
|
+
# src_remote_server_id - int64 - Remote server ID for the source
|
|
107
|
+
# dest_remote_server_id - int64 - Remote server ID for the destination
|
|
108
|
+
# keep_after_copy - boolean - Keep files after copying?
|
|
109
|
+
# delete_empty_folders - boolean - Delete empty folders after sync?
|
|
110
|
+
# disabled - boolean - Is this sync disabled?
|
|
111
|
+
# interval - 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`
|
|
112
|
+
# trigger - string - Trigger type: daily, custom_schedule, or manual
|
|
113
|
+
# 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.
|
|
114
|
+
# holiday_region - string - If trigger is `custom_schedule`, the sync will check if there is a formal, observed holiday for the region, and if so, it will not run.
|
|
115
|
+
# sync_interval_minutes - 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.
|
|
116
|
+
# 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`.
|
|
117
|
+
# schedule_time_zone - string - If trigger is `custom_schedule`, Custom schedule Time Zone for when the sync should be run.
|
|
118
|
+
# 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.
|
|
119
|
+
# 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.
|
|
120
|
+
def update(self, params=None):
|
|
121
|
+
if not isinstance(params, dict):
|
|
122
|
+
params = {}
|
|
123
|
+
|
|
124
|
+
if hasattr(self, "id") and self.id:
|
|
125
|
+
params["id"] = self.id
|
|
126
|
+
else:
|
|
127
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
128
|
+
if "id" not in params:
|
|
129
|
+
raise MissingParameterError("Parameter missing: id")
|
|
130
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
131
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
132
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
133
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
134
|
+
if "description" in params and not isinstance(
|
|
135
|
+
params["description"], str
|
|
136
|
+
):
|
|
137
|
+
raise InvalidParameterError(
|
|
138
|
+
"Bad parameter: description must be an str"
|
|
139
|
+
)
|
|
140
|
+
if "src_path" in params and not isinstance(params["src_path"], str):
|
|
141
|
+
raise InvalidParameterError(
|
|
142
|
+
"Bad parameter: src_path must be an str"
|
|
143
|
+
)
|
|
144
|
+
if "dest_path" in params and not isinstance(params["dest_path"], str):
|
|
145
|
+
raise InvalidParameterError(
|
|
146
|
+
"Bad parameter: dest_path must be an str"
|
|
147
|
+
)
|
|
148
|
+
if "src_remote_server_id" in params and not isinstance(
|
|
149
|
+
params["src_remote_server_id"], int
|
|
150
|
+
):
|
|
151
|
+
raise InvalidParameterError(
|
|
152
|
+
"Bad parameter: src_remote_server_id must be an int"
|
|
153
|
+
)
|
|
154
|
+
if "dest_remote_server_id" in params and not isinstance(
|
|
155
|
+
params["dest_remote_server_id"], int
|
|
156
|
+
):
|
|
157
|
+
raise InvalidParameterError(
|
|
158
|
+
"Bad parameter: dest_remote_server_id must be an int"
|
|
159
|
+
)
|
|
160
|
+
if "interval" in params and not isinstance(params["interval"], str):
|
|
161
|
+
raise InvalidParameterError(
|
|
162
|
+
"Bad parameter: interval must be an str"
|
|
163
|
+
)
|
|
164
|
+
if "trigger" in params and not isinstance(params["trigger"], str):
|
|
165
|
+
raise InvalidParameterError(
|
|
166
|
+
"Bad parameter: trigger must be an str"
|
|
167
|
+
)
|
|
168
|
+
if "trigger_file" in params and not isinstance(
|
|
169
|
+
params["trigger_file"], str
|
|
170
|
+
):
|
|
171
|
+
raise InvalidParameterError(
|
|
172
|
+
"Bad parameter: trigger_file must be an str"
|
|
173
|
+
)
|
|
174
|
+
if "holiday_region" in params and not isinstance(
|
|
175
|
+
params["holiday_region"], str
|
|
176
|
+
):
|
|
177
|
+
raise InvalidParameterError(
|
|
178
|
+
"Bad parameter: holiday_region must be an str"
|
|
179
|
+
)
|
|
180
|
+
if "sync_interval_minutes" in params and not isinstance(
|
|
181
|
+
params["sync_interval_minutes"], int
|
|
182
|
+
):
|
|
183
|
+
raise InvalidParameterError(
|
|
184
|
+
"Bad parameter: sync_interval_minutes must be an int"
|
|
185
|
+
)
|
|
186
|
+
if "recurring_day" in params and not isinstance(
|
|
187
|
+
params["recurring_day"], int
|
|
188
|
+
):
|
|
189
|
+
raise InvalidParameterError(
|
|
190
|
+
"Bad parameter: recurring_day must be an int"
|
|
191
|
+
)
|
|
192
|
+
if "schedule_time_zone" in params and not isinstance(
|
|
193
|
+
params["schedule_time_zone"], str
|
|
194
|
+
):
|
|
195
|
+
raise InvalidParameterError(
|
|
196
|
+
"Bad parameter: schedule_time_zone must be an str"
|
|
197
|
+
)
|
|
198
|
+
if "schedule_days_of_week" in params and not isinstance(
|
|
199
|
+
params["schedule_days_of_week"], builtins.list
|
|
200
|
+
):
|
|
201
|
+
raise InvalidParameterError(
|
|
202
|
+
"Bad parameter: schedule_days_of_week must be an list"
|
|
203
|
+
)
|
|
204
|
+
if "schedule_times_of_day" in params and not isinstance(
|
|
205
|
+
params["schedule_times_of_day"], builtins.list
|
|
206
|
+
):
|
|
207
|
+
raise InvalidParameterError(
|
|
208
|
+
"Bad parameter: schedule_times_of_day must be an list"
|
|
209
|
+
)
|
|
210
|
+
response, _options = Api.send_request(
|
|
211
|
+
"PATCH",
|
|
212
|
+
"/syncs/{id}".format(id=params["id"]),
|
|
213
|
+
params,
|
|
214
|
+
self.options,
|
|
215
|
+
)
|
|
216
|
+
return response.data
|
|
217
|
+
|
|
218
|
+
def delete(self, params=None):
|
|
219
|
+
if not isinstance(params, dict):
|
|
220
|
+
params = {}
|
|
221
|
+
|
|
222
|
+
if hasattr(self, "id") and self.id:
|
|
223
|
+
params["id"] = self.id
|
|
224
|
+
else:
|
|
225
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
226
|
+
if "id" not in params:
|
|
227
|
+
raise MissingParameterError("Parameter missing: id")
|
|
228
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
229
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
230
|
+
Api.send_request(
|
|
231
|
+
"DELETE",
|
|
232
|
+
"/syncs/{id}".format(id=params["id"]),
|
|
233
|
+
params,
|
|
234
|
+
self.options,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
def destroy(self, params=None):
|
|
238
|
+
self.delete(params)
|
|
239
|
+
|
|
240
|
+
def save(self):
|
|
241
|
+
if hasattr(self, "id") and self.id:
|
|
242
|
+
new_obj = self.update(self.get_attributes())
|
|
243
|
+
self.set_attributes(new_obj.get_attributes())
|
|
244
|
+
return True
|
|
245
|
+
else:
|
|
246
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
247
|
+
self.set_attributes(new_obj.get_attributes())
|
|
248
|
+
return True
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
# Parameters:
|
|
252
|
+
# 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.
|
|
253
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
254
|
+
def list(params=None, options=None):
|
|
255
|
+
if not isinstance(params, dict):
|
|
256
|
+
params = {}
|
|
257
|
+
if not isinstance(options, dict):
|
|
258
|
+
options = {}
|
|
259
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
260
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
261
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
262
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
263
|
+
return ListObj(Sync, "GET", "/syncs", params, options)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def all(params=None, options=None):
|
|
267
|
+
list(params, options)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
# Parameters:
|
|
271
|
+
# id (required) - int64 - Sync ID.
|
|
272
|
+
def find(id, params=None, options=None):
|
|
273
|
+
if not isinstance(params, dict):
|
|
274
|
+
params = {}
|
|
275
|
+
if not isinstance(options, dict):
|
|
276
|
+
options = {}
|
|
277
|
+
params["id"] = id
|
|
278
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
279
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
280
|
+
if "id" not in params:
|
|
281
|
+
raise MissingParameterError("Parameter missing: id")
|
|
282
|
+
response, options = Api.send_request(
|
|
283
|
+
"GET", "/syncs/{id}".format(id=params["id"]), params, options
|
|
284
|
+
)
|
|
285
|
+
return Sync(response.data, options)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def get(id, params=None, options=None):
|
|
289
|
+
find(id, params, options)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
# Parameters:
|
|
293
|
+
# name - string - Name for this sync job
|
|
294
|
+
# description - string - Description for this sync job
|
|
295
|
+
# src_path - string - Absolute source path
|
|
296
|
+
# dest_path - string - Absolute destination path
|
|
297
|
+
# src_remote_server_id - int64 - Remote server ID for the source
|
|
298
|
+
# dest_remote_server_id - int64 - Remote server ID for the destination
|
|
299
|
+
# keep_after_copy - boolean - Keep files after copying?
|
|
300
|
+
# delete_empty_folders - boolean - Delete empty folders after sync?
|
|
301
|
+
# disabled - boolean - Is this sync disabled?
|
|
302
|
+
# interval - 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`
|
|
303
|
+
# trigger - string - Trigger type: daily, custom_schedule, or manual
|
|
304
|
+
# 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.
|
|
305
|
+
# holiday_region - string - If trigger is `custom_schedule`, the sync will check if there is a formal, observed holiday for the region, and if so, it will not run.
|
|
306
|
+
# sync_interval_minutes - 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.
|
|
307
|
+
# 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`.
|
|
308
|
+
# schedule_time_zone - string - If trigger is `custom_schedule`, Custom schedule Time Zone for when the sync should be run.
|
|
309
|
+
# 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.
|
|
310
|
+
# 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.
|
|
311
|
+
def create(params=None, options=None):
|
|
312
|
+
if not isinstance(params, dict):
|
|
313
|
+
params = {}
|
|
314
|
+
if not isinstance(options, dict):
|
|
315
|
+
options = {}
|
|
316
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
317
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
318
|
+
if "description" in params and not isinstance(params["description"], str):
|
|
319
|
+
raise InvalidParameterError(
|
|
320
|
+
"Bad parameter: description must be an str"
|
|
321
|
+
)
|
|
322
|
+
if "src_path" in params and not isinstance(params["src_path"], str):
|
|
323
|
+
raise InvalidParameterError("Bad parameter: src_path must be an str")
|
|
324
|
+
if "dest_path" in params and not isinstance(params["dest_path"], str):
|
|
325
|
+
raise InvalidParameterError("Bad parameter: dest_path must be an str")
|
|
326
|
+
if "src_remote_server_id" in params and not isinstance(
|
|
327
|
+
params["src_remote_server_id"], int
|
|
328
|
+
):
|
|
329
|
+
raise InvalidParameterError(
|
|
330
|
+
"Bad parameter: src_remote_server_id must be an int"
|
|
331
|
+
)
|
|
332
|
+
if "dest_remote_server_id" in params and not isinstance(
|
|
333
|
+
params["dest_remote_server_id"], int
|
|
334
|
+
):
|
|
335
|
+
raise InvalidParameterError(
|
|
336
|
+
"Bad parameter: dest_remote_server_id must be an int"
|
|
337
|
+
)
|
|
338
|
+
if "keep_after_copy" in params and not isinstance(
|
|
339
|
+
params["keep_after_copy"], bool
|
|
340
|
+
):
|
|
341
|
+
raise InvalidParameterError(
|
|
342
|
+
"Bad parameter: keep_after_copy must be an bool"
|
|
343
|
+
)
|
|
344
|
+
if "delete_empty_folders" in params and not isinstance(
|
|
345
|
+
params["delete_empty_folders"], bool
|
|
346
|
+
):
|
|
347
|
+
raise InvalidParameterError(
|
|
348
|
+
"Bad parameter: delete_empty_folders must be an bool"
|
|
349
|
+
)
|
|
350
|
+
if "disabled" in params and not isinstance(params["disabled"], bool):
|
|
351
|
+
raise InvalidParameterError("Bad parameter: disabled must be an bool")
|
|
352
|
+
if "interval" in params and not isinstance(params["interval"], str):
|
|
353
|
+
raise InvalidParameterError("Bad parameter: interval must be an str")
|
|
354
|
+
if "trigger" in params and not isinstance(params["trigger"], str):
|
|
355
|
+
raise InvalidParameterError("Bad parameter: trigger must be an str")
|
|
356
|
+
if "trigger_file" in params and not isinstance(
|
|
357
|
+
params["trigger_file"], str
|
|
358
|
+
):
|
|
359
|
+
raise InvalidParameterError(
|
|
360
|
+
"Bad parameter: trigger_file must be an str"
|
|
361
|
+
)
|
|
362
|
+
if "holiday_region" in params and not isinstance(
|
|
363
|
+
params["holiday_region"], str
|
|
364
|
+
):
|
|
365
|
+
raise InvalidParameterError(
|
|
366
|
+
"Bad parameter: holiday_region must be an str"
|
|
367
|
+
)
|
|
368
|
+
if "sync_interval_minutes" in params and not isinstance(
|
|
369
|
+
params["sync_interval_minutes"], int
|
|
370
|
+
):
|
|
371
|
+
raise InvalidParameterError(
|
|
372
|
+
"Bad parameter: sync_interval_minutes must be an int"
|
|
373
|
+
)
|
|
374
|
+
if "recurring_day" in params and not isinstance(
|
|
375
|
+
params["recurring_day"], int
|
|
376
|
+
):
|
|
377
|
+
raise InvalidParameterError(
|
|
378
|
+
"Bad parameter: recurring_day must be an int"
|
|
379
|
+
)
|
|
380
|
+
if "schedule_time_zone" in params and not isinstance(
|
|
381
|
+
params["schedule_time_zone"], str
|
|
382
|
+
):
|
|
383
|
+
raise InvalidParameterError(
|
|
384
|
+
"Bad parameter: schedule_time_zone must be an str"
|
|
385
|
+
)
|
|
386
|
+
if "schedule_days_of_week" in params and not isinstance(
|
|
387
|
+
params["schedule_days_of_week"], builtins.list
|
|
388
|
+
):
|
|
389
|
+
raise InvalidParameterError(
|
|
390
|
+
"Bad parameter: schedule_days_of_week must be an list"
|
|
391
|
+
)
|
|
392
|
+
if "schedule_times_of_day" in params and not isinstance(
|
|
393
|
+
params["schedule_times_of_day"], builtins.list
|
|
394
|
+
):
|
|
395
|
+
raise InvalidParameterError(
|
|
396
|
+
"Bad parameter: schedule_times_of_day must be an list"
|
|
397
|
+
)
|
|
398
|
+
response, options = Api.send_request("POST", "/syncs", params, options)
|
|
399
|
+
return Sync(response.data, options)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
# Dry Run Sync
|
|
403
|
+
def dry_run(id, params=None, options=None):
|
|
404
|
+
if not isinstance(params, dict):
|
|
405
|
+
params = {}
|
|
406
|
+
if not isinstance(options, dict):
|
|
407
|
+
options = {}
|
|
408
|
+
params["id"] = id
|
|
409
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
410
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
411
|
+
if "id" not in params:
|
|
412
|
+
raise MissingParameterError("Parameter missing: id")
|
|
413
|
+
Api.send_request(
|
|
414
|
+
"POST", "/syncs/{id}/dry_run".format(id=params["id"]), params, options
|
|
415
|
+
)
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
# Manually Run Sync
|
|
419
|
+
def manual_run(id, params=None, options=None):
|
|
420
|
+
if not isinstance(params, dict):
|
|
421
|
+
params = {}
|
|
422
|
+
if not isinstance(options, dict):
|
|
423
|
+
options = {}
|
|
424
|
+
params["id"] = id
|
|
425
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
426
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
427
|
+
if "id" not in params:
|
|
428
|
+
raise MissingParameterError("Parameter missing: id")
|
|
429
|
+
Api.send_request(
|
|
430
|
+
"POST",
|
|
431
|
+
"/syncs/{id}/manual_run".format(id=params["id"]),
|
|
432
|
+
params,
|
|
433
|
+
options,
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
# Parameters:
|
|
438
|
+
# name - string - Name for this sync job
|
|
439
|
+
# description - string - Description for this sync job
|
|
440
|
+
# src_path - string - Absolute source path
|
|
441
|
+
# dest_path - string - Absolute destination path
|
|
442
|
+
# src_remote_server_id - int64 - Remote server ID for the source
|
|
443
|
+
# dest_remote_server_id - int64 - Remote server ID for the destination
|
|
444
|
+
# keep_after_copy - boolean - Keep files after copying?
|
|
445
|
+
# delete_empty_folders - boolean - Delete empty folders after sync?
|
|
446
|
+
# disabled - boolean - Is this sync disabled?
|
|
447
|
+
# interval - 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`
|
|
448
|
+
# trigger - string - Trigger type: daily, custom_schedule, or manual
|
|
449
|
+
# 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.
|
|
450
|
+
# holiday_region - string - If trigger is `custom_schedule`, the sync will check if there is a formal, observed holiday for the region, and if so, it will not run.
|
|
451
|
+
# sync_interval_minutes - 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.
|
|
452
|
+
# 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`.
|
|
453
|
+
# schedule_time_zone - string - If trigger is `custom_schedule`, Custom schedule Time Zone for when the sync should be run.
|
|
454
|
+
# 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.
|
|
455
|
+
# 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.
|
|
456
|
+
def update(id, params=None, options=None):
|
|
457
|
+
if not isinstance(params, dict):
|
|
458
|
+
params = {}
|
|
459
|
+
if not isinstance(options, dict):
|
|
460
|
+
options = {}
|
|
461
|
+
params["id"] = id
|
|
462
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
463
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
464
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
465
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
466
|
+
if "description" in params and not isinstance(params["description"], str):
|
|
467
|
+
raise InvalidParameterError(
|
|
468
|
+
"Bad parameter: description must be an str"
|
|
469
|
+
)
|
|
470
|
+
if "src_path" in params and not isinstance(params["src_path"], str):
|
|
471
|
+
raise InvalidParameterError("Bad parameter: src_path must be an str")
|
|
472
|
+
if "dest_path" in params and not isinstance(params["dest_path"], str):
|
|
473
|
+
raise InvalidParameterError("Bad parameter: dest_path must be an str")
|
|
474
|
+
if "src_remote_server_id" in params and not isinstance(
|
|
475
|
+
params["src_remote_server_id"], int
|
|
476
|
+
):
|
|
477
|
+
raise InvalidParameterError(
|
|
478
|
+
"Bad parameter: src_remote_server_id must be an int"
|
|
479
|
+
)
|
|
480
|
+
if "dest_remote_server_id" in params and not isinstance(
|
|
481
|
+
params["dest_remote_server_id"], int
|
|
482
|
+
):
|
|
483
|
+
raise InvalidParameterError(
|
|
484
|
+
"Bad parameter: dest_remote_server_id must be an int"
|
|
485
|
+
)
|
|
486
|
+
if "keep_after_copy" in params and not isinstance(
|
|
487
|
+
params["keep_after_copy"], bool
|
|
488
|
+
):
|
|
489
|
+
raise InvalidParameterError(
|
|
490
|
+
"Bad parameter: keep_after_copy must be an bool"
|
|
491
|
+
)
|
|
492
|
+
if "delete_empty_folders" in params and not isinstance(
|
|
493
|
+
params["delete_empty_folders"], bool
|
|
494
|
+
):
|
|
495
|
+
raise InvalidParameterError(
|
|
496
|
+
"Bad parameter: delete_empty_folders must be an bool"
|
|
497
|
+
)
|
|
498
|
+
if "disabled" in params and not isinstance(params["disabled"], bool):
|
|
499
|
+
raise InvalidParameterError("Bad parameter: disabled must be an bool")
|
|
500
|
+
if "interval" in params and not isinstance(params["interval"], str):
|
|
501
|
+
raise InvalidParameterError("Bad parameter: interval must be an str")
|
|
502
|
+
if "trigger" in params and not isinstance(params["trigger"], str):
|
|
503
|
+
raise InvalidParameterError("Bad parameter: trigger must be an str")
|
|
504
|
+
if "trigger_file" in params and not isinstance(
|
|
505
|
+
params["trigger_file"], str
|
|
506
|
+
):
|
|
507
|
+
raise InvalidParameterError(
|
|
508
|
+
"Bad parameter: trigger_file must be an str"
|
|
509
|
+
)
|
|
510
|
+
if "holiday_region" in params and not isinstance(
|
|
511
|
+
params["holiday_region"], str
|
|
512
|
+
):
|
|
513
|
+
raise InvalidParameterError(
|
|
514
|
+
"Bad parameter: holiday_region must be an str"
|
|
515
|
+
)
|
|
516
|
+
if "sync_interval_minutes" in params and not isinstance(
|
|
517
|
+
params["sync_interval_minutes"], int
|
|
518
|
+
):
|
|
519
|
+
raise InvalidParameterError(
|
|
520
|
+
"Bad parameter: sync_interval_minutes must be an int"
|
|
521
|
+
)
|
|
522
|
+
if "recurring_day" in params and not isinstance(
|
|
523
|
+
params["recurring_day"], int
|
|
524
|
+
):
|
|
525
|
+
raise InvalidParameterError(
|
|
526
|
+
"Bad parameter: recurring_day must be an int"
|
|
527
|
+
)
|
|
528
|
+
if "schedule_time_zone" in params and not isinstance(
|
|
529
|
+
params["schedule_time_zone"], str
|
|
530
|
+
):
|
|
531
|
+
raise InvalidParameterError(
|
|
532
|
+
"Bad parameter: schedule_time_zone must be an str"
|
|
533
|
+
)
|
|
534
|
+
if "schedule_days_of_week" in params and not isinstance(
|
|
535
|
+
params["schedule_days_of_week"], builtins.list
|
|
536
|
+
):
|
|
537
|
+
raise InvalidParameterError(
|
|
538
|
+
"Bad parameter: schedule_days_of_week must be an list"
|
|
539
|
+
)
|
|
540
|
+
if "schedule_times_of_day" in params and not isinstance(
|
|
541
|
+
params["schedule_times_of_day"], builtins.list
|
|
542
|
+
):
|
|
543
|
+
raise InvalidParameterError(
|
|
544
|
+
"Bad parameter: schedule_times_of_day must be an list"
|
|
545
|
+
)
|
|
546
|
+
if "id" not in params:
|
|
547
|
+
raise MissingParameterError("Parameter missing: id")
|
|
548
|
+
response, options = Api.send_request(
|
|
549
|
+
"PATCH", "/syncs/{id}".format(id=params["id"]), params, options
|
|
550
|
+
)
|
|
551
|
+
return Sync(response.data, options)
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
def delete(id, params=None, options=None):
|
|
555
|
+
if not isinstance(params, dict):
|
|
556
|
+
params = {}
|
|
557
|
+
if not isinstance(options, dict):
|
|
558
|
+
options = {}
|
|
559
|
+
params["id"] = id
|
|
560
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
561
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
562
|
+
if "id" not in params:
|
|
563
|
+
raise MissingParameterError("Parameter missing: id")
|
|
564
|
+
Api.send_request(
|
|
565
|
+
"DELETE", "/syncs/{id}".format(id=params["id"]), params, options
|
|
566
|
+
)
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
def destroy(id, params=None, options=None):
|
|
570
|
+
delete(id, params, options)
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
def new(*args, **kwargs):
|
|
574
|
+
return Sync(*args, **kwargs)
|