pangea-sdk 6.2.0b2__py3-none-any.whl → 6.4.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/services/redact.py CHANGED
@@ -7,74 +7,12 @@
7
7
  from __future__ import annotations
8
8
 
9
9
  import enum
10
- from collections.abc import Mapping, Sequence
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] = Field(min_length=1, max_length=1)
51
+ masking_char: Optional[List[str]] = None
114
52
 
115
53
 
116
- class Redaction(APIRequestModel):
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[Mapping[str, RedactionMethodOverrides]] = None
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[Mapping[str, RedactionMethodOverrides]] = None
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[Mapping[str, RedactionMethodOverrides]] = None,
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: Mapping[str, RedactionMethodOverrides] | None = None,
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
- )
@@ -23,8 +23,7 @@ EncodedPrivateKey = NewType("EncodedPrivateKey", str)
23
23
  EncodedSymmetricKey = NewType("EncodedSymmetricKey", str)
24
24
 
25
25
 
26
- Metadata = NewType("Metadata", Dict[str, str])
27
- Tags = NewType("Tags", List[str])
26
+ Tags = list[str]
28
27
 
29
28
 
30
29
  class ItemOrder(str, enum.Enum):
@@ -169,7 +168,7 @@ class ItemData(PangeaResponseResult):
169
168
  current_version: Optional[ItemVersion] = None
170
169
  name: Optional[str] = None
171
170
  folder: Optional[str] = None
172
- metadata: Optional[Metadata] = None
171
+ metadata: Optional[dict[str, str]] = None
173
172
  tags: Optional[Tags] = None
174
173
  rotation_frequency: Optional[str] = None
175
174
  rotation_state: Optional[str] = None
@@ -197,7 +196,7 @@ class Key(PangeaResponseResult):
197
196
  current_version: Optional[ItemVersion] = None
198
197
  name: str
199
198
  folder: str
200
- metadata: Optional[Metadata] = None
199
+ metadata: Optional[dict[str, str]] = None
201
200
  tags: Optional[Tags] = None
202
201
  rotation_frequency: str
203
202
  rotation_state: RotationState
@@ -223,7 +222,7 @@ class Secret(PangeaResponseResult):
223
222
  enabled: bool
224
223
  name: str
225
224
  folder: str
226
- metadata: Optional[Metadata] = None
225
+ metadata: Optional[dict[str, str]] = None
227
226
  tags: Optional[Tags] = None
228
227
  expiration: Optional[str] = None
229
228
  created_at: str
@@ -237,7 +236,7 @@ class ClientSecret(PangeaResponseResult):
237
236
  enabled: bool
238
237
  name: str
239
238
  folder: str
240
- metadata: Metadata
239
+ metadata: dict[str, str]
241
240
  tags: Tags
242
241
  expiration: str
243
242
  created_at: str
@@ -254,7 +253,7 @@ class Folder(PangeaResponseResult):
254
253
  type: Literal[ItemType.FOLDER] = ItemType.FOLDER
255
254
  name: str
256
255
  folder: str
257
- metadata: Metadata
256
+ metadata: dict[str, str]
258
257
  tags: Tags
259
258
  created_at: str
260
259
  inherited_settings: InheritedSettings
@@ -267,7 +266,7 @@ class ListItemData(PangeaResponseResult):
267
266
  folder: str
268
267
  created_at: str
269
268
  tags: Optional[Tags] = None
270
- metadata: Optional[Metadata] = None
269
+ metadata: Optional[dict[str, str]] = None
271
270
  last_rotated: Optional[str] = None
272
271
  next_rotation: Optional[str] = None
273
272
  disabled_at: Optional[str] = None
@@ -325,7 +324,7 @@ class UpdateRequest(APIRequestModel):
325
324
  id: str
326
325
  name: Optional[str] = None
327
326
  folder: Optional[str] = None
328
- metadata: Optional[Metadata] = None
327
+ metadata: Optional[Mapping[str, str]] = None
329
328
  tags: Optional[Tags] = None
330
329
  disabled_at: Optional[str] = None
331
330
  enabled: Optional[bool] = None
@@ -410,7 +409,7 @@ class StateChangeResult(PangeaResponseResult):
410
409
  class FolderCreateRequest(APIRequestModel):
411
410
  name: str
412
411
  folder: str
413
- metadata: Optional[Metadata] = None
412
+ metadata: Optional[Mapping[str, str]] = None
414
413
  tags: Optional[Tags] = None
415
414
  rotation_frequency: Optional[str] = None
416
415
  rotation_state: Optional[RequestRotationState] = None
@@ -431,7 +430,7 @@ class FolderCreateResult(PangeaResponseResult):
431
430
  folder: str
432
431
  """The folder where this item is stored."""
433
432
 
434
- metadata: Optional[Metadata] = None
433
+ metadata: Optional[dict[str, str]] = None
435
434
  """User-provided metadata."""
436
435
 
437
436
  tags: Optional[Tags] = None
@@ -680,7 +679,7 @@ class PangeaToken(PangeaResponseResult):
680
679
 
681
680
  item_versions: List[PangeaTokenVersion]
682
681
 
683
- metadata: Optional[Metadata] = None
682
+ metadata: Optional[dict[str, str]] = None
684
683
  """Metadata provided by the user."""
685
684
 
686
685
  num_versions: int
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from collections.abc import Mapping
3
4
  from typing import Literal, Optional, Union
4
5
 
5
6
  from pangea.response import APIRequestModel, PangeaDateTime
@@ -10,13 +11,7 @@ from pangea.services.vault.models.asymmetric import (
10
11
  AsymmetricKeyPurpose,
11
12
  AsymmetricKeySigningAlgorithm,
12
13
  )
13
- from pangea.services.vault.models.common import (
14
- ItemType,
15
- Metadata,
16
- RequestManualRotationState,
17
- RequestRotationState,
18
- Tags,
19
- )
14
+ from pangea.services.vault.models.common import ItemType, RequestManualRotationState, RequestRotationState, Tags
20
15
  from pangea.services.vault.models.symmetric import (
21
16
  SymmetricKeyEncryptionAlgorithm,
22
17
  SymmetricKeyFpeAlgorithm,
@@ -39,7 +34,7 @@ class CommonGenerateRequest(APIRequestModel):
39
34
  ]
40
35
  name: Optional[str] = None
41
36
  folder: Optional[str] = None
42
- metadata: Optional[Metadata] = None
37
+ metadata: Optional[Mapping[str, str]] = None
43
38
  tags: Optional[Tags] = None
44
39
  rotation_frequency: Optional[str] = None
45
40
  rotation_state: Optional[RequestRotationState] = RequestRotationState.INHERITED
@@ -71,7 +66,7 @@ class KeyStoreRequest(APIRequestModel):
71
66
  # Optional.
72
67
  name: Optional[str] = None
73
68
  folder: Optional[str] = None
74
- metadata: Optional[Metadata] = None
69
+ metadata: Optional[Mapping[str, str]] = None
75
70
  tags: Optional[Tags] = None
76
71
  rotation_frequency: Optional[str] = None
77
72
  rotation_state: Optional[RequestRotationState] = RequestRotationState.INHERITED