mosaic-python-client 0.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.
- mosaic_client/__init__.py +17 -0
- mosaic_client/epix/__init__.py +115 -0
- mosaic_client/epix/client.py +772 -0
- mosaic_client/epix/models.py +487 -0
- mosaic_client/epix/schemas.py +379 -0
- mosaic_client/gpas/__init__.py +13 -0
- mosaic_client/gpas/client.py +342 -0
- mosaic_client/gpas/models.py +70 -0
- mosaic_client/gpas/schemas.py +53 -0
- mosaic_client/helpers.py +115 -0
- mosaic_python_client-0.2.0.dist-info/METADATA +290 -0
- mosaic_python_client-0.2.0.dist-info/RECORD +14 -0
- mosaic_python_client-0.2.0.dist-info/WHEEL +4 -0
- mosaic_python_client-0.2.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains functions for interacting with the E-PIX SOAP interface.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from zeep import Client
|
|
6
|
+
|
|
7
|
+
from mosaic_client.epix.models import (
|
|
8
|
+
BatchRequestConfig,
|
|
9
|
+
BatchResponseEntry,
|
|
10
|
+
Domain,
|
|
11
|
+
DomainConfiguration,
|
|
12
|
+
FullIdentity,
|
|
13
|
+
IdentifierDomain,
|
|
14
|
+
Identity,
|
|
15
|
+
Person,
|
|
16
|
+
Reason,
|
|
17
|
+
ResponseEntry,
|
|
18
|
+
Source,
|
|
19
|
+
)
|
|
20
|
+
from mosaic_client.epix.schemas import (
|
|
21
|
+
BatchRequestConfigSchema,
|
|
22
|
+
DomainConfigurationSchema,
|
|
23
|
+
DomainSchema,
|
|
24
|
+
FullIdentitySchema,
|
|
25
|
+
IdentifierDomainSchema,
|
|
26
|
+
IdentitySchema,
|
|
27
|
+
PersonSchema,
|
|
28
|
+
ReasonSchema,
|
|
29
|
+
ResponseEntrySchema,
|
|
30
|
+
SourceSchema,
|
|
31
|
+
)
|
|
32
|
+
from mosaic_client.helpers import WSDLClient, _cast_client, _read_key_value_entry_response, _serialize_dict
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def request_mpi(
|
|
36
|
+
client: Client, domain_name: str, source_name: str, identity: Identity, comment: str | None = None
|
|
37
|
+
) -> ResponseEntry:
|
|
38
|
+
"""
|
|
39
|
+
Requests an MPI for an identity. This function throws a Fault if any required identity fields
|
|
40
|
+
are missing, as per the domain configuration.
|
|
41
|
+
|
|
42
|
+
:param client: Zeep client with E-PIX service definitions
|
|
43
|
+
:param domain_name: data domain to which the identity belongs
|
|
44
|
+
:param source_name: source name from which the identity stems
|
|
45
|
+
:param identity: identity to request MPI for
|
|
46
|
+
:param comment: optional comment on this transaction
|
|
47
|
+
:return: MPI response, indicating whether the identity already exists and containing the assigned MPI
|
|
48
|
+
"""
|
|
49
|
+
identity_soap = IdentitySchema().dump(identity)
|
|
50
|
+
response_entry_soap = client.service.requestMPI(
|
|
51
|
+
domainName=domain_name,
|
|
52
|
+
identity=identity_soap,
|
|
53
|
+
sourceName=source_name,
|
|
54
|
+
comment=comment,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return ResponseEntrySchema().load(_serialize_dict(response_entry_soap))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def get_person_by_mpi(client: Client, domain_name: str, mpi_id: str) -> Person:
|
|
61
|
+
"""
|
|
62
|
+
Returns a person by their MPI. This function throws a Fault if the MPI is not present.
|
|
63
|
+
|
|
64
|
+
:param client: Zeep client with E-PIX service definitions
|
|
65
|
+
:param domain_name: data domain in which to look for the person
|
|
66
|
+
:param mpi_id: MPI of the desired person
|
|
67
|
+
:return: person assigned to the specified MPI
|
|
68
|
+
"""
|
|
69
|
+
person_soap = client.service.getPersonByMPI(domainName=domain_name, mpiId=mpi_id)
|
|
70
|
+
return PersonSchema().load(_serialize_dict(person_soap))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _malformed_mpi_response(reason: str) -> ValueError:
|
|
74
|
+
"""
|
|
75
|
+
Returns an error to indicate a malformed E-PIX response.
|
|
76
|
+
|
|
77
|
+
:param reason: reason for error
|
|
78
|
+
:return: ValueError with specified reason
|
|
79
|
+
"""
|
|
80
|
+
return ValueError(f"MPI response is malformed: {reason}")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def update_person(
|
|
84
|
+
client: Client,
|
|
85
|
+
domain_name: str,
|
|
86
|
+
source_name: str,
|
|
87
|
+
mpi_id: str,
|
|
88
|
+
identity: Identity,
|
|
89
|
+
force: bool = False,
|
|
90
|
+
comment: str | None = None,
|
|
91
|
+
) -> ResponseEntry:
|
|
92
|
+
"""
|
|
93
|
+
Updates an identity, addressed by their MPI. This function throws a Fault if any required identity fields
|
|
94
|
+
are missing, as per the domain configuration.
|
|
95
|
+
|
|
96
|
+
:param client: Zeep client with E-PIX service definitions
|
|
97
|
+
:param domain_name: data domain to which the identity belongs
|
|
98
|
+
:param source_name: source name from which the identity stems
|
|
99
|
+
:param mpi_id: MPI of the person to update
|
|
100
|
+
:param identity: identity with updated information
|
|
101
|
+
:param force: undocumented API option
|
|
102
|
+
:param comment: optional comment on this transaction
|
|
103
|
+
:return: updated person record
|
|
104
|
+
"""
|
|
105
|
+
identity_soap = IdentitySchema().dump(identity)
|
|
106
|
+
response_entry_soap = client.service.updatePerson(
|
|
107
|
+
domainName=domain_name,
|
|
108
|
+
sourceName=source_name,
|
|
109
|
+
mpiId=mpi_id,
|
|
110
|
+
identity=identity_soap,
|
|
111
|
+
force=force,
|
|
112
|
+
comment=comment,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
return ResponseEntrySchema().load(_serialize_dict(response_entry_soap))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def get_persons_for_domain(client: Client, domain_name: str) -> list[Person]:
|
|
119
|
+
"""
|
|
120
|
+
Returns a list of persons stored in a domain. This function throws a Fault if the specified domain
|
|
121
|
+
doesn't exist.
|
|
122
|
+
|
|
123
|
+
:param client: Zeep client with E-PIX service definitions
|
|
124
|
+
:param domain_name: data domain in which to look for persons
|
|
125
|
+
:return: list of persons inside the specified domain
|
|
126
|
+
"""
|
|
127
|
+
persons_lst = _serialize_dict(client.service.getPersonsForDomain(domainName=domain_name))
|
|
128
|
+
|
|
129
|
+
return [PersonSchema().load(person) for person in persons_lst]
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def get_identities_for_domain(client: Client, domain_name: str) -> list[FullIdentity]:
|
|
133
|
+
"""
|
|
134
|
+
Returns a list of identities stored in a domain. This function throws a Fault if the specified domain
|
|
135
|
+
doesn't exist.
|
|
136
|
+
|
|
137
|
+
:param client: Zeep client with E-PIX service definitions
|
|
138
|
+
:param domain_name: data domain in which to look for identities
|
|
139
|
+
:return: list of identities inside the specified domain
|
|
140
|
+
"""
|
|
141
|
+
identity_lst = _serialize_dict(client.service.getIdentitiesForDomain(domainName=domain_name))
|
|
142
|
+
|
|
143
|
+
return [FullIdentitySchema().load(identity) for identity in identity_lst]
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def deactivate_identity(client: Client, identity_id: int) -> None:
|
|
147
|
+
"""
|
|
148
|
+
Deactivates an identity based on their identity ID (not MPI!). This function throws a Fault if the
|
|
149
|
+
specified identity ID cannot be found.
|
|
150
|
+
|
|
151
|
+
:param client: Zeep client with E-PIX service definitions
|
|
152
|
+
:param identity_id: ID of the identity to deactivate
|
|
153
|
+
:return: nothing
|
|
154
|
+
"""
|
|
155
|
+
client.service.deactivateIdentity(identityId=identity_id)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def deactivate_person(client: Client, domain_name: str, mpi_id: str) -> None:
|
|
159
|
+
"""
|
|
160
|
+
Deactivates a person based on their MPI. This function throws a Fault if the specified MPI cannot be found
|
|
161
|
+
in the provided data domain.
|
|
162
|
+
|
|
163
|
+
:param client: Zeep client with E-PIX service definitions
|
|
164
|
+
:param domain_name: data domain in which to look up the MPI
|
|
165
|
+
:param mpi_id: MPI of the person to deactivate
|
|
166
|
+
:return: nothing
|
|
167
|
+
"""
|
|
168
|
+
client.service.deactivatePerson(domainName=domain_name, mpiId=mpi_id)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def delete_identity(client: Client, identity_id: int) -> None:
|
|
172
|
+
"""
|
|
173
|
+
Deletes an identity based on their identity ID (not MPI!). This function throws a Fault if the
|
|
174
|
+
specified identity ID cannot be found, or if the identity with the ID has not been deactivated yet.
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
:param client: Zeep client with E-PIX service definitions
|
|
178
|
+
:param identity_id: ID of the identity to delete
|
|
179
|
+
:return: nothing
|
|
180
|
+
"""
|
|
181
|
+
client.service.deleteIdentity(identityId=identity_id)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def delete_person(client: Client, domain_name: str, mpi_id: str) -> None:
|
|
185
|
+
"""
|
|
186
|
+
Deletes a person based on their MPI. This function throws a Fault if the specified MPI cannot be found
|
|
187
|
+
in the provided data domain, or if the identity with the ID has not been deactivated yet.
|
|
188
|
+
|
|
189
|
+
:param client: Zeep client with E-PIX service definitions
|
|
190
|
+
:param domain_name: data domain in which to look up the MPI
|
|
191
|
+
:param mpi_id: MPI of the person to delete
|
|
192
|
+
:return: nothing
|
|
193
|
+
"""
|
|
194
|
+
client.service.deletePerson(domainName=domain_name, mpiId=mpi_id)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def request_mpi_batch(
|
|
198
|
+
client: Client,
|
|
199
|
+
domain_name: str,
|
|
200
|
+
source_name: str,
|
|
201
|
+
identities: list[Identity],
|
|
202
|
+
config: BatchRequestConfig | None = None,
|
|
203
|
+
comment: str | None = None,
|
|
204
|
+
) -> list[BatchResponseEntry]:
|
|
205
|
+
"""
|
|
206
|
+
Requests MPIs for a list of identities. This function throws a Fault if any required identity fields
|
|
207
|
+
are missing, as per the domain configuration.
|
|
208
|
+
|
|
209
|
+
:param client: Zeep client with E-PIX service definitions
|
|
210
|
+
:param domain_name: data domain to which the identities belong
|
|
211
|
+
:param source_name: source name from which the identities stem
|
|
212
|
+
:param identities: identities to request MPIs for
|
|
213
|
+
:param config: optional configuration on how to handle this request
|
|
214
|
+
:param comment: optional comment on this transaction
|
|
215
|
+
:return: list of MPI responses, indicating whether an identity already exists and containing the assigned MPI
|
|
216
|
+
"""
|
|
217
|
+
# load config if present
|
|
218
|
+
if config is not None:
|
|
219
|
+
config = BatchRequestConfigSchema().dump(config)
|
|
220
|
+
|
|
221
|
+
response_soap = client.service.requestMPIBatch(
|
|
222
|
+
mpiRequest={
|
|
223
|
+
"comment": comment,
|
|
224
|
+
"domainName": domain_name,
|
|
225
|
+
"requestConfig": config,
|
|
226
|
+
"requestEntries": [IdentitySchema().dump(identity) for identity in identities],
|
|
227
|
+
"sourceName": source_name,
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
key_value_lst = _read_key_value_entry_response(_serialize_dict(response_soap))
|
|
232
|
+
batch_response_entry_lst: list[BatchResponseEntry] = []
|
|
233
|
+
|
|
234
|
+
for kv_entry in key_value_lst:
|
|
235
|
+
identity = IdentitySchema().load(kv_entry[0])
|
|
236
|
+
response_entry = ResponseEntrySchema().load(kv_entry[1])
|
|
237
|
+
|
|
238
|
+
batch_response_entry_lst.append(
|
|
239
|
+
BatchResponseEntry(
|
|
240
|
+
match_status=response_entry.match_status,
|
|
241
|
+
person=response_entry.person,
|
|
242
|
+
identity=identity,
|
|
243
|
+
mpi_error_code=response_entry.mpi_error_code,
|
|
244
|
+
)
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
return batch_response_entry_lst
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def add_identifier_domain(client: Client, identifier_domain: IdentifierDomain) -> None:
|
|
251
|
+
"""
|
|
252
|
+
Adds a new identifier domain.
|
|
253
|
+
|
|
254
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
255
|
+
:param identifier_domain: identifier domain data class to create
|
|
256
|
+
"""
|
|
257
|
+
domain_soap = IdentifierDomainSchema().dump(identifier_domain)
|
|
258
|
+
client.service.addIdentifierDomain(domain_soap)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def get_identifier_domain(client: Client, domain_name: str) -> IdentifierDomain:
|
|
262
|
+
"""
|
|
263
|
+
Gets an identifier domain by its name.
|
|
264
|
+
|
|
265
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
266
|
+
:param domain_name: name of the identifier domain to get
|
|
267
|
+
:return: identifier domain instance
|
|
268
|
+
"""
|
|
269
|
+
domain_soap = client.service.getIdentifierDomain(identifierDomainName=domain_name)
|
|
270
|
+
return IdentifierDomainSchema().load(_serialize_dict(domain_soap))
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def get_identifier_domains(client: Client) -> list[IdentifierDomain]:
|
|
274
|
+
"""
|
|
275
|
+
Lists all available identifier domains in the E-PIX instance.
|
|
276
|
+
|
|
277
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
278
|
+
:return: list of all available identifier domains as identifier domain instances
|
|
279
|
+
"""
|
|
280
|
+
domains = _serialize_dict(client.service.getIdentifierDomains())
|
|
281
|
+
return [IdentifierDomainSchema().load(domain) for domain in domains]
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def delete_identifier_domain(client: Client, domain_name: str) -> None:
|
|
285
|
+
"""
|
|
286
|
+
Deletes an identifier domain that matches the specified name. Raises a Fault if there is no identifier domain with
|
|
287
|
+
such a name.
|
|
288
|
+
|
|
289
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
290
|
+
:param domain_name: name of the identifier domain to delete
|
|
291
|
+
"""
|
|
292
|
+
client.service.deleteIdentifierDomain(identifierDomainName=domain_name)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def update_identifier_domain(client: Client, identifier_domain: IdentifierDomain) -> IdentifierDomain:
|
|
296
|
+
"""
|
|
297
|
+
Updates an identifier domain with the given identifier domain instance.
|
|
298
|
+
|
|
299
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
300
|
+
:param identifier_domain: identifier domain data class with update information
|
|
301
|
+
:return: updated identifier domain instance
|
|
302
|
+
"""
|
|
303
|
+
domain_soap = IdentifierDomainSchema().dump(identifier_domain)
|
|
304
|
+
response_domain_soap = client.service.updateIdentifierDomain(identifierDomain=domain_soap)
|
|
305
|
+
return IdentifierDomainSchema().load(_serialize_dict(response_domain_soap))
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def add_source(client: Client, source: Source) -> None:
|
|
309
|
+
"""
|
|
310
|
+
Adds a new data source.
|
|
311
|
+
|
|
312
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
313
|
+
:param source: source data class to create
|
|
314
|
+
"""
|
|
315
|
+
source_soap = SourceSchema().dump(source)
|
|
316
|
+
client.service.addSource(source=source_soap)
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def get_source(client: Client, source_name: str) -> Source:
|
|
320
|
+
"""
|
|
321
|
+
Gets a data source by its name.
|
|
322
|
+
|
|
323
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
324
|
+
:param source_name: name of the data source to get
|
|
325
|
+
:return: source instance
|
|
326
|
+
"""
|
|
327
|
+
source_soap = client.service.getSource(sourceName=source_name)
|
|
328
|
+
return SourceSchema().load(_serialize_dict(source_soap))
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def get_sources(client: Client) -> list[Source]:
|
|
332
|
+
"""
|
|
333
|
+
Lists all available data sources in the E-PIX instance.
|
|
334
|
+
|
|
335
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
336
|
+
:return: list of all available data sources as source instances
|
|
337
|
+
"""
|
|
338
|
+
sources = _serialize_dict(client.service.getSources())
|
|
339
|
+
return [SourceSchema().load(source) for source in sources]
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def delete_source(client: Client, source_name: str) -> None:
|
|
343
|
+
"""
|
|
344
|
+
Deletes a data source that matches the specified name. Raises a Fault if there is no data source with such a name.
|
|
345
|
+
|
|
346
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
347
|
+
:param source_name: name of the data source to delete
|
|
348
|
+
"""
|
|
349
|
+
client.service.deleteSource(sourceName=source_name)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def update_source(client: Client, source: Source) -> Source:
|
|
353
|
+
"""
|
|
354
|
+
Updates a data source with the given source instance.
|
|
355
|
+
|
|
356
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
357
|
+
:param source: source data class with update information
|
|
358
|
+
:return: updated source instance
|
|
359
|
+
"""
|
|
360
|
+
source_soap = SourceSchema().dump(source)
|
|
361
|
+
response_source_soap = client.service.updateSource(source=source_soap)
|
|
362
|
+
return SourceSchema().load(_serialize_dict(response_source_soap))
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
def add_domain(client: Client, domain: Domain) -> None:
|
|
366
|
+
"""
|
|
367
|
+
Adds a new domain.
|
|
368
|
+
|
|
369
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
370
|
+
:param domain: domain data class to create
|
|
371
|
+
"""
|
|
372
|
+
domain_soap = DomainSchema().dump(domain)
|
|
373
|
+
client.service.addDomain(domain=domain_soap)
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
def get_domain(client: Client, domain_name: str) -> Domain:
|
|
377
|
+
"""
|
|
378
|
+
Gets a domain by its name.
|
|
379
|
+
|
|
380
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
381
|
+
:param domain_name: name of the domain to get
|
|
382
|
+
:return: domain instance
|
|
383
|
+
"""
|
|
384
|
+
domain_soap = client.service.getDomain(domainName=domain_name)
|
|
385
|
+
return DomainSchema().load(_serialize_dict(domain_soap))
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
def get_domains(client: Client) -> list[Domain]:
|
|
389
|
+
"""
|
|
390
|
+
Lists all available domains in the E-PIX instance.
|
|
391
|
+
|
|
392
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
393
|
+
:return: list of all available domains as domain instances
|
|
394
|
+
"""
|
|
395
|
+
domains = _serialize_dict(client.service.getDomains())
|
|
396
|
+
return [DomainSchema().load(domain) for domain in domains]
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
def delete_domain(client: Client, domain_name: str, force: bool = False) -> None:
|
|
400
|
+
"""
|
|
401
|
+
Deletes a domain that matches the specified name. Raises a Fault if there is no domain with such a name. Set force
|
|
402
|
+
to True, if the domain is already populated.
|
|
403
|
+
|
|
404
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
405
|
+
:param domain_name: name of the domain to delete
|
|
406
|
+
:param force: whether the deletion should be forced or not
|
|
407
|
+
"""
|
|
408
|
+
client.service.deleteDomain(domainName=domain_name, force=force)
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def get_config_for_domain(client: Client, domain_name: str) -> DomainConfiguration:
|
|
412
|
+
"""
|
|
413
|
+
Gets the configuration for a specified domain.
|
|
414
|
+
|
|
415
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
416
|
+
:param domain_name: name of the domain to get the configuration for
|
|
417
|
+
:return: domain configuration instance
|
|
418
|
+
"""
|
|
419
|
+
config = client.service.getConfigurationForDomain(domainName=domain_name)
|
|
420
|
+
return DomainConfigurationSchema().load(_serialize_dict(config))
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def update_domain_in_use(client: Client, domain_name: str, label: str, description: str) -> Domain:
|
|
424
|
+
"""
|
|
425
|
+
Updates a domain that is already populated. If a domain is populated, it is only possible to update the label and
|
|
426
|
+
description of a domain.
|
|
427
|
+
|
|
428
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
429
|
+
:param domain_name: name of the domain to update
|
|
430
|
+
:param label: new label
|
|
431
|
+
:param description: new description
|
|
432
|
+
:return: updated domain instance
|
|
433
|
+
"""
|
|
434
|
+
domain_soap = client.service.updateDomainInUse(domainName=domain_name, label=label, description=description)
|
|
435
|
+
return DomainSchema().load(_serialize_dict(domain_soap))
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
def update_domain(client: Client, domain: Domain) -> Domain:
|
|
439
|
+
"""
|
|
440
|
+
Updates a domain with a given domain instance. Raises an error if the domain is already populated.
|
|
441
|
+
|
|
442
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
443
|
+
:param domain: domain instance class to update
|
|
444
|
+
:return: domain data class with update information
|
|
445
|
+
"""
|
|
446
|
+
domain_soap = DomainSchema().dump(domain)
|
|
447
|
+
response_domain_soap = client.service.updateDomain(domain=domain_soap)
|
|
448
|
+
return DomainSchema().load(_serialize_dict(response_domain_soap))
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
def get_defined_deduplication_reasons(client: Client, domain_name: str) -> list[Reason]:
|
|
452
|
+
"""
|
|
453
|
+
Gets a list of deduplication reasons for a given domain.
|
|
454
|
+
|
|
455
|
+
:param client: Zeep client with E-PIX management service definitions
|
|
456
|
+
:param domain_name: name of the domain to get the deduplication reasons for
|
|
457
|
+
:return: list of deduplication reasons as reason data class instances
|
|
458
|
+
"""
|
|
459
|
+
reasons = _serialize_dict(client.service.getDefinedDeduplicationReasons(domainName=domain_name))
|
|
460
|
+
return [ReasonSchema().load(reason) for reason in reasons]
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
class EPIXClient(WSDLClient):
|
|
464
|
+
"""
|
|
465
|
+
This class is a wrapper around the E-PIX service functions.
|
|
466
|
+
"""
|
|
467
|
+
|
|
468
|
+
def __init__(self, client: Client | str, management_client: Client | str):
|
|
469
|
+
"""
|
|
470
|
+
Constructs a new SOAP client for E-PIX service definitions.
|
|
471
|
+
|
|
472
|
+
:param client: URL to WSDL endpoint or zeep instance with WSDL information for the E-PIX service
|
|
473
|
+
:param management_client: URL to WSDL endpoint or zeep instance with WSDL information for the E-PIX management
|
|
474
|
+
service
|
|
475
|
+
"""
|
|
476
|
+
super().__init__(client)
|
|
477
|
+
self._management_client = _cast_client(management_client)
|
|
478
|
+
|
|
479
|
+
def request_mpi(
|
|
480
|
+
self,
|
|
481
|
+
domain_name: str,
|
|
482
|
+
source_name: str,
|
|
483
|
+
identity: Identity,
|
|
484
|
+
comment: str | None = None,
|
|
485
|
+
) -> ResponseEntry:
|
|
486
|
+
"""
|
|
487
|
+
Requests an MPI for an identity. This function throws a Fault if any required identity fields
|
|
488
|
+
are missing, as per the domain configuration.
|
|
489
|
+
|
|
490
|
+
:param domain_name: data domain to which the identity belongs
|
|
491
|
+
:param source_name: source name from which the identity stems
|
|
492
|
+
:param identity: identity to request MPI for
|
|
493
|
+
:param comment: optional comment on this transaction
|
|
494
|
+
:return: MPI response, indicating whether the identity already exists and containing the assigned MPI
|
|
495
|
+
"""
|
|
496
|
+
return request_mpi(self._client, domain_name, source_name, identity, comment)
|
|
497
|
+
|
|
498
|
+
def request_mpi_batch(
|
|
499
|
+
self,
|
|
500
|
+
domain_name: str,
|
|
501
|
+
source_name: str,
|
|
502
|
+
identities: list[Identity],
|
|
503
|
+
config: BatchRequestConfig | None = None,
|
|
504
|
+
comment: str | None = None,
|
|
505
|
+
) -> list[BatchResponseEntry]:
|
|
506
|
+
"""
|
|
507
|
+
Requests MPIs for a list of identities. This function throws a Fault if any required identity fields
|
|
508
|
+
are missing, as per the domain configuration.
|
|
509
|
+
|
|
510
|
+
:param domain_name: data domain to which the identities belong
|
|
511
|
+
:param source_name: source name from which the identities stem
|
|
512
|
+
:param identities: identities to request MPIs for
|
|
513
|
+
:param config: optional configuration on how to handle this request
|
|
514
|
+
:param comment: optional comment on this transaction
|
|
515
|
+
:return: list of MPI responses, indicating whether an identity already exists and containing the assigned MPI
|
|
516
|
+
"""
|
|
517
|
+
return request_mpi_batch(self._client, domain_name, source_name, identities, config, comment)
|
|
518
|
+
|
|
519
|
+
def get_person_by_mpi(self, domain_name: str, mpi_id: str) -> Person:
|
|
520
|
+
"""
|
|
521
|
+
Returns a person by their MPI. This function throws a Fault if the MPI is not present.
|
|
522
|
+
|
|
523
|
+
:param domain_name: data domain in which to look for the person
|
|
524
|
+
:param mpi_id: MPI of the desired person
|
|
525
|
+
:return: person assigned to the specified MPI
|
|
526
|
+
"""
|
|
527
|
+
return get_person_by_mpi(self._client, domain_name, mpi_id)
|
|
528
|
+
|
|
529
|
+
def update_person(
|
|
530
|
+
self,
|
|
531
|
+
domain_name: str,
|
|
532
|
+
source_name: str,
|
|
533
|
+
mpi_id: str,
|
|
534
|
+
identity: Identity,
|
|
535
|
+
force: bool = False,
|
|
536
|
+
comment: str | None = None,
|
|
537
|
+
) -> ResponseEntry:
|
|
538
|
+
"""
|
|
539
|
+
Updates an identity, addressed by their MPI. This function throws a Fault if any required identity fields
|
|
540
|
+
are missing, as per the domain configuration.
|
|
541
|
+
|
|
542
|
+
:param domain_name: data domain to which the identity belongs
|
|
543
|
+
:param source_name: source name from which the identity stems
|
|
544
|
+
:param mpi_id: MPI of the person to update
|
|
545
|
+
:param identity: identity with updated information
|
|
546
|
+
:param force: undocumented API option
|
|
547
|
+
:param comment: optional comment on this transaction
|
|
548
|
+
:return: updated person record
|
|
549
|
+
"""
|
|
550
|
+
return update_person(self._client, domain_name, source_name, mpi_id, identity, force, comment)
|
|
551
|
+
|
|
552
|
+
def get_persons_for_domain(self, domain_name: str) -> list[Person]:
|
|
553
|
+
"""
|
|
554
|
+
Returns a list of persons stored in a domain. This function throws a Fault if the specified domain
|
|
555
|
+
doesn't exist.
|
|
556
|
+
|
|
557
|
+
:param domain_name: data domain in which to look for persons
|
|
558
|
+
:return: list of persons inside the specified domain
|
|
559
|
+
"""
|
|
560
|
+
return get_persons_for_domain(self._client, domain_name)
|
|
561
|
+
|
|
562
|
+
def get_identities_for_domain(self, domain_name: str) -> list[FullIdentity]:
|
|
563
|
+
"""
|
|
564
|
+
Returns a list of identities stored in a domain. This function throws a Fault if the specified domain
|
|
565
|
+
doesn't exist.
|
|
566
|
+
|
|
567
|
+
:param domain_name: data domain in which to look for identities
|
|
568
|
+
:return: list of identities inside the specified domain
|
|
569
|
+
"""
|
|
570
|
+
return get_identities_for_domain(self._client, domain_name)
|
|
571
|
+
|
|
572
|
+
def deactivate_identity(self, identity_id: int) -> None:
|
|
573
|
+
"""
|
|
574
|
+
Deactivates an identity based on their identity ID (not MPI!). This function throws a Fault if the
|
|
575
|
+
specified identity ID cannot be found.
|
|
576
|
+
|
|
577
|
+
:param identity_id: ID of the identity to deactivate
|
|
578
|
+
:return: nothing
|
|
579
|
+
"""
|
|
580
|
+
deactivate_identity(self._client, identity_id)
|
|
581
|
+
|
|
582
|
+
def deactivate_person(self, domain_name: str, mpi_id: str) -> None:
|
|
583
|
+
"""
|
|
584
|
+
Deactivates a person based on their MPI. This function throws a Fault if the specified MPI cannot be found
|
|
585
|
+
in the provided data domain.
|
|
586
|
+
|
|
587
|
+
:param domain_name: data domain in which to look up the MPI
|
|
588
|
+
:param mpi_id: MPI of the person to deactivate
|
|
589
|
+
:return: nothing
|
|
590
|
+
"""
|
|
591
|
+
deactivate_person(self._client, domain_name, mpi_id)
|
|
592
|
+
|
|
593
|
+
def delete_identity(self, identity_id: int) -> None:
|
|
594
|
+
"""
|
|
595
|
+
Deletes an identity based on their identity ID (not MPI!). This function throws a Fault if the
|
|
596
|
+
specified identity ID cannot be found, or if the identity with the ID has not been deactivated yet.
|
|
597
|
+
|
|
598
|
+
:param identity_id: ID of the identity to delete
|
|
599
|
+
:return: nothing
|
|
600
|
+
"""
|
|
601
|
+
delete_identity(self._client, identity_id)
|
|
602
|
+
|
|
603
|
+
def delete_person(self, domain_name: str, mpi_id: str) -> None:
|
|
604
|
+
"""
|
|
605
|
+
Deletes a person based on their MPI. This function throws a Fault if the specified MPI cannot be found
|
|
606
|
+
in the provided data domain, or if the identity with the ID has not been deactivated yet.
|
|
607
|
+
|
|
608
|
+
:param domain_name: data domain in which to look up the MPI
|
|
609
|
+
:param mpi_id: MPI of the person to delete
|
|
610
|
+
:return: nothing
|
|
611
|
+
"""
|
|
612
|
+
delete_person(self._client, domain_name, mpi_id)
|
|
613
|
+
|
|
614
|
+
def add_identifier_domain(self, identifier_domain: IdentifierDomain) -> None:
|
|
615
|
+
"""
|
|
616
|
+
Adds a new identifier domain.
|
|
617
|
+
|
|
618
|
+
:param identifier_domain: identifier domain data class to create
|
|
619
|
+
"""
|
|
620
|
+
add_identifier_domain(self._management_client, identifier_domain)
|
|
621
|
+
|
|
622
|
+
def get_identifier_domain(self, identifier_domain_name: str) -> IdentifierDomain:
|
|
623
|
+
"""
|
|
624
|
+
Gets an identifier domain by its name.
|
|
625
|
+
|
|
626
|
+
:param identifier_domain_name: name of the identifier domain to get
|
|
627
|
+
:return: identifier domain instance
|
|
628
|
+
"""
|
|
629
|
+
return get_identifier_domain(self._management_client, identifier_domain_name)
|
|
630
|
+
|
|
631
|
+
def get_identifier_domains(self) -> list[IdentifierDomain]:
|
|
632
|
+
"""
|
|
633
|
+
Lists all available identifier domains in the E-PIX instance.
|
|
634
|
+
|
|
635
|
+
:return: list of all available identifier domains as identifier domain instances
|
|
636
|
+
"""
|
|
637
|
+
return get_identifier_domains(self._management_client)
|
|
638
|
+
|
|
639
|
+
def delete_identifier_domain(self, identifier_domain_name: str) -> None:
|
|
640
|
+
"""
|
|
641
|
+
Deletes an identifier domain that matches the specified name. Raises a Fault if there is no identifier domain
|
|
642
|
+
with such a name.
|
|
643
|
+
|
|
644
|
+
:param identifier_domain_name: name of the identifier domain to delete
|
|
645
|
+
"""
|
|
646
|
+
delete_identifier_domain(self._management_client, identifier_domain_name)
|
|
647
|
+
|
|
648
|
+
def update_identifier_domain(self, identifier_domain: IdentifierDomain) -> IdentifierDomain:
|
|
649
|
+
"""
|
|
650
|
+
Updates an identifier domain with the given identifier domain instance.
|
|
651
|
+
|
|
652
|
+
:param identifier_domain: identifier domain data class with update information
|
|
653
|
+
:return: updated identifier domain instance
|
|
654
|
+
"""
|
|
655
|
+
return update_identifier_domain(self._management_client, identifier_domain)
|
|
656
|
+
|
|
657
|
+
def add_source(self, source: Source) -> None:
|
|
658
|
+
"""
|
|
659
|
+
Adds a new data source.
|
|
660
|
+
|
|
661
|
+
:param source: source data class to create
|
|
662
|
+
"""
|
|
663
|
+
add_source(self._management_client, source)
|
|
664
|
+
|
|
665
|
+
def get_source(self, source_name: str) -> Source:
|
|
666
|
+
"""
|
|
667
|
+
Gets a data source by its name.
|
|
668
|
+
|
|
669
|
+
:param source_name: name of the data source to get
|
|
670
|
+
:return: source instance
|
|
671
|
+
"""
|
|
672
|
+
return get_source(self._management_client, source_name)
|
|
673
|
+
|
|
674
|
+
def get_sources(self) -> list[Source]:
|
|
675
|
+
"""
|
|
676
|
+
Lists all available data sources in the E-PIX instance.
|
|
677
|
+
|
|
678
|
+
:return: list of all available data sources as source instances
|
|
679
|
+
"""
|
|
680
|
+
return get_sources(self._management_client)
|
|
681
|
+
|
|
682
|
+
def delete_source(self, source_name: str) -> None:
|
|
683
|
+
"""
|
|
684
|
+
Deletes a data source that matches the specified name. Raises a Fault if there is no data source with such a
|
|
685
|
+
name.
|
|
686
|
+
|
|
687
|
+
:param source_name: name of the data source to delete
|
|
688
|
+
"""
|
|
689
|
+
delete_source(self._management_client, source_name)
|
|
690
|
+
|
|
691
|
+
def update_source(self, source: Source) -> Source:
|
|
692
|
+
"""
|
|
693
|
+
Updates a data source with the given source instance.
|
|
694
|
+
|
|
695
|
+
:param source: source data class with update information
|
|
696
|
+
:return: updated source instance
|
|
697
|
+
"""
|
|
698
|
+
return update_source(self._management_client, source)
|
|
699
|
+
|
|
700
|
+
def add_domain(self, domain: Domain) -> None:
|
|
701
|
+
"""
|
|
702
|
+
Adds a new domain.
|
|
703
|
+
|
|
704
|
+
:param domain: domain data class to create
|
|
705
|
+
"""
|
|
706
|
+
add_domain(self._management_client, domain)
|
|
707
|
+
|
|
708
|
+
def get_domain(self, domain_name: str) -> Domain:
|
|
709
|
+
"""
|
|
710
|
+
Gets a domain by its name.
|
|
711
|
+
|
|
712
|
+
:param domain_name: name of the domain to get
|
|
713
|
+
:return: domain instance
|
|
714
|
+
"""
|
|
715
|
+
return get_domain(self._management_client, domain_name)
|
|
716
|
+
|
|
717
|
+
def get_domains(self) -> list[Domain]:
|
|
718
|
+
"""
|
|
719
|
+
Lists all available domains in the E-PIX instance.
|
|
720
|
+
|
|
721
|
+
:return: list of all available domains as domain instances
|
|
722
|
+
"""
|
|
723
|
+
return get_domains(self._management_client)
|
|
724
|
+
|
|
725
|
+
def delete_domain(self, domain_name: str, force: bool = False) -> None:
|
|
726
|
+
"""
|
|
727
|
+
Deletes a domain that matches the specified name. Raises a Fault if there is no domain with such a name. Set
|
|
728
|
+
force to True, if the domain is already populated.
|
|
729
|
+
|
|
730
|
+
:param domain_name: name of the domain to delete
|
|
731
|
+
:param force: whether the deletion should be forced or not
|
|
732
|
+
"""
|
|
733
|
+
delete_domain(self._management_client, domain_name, force)
|
|
734
|
+
|
|
735
|
+
def get_config_for_domain(self, domain_name: str) -> DomainConfiguration:
|
|
736
|
+
"""
|
|
737
|
+
Gets the configuration for a specified domain.
|
|
738
|
+
|
|
739
|
+
:param domain_name: name of the domain to get the configuration for
|
|
740
|
+
:return: domain configuration instance
|
|
741
|
+
"""
|
|
742
|
+
return get_config_for_domain(self._management_client, domain_name)
|
|
743
|
+
|
|
744
|
+
def update_domain_in_use(self, domain_name: str, label: str, description: str) -> Domain:
|
|
745
|
+
"""
|
|
746
|
+
Updates a domain that is already populated. If a domain is populated, it is only possible to update the label
|
|
747
|
+
and description of a domain.
|
|
748
|
+
|
|
749
|
+
:param domain_name: name of the domain to update
|
|
750
|
+
:param label: new label
|
|
751
|
+
:param description: new description
|
|
752
|
+
:return: updated domain instance
|
|
753
|
+
"""
|
|
754
|
+
return update_domain_in_use(self._management_client, domain_name, label, description)
|
|
755
|
+
|
|
756
|
+
def update_domain(self, domain: Domain) -> Domain:
|
|
757
|
+
"""
|
|
758
|
+
Updates a domain with a given domain instance. Raises an error if the domain is already populated.
|
|
759
|
+
|
|
760
|
+
:param domain: domain instance class to update
|
|
761
|
+
:return: domain data class with update information
|
|
762
|
+
"""
|
|
763
|
+
return update_domain(self._management_client, domain)
|
|
764
|
+
|
|
765
|
+
def get_defined_deduplication_reasons(self, domain_name: str) -> list[Reason]:
|
|
766
|
+
"""
|
|
767
|
+
Gets a list of deduplication reasons for a given domain.
|
|
768
|
+
|
|
769
|
+
:param domain_name: name of the domain to get the deduplication reasons for
|
|
770
|
+
:return: list of deduplication reasons as reason data class instances
|
|
771
|
+
"""
|
|
772
|
+
return get_defined_deduplication_reasons(self._management_client, domain_name)
|