datamasque-python 1.1.8__py3-none-any.whl → 1.2.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.
@@ -3,7 +3,6 @@ from typing import Optional
3
3
 
4
4
  from datamasque.client.base import BaseClient
5
5
  from datamasque.client.exceptions import DataMasqueApiError
6
- from datamasque.client.models.discovery_config import DiscoveryConfigType
7
6
  from datamasque.client.models.discovery_config_library import DiscoveryConfigLibrary, DiscoveryConfigLibraryId
8
7
 
9
8
  logger = logging.getLogger(__name__)
@@ -31,14 +30,12 @@ class DiscoveryConfigLibraryClient(BaseClient):
31
30
  response = self.make_request("GET", f"/api/discovery/config-libraries/{library_id}/")
32
31
  return DiscoveryConfigLibrary.model_validate(response.json())
33
32
 
34
- def _get_discovery_config_library_id_by_name(
35
- self, name: str, config_type: DiscoveryConfigType, namespace: str
36
- ) -> Optional[DiscoveryConfigLibraryId]:
33
+ def _get_discovery_config_library_id_by_name(self, name: str, namespace: str) -> Optional[DiscoveryConfigLibraryId]:
37
34
  """
38
- Returns the ID of the library with the given name, type, and namespace, or `None` if there is none.
35
+ Returns the ID of the library with the given name and namespace, or `None` if there is none.
39
36
 
40
37
  The listing is filtered by name to keep the response small;
41
- type and namespace are matched client-side,
38
+ the namespace is matched client-side,
42
39
  since the API's namespace filter cannot select the default (empty) namespace.
43
40
  """
44
41
 
@@ -48,11 +45,7 @@ class DiscoveryConfigLibraryClient(BaseClient):
48
45
  params={"name_exact": name},
49
46
  )
50
47
  entries = [DiscoveryConfigLibrary.model_validate(item) for item in response.json()]
51
- matches = [
52
- entry
53
- for entry in entries
54
- if entry.name == name and entry.namespace == namespace and entry.config_type is config_type
55
- ]
48
+ matches = [entry for entry in entries if entry.name == name and entry.namespace == namespace]
56
49
  if not matches:
57
50
  return None
58
51
 
@@ -64,18 +57,15 @@ class DiscoveryConfigLibraryClient(BaseClient):
64
57
 
65
58
  return matches[0].id
66
59
 
67
- def get_discovery_config_library_by_name(
68
- self, name: str, config_type: DiscoveryConfigType, namespace: str = ""
69
- ) -> Optional[DiscoveryConfigLibrary]:
60
+ def get_discovery_config_library_by_name(self, name: str, namespace: str = "") -> Optional[DiscoveryConfigLibrary]:
70
61
  """
71
- Looks for a discovery config library matching the given name, type, and namespace (case-sensitive, exact match).
62
+ Looks for a discovery config library matching the given name and namespace (case-sensitive, exact match).
72
63
 
73
- Library names are unique per type within a namespace,
74
- so a type is required to identify a single library.
64
+ Library names are unique within a namespace.
75
65
  Returns it (with full YAML content) if found, otherwise `None`.
76
66
  """
77
67
 
78
- library_id = self._get_discovery_config_library_id_by_name(name, config_type, namespace)
68
+ library_id = self._get_discovery_config_library_id_by_name(name, namespace)
79
69
  if library_id is None:
80
70
  return None
81
71
 
@@ -106,7 +96,6 @@ class DiscoveryConfigLibraryClient(BaseClient):
106
96
 
107
97
  The library must have its `id` set (i.e., it must have been previously created or retrieved from the server)
108
98
  and its `yaml` content present.
109
- A library's `config_type` is fixed at creation and cannot be changed by an update.
110
99
  """
111
100
 
112
101
  if library.id is None:
@@ -129,12 +118,12 @@ class DiscoveryConfigLibraryClient(BaseClient):
129
118
 
130
119
  def create_or_update_discovery_config_library(self, library: DiscoveryConfigLibrary) -> DiscoveryConfigLibrary:
131
120
  """
132
- Creates the library, or updates the existing one with the same name, namespace, and config type.
121
+ Creates the library, or updates the existing one with the same name and namespace.
133
122
 
134
123
  Sets the library's `id` property.
135
124
  """
136
125
 
137
- library_id = self._get_discovery_config_library_id_by_name(library.name, library.config_type, library.namespace)
126
+ library_id = self._get_discovery_config_library_id_by_name(library.name, library.namespace)
138
127
  if library_id is not None:
139
128
  library.id = library_id
140
129
  return self.update_discovery_config_library(library)
@@ -157,16 +146,15 @@ class DiscoveryConfigLibraryClient(BaseClient):
157
146
  self._delete_if_exists(f"/api/discovery/config-libraries/{library_id}/", params=params)
158
147
 
159
148
  def delete_discovery_config_library_by_name_if_exists(
160
- self, name: str, config_type: DiscoveryConfigType, namespace: str = "", *, force: bool = False
149
+ self, name: str, namespace: str = "", *, force: bool = False
161
150
  ) -> None:
162
151
  """
163
- Deletes the discovery config library with the given name, type, and namespace.
152
+ Deletes the discovery config library with the given name and namespace.
164
153
 
165
- Library names are unique per type within a namespace,
166
- so a type is required to identify a single library.
154
+ Library names are unique within a namespace.
167
155
  No-op if no such library exists.
168
156
  """
169
157
 
170
- library_id = self._get_discovery_config_library_id_by_name(name, config_type, namespace)
158
+ library_id = self._get_discovery_config_library_id_by_name(name, namespace)
171
159
  if library_id is not None:
172
160
  self.delete_discovery_config_library_by_id_if_exists(library_id, force=force)
@@ -3,7 +3,6 @@ from typing import NewType, Optional
3
3
 
4
4
  from pydantic import BaseModel, ConfigDict, Field
5
5
 
6
- from datamasque.client.models.discovery_config import DiscoveryConfigType
7
6
  from datamasque.client.models.status import ValidationStatus
8
7
 
9
8
  DiscoveryConfigLibraryId = NewType("DiscoveryConfigLibraryId", str)
@@ -13,14 +12,13 @@ class DiscoveryConfigLibrary(BaseModel):
13
12
  """
14
13
  Represents a named, namespaced, persisted YAML discovery config library.
15
14
 
16
- Library names are unique per config type within a namespace,
17
- so a database and a file library may share a name.
15
+ A library is untyped: the same library may be imported by both database and
16
+ file discovery configs, and its name is unique within a namespace.
18
17
  """
19
18
 
20
19
  model_config = ConfigDict(extra="allow", populate_by_name=True)
21
20
 
22
21
  name: str
23
- config_type: DiscoveryConfigType
24
22
  namespace: str = ""
25
23
  yaml: Optional[str] = Field(default=None, alias="config_yaml")
26
24
  # Server-populated read-only fields, excluded from request bodies.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datamasque-python
3
- Version: 1.1.8
3
+ Version: 1.2.0
4
4
  Summary: Official Python client for the DataMasque data-masking API.
5
5
  Project-URL: Homepage, https://datamasque.com/
6
6
  Project-URL: Documentation, https://datamasque-python.readthedocs.io/
@@ -2,7 +2,7 @@ datamasque/client/__init__.py,sha256=Tq3xY-x3yQj5E05q5YJFxXzpYYEu_eOiKSGmX-IINHI
2
2
  datamasque/client/base.py,sha256=cXU4dluL9e1N1F2pV48iIvebv6OHt7Kh4Ka2y9vkOPo,14296
3
3
  datamasque/client/connections.py,sha256=EFinx8fJRme0mTxuWY3d29UnmUFbsQhMaUQT0Ma2PK4,2885
4
4
  datamasque/client/discovery.py,sha256=MTDiif6YWkv64hHXZ8YJxtRhoeKIvQVfjNYvjCIZCXE,21261
5
- datamasque/client/discovery_config_libraries.py,sha256=Ne8vzY9NDoY11O2HCSA8le9KiTlJPSoznKy3PL05lqY,7628
5
+ datamasque/client/discovery_config_libraries.py,sha256=bwuBTCnJUSnOyTz_I-_D6uS3wcRJh3ZRtfv2AOyMnmY,7024
6
6
  datamasque/client/discovery_configs.py,sha256=G-W-X_KizjjQLa-Rb6ixLjlkxbkCe4WGCOfYZrGtxIk,6420
7
7
  datamasque/client/dmclient.py,sha256=w8aloPHL8YGKfESUzn62G9XrVovDoGlqrktX_KuDL7U,1864
8
8
  datamasque/client/exceptions.py,sha256=YpM_vhnl31_02KQmx-NPP2AxR3gKYcmcxyb_35G9HVw,3755
@@ -22,7 +22,7 @@ datamasque/client/models/connection.py,sha256=loLy4RCiIfY9kvBFspSqJSRhHqhcJxm_mQ
22
22
  datamasque/client/models/data_selection.py,sha256=406yyUZ5NmLBSql2lYM1gsTWY5GWmnutmF-DjznAoLc,1904
23
23
  datamasque/client/models/discovery.py,sha256=w3DXPux15BDMVs5urTpU2DM8pnWUzS3LFzCr6ctymxk,13517
24
24
  datamasque/client/models/discovery_config.py,sha256=1CHMgSxMXuarPGfRcz9wX7jeZLn1SDw0UEe-L5naE54,1917
25
- datamasque/client/models/discovery_config_library.py,sha256=5MLIe3SCQ6IbhWbZ_avDL9H65fW4O5h3HtjlgEfcFGg,1378
25
+ datamasque/client/models/discovery_config_library.py,sha256=NW4bhrlpps_SyJcX07W-dfQ_i9C0OH3O0b9TQcXPl1w,1298
26
26
  datamasque/client/models/dm_instance.py,sha256=6h0WNlI1qt6jkrYFapIvuSJFkhRCcwbpx0PLG5NsrGw,2219
27
27
  datamasque/client/models/files.py,sha256=7hG3Q1-XYb1PF88l3ppsmBp2tjNtvQvv-RNTrOa7Nts,2784
28
28
  datamasque/client/models/git.py,sha256=F0KdMFe2vMyL-9tp3SGKGeOlbD1gbcjQn0jpOzNzybc,1782
@@ -36,7 +36,7 @@ datamasque/client/models/safe_data_preview.py,sha256=BiI9d13KdQrTin2JfbjiRiODjns
36
36
  datamasque/client/models/status.py,sha256=WiSMEy_YxdcIA46ioYpAEu8OK8UNDoXpV1W7IUhhyVY,3219
37
37
  datamasque/client/models/table_reference.py,sha256=55fKdHjC2TQnUmbp0XiWqfeFGXqcq4wXjbWgMaN3p3c,3835
38
38
  datamasque/client/models/user.py,sha256=UGAUzgJkf78m24_zFXXoA99zdut48BXkX_ivV8yq1Vc,2043
39
- datamasque_python-1.1.8.dist-info/METADATA,sha256=_uqOykCTG6M-qHCHbFxWOIzY5hNpxh2L2GOYfrH4Zr0,4497
40
- datamasque_python-1.1.8.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
41
- datamasque_python-1.1.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
42
- datamasque_python-1.1.8.dist-info/RECORD,,
39
+ datamasque_python-1.2.0.dist-info/METADATA,sha256=9PUXw1BVSYhSjvPC6YaRVwSlCDrdG0GITMsRw6JA2FE,4497
40
+ datamasque_python-1.2.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
41
+ datamasque_python-1.2.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
42
+ datamasque_python-1.2.0.dist-info/RECORD,,