files-com 1.6.208__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 +758 -0
- _VERSION +1 -0
- files_com-1.6.208.dist-info/METADATA +770 -0
- files_com-1.6.208.dist-info/RECORD +126 -0
- files_com-1.6.208.dist-info/WHEEL +5 -0
- files_com-1.6.208.dist-info/licenses/LICENSE +21 -0
- files_com-1.6.208.dist-info/top_level.txt +1 -0
- files_sdk/__init__.py +309 -0
- files_sdk/api.py +63 -0
- files_sdk/api_client.py +336 -0
- files_sdk/error.py +2981 -0
- files_sdk/list_obj.py +42 -0
- files_sdk/models/__init__.py +119 -0
- files_sdk/models/account_line_item.py +51 -0
- files_sdk/models/action.py +49 -0
- files_sdk/models/action_notification_export.py +153 -0
- files_sdk/models/action_notification_export_result.py +88 -0
- files_sdk/models/agent_push_update.py +44 -0
- files_sdk/models/api_key.py +318 -0
- files_sdk/models/api_request_log.py +105 -0
- files_sdk/models/app.py +89 -0
- files_sdk/models/as2_incoming_message.py +117 -0
- files_sdk/models/as2_outgoing_message.py +113 -0
- files_sdk/models/as2_partner.py +415 -0
- files_sdk/models/as2_station.py +282 -0
- files_sdk/models/auto.py +36 -0
- files_sdk/models/automation.py +823 -0
- files_sdk/models/automation_log.py +94 -0
- files_sdk/models/automation_run.py +112 -0
- files_sdk/models/bandwidth_snapshot.py +91 -0
- files_sdk/models/behavior.py +340 -0
- files_sdk/models/bundle.py +686 -0
- files_sdk/models/bundle_action.py +93 -0
- files_sdk/models/bundle_download.py +94 -0
- files_sdk/models/bundle_notification.py +252 -0
- files_sdk/models/bundle_path.py +37 -0
- files_sdk/models/bundle_recipient.py +133 -0
- files_sdk/models/bundle_registration.py +82 -0
- files_sdk/models/child_site_management_policy.py +278 -0
- files_sdk/models/clickwrap.py +268 -0
- files_sdk/models/dns_record.py +59 -0
- files_sdk/models/email_incoming_message.py +102 -0
- files_sdk/models/email_log.py +84 -0
- files_sdk/models/errors.py +37 -0
- files_sdk/models/exavault_api_request_log.py +102 -0
- files_sdk/models/external_event.py +148 -0
- files_sdk/models/file.py +851 -0
- files_sdk/models/file_action.py +39 -0
- files_sdk/models/file_comment.py +191 -0
- files_sdk/models/file_comment_reaction.py +125 -0
- files_sdk/models/file_migration.py +69 -0
- files_sdk/models/file_migration_log.py +88 -0
- files_sdk/models/file_upload_part.py +54 -0
- files_sdk/models/folder.py +186 -0
- files_sdk/models/form_field.py +43 -0
- files_sdk/models/form_field_set.py +265 -0
- files_sdk/models/ftp_action_log.py +104 -0
- files_sdk/models/gpg_key.py +333 -0
- files_sdk/models/group.py +338 -0
- files_sdk/models/group_user.py +235 -0
- files_sdk/models/history.py +236 -0
- files_sdk/models/history_export.py +238 -0
- files_sdk/models/history_export_result.py +98 -0
- files_sdk/models/holiday_region.py +58 -0
- files_sdk/models/image.py +37 -0
- files_sdk/models/inbound_s3_log.py +95 -0
- files_sdk/models/inbox_recipient.py +124 -0
- files_sdk/models/inbox_registration.py +79 -0
- files_sdk/models/inbox_upload.py +80 -0
- files_sdk/models/invoice.py +91 -0
- files_sdk/models/invoice_line_item.py +51 -0
- files_sdk/models/ip_address.py +119 -0
- files_sdk/models/key_lifecycle_rule.py +243 -0
- files_sdk/models/lock.py +174 -0
- files_sdk/models/message.py +244 -0
- files_sdk/models/message_comment.py +223 -0
- files_sdk/models/message_comment_reaction.py +181 -0
- files_sdk/models/message_reaction.py +170 -0
- files_sdk/models/notification.py +451 -0
- files_sdk/models/outbound_connection_log.py +105 -0
- files_sdk/models/partner.py +307 -0
- files_sdk/models/payment.py +91 -0
- files_sdk/models/payment_line_item.py +42 -0
- files_sdk/models/permission.py +190 -0
- files_sdk/models/preview.py +40 -0
- files_sdk/models/priority.py +63 -0
- files_sdk/models/project.py +205 -0
- files_sdk/models/public_hosting_request_log.py +101 -0
- files_sdk/models/public_ip_address.py +42 -0
- files_sdk/models/public_key.py +269 -0
- files_sdk/models/remote_bandwidth_snapshot.py +91 -0
- files_sdk/models/remote_mount_backend.py +438 -0
- files_sdk/models/remote_server.py +1854 -0
- files_sdk/models/remote_server_configuration_file.py +73 -0
- files_sdk/models/remote_server_credential.py +855 -0
- files_sdk/models/request.py +184 -0
- files_sdk/models/restore.py +142 -0
- files_sdk/models/scim_log.py +88 -0
- files_sdk/models/session.py +100 -0
- files_sdk/models/settings_change.py +71 -0
- files_sdk/models/sftp_action_log.py +108 -0
- files_sdk/models/sftp_host_key.py +215 -0
- files_sdk/models/share_group.py +228 -0
- files_sdk/models/share_group_member.py +41 -0
- files_sdk/models/siem_http_destination.py +1074 -0
- files_sdk/models/site.py +1289 -0
- files_sdk/models/snapshot.py +255 -0
- files_sdk/models/sso_strategy.py +168 -0
- files_sdk/models/status.py +42 -0
- files_sdk/models/style.py +152 -0
- files_sdk/models/sync.py +588 -0
- files_sdk/models/sync_log.py +86 -0
- files_sdk/models/sync_run.py +124 -0
- files_sdk/models/usage_by_top_level_dir.py +41 -0
- files_sdk/models/usage_daily_snapshot.py +93 -0
- files_sdk/models/usage_snapshot.py +73 -0
- files_sdk/models/user.py +1232 -0
- files_sdk/models/user_cipher_use.py +91 -0
- files_sdk/models/user_lifecycle_rule.py +355 -0
- files_sdk/models/user_request.py +166 -0
- files_sdk/models/user_sftp_client_use.py +68 -0
- files_sdk/models/web_dav_action_log.py +104 -0
- files_sdk/models/webhook_test.py +116 -0
- files_sdk/models/workspace.py +202 -0
- files_sdk/path_util.py +42 -0
- files_sdk/util.py +34 -0
|
@@ -0,0 +1,333 @@
|
|
|
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 GpgKey:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - GPG key ID.
|
|
14
|
+
"workspace_id": None, # int64 - Workspace ID (0 for default workspace).
|
|
15
|
+
"expires_at": None, # date-time - GPG key expiration date.
|
|
16
|
+
"name": None, # string - GPG key name.
|
|
17
|
+
"partner_id": None, # int64 - Partner ID who owns this GPG Key, if applicable.
|
|
18
|
+
"partner_name": None, # string - Name of the Partner who owns this GPG Key, if applicable.
|
|
19
|
+
"user_id": None, # int64 - User ID who owns this GPG Key, if applicable.
|
|
20
|
+
"public_key_md5": None, # string - MD5 hash of the GPG public key
|
|
21
|
+
"private_key_md5": None, # string - MD5 hash of the GPG private key.
|
|
22
|
+
"generated_public_key": None, # string - GPG public key
|
|
23
|
+
"generated_private_key": None, # string - GPG private key.
|
|
24
|
+
"private_key_password_md5": None, # string - GPG private key password. Only required for password protected keys.
|
|
25
|
+
"public_key": None, # string - The GPG public key
|
|
26
|
+
"private_key": None, # string - The GPG private key
|
|
27
|
+
"private_key_password": None, # string - The GPG private key password
|
|
28
|
+
"generate_expires_at": None, # string - Expiration date of the key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
|
|
29
|
+
"generate_keypair": None, # boolean - If true, generate a new GPG key pair. Can not be used with `public_key`/`private_key`
|
|
30
|
+
"generate_full_name": None, # string - Full name of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
|
|
31
|
+
"generate_email": None, # string - Email address of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
|
|
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 GpgKey.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 GpgKey.default_attributes
|
|
50
|
+
if getattr(self, k, None) is not None
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Parameters:
|
|
54
|
+
# partner_id - int64 - Partner ID who owns this GPG Key, if applicable.
|
|
55
|
+
# public_key - string - The GPG public key
|
|
56
|
+
# private_key - string - The GPG private key
|
|
57
|
+
# private_key_password - string - The GPG private key password
|
|
58
|
+
# name - string - GPG key name.
|
|
59
|
+
def update(self, params=None):
|
|
60
|
+
if not isinstance(params, dict):
|
|
61
|
+
params = {}
|
|
62
|
+
|
|
63
|
+
if hasattr(self, "id") and self.id:
|
|
64
|
+
params["id"] = self.id
|
|
65
|
+
else:
|
|
66
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
67
|
+
if "id" not in params:
|
|
68
|
+
raise MissingParameterError("Parameter missing: id")
|
|
69
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
70
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
71
|
+
if "partner_id" in params and not isinstance(
|
|
72
|
+
params["partner_id"], int
|
|
73
|
+
):
|
|
74
|
+
raise InvalidParameterError(
|
|
75
|
+
"Bad parameter: partner_id must be an int"
|
|
76
|
+
)
|
|
77
|
+
if "public_key" in params and not isinstance(
|
|
78
|
+
params["public_key"], str
|
|
79
|
+
):
|
|
80
|
+
raise InvalidParameterError(
|
|
81
|
+
"Bad parameter: public_key must be an str"
|
|
82
|
+
)
|
|
83
|
+
if "private_key" in params and not isinstance(
|
|
84
|
+
params["private_key"], str
|
|
85
|
+
):
|
|
86
|
+
raise InvalidParameterError(
|
|
87
|
+
"Bad parameter: private_key must be an str"
|
|
88
|
+
)
|
|
89
|
+
if "private_key_password" in params and not isinstance(
|
|
90
|
+
params["private_key_password"], str
|
|
91
|
+
):
|
|
92
|
+
raise InvalidParameterError(
|
|
93
|
+
"Bad parameter: private_key_password must be an str"
|
|
94
|
+
)
|
|
95
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
96
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
97
|
+
response, _options = Api.send_request(
|
|
98
|
+
"PATCH",
|
|
99
|
+
"/gpg_keys/{id}".format(id=params["id"]),
|
|
100
|
+
params,
|
|
101
|
+
self.options,
|
|
102
|
+
)
|
|
103
|
+
return response.data
|
|
104
|
+
|
|
105
|
+
def delete(self, params=None):
|
|
106
|
+
if not isinstance(params, dict):
|
|
107
|
+
params = {}
|
|
108
|
+
|
|
109
|
+
if hasattr(self, "id") and self.id:
|
|
110
|
+
params["id"] = self.id
|
|
111
|
+
else:
|
|
112
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
113
|
+
if "id" not in params:
|
|
114
|
+
raise MissingParameterError("Parameter missing: id")
|
|
115
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
116
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
117
|
+
Api.send_request(
|
|
118
|
+
"DELETE",
|
|
119
|
+
"/gpg_keys/{id}".format(id=params["id"]),
|
|
120
|
+
params,
|
|
121
|
+
self.options,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
def destroy(self, params=None):
|
|
125
|
+
self.delete(params)
|
|
126
|
+
|
|
127
|
+
def save(self):
|
|
128
|
+
if hasattr(self, "id") and self.id:
|
|
129
|
+
new_obj = self.update(self.get_attributes())
|
|
130
|
+
self.set_attributes(new_obj.get_attributes())
|
|
131
|
+
return True
|
|
132
|
+
else:
|
|
133
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
134
|
+
self.set_attributes(new_obj.get_attributes())
|
|
135
|
+
return True
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
# Parameters:
|
|
139
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
140
|
+
# 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.
|
|
141
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
142
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `name` or `expires_at`.
|
|
143
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `workspace_id`, `partner_id` or `expires_at`. Valid field combinations are `[ workspace_id, expires_at ]`.
|
|
144
|
+
# filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `expires_at`.
|
|
145
|
+
# filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `expires_at`.
|
|
146
|
+
# filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `expires_at`.
|
|
147
|
+
# filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `expires_at`.
|
|
148
|
+
def list(params=None, options=None):
|
|
149
|
+
if not isinstance(params, dict):
|
|
150
|
+
params = {}
|
|
151
|
+
if not isinstance(options, dict):
|
|
152
|
+
options = {}
|
|
153
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
154
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
155
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
156
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
157
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
158
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
159
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
160
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
161
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
162
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
163
|
+
if "filter_gt" in params and not isinstance(params["filter_gt"], dict):
|
|
164
|
+
raise InvalidParameterError("Bad parameter: filter_gt must be an dict")
|
|
165
|
+
if "filter_gteq" in params and not isinstance(params["filter_gteq"], dict):
|
|
166
|
+
raise InvalidParameterError(
|
|
167
|
+
"Bad parameter: filter_gteq must be an dict"
|
|
168
|
+
)
|
|
169
|
+
if "filter_lt" in params and not isinstance(params["filter_lt"], dict):
|
|
170
|
+
raise InvalidParameterError("Bad parameter: filter_lt must be an dict")
|
|
171
|
+
if "filter_lteq" in params and not isinstance(params["filter_lteq"], dict):
|
|
172
|
+
raise InvalidParameterError(
|
|
173
|
+
"Bad parameter: filter_lteq must be an dict"
|
|
174
|
+
)
|
|
175
|
+
return ListObj(GpgKey, "GET", "/gpg_keys", params, options)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def all(params=None, options=None):
|
|
179
|
+
list(params, options)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
# Parameters:
|
|
183
|
+
# id (required) - int64 - Gpg Key ID.
|
|
184
|
+
def find(id, params=None, options=None):
|
|
185
|
+
if not isinstance(params, dict):
|
|
186
|
+
params = {}
|
|
187
|
+
if not isinstance(options, dict):
|
|
188
|
+
options = {}
|
|
189
|
+
params["id"] = id
|
|
190
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
191
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
192
|
+
if "id" not in params:
|
|
193
|
+
raise MissingParameterError("Parameter missing: id")
|
|
194
|
+
response, options = Api.send_request(
|
|
195
|
+
"GET", "/gpg_keys/{id}".format(id=params["id"]), params, options
|
|
196
|
+
)
|
|
197
|
+
return GpgKey(response.data, options)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def get(id, params=None, options=None):
|
|
201
|
+
find(id, params, options)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
# Parameters:
|
|
205
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
206
|
+
# partner_id - int64 - Partner ID who owns this GPG Key, if applicable.
|
|
207
|
+
# public_key - string - The GPG public key
|
|
208
|
+
# private_key - string - The GPG private key
|
|
209
|
+
# private_key_password - string - The GPG private key password
|
|
210
|
+
# name (required) - string - GPG key name.
|
|
211
|
+
# workspace_id - int64 - Workspace ID (0 for default workspace).
|
|
212
|
+
# generate_expires_at - string - Expiration date of the key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
|
|
213
|
+
# generate_keypair - boolean - If true, generate a new GPG key pair. Can not be used with `public_key`/`private_key`
|
|
214
|
+
# generate_full_name - string - Full name of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
|
|
215
|
+
# generate_email - string - Email address of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
|
|
216
|
+
def create(params=None, options=None):
|
|
217
|
+
if not isinstance(params, dict):
|
|
218
|
+
params = {}
|
|
219
|
+
if not isinstance(options, dict):
|
|
220
|
+
options = {}
|
|
221
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
222
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
223
|
+
if "partner_id" in params and not isinstance(params["partner_id"], int):
|
|
224
|
+
raise InvalidParameterError("Bad parameter: partner_id must be an int")
|
|
225
|
+
if "public_key" in params and not isinstance(params["public_key"], str):
|
|
226
|
+
raise InvalidParameterError("Bad parameter: public_key must be an str")
|
|
227
|
+
if "private_key" in params and not isinstance(params["private_key"], str):
|
|
228
|
+
raise InvalidParameterError(
|
|
229
|
+
"Bad parameter: private_key must be an str"
|
|
230
|
+
)
|
|
231
|
+
if "private_key_password" in params and not isinstance(
|
|
232
|
+
params["private_key_password"], str
|
|
233
|
+
):
|
|
234
|
+
raise InvalidParameterError(
|
|
235
|
+
"Bad parameter: private_key_password must be an str"
|
|
236
|
+
)
|
|
237
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
238
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
239
|
+
if "workspace_id" in params and not isinstance(
|
|
240
|
+
params["workspace_id"], int
|
|
241
|
+
):
|
|
242
|
+
raise InvalidParameterError(
|
|
243
|
+
"Bad parameter: workspace_id must be an int"
|
|
244
|
+
)
|
|
245
|
+
if "generate_expires_at" in params and not isinstance(
|
|
246
|
+
params["generate_expires_at"], str
|
|
247
|
+
):
|
|
248
|
+
raise InvalidParameterError(
|
|
249
|
+
"Bad parameter: generate_expires_at must be an str"
|
|
250
|
+
)
|
|
251
|
+
if "generate_keypair" in params and not isinstance(
|
|
252
|
+
params["generate_keypair"], bool
|
|
253
|
+
):
|
|
254
|
+
raise InvalidParameterError(
|
|
255
|
+
"Bad parameter: generate_keypair must be an bool"
|
|
256
|
+
)
|
|
257
|
+
if "generate_full_name" in params and not isinstance(
|
|
258
|
+
params["generate_full_name"], str
|
|
259
|
+
):
|
|
260
|
+
raise InvalidParameterError(
|
|
261
|
+
"Bad parameter: generate_full_name must be an str"
|
|
262
|
+
)
|
|
263
|
+
if "generate_email" in params and not isinstance(
|
|
264
|
+
params["generate_email"], str
|
|
265
|
+
):
|
|
266
|
+
raise InvalidParameterError(
|
|
267
|
+
"Bad parameter: generate_email must be an str"
|
|
268
|
+
)
|
|
269
|
+
if "name" not in params:
|
|
270
|
+
raise MissingParameterError("Parameter missing: name")
|
|
271
|
+
response, options = Api.send_request("POST", "/gpg_keys", params, options)
|
|
272
|
+
return GpgKey(response.data, options)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
# Parameters:
|
|
276
|
+
# partner_id - int64 - Partner ID who owns this GPG Key, if applicable.
|
|
277
|
+
# public_key - string - The GPG public key
|
|
278
|
+
# private_key - string - The GPG private key
|
|
279
|
+
# private_key_password - string - The GPG private key password
|
|
280
|
+
# name - string - GPG key name.
|
|
281
|
+
def update(id, params=None, options=None):
|
|
282
|
+
if not isinstance(params, dict):
|
|
283
|
+
params = {}
|
|
284
|
+
if not isinstance(options, dict):
|
|
285
|
+
options = {}
|
|
286
|
+
params["id"] = id
|
|
287
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
288
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
289
|
+
if "partner_id" in params and not isinstance(params["partner_id"], int):
|
|
290
|
+
raise InvalidParameterError("Bad parameter: partner_id must be an int")
|
|
291
|
+
if "public_key" in params and not isinstance(params["public_key"], str):
|
|
292
|
+
raise InvalidParameterError("Bad parameter: public_key must be an str")
|
|
293
|
+
if "private_key" in params and not isinstance(params["private_key"], str):
|
|
294
|
+
raise InvalidParameterError(
|
|
295
|
+
"Bad parameter: private_key must be an str"
|
|
296
|
+
)
|
|
297
|
+
if "private_key_password" in params and not isinstance(
|
|
298
|
+
params["private_key_password"], str
|
|
299
|
+
):
|
|
300
|
+
raise InvalidParameterError(
|
|
301
|
+
"Bad parameter: private_key_password must be an str"
|
|
302
|
+
)
|
|
303
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
304
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
305
|
+
if "id" not in params:
|
|
306
|
+
raise MissingParameterError("Parameter missing: id")
|
|
307
|
+
response, options = Api.send_request(
|
|
308
|
+
"PATCH", "/gpg_keys/{id}".format(id=params["id"]), params, options
|
|
309
|
+
)
|
|
310
|
+
return GpgKey(response.data, options)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
def delete(id, params=None, options=None):
|
|
314
|
+
if not isinstance(params, dict):
|
|
315
|
+
params = {}
|
|
316
|
+
if not isinstance(options, dict):
|
|
317
|
+
options = {}
|
|
318
|
+
params["id"] = id
|
|
319
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
320
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
321
|
+
if "id" not in params:
|
|
322
|
+
raise MissingParameterError("Parameter missing: id")
|
|
323
|
+
Api.send_request(
|
|
324
|
+
"DELETE", "/gpg_keys/{id}".format(id=params["id"]), params, options
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def destroy(id, params=None, options=None):
|
|
329
|
+
delete(id, params, options)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def new(*args, **kwargs):
|
|
333
|
+
return GpgKey(*args, **kwargs)
|
|
@@ -0,0 +1,338 @@
|
|
|
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 Group:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Group ID
|
|
14
|
+
"name": None, # string - Group name
|
|
15
|
+
"allowed_ips": None, # string - A list of allowed IPs if applicable. Newline delimited
|
|
16
|
+
"admin_ids": None, # string - Comma-delimited list of user IDs who are group administrators (separated by commas)
|
|
17
|
+
"notes": None, # string - Notes about this group
|
|
18
|
+
"user_ids": None, # string - Comma-delimited list of user IDs who belong to this group (separated by commas)
|
|
19
|
+
"usernames": None, # string - Comma-delimited list of usernames who belong to this group (separated by commas)
|
|
20
|
+
"ftp_permission": None, # boolean - If true, users in this group can use FTP to login. This will override a false value of `ftp_permission` on the user level.
|
|
21
|
+
"sftp_permission": None, # boolean - If true, users in this group can use SFTP to login. This will override a false value of `sftp_permission` on the user level.
|
|
22
|
+
"dav_permission": None, # boolean - If true, users in this group can use WebDAV to login. This will override a false value of `dav_permission` on the user level.
|
|
23
|
+
"restapi_permission": None, # boolean - If true, users in this group can use the REST API to login. This will override a false value of `restapi_permission` on the user level.
|
|
24
|
+
"site_id": None, # int64 - Site ID
|
|
25
|
+
"workspace_id": None, # int64 - Workspace ID
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
def __init__(self, attributes=None, options=None):
|
|
29
|
+
if not isinstance(attributes, dict):
|
|
30
|
+
attributes = {}
|
|
31
|
+
if not isinstance(options, dict):
|
|
32
|
+
options = {}
|
|
33
|
+
self.set_attributes(attributes)
|
|
34
|
+
self.options = options
|
|
35
|
+
|
|
36
|
+
def set_attributes(self, attributes):
|
|
37
|
+
for attribute, default_value in Group.default_attributes.items():
|
|
38
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
39
|
+
|
|
40
|
+
def get_attributes(self):
|
|
41
|
+
return {
|
|
42
|
+
k: getattr(self, k, None)
|
|
43
|
+
for k in Group.default_attributes
|
|
44
|
+
if getattr(self, k, None) is not None
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Parameters:
|
|
48
|
+
# notes - string - Group notes.
|
|
49
|
+
# user_ids - string - A list of user ids. If sent as a string, should be comma-delimited.
|
|
50
|
+
# admin_ids - string - A list of group admin user ids. If sent as a string, should be comma-delimited.
|
|
51
|
+
# ftp_permission - boolean - If true, users in this group can use FTP to login. This will override a false value of `ftp_permission` on the user level.
|
|
52
|
+
# sftp_permission - boolean - If true, users in this group can use SFTP to login. This will override a false value of `sftp_permission` on the user level.
|
|
53
|
+
# dav_permission - boolean - If true, users in this group can use WebDAV to login. This will override a false value of `dav_permission` on the user level.
|
|
54
|
+
# restapi_permission - boolean - If true, users in this group can use the REST API to login. This will override a false value of `restapi_permission` on the user level.
|
|
55
|
+
# allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
|
|
56
|
+
# name - string - Group name.
|
|
57
|
+
def update(self, params=None):
|
|
58
|
+
if not isinstance(params, dict):
|
|
59
|
+
params = {}
|
|
60
|
+
|
|
61
|
+
if hasattr(self, "id") and self.id:
|
|
62
|
+
params["id"] = self.id
|
|
63
|
+
else:
|
|
64
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
65
|
+
if "id" not in params:
|
|
66
|
+
raise MissingParameterError("Parameter missing: id")
|
|
67
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
68
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
69
|
+
if "notes" in params and not isinstance(params["notes"], str):
|
|
70
|
+
raise InvalidParameterError("Bad parameter: notes must be an str")
|
|
71
|
+
if "user_ids" in params and not isinstance(params["user_ids"], str):
|
|
72
|
+
raise InvalidParameterError(
|
|
73
|
+
"Bad parameter: user_ids must be an str"
|
|
74
|
+
)
|
|
75
|
+
if "admin_ids" in params and not isinstance(params["admin_ids"], str):
|
|
76
|
+
raise InvalidParameterError(
|
|
77
|
+
"Bad parameter: admin_ids must be an str"
|
|
78
|
+
)
|
|
79
|
+
if "allowed_ips" in params and not isinstance(
|
|
80
|
+
params["allowed_ips"], str
|
|
81
|
+
):
|
|
82
|
+
raise InvalidParameterError(
|
|
83
|
+
"Bad parameter: allowed_ips must be an str"
|
|
84
|
+
)
|
|
85
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
86
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
87
|
+
response, _options = Api.send_request(
|
|
88
|
+
"PATCH",
|
|
89
|
+
"/groups/{id}".format(id=params["id"]),
|
|
90
|
+
params,
|
|
91
|
+
self.options,
|
|
92
|
+
)
|
|
93
|
+
return response.data
|
|
94
|
+
|
|
95
|
+
def delete(self, params=None):
|
|
96
|
+
if not isinstance(params, dict):
|
|
97
|
+
params = {}
|
|
98
|
+
|
|
99
|
+
if hasattr(self, "id") and self.id:
|
|
100
|
+
params["id"] = self.id
|
|
101
|
+
else:
|
|
102
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
103
|
+
if "id" not in params:
|
|
104
|
+
raise MissingParameterError("Parameter missing: id")
|
|
105
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
106
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
107
|
+
Api.send_request(
|
|
108
|
+
"DELETE",
|
|
109
|
+
"/groups/{id}".format(id=params["id"]),
|
|
110
|
+
params,
|
|
111
|
+
self.options,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
def destroy(self, params=None):
|
|
115
|
+
self.delete(params)
|
|
116
|
+
|
|
117
|
+
def save(self):
|
|
118
|
+
if hasattr(self, "id") and self.id:
|
|
119
|
+
new_obj = self.update(self.get_attributes())
|
|
120
|
+
self.set_attributes(new_obj.get_attributes())
|
|
121
|
+
return True
|
|
122
|
+
else:
|
|
123
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
124
|
+
self.set_attributes(new_obj.get_attributes())
|
|
125
|
+
return True
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
# Parameters:
|
|
129
|
+
# 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.
|
|
130
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
131
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `workspace_id` or `name`.
|
|
132
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `name` and `workspace_id`. Valid field combinations are `[ workspace_id, name ]`.
|
|
133
|
+
# filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `name`.
|
|
134
|
+
# ids - string - Comma-separated list of group ids to include in results.
|
|
135
|
+
# include_parent_site_groups - boolean - Include groups from the parent site.
|
|
136
|
+
def list(params=None, options=None):
|
|
137
|
+
if not isinstance(params, dict):
|
|
138
|
+
params = {}
|
|
139
|
+
if not isinstance(options, dict):
|
|
140
|
+
options = {}
|
|
141
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
142
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
143
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
144
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
145
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
146
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
147
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
148
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
149
|
+
if "filter_prefix" in params and not isinstance(
|
|
150
|
+
params["filter_prefix"], dict
|
|
151
|
+
):
|
|
152
|
+
raise InvalidParameterError(
|
|
153
|
+
"Bad parameter: filter_prefix must be an dict"
|
|
154
|
+
)
|
|
155
|
+
if "ids" in params and not isinstance(params["ids"], str):
|
|
156
|
+
raise InvalidParameterError("Bad parameter: ids must be an str")
|
|
157
|
+
if "include_parent_site_groups" in params and not isinstance(
|
|
158
|
+
params["include_parent_site_groups"], bool
|
|
159
|
+
):
|
|
160
|
+
raise InvalidParameterError(
|
|
161
|
+
"Bad parameter: include_parent_site_groups must be an bool"
|
|
162
|
+
)
|
|
163
|
+
return ListObj(Group, "GET", "/groups", params, options)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def all(params=None, options=None):
|
|
167
|
+
list(params, options)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
# Parameters:
|
|
171
|
+
# id (required) - int64 - Group ID.
|
|
172
|
+
def find(id, params=None, options=None):
|
|
173
|
+
if not isinstance(params, dict):
|
|
174
|
+
params = {}
|
|
175
|
+
if not isinstance(options, dict):
|
|
176
|
+
options = {}
|
|
177
|
+
params["id"] = id
|
|
178
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
179
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
180
|
+
if "id" not in params:
|
|
181
|
+
raise MissingParameterError("Parameter missing: id")
|
|
182
|
+
response, options = Api.send_request(
|
|
183
|
+
"GET", "/groups/{id}".format(id=params["id"]), params, options
|
|
184
|
+
)
|
|
185
|
+
return Group(response.data, options)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def get(id, params=None, options=None):
|
|
189
|
+
find(id, params, options)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# Parameters:
|
|
193
|
+
# notes - string - Group notes.
|
|
194
|
+
# user_ids - string - A list of user ids. If sent as a string, should be comma-delimited.
|
|
195
|
+
# admin_ids - string - A list of group admin user ids. If sent as a string, should be comma-delimited.
|
|
196
|
+
# ftp_permission - boolean - If true, users in this group can use FTP to login. This will override a false value of `ftp_permission` on the user level.
|
|
197
|
+
# sftp_permission - boolean - If true, users in this group can use SFTP to login. This will override a false value of `sftp_permission` on the user level.
|
|
198
|
+
# dav_permission - boolean - If true, users in this group can use WebDAV to login. This will override a false value of `dav_permission` on the user level.
|
|
199
|
+
# restapi_permission - boolean - If true, users in this group can use the REST API to login. This will override a false value of `restapi_permission` on the user level.
|
|
200
|
+
# allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
|
|
201
|
+
# name (required) - string - Group name.
|
|
202
|
+
# workspace_id - int64 - Workspace ID
|
|
203
|
+
def create(params=None, options=None):
|
|
204
|
+
if not isinstance(params, dict):
|
|
205
|
+
params = {}
|
|
206
|
+
if not isinstance(options, dict):
|
|
207
|
+
options = {}
|
|
208
|
+
if "notes" in params and not isinstance(params["notes"], str):
|
|
209
|
+
raise InvalidParameterError("Bad parameter: notes must be an str")
|
|
210
|
+
if "user_ids" in params and not isinstance(params["user_ids"], str):
|
|
211
|
+
raise InvalidParameterError("Bad parameter: user_ids must be an str")
|
|
212
|
+
if "admin_ids" in params and not isinstance(params["admin_ids"], str):
|
|
213
|
+
raise InvalidParameterError("Bad parameter: admin_ids must be an str")
|
|
214
|
+
if "ftp_permission" in params and not isinstance(
|
|
215
|
+
params["ftp_permission"], bool
|
|
216
|
+
):
|
|
217
|
+
raise InvalidParameterError(
|
|
218
|
+
"Bad parameter: ftp_permission must be an bool"
|
|
219
|
+
)
|
|
220
|
+
if "sftp_permission" in params and not isinstance(
|
|
221
|
+
params["sftp_permission"], bool
|
|
222
|
+
):
|
|
223
|
+
raise InvalidParameterError(
|
|
224
|
+
"Bad parameter: sftp_permission must be an bool"
|
|
225
|
+
)
|
|
226
|
+
if "dav_permission" in params and not isinstance(
|
|
227
|
+
params["dav_permission"], bool
|
|
228
|
+
):
|
|
229
|
+
raise InvalidParameterError(
|
|
230
|
+
"Bad parameter: dav_permission must be an bool"
|
|
231
|
+
)
|
|
232
|
+
if "restapi_permission" in params and not isinstance(
|
|
233
|
+
params["restapi_permission"], bool
|
|
234
|
+
):
|
|
235
|
+
raise InvalidParameterError(
|
|
236
|
+
"Bad parameter: restapi_permission must be an bool"
|
|
237
|
+
)
|
|
238
|
+
if "allowed_ips" in params and not isinstance(params["allowed_ips"], str):
|
|
239
|
+
raise InvalidParameterError(
|
|
240
|
+
"Bad parameter: allowed_ips must be an str"
|
|
241
|
+
)
|
|
242
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
243
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
244
|
+
if "workspace_id" in params and not isinstance(
|
|
245
|
+
params["workspace_id"], int
|
|
246
|
+
):
|
|
247
|
+
raise InvalidParameterError(
|
|
248
|
+
"Bad parameter: workspace_id must be an int"
|
|
249
|
+
)
|
|
250
|
+
if "name" not in params:
|
|
251
|
+
raise MissingParameterError("Parameter missing: name")
|
|
252
|
+
response, options = Api.send_request("POST", "/groups", params, options)
|
|
253
|
+
return Group(response.data, options)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
# Parameters:
|
|
257
|
+
# notes - string - Group notes.
|
|
258
|
+
# user_ids - string - A list of user ids. If sent as a string, should be comma-delimited.
|
|
259
|
+
# admin_ids - string - A list of group admin user ids. If sent as a string, should be comma-delimited.
|
|
260
|
+
# ftp_permission - boolean - If true, users in this group can use FTP to login. This will override a false value of `ftp_permission` on the user level.
|
|
261
|
+
# sftp_permission - boolean - If true, users in this group can use SFTP to login. This will override a false value of `sftp_permission` on the user level.
|
|
262
|
+
# dav_permission - boolean - If true, users in this group can use WebDAV to login. This will override a false value of `dav_permission` on the user level.
|
|
263
|
+
# restapi_permission - boolean - If true, users in this group can use the REST API to login. This will override a false value of `restapi_permission` on the user level.
|
|
264
|
+
# allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
|
|
265
|
+
# name - string - Group name.
|
|
266
|
+
def update(id, params=None, options=None):
|
|
267
|
+
if not isinstance(params, dict):
|
|
268
|
+
params = {}
|
|
269
|
+
if not isinstance(options, dict):
|
|
270
|
+
options = {}
|
|
271
|
+
params["id"] = id
|
|
272
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
273
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
274
|
+
if "notes" in params and not isinstance(params["notes"], str):
|
|
275
|
+
raise InvalidParameterError("Bad parameter: notes must be an str")
|
|
276
|
+
if "user_ids" in params and not isinstance(params["user_ids"], str):
|
|
277
|
+
raise InvalidParameterError("Bad parameter: user_ids must be an str")
|
|
278
|
+
if "admin_ids" in params and not isinstance(params["admin_ids"], str):
|
|
279
|
+
raise InvalidParameterError("Bad parameter: admin_ids must be an str")
|
|
280
|
+
if "ftp_permission" in params and not isinstance(
|
|
281
|
+
params["ftp_permission"], bool
|
|
282
|
+
):
|
|
283
|
+
raise InvalidParameterError(
|
|
284
|
+
"Bad parameter: ftp_permission must be an bool"
|
|
285
|
+
)
|
|
286
|
+
if "sftp_permission" in params and not isinstance(
|
|
287
|
+
params["sftp_permission"], bool
|
|
288
|
+
):
|
|
289
|
+
raise InvalidParameterError(
|
|
290
|
+
"Bad parameter: sftp_permission must be an bool"
|
|
291
|
+
)
|
|
292
|
+
if "dav_permission" in params and not isinstance(
|
|
293
|
+
params["dav_permission"], bool
|
|
294
|
+
):
|
|
295
|
+
raise InvalidParameterError(
|
|
296
|
+
"Bad parameter: dav_permission must be an bool"
|
|
297
|
+
)
|
|
298
|
+
if "restapi_permission" in params and not isinstance(
|
|
299
|
+
params["restapi_permission"], bool
|
|
300
|
+
):
|
|
301
|
+
raise InvalidParameterError(
|
|
302
|
+
"Bad parameter: restapi_permission must be an bool"
|
|
303
|
+
)
|
|
304
|
+
if "allowed_ips" in params and not isinstance(params["allowed_ips"], str):
|
|
305
|
+
raise InvalidParameterError(
|
|
306
|
+
"Bad parameter: allowed_ips must be an str"
|
|
307
|
+
)
|
|
308
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
309
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
310
|
+
if "id" not in params:
|
|
311
|
+
raise MissingParameterError("Parameter missing: id")
|
|
312
|
+
response, options = Api.send_request(
|
|
313
|
+
"PATCH", "/groups/{id}".format(id=params["id"]), params, options
|
|
314
|
+
)
|
|
315
|
+
return Group(response.data, options)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def delete(id, params=None, options=None):
|
|
319
|
+
if not isinstance(params, dict):
|
|
320
|
+
params = {}
|
|
321
|
+
if not isinstance(options, dict):
|
|
322
|
+
options = {}
|
|
323
|
+
params["id"] = id
|
|
324
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
325
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
326
|
+
if "id" not in params:
|
|
327
|
+
raise MissingParameterError("Parameter missing: id")
|
|
328
|
+
Api.send_request(
|
|
329
|
+
"DELETE", "/groups/{id}".format(id=params["id"]), params, options
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def destroy(id, params=None, options=None):
|
|
334
|
+
delete(id, params, options)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
def new(*args, **kwargs):
|
|
338
|
+
return Group(*args, **kwargs)
|