files-com 1.5.0__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 +682 -0
- _VERSION +1 -0
- files_com-1.5.0.dist-info/METADATA +694 -0
- files_com-1.5.0.dist-info/RECORD +113 -0
- files_com-1.5.0.dist-info/WHEEL +5 -0
- files_com-1.5.0.dist-info/licenses/LICENSE +21 -0
- files_com-1.5.0.dist-info/top_level.txt +1 -0
- files_sdk/__init__.py +270 -0
- files_sdk/api.py +57 -0
- files_sdk/api_client.py +327 -0
- files_sdk/error.py +2891 -0
- files_sdk/list_obj.py +42 -0
- files_sdk/models/__init__.py +104 -0
- files_sdk/models/account_line_item.py +51 -0
- files_sdk/models/action.py +49 -0
- files_sdk/models/action_notification_export.py +147 -0
- files_sdk/models/action_notification_export_result.py +88 -0
- files_sdk/models/api_key.py +322 -0
- files_sdk/models/api_request_log.py +87 -0
- files_sdk/models/app.py +89 -0
- files_sdk/models/as2_incoming_message.py +123 -0
- files_sdk/models/as2_outgoing_message.py +119 -0
- files_sdk/models/as2_partner.py +374 -0
- files_sdk/models/as2_station.py +271 -0
- files_sdk/models/auto.py +36 -0
- files_sdk/models/automation.py +691 -0
- files_sdk/models/automation_log.py +77 -0
- files_sdk/models/automation_run.py +108 -0
- files_sdk/models/bandwidth_snapshot.py +91 -0
- files_sdk/models/behavior.py +334 -0
- files_sdk/models/bundle.py +550 -0
- files_sdk/models/bundle_action.py +86 -0
- files_sdk/models/bundle_download.py +94 -0
- files_sdk/models/bundle_notification.py +217 -0
- files_sdk/models/bundle_path.py +37 -0
- files_sdk/models/bundle_recipient.py +120 -0
- files_sdk/models/bundle_registration.py +79 -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 +74 -0
- files_sdk/models/errors.py +37 -0
- files_sdk/models/exavault_api_request_log.py +85 -0
- files_sdk/models/external_event.py +148 -0
- files_sdk/models/file.py +791 -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 +78 -0
- files_sdk/models/file_upload_part.py +54 -0
- files_sdk/models/folder.py +154 -0
- files_sdk/models/form_field.py +43 -0
- files_sdk/models/form_field_set.py +240 -0
- files_sdk/models/ftp_action_log.py +87 -0
- files_sdk/models/gpg_key.py +254 -0
- files_sdk/models/group.py +276 -0
- files_sdk/models/group_user.py +231 -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/image.py +37 -0
- files_sdk/models/inbox_recipient.py +118 -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 +46 -0
- files_sdk/models/ip_address.py +119 -0
- files_sdk/models/lock.py +158 -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 +357 -0
- files_sdk/models/outbound_connection_log.py +88 -0
- files_sdk/models/payment.py +91 -0
- files_sdk/models/payment_line_item.py +42 -0
- files_sdk/models/permission.py +174 -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 +82 -0
- files_sdk/models/public_ip_address.py +42 -0
- files_sdk/models/public_key.py +212 -0
- files_sdk/models/remote_bandwidth_snapshot.py +91 -0
- files_sdk/models/remote_server.py +1677 -0
- files_sdk/models/remote_server_configuration_file.py +72 -0
- files_sdk/models/request.py +180 -0
- files_sdk/models/restore.py +104 -0
- files_sdk/models/session.py +100 -0
- files_sdk/models/settings_change.py +71 -0
- files_sdk/models/sftp_action_log.py +91 -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 +773 -0
- files_sdk/models/site.py +767 -0
- files_sdk/models/snapshot.py +255 -0
- files_sdk/models/sso_strategy.py +167 -0
- files_sdk/models/status.py +42 -0
- files_sdk/models/style.py +152 -0
- files_sdk/models/sync_log.py +75 -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 +893 -0
- files_sdk/models/user_cipher_use.py +68 -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 +87 -0
- files_sdk/models/webhook_test.py +104 -0
- files_sdk/path_util.py +42 -0
- files_sdk/util.py +34 -0
|
@@ -0,0 +1,174 @@
|
|
|
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 Permission:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Permission ID
|
|
14
|
+
"path": None, # string - Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
|
15
|
+
"user_id": None, # int64 - User ID
|
|
16
|
+
"username": None, # string - Username (if applicable)
|
|
17
|
+
"group_id": None, # int64 - Group ID
|
|
18
|
+
"group_name": None, # string - Group name (if applicable)
|
|
19
|
+
"permission": None, # string - Permission type. See the table referenced in the documentation for an explanation of each permission.
|
|
20
|
+
"recursive": None, # boolean - Recursive: does this permission apply to subfolders?
|
|
21
|
+
"site_id": None, # int64 - Site ID
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
def __init__(self, attributes=None, options=None):
|
|
25
|
+
if not isinstance(attributes, dict):
|
|
26
|
+
attributes = {}
|
|
27
|
+
if not isinstance(options, dict):
|
|
28
|
+
options = {}
|
|
29
|
+
self.set_attributes(attributes)
|
|
30
|
+
self.options = options
|
|
31
|
+
|
|
32
|
+
def set_attributes(self, attributes):
|
|
33
|
+
for attribute, default_value in Permission.default_attributes.items():
|
|
34
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
35
|
+
|
|
36
|
+
def get_attributes(self):
|
|
37
|
+
return {
|
|
38
|
+
k: getattr(self, k, None)
|
|
39
|
+
for k in Permission.default_attributes
|
|
40
|
+
if getattr(self, k, None) is not None
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
def delete(self, params=None):
|
|
44
|
+
if not isinstance(params, dict):
|
|
45
|
+
params = {}
|
|
46
|
+
|
|
47
|
+
if hasattr(self, "id") and self.id:
|
|
48
|
+
params["id"] = self.id
|
|
49
|
+
else:
|
|
50
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
51
|
+
if "id" not in params:
|
|
52
|
+
raise MissingParameterError("Parameter missing: id")
|
|
53
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
54
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
55
|
+
Api.send_request(
|
|
56
|
+
"DELETE",
|
|
57
|
+
"/permissions/{id}".format(id=params["id"]),
|
|
58
|
+
params,
|
|
59
|
+
self.options,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def destroy(self, params=None):
|
|
63
|
+
self.delete(params)
|
|
64
|
+
|
|
65
|
+
def save(self):
|
|
66
|
+
if hasattr(self, "id") and self.id:
|
|
67
|
+
raise NotImplementedError(
|
|
68
|
+
"The Permission object doesn't support updates."
|
|
69
|
+
)
|
|
70
|
+
else:
|
|
71
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
72
|
+
self.set_attributes(new_obj.get_attributes())
|
|
73
|
+
return True
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# Parameters:
|
|
77
|
+
# 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.
|
|
78
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
79
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `group_id`, `path` or `user_id`.
|
|
80
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `path`, `group_id` or `user_id`. Valid field combinations are `[ group_id, path ]`, `[ user_id, path ]` or `[ user_id, group_id ]`.
|
|
81
|
+
# filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`.
|
|
82
|
+
# path - string - Permission path. If provided, will scope all permissions(including upward) to this path.
|
|
83
|
+
# include_groups - boolean - If searching by user or group, also include user's permissions that are inherited from its groups?
|
|
84
|
+
# group_id - string
|
|
85
|
+
# user_id - string
|
|
86
|
+
def list(params=None, options=None):
|
|
87
|
+
if not isinstance(params, dict):
|
|
88
|
+
params = {}
|
|
89
|
+
if not isinstance(options, dict):
|
|
90
|
+
options = {}
|
|
91
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
92
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
93
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
94
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
95
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
96
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
97
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
98
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
99
|
+
if "filter_prefix" in params and not isinstance(
|
|
100
|
+
params["filter_prefix"], dict
|
|
101
|
+
):
|
|
102
|
+
raise InvalidParameterError(
|
|
103
|
+
"Bad parameter: filter_prefix must be an dict"
|
|
104
|
+
)
|
|
105
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
106
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
107
|
+
if "group_id" in params and not isinstance(params["group_id"], str):
|
|
108
|
+
raise InvalidParameterError("Bad parameter: group_id must be an str")
|
|
109
|
+
if "user_id" in params and not isinstance(params["user_id"], str):
|
|
110
|
+
raise InvalidParameterError("Bad parameter: user_id must be an str")
|
|
111
|
+
return ListObj(Permission, "GET", "/permissions", params, options)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def all(params=None, options=None):
|
|
115
|
+
list(params, options)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# Parameters:
|
|
119
|
+
# path (required) - string - Folder path
|
|
120
|
+
# group_id - int64 - Group ID. Provide `group_name` or `group_id`
|
|
121
|
+
# permission - string - Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
|
|
122
|
+
# recursive - boolean - Apply to subfolders recursively?
|
|
123
|
+
# user_id - int64 - User ID. Provide `username` or `user_id`
|
|
124
|
+
# username - string - User username. Provide `username` or `user_id`
|
|
125
|
+
# group_name - string - Group name. Provide `group_name` or `group_id`
|
|
126
|
+
# site_id - int64 - Site ID. If not provided, will default to current site. Used when creating a permission for a child site.
|
|
127
|
+
def create(params=None, options=None):
|
|
128
|
+
if not isinstance(params, dict):
|
|
129
|
+
params = {}
|
|
130
|
+
if not isinstance(options, dict):
|
|
131
|
+
options = {}
|
|
132
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
133
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
134
|
+
if "group_id" in params and not isinstance(params["group_id"], int):
|
|
135
|
+
raise InvalidParameterError("Bad parameter: group_id must be an int")
|
|
136
|
+
if "permission" in params and not isinstance(params["permission"], str):
|
|
137
|
+
raise InvalidParameterError("Bad parameter: permission must be an str")
|
|
138
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
139
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
140
|
+
if "username" in params and not isinstance(params["username"], str):
|
|
141
|
+
raise InvalidParameterError("Bad parameter: username must be an str")
|
|
142
|
+
if "group_name" in params and not isinstance(params["group_name"], str):
|
|
143
|
+
raise InvalidParameterError("Bad parameter: group_name must be an str")
|
|
144
|
+
if "site_id" in params and not isinstance(params["site_id"], int):
|
|
145
|
+
raise InvalidParameterError("Bad parameter: site_id must be an int")
|
|
146
|
+
if "path" not in params:
|
|
147
|
+
raise MissingParameterError("Parameter missing: path")
|
|
148
|
+
response, options = Api.send_request(
|
|
149
|
+
"POST", "/permissions", params, options
|
|
150
|
+
)
|
|
151
|
+
return Permission(response.data, options)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def delete(id, params=None, options=None):
|
|
155
|
+
if not isinstance(params, dict):
|
|
156
|
+
params = {}
|
|
157
|
+
if not isinstance(options, dict):
|
|
158
|
+
options = {}
|
|
159
|
+
params["id"] = id
|
|
160
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
161
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
162
|
+
if "id" not in params:
|
|
163
|
+
raise MissingParameterError("Parameter missing: id")
|
|
164
|
+
Api.send_request(
|
|
165
|
+
"DELETE", "/permissions/{id}".format(id=params["id"]), params, options
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def destroy(id, params=None, options=None):
|
|
170
|
+
delete(id, params, options)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def new(*args, **kwargs):
|
|
174
|
+
return Permission(*args, **kwargs)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import builtins # noqa: F401
|
|
2
|
+
from files_sdk.api import Api # noqa: F401
|
|
3
|
+
from files_sdk.error import ( # noqa: F401
|
|
4
|
+
InvalidParameterError,
|
|
5
|
+
MissingParameterError,
|
|
6
|
+
NotImplementedError,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Preview:
|
|
11
|
+
default_attributes = {
|
|
12
|
+
"id": None, # int64 - Preview ID
|
|
13
|
+
"status": None, # string - Preview status. Can be invalid, not_generated, generating, complete, or file_too_large
|
|
14
|
+
"download_uri": None, # string - Link to download preview
|
|
15
|
+
"type": None, # string - Preview type. Can be image, pdf, pdf_native, video, or audio
|
|
16
|
+
"size": None, # string - Preview size
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
def __init__(self, attributes=None, options=None):
|
|
20
|
+
if not isinstance(attributes, dict):
|
|
21
|
+
attributes = {}
|
|
22
|
+
if not isinstance(options, dict):
|
|
23
|
+
options = {}
|
|
24
|
+
self.set_attributes(attributes)
|
|
25
|
+
self.options = options
|
|
26
|
+
|
|
27
|
+
def set_attributes(self, attributes):
|
|
28
|
+
for attribute, default_value in Preview.default_attributes.items():
|
|
29
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
30
|
+
|
|
31
|
+
def get_attributes(self):
|
|
32
|
+
return {
|
|
33
|
+
k: getattr(self, k, None)
|
|
34
|
+
for k in Preview.default_attributes
|
|
35
|
+
if getattr(self, k, None) is not None
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def new(*args, **kwargs):
|
|
40
|
+
return Preview(*args, **kwargs)
|
|
@@ -0,0 +1,63 @@
|
|
|
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 Priority:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"path": None, # string - The path corresponding to the priority color. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
|
14
|
+
"color": None, # string - The priority color
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def __init__(self, attributes=None, options=None):
|
|
18
|
+
if not isinstance(attributes, dict):
|
|
19
|
+
attributes = {}
|
|
20
|
+
if not isinstance(options, dict):
|
|
21
|
+
options = {}
|
|
22
|
+
self.set_attributes(attributes)
|
|
23
|
+
self.options = options
|
|
24
|
+
|
|
25
|
+
def set_attributes(self, attributes):
|
|
26
|
+
for attribute, default_value in Priority.default_attributes.items():
|
|
27
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
28
|
+
|
|
29
|
+
def get_attributes(self):
|
|
30
|
+
return {
|
|
31
|
+
k: getattr(self, k, None)
|
|
32
|
+
for k in Priority.default_attributes
|
|
33
|
+
if getattr(self, k, None) is not None
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# Parameters:
|
|
38
|
+
# 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.
|
|
39
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
40
|
+
# path (required) - string - The path to query for priorities
|
|
41
|
+
def list(path, params=None, options=None):
|
|
42
|
+
if not isinstance(params, dict):
|
|
43
|
+
params = {}
|
|
44
|
+
if not isinstance(options, dict):
|
|
45
|
+
options = {}
|
|
46
|
+
params["path"] = path
|
|
47
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
48
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
49
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
50
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
51
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
52
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
53
|
+
if "path" not in params:
|
|
54
|
+
raise MissingParameterError("Parameter missing: path")
|
|
55
|
+
return ListObj(Priority, "GET", "/priorities", params, options)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def all(path, params=None, options=None):
|
|
59
|
+
list(path, params, options)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def new(*args, **kwargs):
|
|
63
|
+
return Priority(*args, **kwargs)
|
|
@@ -0,0 +1,205 @@
|
|
|
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 Project:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Project ID
|
|
14
|
+
"global_access": None, # string - Global access settings
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def __init__(self, attributes=None, options=None):
|
|
18
|
+
if not isinstance(attributes, dict):
|
|
19
|
+
attributes = {}
|
|
20
|
+
if not isinstance(options, dict):
|
|
21
|
+
options = {}
|
|
22
|
+
self.set_attributes(attributes)
|
|
23
|
+
self.options = options
|
|
24
|
+
|
|
25
|
+
def set_attributes(self, attributes):
|
|
26
|
+
for attribute, default_value in Project.default_attributes.items():
|
|
27
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
28
|
+
|
|
29
|
+
def get_attributes(self):
|
|
30
|
+
return {
|
|
31
|
+
k: getattr(self, k, None)
|
|
32
|
+
for k in Project.default_attributes
|
|
33
|
+
if getattr(self, k, None) is not None
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Parameters:
|
|
37
|
+
# global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
|
|
38
|
+
def update(self, params=None):
|
|
39
|
+
if not isinstance(params, dict):
|
|
40
|
+
params = {}
|
|
41
|
+
|
|
42
|
+
if hasattr(self, "id") and self.id:
|
|
43
|
+
params["id"] = self.id
|
|
44
|
+
else:
|
|
45
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
46
|
+
if "id" not in params:
|
|
47
|
+
raise MissingParameterError("Parameter missing: id")
|
|
48
|
+
if "global_access" not in params:
|
|
49
|
+
raise MissingParameterError("Parameter missing: global_access")
|
|
50
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
51
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
52
|
+
if "global_access" in params and not isinstance(
|
|
53
|
+
params["global_access"], str
|
|
54
|
+
):
|
|
55
|
+
raise InvalidParameterError(
|
|
56
|
+
"Bad parameter: global_access must be an str"
|
|
57
|
+
)
|
|
58
|
+
response, _options = Api.send_request(
|
|
59
|
+
"PATCH",
|
|
60
|
+
"/projects/{id}".format(id=params["id"]),
|
|
61
|
+
params,
|
|
62
|
+
self.options,
|
|
63
|
+
)
|
|
64
|
+
return response.data
|
|
65
|
+
|
|
66
|
+
def delete(self, params=None):
|
|
67
|
+
if not isinstance(params, dict):
|
|
68
|
+
params = {}
|
|
69
|
+
|
|
70
|
+
if hasattr(self, "id") and self.id:
|
|
71
|
+
params["id"] = self.id
|
|
72
|
+
else:
|
|
73
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
74
|
+
if "id" not in params:
|
|
75
|
+
raise MissingParameterError("Parameter missing: id")
|
|
76
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
77
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
78
|
+
Api.send_request(
|
|
79
|
+
"DELETE",
|
|
80
|
+
"/projects/{id}".format(id=params["id"]),
|
|
81
|
+
params,
|
|
82
|
+
self.options,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
def destroy(self, params=None):
|
|
86
|
+
self.delete(params)
|
|
87
|
+
|
|
88
|
+
def save(self):
|
|
89
|
+
if hasattr(self, "id") and self.id:
|
|
90
|
+
new_obj = self.update(self.get_attributes())
|
|
91
|
+
self.set_attributes(new_obj.get_attributes())
|
|
92
|
+
return True
|
|
93
|
+
else:
|
|
94
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
95
|
+
self.set_attributes(new_obj.get_attributes())
|
|
96
|
+
return True
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# Parameters:
|
|
100
|
+
# 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.
|
|
101
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
102
|
+
def list(params=None, options=None):
|
|
103
|
+
if not isinstance(params, dict):
|
|
104
|
+
params = {}
|
|
105
|
+
if not isinstance(options, dict):
|
|
106
|
+
options = {}
|
|
107
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
108
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
109
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
110
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
111
|
+
return ListObj(Project, "GET", "/projects", params, options)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def all(params=None, options=None):
|
|
115
|
+
list(params, options)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# Parameters:
|
|
119
|
+
# id (required) - int64 - Project ID.
|
|
120
|
+
def find(id, params=None, options=None):
|
|
121
|
+
if not isinstance(params, dict):
|
|
122
|
+
params = {}
|
|
123
|
+
if not isinstance(options, dict):
|
|
124
|
+
options = {}
|
|
125
|
+
params["id"] = id
|
|
126
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
127
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
128
|
+
if "id" not in params:
|
|
129
|
+
raise MissingParameterError("Parameter missing: id")
|
|
130
|
+
response, options = Api.send_request(
|
|
131
|
+
"GET", "/projects/{id}".format(id=params["id"]), params, options
|
|
132
|
+
)
|
|
133
|
+
return Project(response.data, options)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def get(id, params=None, options=None):
|
|
137
|
+
find(id, params, options)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# Parameters:
|
|
141
|
+
# global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
|
|
142
|
+
def create(params=None, options=None):
|
|
143
|
+
if not isinstance(params, dict):
|
|
144
|
+
params = {}
|
|
145
|
+
if not isinstance(options, dict):
|
|
146
|
+
options = {}
|
|
147
|
+
if "global_access" in params and not isinstance(
|
|
148
|
+
params["global_access"], str
|
|
149
|
+
):
|
|
150
|
+
raise InvalidParameterError(
|
|
151
|
+
"Bad parameter: global_access must be an str"
|
|
152
|
+
)
|
|
153
|
+
if "global_access" not in params:
|
|
154
|
+
raise MissingParameterError("Parameter missing: global_access")
|
|
155
|
+
response, options = Api.send_request("POST", "/projects", params, options)
|
|
156
|
+
return Project(response.data, options)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
# Parameters:
|
|
160
|
+
# global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
|
|
161
|
+
def update(id, params=None, options=None):
|
|
162
|
+
if not isinstance(params, dict):
|
|
163
|
+
params = {}
|
|
164
|
+
if not isinstance(options, dict):
|
|
165
|
+
options = {}
|
|
166
|
+
params["id"] = id
|
|
167
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
168
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
169
|
+
if "global_access" in params and not isinstance(
|
|
170
|
+
params["global_access"], str
|
|
171
|
+
):
|
|
172
|
+
raise InvalidParameterError(
|
|
173
|
+
"Bad parameter: global_access must be an str"
|
|
174
|
+
)
|
|
175
|
+
if "id" not in params:
|
|
176
|
+
raise MissingParameterError("Parameter missing: id")
|
|
177
|
+
if "global_access" not in params:
|
|
178
|
+
raise MissingParameterError("Parameter missing: global_access")
|
|
179
|
+
response, options = Api.send_request(
|
|
180
|
+
"PATCH", "/projects/{id}".format(id=params["id"]), params, options
|
|
181
|
+
)
|
|
182
|
+
return Project(response.data, options)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def delete(id, params=None, options=None):
|
|
186
|
+
if not isinstance(params, dict):
|
|
187
|
+
params = {}
|
|
188
|
+
if not isinstance(options, dict):
|
|
189
|
+
options = {}
|
|
190
|
+
params["id"] = id
|
|
191
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
192
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
193
|
+
if "id" not in params:
|
|
194
|
+
raise MissingParameterError("Parameter missing: id")
|
|
195
|
+
Api.send_request(
|
|
196
|
+
"DELETE", "/projects/{id}".format(id=params["id"]), params, options
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def destroy(id, params=None, options=None):
|
|
201
|
+
delete(id, params, options)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def new(*args, **kwargs):
|
|
205
|
+
return Project(*args, **kwargs)
|
|
@@ -0,0 +1,82 @@
|
|
|
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 PublicHostingRequestLog:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"timestamp": None, # date-time - Start Time of Action
|
|
14
|
+
"remote_ip": None, # string - IP Address of Public Hosting Client
|
|
15
|
+
"server_ip": None, # string - IP Address of Public Hosting Server
|
|
16
|
+
"hostname": None, # string - HTTP Request Hostname
|
|
17
|
+
"path": None, # string - HTTP Request Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
|
18
|
+
"responseCode": None, # int64 - HTTP Response Code
|
|
19
|
+
"success": None, # boolean - Whether SFTP Action was successful.
|
|
20
|
+
"duration_ms": None, # int64 - Duration (in milliseconds)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
def __init__(self, attributes=None, options=None):
|
|
24
|
+
if not isinstance(attributes, dict):
|
|
25
|
+
attributes = {}
|
|
26
|
+
if not isinstance(options, dict):
|
|
27
|
+
options = {}
|
|
28
|
+
self.set_attributes(attributes)
|
|
29
|
+
self.options = options
|
|
30
|
+
|
|
31
|
+
def set_attributes(self, attributes):
|
|
32
|
+
for (
|
|
33
|
+
attribute,
|
|
34
|
+
default_value,
|
|
35
|
+
) in PublicHostingRequestLog.default_attributes.items():
|
|
36
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
37
|
+
|
|
38
|
+
def get_attributes(self):
|
|
39
|
+
return {
|
|
40
|
+
k: getattr(self, k, None)
|
|
41
|
+
for k in PublicHostingRequestLog.default_attributes
|
|
42
|
+
if getattr(self, k, None) is not None
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Parameters:
|
|
47
|
+
# 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.
|
|
48
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
49
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `start_date`, `end_date`, `path`, `remote_ip` or `success`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ path ]`, `[ remote_ip ]`, `[ success ]`, `[ start_date, end_date ]`, `[ start_date, path ]`, `[ start_date, remote_ip ]`, `[ start_date, success ]`, `[ end_date, path ]`, `[ end_date, remote_ip ]`, `[ end_date, success ]`, `[ path, remote_ip ]`, `[ path, success ]`, `[ remote_ip, success ]`, `[ start_date, end_date, path ]`, `[ start_date, end_date, remote_ip ]`, `[ start_date, end_date, success ]`, `[ start_date, path, remote_ip ]`, `[ start_date, path, success ]`, `[ start_date, remote_ip, success ]`, `[ end_date, path, remote_ip ]`, `[ end_date, path, success ]`, `[ end_date, remote_ip, success ]`, `[ path, remote_ip, success ]`, `[ start_date, end_date, path, remote_ip ]`, `[ start_date, end_date, path, success ]`, `[ start_date, end_date, remote_ip, success ]`, `[ start_date, path, remote_ip, success ]` or `[ end_date, path, remote_ip, success ]`.
|
|
50
|
+
# filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ path ]`, `[ remote_ip ]`, `[ success ]`, `[ start_date, end_date ]`, `[ start_date, path ]`, `[ start_date, remote_ip ]`, `[ start_date, success ]`, `[ end_date, path ]`, `[ end_date, remote_ip ]`, `[ end_date, success ]`, `[ path, remote_ip ]`, `[ path, success ]`, `[ remote_ip, success ]`, `[ start_date, end_date, path ]`, `[ start_date, end_date, remote_ip ]`, `[ start_date, end_date, success ]`, `[ start_date, path, remote_ip ]`, `[ start_date, path, success ]`, `[ start_date, remote_ip, success ]`, `[ end_date, path, remote_ip ]`, `[ end_date, path, success ]`, `[ end_date, remote_ip, success ]`, `[ path, remote_ip, success ]`, `[ start_date, end_date, path, remote_ip ]`, `[ start_date, end_date, path, success ]`, `[ start_date, end_date, remote_ip, success ]`, `[ start_date, path, remote_ip, success ]` or `[ end_date, path, remote_ip, success ]`.
|
|
51
|
+
def list(params=None, options=None):
|
|
52
|
+
if not isinstance(params, dict):
|
|
53
|
+
params = {}
|
|
54
|
+
if not isinstance(options, dict):
|
|
55
|
+
options = {}
|
|
56
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
57
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
58
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
59
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
60
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
61
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
62
|
+
if "filter_prefix" in params and not isinstance(
|
|
63
|
+
params["filter_prefix"], dict
|
|
64
|
+
):
|
|
65
|
+
raise InvalidParameterError(
|
|
66
|
+
"Bad parameter: filter_prefix must be an dict"
|
|
67
|
+
)
|
|
68
|
+
return ListObj(
|
|
69
|
+
PublicHostingRequestLog,
|
|
70
|
+
"GET",
|
|
71
|
+
"/public_hosting_request_logs",
|
|
72
|
+
params,
|
|
73
|
+
options,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def all(params=None, options=None):
|
|
78
|
+
list(params, options)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def new(*args, **kwargs):
|
|
82
|
+
return PublicHostingRequestLog(*args, **kwargs)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import builtins # noqa: F401
|
|
2
|
+
from files_sdk.api import Api # noqa: F401
|
|
3
|
+
from files_sdk.error import ( # noqa: F401
|
|
4
|
+
InvalidParameterError,
|
|
5
|
+
MissingParameterError,
|
|
6
|
+
NotImplementedError,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PublicIpAddress:
|
|
11
|
+
default_attributes = {
|
|
12
|
+
"ip_address": None, # string - The public IP address.
|
|
13
|
+
"server_name": None, # string - The name of the frontend server.
|
|
14
|
+
"ftp_enabled": None, # boolean
|
|
15
|
+
"sftp_enabled": None, # boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def __init__(self, attributes=None, options=None):
|
|
19
|
+
if not isinstance(attributes, dict):
|
|
20
|
+
attributes = {}
|
|
21
|
+
if not isinstance(options, dict):
|
|
22
|
+
options = {}
|
|
23
|
+
self.set_attributes(attributes)
|
|
24
|
+
self.options = options
|
|
25
|
+
|
|
26
|
+
def set_attributes(self, attributes):
|
|
27
|
+
for (
|
|
28
|
+
attribute,
|
|
29
|
+
default_value,
|
|
30
|
+
) in PublicIpAddress.default_attributes.items():
|
|
31
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
32
|
+
|
|
33
|
+
def get_attributes(self):
|
|
34
|
+
return {
|
|
35
|
+
k: getattr(self, k, None)
|
|
36
|
+
for k in PublicIpAddress.default_attributes
|
|
37
|
+
if getattr(self, k, None) is not None
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def new(*args, **kwargs):
|
|
42
|
+
return PublicIpAddress(*args, **kwargs)
|