pangea-sdk 3.8.0b1__py3-none-any.whl → 5.4.0b1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pangea/__init__.py +1 -1
- pangea/asyncio/file_uploader.py +1 -1
- pangea/asyncio/request.py +56 -34
- pangea/asyncio/services/__init__.py +4 -0
- pangea/asyncio/services/ai_guard.py +75 -0
- pangea/asyncio/services/audit.py +192 -31
- pangea/asyncio/services/authn.py +187 -109
- pangea/asyncio/services/authz.py +285 -0
- pangea/asyncio/services/base.py +21 -2
- pangea/asyncio/services/embargo.py +2 -2
- pangea/asyncio/services/file_scan.py +24 -9
- pangea/asyncio/services/intel.py +108 -34
- pangea/asyncio/services/prompt_guard.py +73 -0
- pangea/asyncio/services/redact.py +72 -4
- pangea/asyncio/services/sanitize.py +217 -0
- pangea/asyncio/services/share.py +246 -73
- pangea/asyncio/services/vault.py +1710 -750
- pangea/crypto/rsa.py +135 -0
- pangea/deep_verify.py +7 -1
- pangea/dump_audit.py +9 -8
- pangea/request.py +87 -59
- pangea/response.py +49 -31
- pangea/services/__init__.py +4 -0
- pangea/services/ai_guard.py +128 -0
- pangea/services/audit/audit.py +205 -42
- pangea/services/audit/models.py +56 -8
- pangea/services/audit/signing.py +6 -5
- pangea/services/audit/util.py +3 -3
- pangea/services/authn/authn.py +140 -70
- pangea/services/authn/models.py +167 -11
- pangea/services/authz.py +400 -0
- pangea/services/base.py +39 -8
- pangea/services/embargo.py +2 -2
- pangea/services/file_scan.py +32 -15
- pangea/services/intel.py +157 -32
- pangea/services/prompt_guard.py +83 -0
- pangea/services/redact.py +152 -4
- pangea/services/sanitize.py +371 -0
- pangea/services/share/share.py +683 -107
- pangea/services/vault/models/asymmetric.py +120 -18
- pangea/services/vault/models/common.py +439 -141
- pangea/services/vault/models/keys.py +94 -0
- pangea/services/vault/models/secret.py +27 -3
- pangea/services/vault/models/symmetric.py +68 -22
- pangea/services/vault/vault.py +1690 -749
- pangea/tools.py +6 -7
- pangea/utils.py +16 -27
- pangea/verify_audit.py +270 -83
- {pangea_sdk-3.8.0b1.dist-info → pangea_sdk-5.4.0b1.dist-info}/METADATA +43 -35
- pangea_sdk-5.4.0b1.dist-info/RECORD +60 -0
- {pangea_sdk-3.8.0b1.dist-info → pangea_sdk-5.4.0b1.dist-info}/WHEEL +1 -1
- pangea_sdk-3.8.0b1.dist-info/RECORD +0 -50
pangea/services/share/share.py
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# Copyright 2022 Pangea Cyber Corporation
|
2
2
|
# Author: Pangea Cyber Corporation
|
3
|
+
from __future__ import annotations
|
4
|
+
|
3
5
|
import enum
|
4
6
|
import io
|
5
7
|
from typing import Dict, List, NewType, Optional, Tuple, Union
|
6
8
|
|
7
|
-
from
|
8
|
-
from .file_format import FileFormat
|
9
|
+
from pangea.config import PangeaConfig
|
9
10
|
from pangea.response import APIRequestModel, PangeaResponse, PangeaResponseResult, TransferMethod
|
11
|
+
from pangea.services.base import ServiceBase
|
12
|
+
from pangea.services.share.file_format import FileFormat
|
10
13
|
from pangea.utils import get_file_size, get_file_upload_params
|
11
14
|
|
12
15
|
Metadata = NewType("Metadata", Dict[str, str])
|
@@ -77,7 +80,7 @@ class ItemOrderBy(str, enum.Enum):
|
|
77
80
|
|
78
81
|
class ShareLinkOrderBy(str, enum.Enum):
|
79
82
|
ID = "id"
|
80
|
-
|
83
|
+
BUCKET_ID = "bucket_id"
|
81
84
|
TARGET = "target"
|
82
85
|
LINK_TYPE = "link_type"
|
83
86
|
ACCESS_COUNT = "access_count"
|
@@ -96,69 +99,225 @@ class ShareLinkOrderBy(str, enum.Enum):
|
|
96
99
|
|
97
100
|
class DeleteRequest(APIRequestModel):
|
98
101
|
id: Optional[str] = None
|
102
|
+
"""The ID of the object to delete."""
|
103
|
+
|
99
104
|
force: Optional[bool] = None
|
100
|
-
|
105
|
+
"""If true, delete a folder even if it's not empty. Deletes the contents of folder as well."""
|
106
|
+
|
107
|
+
bucket_id: Optional[str] = None
|
108
|
+
"""The bucket to use, if not the default."""
|
101
109
|
|
102
110
|
|
103
111
|
class ItemData(PangeaResponseResult):
|
104
|
-
id: str
|
105
|
-
type: str
|
106
|
-
name: str
|
107
|
-
created_at: str
|
108
|
-
updated_at: str
|
109
|
-
size: Optional[int] = None
|
110
112
|
billable_size: Optional[int] = None
|
111
|
-
|
112
|
-
|
113
|
-
|
113
|
+
"""The number of billable bytes (includes Metadata, Tags, etc.) for the object."""
|
114
|
+
|
115
|
+
created_at: str
|
116
|
+
"""The date and time the object was created."""
|
117
|
+
|
118
|
+
id: str
|
119
|
+
"""The ID of a stored object."""
|
120
|
+
|
114
121
|
md5: Optional[str] = None
|
122
|
+
"""The MD5 hash of the file contents. Cannot be written to."""
|
123
|
+
|
124
|
+
metadata: Optional[Metadata] = None
|
125
|
+
"""A set of string-based key/value pairs used to provide additional data about an object."""
|
126
|
+
|
127
|
+
metadata_protected: Optional[Metadata] = None
|
128
|
+
"""Protected (read-only) metadata."""
|
129
|
+
|
115
130
|
sha256: Optional[str] = None
|
131
|
+
"""The SHA256 hash of the file contents. Cannot be written to."""
|
132
|
+
|
116
133
|
sha512: Optional[str] = None
|
134
|
+
"""The SHA512 hash of the file contents. Cannot be written to."""
|
135
|
+
|
136
|
+
size: Optional[int] = None
|
137
|
+
"""The size of the object in bytes."""
|
138
|
+
|
139
|
+
tags: Optional[Tags] = None
|
140
|
+
"""A list of user-defined tags."""
|
141
|
+
|
142
|
+
tags_protected: Optional[Tags] = None
|
143
|
+
"""Protected (read-only) flags."""
|
144
|
+
|
145
|
+
type: str
|
146
|
+
"""The type of the item (file or dir). Cannot be written to."""
|
147
|
+
|
148
|
+
updated_at: str
|
149
|
+
"""The date and time the object was last updated."""
|
150
|
+
|
151
|
+
name: str
|
152
|
+
"""The name of the object."""
|
153
|
+
|
154
|
+
folder: str
|
155
|
+
"""The full path to the folder the object is stored in."""
|
156
|
+
|
117
157
|
parent_id: Optional[str] = None
|
158
|
+
"""The parent ID (a folder). Blanks means the root folder."""
|
159
|
+
|
160
|
+
external_bucket_key: Optional[str] = None
|
161
|
+
"""The key in the external bucket that contains this file."""
|
162
|
+
|
163
|
+
file_ttl: Optional[str] = None
|
164
|
+
"""The explicit file TTL setting for this object."""
|
165
|
+
|
166
|
+
file_ttl_effective: Optional[str] = None
|
167
|
+
"""
|
168
|
+
The effective file TTL setting for this object, either explicitly set or
|
169
|
+
inherited (see `file_ttl_from_id`.)
|
170
|
+
"""
|
171
|
+
|
172
|
+
file_ttl_from_id: Optional[str] = None
|
173
|
+
"""
|
174
|
+
The ID of the object the expiry / TTL is set from. Either a service
|
175
|
+
configuration, the object itself, or a parent folder.
|
176
|
+
"""
|
118
177
|
|
119
178
|
|
120
179
|
class DeleteResult(PangeaResponseResult):
|
121
180
|
count: int
|
181
|
+
"""Number of objects deleted."""
|
122
182
|
|
123
183
|
|
124
184
|
class FolderCreateRequest(APIRequestModel):
|
125
185
|
name: Optional[str] = None
|
186
|
+
"""The name of an object."""
|
187
|
+
|
188
|
+
file_ttl: Optional[str] = None
|
189
|
+
"""Duration until files within this folder are automatically deleted."""
|
190
|
+
|
126
191
|
metadata: Optional[Metadata] = None
|
192
|
+
"""A set of string-based key/value pairs used to provide additional data about an object."""
|
193
|
+
|
194
|
+
root_folder: Optional[str] = None
|
195
|
+
"""
|
196
|
+
The path of a root folder to restrict the operation to. Must resolve to
|
197
|
+
`root_id` if also set.
|
198
|
+
"""
|
199
|
+
|
200
|
+
root_id: Optional[str] = None
|
201
|
+
"""
|
202
|
+
The ID of a root folder to restrict the operation to. Must match
|
203
|
+
`root_folder` if also set.
|
204
|
+
"""
|
205
|
+
|
127
206
|
parent_id: Optional[str] = None
|
128
|
-
|
207
|
+
"""The ID of the parent folder. Must match `folder` if also set."""
|
208
|
+
|
209
|
+
folder: Optional[str] = None
|
210
|
+
"""The folder to place the folder in. Must match `parent_id` if also set."""
|
211
|
+
|
129
212
|
tags: Optional[Tags] = None
|
213
|
+
"""A list of user-defined tags"""
|
214
|
+
|
215
|
+
tenant_id: Optional[str] = None
|
216
|
+
"""A tenant to associate with this request"""
|
217
|
+
|
218
|
+
bucket_id: Optional[str] = None
|
219
|
+
"""The bucket to use, if not the default."""
|
130
220
|
|
131
221
|
|
132
222
|
class FolderCreateResult(PangeaResponseResult):
|
133
223
|
object: ItemData
|
224
|
+
"""Information on the created folder."""
|
134
225
|
|
135
226
|
|
136
227
|
class GetRequest(APIRequestModel):
|
137
228
|
id: Optional[str] = None
|
138
|
-
|
229
|
+
"""The ID of the object to retrieve."""
|
230
|
+
|
231
|
+
password: Optional[str] = None
|
232
|
+
"""If the file was protected with a password, the password to decrypt with."""
|
233
|
+
|
139
234
|
transfer_method: Optional[TransferMethod] = None
|
235
|
+
"""The requested transfer method for the file data."""
|
236
|
+
|
237
|
+
bucket_id: Optional[str] = None
|
238
|
+
"""The bucket to use, if not the default."""
|
239
|
+
|
240
|
+
tenant_id: Optional[str] = None
|
241
|
+
"""A tenant to associate with this request."""
|
140
242
|
|
141
243
|
|
142
244
|
class GetResult(PangeaResponseResult):
|
143
245
|
object: ItemData
|
246
|
+
"""File information."""
|
247
|
+
|
144
248
|
dest_url: Optional[str] = None
|
249
|
+
"""A URL where the file can be downloaded from. (transfer_method: dest-url)"""
|
145
250
|
|
146
251
|
|
147
252
|
class PutRequest(APIRequestModel):
|
253
|
+
transfer_method: Optional[TransferMethod] = None
|
254
|
+
"""The transfer method used to upload the file data."""
|
255
|
+
|
256
|
+
bucket_id: Optional[str] = None
|
257
|
+
"""The bucket to use, if not the default."""
|
258
|
+
|
259
|
+
size: Optional[int] = None
|
260
|
+
"""The size (in bytes) of the file. If the upload doesn't match, the call will fail."""
|
261
|
+
|
262
|
+
crc32c: Optional[str] = None
|
263
|
+
"""The hexadecimal-encoded CRC32C hash of the file data, which will be verified by the server if provided."""
|
264
|
+
|
265
|
+
sha256: Optional[str] = None
|
266
|
+
"""The SHA256 hash of the file data, which will be verified by the server if provided."""
|
267
|
+
|
268
|
+
md5: Optional[str] = None
|
269
|
+
"""The hexadecimal-encoded MD5 hash of the file data, which will be verified by the server if provided."""
|
270
|
+
|
148
271
|
name: Optional[str] = None
|
272
|
+
"""The name of the object to store."""
|
273
|
+
|
149
274
|
format: Optional[FileFormat] = None
|
275
|
+
"""The format of the file, which will be verified by the server if provided. Uploads not matching the supplied format will be rejected."""
|
276
|
+
|
150
277
|
metadata: Optional[Metadata] = None
|
278
|
+
"""A set of string-based key/value pairs used to provide additional data about an object."""
|
279
|
+
|
151
280
|
mimetype: Optional[str] = None
|
281
|
+
"""The MIME type of the file, which will be verified by the server if provided. Uploads not matching the supplied MIME type will be rejected."""
|
282
|
+
|
152
283
|
parent_id: Optional[str] = None
|
153
|
-
|
154
|
-
|
155
|
-
|
284
|
+
"""The parent ID of the object (a folder). Leave blank to keep in the root folder."""
|
285
|
+
|
286
|
+
folder: Optional[str] = None
|
287
|
+
"""The path to the parent folder. Leave blank for the root folder. Path must resolve to `parent_id` if also set."""
|
288
|
+
|
289
|
+
file_ttl: Optional[str] = None
|
290
|
+
"""The TTL before expiry for the file."""
|
291
|
+
|
292
|
+
password: Optional[str] = None
|
293
|
+
"""An optional password to protect the file with. Downloading the file will require this password."""
|
294
|
+
|
295
|
+
password_algorithm: Optional[str] = None
|
296
|
+
"""An optional password algorithm to protect the file with. See symmetric vault password_algorithm."""
|
297
|
+
|
298
|
+
root_folder: Optional[str] = None
|
299
|
+
"""
|
300
|
+
The path of a root folder to restrict the operation to. Must resolve to
|
301
|
+
`root_id` if also set.
|
302
|
+
"""
|
303
|
+
|
304
|
+
root_id: Optional[str] = None
|
305
|
+
"""
|
306
|
+
The ID of a root folder to restrict the operation to. Must match
|
307
|
+
`root_folder` if also set.
|
308
|
+
"""
|
309
|
+
|
156
310
|
sha1: Optional[str] = None
|
157
|
-
|
311
|
+
"""The hexadecimal-encoded SHA1 hash of the file data, which will be verified by the server if provided."""
|
312
|
+
|
158
313
|
sha512: Optional[str] = None
|
159
|
-
|
314
|
+
"""The hexadecimal-encoded SHA512 hash of the file data, which will be verified by the server if provided."""
|
315
|
+
|
160
316
|
tags: Optional[Tags] = None
|
161
|
-
|
317
|
+
"""A list of user-defined tags"""
|
318
|
+
|
319
|
+
tenant_id: Optional[str] = None
|
320
|
+
"""A tenant to associate with this request"""
|
162
321
|
|
163
322
|
|
164
323
|
class PutResult(PangeaResponseResult):
|
@@ -167,15 +326,70 @@ class PutResult(PangeaResponseResult):
|
|
167
326
|
|
168
327
|
class UpdateRequest(APIRequestModel):
|
169
328
|
id: Optional[str]
|
170
|
-
|
329
|
+
"""An identifier for the file to update."""
|
330
|
+
|
331
|
+
folder: Optional[str] = None
|
332
|
+
"""
|
333
|
+
Set the parent (folder). Leave blank for the root folder. Path must resolve
|
334
|
+
to `parent_id` if also set.
|
335
|
+
"""
|
336
|
+
|
171
337
|
add_metadata: Optional[Metadata] = None
|
172
|
-
|
173
|
-
|
338
|
+
"""A list of Metadata key/values to set in the object. If a provided key exists, the value will be replaced."""
|
339
|
+
|
340
|
+
add_password: Optional[str] = None
|
341
|
+
"""Protect the file with the supplied password."""
|
342
|
+
|
343
|
+
add_password_algorithm: Optional[str] = None
|
344
|
+
"""The algorithm to use to password protect the file."""
|
345
|
+
|
174
346
|
add_tags: Optional[Tags] = None
|
347
|
+
"""A list of Tags to add. It is not an error to provide a tag which already exists."""
|
348
|
+
|
349
|
+
file_ttl: Optional[str] = None
|
350
|
+
"""Set the file TTL."""
|
351
|
+
|
352
|
+
name: Optional[str] = None
|
353
|
+
"""Sets the object's Name."""
|
354
|
+
|
355
|
+
metadata: Optional[Metadata] = None
|
356
|
+
"""Set the object's metadata."""
|
357
|
+
|
358
|
+
remove_metadata: Optional[Metadata] = None
|
359
|
+
"""A list of metadata key/values to remove in the object. It is not an error for a provided key to not exist. If a provided key exists but doesn't match the provided value, it will not be removed."""
|
360
|
+
|
361
|
+
remove_password: Optional[str] = None
|
362
|
+
"""Remove the supplied password from the file."""
|
363
|
+
|
175
364
|
remove_tags: Optional[Tags] = None
|
176
|
-
tags
|
365
|
+
"""A list of tags to remove. It is not an error to provide a tag which is not present."""
|
366
|
+
|
367
|
+
root_folder: Optional[str] = None
|
368
|
+
"""
|
369
|
+
The path of a root folder to restrict the operation to. Must resolve to
|
370
|
+
`root_id` if also set.
|
371
|
+
"""
|
372
|
+
|
373
|
+
root_id: Optional[str] = None
|
374
|
+
"""
|
375
|
+
The ID of a root folder to restrict the operation to. Must match
|
376
|
+
`root_folder` if also set.
|
377
|
+
"""
|
378
|
+
|
177
379
|
parent_id: Optional[str] = None
|
380
|
+
"""Set the parent (folder) of the object. Can be an empty string for the root folder."""
|
381
|
+
|
382
|
+
tags: Optional[Tags] = None
|
383
|
+
"""Set the object's tags."""
|
384
|
+
|
385
|
+
tenant_id: Optional[str] = None
|
386
|
+
"""A tenant to associate with this request."""
|
387
|
+
|
178
388
|
updated_at: Optional[str] = None
|
389
|
+
"""The date and time the object was last updated. If included, the update will fail if this doesn't match the date and time of the last update for the object."""
|
390
|
+
|
391
|
+
bucket_id: Optional[str] = None
|
392
|
+
"""The bucket to use, if not the default."""
|
179
393
|
|
180
394
|
|
181
395
|
class UpdateResult(PangeaResponseResult):
|
@@ -183,49 +397,179 @@ class UpdateResult(PangeaResponseResult):
|
|
183
397
|
|
184
398
|
|
185
399
|
class FilterList(APIRequestModel):
|
186
|
-
|
400
|
+
created_at: Optional[str] = None
|
401
|
+
"""Only records where created_at equals this value."""
|
402
|
+
|
403
|
+
created_at__gt: Optional[str] = None
|
404
|
+
"""Only records where created_at is greater than this value."""
|
405
|
+
|
406
|
+
created_at__gte: Optional[str] = None
|
407
|
+
"""Only records where created_at is greater than or equal to this value."""
|
408
|
+
|
409
|
+
created_at__lt: Optional[str] = None
|
410
|
+
"""Only records where created_at is less than this value."""
|
411
|
+
|
412
|
+
created_at__lte: Optional[str] = None
|
413
|
+
"""Only records where created_at is less than or equal to this value."""
|
414
|
+
|
415
|
+
folder: Optional[str] = None
|
416
|
+
"""Only records where the object exists in the supplied parent folder path name."""
|
417
|
+
|
418
|
+
id: Optional[str] = None
|
419
|
+
"""Only records where id equals this value."""
|
420
|
+
|
421
|
+
id__in: Optional[List[str]] = None
|
422
|
+
"""Only records where id equals one of the provided substrings."""
|
423
|
+
|
424
|
+
name: Optional[str] = None
|
425
|
+
"""Only records where name equals this value."""
|
426
|
+
|
427
|
+
name__contains: Optional[List[str]] = None
|
428
|
+
"""Only records where name includes each substring."""
|
429
|
+
|
430
|
+
name__in: Optional[List[str]] = None
|
431
|
+
"""Only records where name equals one of the provided substrings."""
|
432
|
+
|
433
|
+
parent_id: Optional[str] = None
|
434
|
+
"""Only records where parent_id equals this value."""
|
435
|
+
|
436
|
+
parent_id__in: Optional[List[str]] = None
|
437
|
+
"""Only records where parent_id equals one of the provided substrings."""
|
438
|
+
|
439
|
+
size: Optional[int] = None
|
440
|
+
"""Only records where size equals this value."""
|
441
|
+
|
442
|
+
size__gt: Optional[int] = None
|
443
|
+
"""Only records where size is greater than this value."""
|
444
|
+
|
445
|
+
size__gte: Optional[int] = None
|
446
|
+
"""Only records where size is greater than or equal to this value."""
|
447
|
+
|
448
|
+
size__lt: Optional[int] = None
|
449
|
+
"""Only records where size is less than to this value."""
|
450
|
+
|
451
|
+
size__lte: Optional[int] = None
|
452
|
+
"""Only records where size is less than or equal to this value."""
|
453
|
+
|
454
|
+
tags: Optional[List[str]] = None
|
455
|
+
"""A list of tags that all must be present."""
|
456
|
+
|
457
|
+
type: Optional[str] = None
|
458
|
+
"""Only records where type equals this value."""
|
459
|
+
|
460
|
+
type__contains: Optional[List[str]] = None
|
461
|
+
"""Only records where type includes each substring."""
|
462
|
+
|
463
|
+
type__in: Optional[List[str]] = None
|
464
|
+
"""Only records where type equals one of the provided substrings."""
|
465
|
+
|
466
|
+
updated_at: Optional[str] = None
|
467
|
+
"""Only records where updated_at equals this value."""
|
468
|
+
|
469
|
+
updated_at__gt: Optional[str] = None
|
470
|
+
"""Only records where updated_at is greater than this value."""
|
471
|
+
|
472
|
+
updated_at__gte: Optional[str] = None
|
473
|
+
"""Only records where updated_at is greater than or equal to this value."""
|
474
|
+
|
475
|
+
updated_at__lt: Optional[str] = None
|
476
|
+
"""Only records where updated_at is less than this value."""
|
477
|
+
|
478
|
+
updated_at__lte: Optional[str] = None
|
479
|
+
"""Only records where updated_at is less than or equal to this value."""
|
187
480
|
|
188
481
|
|
189
482
|
class ListRequest(APIRequestModel):
|
190
483
|
filter: Optional[Union[Dict[str, str], FilterList]] = None
|
191
484
|
last: Optional[str] = None
|
485
|
+
"""Reflected value from a previous response to obtain the next page of results."""
|
486
|
+
|
192
487
|
order: Optional[ItemOrder] = None
|
488
|
+
"""Order results asc(ending) or desc(ending)."""
|
489
|
+
|
193
490
|
order_by: Optional[ItemOrderBy] = None
|
491
|
+
"""Which field to order results by."""
|
492
|
+
|
194
493
|
size: Optional[int] = None
|
494
|
+
"""Maximum results to include in the response."""
|
495
|
+
|
496
|
+
include_external_bucket_key: bool = False
|
497
|
+
"""If true, include the `external_bucket_key` in results."""
|
498
|
+
|
499
|
+
bucket_id: Optional[str] = None
|
500
|
+
"""The bucket to use, if not the default."""
|
195
501
|
|
196
502
|
|
197
503
|
class ListResult(PangeaResponseResult):
|
198
504
|
count: int
|
505
|
+
"""The total number of objects matched by the list request."""
|
506
|
+
|
199
507
|
last: Optional[str] = None
|
508
|
+
"""Used to fetch the next page of the current listing when provided in a repeated request's last parameter."""
|
509
|
+
|
200
510
|
objects: List[ItemData]
|
201
511
|
|
202
512
|
|
203
513
|
class GetArchiveRequest(APIRequestModel):
|
204
514
|
ids: List[str] = []
|
515
|
+
"""The IDs of the objects to include in the archive. Folders include all children."""
|
516
|
+
|
205
517
|
format: Optional[ArchiveFormat] = None
|
518
|
+
"""The format to use to build the archive."""
|
519
|
+
|
206
520
|
transfer_method: Optional[TransferMethod] = None
|
521
|
+
"""The requested transfer method for the file data."""
|
522
|
+
|
523
|
+
bucket_id: Optional[str] = None
|
524
|
+
"""The bucket to use, if not the default."""
|
207
525
|
|
208
526
|
|
209
527
|
class GetArchiveResult(PangeaResponseResult):
|
210
|
-
dest_url: Optional[str] = None
|
211
528
|
count: int
|
529
|
+
"""Number of objects included in the archive."""
|
530
|
+
|
531
|
+
dest_url: Optional[str] = None
|
532
|
+
"""A location where the archive can be downloaded from. (transfer_method: dest-url)"""
|
533
|
+
|
534
|
+
objects: List[ItemData] = []
|
535
|
+
"""A list of all objects included in the archive."""
|
212
536
|
|
213
537
|
|
214
538
|
class Authenticator(PangeaResponseResult):
|
215
539
|
auth_type: AuthenticatorType
|
540
|
+
"""An authentication mechanism."""
|
541
|
+
|
216
542
|
auth_context: str
|
543
|
+
"""An email address, a phone number or a password to access share link."""
|
217
544
|
|
218
545
|
|
219
546
|
class ShareLinkItemBase(PangeaResponseResult):
|
220
547
|
targets: List[str] = []
|
548
|
+
"""List of storage IDs."""
|
549
|
+
|
221
550
|
link_type: Optional[LinkType] = None
|
551
|
+
"""Type of link."""
|
552
|
+
|
222
553
|
expires_at: Optional[str] = None
|
554
|
+
"""The date and time the share link expires."""
|
555
|
+
|
223
556
|
max_access_count: Optional[int] = None
|
224
|
-
|
225
|
-
|
557
|
+
"""The maximum number of times a user can be authenticated to access the share link."""
|
558
|
+
|
559
|
+
authenticators: Optional[List[Authenticator]] = None
|
560
|
+
"""A list of authenticators."""
|
561
|
+
|
226
562
|
title: Optional[str] = None
|
563
|
+
"""An optional title to use in accessing shares."""
|
564
|
+
|
565
|
+
message: Optional[str] = None
|
566
|
+
"""An optional message to use in accessing shares."""
|
567
|
+
|
227
568
|
notify_email: Optional[str] = None
|
569
|
+
"""An email address"""
|
570
|
+
|
228
571
|
tags: Optional[Tags] = None
|
572
|
+
"""A list of user-defined tags"""
|
229
573
|
|
230
574
|
|
231
575
|
class ShareLinkCreateItem(ShareLinkItemBase):
|
@@ -234,15 +578,28 @@ class ShareLinkCreateItem(ShareLinkItemBase):
|
|
234
578
|
|
235
579
|
class ShareLinkCreateRequest(APIRequestModel):
|
236
580
|
links: List[ShareLinkCreateItem] = []
|
581
|
+
bucket_id: Optional[str] = None
|
582
|
+
"""The bucket to use, if not the default."""
|
237
583
|
|
238
584
|
|
239
585
|
class ShareLinkItem(ShareLinkItemBase):
|
240
586
|
id: str
|
241
|
-
|
587
|
+
"""The ID of a share link."""
|
588
|
+
|
242
589
|
access_count: int
|
590
|
+
"""The number of times a user has authenticated to access the share link."""
|
591
|
+
|
243
592
|
created_at: str
|
593
|
+
"""The date and time the share link was created."""
|
594
|
+
|
244
595
|
last_accessed_at: Optional[str] = None
|
245
|
-
link
|
596
|
+
"""The date and time the share link was last accessed."""
|
597
|
+
|
598
|
+
link: Optional[str] = None
|
599
|
+
"""A URL to access the file/folders shared with a link."""
|
600
|
+
|
601
|
+
bucket_id: str
|
602
|
+
"""The ID of a share bucket resource."""
|
246
603
|
|
247
604
|
|
248
605
|
class ShareLinkCreateResult(PangeaResponseResult):
|
@@ -251,6 +608,7 @@ class ShareLinkCreateResult(PangeaResponseResult):
|
|
251
608
|
|
252
609
|
class ShareLinkGetRequest(APIRequestModel):
|
253
610
|
id: str
|
611
|
+
"""The ID of a share link."""
|
254
612
|
|
255
613
|
|
256
614
|
class ShareLinkGetResult(PangeaResponseResult):
|
@@ -261,9 +619,6 @@ class FilterShareLinkList(APIRequestModel):
|
|
261
619
|
id: Optional[str] = None
|
262
620
|
id__contains: Optional[List[str]] = None
|
263
621
|
id__in: Optional[List[str]] = None
|
264
|
-
storage_pool_id: Optional[str] = None
|
265
|
-
storage_pool_id__contains: Optional[List[str]] = None
|
266
|
-
storage_pool_id__in: Optional[List[str]] = None
|
267
622
|
target: Optional[str] = None
|
268
623
|
target__contains: Optional[List[str]] = None
|
269
624
|
target__in: Optional[List[str]] = None
|
@@ -298,23 +653,51 @@ class FilterShareLinkList(APIRequestModel):
|
|
298
653
|
link: Optional[str] = None
|
299
654
|
link__contains: Optional[List[str]] = None
|
300
655
|
link__in: Optional[List[str]] = None
|
656
|
+
title: Optional[str] = None
|
657
|
+
title__contains: Optional[List[str]] = None
|
658
|
+
title__in: Optional[List[str]] = None
|
659
|
+
message: Optional[str] = None
|
660
|
+
message__contains: Optional[List[str]] = None
|
661
|
+
message__in: Optional[List[str]] = None
|
662
|
+
notify_email: Optional[str] = None
|
663
|
+
notify_email__contains: Optional[List[str]] = None
|
664
|
+
notify_email__in: Optional[List[str]] = None
|
665
|
+
tags: Optional[List[str]] = None
|
301
666
|
|
302
667
|
|
303
668
|
class ShareLinkListRequest(APIRequestModel):
|
304
669
|
filter: Optional[Union[FilterShareLinkList, Dict[str, str]]] = None
|
670
|
+
|
305
671
|
last: Optional[str] = None
|
672
|
+
"""Reflected value from a previous response to obtain the next page of results."""
|
673
|
+
|
306
674
|
order: Optional[ItemOrder] = None
|
675
|
+
"""Order results asc(ending) or desc(ending)."""
|
676
|
+
|
307
677
|
order_by: Optional[ShareLinkOrderBy] = None
|
678
|
+
"""Which field to order results by."""
|
679
|
+
|
308
680
|
size: Optional[int] = None
|
681
|
+
"""Maximum results to include in the response."""
|
682
|
+
|
683
|
+
bucket_id: Optional[str] = None
|
684
|
+
"""The bucket to use, if not the default."""
|
309
685
|
|
310
686
|
|
311
687
|
class ShareLinkListResult(PangeaResponseResult):
|
312
688
|
count: int
|
689
|
+
"""The total number of share links matched by the list request."""
|
690
|
+
|
691
|
+
last: Optional[str] = None
|
692
|
+
"""Used to fetch the next page of the current listing when provided in a repeated request's last parameter."""
|
693
|
+
|
313
694
|
share_link_objects: List[ShareLinkItem] = []
|
314
695
|
|
315
696
|
|
316
697
|
class ShareLinkDeleteRequest(APIRequestModel):
|
317
698
|
ids: List[str]
|
699
|
+
bucket_id: Optional[str] = None
|
700
|
+
"""The bucket to use, if not the default."""
|
318
701
|
|
319
702
|
|
320
703
|
class ShareLinkDeleteResult(PangeaResponseResult):
|
@@ -328,34 +711,96 @@ class ShareLinkSendItem(APIRequestModel):
|
|
328
711
|
|
329
712
|
class ShareLinkSendRequest(APIRequestModel):
|
330
713
|
links: List[ShareLinkSendItem]
|
714
|
+
|
331
715
|
sender_email: str
|
716
|
+
"""An email address."""
|
717
|
+
|
332
718
|
sender_name: Optional[str]
|
719
|
+
"""The sender name information. Can be sender's full name for example."""
|
333
720
|
|
334
721
|
|
335
722
|
class ShareLinkSendResult(PangeaResponseResult):
|
336
723
|
share_link_objects: List[ShareLinkItem]
|
337
724
|
|
338
725
|
|
726
|
+
class Bucket(PangeaResponseResult):
|
727
|
+
id: str
|
728
|
+
"""The ID of a share bucket resource."""
|
729
|
+
|
730
|
+
default: bool
|
731
|
+
"""If true, is the default bucket."""
|
732
|
+
|
733
|
+
name: str
|
734
|
+
"""The bucket's friendly name."""
|
735
|
+
|
736
|
+
transfer_methods: List[TransferMethod]
|
737
|
+
|
738
|
+
|
739
|
+
class BucketsResult(PangeaResponseResult):
|
740
|
+
buckets: List[Bucket]
|
741
|
+
"""A list of available buckets."""
|
742
|
+
|
743
|
+
|
339
744
|
class Share(ServiceBase):
|
340
|
-
"""Share service client."""
|
745
|
+
"""Secure Share service client."""
|
341
746
|
|
342
747
|
service_name = "share"
|
343
748
|
|
749
|
+
def __init__(
|
750
|
+
self, token: str, config: PangeaConfig | None = None, logger_name: str = "pangea", config_id: str | None = None
|
751
|
+
) -> None:
|
752
|
+
"""
|
753
|
+
Secure Share client
|
754
|
+
|
755
|
+
Initializes a new Secure Share client.
|
756
|
+
|
757
|
+
Args:
|
758
|
+
token: Pangea API token.
|
759
|
+
config: Configuration.
|
760
|
+
logger_name: Logger name.
|
761
|
+
config_id: Configuration ID.
|
762
|
+
|
763
|
+
Examples:
|
764
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
765
|
+
authz = Share(token="pangea_token", config=config)
|
766
|
+
"""
|
767
|
+
|
768
|
+
super().__init__(token, config, logger_name, config_id=config_id)
|
769
|
+
|
770
|
+
def buckets(self) -> PangeaResponse[BucketsResult]:
|
771
|
+
"""
|
772
|
+
Buckets
|
773
|
+
|
774
|
+
Get information on the accessible buckets.
|
775
|
+
|
776
|
+
OperationId: share_post_v1_buckets
|
777
|
+
|
778
|
+
Returns:
|
779
|
+
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
780
|
+
|
781
|
+
Examples:
|
782
|
+
response = share.buckets()
|
783
|
+
"""
|
784
|
+
return self.request.post("v1/buckets", BucketsResult)
|
785
|
+
|
344
786
|
def delete(
|
345
|
-
self,
|
787
|
+
self,
|
788
|
+
id: Optional[str] = None,
|
789
|
+
force: Optional[bool] = None,
|
790
|
+
bucket_id: Optional[str] = None,
|
346
791
|
) -> PangeaResponse[DeleteResult]:
|
347
792
|
"""
|
348
793
|
Delete
|
349
794
|
|
350
795
|
Delete object by ID or path. If both are supplied, the path must match
|
351
|
-
that of the object represented by the ID.
|
796
|
+
that of the object represented by the ID.
|
352
797
|
|
353
|
-
OperationId:
|
798
|
+
OperationId: share_post_v1_delete
|
354
799
|
|
355
800
|
Args:
|
356
801
|
id (str, optional): The ID of the object to delete.
|
357
|
-
path (str, optional): The path of the object to delete.
|
358
802
|
force (bool, optional): If true, delete a folder even if it's not empty.
|
803
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
359
804
|
|
360
805
|
Returns:
|
361
806
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -363,30 +808,45 @@ class Share(ServiceBase):
|
|
363
808
|
Examples:
|
364
809
|
response = share.delete(id="pos_3djfmzg2db4c6donarecbyv5begtj2bm")
|
365
810
|
"""
|
366
|
-
input = DeleteRequest(id=id,
|
367
|
-
return self.request.post("
|
811
|
+
input = DeleteRequest(id=id, force=force, bucket_id=bucket_id)
|
812
|
+
return self.request.post("v1/delete", DeleteResult, data=input.model_dump(exclude_none=True))
|
368
813
|
|
369
814
|
def folder_create(
|
370
815
|
self,
|
371
816
|
name: Optional[str] = None,
|
372
817
|
metadata: Optional[Metadata] = None,
|
373
818
|
parent_id: Optional[str] = None,
|
374
|
-
|
819
|
+
folder: Optional[str] = None,
|
375
820
|
tags: Optional[Tags] = None,
|
821
|
+
bucket_id: Optional[str] = None,
|
822
|
+
*,
|
823
|
+
file_ttl: Optional[str] = None,
|
824
|
+
root_folder: Optional[str] = None,
|
825
|
+
root_id: Optional[str] = None,
|
826
|
+
tenant_id: Optional[str] = None,
|
376
827
|
) -> PangeaResponse[FolderCreateResult]:
|
377
828
|
"""
|
378
829
|
Create a folder
|
379
830
|
|
380
|
-
Create a folder, either by name or path and parent_id.
|
831
|
+
Create a folder, either by name or path and parent_id.
|
381
832
|
|
382
|
-
OperationId:
|
833
|
+
OperationId: share_post_v1_folder_create
|
383
834
|
|
384
835
|
Args:
|
385
836
|
name (str, optional): The name of an object.
|
386
837
|
metadata (Metadata, optional): A set of string-based key/value pairs used to provide additional data about an object.
|
387
838
|
parent_id (str, optional): The ID of a stored object.
|
388
|
-
|
839
|
+
folder (str, optional): The folder to place the folder in. Must
|
840
|
+
match `parent_id` if also set.
|
389
841
|
tags (Tags, optional): A list of user-defined tags.
|
842
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
843
|
+
file_ttl: Duration until files within this folder are automatically
|
844
|
+
deleted.
|
845
|
+
root_folder: The path of a root folder to restrict the operation to.
|
846
|
+
Must resolve to `root_id` if also set.
|
847
|
+
root_id: The ID of a root folder to restrict the operation to. Must
|
848
|
+
match `root_folder` if also set.
|
849
|
+
tenant_id: A tenant to associate with this request
|
390
850
|
|
391
851
|
Returns:
|
392
852
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -398,28 +858,47 @@ class Share(ServiceBase):
|
|
398
858
|
"priority": "medium",
|
399
859
|
},
|
400
860
|
parent_id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
|
401
|
-
|
861
|
+
folder="/",
|
402
862
|
tags=["irs_2023", "personal"],
|
403
863
|
)
|
404
864
|
"""
|
405
|
-
input = FolderCreateRequest(
|
406
|
-
|
865
|
+
input = FolderCreateRequest(
|
866
|
+
name=name,
|
867
|
+
metadata=metadata,
|
868
|
+
parent_id=parent_id,
|
869
|
+
folder=folder,
|
870
|
+
tags=tags,
|
871
|
+
bucket_id=bucket_id,
|
872
|
+
file_ttl=file_ttl,
|
873
|
+
root_folder=root_folder,
|
874
|
+
root_id=root_id,
|
875
|
+
tenant_id=tenant_id,
|
876
|
+
)
|
877
|
+
return self.request.post("v1/folder/create", FolderCreateResult, data=input.model_dump(exclude_none=True))
|
407
878
|
|
408
879
|
def get(
|
409
|
-
self,
|
880
|
+
self,
|
881
|
+
id: Optional[str] = None,
|
882
|
+
transfer_method: Optional[TransferMethod] = None,
|
883
|
+
bucket_id: Optional[str] = None,
|
884
|
+
password: Optional[str] = None,
|
885
|
+
*,
|
886
|
+
tenant_id: Optional[str] = None,
|
410
887
|
) -> PangeaResponse[GetResult]:
|
411
888
|
"""
|
412
889
|
Get an object
|
413
890
|
|
414
891
|
Get object. If both ID and Path are supplied, the call will fail if the
|
415
|
-
target object doesn't match both properties.
|
892
|
+
target object doesn't match both properties.
|
416
893
|
|
417
|
-
OperationId:
|
894
|
+
OperationId: share_post_v1_get
|
418
895
|
|
419
896
|
Args:
|
420
897
|
id (str, optional): The ID of the object to retrieve.
|
421
|
-
path (str, optional): The path of the object to retrieve.
|
422
898
|
transfer_method (TransferMethod, optional): The requested transfer method for the file data.
|
899
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
900
|
+
password (str, optional): If the file was protected with a password, the password to decrypt with.
|
901
|
+
tenant_id: A tenant to associate with this request.
|
423
902
|
|
424
903
|
Returns:
|
425
904
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -427,33 +906,33 @@ class Share(ServiceBase):
|
|
427
906
|
Examples:
|
428
907
|
response = share.get(
|
429
908
|
id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
|
430
|
-
|
909
|
+
folder="/",
|
431
910
|
)
|
432
911
|
"""
|
433
912
|
input = GetRequest(
|
434
|
-
id=id,
|
435
|
-
path=path,
|
436
|
-
transfer_method=transfer_method,
|
913
|
+
id=id, transfer_method=transfer_method, bucket_id=bucket_id, password=password, tenant_id=tenant_id
|
437
914
|
)
|
438
|
-
return self.request.post("
|
915
|
+
return self.request.post("v1/get", GetResult, data=input.model_dump(exclude_none=True))
|
439
916
|
|
440
917
|
def get_archive(
|
441
918
|
self,
|
442
919
|
ids: List[str] = [],
|
443
920
|
format: Optional[ArchiveFormat] = None,
|
444
921
|
transfer_method: Optional[TransferMethod] = None,
|
922
|
+
bucket_id: Optional[str] = None,
|
445
923
|
) -> PangeaResponse[GetArchiveResult]:
|
446
924
|
"""
|
447
925
|
Get archive
|
448
926
|
|
449
|
-
Get an archive file of multiple objects.
|
927
|
+
Get an archive file of multiple objects.
|
450
928
|
|
451
|
-
OperationId:
|
929
|
+
OperationId: share_post_v1_get_archive
|
452
930
|
|
453
931
|
Args:
|
454
932
|
ids (List[str]): The IDs of the objects to include in the archive. Folders include all children.
|
455
933
|
format (ArchiveFormat, optional): The format to use for the built archive.
|
456
934
|
transfer_method (TransferMethod, optional): The requested transfer method for the file data.
|
935
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
457
936
|
|
458
937
|
Returns:
|
459
938
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -470,8 +949,8 @@ class Share(ServiceBase):
|
|
470
949
|
):
|
471
950
|
raise ValueError(f"Only {TransferMethod.DEST_URL} and {TransferMethod.MULTIPART} are supported")
|
472
951
|
|
473
|
-
input = GetArchiveRequest(ids=ids, format=format, transfer_method=transfer_method)
|
474
|
-
return self.request.post("
|
952
|
+
input = GetArchiveRequest(ids=ids, format=format, transfer_method=transfer_method, bucket_id=bucket_id)
|
953
|
+
return self.request.post("v1/get_archive", GetArchiveResult, data=input.model_dump(exclude_none=True))
|
475
954
|
|
476
955
|
def list(
|
477
956
|
self,
|
@@ -480,13 +959,14 @@ class Share(ServiceBase):
|
|
480
959
|
order: Optional[ItemOrder] = None,
|
481
960
|
order_by: Optional[ItemOrderBy] = None,
|
482
961
|
size: Optional[int] = None,
|
962
|
+
bucket_id: Optional[str] = None,
|
483
963
|
) -> PangeaResponse[ListResult]:
|
484
964
|
"""
|
485
965
|
List
|
486
966
|
|
487
|
-
List or filter/search records.
|
967
|
+
List or filter/search records.
|
488
968
|
|
489
|
-
OperationId:
|
969
|
+
OperationId: share_post_v1_list
|
490
970
|
|
491
971
|
Args:
|
492
972
|
filter (Union[Dict[str, str], FilterList], optional):
|
@@ -494,6 +974,7 @@ class Share(ServiceBase):
|
|
494
974
|
order (ItemOrder, optional): Order results asc(ending) or desc(ending).
|
495
975
|
order_by (ItemOrderBy, optional): Which field to order results by.
|
496
976
|
size (int, optional): Maximum results to include in the response.
|
977
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
497
978
|
|
498
979
|
Returns:
|
499
980
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -501,14 +982,14 @@ class Share(ServiceBase):
|
|
501
982
|
Examples:
|
502
983
|
response = share.list()
|
503
984
|
"""
|
504
|
-
input = ListRequest(filter=filter, last=last, order=order, order_by=order_by, size=size)
|
505
|
-
return self.request.post("
|
985
|
+
input = ListRequest(filter=filter, last=last, order=order, order_by=order_by, size=size, bucket_id=bucket_id)
|
986
|
+
return self.request.post("v1/list", ListResult, data=input.model_dump(exclude_none=True))
|
506
987
|
|
507
988
|
def put(
|
508
989
|
self,
|
509
990
|
file: io.BufferedReader,
|
510
991
|
name: Optional[str] = None,
|
511
|
-
|
992
|
+
folder: Optional[str] = None,
|
512
993
|
format: Optional[FileFormat] = None,
|
513
994
|
metadata: Optional[Metadata] = None,
|
514
995
|
mimetype: Optional[str] = None,
|
@@ -521,18 +1002,27 @@ class Share(ServiceBase):
|
|
521
1002
|
sha256: Optional[str] = None,
|
522
1003
|
sha512: Optional[str] = None,
|
523
1004
|
size: Optional[int] = None,
|
1005
|
+
bucket_id: Optional[str] = None,
|
1006
|
+
password: Optional[str] = None,
|
1007
|
+
password_algorithm: Optional[str] = None,
|
1008
|
+
*,
|
1009
|
+
file_ttl: Optional[str] = None,
|
1010
|
+
root_folder: Optional[str] = None,
|
1011
|
+
root_id: Optional[str] = None,
|
1012
|
+
tenant_id: Optional[str] = None,
|
524
1013
|
) -> PangeaResponse[PutResult]:
|
525
1014
|
"""
|
526
1015
|
Upload a file
|
527
1016
|
|
528
|
-
Upload a file.
|
1017
|
+
Upload a file.
|
529
1018
|
|
530
|
-
OperationId:
|
1019
|
+
OperationId: share_post_v1_put
|
531
1020
|
|
532
1021
|
Args:
|
533
1022
|
file (io.BufferedReader):
|
534
1023
|
name (str, optional): The name of the object to store.
|
535
|
-
|
1024
|
+
folder (str, optional): The path to the parent folder. Leave blank
|
1025
|
+
for the root folder. Path must resolve to `parent_id` if also set.
|
536
1026
|
format (FileFormat, optional): The format of the file, which will be verified by the server if provided. Uploads not matching the supplied format will be rejected.
|
537
1027
|
metadata (Metadata, optional): A set of string-based key/value pairs used to provide additional data about an object.
|
538
1028
|
mimetype (str, optional): The MIME type of the file, which will be verified by the server if provided. Uploads not matching the supplied MIME type will be rejected.
|
@@ -545,6 +1035,15 @@ class Share(ServiceBase):
|
|
545
1035
|
sha256 (str, optional): The SHA256 hash of the file data, which will be verified by the server if provided.
|
546
1036
|
sha512 (str, optional): The hexadecimal-encoded SHA512 hash of the file data, which will be verified by the server if provided.
|
547
1037
|
size (str, optional): The size (in bytes) of the file. If the upload doesn't match, the call will fail.
|
1038
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
1039
|
+
password (str, optional): An optional password to protect the file with. Downloading the file will require this password.
|
1040
|
+
password_algorithm (str, optional): An optional password algorithm to protect the file with. See symmetric vault password_algorithm.
|
1041
|
+
file_ttl: The TTL before expiry for the file.
|
1042
|
+
root_folder: The path of a root folder to restrict the operation to.
|
1043
|
+
Must resolve to `root_id` if also set.
|
1044
|
+
root_id: The ID of a root folder to restrict the operation to. Must
|
1045
|
+
match `root_folder` if also set.
|
1046
|
+
tenant_id: A tenant to associate with this request.
|
548
1047
|
|
549
1048
|
Returns:
|
550
1049
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -576,7 +1075,7 @@ class Share(ServiceBase):
|
|
576
1075
|
metadata=metadata,
|
577
1076
|
mimetype=mimetype,
|
578
1077
|
parent_id=parent_id,
|
579
|
-
|
1078
|
+
folder=folder,
|
580
1079
|
tags=tags,
|
581
1080
|
transfer_method=transfer_method,
|
582
1081
|
crc32c=crc32c,
|
@@ -585,14 +1084,21 @@ class Share(ServiceBase):
|
|
585
1084
|
sha256=sha256,
|
586
1085
|
sha512=sha512,
|
587
1086
|
size=size,
|
1087
|
+
bucket_id=bucket_id,
|
1088
|
+
password=password,
|
1089
|
+
password_algorithm=password_algorithm,
|
1090
|
+
file_ttl=file_ttl,
|
1091
|
+
root_folder=root_folder,
|
1092
|
+
root_id=root_id,
|
1093
|
+
tenant_id=tenant_id,
|
588
1094
|
)
|
589
|
-
data = input.
|
590
|
-
return self.request.post("
|
1095
|
+
data = input.model_dump(exclude_none=True)
|
1096
|
+
return self.request.post("v1/put", PutResult, data=data, files=files)
|
591
1097
|
|
592
1098
|
def request_upload_url(
|
593
1099
|
self,
|
594
1100
|
name: Optional[str] = None,
|
595
|
-
|
1101
|
+
folder: Optional[str] = None,
|
596
1102
|
format: Optional[FileFormat] = None,
|
597
1103
|
metadata: Optional[Metadata] = None,
|
598
1104
|
mimetype: Optional[str] = None,
|
@@ -605,17 +1111,26 @@ class Share(ServiceBase):
|
|
605
1111
|
crc32c: Optional[str] = None,
|
606
1112
|
sha256: Optional[str] = None,
|
607
1113
|
size: Optional[int] = None,
|
1114
|
+
bucket_id: Optional[str] = None,
|
1115
|
+
*,
|
1116
|
+
file_ttl: Optional[str] = None,
|
1117
|
+
password: Optional[str] = None,
|
1118
|
+
password_algorithm: Optional[str] = None,
|
1119
|
+
root_folder: Optional[str] = None,
|
1120
|
+
root_id: Optional[str] = None,
|
1121
|
+
tenant_id: Optional[str] = None,
|
608
1122
|
) -> PangeaResponse[PutResult]:
|
609
1123
|
"""
|
610
1124
|
Request upload URL
|
611
1125
|
|
612
|
-
Request an upload URL.
|
1126
|
+
Request an upload URL.
|
613
1127
|
|
614
|
-
OperationId:
|
1128
|
+
OperationId: share_post_v1_put 2
|
615
1129
|
|
616
1130
|
Args:
|
617
1131
|
name (str, optional): The name of the object to store.
|
618
|
-
|
1132
|
+
folder (str, optional): The path to the parent folder. Leave blank
|
1133
|
+
for the root folder. Path must resolve to `parent_id` if also set.
|
619
1134
|
format (FileFormat, optional): The format of the file, which will be verified by the server if provided. Uploads not matching the supplied format will be rejected.
|
620
1135
|
metadata (Metadata, optional): A set of string-based key/value pairs used to provide additional data about an object.
|
621
1136
|
mimetype (str, optional): The MIME type of the file, which will be verified by the server if provided. Uploads not matching the supplied MIME type will be rejected.
|
@@ -628,6 +1143,17 @@ class Share(ServiceBase):
|
|
628
1143
|
crc32c (str, optional): The hexadecimal-encoded CRC32C hash of the file data, which will be verified by the server if provided.
|
629
1144
|
sha256 (str, optional): The SHA256 hash of the file data, which will be verified by the server if provided.
|
630
1145
|
size (str, optional): The size (in bytes) of the file. If the upload doesn't match, the call will fail.
|
1146
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
1147
|
+
file_ttl: The TTL before expiry for the file.
|
1148
|
+
password: An optional password to protect the file with. Downloading
|
1149
|
+
the file will require this password.
|
1150
|
+
password_algorithm: An optional password algorithm to protect the
|
1151
|
+
file with. See symmetric vault password_algorithm.
|
1152
|
+
root_folder: The path of a root folder to restrict the operation to.
|
1153
|
+
Must resolve to `root_id` if also set.
|
1154
|
+
root_id: The ID of a root folder to restrict the operation to. Must
|
1155
|
+
match `root_folder` if also set.
|
1156
|
+
tenant_id: A tenant to associate with this request.
|
631
1157
|
|
632
1158
|
Returns:
|
633
1159
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -643,7 +1169,7 @@ class Share(ServiceBase):
|
|
643
1169
|
"priority": "medium",
|
644
1170
|
},
|
645
1171
|
parent_id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
|
646
|
-
|
1172
|
+
folder="/",
|
647
1173
|
tags=["irs_2023", "personal"],
|
648
1174
|
)
|
649
1175
|
"""
|
@@ -653,7 +1179,7 @@ class Share(ServiceBase):
|
|
653
1179
|
metadata=metadata,
|
654
1180
|
mimetype=mimetype,
|
655
1181
|
parent_id=parent_id,
|
656
|
-
|
1182
|
+
folder=folder,
|
657
1183
|
tags=tags,
|
658
1184
|
transfer_method=transfer_method,
|
659
1185
|
crc32c=crc32c,
|
@@ -662,15 +1188,22 @@ class Share(ServiceBase):
|
|
662
1188
|
sha256=sha256,
|
663
1189
|
sha512=sha512,
|
664
1190
|
size=size,
|
1191
|
+
bucket_id=bucket_id,
|
1192
|
+
file_ttl=file_ttl,
|
1193
|
+
password=password,
|
1194
|
+
password_algorithm=password_algorithm,
|
1195
|
+
root_folder=root_folder,
|
1196
|
+
root_id=root_id,
|
1197
|
+
tenant_id=tenant_id,
|
665
1198
|
)
|
666
1199
|
|
667
|
-
data = input.
|
668
|
-
return self.request.request_presigned_url("
|
1200
|
+
data = input.model_dump(exclude_none=True)
|
1201
|
+
return self.request.request_presigned_url("v1/put", PutResult, data=data)
|
669
1202
|
|
670
1203
|
def update(
|
671
1204
|
self,
|
672
1205
|
id: Optional[str] = None,
|
673
|
-
|
1206
|
+
folder: Optional[str] = None,
|
674
1207
|
add_metadata: Optional[Metadata] = None,
|
675
1208
|
remove_metadata: Optional[Metadata] = None,
|
676
1209
|
metadata: Optional[Metadata] = None,
|
@@ -679,17 +1212,27 @@ class Share(ServiceBase):
|
|
679
1212
|
tags: Optional[Tags] = None,
|
680
1213
|
parent_id: Optional[str] = None,
|
681
1214
|
updated_at: Optional[str] = None,
|
1215
|
+
bucket_id: Optional[str] = None,
|
1216
|
+
*,
|
1217
|
+
add_password: Optional[str] = None,
|
1218
|
+
add_password_algorithm: Optional[str] = None,
|
1219
|
+
remove_password: Optional[str] = None,
|
1220
|
+
file_ttl: Optional[str] = None,
|
1221
|
+
root_folder: Optional[str] = None,
|
1222
|
+
root_id: Optional[str] = None,
|
1223
|
+
tenant_id: Optional[str] = None,
|
682
1224
|
) -> PangeaResponse[UpdateResult]:
|
683
1225
|
"""
|
684
1226
|
Update a file
|
685
1227
|
|
686
|
-
Update a file.
|
1228
|
+
Update a file.
|
687
1229
|
|
688
|
-
OperationId:
|
1230
|
+
OperationId: share_post_v1_update
|
689
1231
|
|
690
1232
|
Args:
|
691
1233
|
id (str, optional): An identifier for the file to update.
|
692
|
-
|
1234
|
+
folder (str, optional): Set the parent (folder). Leave blank for the
|
1235
|
+
root folder. Path must resolve to `parent_id` if also set.
|
693
1236
|
add_metadata (Metadata, optional): A list of Metadata key/values to set in the object. If a provided key exists, the value will be replaced.
|
694
1237
|
remove_metadata (Metadata, optional): A list of Metadata key/values to remove in the object. It is not an error for a provided key to not exist. If a provided key exists but doesn't match the provided value, it will not be removed.
|
695
1238
|
metadata (Metadata, optional): Set the object's Metadata.
|
@@ -698,6 +1241,17 @@ class Share(ServiceBase):
|
|
698
1241
|
tags (Tags, optional): Set the object's Tags.
|
699
1242
|
parent_id (str, optional): Set the parent (folder) of the object.
|
700
1243
|
updated_at (str, optional): The date and time the object was last updated. If included, the update will fail if this doesn't match what's stored.
|
1244
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
1245
|
+
add_password: Protect the file with the supplied password.
|
1246
|
+
add_password_algorithm: The algorithm to use to password protect the
|
1247
|
+
file.
|
1248
|
+
remove_password: Remove the supplied password from the file.
|
1249
|
+
file_ttl: Set the file TTL.
|
1250
|
+
root_folder: The path of a root folder to restrict the operation to.
|
1251
|
+
Must resolve to `root_id` if also set.
|
1252
|
+
root_id: The ID of a root folder to restrict the operation to. Must
|
1253
|
+
match `root_folder` if also set.
|
1254
|
+
tenant_id: A tenant to associate with this request.
|
701
1255
|
|
702
1256
|
Returns:
|
703
1257
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -713,8 +1267,8 @@ class Share(ServiceBase):
|
|
713
1267
|
)
|
714
1268
|
"""
|
715
1269
|
input = UpdateRequest(
|
716
|
-
id=id,
|
717
|
-
|
1270
|
+
id=id,
|
1271
|
+
folder=folder,
|
718
1272
|
add_metadata=add_metadata,
|
719
1273
|
remove_metadata=remove_metadata,
|
720
1274
|
metadata=metadata,
|
@@ -723,19 +1277,30 @@ class Share(ServiceBase):
|
|
723
1277
|
tags=tags,
|
724
1278
|
parent_id=parent_id,
|
725
1279
|
updated_at=updated_at,
|
1280
|
+
bucket_id=bucket_id,
|
1281
|
+
add_password=add_password,
|
1282
|
+
add_password_algorithm=add_password_algorithm,
|
1283
|
+
remove_password=remove_password,
|
1284
|
+
file_ttl=file_ttl,
|
1285
|
+
root_folder=root_folder,
|
1286
|
+
root_id=root_id,
|
1287
|
+
tenant_id=tenant_id,
|
726
1288
|
)
|
727
|
-
return self.request.post("
|
1289
|
+
return self.request.post("v1/update", UpdateResult, data=input.model_dump(exclude_none=True))
|
728
1290
|
|
729
|
-
def share_link_create(
|
1291
|
+
def share_link_create(
|
1292
|
+
self, links: List[ShareLinkCreateItem], bucket_id: Optional[str] = None
|
1293
|
+
) -> PangeaResponse[ShareLinkCreateResult]:
|
730
1294
|
"""
|
731
1295
|
Create share links
|
732
1296
|
|
733
|
-
Create a share link.
|
1297
|
+
Create a share link.
|
734
1298
|
|
735
|
-
OperationId:
|
1299
|
+
OperationId: share_post_v1_share_link_create
|
736
1300
|
|
737
1301
|
Args:
|
738
1302
|
links (List[ShareLinkCreateItem]):
|
1303
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
739
1304
|
|
740
1305
|
Returns:
|
741
1306
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -756,16 +1321,18 @@ class Share(ServiceBase):
|
|
756
1321
|
],
|
757
1322
|
)
|
758
1323
|
"""
|
759
|
-
input = ShareLinkCreateRequest(links=links)
|
760
|
-
return self.request.post(
|
1324
|
+
input = ShareLinkCreateRequest(links=links, bucket_id=bucket_id)
|
1325
|
+
return self.request.post(
|
1326
|
+
"v1/share/link/create", ShareLinkCreateResult, data=input.model_dump(exclude_none=True)
|
1327
|
+
)
|
761
1328
|
|
762
1329
|
def share_link_get(self, id: str) -> PangeaResponse[ShareLinkGetResult]:
|
763
1330
|
"""
|
764
1331
|
Get share link
|
765
1332
|
|
766
|
-
Get a share link.
|
1333
|
+
Get a share link.
|
767
1334
|
|
768
|
-
OperationId:
|
1335
|
+
OperationId: share_post_v1_share_link_get
|
769
1336
|
|
770
1337
|
Args:
|
771
1338
|
id (str, optional): The ID of a share link.
|
@@ -779,7 +1346,7 @@ class Share(ServiceBase):
|
|
779
1346
|
)
|
780
1347
|
"""
|
781
1348
|
input = ShareLinkGetRequest(id=id)
|
782
|
-
return self.request.post("
|
1349
|
+
return self.request.post("v1/share/link/get", ShareLinkGetResult, data=input.model_dump(exclude_none=True))
|
783
1350
|
|
784
1351
|
def share_link_list(
|
785
1352
|
self,
|
@@ -788,13 +1355,14 @@ class Share(ServiceBase):
|
|
788
1355
|
order: Optional[ItemOrder] = None,
|
789
1356
|
order_by: Optional[ShareLinkOrderBy] = None,
|
790
1357
|
size: Optional[int] = None,
|
1358
|
+
bucket_id: Optional[str] = None,
|
791
1359
|
) -> PangeaResponse[ShareLinkListResult]:
|
792
1360
|
"""
|
793
1361
|
List share links
|
794
1362
|
|
795
|
-
Look up share links by filter options.
|
1363
|
+
Look up share links by filter options.
|
796
1364
|
|
797
|
-
OperationId:
|
1365
|
+
OperationId: share_post_v1_share_link_list
|
798
1366
|
|
799
1367
|
Args:
|
800
1368
|
filter (Union[Dict[str, str], ShareLinkListFilter], optional):
|
@@ -802,6 +1370,7 @@ class Share(ServiceBase):
|
|
802
1370
|
order (ItemOrder, optional): Order results asc(ending) or desc(ending).
|
803
1371
|
order_by (ItemOrderBy, optional): Which field to order results by.
|
804
1372
|
size (int, optional): Maximum results to include in the response.
|
1373
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
805
1374
|
|
806
1375
|
Returns:
|
807
1376
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -809,19 +1378,24 @@ class Share(ServiceBase):
|
|
809
1378
|
Examples:
|
810
1379
|
response = share.share_link_list()
|
811
1380
|
"""
|
812
|
-
input = ShareLinkListRequest(
|
813
|
-
|
1381
|
+
input = ShareLinkListRequest(
|
1382
|
+
filter=filter, last=last, order=order, order_by=order_by, size=size, bucket_id=bucket_id
|
1383
|
+
)
|
1384
|
+
return self.request.post("v1/share/link/list", ShareLinkListResult, data=input.model_dump(exclude_none=True))
|
814
1385
|
|
815
|
-
def share_link_delete(
|
1386
|
+
def share_link_delete(
|
1387
|
+
self, ids: List[str], bucket_id: Optional[str] = None
|
1388
|
+
) -> PangeaResponse[ShareLinkDeleteResult]:
|
816
1389
|
"""
|
817
1390
|
Delete share links
|
818
1391
|
|
819
|
-
Delete share links.
|
1392
|
+
Delete share links.
|
820
1393
|
|
821
|
-
OperationId:
|
1394
|
+
OperationId: share_post_v1_share_link_delete
|
822
1395
|
|
823
1396
|
Args:
|
824
1397
|
ids (List[str]): list of the share link's id to delete
|
1398
|
+
bucket_id (str, optional): The bucket to use, if not the default
|
825
1399
|
|
826
1400
|
Returns:
|
827
1401
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -831,8 +1405,10 @@ class Share(ServiceBase):
|
|
831
1405
|
ids=["psl_3djfmzg2db4c6donarecbyv5begtj2bm"]
|
832
1406
|
)
|
833
1407
|
"""
|
834
|
-
input = ShareLinkDeleteRequest(ids=ids)
|
835
|
-
return self.request.post(
|
1408
|
+
input = ShareLinkDeleteRequest(ids=ids, bucket_id=bucket_id)
|
1409
|
+
return self.request.post(
|
1410
|
+
"v1/share/link/delete", ShareLinkDeleteResult, data=input.model_dump(exclude_none=True)
|
1411
|
+
)
|
836
1412
|
|
837
1413
|
def share_link_send(
|
838
1414
|
self, links: List[ShareLinkSendItem], sender_email: str, sender_name: Optional[str] = None
|
@@ -843,9 +1419,9 @@ class Share(ServiceBase):
|
|
843
1419
|
Send a secure share-link notification to a set of email addresses. The
|
844
1420
|
notification email will contain an Open button that the recipient can
|
845
1421
|
use to follow the secured share-link to authenticate and then access the
|
846
|
-
shared content.
|
1422
|
+
shared content.
|
847
1423
|
|
848
|
-
OperationId:
|
1424
|
+
OperationId: share_post_v1_share_link_send
|
849
1425
|
|
850
1426
|
Args:
|
851
1427
|
sender_email: An email address.
|
@@ -861,4 +1437,4 @@ class Share(ServiceBase):
|
|
861
1437
|
"""
|
862
1438
|
|
863
1439
|
input = ShareLinkSendRequest(links=links, sender_email=sender_email, sender_name=sender_name)
|
864
|
-
return self.request.post("
|
1440
|
+
return self.request.post("v1/share/link/send", ShareLinkSendResult, data=input.model_dump(exclude_none=True))
|