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,91 @@
|
|
|
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 UserCipherUse:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - UserCipherUse ID
|
|
14
|
+
"user_id": None, # int64 - ID of the user who performed this access
|
|
15
|
+
"username": None, # string - Username of the user who performed this access
|
|
16
|
+
"protocol_cipher": None, # string - The protocol and cipher employed
|
|
17
|
+
"created_at": None, # date-time - The earliest recorded use of this combination of interface and protocol and cipher (for this user)
|
|
18
|
+
"insecure": None, # boolean - Is this cipher considered insecure?
|
|
19
|
+
"interface": None, # string - The interface accessed
|
|
20
|
+
"updated_at": None, # date-time - The most recent use of this combination of interface and protocol and cipher (for this user)
|
|
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 UserCipherUse.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 UserCipherUse.default_attributes
|
|
42
|
+
if getattr(self, k, None) is not None
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Parameters:
|
|
47
|
+
# user_id - int64 - User ID. If provided, will return uses for this user.
|
|
48
|
+
# 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.
|
|
49
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
50
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `updated_at`.
|
|
51
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `insecure` and `updated_at`. Valid field combinations are `[ insecure, updated_at ]`.
|
|
52
|
+
# filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `updated_at`.
|
|
53
|
+
# filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `updated_at`.
|
|
54
|
+
# filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `updated_at`.
|
|
55
|
+
# filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `updated_at`.
|
|
56
|
+
def list(params=None, options=None):
|
|
57
|
+
if not isinstance(params, dict):
|
|
58
|
+
params = {}
|
|
59
|
+
if not isinstance(options, dict):
|
|
60
|
+
options = {}
|
|
61
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
62
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
63
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
64
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
65
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
66
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
67
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
68
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
69
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
70
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
71
|
+
if "filter_gt" in params and not isinstance(params["filter_gt"], dict):
|
|
72
|
+
raise InvalidParameterError("Bad parameter: filter_gt must be an dict")
|
|
73
|
+
if "filter_gteq" in params and not isinstance(params["filter_gteq"], dict):
|
|
74
|
+
raise InvalidParameterError(
|
|
75
|
+
"Bad parameter: filter_gteq must be an dict"
|
|
76
|
+
)
|
|
77
|
+
if "filter_lt" in params and not isinstance(params["filter_lt"], dict):
|
|
78
|
+
raise InvalidParameterError("Bad parameter: filter_lt must be an dict")
|
|
79
|
+
if "filter_lteq" in params and not isinstance(params["filter_lteq"], dict):
|
|
80
|
+
raise InvalidParameterError(
|
|
81
|
+
"Bad parameter: filter_lteq must be an dict"
|
|
82
|
+
)
|
|
83
|
+
return ListObj(UserCipherUse, "GET", "/user_cipher_uses", params, options)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def all(params=None, options=None):
|
|
87
|
+
list(params, options)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def new(*args, **kwargs):
|
|
91
|
+
return UserCipherUse(*args, **kwargs)
|
|
@@ -0,0 +1,355 @@
|
|
|
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 UserLifecycleRule:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - User Lifecycle Rule ID
|
|
14
|
+
"authentication_method": None, # string - User authentication method for which the rule will apply.
|
|
15
|
+
"group_ids": None, # array(int64) - Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
|
|
16
|
+
"action": None, # string - Action to take on inactive users (disable or delete)
|
|
17
|
+
"inactivity_days": None, # int64 - Number of days of inactivity before the rule applies
|
|
18
|
+
"include_folder_admins": None, # boolean - If true, the rule will apply to folder admins.
|
|
19
|
+
"include_site_admins": None, # boolean - If true, the rule will apply to site admins.
|
|
20
|
+
"name": None, # string - User Lifecycle Rule name
|
|
21
|
+
"partner_tag": None, # string - If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
22
|
+
"site_id": None, # int64 - Site ID
|
|
23
|
+
"user_state": None, # string - State of the users to apply the rule to (inactive or disabled)
|
|
24
|
+
"user_tag": None, # string - If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
def __init__(self, attributes=None, options=None):
|
|
28
|
+
if not isinstance(attributes, dict):
|
|
29
|
+
attributes = {}
|
|
30
|
+
if not isinstance(options, dict):
|
|
31
|
+
options = {}
|
|
32
|
+
self.set_attributes(attributes)
|
|
33
|
+
self.options = options
|
|
34
|
+
|
|
35
|
+
def set_attributes(self, attributes):
|
|
36
|
+
for (
|
|
37
|
+
attribute,
|
|
38
|
+
default_value,
|
|
39
|
+
) in UserLifecycleRule.default_attributes.items():
|
|
40
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
41
|
+
|
|
42
|
+
def get_attributes(self):
|
|
43
|
+
return {
|
|
44
|
+
k: getattr(self, k, None)
|
|
45
|
+
for k in UserLifecycleRule.default_attributes
|
|
46
|
+
if getattr(self, k, None) is not None
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# Parameters:
|
|
50
|
+
# action - string - Action to take on inactive users (disable or delete)
|
|
51
|
+
# authentication_method - string - User authentication method for which the rule will apply.
|
|
52
|
+
# group_ids - array(int64) - Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
|
|
53
|
+
# inactivity_days - int64 - Number of days of inactivity before the rule applies
|
|
54
|
+
# include_site_admins - boolean - If true, the rule will apply to site admins.
|
|
55
|
+
# include_folder_admins - boolean - If true, the rule will apply to folder admins.
|
|
56
|
+
# name - string - User Lifecycle Rule name
|
|
57
|
+
# partner_tag - string - If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
58
|
+
# user_state - string - State of the users to apply the rule to (inactive or disabled)
|
|
59
|
+
# user_tag - string - If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
60
|
+
def update(self, params=None):
|
|
61
|
+
if not isinstance(params, dict):
|
|
62
|
+
params = {}
|
|
63
|
+
|
|
64
|
+
if hasattr(self, "id") and self.id:
|
|
65
|
+
params["id"] = self.id
|
|
66
|
+
else:
|
|
67
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
68
|
+
if "id" not in params:
|
|
69
|
+
raise MissingParameterError("Parameter missing: id")
|
|
70
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
71
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
72
|
+
if "action" in params and not isinstance(params["action"], str):
|
|
73
|
+
raise InvalidParameterError("Bad parameter: action must be an str")
|
|
74
|
+
if "authentication_method" in params and not isinstance(
|
|
75
|
+
params["authentication_method"], str
|
|
76
|
+
):
|
|
77
|
+
raise InvalidParameterError(
|
|
78
|
+
"Bad parameter: authentication_method must be an str"
|
|
79
|
+
)
|
|
80
|
+
if "group_ids" in params and not isinstance(
|
|
81
|
+
params["group_ids"], builtins.list
|
|
82
|
+
):
|
|
83
|
+
raise InvalidParameterError(
|
|
84
|
+
"Bad parameter: group_ids must be an list"
|
|
85
|
+
)
|
|
86
|
+
if "inactivity_days" in params and not isinstance(
|
|
87
|
+
params["inactivity_days"], int
|
|
88
|
+
):
|
|
89
|
+
raise InvalidParameterError(
|
|
90
|
+
"Bad parameter: inactivity_days must be an int"
|
|
91
|
+
)
|
|
92
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
93
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
94
|
+
if "partner_tag" in params and not isinstance(
|
|
95
|
+
params["partner_tag"], str
|
|
96
|
+
):
|
|
97
|
+
raise InvalidParameterError(
|
|
98
|
+
"Bad parameter: partner_tag must be an str"
|
|
99
|
+
)
|
|
100
|
+
if "user_state" in params and not isinstance(
|
|
101
|
+
params["user_state"], str
|
|
102
|
+
):
|
|
103
|
+
raise InvalidParameterError(
|
|
104
|
+
"Bad parameter: user_state must be an str"
|
|
105
|
+
)
|
|
106
|
+
if "user_tag" in params and not isinstance(params["user_tag"], str):
|
|
107
|
+
raise InvalidParameterError(
|
|
108
|
+
"Bad parameter: user_tag must be an str"
|
|
109
|
+
)
|
|
110
|
+
response, _options = Api.send_request(
|
|
111
|
+
"PATCH",
|
|
112
|
+
"/user_lifecycle_rules/{id}".format(id=params["id"]),
|
|
113
|
+
params,
|
|
114
|
+
self.options,
|
|
115
|
+
)
|
|
116
|
+
return response.data
|
|
117
|
+
|
|
118
|
+
def delete(self, params=None):
|
|
119
|
+
if not isinstance(params, dict):
|
|
120
|
+
params = {}
|
|
121
|
+
|
|
122
|
+
if hasattr(self, "id") and self.id:
|
|
123
|
+
params["id"] = self.id
|
|
124
|
+
else:
|
|
125
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
126
|
+
if "id" not in params:
|
|
127
|
+
raise MissingParameterError("Parameter missing: id")
|
|
128
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
129
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
130
|
+
Api.send_request(
|
|
131
|
+
"DELETE",
|
|
132
|
+
"/user_lifecycle_rules/{id}".format(id=params["id"]),
|
|
133
|
+
params,
|
|
134
|
+
self.options,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
def destroy(self, params=None):
|
|
138
|
+
self.delete(params)
|
|
139
|
+
|
|
140
|
+
def save(self):
|
|
141
|
+
if hasattr(self, "id") and self.id:
|
|
142
|
+
new_obj = self.update(self.get_attributes())
|
|
143
|
+
self.set_attributes(new_obj.get_attributes())
|
|
144
|
+
return True
|
|
145
|
+
else:
|
|
146
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
147
|
+
self.set_attributes(new_obj.get_attributes())
|
|
148
|
+
return True
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# Parameters:
|
|
152
|
+
# 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.
|
|
153
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
154
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`.
|
|
155
|
+
def list(params=None, options=None):
|
|
156
|
+
if not isinstance(params, dict):
|
|
157
|
+
params = {}
|
|
158
|
+
if not isinstance(options, dict):
|
|
159
|
+
options = {}
|
|
160
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
161
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
162
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
163
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
164
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
165
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
166
|
+
return ListObj(
|
|
167
|
+
UserLifecycleRule, "GET", "/user_lifecycle_rules", params, options
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def all(params=None, options=None):
|
|
172
|
+
list(params, options)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
# Parameters:
|
|
176
|
+
# id (required) - int64 - User Lifecycle Rule ID.
|
|
177
|
+
def find(id, params=None, options=None):
|
|
178
|
+
if not isinstance(params, dict):
|
|
179
|
+
params = {}
|
|
180
|
+
if not isinstance(options, dict):
|
|
181
|
+
options = {}
|
|
182
|
+
params["id"] = id
|
|
183
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
184
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
185
|
+
if "id" not in params:
|
|
186
|
+
raise MissingParameterError("Parameter missing: id")
|
|
187
|
+
response, options = Api.send_request(
|
|
188
|
+
"GET",
|
|
189
|
+
"/user_lifecycle_rules/{id}".format(id=params["id"]),
|
|
190
|
+
params,
|
|
191
|
+
options,
|
|
192
|
+
)
|
|
193
|
+
return UserLifecycleRule(response.data, options)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def get(id, params=None, options=None):
|
|
197
|
+
find(id, params, options)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
# Parameters:
|
|
201
|
+
# action - string - Action to take on inactive users (disable or delete)
|
|
202
|
+
# authentication_method - string - User authentication method for which the rule will apply.
|
|
203
|
+
# group_ids - array(int64) - Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
|
|
204
|
+
# inactivity_days - int64 - Number of days of inactivity before the rule applies
|
|
205
|
+
# include_site_admins - boolean - If true, the rule will apply to site admins.
|
|
206
|
+
# include_folder_admins - boolean - If true, the rule will apply to folder admins.
|
|
207
|
+
# name - string - User Lifecycle Rule name
|
|
208
|
+
# partner_tag - string - If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
209
|
+
# user_state - string - State of the users to apply the rule to (inactive or disabled)
|
|
210
|
+
# user_tag - string - If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
211
|
+
def create(params=None, options=None):
|
|
212
|
+
if not isinstance(params, dict):
|
|
213
|
+
params = {}
|
|
214
|
+
if not isinstance(options, dict):
|
|
215
|
+
options = {}
|
|
216
|
+
if "action" in params and not isinstance(params["action"], str):
|
|
217
|
+
raise InvalidParameterError("Bad parameter: action must be an str")
|
|
218
|
+
if "authentication_method" in params and not isinstance(
|
|
219
|
+
params["authentication_method"], str
|
|
220
|
+
):
|
|
221
|
+
raise InvalidParameterError(
|
|
222
|
+
"Bad parameter: authentication_method must be an str"
|
|
223
|
+
)
|
|
224
|
+
if "group_ids" in params and not isinstance(
|
|
225
|
+
params["group_ids"], builtins.list
|
|
226
|
+
):
|
|
227
|
+
raise InvalidParameterError("Bad parameter: group_ids must be an list")
|
|
228
|
+
if "inactivity_days" in params and not isinstance(
|
|
229
|
+
params["inactivity_days"], int
|
|
230
|
+
):
|
|
231
|
+
raise InvalidParameterError(
|
|
232
|
+
"Bad parameter: inactivity_days must be an int"
|
|
233
|
+
)
|
|
234
|
+
if "include_site_admins" in params and not isinstance(
|
|
235
|
+
params["include_site_admins"], bool
|
|
236
|
+
):
|
|
237
|
+
raise InvalidParameterError(
|
|
238
|
+
"Bad parameter: include_site_admins must be an bool"
|
|
239
|
+
)
|
|
240
|
+
if "include_folder_admins" in params and not isinstance(
|
|
241
|
+
params["include_folder_admins"], bool
|
|
242
|
+
):
|
|
243
|
+
raise InvalidParameterError(
|
|
244
|
+
"Bad parameter: include_folder_admins must be an bool"
|
|
245
|
+
)
|
|
246
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
247
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
248
|
+
if "partner_tag" in params and not isinstance(params["partner_tag"], str):
|
|
249
|
+
raise InvalidParameterError(
|
|
250
|
+
"Bad parameter: partner_tag must be an str"
|
|
251
|
+
)
|
|
252
|
+
if "user_state" in params and not isinstance(params["user_state"], str):
|
|
253
|
+
raise InvalidParameterError("Bad parameter: user_state must be an str")
|
|
254
|
+
if "user_tag" in params and not isinstance(params["user_tag"], str):
|
|
255
|
+
raise InvalidParameterError("Bad parameter: user_tag must be an str")
|
|
256
|
+
response, options = Api.send_request(
|
|
257
|
+
"POST", "/user_lifecycle_rules", params, options
|
|
258
|
+
)
|
|
259
|
+
return UserLifecycleRule(response.data, options)
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
# Parameters:
|
|
263
|
+
# action - string - Action to take on inactive users (disable or delete)
|
|
264
|
+
# authentication_method - string - User authentication method for which the rule will apply.
|
|
265
|
+
# group_ids - array(int64) - Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
|
|
266
|
+
# inactivity_days - int64 - Number of days of inactivity before the rule applies
|
|
267
|
+
# include_site_admins - boolean - If true, the rule will apply to site admins.
|
|
268
|
+
# include_folder_admins - boolean - If true, the rule will apply to folder admins.
|
|
269
|
+
# name - string - User Lifecycle Rule name
|
|
270
|
+
# partner_tag - string - If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
271
|
+
# user_state - string - State of the users to apply the rule to (inactive or disabled)
|
|
272
|
+
# user_tag - string - If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
273
|
+
def update(id, params=None, options=None):
|
|
274
|
+
if not isinstance(params, dict):
|
|
275
|
+
params = {}
|
|
276
|
+
if not isinstance(options, dict):
|
|
277
|
+
options = {}
|
|
278
|
+
params["id"] = id
|
|
279
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
280
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
281
|
+
if "action" in params and not isinstance(params["action"], str):
|
|
282
|
+
raise InvalidParameterError("Bad parameter: action must be an str")
|
|
283
|
+
if "authentication_method" in params and not isinstance(
|
|
284
|
+
params["authentication_method"], str
|
|
285
|
+
):
|
|
286
|
+
raise InvalidParameterError(
|
|
287
|
+
"Bad parameter: authentication_method must be an str"
|
|
288
|
+
)
|
|
289
|
+
if "group_ids" in params and not isinstance(
|
|
290
|
+
params["group_ids"], builtins.list
|
|
291
|
+
):
|
|
292
|
+
raise InvalidParameterError("Bad parameter: group_ids must be an list")
|
|
293
|
+
if "inactivity_days" in params and not isinstance(
|
|
294
|
+
params["inactivity_days"], int
|
|
295
|
+
):
|
|
296
|
+
raise InvalidParameterError(
|
|
297
|
+
"Bad parameter: inactivity_days must be an int"
|
|
298
|
+
)
|
|
299
|
+
if "include_site_admins" in params and not isinstance(
|
|
300
|
+
params["include_site_admins"], bool
|
|
301
|
+
):
|
|
302
|
+
raise InvalidParameterError(
|
|
303
|
+
"Bad parameter: include_site_admins must be an bool"
|
|
304
|
+
)
|
|
305
|
+
if "include_folder_admins" in params and not isinstance(
|
|
306
|
+
params["include_folder_admins"], bool
|
|
307
|
+
):
|
|
308
|
+
raise InvalidParameterError(
|
|
309
|
+
"Bad parameter: include_folder_admins must be an bool"
|
|
310
|
+
)
|
|
311
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
312
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
313
|
+
if "partner_tag" in params and not isinstance(params["partner_tag"], str):
|
|
314
|
+
raise InvalidParameterError(
|
|
315
|
+
"Bad parameter: partner_tag must be an str"
|
|
316
|
+
)
|
|
317
|
+
if "user_state" in params and not isinstance(params["user_state"], str):
|
|
318
|
+
raise InvalidParameterError("Bad parameter: user_state must be an str")
|
|
319
|
+
if "user_tag" in params and not isinstance(params["user_tag"], str):
|
|
320
|
+
raise InvalidParameterError("Bad parameter: user_tag must be an str")
|
|
321
|
+
if "id" not in params:
|
|
322
|
+
raise MissingParameterError("Parameter missing: id")
|
|
323
|
+
response, options = Api.send_request(
|
|
324
|
+
"PATCH",
|
|
325
|
+
"/user_lifecycle_rules/{id}".format(id=params["id"]),
|
|
326
|
+
params,
|
|
327
|
+
options,
|
|
328
|
+
)
|
|
329
|
+
return UserLifecycleRule(response.data, options)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def delete(id, params=None, options=None):
|
|
333
|
+
if not isinstance(params, dict):
|
|
334
|
+
params = {}
|
|
335
|
+
if not isinstance(options, dict):
|
|
336
|
+
options = {}
|
|
337
|
+
params["id"] = id
|
|
338
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
339
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
340
|
+
if "id" not in params:
|
|
341
|
+
raise MissingParameterError("Parameter missing: id")
|
|
342
|
+
Api.send_request(
|
|
343
|
+
"DELETE",
|
|
344
|
+
"/user_lifecycle_rules/{id}".format(id=params["id"]),
|
|
345
|
+
params,
|
|
346
|
+
options,
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def destroy(id, params=None, options=None):
|
|
351
|
+
delete(id, params, options)
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
def new(*args, **kwargs):
|
|
355
|
+
return UserLifecycleRule(*args, **kwargs)
|
|
@@ -0,0 +1,166 @@
|
|
|
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 UserRequest:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - ID
|
|
14
|
+
"name": None, # string - User's full name
|
|
15
|
+
"email": None, # email - User email address
|
|
16
|
+
"details": None, # string - Details of the user's request
|
|
17
|
+
"company": None, # string - User's company name
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
def __init__(self, attributes=None, options=None):
|
|
21
|
+
if not isinstance(attributes, dict):
|
|
22
|
+
attributes = {}
|
|
23
|
+
if not isinstance(options, dict):
|
|
24
|
+
options = {}
|
|
25
|
+
self.set_attributes(attributes)
|
|
26
|
+
self.options = options
|
|
27
|
+
|
|
28
|
+
def set_attributes(self, attributes):
|
|
29
|
+
for attribute, default_value in UserRequest.default_attributes.items():
|
|
30
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
31
|
+
|
|
32
|
+
def get_attributes(self):
|
|
33
|
+
return {
|
|
34
|
+
k: getattr(self, k, None)
|
|
35
|
+
for k in UserRequest.default_attributes
|
|
36
|
+
if getattr(self, k, None) is not None
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
def delete(self, params=None):
|
|
40
|
+
if not isinstance(params, dict):
|
|
41
|
+
params = {}
|
|
42
|
+
|
|
43
|
+
if hasattr(self, "id") and self.id:
|
|
44
|
+
params["id"] = self.id
|
|
45
|
+
else:
|
|
46
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
47
|
+
if "id" not in params:
|
|
48
|
+
raise MissingParameterError("Parameter missing: id")
|
|
49
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
50
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
51
|
+
Api.send_request(
|
|
52
|
+
"DELETE",
|
|
53
|
+
"/user_requests/{id}".format(id=params["id"]),
|
|
54
|
+
params,
|
|
55
|
+
self.options,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def destroy(self, params=None):
|
|
59
|
+
self.delete(params)
|
|
60
|
+
|
|
61
|
+
def save(self):
|
|
62
|
+
if hasattr(self, "id") and self.id:
|
|
63
|
+
raise NotImplementedError(
|
|
64
|
+
"The UserRequest object doesn't support updates."
|
|
65
|
+
)
|
|
66
|
+
else:
|
|
67
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
68
|
+
self.set_attributes(new_obj.get_attributes())
|
|
69
|
+
return True
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
# Parameters:
|
|
73
|
+
# 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.
|
|
74
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
75
|
+
def list(params=None, options=None):
|
|
76
|
+
if not isinstance(params, dict):
|
|
77
|
+
params = {}
|
|
78
|
+
if not isinstance(options, dict):
|
|
79
|
+
options = {}
|
|
80
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
81
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
82
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
83
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
84
|
+
return ListObj(UserRequest, "GET", "/user_requests", params, options)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def all(params=None, options=None):
|
|
88
|
+
list(params, options)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# Parameters:
|
|
92
|
+
# id (required) - int64 - User Request ID.
|
|
93
|
+
def find(id, params=None, options=None):
|
|
94
|
+
if not isinstance(params, dict):
|
|
95
|
+
params = {}
|
|
96
|
+
if not isinstance(options, dict):
|
|
97
|
+
options = {}
|
|
98
|
+
params["id"] = id
|
|
99
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
100
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
101
|
+
if "id" not in params:
|
|
102
|
+
raise MissingParameterError("Parameter missing: id")
|
|
103
|
+
response, options = Api.send_request(
|
|
104
|
+
"GET", "/user_requests/{id}".format(id=params["id"]), params, options
|
|
105
|
+
)
|
|
106
|
+
return UserRequest(response.data, options)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def get(id, params=None, options=None):
|
|
110
|
+
find(id, params, options)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# Parameters:
|
|
114
|
+
# name (required) - string - Name of user requested
|
|
115
|
+
# email (required) - string - Email of user requested
|
|
116
|
+
# details (required) - string - Details of the user request
|
|
117
|
+
# company - string - Company of the user requested
|
|
118
|
+
def create(params=None, options=None):
|
|
119
|
+
if not isinstance(params, dict):
|
|
120
|
+
params = {}
|
|
121
|
+
if not isinstance(options, dict):
|
|
122
|
+
options = {}
|
|
123
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
124
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
125
|
+
if "email" in params and not isinstance(params["email"], str):
|
|
126
|
+
raise InvalidParameterError("Bad parameter: email must be an str")
|
|
127
|
+
if "details" in params and not isinstance(params["details"], str):
|
|
128
|
+
raise InvalidParameterError("Bad parameter: details must be an str")
|
|
129
|
+
if "company" in params and not isinstance(params["company"], str):
|
|
130
|
+
raise InvalidParameterError("Bad parameter: company must be an str")
|
|
131
|
+
if "name" not in params:
|
|
132
|
+
raise MissingParameterError("Parameter missing: name")
|
|
133
|
+
if "email" not in params:
|
|
134
|
+
raise MissingParameterError("Parameter missing: email")
|
|
135
|
+
if "details" not in params:
|
|
136
|
+
raise MissingParameterError("Parameter missing: details")
|
|
137
|
+
response, options = Api.send_request(
|
|
138
|
+
"POST", "/user_requests", params, options
|
|
139
|
+
)
|
|
140
|
+
return UserRequest(response.data, options)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def delete(id, params=None, options=None):
|
|
144
|
+
if not isinstance(params, dict):
|
|
145
|
+
params = {}
|
|
146
|
+
if not isinstance(options, dict):
|
|
147
|
+
options = {}
|
|
148
|
+
params["id"] = id
|
|
149
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
150
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
151
|
+
if "id" not in params:
|
|
152
|
+
raise MissingParameterError("Parameter missing: id")
|
|
153
|
+
Api.send_request(
|
|
154
|
+
"DELETE",
|
|
155
|
+
"/user_requests/{id}".format(id=params["id"]),
|
|
156
|
+
params,
|
|
157
|
+
options,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def destroy(id, params=None, options=None):
|
|
162
|
+
delete(id, params, options)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def new(*args, **kwargs):
|
|
166
|
+
return UserRequest(*args, **kwargs)
|
|
@@ -0,0 +1,68 @@
|
|
|
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 UserSftpClientUse:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - UserSftpClientUse ID
|
|
14
|
+
"sftp_client": None, # string - The SFTP client used
|
|
15
|
+
"created_at": None, # date-time - The earliest recorded use of this SFTP client (for this user)
|
|
16
|
+
"updated_at": None, # date-time - The most recent use of this SFTP client (for this user)
|
|
17
|
+
"user_id": None, # int64 - ID of the user who performed this access
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
def __init__(self, attributes=None, options=None):
|
|
21
|
+
if not isinstance(attributes, dict):
|
|
22
|
+
attributes = {}
|
|
23
|
+
if not isinstance(options, dict):
|
|
24
|
+
options = {}
|
|
25
|
+
self.set_attributes(attributes)
|
|
26
|
+
self.options = options
|
|
27
|
+
|
|
28
|
+
def set_attributes(self, attributes):
|
|
29
|
+
for (
|
|
30
|
+
attribute,
|
|
31
|
+
default_value,
|
|
32
|
+
) in UserSftpClientUse.default_attributes.items():
|
|
33
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
34
|
+
|
|
35
|
+
def get_attributes(self):
|
|
36
|
+
return {
|
|
37
|
+
k: getattr(self, k, None)
|
|
38
|
+
for k in UserSftpClientUse.default_attributes
|
|
39
|
+
if getattr(self, k, None) is not None
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Parameters:
|
|
44
|
+
# user_id - int64 - User ID. If provided, will return uses for this user.
|
|
45
|
+
# 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.
|
|
46
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
47
|
+
def list(params=None, options=None):
|
|
48
|
+
if not isinstance(params, dict):
|
|
49
|
+
params = {}
|
|
50
|
+
if not isinstance(options, dict):
|
|
51
|
+
options = {}
|
|
52
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
53
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
54
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
55
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
56
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
57
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
58
|
+
return ListObj(
|
|
59
|
+
UserSftpClientUse, "GET", "/user_sftp_client_uses", params, options
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def all(params=None, options=None):
|
|
64
|
+
list(params, options)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def new(*args, **kwargs):
|
|
68
|
+
return UserSftpClientUse(*args, **kwargs)
|