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/asyncio/services/share.py
CHANGED
@@ -1,35 +1,79 @@
|
|
1
1
|
# Copyright 2022 Pangea Cyber Corporation
|
2
2
|
# Author: Pangea Cyber Corporation
|
3
|
+
from __future__ import annotations
|
4
|
+
|
3
5
|
import io
|
4
6
|
from typing import Dict, List, Optional, Tuple, Union
|
5
7
|
|
6
8
|
import pangea.services.share.share as m
|
7
|
-
from .base import ServiceBaseAsync
|
9
|
+
from pangea.asyncio.services.base import ServiceBaseAsync
|
10
|
+
from pangea.config import PangeaConfig
|
8
11
|
from pangea.response import PangeaResponse, TransferMethod
|
9
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
|
|
13
16
|
class ShareAsync(ServiceBaseAsync):
|
14
|
-
"""Share service client."""
|
17
|
+
"""Secure Share service client."""
|
15
18
|
|
16
19
|
service_name = "share"
|
17
20
|
|
21
|
+
def __init__(
|
22
|
+
self, token: str, config: PangeaConfig | None = None, logger_name: str = "pangea", config_id: str | None = None
|
23
|
+
) -> None:
|
24
|
+
"""
|
25
|
+
Secure Share client
|
26
|
+
|
27
|
+
Initializes a new Secure Share client.
|
28
|
+
|
29
|
+
Args:
|
30
|
+
token: Pangea API token.
|
31
|
+
config: Configuration.
|
32
|
+
logger_name: Logger name.
|
33
|
+
config_id: Configuration ID.
|
34
|
+
|
35
|
+
Examples:
|
36
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
37
|
+
authz = ShareAsync(token="pangea_token", config=config)
|
38
|
+
"""
|
39
|
+
|
40
|
+
super().__init__(token, config, logger_name, config_id=config_id)
|
41
|
+
|
42
|
+
async def buckets(self) -> PangeaResponse[m.BucketsResult]:
|
43
|
+
"""
|
44
|
+
Buckets
|
45
|
+
|
46
|
+
Get information on the accessible buckets.
|
47
|
+
|
48
|
+
OperationId: share_post_v1_buckets
|
49
|
+
|
50
|
+
Returns:
|
51
|
+
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
52
|
+
|
53
|
+
Examples:
|
54
|
+
response = share.buckets()
|
55
|
+
"""
|
56
|
+
|
57
|
+
return await self.request.post("v1/buckets", m.BucketsResult)
|
58
|
+
|
18
59
|
async def delete(
|
19
|
-
self,
|
60
|
+
self,
|
61
|
+
id: Optional[str] = None,
|
62
|
+
force: Optional[bool] = None,
|
63
|
+
bucket_id: Optional[str] = None,
|
20
64
|
) -> PangeaResponse[m.DeleteResult]:
|
21
65
|
"""
|
22
66
|
Delete
|
23
67
|
|
24
68
|
Delete object by ID or path. If both are supplied, the path must match
|
25
|
-
that of the object represented by the ID.
|
69
|
+
that of the object represented by the ID.
|
26
70
|
|
27
|
-
OperationId:
|
71
|
+
OperationId: share_post_v1_delete
|
28
72
|
|
29
73
|
Args:
|
30
74
|
id (str, optional): The ID of the object to delete.
|
31
|
-
path (str, optional): The path of the object to delete.
|
32
75
|
force (bool, optional): If true, delete a folder even if it's not empty.
|
76
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
33
77
|
|
34
78
|
Returns:
|
35
79
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -38,30 +82,45 @@ class ShareAsync(ServiceBaseAsync):
|
|
38
82
|
response = await share.delete(id="pos_3djfmzg2db4c6donarecbyv5begtj2bm")
|
39
83
|
"""
|
40
84
|
|
41
|
-
input = m.DeleteRequest(id=id,
|
42
|
-
return await self.request.post("
|
85
|
+
input = m.DeleteRequest(id=id, force=force, bucket_id=bucket_id)
|
86
|
+
return await self.request.post("v1/delete", m.DeleteResult, data=input.model_dump(exclude_none=True))
|
43
87
|
|
44
88
|
async def folder_create(
|
45
89
|
self,
|
46
90
|
name: Optional[str] = None,
|
47
91
|
metadata: Optional[m.Metadata] = None,
|
48
92
|
parent_id: Optional[str] = None,
|
49
|
-
|
93
|
+
folder: Optional[str] = None,
|
50
94
|
tags: Optional[m.Tags] = None,
|
95
|
+
bucket_id: Optional[str] = None,
|
96
|
+
*,
|
97
|
+
file_ttl: Optional[str] = None,
|
98
|
+
root_folder: Optional[str] = None,
|
99
|
+
root_id: Optional[str] = None,
|
100
|
+
tenant_id: Optional[str] = None,
|
51
101
|
) -> PangeaResponse[m.FolderCreateResult]:
|
52
102
|
"""
|
53
103
|
Create a folder
|
54
104
|
|
55
|
-
Create a folder, either by name or path and parent_id.
|
105
|
+
Create a folder, either by name or path and parent_id.
|
56
106
|
|
57
|
-
OperationId:
|
107
|
+
OperationId: share_post_v1_folder_create
|
58
108
|
|
59
109
|
Args:
|
60
110
|
name (str, optional): The name of an object.
|
61
111
|
metadata (Metadata, optional): A set of string-based key/value pairs used to provide additional data about an object.
|
62
112
|
parent_id (str, optional): The ID of a stored object.
|
63
|
-
|
113
|
+
folder (str, optional): The folder to place the folder in. Must
|
114
|
+
match `parent_id` if also set.
|
64
115
|
tags (Tags, optional): A list of user-defined tags.
|
116
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
117
|
+
file_ttl: Duration until files within this folder are automatically
|
118
|
+
deleted.
|
119
|
+
root_folder: The path of a root folder to restrict the operation to. Must resolve to
|
120
|
+
`root_id` if also set.
|
121
|
+
root_id: The ID of a root folder to restrict the operation to. Must match
|
122
|
+
`root_folder` if also set.
|
123
|
+
tenant_id: A tenant to associate with this request.
|
65
124
|
|
66
125
|
Returns:
|
67
126
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -73,29 +132,50 @@ class ShareAsync(ServiceBaseAsync):
|
|
73
132
|
"priority": "medium",
|
74
133
|
},
|
75
134
|
parent_id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
|
76
|
-
|
135
|
+
folder="/",
|
77
136
|
tags=["irs_2023", "personal"],
|
78
137
|
)
|
79
138
|
"""
|
80
139
|
|
81
|
-
input = m.FolderCreateRequest(
|
82
|
-
|
140
|
+
input = m.FolderCreateRequest(
|
141
|
+
name=name,
|
142
|
+
metadata=metadata,
|
143
|
+
parent_id=parent_id,
|
144
|
+
folder=folder,
|
145
|
+
tags=tags,
|
146
|
+
bucket_id=bucket_id,
|
147
|
+
file_ttl=file_ttl,
|
148
|
+
root_folder=root_folder,
|
149
|
+
root_id=root_id,
|
150
|
+
tenant_id=tenant_id,
|
151
|
+
)
|
152
|
+
return await self.request.post(
|
153
|
+
"v1/folder/create", m.FolderCreateResult, data=input.model_dump(exclude_none=True)
|
154
|
+
)
|
83
155
|
|
84
156
|
async def get(
|
85
|
-
self,
|
157
|
+
self,
|
158
|
+
id: Optional[str] = None,
|
159
|
+
transfer_method: Optional[TransferMethod] = None,
|
160
|
+
bucket_id: Optional[str] = None,
|
161
|
+
password: Optional[str] = None,
|
162
|
+
*,
|
163
|
+
tenant_id: Optional[str] = None,
|
86
164
|
) -> PangeaResponse[m.GetResult]:
|
87
165
|
"""
|
88
166
|
Get an object
|
89
167
|
|
90
168
|
Get object. If both ID and Path are supplied, the call will fail if the
|
91
|
-
target object doesn't match both properties.
|
169
|
+
target object doesn't match both properties.
|
92
170
|
|
93
|
-
OperationId:
|
171
|
+
OperationId: share_post_v1_get
|
94
172
|
|
95
173
|
Args:
|
96
174
|
id (str, optional): The ID of the object to retrieve.
|
97
|
-
path (str, optional): The path of the object to retrieve.
|
98
175
|
transfer_method (TransferMethod, optional): The requested transfer method for the file data.
|
176
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
177
|
+
password (str, optional): If the file was protected with a password, the password to decrypt with.
|
178
|
+
tenant_id: A tenant to associate with this request.
|
99
179
|
|
100
180
|
Returns:
|
101
181
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -103,34 +183,34 @@ class ShareAsync(ServiceBaseAsync):
|
|
103
183
|
Examples:
|
104
184
|
response = await share.get(
|
105
185
|
id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
|
106
|
-
|
186
|
+
folder="/",
|
107
187
|
)
|
108
188
|
"""
|
109
189
|
|
110
190
|
input = m.GetRequest(
|
111
|
-
id=id,
|
112
|
-
path=path,
|
113
|
-
transfer_method=transfer_method,
|
191
|
+
id=id, transfer_method=transfer_method, bucket_id=bucket_id, password=password, tenant_id=tenant_id
|
114
192
|
)
|
115
|
-
return await self.request.post("
|
193
|
+
return await self.request.post("v1/get", m.GetResult, data=input.model_dump(exclude_none=True))
|
116
194
|
|
117
195
|
async def get_archive(
|
118
196
|
self,
|
119
197
|
ids: List[str] = [],
|
120
198
|
format: Optional[m.ArchiveFormat] = None,
|
121
199
|
transfer_method: Optional[TransferMethod] = None,
|
200
|
+
bucket_id: Optional[str] = None,
|
122
201
|
) -> PangeaResponse[m.GetArchiveResult]:
|
123
202
|
"""
|
124
203
|
Get archive
|
125
204
|
|
126
|
-
Get an archive file of multiple objects.
|
205
|
+
Get an archive file of multiple objects.
|
127
206
|
|
128
|
-
OperationId:
|
207
|
+
OperationId: share_post_v1_get_archive
|
129
208
|
|
130
209
|
Args:
|
131
210
|
ids (List[str]): The IDs of the objects to include in the archive. Folders include all children.
|
132
211
|
format (ArchiveFormat, optional): The format to use for the built archive.
|
133
212
|
transfer_method (TransferMethod, optional): The requested transfer method for the file data.
|
213
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
134
214
|
|
135
215
|
Returns:
|
136
216
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -148,8 +228,8 @@ class ShareAsync(ServiceBaseAsync):
|
|
148
228
|
):
|
149
229
|
raise ValueError(f"Only {TransferMethod.DEST_URL} and {TransferMethod.MULTIPART} are supported")
|
150
230
|
|
151
|
-
input = m.GetArchiveRequest(ids=ids, format=format, transfer_method=transfer_method)
|
152
|
-
return await self.request.post("
|
231
|
+
input = m.GetArchiveRequest(ids=ids, format=format, transfer_method=transfer_method, bucket_id=bucket_id)
|
232
|
+
return await self.request.post("v1/get_archive", m.GetArchiveResult, data=input.model_dump(exclude_none=True))
|
153
233
|
|
154
234
|
async def list(
|
155
235
|
self,
|
@@ -158,13 +238,14 @@ class ShareAsync(ServiceBaseAsync):
|
|
158
238
|
order: Optional[m.ItemOrder] = None,
|
159
239
|
order_by: Optional[m.ItemOrderBy] = None,
|
160
240
|
size: Optional[int] = None,
|
241
|
+
bucket_id: Optional[str] = None,
|
161
242
|
) -> PangeaResponse[m.ListResult]:
|
162
243
|
"""
|
163
244
|
List
|
164
245
|
|
165
|
-
List or filter/search records.
|
246
|
+
List or filter/search records.
|
166
247
|
|
167
|
-
OperationId:
|
248
|
+
OperationId: share_post_v1_list
|
168
249
|
|
169
250
|
Args:
|
170
251
|
filter (Union[Dict[str, str], FilterList], optional):
|
@@ -172,6 +253,7 @@ class ShareAsync(ServiceBaseAsync):
|
|
172
253
|
order (ItemOrder, optional): Order results asc(ending) or desc(ending).
|
173
254
|
order_by (ItemOrderBy, optional): Which field to order results by.
|
174
255
|
size (int, optional): Maximum results to include in the response.
|
256
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
175
257
|
|
176
258
|
Returns:
|
177
259
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -180,14 +262,14 @@ class ShareAsync(ServiceBaseAsync):
|
|
180
262
|
response = await share.list()
|
181
263
|
"""
|
182
264
|
|
183
|
-
input = m.ListRequest(filter=filter, last=last, order=order, order_by=order_by, size=size)
|
184
|
-
return await self.request.post("
|
265
|
+
input = m.ListRequest(filter=filter, last=last, order=order, order_by=order_by, size=size, bucket_id=bucket_id)
|
266
|
+
return await self.request.post("v1/list", m.ListResult, data=input.model_dump(exclude_none=True))
|
185
267
|
|
186
268
|
async def put(
|
187
269
|
self,
|
188
270
|
file: io.BufferedReader,
|
189
271
|
name: Optional[str] = None,
|
190
|
-
|
272
|
+
folder: Optional[str] = None,
|
191
273
|
format: Optional[FileFormat] = None,
|
192
274
|
metadata: Optional[m.Metadata] = None,
|
193
275
|
mimetype: Optional[str] = None,
|
@@ -200,18 +282,27 @@ class ShareAsync(ServiceBaseAsync):
|
|
200
282
|
sha256: Optional[str] = None,
|
201
283
|
sha512: Optional[str] = None,
|
202
284
|
size: Optional[int] = None,
|
285
|
+
bucket_id: Optional[str] = None,
|
286
|
+
password: Optional[str] = None,
|
287
|
+
password_algorithm: Optional[str] = None,
|
288
|
+
*,
|
289
|
+
file_ttl: Optional[str] = None,
|
290
|
+
root_folder: Optional[str] = None,
|
291
|
+
root_id: Optional[str] = None,
|
292
|
+
tenant_id: Optional[str] = None,
|
203
293
|
) -> PangeaResponse[m.PutResult]:
|
204
294
|
"""
|
205
295
|
Upload a file
|
206
296
|
|
207
|
-
Upload a file.
|
297
|
+
Upload a file.
|
208
298
|
|
209
|
-
OperationId:
|
299
|
+
OperationId: share_post_v1_put
|
210
300
|
|
211
301
|
Args:
|
212
302
|
file (io.BufferedReader):
|
213
303
|
name (str, optional): The name of the object to store.
|
214
|
-
|
304
|
+
folder (str, optional): The path to the parent folder. Leave blank
|
305
|
+
for the root folder. Path must resolve to `parent_id` if also set.
|
215
306
|
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.
|
216
307
|
metadata (Metadata, optional): A set of string-based key/value pairs used to provide additional data about an object.
|
217
308
|
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.
|
@@ -224,6 +315,15 @@ class ShareAsync(ServiceBaseAsync):
|
|
224
315
|
sha256 (str, optional): The SHA256 hash of the file data, which will be verified by the server if provided.
|
225
316
|
sha512 (str, optional): The hexadecimal-encoded SHA512 hash of the file data, which will be verified by the server if provided.
|
226
317
|
size (str, optional): The size (in bytes) of the file. If the upload doesn't match, the call will fail.
|
318
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
319
|
+
password (str, optional): An optional password to protect the file with. Downloading the file will require this password.
|
320
|
+
password_algorithm (str, optional): An optional password algorithm to protect the file with. See symmetric vault password_algorithm.
|
321
|
+
file_ttl: The TTL before expiry for the file.
|
322
|
+
root_folder: The path of a root folder to restrict the operation to.
|
323
|
+
Must resolve to `root_id` if also set.
|
324
|
+
root_id: The ID of a root folder to restrict the operation to. Must
|
325
|
+
match `root_folder` if also set.
|
326
|
+
tenant_id: A tenant to associate with this request.
|
227
327
|
|
228
328
|
Returns:
|
229
329
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -256,7 +356,7 @@ class ShareAsync(ServiceBaseAsync):
|
|
256
356
|
metadata=metadata,
|
257
357
|
mimetype=mimetype,
|
258
358
|
parent_id=parent_id,
|
259
|
-
|
359
|
+
folder=folder,
|
260
360
|
tags=tags,
|
261
361
|
transfer_method=transfer_method,
|
262
362
|
crc32c=crc32c,
|
@@ -265,14 +365,21 @@ class ShareAsync(ServiceBaseAsync):
|
|
265
365
|
sha256=sha256,
|
266
366
|
sha512=sha512,
|
267
367
|
size=size,
|
368
|
+
bucket_id=bucket_id,
|
369
|
+
password=password,
|
370
|
+
password_algorithm=password_algorithm,
|
371
|
+
file_ttl=file_ttl,
|
372
|
+
root_folder=root_folder,
|
373
|
+
root_id=root_id,
|
374
|
+
tenant_id=tenant_id,
|
268
375
|
)
|
269
|
-
data = input.
|
270
|
-
return await self.request.post("
|
376
|
+
data = input.model_dump(exclude_none=True)
|
377
|
+
return await self.request.post("v1/put", m.PutResult, data=data, files=files)
|
271
378
|
|
272
379
|
async def request_upload_url(
|
273
380
|
self,
|
274
381
|
name: Optional[str] = None,
|
275
|
-
|
382
|
+
folder: Optional[str] = None,
|
276
383
|
format: Optional[FileFormat] = None,
|
277
384
|
metadata: Optional[m.Metadata] = None,
|
278
385
|
mimetype: Optional[str] = None,
|
@@ -285,17 +392,26 @@ class ShareAsync(ServiceBaseAsync):
|
|
285
392
|
crc32c: Optional[str] = None,
|
286
393
|
sha256: Optional[str] = None,
|
287
394
|
size: Optional[int] = None,
|
395
|
+
bucket_id: Optional[str] = None,
|
396
|
+
*,
|
397
|
+
password: Optional[str] = None,
|
398
|
+
password_algorithm: Optional[str] = None,
|
399
|
+
file_ttl: Optional[str] = None,
|
400
|
+
root_folder: Optional[str] = None,
|
401
|
+
root_id: Optional[str] = None,
|
402
|
+
tenant_id: Optional[str] = None,
|
288
403
|
) -> PangeaResponse[m.PutResult]:
|
289
404
|
"""
|
290
405
|
Request upload URL
|
291
406
|
|
292
|
-
Request an upload URL.
|
407
|
+
Request an upload URL.
|
293
408
|
|
294
|
-
OperationId:
|
409
|
+
OperationId: share_post_v1_put 2
|
295
410
|
|
296
411
|
Args:
|
297
412
|
name (str, optional): The name of the object to store.
|
298
|
-
|
413
|
+
folder (str, optional): The path to the parent folder. Leave blank
|
414
|
+
for the root folder. Path must resolve to `parent_id` if also set.
|
299
415
|
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.
|
300
416
|
metadata (Metadata, optional): A set of string-based key/value pairs used to provide additional data about an object.
|
301
417
|
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.
|
@@ -308,6 +424,17 @@ class ShareAsync(ServiceBaseAsync):
|
|
308
424
|
crc32c (str, optional): The hexadecimal-encoded CRC32C hash of the file data, which will be verified by the server if provided.
|
309
425
|
sha256 (str, optional): The SHA256 hash of the file data, which will be verified by the server if provided.
|
310
426
|
size (str, optional): The size (in bytes) of the file. If the upload doesn't match, the call will fail.
|
427
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
428
|
+
password: An optional password to protect the file with. Downloading
|
429
|
+
the file will require this password.
|
430
|
+
password_algorithm: An optional password algorithm to protect the
|
431
|
+
file with. See symmetric vault password_algorithm.
|
432
|
+
file_ttl: The TTL before expiry for the file.
|
433
|
+
root_folder: The path of a root folder to restrict the operation to.
|
434
|
+
Must resolve to `root_id` if also set.
|
435
|
+
root_id: The ID of a root folder to restrict the operation to. Must
|
436
|
+
match `root_folder` if also set.
|
437
|
+
tenant_id: A tenant to associate with this request.
|
311
438
|
|
312
439
|
Returns:
|
313
440
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -323,7 +450,7 @@ class ShareAsync(ServiceBaseAsync):
|
|
323
450
|
"priority": "medium",
|
324
451
|
},
|
325
452
|
parent_id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
|
326
|
-
|
453
|
+
folder="/",
|
327
454
|
tags=["irs_2023", "personal"],
|
328
455
|
)
|
329
456
|
"""
|
@@ -334,7 +461,7 @@ class ShareAsync(ServiceBaseAsync):
|
|
334
461
|
metadata=metadata,
|
335
462
|
mimetype=mimetype,
|
336
463
|
parent_id=parent_id,
|
337
|
-
|
464
|
+
folder=folder,
|
338
465
|
tags=tags,
|
339
466
|
transfer_method=transfer_method,
|
340
467
|
crc32c=crc32c,
|
@@ -343,15 +470,22 @@ class ShareAsync(ServiceBaseAsync):
|
|
343
470
|
sha256=sha256,
|
344
471
|
sha512=sha512,
|
345
472
|
size=size,
|
473
|
+
bucket_id=bucket_id,
|
474
|
+
password=password,
|
475
|
+
password_algorithm=password_algorithm,
|
476
|
+
file_ttl=file_ttl,
|
477
|
+
root_folder=root_folder,
|
478
|
+
root_id=root_id,
|
479
|
+
tenant_id=tenant_id,
|
346
480
|
)
|
347
481
|
|
348
|
-
data = input.
|
349
|
-
return await self.request.request_presigned_url("
|
482
|
+
data = input.model_dump(exclude_none=True)
|
483
|
+
return await self.request.request_presigned_url("v1/put", m.PutResult, data=data)
|
350
484
|
|
351
485
|
async def update(
|
352
486
|
self,
|
353
487
|
id: Optional[str] = None,
|
354
|
-
|
488
|
+
folder: Optional[str] = None,
|
355
489
|
add_metadata: Optional[m.Metadata] = None,
|
356
490
|
remove_metadata: Optional[m.Metadata] = None,
|
357
491
|
metadata: Optional[m.Metadata] = None,
|
@@ -360,17 +494,27 @@ class ShareAsync(ServiceBaseAsync):
|
|
360
494
|
tags: Optional[m.Tags] = None,
|
361
495
|
parent_id: Optional[str] = None,
|
362
496
|
updated_at: Optional[str] = None,
|
497
|
+
bucket_id: Optional[str] = None,
|
498
|
+
*,
|
499
|
+
add_password: Optional[str] = None,
|
500
|
+
add_password_algorithm: Optional[str] = None,
|
501
|
+
remove_password: Optional[str] = None,
|
502
|
+
file_ttl: Optional[str] = None,
|
503
|
+
root_folder: Optional[str] = None,
|
504
|
+
root_id: Optional[str] = None,
|
505
|
+
tenant_id: Optional[str] = None,
|
363
506
|
) -> PangeaResponse[m.UpdateResult]:
|
364
507
|
"""
|
365
508
|
Update a file
|
366
509
|
|
367
|
-
Update a file.
|
510
|
+
Update a file.
|
368
511
|
|
369
|
-
OperationId:
|
512
|
+
OperationId: share_post_v1_update
|
370
513
|
|
371
514
|
Args:
|
372
515
|
id (str, optional): An identifier for the file to update.
|
373
|
-
|
516
|
+
folder (str, optional): Set the parent (folder). Leave blank for the
|
517
|
+
root folder. Path must resolve to `parent_id` if also set.
|
374
518
|
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.
|
375
519
|
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.
|
376
520
|
metadata (Metadata, optional): Set the object's Metadata.
|
@@ -379,6 +523,17 @@ class ShareAsync(ServiceBaseAsync):
|
|
379
523
|
tags (Tags, optional): Set the object's Tags.
|
380
524
|
parent_id (str, optional): Set the parent (folder) of the object.
|
381
525
|
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.
|
526
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
527
|
+
add_password: Protect the file with the supplied password.
|
528
|
+
add_password_algorithm: The algorithm to use to password protect the
|
529
|
+
file.
|
530
|
+
remove_password: Remove the supplied password from the file.
|
531
|
+
file_ttl: Set the file TTL.
|
532
|
+
root_folder: The path of a root folder to restrict the operation to.
|
533
|
+
Must resolve to `root_id` if also set.
|
534
|
+
root_id: The ID of a root folder to restrict the operation to. Must
|
535
|
+
match `root_folder` if also set.
|
536
|
+
tenant_id: A tenant to associate with this request.
|
382
537
|
|
383
538
|
Returns:
|
384
539
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -396,7 +551,7 @@ class ShareAsync(ServiceBaseAsync):
|
|
396
551
|
|
397
552
|
input = m.UpdateRequest(
|
398
553
|
id=id,
|
399
|
-
|
554
|
+
folder=folder,
|
400
555
|
add_metadata=add_metadata,
|
401
556
|
remove_metadata=remove_metadata,
|
402
557
|
metadata=metadata,
|
@@ -405,19 +560,30 @@ class ShareAsync(ServiceBaseAsync):
|
|
405
560
|
tags=tags,
|
406
561
|
parent_id=parent_id,
|
407
562
|
updated_at=updated_at,
|
563
|
+
bucket_id=bucket_id,
|
564
|
+
add_password=add_password,
|
565
|
+
add_password_algorithm=add_password_algorithm,
|
566
|
+
remove_password=remove_password,
|
567
|
+
file_ttl=file_ttl,
|
568
|
+
root_folder=root_folder,
|
569
|
+
root_id=root_id,
|
570
|
+
tenant_id=tenant_id,
|
408
571
|
)
|
409
|
-
return await self.request.post("
|
572
|
+
return await self.request.post("v1/update", m.UpdateResult, data=input.model_dump(exclude_none=True))
|
410
573
|
|
411
|
-
async def share_link_create(
|
574
|
+
async def share_link_create(
|
575
|
+
self, links: List[m.ShareLinkCreateItem], bucket_id: Optional[str] = None
|
576
|
+
) -> PangeaResponse[m.ShareLinkCreateResult]:
|
412
577
|
"""
|
413
578
|
Create share links
|
414
579
|
|
415
|
-
Create a share link.
|
580
|
+
Create a share link.
|
416
581
|
|
417
|
-
OperationId:
|
582
|
+
OperationId: share_post_v1_share_link_create
|
418
583
|
|
419
584
|
Args:
|
420
585
|
links (List[ShareLinkCreateItem]):
|
586
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
421
587
|
|
422
588
|
Returns:
|
423
589
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -439,18 +605,18 @@ class ShareAsync(ServiceBaseAsync):
|
|
439
605
|
)
|
440
606
|
"""
|
441
607
|
|
442
|
-
input = m.ShareLinkCreateRequest(links=links)
|
608
|
+
input = m.ShareLinkCreateRequest(links=links, bucket_id=bucket_id)
|
443
609
|
return await self.request.post(
|
444
|
-
"
|
610
|
+
"v1/share/link/create", m.ShareLinkCreateResult, data=input.model_dump(exclude_none=True)
|
445
611
|
)
|
446
612
|
|
447
613
|
async def share_link_get(self, id: str) -> PangeaResponse[m.ShareLinkGetResult]:
|
448
614
|
"""
|
449
615
|
Get share link
|
450
616
|
|
451
|
-
Get a share link.
|
617
|
+
Get a share link.
|
452
618
|
|
453
|
-
OperationId:
|
619
|
+
OperationId: share_post_v1_share_link_get
|
454
620
|
|
455
621
|
Args:
|
456
622
|
id (str, optional): The ID of a share link.
|
@@ -466,7 +632,7 @@ class ShareAsync(ServiceBaseAsync):
|
|
466
632
|
|
467
633
|
input = m.ShareLinkGetRequest(id=id)
|
468
634
|
return await self.request.post(
|
469
|
-
"
|
635
|
+
"v1/share/link/get", m.ShareLinkGetResult, data=input.model_dump(exclude_none=True)
|
470
636
|
)
|
471
637
|
|
472
638
|
async def share_link_list(
|
@@ -476,13 +642,14 @@ class ShareAsync(ServiceBaseAsync):
|
|
476
642
|
order: Optional[m.ItemOrder] = None,
|
477
643
|
order_by: Optional[m.ShareLinkOrderBy] = None,
|
478
644
|
size: Optional[int] = None,
|
645
|
+
bucket_id: Optional[str] = None,
|
479
646
|
) -> PangeaResponse[m.ShareLinkListResult]:
|
480
647
|
"""
|
481
648
|
List share links
|
482
649
|
|
483
|
-
Look up share links by filter options.
|
650
|
+
Look up share links by filter options.
|
484
651
|
|
485
|
-
OperationId:
|
652
|
+
OperationId: share_post_v1_share_link_list
|
486
653
|
|
487
654
|
Args:
|
488
655
|
filter (Union[Dict[str, str], ShareLinkListFilter], optional):
|
@@ -490,6 +657,7 @@ class ShareAsync(ServiceBaseAsync):
|
|
490
657
|
order (ItemOrder, optional): Order results asc(ending) or desc(ending).
|
491
658
|
order_by (ItemOrderBy, optional): Which field to order results by.
|
492
659
|
size (int, optional): Maximum results to include in the response.
|
660
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
493
661
|
|
494
662
|
Returns:
|
495
663
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -498,21 +666,26 @@ class ShareAsync(ServiceBaseAsync):
|
|
498
666
|
response = await share.share_link_list()
|
499
667
|
"""
|
500
668
|
|
501
|
-
input = m.ShareLinkListRequest(
|
669
|
+
input = m.ShareLinkListRequest(
|
670
|
+
filter=filter, last=last, order=order, order_by=order_by, size=size, bucket_id=bucket_id
|
671
|
+
)
|
502
672
|
return await self.request.post(
|
503
|
-
"
|
673
|
+
"v1/share/link/list", m.ShareLinkListResult, data=input.model_dump(exclude_none=True)
|
504
674
|
)
|
505
675
|
|
506
|
-
async def share_link_delete(
|
676
|
+
async def share_link_delete(
|
677
|
+
self, ids: List[str], bucket_id: Optional[str] = None
|
678
|
+
) -> PangeaResponse[m.ShareLinkDeleteResult]:
|
507
679
|
"""
|
508
680
|
Delete share links
|
509
681
|
|
510
|
-
Delete share links.
|
682
|
+
Delete share links.
|
511
683
|
|
512
|
-
OperationId:
|
684
|
+
OperationId: share_post_v1_share_link_delete
|
513
685
|
|
514
686
|
Args:
|
515
687
|
ids (List[str]): list of the share link's id to delete
|
688
|
+
bucket_id (str, optional): The bucket to use, if not the default.
|
516
689
|
|
517
690
|
Returns:
|
518
691
|
A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
|
@@ -523,9 +696,9 @@ class ShareAsync(ServiceBaseAsync):
|
|
523
696
|
)
|
524
697
|
"""
|
525
698
|
|
526
|
-
input = m.ShareLinkDeleteRequest(ids=ids)
|
699
|
+
input = m.ShareLinkDeleteRequest(ids=ids, bucket_id=bucket_id)
|
527
700
|
return await self.request.post(
|
528
|
-
"
|
701
|
+
"v1/share/link/delete", m.ShareLinkDeleteResult, data=input.model_dump(exclude_none=True)
|
529
702
|
)
|
530
703
|
|
531
704
|
async def share_link_send(
|
@@ -537,9 +710,9 @@ class ShareAsync(ServiceBaseAsync):
|
|
537
710
|
Send a secure share-link notification to a set of email addresses. The
|
538
711
|
notification email will contain an Open button that the recipient can
|
539
712
|
use to follow the secured share-link to authenticate and then access the
|
540
|
-
shared content.
|
713
|
+
shared content.
|
541
714
|
|
542
|
-
OperationId:
|
715
|
+
OperationId: share_post_v1_share_link_send
|
543
716
|
|
544
717
|
Args:
|
545
718
|
sender_email: An email address.
|
@@ -556,5 +729,5 @@ class ShareAsync(ServiceBaseAsync):
|
|
556
729
|
|
557
730
|
input = m.ShareLinkSendRequest(links=links, sender_email=sender_email, sender_name=sender_name)
|
558
731
|
return await self.request.post(
|
559
|
-
"
|
732
|
+
"v1/share/link/send", m.ShareLinkSendResult, data=input.model_dump(exclude_none=True)
|
560
733
|
)
|