pangea-sdk 6.5.0b1__py3-none-any.whl → 6.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pangea/__init__.py +3 -11
- pangea/_constants.py +4 -0
- pangea/_typing.py +30 -0
- pangea/asyncio/__init__.py +2 -1
- pangea/asyncio/file_uploader.py +3 -2
- pangea/asyncio/request.py +66 -162
- pangea/asyncio/services/__init__.py +19 -3
- pangea/asyncio/services/ai_guard.py +23 -169
- pangea/asyncio/services/audit.py +1 -301
- pangea/asyncio/services/authn.py +25 -8
- pangea/asyncio/services/base.py +21 -6
- pangea/asyncio/services/file_scan.py +1 -1
- pangea/asyncio/services/intel.py +160 -95
- pangea/asyncio/services/prompt_guard.py +5 -112
- pangea/asyncio/services/redact.py +4 -265
- pangea/config.py +4 -2
- pangea/file_uploader.py +4 -1
- pangea/request.py +91 -166
- pangea/response.py +5 -1
- pangea/services/__init__.py +19 -3
- pangea/services/ai_guard.py +84 -694
- pangea/services/audit/audit.py +3 -301
- pangea/services/audit/models.py +1 -273
- pangea/services/audit/util.py +2 -0
- pangea/services/authn/authn.py +4 -5
- pangea/services/base.py +3 -0
- pangea/services/file_scan.py +3 -2
- pangea/services/intel.py +187 -252
- pangea/services/prompt_guard.py +5 -193
- pangea/services/redact.py +7 -473
- pangea/services/vault/vault.py +3 -0
- {pangea_sdk-6.5.0b1.dist-info → pangea_sdk-6.6.0.dist-info}/METADATA +17 -18
- pangea_sdk-6.6.0.dist-info/RECORD +62 -0
- pangea_sdk-6.6.0.dist-info/WHEEL +4 -0
- pangea/asyncio/services/management.py +0 -576
- pangea/services/management.py +0 -720
- pangea_sdk-6.5.0b1.dist-info/RECORD +0 -62
- pangea_sdk-6.5.0b1.dist-info/WHEEL +0 -4
pangea/services/redact.py
CHANGED
@@ -7,74 +7,12 @@
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import enum
|
10
|
-
from
|
11
|
-
from typing import Dict, List, Optional, Union, cast, overload
|
12
|
-
|
13
|
-
from pydantic import Field, TypeAdapter
|
14
|
-
from typing_extensions import Annotated, Literal
|
10
|
+
from typing import Dict, List, Optional, Union
|
15
11
|
|
16
12
|
from pangea.config import PangeaConfig
|
17
13
|
from pangea.response import APIRequestModel, APIResponseModel, PangeaResponse, PangeaResponseResult
|
18
14
|
from pangea.services.base import ServiceBase
|
19
15
|
|
20
|
-
MatcherType = Literal[
|
21
|
-
"CREDIT_CARD",
|
22
|
-
"CRYPTO",
|
23
|
-
"DATE_TIME",
|
24
|
-
"EMAIL_ADDRESS",
|
25
|
-
"IBAN_CODE",
|
26
|
-
"IP_ADDRESS",
|
27
|
-
"NRP",
|
28
|
-
"LOCATION",
|
29
|
-
"PERSON",
|
30
|
-
"PHONE_NUMBER",
|
31
|
-
"MEDICAL_LICENSE",
|
32
|
-
"URL",
|
33
|
-
"US_BANK_NUMBER",
|
34
|
-
"US_DRIVER_LICENSE",
|
35
|
-
"US_ITIN",
|
36
|
-
"US_PASSPORT",
|
37
|
-
"US_SSN",
|
38
|
-
"UK_NHS",
|
39
|
-
"NIF",
|
40
|
-
"FIN/NRIC",
|
41
|
-
"AU_ABN",
|
42
|
-
"AU_ACN",
|
43
|
-
"AU_TFN",
|
44
|
-
"AU_MEDICARE",
|
45
|
-
"FIREBASE_URL",
|
46
|
-
"RSA_PRIVATE_KEY",
|
47
|
-
"SSH_DSA_PRIVATE_KEY",
|
48
|
-
"SSH_EC_PRIVATE_KEY",
|
49
|
-
"PGP_PRIVATE_KEY_BLOCK",
|
50
|
-
"AMAZON_AWS_ACCESS_KEY_ID",
|
51
|
-
"AMAZON_AWS_SECRET_ACCESS_KEY",
|
52
|
-
"AMAZON_MWS_AUTH_TOKEN",
|
53
|
-
"FACEBOOK_ACCESS_TOKEN",
|
54
|
-
"GITHUB_ACCESS_TOKEN",
|
55
|
-
"JWT_TOKEN",
|
56
|
-
"GOOGLE_API_KEY",
|
57
|
-
"GOOGLE_CLOUD_PLATFORM_API_KEY",
|
58
|
-
"GOOGLE_DRIVE_API_KEY",
|
59
|
-
"GOOGLE_CLOUD_PLATFORM_SERVICE_ACCOUNT",
|
60
|
-
"GOOGLE_GMAIL_API_KEY",
|
61
|
-
"YOUTUBE_API_KEY",
|
62
|
-
"MAILCHIMP_API_KEY",
|
63
|
-
"MAILGUN_API_KEY",
|
64
|
-
"MONEY",
|
65
|
-
"BASIC_AUTH",
|
66
|
-
"PICATIC_API_KEY",
|
67
|
-
"SLACK_TOKEN",
|
68
|
-
"SLACK_WEBHOOK",
|
69
|
-
"STRIPE_API_KEY",
|
70
|
-
"STRIPE_RESTRICTED_API_KEY",
|
71
|
-
"SQUARE_ACCESS_TOKEN",
|
72
|
-
"SQUARE_OAUTH_SECRET",
|
73
|
-
"TWILIO_API_KEY",
|
74
|
-
"PANGEA_TOKEN",
|
75
|
-
"PROFANITY",
|
76
|
-
]
|
77
|
-
|
78
16
|
|
79
17
|
class RedactFormat(str, enum.Enum):
|
80
18
|
"""Structured data format."""
|
@@ -110,10 +48,10 @@ class PartialMasking(APIRequestModel):
|
|
110
48
|
masked_from_left: Optional[int] = None
|
111
49
|
masked_from_right: Optional[int] = None
|
112
50
|
chars_to_ignore: Optional[List[str]] = None
|
113
|
-
masking_char: Optional[str] =
|
51
|
+
masking_char: Optional[List[str]] = None
|
114
52
|
|
115
53
|
|
116
|
-
class
|
54
|
+
class RedactionMethodOverrides(APIRequestModel):
|
117
55
|
redaction_type: RedactType
|
118
56
|
hash: Optional[Dict] = None
|
119
57
|
fpe_alphabet: Optional[FPEAlphabet] = None
|
@@ -121,10 +59,6 @@ class Redaction(APIRequestModel):
|
|
121
59
|
redaction_value: Optional[str] = None
|
122
60
|
|
123
61
|
|
124
|
-
class RedactionMethodOverrides(Redaction):
|
125
|
-
"""This field allows users to specify the redaction method per rule and its various parameters."""
|
126
|
-
|
127
|
-
|
128
62
|
class RedactRequest(APIRequestModel):
|
129
63
|
"""
|
130
64
|
Input class to make a redact request
|
@@ -135,7 +69,7 @@ class RedactRequest(APIRequestModel):
|
|
135
69
|
rules: Optional[List[str]] = None
|
136
70
|
rulesets: Optional[List[str]] = None
|
137
71
|
return_result: Optional[bool] = None
|
138
|
-
redaction_method_overrides: Optional[
|
72
|
+
redaction_method_overrides: Optional[RedactionMethodOverrides] = None
|
139
73
|
vault_parameters: Optional[VaultParameters] = None
|
140
74
|
llm_request: Optional[bool] = None
|
141
75
|
"""Is this redact call going to be used in an LLM request?"""
|
@@ -216,7 +150,7 @@ class StructuredRequest(APIRequestModel):
|
|
216
150
|
rules: Optional[List[str]] = None
|
217
151
|
rulesets: Optional[List[str]] = None
|
218
152
|
return_result: Optional[bool] = None
|
219
|
-
redaction_method_overrides: Optional[
|
153
|
+
redaction_method_overrides: Optional[RedactionMethodOverrides] = None
|
220
154
|
vault_parameters: Optional[VaultParameters] = None
|
221
155
|
llm_request: Optional[bool] = None
|
222
156
|
"""Is this redact call going to be used in an LLM request?"""
|
@@ -264,145 +198,6 @@ class UnredactResult(PangeaResponseResult):
|
|
264
198
|
data: RedactedData
|
265
199
|
|
266
200
|
|
267
|
-
class Matcher(APIResponseModel):
|
268
|
-
match_type: str
|
269
|
-
match_value: str
|
270
|
-
match_score: float
|
271
|
-
|
272
|
-
|
273
|
-
class RuleV1(APIResponseModel):
|
274
|
-
entity_name: str
|
275
|
-
matchers: Union[List[Matcher], MatcherType]
|
276
|
-
ruleset: str
|
277
|
-
|
278
|
-
match_threshold: Optional[float] = None
|
279
|
-
context_values: Optional[List[str]] = None
|
280
|
-
name: Optional[str] = None
|
281
|
-
description: Optional[str] = None
|
282
|
-
|
283
|
-
|
284
|
-
class RuleV2(APIResponseModel):
|
285
|
-
entity_name: str
|
286
|
-
matchers: Union[List[Matcher], MatcherType]
|
287
|
-
|
288
|
-
match_threshold: Optional[float] = None
|
289
|
-
context_values: Optional[List[str]] = None
|
290
|
-
negative_context_values: Optional[List[str]] = None
|
291
|
-
name: Optional[str] = None
|
292
|
-
description: Optional[str] = None
|
293
|
-
|
294
|
-
|
295
|
-
class RulesetV1(APIResponseModel):
|
296
|
-
name: Optional[str] = None
|
297
|
-
description: Optional[str] = None
|
298
|
-
rules: List[str]
|
299
|
-
|
300
|
-
|
301
|
-
class RulesetV2(APIResponseModel):
|
302
|
-
name: Optional[str] = None
|
303
|
-
description: Optional[str] = None
|
304
|
-
|
305
|
-
|
306
|
-
class ServiceConfigV1(PangeaResponseResult):
|
307
|
-
version: Literal["1.0.0"] = "1.0.0"
|
308
|
-
id: str
|
309
|
-
name: str
|
310
|
-
updated_at: str
|
311
|
-
enabled_rules: List[str]
|
312
|
-
|
313
|
-
redactions: Optional[Dict[str, Redaction]] = None
|
314
|
-
|
315
|
-
vault_service_config_id: Optional[str] = None
|
316
|
-
"""Service config used to create the secret"""
|
317
|
-
|
318
|
-
salt_vault_secret_id: Optional[str] = None
|
319
|
-
"""Pangea only allows hashing to be done using a salt value to prevent brute-force attacks."""
|
320
|
-
|
321
|
-
rules: Optional[Dict[str, RuleV1]] = None
|
322
|
-
rulesets: Optional[Dict[str, RulesetV1]] = None
|
323
|
-
supported_languages: Optional[List[Literal["en"]]] = None
|
324
|
-
|
325
|
-
|
326
|
-
class ServiceConfigV2(PangeaResponseResult):
|
327
|
-
version: Literal["2.0.0"] = "2.0.0"
|
328
|
-
id: str
|
329
|
-
name: str
|
330
|
-
updated_at: str
|
331
|
-
enabled_rules: List[str]
|
332
|
-
|
333
|
-
enforce_enabled_rules: Optional[bool] = None
|
334
|
-
"""Always run service config enabled rules across all redact calls regardless of flags?"""
|
335
|
-
|
336
|
-
redactions: Optional[Dict[str, Redaction]] = None
|
337
|
-
|
338
|
-
vault_service_config_id: Optional[str] = None
|
339
|
-
"""Service config used to create the secret"""
|
340
|
-
|
341
|
-
salt_vault_secret_id: Optional[str] = None
|
342
|
-
"""Pangea only allows hashing to be done using a salt value to prevent brute-force attacks."""
|
343
|
-
|
344
|
-
fpe_vault_secret_id: Optional[str] = None
|
345
|
-
"""The ID of the key used by FF3 Encryption algorithms for FPE."""
|
346
|
-
|
347
|
-
rules: Optional[Dict[str, RuleV2]] = None
|
348
|
-
rulesets: Optional[Dict[str, RulesetV2]] = None
|
349
|
-
supported_languages: Optional[List[Literal["en"]]] = None
|
350
|
-
|
351
|
-
|
352
|
-
ServiceConfigResult = Annotated[Union[ServiceConfigV1, ServiceConfigV2], Field(discriminator="version")]
|
353
|
-
|
354
|
-
|
355
|
-
class ServiceConfigFilter(APIRequestModel):
|
356
|
-
id: Optional[str] = None
|
357
|
-
"""Only records where id equals this value."""
|
358
|
-
|
359
|
-
id__contains: Optional[Sequence[str]] = None
|
360
|
-
"""Only records where id includes each substring."""
|
361
|
-
|
362
|
-
id__in: Optional[Sequence[str]] = None
|
363
|
-
"""Only records where id equals one of the provided substrings."""
|
364
|
-
|
365
|
-
created_at: Optional[str] = None
|
366
|
-
"""Only records where created_at equals this value."""
|
367
|
-
|
368
|
-
created_at__gt: Optional[str] = None
|
369
|
-
"""Only records where created_at is greater than this value."""
|
370
|
-
|
371
|
-
created_at__gte: Optional[str] = None
|
372
|
-
"""Only records where created_at is greater than or equal to this value."""
|
373
|
-
|
374
|
-
created_at__lt: Optional[str] = None
|
375
|
-
"""Only records where created_at is less than this value."""
|
376
|
-
|
377
|
-
created_at__lte: Optional[str] = None
|
378
|
-
"""Only records where created_at is less than or equal to this value."""
|
379
|
-
|
380
|
-
updated_at: Optional[str] = None
|
381
|
-
"""Only records where updated_at equals this value."""
|
382
|
-
|
383
|
-
updated_at__gt: Optional[str] = None
|
384
|
-
"""Only records where updated_at is greater than this value."""
|
385
|
-
|
386
|
-
updated_at__gte: Optional[str] = None
|
387
|
-
"""Only records where updated_at is greater than or equal to this value."""
|
388
|
-
|
389
|
-
updated_at__lt: Optional[str] = None
|
390
|
-
"""Only records where updated_at is less than this value."""
|
391
|
-
|
392
|
-
updated_at__lte: Optional[str] = None
|
393
|
-
"""Only records where updated_at is less than or equal to this value."""
|
394
|
-
|
395
|
-
|
396
|
-
class ServiceConfigListResult(PangeaResponseResult):
|
397
|
-
count: int
|
398
|
-
"""The total number of service configs matched by the list request."""
|
399
|
-
|
400
|
-
last: str
|
401
|
-
"""Used to fetch the next page of the current listing when provided in a repeated request's last parameter."""
|
402
|
-
|
403
|
-
items: Sequence[ServiceConfigResult]
|
404
|
-
|
405
|
-
|
406
201
|
class Redact(ServiceBase):
|
407
202
|
"""Redact service client.
|
408
203
|
|
@@ -457,7 +252,7 @@ class Redact(ServiceBase):
|
|
457
252
|
rules: Optional[List[str]] = None,
|
458
253
|
rulesets: Optional[List[str]] = None,
|
459
254
|
return_result: Optional[bool] = None,
|
460
|
-
redaction_method_overrides: Optional[
|
255
|
+
redaction_method_overrides: Optional[RedactionMethodOverrides] = None,
|
461
256
|
llm_request: Optional[bool] = None,
|
462
257
|
vault_parameters: Optional[VaultParameters] = None,
|
463
258
|
) -> PangeaResponse[RedactResult]:
|
@@ -512,7 +307,7 @@ class Redact(ServiceBase):
|
|
512
307
|
rules: Optional[List[str]] = None,
|
513
308
|
rulesets: Optional[List[str]] = None,
|
514
309
|
return_result: Optional[bool] = None,
|
515
|
-
redaction_method_overrides:
|
310
|
+
redaction_method_overrides: Optional[RedactionMethodOverrides] = None,
|
516
311
|
llm_request: Optional[bool] = None,
|
517
312
|
vault_parameters: Optional[VaultParameters] = None,
|
518
313
|
) -> PangeaResponse[StructuredResult]:
|
@@ -591,264 +386,3 @@ class Redact(ServiceBase):
|
|
591
386
|
"""
|
592
387
|
input = UnredactRequest(redacted_data=redacted_data, fpe_context=fpe_context)
|
593
388
|
return self.request.post("v1/unredact", UnredactResult, data=input.model_dump(exclude_none=True))
|
594
|
-
|
595
|
-
def get_service_config(self, config_id: str) -> PangeaResponse[ServiceConfigResult]:
|
596
|
-
"""
|
597
|
-
Get a service config.
|
598
|
-
|
599
|
-
|
600
|
-
OperationId: redact_post_v1beta_config
|
601
|
-
"""
|
602
|
-
response = self.request.post("v1beta/config", PangeaResponseResult, data={"id": config_id})
|
603
|
-
response.result = TypeAdapter(ServiceConfigResult).validate_python(response.json["result"])
|
604
|
-
return cast(PangeaResponse[ServiceConfigResult], response)
|
605
|
-
|
606
|
-
@overload
|
607
|
-
def create_service_config(
|
608
|
-
self,
|
609
|
-
name: str,
|
610
|
-
*,
|
611
|
-
version: Literal["1.0.0"],
|
612
|
-
enabled_rules: Sequence[str] | None = None,
|
613
|
-
redactions: Mapping[str, Redaction] | None = None,
|
614
|
-
vault_service_config_id: str | None = None,
|
615
|
-
salt_vault_secret_id: str | None = None,
|
616
|
-
rules: Mapping[str, RuleV1] | None = None,
|
617
|
-
rulesets: Mapping[str, RulesetV1] | None = None,
|
618
|
-
supported_languages: Sequence[Literal["en"]] | None = None,
|
619
|
-
) -> PangeaResponse[ServiceConfigResult]:
|
620
|
-
"""
|
621
|
-
Create a v1.0.0 service config.
|
622
|
-
|
623
|
-
OperationId: redact_post_v1beta_config_create
|
624
|
-
|
625
|
-
Args:
|
626
|
-
vault_service_config_id: Service config used to create the secret
|
627
|
-
salt_vault_secret_id: Pangea only allows hashing to be done using a salt value to prevent brute-force attacks.
|
628
|
-
"""
|
629
|
-
|
630
|
-
@overload
|
631
|
-
def create_service_config(
|
632
|
-
self,
|
633
|
-
name: str,
|
634
|
-
*,
|
635
|
-
version: Literal["2.0.0"] | None = None,
|
636
|
-
enabled_rules: Sequence[str] | None = None,
|
637
|
-
enforce_enabled_rules: bool | None = None,
|
638
|
-
redactions: Mapping[str, Redaction] | None = None,
|
639
|
-
vault_service_config_id: str | None = None,
|
640
|
-
salt_vault_secret_id: str | None = None,
|
641
|
-
fpe_vault_secret_id: str | None = None,
|
642
|
-
rules: Mapping[str, RuleV2] | None = None,
|
643
|
-
rulesets: Mapping[str, RulesetV2] | None = None,
|
644
|
-
supported_languages: Sequence[Literal["en"]] | None = None,
|
645
|
-
) -> PangeaResponse[ServiceConfigResult]:
|
646
|
-
"""
|
647
|
-
Create a v2.0.0 service config.
|
648
|
-
|
649
|
-
OperationId: redact_post_v1beta_config_create
|
650
|
-
|
651
|
-
Args:
|
652
|
-
enforce_enabled_rules: Always run service config enabled rules across all redact calls regardless of flags?
|
653
|
-
vault_service_config_id: Service config used to create the secret
|
654
|
-
salt_vault_secret_id: Pangea only allows hashing to be done using a salt value to prevent brute-force attacks.
|
655
|
-
fpe_vault_secret_id: The ID of the key used by FF3 Encryption algorithms for FPE.
|
656
|
-
"""
|
657
|
-
|
658
|
-
def create_service_config(
|
659
|
-
self,
|
660
|
-
name: str,
|
661
|
-
*,
|
662
|
-
version: Literal["1.0.0", "2.0.0"] | None = None,
|
663
|
-
enabled_rules: Sequence[str] | None = None,
|
664
|
-
enforce_enabled_rules: bool | None = None,
|
665
|
-
fpe_vault_secret_id: str | None = None,
|
666
|
-
redactions: Mapping[str, Redaction] | None = None,
|
667
|
-
rules: Mapping[str, RuleV1 | RuleV2] | None = None,
|
668
|
-
rulesets: Mapping[str, RulesetV1 | RulesetV2] | None = None,
|
669
|
-
salt_vault_secret_id: str | None = None,
|
670
|
-
supported_languages: Sequence[Literal["en"]] | None = None,
|
671
|
-
vault_service_config_id: str | None = None,
|
672
|
-
) -> PangeaResponse[ServiceConfigResult]:
|
673
|
-
"""
|
674
|
-
Create a service config.
|
675
|
-
|
676
|
-
OperationId: redact_post_v1beta_config_create
|
677
|
-
|
678
|
-
Args:
|
679
|
-
enforce_enabled_rules: Always run service config enabled rules across all redact calls regardless of flags?
|
680
|
-
fpe_vault_secret_id: The ID of the key used by FF3 Encryption algorithms for FPE.
|
681
|
-
salt_vault_secret_id: Pangea only allows hashing to be done using a salt value to prevent brute-force attacks.
|
682
|
-
vault_service_config_id: Service config used to create the secret
|
683
|
-
"""
|
684
|
-
|
685
|
-
response = self.request.post(
|
686
|
-
"v1beta/config/create",
|
687
|
-
PangeaResponseResult,
|
688
|
-
data={
|
689
|
-
"name": name,
|
690
|
-
"version": version,
|
691
|
-
"enabled_rules": enabled_rules,
|
692
|
-
"enforce_enabled_rules": enforce_enabled_rules,
|
693
|
-
"fpe_vault_secret_id": fpe_vault_secret_id,
|
694
|
-
"redactions": redactions,
|
695
|
-
"rules": rules,
|
696
|
-
"rulesets": rulesets,
|
697
|
-
"salt_vault_secret_id": salt_vault_secret_id,
|
698
|
-
"supported_languages": supported_languages,
|
699
|
-
"vault_service_config_id": vault_service_config_id,
|
700
|
-
},
|
701
|
-
)
|
702
|
-
response.result = TypeAdapter(ServiceConfigResult).validate_python(response.json["result"])
|
703
|
-
return cast(PangeaResponse[ServiceConfigResult], response)
|
704
|
-
|
705
|
-
@overload
|
706
|
-
def update_service_config(
|
707
|
-
self,
|
708
|
-
config_id: str,
|
709
|
-
*,
|
710
|
-
version: Literal["1.0.0"],
|
711
|
-
name: str,
|
712
|
-
updated_at: str,
|
713
|
-
enabled_rules: Sequence[str] | None = None,
|
714
|
-
redactions: Mapping[str, Redaction] | None = None,
|
715
|
-
vault_service_config_id: str | None = None,
|
716
|
-
salt_vault_secret_id: str | None = None,
|
717
|
-
rules: Mapping[str, RuleV1] | None = None,
|
718
|
-
rulesets: Mapping[str, RulesetV1] | None = None,
|
719
|
-
supported_languages: Sequence[Literal["en"]] | None = None,
|
720
|
-
) -> PangeaResponse[ServiceConfigResult]:
|
721
|
-
"""
|
722
|
-
Update a v1.0.0 service config.
|
723
|
-
|
724
|
-
OperationId: redact_post_v1beta_config_update
|
725
|
-
|
726
|
-
Args:
|
727
|
-
vault_service_config_id: Service config used to create the secret
|
728
|
-
salt_vault_secret_id: Pangea only allows hashing to be done using a salt value to prevent brute-force attacks.
|
729
|
-
"""
|
730
|
-
|
731
|
-
@overload
|
732
|
-
def update_service_config(
|
733
|
-
self,
|
734
|
-
config_id: str,
|
735
|
-
*,
|
736
|
-
version: Literal["2.0.0"] | None = None,
|
737
|
-
name: str,
|
738
|
-
updated_at: str,
|
739
|
-
enabled_rules: Sequence[str] | None = None,
|
740
|
-
enforce_enabled_rules: bool | None = None,
|
741
|
-
redactions: Mapping[str, Redaction] | None = None,
|
742
|
-
vault_service_config_id: str | None = None,
|
743
|
-
salt_vault_secret_id: str | None = None,
|
744
|
-
fpe_vault_secret_id: str | None = None,
|
745
|
-
rules: Mapping[str, RuleV2] | None = None,
|
746
|
-
rulesets: Mapping[str, RulesetV2] | None = None,
|
747
|
-
supported_languages: Sequence[Literal["en"]] | None = None,
|
748
|
-
) -> PangeaResponse[ServiceConfigResult]:
|
749
|
-
"""
|
750
|
-
Update a v2.0.0 service config.
|
751
|
-
|
752
|
-
OperationId: redact_post_v1beta_config_update
|
753
|
-
|
754
|
-
Args:
|
755
|
-
enforce_enabled_rules: Always run service config enabled rules across all redact calls regardless of flags?
|
756
|
-
vault_service_config_id: Service config used to create the secret
|
757
|
-
salt_vault_secret_id: Pangea only allows hashing to be done using a salt value to prevent brute-force attacks.
|
758
|
-
fpe_vault_secret_id: The ID of the key used by FF3 Encryption algorithms for FPE.
|
759
|
-
"""
|
760
|
-
|
761
|
-
def update_service_config(
|
762
|
-
self,
|
763
|
-
config_id: str,
|
764
|
-
*,
|
765
|
-
version: Literal["1.0.0", "2.0.0"] | None = None,
|
766
|
-
name: str,
|
767
|
-
updated_at: str,
|
768
|
-
enabled_rules: Sequence[str] | None = None,
|
769
|
-
enforce_enabled_rules: bool | None = None,
|
770
|
-
fpe_vault_secret_id: str | None = None,
|
771
|
-
redactions: Mapping[str, Redaction] | None = None,
|
772
|
-
rules: Mapping[str, RuleV1 | RuleV2] | None = None,
|
773
|
-
rulesets: Mapping[str, RulesetV1 | RulesetV2] | None = None,
|
774
|
-
salt_vault_secret_id: str | None = None,
|
775
|
-
supported_languages: Sequence[Literal["en"]] | None = None,
|
776
|
-
vault_service_config_id: str | None = None,
|
777
|
-
) -> PangeaResponse[ServiceConfigResult]:
|
778
|
-
"""
|
779
|
-
Update a service config.
|
780
|
-
|
781
|
-
OperationId: redact_post_v1beta_config_update
|
782
|
-
|
783
|
-
Args:
|
784
|
-
enforce_enabled_rules: Always run service config enabled rules across all redact calls regardless of flags?
|
785
|
-
fpe_vault_secret_id: The ID of the key used by FF3 Encryption algorithms for FPE.
|
786
|
-
salt_vault_secret_id: Pangea only allows hashing to be done using a salt value to prevent brute-force attacks.
|
787
|
-
vault_service_config_id: Service config used to create the secret
|
788
|
-
"""
|
789
|
-
|
790
|
-
response = self.request.post(
|
791
|
-
"v1beta/config/update",
|
792
|
-
PangeaResponseResult,
|
793
|
-
data={
|
794
|
-
"id": config_id,
|
795
|
-
"updated_at": updated_at,
|
796
|
-
"name": name,
|
797
|
-
"version": version,
|
798
|
-
"enabled_rules": enabled_rules,
|
799
|
-
"enforce_enabled_rules": enforce_enabled_rules,
|
800
|
-
"fpe_vault_secret_id": fpe_vault_secret_id,
|
801
|
-
"redactions": redactions,
|
802
|
-
"rules": rules,
|
803
|
-
"rulesets": rulesets,
|
804
|
-
"salt_vault_secret_id": salt_vault_secret_id,
|
805
|
-
"supported_languages": supported_languages,
|
806
|
-
"vault_service_config_id": vault_service_config_id,
|
807
|
-
},
|
808
|
-
)
|
809
|
-
response.result = TypeAdapter(ServiceConfigResult).validate_python(response.json["result"])
|
810
|
-
return cast(PangeaResponse[ServiceConfigResult], response)
|
811
|
-
|
812
|
-
def delete_service_config(
|
813
|
-
self,
|
814
|
-
config_id: str,
|
815
|
-
) -> PangeaResponse[ServiceConfigResult]:
|
816
|
-
"""
|
817
|
-
Delete a service config.
|
818
|
-
|
819
|
-
OperationId: redact_post_v1beta_config_delete
|
820
|
-
|
821
|
-
Args:
|
822
|
-
config_id: An ID for a service config
|
823
|
-
"""
|
824
|
-
|
825
|
-
response = self.request.post("v1beta/config/delete", PangeaResponseResult, data={"id": config_id})
|
826
|
-
response.result = TypeAdapter(ServiceConfigResult).validate_python(response.json["result"])
|
827
|
-
return cast(PangeaResponse[ServiceConfigResult], response)
|
828
|
-
|
829
|
-
def list_service_configs(
|
830
|
-
self,
|
831
|
-
*,
|
832
|
-
filter: ServiceConfigFilter | None = None,
|
833
|
-
last: str | None = None,
|
834
|
-
order: Literal["asc", "desc"] | None = None,
|
835
|
-
order_by: Literal["id", "created_at", "updated_at"] | None = None,
|
836
|
-
size: int | None = None,
|
837
|
-
) -> PangeaResponse[ServiceConfigListResult]:
|
838
|
-
"""
|
839
|
-
List service configs.
|
840
|
-
|
841
|
-
OperationId: redact_post_v1beta_config_list
|
842
|
-
|
843
|
-
Args:
|
844
|
-
last: Reflected value from a previous response to obtain the next page of results.
|
845
|
-
order: Order results asc(ending) or desc(ending).
|
846
|
-
order_by: Which field to order results by.
|
847
|
-
size: Maximum results to include in the response.
|
848
|
-
"""
|
849
|
-
|
850
|
-
return self.request.post(
|
851
|
-
"v1beta/config/list",
|
852
|
-
ServiceConfigListResult,
|
853
|
-
data={"filter": filter, "last": last, "order": order, "order_by": order_by, "size": size},
|
854
|
-
)
|
pangea/services/vault/vault.py
CHANGED
@@ -88,6 +88,9 @@ if TYPE_CHECKING:
|
|
88
88
|
from pangea.request import TResult
|
89
89
|
|
90
90
|
|
91
|
+
__all__ = ("ExportEncryptionAlgorithm", "ItemType", "ItemVersionState", "TransformAlphabet", "Vault")
|
92
|
+
|
93
|
+
|
91
94
|
VaultItem = Annotated[
|
92
95
|
Union[AsymmetricKey, SymmetricKey, Secret, ClientSecret, Folder, PangeaToken], Field(discriminator="type")
|
93
96
|
]
|
@@ -1,24 +1,25 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: pangea-sdk
|
3
|
-
Version: 6.
|
3
|
+
Version: 6.6.0
|
4
4
|
Summary: Pangea API SDK
|
5
|
-
License: MIT
|
6
5
|
Keywords: Pangea,SDK,Audit
|
7
6
|
Author: Glenn Gallien
|
8
|
-
Author-email: glenn.gallien@pangea.cloud
|
9
|
-
|
7
|
+
Author-email: Glenn Gallien <glenn.gallien@pangea.cloud>
|
8
|
+
License-Expression: MIT
|
10
9
|
Classifier: Topic :: Software Development
|
11
10
|
Classifier: Topic :: Software Development :: Libraries
|
12
|
-
Requires-Dist: aiohttp
|
13
|
-
Requires-Dist: cryptography
|
14
|
-
Requires-Dist: deprecated
|
15
|
-
Requires-Dist: google-crc32c
|
16
|
-
Requires-Dist: pydantic
|
17
|
-
Requires-Dist: python-dateutil
|
18
|
-
Requires-Dist: requests
|
19
|
-
Requires-Dist: requests-toolbelt
|
20
|
-
Requires-Dist: typing-extensions
|
21
|
-
Requires-Dist: yarl
|
11
|
+
Requires-Dist: aiohttp>=3.12.15,<4.0.0
|
12
|
+
Requires-Dist: cryptography>=45.0.6,<46.0.0
|
13
|
+
Requires-Dist: deprecated>=1.2.18,<2.0.0
|
14
|
+
Requires-Dist: google-crc32c>=1.7.1,<2.0.0
|
15
|
+
Requires-Dist: pydantic>=2.11.7,<3.0.0
|
16
|
+
Requires-Dist: python-dateutil>=2.9.0.post0,<3.0.0
|
17
|
+
Requires-Dist: requests>=2.32.5,<3.0.0
|
18
|
+
Requires-Dist: requests-toolbelt>=1.0.0,<2.0.0
|
19
|
+
Requires-Dist: typing-extensions>=4.15.0,<5.0.0
|
20
|
+
Requires-Dist: yarl>=1.20.1,<2.0.0
|
21
|
+
Requires-Python: >=3.9.2, <4.0.0
|
22
|
+
Project-URL: repository, https://github.com/pangeacyber/pangea-python
|
22
23
|
Description-Content-Type: text/markdown
|
23
24
|
|
24
25
|
<a href="https://pangea.cloud?utm_source=github&utm_medium=python-sdk" target="_blank" rel="noopener noreferrer">
|
@@ -116,8 +117,7 @@ The SDK supports the following configuration options via `PangeaConfig`:
|
|
116
117
|
Use `base_url_template` for more control over the URL, such as setting
|
117
118
|
service-specific paths. Defaults to `aws.us.pangea.cloud`.
|
118
119
|
- `request_retries` — Number of retries on the initial request.
|
119
|
-
- `request_backoff` —
|
120
|
-
- `request_timeout` — Timeout used on initial request attempts.
|
120
|
+
- `request_backoff` — A backoff factor to apply between request attempts.
|
121
121
|
- `poll_result_timeout` — Timeout used to poll results after 202 (in secs).
|
122
122
|
- `queued_retry_enabled` — Enable queued request retry support.
|
123
123
|
- `custom_user_agent` — Custom user agent to be used in the request headers.
|
@@ -243,4 +243,3 @@ It accepts multiple file formats:
|
|
243
243
|
[Beta Examples]: https://github.com/pangeacyber/pangea-python/tree/beta/examples
|
244
244
|
[Pangea Console]: https://console.pangea.cloud/
|
245
245
|
[Secure Audit Log]: https://pangea.cloud/docs/audit
|
246
|
-
|
@@ -0,0 +1,62 @@
|
|
1
|
+
pangea/__init__.py,sha256=j7MocWhIqtM9TirF83kkM6bNkkzclqSaoDRr0_0DrRU,293
|
2
|
+
pangea/_constants.py,sha256=gGGoQ6rhSiFEw1MKSGI588CHvFokG1Cf9SkkdPdRjVY,113
|
3
|
+
pangea/_typing.py,sha256=pFBLkW2gPVZkgvMibQkovusQJZuGjhcqpkeRHnQrvds,798
|
4
|
+
pangea/asyncio/__init__.py,sha256=96zytAbw70iKlqGwF12FCTf358_ijkBVNuo-1vBOyHI,79
|
5
|
+
pangea/asyncio/file_uploader.py,sha256=Ln-FvsHM-fq4vpAvfoYQevesQgM-ycLqg2MT-58xoU0,1435
|
6
|
+
pangea/asyncio/request.py,sha256=rLMUWGx6PZO7xCZAyvVcOQQRfBp7I0BmBRe3HE_YiLY,20943
|
7
|
+
pangea/asyncio/services/__init__.py,sha256=j39Z0CpDAUzdn5C61b-kZCtv9JPXQfQ4wkJSSFp5kXM,803
|
8
|
+
pangea/asyncio/services/ai_guard.py,sha256=NEn-kB9oUfNC26uKOapfPc60LeSyGPLeNAOuopDz6WE,7307
|
9
|
+
pangea/asyncio/services/audit.py,sha256=smZwzCKa37Wzo7yNqa-Rp7WCWNXXQCfjKA25PvxL8fo,26127
|
10
|
+
pangea/asyncio/services/authn.py,sha256=jWNIQ2Sb-0vn3hHGKJ47Xm-_EDs58vbgX6NwU_a9E70,52815
|
11
|
+
pangea/asyncio/services/authz.py,sha256=vtSQ3iEYUGL7aSn4S-UjiwzXHlMeAW0vp1fbU7rx6Y8,10796
|
12
|
+
pangea/asyncio/services/base.py,sha256=5SYEY5OVxpa5p0HtUV2OqpWNl8cP8qYxbQvpVgevZMQ,3416
|
13
|
+
pangea/asyncio/services/embargo.py,sha256=ctzj3kip6xos-Eu3JuOskrCGYC8T3JlsgAopZHiPSXM,3068
|
14
|
+
pangea/asyncio/services/file_scan.py,sha256=5Ckb3cXKpcoO7KTUu6ejr1uC43-6EJb91WuGOHroRHE,7202
|
15
|
+
pangea/asyncio/services/intel.py,sha256=WpQe8zN7T_y7OUzyYg3bu8yiKEH4iH1G60CRF6q5c60,39541
|
16
|
+
pangea/asyncio/services/prompt_guard.py,sha256=x8QZzT_tJ8eStyAhDDZ04T0EXLf3Pd53BFe39ts6fk0,2597
|
17
|
+
pangea/asyncio/services/redact.py,sha256=356Kd5sww6wJsxA6DFIJvVEJle00n7HijdINb61YX9E,8014
|
18
|
+
pangea/asyncio/services/sanitize.py,sha256=OybTAUfh_7vYRwb6Cjp4aHZoeHhIlg8caJ_BVrdbA1A,8691
|
19
|
+
pangea/asyncio/services/share.py,sha256=AV9FbA-IMU5TFhcBtUHoXKDQYfOIWAJJZKW6vFohBbs,30816
|
20
|
+
pangea/asyncio/services/vault.py,sha256=bYIUYmWYH8LqycfyDyNoS83BRWMd56t-RMt0B-TU8cQ,78564
|
21
|
+
pangea/audit_logger.py,sha256=DOzL5oyXwaPlsuK6VRHXn_lPdNc4Z7LHGj78RArXs5A,3861
|
22
|
+
pangea/config.py,sha256=KbSEq1_h4vp2q2YIfPCcJtaWCRAReKIfNjnXKC_jgTM,1973
|
23
|
+
pangea/crypto/rsa.py,sha256=mwSiNy571KAGr3F6oEM0CXWkl9D023ch8ldbZZeLj_4,4747
|
24
|
+
pangea/deep_verify.py,sha256=Z8vnrxEiwa3hcTJO6ckZpdSerQHjtgnUUllaWTAMdwI,8637
|
25
|
+
pangea/deprecated.py,sha256=3yiM7WnSOHq55ROtJvhjiTDSmOEIa0B85YPctVfp-WU,597
|
26
|
+
pangea/dump_audit.py,sha256=b89jKV3ewy77WA_AzVMIT04_E1CUxTplj94IURJM7nc,7081
|
27
|
+
pangea/exceptions.py,sha256=EiH7NiNDyN69ZYlVikF8d1tAO3_Do0bKl8dFXghY8t0,5585
|
28
|
+
pangea/file_uploader.py,sha256=KRuz2zA66aOyKGS9PXUW1qv9vLHOGMd1RHkAbhGk3cY,1329
|
29
|
+
pangea/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
|
+
pangea/request.py,sha256=PAbcRx746hSht20K_EOWPeQMjFzxjws7KfdMzzg_V10,27938
|
31
|
+
pangea/response.py,sha256=1OG5bPWE0j3p77tWYivG_O_O2SD8h0Tuq9WlN6rOKS0,7821
|
32
|
+
pangea/services/__init__.py,sha256=KP2U0-TcusW5H3GUFxS7Nc_LxxJ-X0uBbxeLQmGO6-o,667
|
33
|
+
pangea/services/ai_guard.py,sha256=MV_R8L-o5dU-DFV4uI0gqvlNXdXQl1uGV5vj3O_0-LU,19871
|
34
|
+
pangea/services/audit/audit.py,sha256=40jrCAOuZym_QsEfhghIjPm3KKWwPx9B3ZKJ-T7R4W4,39231
|
35
|
+
pangea/services/audit/exceptions.py,sha256=bhVuYe4ammacOVxwg98CChxvwZf5FKgR2DcgqILOcwc,471
|
36
|
+
pangea/services/audit/models.py,sha256=pE4jtYAn_c5JdPrXBfpKHwpRAqO_DTSCOy-QHkPMajw,15471
|
37
|
+
pangea/services/audit/signing.py,sha256=VsQkstQL1vxIdN2Ghxp4P-FLBpV_BIvDsBCkRAZQpk8,5593
|
38
|
+
pangea/services/audit/util.py,sha256=dDVCD70V6YHFVGmWbm3AOHofxI-OfeJeTMDYQ-5WSxo,7683
|
39
|
+
pangea/services/authn/authn.py,sha256=09g-89ymhS5tUeQXWEMb2ejKnTueaXKk8MgrdEA26Qo,51169
|
40
|
+
pangea/services/authn/models.py,sha256=Vrez5m_IvBvSN3ujrcsJ388u7rDyQUdMU8p3snqPZck,27218
|
41
|
+
pangea/services/authz.py,sha256=DJx41B5W8UrGP3Ea9t-qB4DSdIi1tvjtDMWONV5gdFg,16191
|
42
|
+
pangea/services/base.py,sha256=cnxwCSqZt-lvYG9etbJRXVxtHH67uMW07ptfVbfVfq4,3864
|
43
|
+
pangea/services/embargo.py,sha256=3rE3ImjBg2VUXQljGZICedsr14psWdymC2pmmdJF2co,4000
|
44
|
+
pangea/services/file_scan.py,sha256=gSla3VUmgl3iA7DcrCf1BKopvunPG5ecIvX4DwzYOvc,7952
|
45
|
+
pangea/services/intel.py,sha256=1aglQxS1skMM6RMdXdjIiRq3jv4hMTtp-DbFbuHj3Hs,55159
|
46
|
+
pangea/services/prompt_guard.py,sha256=FynHzWl3NH-GK2r9ID62d3VDLgQ5XPequIrJI1hUS1s,3485
|
47
|
+
pangea/services/redact.py,sha256=LJMHPK8hDxPLEVNfRgESAWgL4GBMiJC_pr1wXGb79W8,13225
|
48
|
+
pangea/services/sanitize.py,sha256=0ZlCrEg8imJtRyovy4qZJb1ZAZ8ppIOQTj_nocBJ2CM,13019
|
49
|
+
pangea/services/share/file_format.py,sha256=1svO1ee_aenA9zoO_AaU-Rk5Ulp7kcPOc_KwNoluyQE,2797
|
50
|
+
pangea/services/share/share.py,sha256=IhTilqWcQ2GlsJ7kHHuVbXfNu8jvFtPBnEeM26SNsY8,52403
|
51
|
+
pangea/services/vault/models/asymmetric.py,sha256=F6JMd9BlYJZSjfhJRavqcadmQJAbcd5drezLLQ_ZJEs,5058
|
52
|
+
pangea/services/vault/models/common.py,sha256=Vw0yCLEMymiDrFEkKlmPrYEejUJ_JonFeMEvy7wwZg0,18050
|
53
|
+
pangea/services/vault/models/keys.py,sha256=2Aiwv6UCbTeFykvGYW6eXd7J3hgImGCd8f5dYoHJ2cE,2805
|
54
|
+
pangea/services/vault/models/secret.py,sha256=Rz6cKTRWolbW8WW33-F7RWB29GI_lXiD72helbplvFk,1152
|
55
|
+
pangea/services/vault/models/symmetric.py,sha256=VqJ_C3xj2e4OtnFiPyngX6_sOcXKFf1yhatSF9PmB90,2629
|
56
|
+
pangea/services/vault/vault.py,sha256=PJs1YlTud1cPnhyUDMguIEyhN0i-haG1kuzA_4hygEk,77676
|
57
|
+
pangea/tools.py,sha256=JkwVplvx7MCPRSdPhFTLvOl6h7btaUbXEuHgUy0EHBU,6452
|
58
|
+
pangea/utils.py,sha256=QwTODI_D8by86uXeA0MpdhJICvz5baKUtfv1rguQshU,4943
|
59
|
+
pangea/verify_audit.py,sha256=-VepQKHtSqZRqhIKiUtLufa7ywwdMNLN2SuhingMooU,17288
|
60
|
+
pangea_sdk-6.6.0.dist-info/WHEEL,sha256=NHRAbdxxzyL9K3IO2LjmlNqKSyPZnKv2BD16YYVKo18,79
|
61
|
+
pangea_sdk-6.6.0.dist-info/METADATA,sha256=LhMZi-f0Kimf535y-GZsfRdoVG0weQMGO4uGnN4yx9A,8029
|
62
|
+
pangea_sdk-6.6.0.dist-info/RECORD,,
|