files-com 1.6.137__py3-none-any.whl → 1.6.164__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.
@@ -0,0 +1,240 @@
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 KeyLifecycleRule:
12
+ default_attributes = {
13
+ "id": None, # int64 - Key Lifecycle Rule ID
14
+ "key_type": None, # string - Key type for which the rule will apply (gpg or ssh).
15
+ "inactivity_days": None, # int64 - Number of days of inactivity before the rule applies.
16
+ "name": None, # string - Key Lifecycle Rule name
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 (
29
+ attribute,
30
+ default_value,
31
+ ) in KeyLifecycleRule.default_attributes.items():
32
+ setattr(self, attribute, attributes.get(attribute, default_value))
33
+
34
+ def get_attributes(self):
35
+ return {
36
+ k: getattr(self, k, None)
37
+ for k in KeyLifecycleRule.default_attributes
38
+ if getattr(self, k, None) is not None
39
+ }
40
+
41
+ # Parameters:
42
+ # key_type - string - Key type for which the rule will apply (gpg or ssh).
43
+ # inactivity_days - int64 - Number of days of inactivity before the rule applies.
44
+ # name - string - Key Lifecycle Rule name
45
+ def update(self, params=None):
46
+ if not isinstance(params, dict):
47
+ params = {}
48
+
49
+ if hasattr(self, "id") and self.id:
50
+ params["id"] = self.id
51
+ else:
52
+ raise MissingParameterError("Current object doesn't have a id")
53
+ if "id" not in params:
54
+ raise MissingParameterError("Parameter missing: id")
55
+ if "id" in params and not isinstance(params["id"], int):
56
+ raise InvalidParameterError("Bad parameter: id must be an int")
57
+ if "key_type" in params and not isinstance(params["key_type"], str):
58
+ raise InvalidParameterError(
59
+ "Bad parameter: key_type must be an str"
60
+ )
61
+ if "inactivity_days" in params and not isinstance(
62
+ params["inactivity_days"], int
63
+ ):
64
+ raise InvalidParameterError(
65
+ "Bad parameter: inactivity_days must be an int"
66
+ )
67
+ if "name" in params and not isinstance(params["name"], str):
68
+ raise InvalidParameterError("Bad parameter: name must be an str")
69
+ response, _options = Api.send_request(
70
+ "PATCH",
71
+ "/key_lifecycle_rules/{id}".format(id=params["id"]),
72
+ params,
73
+ self.options,
74
+ )
75
+ return response.data
76
+
77
+ def delete(self, params=None):
78
+ if not isinstance(params, dict):
79
+ params = {}
80
+
81
+ if hasattr(self, "id") and self.id:
82
+ params["id"] = self.id
83
+ else:
84
+ raise MissingParameterError("Current object doesn't have a id")
85
+ if "id" not in params:
86
+ raise MissingParameterError("Parameter missing: id")
87
+ if "id" in params and not isinstance(params["id"], int):
88
+ raise InvalidParameterError("Bad parameter: id must be an int")
89
+ Api.send_request(
90
+ "DELETE",
91
+ "/key_lifecycle_rules/{id}".format(id=params["id"]),
92
+ params,
93
+ self.options,
94
+ )
95
+
96
+ def destroy(self, params=None):
97
+ self.delete(params)
98
+
99
+ def save(self):
100
+ if hasattr(self, "id") and self.id:
101
+ new_obj = self.update(self.get_attributes())
102
+ self.set_attributes(new_obj.get_attributes())
103
+ return True
104
+ else:
105
+ new_obj = create(self.get_attributes(), self.options)
106
+ self.set_attributes(new_obj.get_attributes())
107
+ return True
108
+
109
+
110
+ # Parameters:
111
+ # 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.
112
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
113
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are .
114
+ def list(params=None, options=None):
115
+ if not isinstance(params, dict):
116
+ params = {}
117
+ if not isinstance(options, dict):
118
+ options = {}
119
+ if "cursor" in params and not isinstance(params["cursor"], str):
120
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
121
+ if "per_page" in params and not isinstance(params["per_page"], int):
122
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
123
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
124
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
125
+ return ListObj(
126
+ KeyLifecycleRule, "GET", "/key_lifecycle_rules", params, options
127
+ )
128
+
129
+
130
+ def all(params=None, options=None):
131
+ list(params, options)
132
+
133
+
134
+ # Parameters:
135
+ # id (required) - int64 - Key Lifecycle Rule ID.
136
+ def find(id, params=None, options=None):
137
+ if not isinstance(params, dict):
138
+ params = {}
139
+ if not isinstance(options, dict):
140
+ options = {}
141
+ params["id"] = id
142
+ if "id" in params and not isinstance(params["id"], int):
143
+ raise InvalidParameterError("Bad parameter: id must be an int")
144
+ if "id" not in params:
145
+ raise MissingParameterError("Parameter missing: id")
146
+ response, options = Api.send_request(
147
+ "GET",
148
+ "/key_lifecycle_rules/{id}".format(id=params["id"]),
149
+ params,
150
+ options,
151
+ )
152
+ return KeyLifecycleRule(response.data, options)
153
+
154
+
155
+ def get(id, params=None, options=None):
156
+ find(id, params, options)
157
+
158
+
159
+ # Parameters:
160
+ # key_type - string - Key type for which the rule will apply (gpg or ssh).
161
+ # inactivity_days - int64 - Number of days of inactivity before the rule applies.
162
+ # name - string - Key Lifecycle Rule name
163
+ def create(params=None, options=None):
164
+ if not isinstance(params, dict):
165
+ params = {}
166
+ if not isinstance(options, dict):
167
+ options = {}
168
+ if "key_type" in params and not isinstance(params["key_type"], str):
169
+ raise InvalidParameterError("Bad parameter: key_type must be an str")
170
+ if "inactivity_days" in params and not isinstance(
171
+ params["inactivity_days"], int
172
+ ):
173
+ raise InvalidParameterError(
174
+ "Bad parameter: inactivity_days must be an int"
175
+ )
176
+ if "name" in params and not isinstance(params["name"], str):
177
+ raise InvalidParameterError("Bad parameter: name must be an str")
178
+ response, options = Api.send_request(
179
+ "POST", "/key_lifecycle_rules", params, options
180
+ )
181
+ return KeyLifecycleRule(response.data, options)
182
+
183
+
184
+ # Parameters:
185
+ # key_type - string - Key type for which the rule will apply (gpg or ssh).
186
+ # inactivity_days - int64 - Number of days of inactivity before the rule applies.
187
+ # name - string - Key Lifecycle Rule name
188
+ def update(id, params=None, options=None):
189
+ if not isinstance(params, dict):
190
+ params = {}
191
+ if not isinstance(options, dict):
192
+ options = {}
193
+ params["id"] = id
194
+ if "id" in params and not isinstance(params["id"], int):
195
+ raise InvalidParameterError("Bad parameter: id must be an int")
196
+ if "key_type" in params and not isinstance(params["key_type"], str):
197
+ raise InvalidParameterError("Bad parameter: key_type must be an str")
198
+ if "inactivity_days" in params and not isinstance(
199
+ params["inactivity_days"], int
200
+ ):
201
+ raise InvalidParameterError(
202
+ "Bad parameter: inactivity_days must be an int"
203
+ )
204
+ if "name" in params and not isinstance(params["name"], str):
205
+ raise InvalidParameterError("Bad parameter: name must be an str")
206
+ if "id" not in params:
207
+ raise MissingParameterError("Parameter missing: id")
208
+ response, options = Api.send_request(
209
+ "PATCH",
210
+ "/key_lifecycle_rules/{id}".format(id=params["id"]),
211
+ params,
212
+ options,
213
+ )
214
+ return KeyLifecycleRule(response.data, options)
215
+
216
+
217
+ def delete(id, params=None, options=None):
218
+ if not isinstance(params, dict):
219
+ params = {}
220
+ if not isinstance(options, dict):
221
+ options = {}
222
+ params["id"] = id
223
+ if "id" in params and not isinstance(params["id"], int):
224
+ raise InvalidParameterError("Bad parameter: id must be an int")
225
+ if "id" not in params:
226
+ raise MissingParameterError("Parameter missing: id")
227
+ Api.send_request(
228
+ "DELETE",
229
+ "/key_lifecycle_rules/{id}".format(id=params["id"]),
230
+ params,
231
+ options,
232
+ )
233
+
234
+
235
+ def destroy(id, params=None, options=None):
236
+ delete(id, params, options)
237
+
238
+
239
+ def new(*args, **kwargs):
240
+ return KeyLifecycleRule(*args, **kwargs)
@@ -1,4 +1,5 @@
1
1
  import builtins # noqa: F401
2
+ from files_sdk.models.agent_push_update import AgentPushUpdate
2
3
  from files_sdk.models.remote_server_configuration_file import (
3
4
  RemoteServerConfigurationFile,
4
5
  )
@@ -20,11 +21,12 @@ class RemoteServer:
20
21
  "remote_home_path": None, # string - Initial home folder on remote server
21
22
  "name": None, # string - Internal name for your reference
22
23
  "description": None, # string - Internal description for your reference
23
- "port": None, # int64 - Port for remote server. Not needed for S3.
24
+ "port": None, # int64 - Port for remote server.
24
25
  "buffer_uploads": None, # string - If set to always, uploads to this server will be uploaded first to Files.com before being sent to the remote server. This can improve performance in certain access patterns, such as high-latency connections. It will cause data to be temporarily stored in Files.com. If set to auto, we will perform this optimization if we believe it to be a benefit in a given situation.
25
26
  "max_connections": None, # int64 - Max number of parallel connections. Ignored for S3 connections (we will parallelize these as much as possible).
26
27
  "pin_to_site_region": None, # boolean - If true, we will ensure that all communications with this remote server are made through the primary region of the site. This setting can also be overridden by a site-wide setting which will force it to true.
27
28
  "pinned_region": None, # string - If set, all communications with this remote server are made through the provided region.
29
+ "remote_server_credential_id": None, # int64 - ID of Remote Server Credential, if applicable.
28
30
  "s3_bucket": None, # string - S3 bucket name
29
31
  "s3_region": None, # string - S3 region
30
32
  "aws_access_key": None, # string - AWS Access Key.
@@ -32,7 +34,7 @@ class RemoteServer:
32
34
  "server_host_key": None, # string - Remote server SSH Host Key. If provided, we will require that the server host key matches the provided key. Uses OpenSSH format similar to what would go into ~/.ssh/known_hosts
33
35
  "server_type": None, # string - Remote server type.
34
36
  "ssl": None, # string - Should we require SSL?
35
- "username": None, # string - Remote server username. Not needed for S3 buckets.
37
+ "username": None, # string - Remote server username.
36
38
  "google_cloud_storage_bucket": None, # string - Google Cloud Storage: Bucket Name
37
39
  "google_cloud_storage_project_id": None, # string - Google Cloud Storage: Project ID
38
40
  "google_cloud_storage_s3_compatible_access_key": None, # string - Google Cloud Storage: S3-compatible Access Key.
@@ -60,6 +62,8 @@ class RemoteServer:
60
62
  "files_agent_root": None, # string - Agent local root path
61
63
  "files_agent_api_token": None, # string - Files Agent API Token
62
64
  "files_agent_version": None, # string - Files Agent version
65
+ "files_agent_up_to_date": None, # boolean - If true, the Files Agent is up to date.
66
+ "files_agent_latest_version": None, # string - Latest available Files Agent version
63
67
  "outbound_agent_id": None, # int64 - Route traffic to outbound on a files-agent
64
68
  "filebase_bucket": None, # string - Filebase: Bucket name
65
69
  "filebase_access_key": None, # string - Filebase: Access Key.
@@ -114,6 +118,27 @@ class RemoteServer:
114
118
  if getattr(self, k, None) is not None
115
119
  }
116
120
 
121
+ # Push update to Files Agent
122
+ def agent_push_update(self, params=None):
123
+ if not isinstance(params, dict):
124
+ params = {}
125
+
126
+ if hasattr(self, "id") and self.id:
127
+ params["id"] = self.id
128
+ else:
129
+ raise MissingParameterError("Current object doesn't have a id")
130
+ if "id" not in params:
131
+ raise MissingParameterError("Parameter missing: id")
132
+ if "id" in params and not isinstance(params["id"], int):
133
+ raise InvalidParameterError("Bad parameter: id must be an int")
134
+ response, _options = Api.send_request(
135
+ "POST",
136
+ "/remote_servers/{id}/agent_push_update".format(id=params["id"]),
137
+ params,
138
+ self.options,
139
+ )
140
+ return response.data
141
+
117
142
  # Post local changes, check in, and download configuration file (used by some Remote Server integrations, such as the Files.com Agent)
118
143
  #
119
144
  # Parameters:
@@ -250,7 +275,8 @@ class RemoteServer:
250
275
  # name - string - Internal name for your reference
251
276
  # one_drive_account_type - string - OneDrive: Either personal or business_other account types
252
277
  # pin_to_site_region - boolean - If true, we will ensure that all communications with this remote server are made through the primary region of the site. This setting can also be overridden by a site-wide setting which will force it to true.
253
- # port - int64 - Port for remote server. Not needed for S3.
278
+ # port - int64 - Port for remote server.
279
+ # remote_server_credential_id - int64 - ID of Remote Server Credential, if applicable.
254
280
  # s3_bucket - string - S3 bucket name
255
281
  # s3_compatible_access_key - string - S3-compatible: Access Key
256
282
  # s3_compatible_bucket - string - S3-compatible: Bucket name
@@ -261,7 +287,7 @@ class RemoteServer:
261
287
  # server_host_key - string - Remote server SSH Host Key. If provided, we will require that the server host key matches the provided key. Uses OpenSSH format similar to what would go into ~/.ssh/known_hosts
262
288
  # server_type - string - Remote server type.
263
289
  # ssl - string - Should we require SSL?
264
- # username - string - Remote server username. Not needed for S3 buckets.
290
+ # username - string - Remote server username.
265
291
  # wasabi_access_key - string - Wasabi: Access Key.
266
292
  # wasabi_bucket - string - Wasabi: Bucket name
267
293
  # wasabi_region - string - Wasabi: Region
@@ -568,6 +594,12 @@ class RemoteServer:
568
594
  )
569
595
  if "port" in params and not isinstance(params["port"], int):
570
596
  raise InvalidParameterError("Bad parameter: port must be an int")
597
+ if "remote_server_credential_id" in params and not isinstance(
598
+ params["remote_server_credential_id"], int
599
+ ):
600
+ raise InvalidParameterError(
601
+ "Bad parameter: remote_server_credential_id must be an int"
602
+ )
571
603
  if "s3_bucket" in params and not isinstance(params["s3_bucket"], str):
572
604
  raise InvalidParameterError(
573
605
  "Bad parameter: s3_bucket must be an str"
@@ -812,7 +844,8 @@ def find_configuration_file(id, params=None, options=None):
812
844
  # name - string - Internal name for your reference
813
845
  # one_drive_account_type - string - OneDrive: Either personal or business_other account types
814
846
  # pin_to_site_region - boolean - If true, we will ensure that all communications with this remote server are made through the primary region of the site. This setting can also be overridden by a site-wide setting which will force it to true.
815
- # port - int64 - Port for remote server. Not needed for S3.
847
+ # port - int64 - Port for remote server.
848
+ # remote_server_credential_id - int64 - ID of Remote Server Credential, if applicable.
816
849
  # s3_bucket - string - S3 bucket name
817
850
  # s3_compatible_access_key - string - S3-compatible: Access Key
818
851
  # s3_compatible_bucket - string - S3-compatible: Bucket name
@@ -823,7 +856,7 @@ def find_configuration_file(id, params=None, options=None):
823
856
  # server_host_key - string - Remote server SSH Host Key. If provided, we will require that the server host key matches the provided key. Uses OpenSSH format similar to what would go into ~/.ssh/known_hosts
824
857
  # server_type - string - Remote server type.
825
858
  # ssl - string - Should we require SSL?
826
- # username - string - Remote server username. Not needed for S3 buckets.
859
+ # username - string - Remote server username.
827
860
  # wasabi_access_key - string - Wasabi: Access Key.
828
861
  # wasabi_bucket - string - Wasabi: Bucket name
829
862
  # wasabi_region - string - Wasabi: Region
@@ -1145,6 +1178,12 @@ def create(params=None, options=None):
1145
1178
  )
1146
1179
  if "port" in params and not isinstance(params["port"], int):
1147
1180
  raise InvalidParameterError("Bad parameter: port must be an int")
1181
+ if "remote_server_credential_id" in params and not isinstance(
1182
+ params["remote_server_credential_id"], int
1183
+ ):
1184
+ raise InvalidParameterError(
1185
+ "Bad parameter: remote_server_credential_id must be an int"
1186
+ )
1148
1187
  if "s3_bucket" in params and not isinstance(params["s3_bucket"], str):
1149
1188
  raise InvalidParameterError("Bad parameter: s3_bucket must be an str")
1150
1189
  if "s3_compatible_access_key" in params and not isinstance(
@@ -1217,6 +1256,26 @@ def create(params=None, options=None):
1217
1256
  return RemoteServer(response.data, options)
1218
1257
 
1219
1258
 
1259
+ # Push update to Files Agent
1260
+ def agent_push_update(id, params=None, options=None):
1261
+ if not isinstance(params, dict):
1262
+ params = {}
1263
+ if not isinstance(options, dict):
1264
+ options = {}
1265
+ params["id"] = id
1266
+ if "id" in params and not isinstance(params["id"], int):
1267
+ raise InvalidParameterError("Bad parameter: id must be an int")
1268
+ if "id" not in params:
1269
+ raise MissingParameterError("Parameter missing: id")
1270
+ response, options = Api.send_request(
1271
+ "POST",
1272
+ "/remote_servers/{id}/agent_push_update".format(id=params["id"]),
1273
+ params,
1274
+ options,
1275
+ )
1276
+ return AgentPushUpdate(response.data, options)
1277
+
1278
+
1220
1279
  # Post local changes, check in, and download configuration file (used by some Remote Server integrations, such as the Files.com Agent)
1221
1280
  #
1222
1281
  # Parameters:
@@ -1340,7 +1399,8 @@ def configuration_file(id, params=None, options=None):
1340
1399
  # name - string - Internal name for your reference
1341
1400
  # one_drive_account_type - string - OneDrive: Either personal or business_other account types
1342
1401
  # pin_to_site_region - boolean - If true, we will ensure that all communications with this remote server are made through the primary region of the site. This setting can also be overridden by a site-wide setting which will force it to true.
1343
- # port - int64 - Port for remote server. Not needed for S3.
1402
+ # port - int64 - Port for remote server.
1403
+ # remote_server_credential_id - int64 - ID of Remote Server Credential, if applicable.
1344
1404
  # s3_bucket - string - S3 bucket name
1345
1405
  # s3_compatible_access_key - string - S3-compatible: Access Key
1346
1406
  # s3_compatible_bucket - string - S3-compatible: Bucket name
@@ -1351,7 +1411,7 @@ def configuration_file(id, params=None, options=None):
1351
1411
  # server_host_key - string - Remote server SSH Host Key. If provided, we will require that the server host key matches the provided key. Uses OpenSSH format similar to what would go into ~/.ssh/known_hosts
1352
1412
  # server_type - string - Remote server type.
1353
1413
  # ssl - string - Should we require SSL?
1354
- # username - string - Remote server username. Not needed for S3 buckets.
1414
+ # username - string - Remote server username.
1355
1415
  # wasabi_access_key - string - Wasabi: Access Key.
1356
1416
  # wasabi_bucket - string - Wasabi: Bucket name
1357
1417
  # wasabi_region - string - Wasabi: Region
@@ -1676,6 +1736,12 @@ def update(id, params=None, options=None):
1676
1736
  )
1677
1737
  if "port" in params and not isinstance(params["port"], int):
1678
1738
  raise InvalidParameterError("Bad parameter: port must be an int")
1739
+ if "remote_server_credential_id" in params and not isinstance(
1740
+ params["remote_server_credential_id"], int
1741
+ ):
1742
+ raise InvalidParameterError(
1743
+ "Bad parameter: remote_server_credential_id must be an int"
1744
+ )
1679
1745
  if "s3_bucket" in params and not isinstance(params["s3_bucket"], str):
1680
1746
  raise InvalidParameterError("Bad parameter: s3_bucket must be an str")
1681
1747
  if "s3_compatible_access_key" in params and not isinstance(