pyegeria 0.6.3__py3-none-any.whl → 0.6.6__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.
- examples/widgets/cat/get_project_structure.py +165 -0
- examples/widgets/cat/list_cert_types.py +176 -0
- examples/widgets/cat/list_projects.py +20 -3
- examples/widgets/ops/monitor_engine_activity.py +14 -3
- pyegeria/__init__.py +4 -2
- pyegeria/_globals.py +1 -0
- pyegeria/asset_catalog_omvs.py +24 -29
- pyegeria/classification_manager_omvs.py +1830 -0
- pyegeria/feedback_manager_omvs.py +667 -674
- pyegeria/my_profile_omvs.py +6 -5
- pyegeria/project_manager_omvs.py +1 -1
- {pyegeria-0.6.3.dist-info → pyegeria-0.6.6.dist-info}/METADATA +3 -1
- {pyegeria-0.6.3.dist-info → pyegeria-0.6.6.dist-info}/RECORD +16 -14
- {pyegeria-0.6.3.dist-info → pyegeria-0.6.6.dist-info}/entry_points.txt +1 -0
- pyegeria/Xfeedback_manager_omvs.py +0 -238
- {pyegeria-0.6.3.dist-info → pyegeria-0.6.6.dist-info}/LICENSE +0 -0
- {pyegeria-0.6.3.dist-info → pyegeria-0.6.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1830 @@
|
|
1
|
+
"""PDX-License-Identifier: Apache-2.0
|
2
|
+
Copyright Contributors to the ODPi Egeria project.
|
3
|
+
|
4
|
+
This module contains an initial version of the feedback_manager_omvs
|
5
|
+
module.
|
6
|
+
|
7
|
+
"""
|
8
|
+
|
9
|
+
import asyncio
|
10
|
+
import json
|
11
|
+
|
12
|
+
from httpx import Response
|
13
|
+
|
14
|
+
from pyegeria import body_slimmer
|
15
|
+
# import json
|
16
|
+
from pyegeria._client import Client, max_paging_size
|
17
|
+
from pyegeria._globals import enable_ssl_check, default_time_out
|
18
|
+
|
19
|
+
|
20
|
+
def jprint(info, comment=None):
|
21
|
+
if comment:
|
22
|
+
print(comment)
|
23
|
+
print(json.dumps(info, indent=2))
|
24
|
+
|
25
|
+
|
26
|
+
def query_seperator(current_string):
|
27
|
+
if current_string == "":
|
28
|
+
return "?"
|
29
|
+
else:
|
30
|
+
return "&"
|
31
|
+
|
32
|
+
|
33
|
+
"params are in the form of [(paramName, value), (param2Name, value)] if the value is not None, it will be added to the query string"
|
34
|
+
|
35
|
+
|
36
|
+
def query_string(params):
|
37
|
+
result = ""
|
38
|
+
for i in range(len(params)):
|
39
|
+
if params[i][1] is not None:
|
40
|
+
result = f"{result}{query_seperator(result)}{params[i][0]}={params[i][1]}"
|
41
|
+
return result
|
42
|
+
|
43
|
+
|
44
|
+
def base_path(client, view_server: str):
|
45
|
+
return f"{client.platform_url}/servers/{view_server}/api/open-metadata/classification-manager"
|
46
|
+
|
47
|
+
|
48
|
+
def extract_relationships_plus(element):
|
49
|
+
type_name = element["relatedElement"]["type"]["typeName"]
|
50
|
+
guid = element["relationshipHeader"]["guid"]
|
51
|
+
properties = element["relationshipProperties"]["propertiesAsStrings"]
|
52
|
+
name = element["relatedElement"]["uniqueName"]
|
53
|
+
return {"name": name, "typeName": type_name, "guid": guid, "properties": properties}
|
54
|
+
|
55
|
+
|
56
|
+
def extract_related_elements_list(element_list):
|
57
|
+
return [extract_relationships_plus(element) for element in element_list]
|
58
|
+
|
59
|
+
|
60
|
+
def related_elements_response(response: dict, detailed_response: bool):
|
61
|
+
if detailed_response:
|
62
|
+
return response
|
63
|
+
else:
|
64
|
+
return extract_related_elements_list(response["elements"])
|
65
|
+
|
66
|
+
|
67
|
+
def element_properties_plus(element):
|
68
|
+
props_plus = element["properties"]
|
69
|
+
props_plus.update({"guid": element["elementHeader"]["guid"]})
|
70
|
+
props_plus.update({"versions": element["elementHeader"]["versions"]})
|
71
|
+
return props_plus
|
72
|
+
|
73
|
+
|
74
|
+
def element_property_plus_list(element_list):
|
75
|
+
return [element_properties_plus(element) for element in element_list]
|
76
|
+
|
77
|
+
|
78
|
+
def element_response(response: dict, element_type: str, detailed_response: bool):
|
79
|
+
if detailed_response:
|
80
|
+
return response
|
81
|
+
else:
|
82
|
+
return element_properties_plus(response[element_type])
|
83
|
+
|
84
|
+
|
85
|
+
def elements_response(response: dict, element_type: str, detailed_response: bool):
|
86
|
+
if detailed_response:
|
87
|
+
return response
|
88
|
+
else:
|
89
|
+
return element_property_plus_list(response[element_type])
|
90
|
+
|
91
|
+
|
92
|
+
class ClassificationManager(Client):
|
93
|
+
"""ClassificationManager is a class that extends the Client class. It
|
94
|
+
provides methods to CRUD annotations and to query elements and relationships. Async version.
|
95
|
+
|
96
|
+
Attributes:
|
97
|
+
|
98
|
+
server_name: str
|
99
|
+
The name of the View Server to connect to.
|
100
|
+
platform_url : str
|
101
|
+
URL of the server platform to connect to
|
102
|
+
user_id : str
|
103
|
+
The identity of the user calling the method - this sets a
|
104
|
+
default optionally used by the methods when the user
|
105
|
+
doesn't pass the user_id on a method call.
|
106
|
+
user_pwd: str
|
107
|
+
The password associated with the user_id. Defaults to None
|
108
|
+
verify_flag: bool
|
109
|
+
Flag to indicate if SSL Certificates should be verified in the HTTP
|
110
|
+
requests.
|
111
|
+
Defaults to False.
|
112
|
+
|
113
|
+
"""
|
114
|
+
|
115
|
+
def __init__(self, server_name: str, platform_url: str, token: str = None, user_id: str = None,
|
116
|
+
user_pwd: str = None, verify_flag: bool = enable_ssl_check, sync_mode: bool = True, ):
|
117
|
+
self.admin_command_root: str
|
118
|
+
Client.__init__(self, server_name, platform_url, user_id=user_id, user_pwd=user_pwd, token=token,
|
119
|
+
async_mode=sync_mode, )
|
120
|
+
|
121
|
+
#
|
122
|
+
# Get elements
|
123
|
+
#
|
124
|
+
async def _async_get_elements(self, open_metadata_type_name: str = None, effective_time: str = None,
|
125
|
+
for_lineage: bool = None, for_duplicate_processing: bool = None, start_from: int = 0,
|
126
|
+
page_size: int = max_paging_size, server_name: str = None, time_out: int = default_time_out) -> list | str:
|
127
|
+
"""
|
128
|
+
Retrieve elements of the requested type name. If no type name is specified, then any type of element may
|
129
|
+
be returned.
|
130
|
+
|
131
|
+
https://egeria-project.org/types/
|
132
|
+
|
133
|
+
Parameters
|
134
|
+
----------
|
135
|
+
open_metadata_type_name : str, default = None
|
136
|
+
- open metadata type to be used to restrict the search
|
137
|
+
effective_time: str, default = None
|
138
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
139
|
+
for_lineage: bool, default is set by server
|
140
|
+
- determines if elements classified as Memento should be returned - normally false
|
141
|
+
for_duplicate_processing: bool, default is set by server
|
142
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
143
|
+
start_from: int, default = 0
|
144
|
+
- index of the list to start from (0 for start).
|
145
|
+
page_size
|
146
|
+
- maximum number of elements to return.
|
147
|
+
server_name: str, default = None
|
148
|
+
- name of the server instances for this request.
|
149
|
+
time_out: int, default = default_time_out
|
150
|
+
- http request timeout for this request
|
151
|
+
|
152
|
+
Returns
|
153
|
+
-------
|
154
|
+
[dict] | str
|
155
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
156
|
+
|
157
|
+
Raises
|
158
|
+
------
|
159
|
+
InvalidParameterException
|
160
|
+
one of the parameters is null or invalid or
|
161
|
+
PropertyServerException
|
162
|
+
There is a problem adding the element properties to the metadata repository or
|
163
|
+
UserNotAuthorizedException
|
164
|
+
the requesting user is not authorized to issue this request.
|
165
|
+
"""
|
166
|
+
if server_name is None:
|
167
|
+
server_name = self.server_name
|
168
|
+
|
169
|
+
possible_query_params = query_string(
|
170
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
171
|
+
("forDuplicateProcessing", for_duplicate_processing)])
|
172
|
+
|
173
|
+
body = {"class": "FindProperties", "openMetadataTypeName": open_metadata_type_name,
|
174
|
+
"effectiveTime": effective_time, }
|
175
|
+
|
176
|
+
url = f"{base_path(self, server_name)}/elements/by-type{possible_query_params}"
|
177
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
178
|
+
elements = response.json().get('elements', 'No elements found')
|
179
|
+
if type(elements) is list:
|
180
|
+
if len(elements) == 0:
|
181
|
+
return "No elements found"
|
182
|
+
return elements
|
183
|
+
|
184
|
+
def get_elements(self, open_metadata_type_name: str = None, effective_time: str = None, for_lineage: bool = None,
|
185
|
+
for_duplicate_processing: bool = None, start_from: int = 0, page_size: int = max_paging_size,
|
186
|
+
server_name: str = None, time_out: int = default_time_out) -> list | str:
|
187
|
+
"""
|
188
|
+
Retrieve elements of the requested type name. If no type name is specified, then any type of element may
|
189
|
+
be returned.
|
190
|
+
|
191
|
+
https://egeria-project.org/types/
|
192
|
+
|
193
|
+
Parameters
|
194
|
+
----------
|
195
|
+
open_metadata_type_name : str, default = None
|
196
|
+
- open metadata type to be used to restrict the search
|
197
|
+
effective_time: str, default = None
|
198
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
199
|
+
for_lineage: bool, default is set by server
|
200
|
+
- determines if elements classified as Memento should be returned - normally false
|
201
|
+
for_duplicate_processing: bool, default is set by server
|
202
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
203
|
+
start_from: int, default = 0
|
204
|
+
- index of the list to start from (0 for start).
|
205
|
+
page_size
|
206
|
+
- maximum number of elements to return.
|
207
|
+
server_name: str, default = None
|
208
|
+
- name of the server instances for this request.
|
209
|
+
time_out: int, default = default_time_out
|
210
|
+
- http request timeout for this request
|
211
|
+
|
212
|
+
Returns
|
213
|
+
-------
|
214
|
+
[dict] | str
|
215
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
216
|
+
|
217
|
+
Raises
|
218
|
+
------
|
219
|
+
InvalidParameterException
|
220
|
+
one of the parameters is null or invalid or
|
221
|
+
PropertyServerException
|
222
|
+
There is a problem adding the element properties to the metadata repository or
|
223
|
+
UserNotAuthorizedException
|
224
|
+
the requesting user is not authorized to issue this request.
|
225
|
+
"""
|
226
|
+
|
227
|
+
loop = asyncio.get_event_loop()
|
228
|
+
response = loop.run_until_complete(
|
229
|
+
self._async_get_elements(open_metadata_type_name, effective_time, for_lineage, for_duplicate_processing,
|
230
|
+
start_from, page_size, server_name, time_out))
|
231
|
+
return response
|
232
|
+
|
233
|
+
async def _async_get_elements_by_property_value(self, property_value: str, property_names: [str],
|
234
|
+
open_metadata_type_name: str = None, effective_time: str = None, for_lineage: bool = None,
|
235
|
+
for_duplicate_processing: bool = None, start_from: int = 0, page_size: int = max_paging_size,
|
236
|
+
server_name: str = None, time_out: int = default_time_out) -> list | str:
|
237
|
+
"""
|
238
|
+
Retrieve elements by a value found in one of the properties specified. The value must match exactly.
|
239
|
+
An open metadata type name may be supplied to restrict the results. Async version.
|
240
|
+
|
241
|
+
https://egeria-project.org/types/
|
242
|
+
|
243
|
+
Parameters
|
244
|
+
----------
|
245
|
+
property_value: str
|
246
|
+
- property value to be searched.
|
247
|
+
property_names: [str]
|
248
|
+
- property names to search in.
|
249
|
+
open_metadata_type_name : str, default = None
|
250
|
+
- open metadata type to be used to restrict the search
|
251
|
+
effective_time: str, default = None
|
252
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
253
|
+
for_lineage: bool, default is set by server
|
254
|
+
- determines if elements classified as Memento should be returned - normally false
|
255
|
+
for_duplicate_processing: bool, default is set by server
|
256
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
257
|
+
start_from: int, default = 0
|
258
|
+
- index of the list to start from (0 for start).
|
259
|
+
page_size
|
260
|
+
- maximum number of elements to return.
|
261
|
+
server_name: str, default = None
|
262
|
+
- name of the server instances for this request.
|
263
|
+
time_out: int, default = default_time_out
|
264
|
+
- http request timeout for this request
|
265
|
+
|
266
|
+
Returns
|
267
|
+
-------
|
268
|
+
[dict] | str
|
269
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
270
|
+
|
271
|
+
Raises
|
272
|
+
------
|
273
|
+
InvalidParameterException
|
274
|
+
one of the parameters is null or invalid or
|
275
|
+
PropertyServerException
|
276
|
+
There is a problem adding the element properties to the metadata repository or
|
277
|
+
UserNotAuthorizedException
|
278
|
+
the requesting user is not authorized to issue this request.
|
279
|
+
"""
|
280
|
+
if server_name is None:
|
281
|
+
server_name = self.server_name
|
282
|
+
|
283
|
+
possible_query_params = query_string(
|
284
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
285
|
+
("forDuplicateProcessing", for_duplicate_processing)])
|
286
|
+
|
287
|
+
body = {"class": "FindPropertyNamesProperties", "openMetadataTypeName": open_metadata_type_name,
|
288
|
+
"propertyValue": property_value, "propertyNames": property_names, "effectiveTime": effective_time, }
|
289
|
+
|
290
|
+
url = f"{base_path(self, server_name)}/elements/by-exact-property-value{possible_query_params}"
|
291
|
+
|
292
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
293
|
+
|
294
|
+
elements = response.json().get('elements', 'No elements found')
|
295
|
+
if type(elements) is list:
|
296
|
+
if len(elements) == 0:
|
297
|
+
return "No elements found"
|
298
|
+
return elements
|
299
|
+
|
300
|
+
def get_elements_by_property_value(self, property_value: str, property_names: [str],
|
301
|
+
open_metadata_type_name: str = None, effective_time: str = None, for_lineage: bool = None,
|
302
|
+
for_duplicate_processing: bool = None, start_from: int = 0, page_size: int = max_paging_size,
|
303
|
+
server_name: str = None, time_out: int = default_time_out) -> list | str:
|
304
|
+
"""
|
305
|
+
Retrieve elements by a value found in one of the properties specified. The value must match exactly.
|
306
|
+
An open metadata type name may be supplied to restrict the results.
|
307
|
+
|
308
|
+
https://egeria-project.org/types/
|
309
|
+
|
310
|
+
Parameters
|
311
|
+
----------
|
312
|
+
property_value: str
|
313
|
+
- property value to be searched.
|
314
|
+
property_names: [str]
|
315
|
+
- property names to search in.
|
316
|
+
open_metadata_type_name : str, default = None
|
317
|
+
- open metadata type to be used to restrict the search
|
318
|
+
effective_time: str, default = None
|
319
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
320
|
+
for_lineage: bool, default is set by server
|
321
|
+
- determines if elements classified as Memento should be returned - normally false
|
322
|
+
for_duplicate_processing: bool, default is set by server
|
323
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
324
|
+
start_from: int, default = 0
|
325
|
+
- index of the list to start from (0 for start).
|
326
|
+
page_size
|
327
|
+
- maximum number of elements to return.
|
328
|
+
server_name: str, default = None
|
329
|
+
- name of the server instances for this request.
|
330
|
+
time_out: int, default = default_time_out
|
331
|
+
- http request timeout for this request
|
332
|
+
|
333
|
+
Returns
|
334
|
+
-------
|
335
|
+
[dict] | str
|
336
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
337
|
+
|
338
|
+
Raises
|
339
|
+
------
|
340
|
+
InvalidParameterException
|
341
|
+
one of the parameters is null or invalid or
|
342
|
+
PropertyServerException
|
343
|
+
There is a problem adding the element properties to the metadata repository or
|
344
|
+
UserNotAuthorizedException
|
345
|
+
the requesting user is not authorized to issue this request.
|
346
|
+
"""
|
347
|
+
|
348
|
+
loop = asyncio.get_event_loop()
|
349
|
+
response = loop.run_until_complete(
|
350
|
+
self._async_get_elements_by_property_value(property_value, property_names, open_metadata_type_name,
|
351
|
+
effective_time, for_lineage, for_duplicate_processing, start_from, page_size, server_name, time_out))
|
352
|
+
return response
|
353
|
+
|
354
|
+
async def _async_find_elements_by_property_value(self, property_value: str, property_names: [str],
|
355
|
+
open_metadata_type_name: str = None, effective_time: str = None, for_lineage: bool = None,
|
356
|
+
for_duplicate_processing: bool = None, start_from: int = 0, page_size: int = max_paging_size,
|
357
|
+
server_name: str = None, time_out: int = default_time_out) -> list | str:
|
358
|
+
"""
|
359
|
+
Retrieve elements by a value found in one of the properties specified. The value must be contained in the
|
360
|
+
properties rather than needing to be an exact match. An open metadata type name may be supplied to restrict
|
361
|
+
the results. Async version.
|
362
|
+
|
363
|
+
https://egeria-project.org/types/
|
364
|
+
|
365
|
+
Parameters
|
366
|
+
----------
|
367
|
+
property_value: str
|
368
|
+
- property value to be searched.
|
369
|
+
property_names: [str]
|
370
|
+
- property names to search in.
|
371
|
+
open_metadata_type_name : str, default = None
|
372
|
+
- open metadata type to be used to restrict the search
|
373
|
+
effective_time: str, default = None
|
374
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
375
|
+
for_lineage: bool, default is set by server
|
376
|
+
- determines if elements classified as Memento should be returned - normally false
|
377
|
+
for_duplicate_processing: bool, default is set by server
|
378
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
379
|
+
start_from: int, default = 0
|
380
|
+
- index of the list to start from (0 for start).
|
381
|
+
page_size
|
382
|
+
- maximum number of elements to return.
|
383
|
+
server_name: str, default = None
|
384
|
+
- name of the server instances for this request.
|
385
|
+
time_out: int, default = default_time_out
|
386
|
+
- http request timeout for this request
|
387
|
+
|
388
|
+
Returns
|
389
|
+
-------
|
390
|
+
[dict] | str
|
391
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
392
|
+
|
393
|
+
Raises
|
394
|
+
------
|
395
|
+
InvalidParameterException
|
396
|
+
one of the parameters is null or invalid or
|
397
|
+
PropertyServerException
|
398
|
+
There is a problem adding the element properties to the metadata repository or
|
399
|
+
UserNotAuthorizedException
|
400
|
+
the requesting user is not authorized to issue this request.
|
401
|
+
"""
|
402
|
+
if server_name is None:
|
403
|
+
server_name = self.server_name
|
404
|
+
|
405
|
+
possible_query_params = query_string(
|
406
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
407
|
+
("forDuplicateProcessing", for_duplicate_processing)])
|
408
|
+
|
409
|
+
body = {"class": "FindPropertyNamesProperties", "openMetadataTypeName": open_metadata_type_name,
|
410
|
+
"propertyValue": property_value, "propertyNames": property_names, "effectiveTime": effective_time, }
|
411
|
+
|
412
|
+
url = f"{base_path(self, server_name)}/elements/by-property-value-search{possible_query_params}"
|
413
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
414
|
+
elements = response.json().get('elements', 'No elements found')
|
415
|
+
if type(elements) is list:
|
416
|
+
if len(elements) == 0:
|
417
|
+
return "No elements found"
|
418
|
+
return elements
|
419
|
+
|
420
|
+
def find_elements_by_property_value(self, property_value: str, property_names: [str],
|
421
|
+
open_metadata_type_name: str = None, effective_time: str = None, for_lineage: bool = None,
|
422
|
+
for_duplicate_processing: bool = None, start_from: int = 0, page_size: int = max_paging_size,
|
423
|
+
server_name: str = None, time_out: int = default_time_out) -> list | str:
|
424
|
+
"""
|
425
|
+
Retrieve elements by a value found in one of the properties specified. The value must be contained in the
|
426
|
+
properties rather than needing to be an exact match. An open metadata type name may be supplied to restrict
|
427
|
+
the results.
|
428
|
+
|
429
|
+
https://egeria-project.org/types/
|
430
|
+
|
431
|
+
Parameters
|
432
|
+
----------
|
433
|
+
property_value: str
|
434
|
+
- property value to be searched.
|
435
|
+
property_names: [str]
|
436
|
+
- property names to search in.
|
437
|
+
open_metadata_type_name : str, default = None
|
438
|
+
- open metadata type to be used to restrict the search
|
439
|
+
effective_time: str, default = None
|
440
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
441
|
+
for_lineage: bool, default is set by server
|
442
|
+
- determines if elements classified as Memento should be returned - normally false
|
443
|
+
for_duplicate_processing: bool, default is set by server
|
444
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
445
|
+
start_from: int, default = 0
|
446
|
+
- index of the list to start from (0 for start).
|
447
|
+
page_size
|
448
|
+
- maximum number of elements to return.
|
449
|
+
server_name: str, default = None
|
450
|
+
- name of the server instances for this request.
|
451
|
+
time_out: int, default = default_time_out
|
452
|
+
- http request timeout for this request
|
453
|
+
|
454
|
+
Returns
|
455
|
+
-------
|
456
|
+
[dict] | str
|
457
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
458
|
+
|
459
|
+
Raises
|
460
|
+
------
|
461
|
+
InvalidParameterException
|
462
|
+
one of the parameters is null or invalid or
|
463
|
+
PropertyServerException
|
464
|
+
There is a problem adding the element properties to the metadata repository or
|
465
|
+
UserNotAuthorizedException
|
466
|
+
the requesting user is not authorized to issue this request.
|
467
|
+
"""
|
468
|
+
|
469
|
+
loop = asyncio.get_event_loop()
|
470
|
+
response = loop.run_until_complete(
|
471
|
+
self._async_find_elements_by_property_value(property_value, property_names, open_metadata_type_name,
|
472
|
+
effective_time, for_lineage, for_duplicate_processing, start_from, page_size, server_name, time_out))
|
473
|
+
return response
|
474
|
+
|
475
|
+
#
|
476
|
+
# Elements by classification
|
477
|
+
#
|
478
|
+
async def _async_get_elements_by_classification(self, classification_name: str, open_metadata_type_name: str = None,
|
479
|
+
effective_time: str = None, for_lineage: bool = None, for_duplicate_processing: bool = None,
|
480
|
+
start_from: int = 0, page_size: int = max_paging_size, server_name: str = None,
|
481
|
+
time_out: int = default_time_out) -> list | str:
|
482
|
+
"""
|
483
|
+
Retrieve elements with the requested classification name. It is also possible to limit the results
|
484
|
+
by specifying a type name for the elements that should be returned. If no type name is specified then
|
485
|
+
any type of element may be returned. Async version.
|
486
|
+
|
487
|
+
https://egeria-project.org/types/
|
488
|
+
|
489
|
+
Parameters
|
490
|
+
----------
|
491
|
+
classification_name: str
|
492
|
+
- the classification name to retrieve elements for.
|
493
|
+
open_metadata_type_name : str, default = None
|
494
|
+
- open metadata type to be used to restrict the search
|
495
|
+
effective_time: str, default = None
|
496
|
+
- Time format is "YYYY-MM-DD THH:MM:SS" (ISO 8601)
|
497
|
+
for_lineage: bool, default is set by server
|
498
|
+
- determines if elements classified as Memento should be returned - normally false
|
499
|
+
for_duplicate_processing: bool, default is set by server
|
500
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
501
|
+
start_from: int, default = 0
|
502
|
+
- index of the list to start from (0 for start).
|
503
|
+
page_size
|
504
|
+
- maximum number of elements to return.
|
505
|
+
server_name: str, default = None
|
506
|
+
- name of the server instances for this request.
|
507
|
+
time_out: int, default = default_time_out
|
508
|
+
- http request timeout for this request
|
509
|
+
|
510
|
+
Returns
|
511
|
+
-------
|
512
|
+
[dict] | str
|
513
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
514
|
+
|
515
|
+
Raises
|
516
|
+
------
|
517
|
+
InvalidParameterException
|
518
|
+
one of the parameters is null or invalid or
|
519
|
+
PropertyServerException
|
520
|
+
There is a problem adding the element properties to the metadata repository or
|
521
|
+
UserNotAuthorizedException
|
522
|
+
the requesting user is not authorized to issue this request.
|
523
|
+
"""
|
524
|
+
if server_name is None:
|
525
|
+
server_name = self.server_name
|
526
|
+
|
527
|
+
possible_query_params = query_string(
|
528
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
529
|
+
("forDuplicateProcessing", for_duplicate_processing)])
|
530
|
+
|
531
|
+
body = {"class": "FindProperties", "openMetadataTypeName": open_metadata_type_name,
|
532
|
+
"effectiveTime": effective_time, }
|
533
|
+
|
534
|
+
url = (f"{base_path(self, server_name)}/elements/by-classification/{classification_name}"
|
535
|
+
f"{possible_query_params}")
|
536
|
+
response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
537
|
+
elements = response.json().get('elements', 'No elements found')
|
538
|
+
if type(elements) is list:
|
539
|
+
if len(elements) == 0:
|
540
|
+
return "No elements found"
|
541
|
+
return elements
|
542
|
+
|
543
|
+
def get_elements_by_classification(self, classification_name: str, open_metadata_type_name: str = None,
|
544
|
+
effective_time: str = None, for_lineage: bool = None, for_duplicate_processing: bool = None,
|
545
|
+
start_from: int = 0, page_size: int = max_paging_size, server_name: str = None,
|
546
|
+
time_out: int = default_time_out) -> list | str:
|
547
|
+
"""
|
548
|
+
Retrieve elements with the requested classification name. It is also possible to limit the results
|
549
|
+
by specifying a type name for the elements that should be returned. If no type name is specified then
|
550
|
+
any type of element may be returned.
|
551
|
+
|
552
|
+
https://egeria-project.org/types/
|
553
|
+
|
554
|
+
Parameters
|
555
|
+
----------
|
556
|
+
classification_name: str
|
557
|
+
- the classification name to retrieve elements for.
|
558
|
+
open_metadata_type_name : str, default = None
|
559
|
+
- open metadata type to be used to restrict the search
|
560
|
+
effective_time: str, default = None
|
561
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
562
|
+
for_lineage: bool, default is set by server
|
563
|
+
- determines if elements classified as Memento should be returned - normally false
|
564
|
+
for_duplicate_processing: bool, default is set by server
|
565
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
566
|
+
start_from: int, default = 0
|
567
|
+
- index of the list to start from (0 for start).
|
568
|
+
page_size
|
569
|
+
- maximum number of elements to return.
|
570
|
+
server_name: str, default = None
|
571
|
+
- name of the server instances for this request.
|
572
|
+
time_out: int, default = default_time_out
|
573
|
+
- http request timeout for this request
|
574
|
+
|
575
|
+
Returns
|
576
|
+
-------
|
577
|
+
[dict] | str
|
578
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
579
|
+
|
580
|
+
Raises
|
581
|
+
------
|
582
|
+
InvalidParameterException
|
583
|
+
one of the parameters is null or invalid or
|
584
|
+
PropertyServerException
|
585
|
+
There is a problem adding the element properties to the metadata repository or
|
586
|
+
UserNotAuthorizedException
|
587
|
+
the requesting user is not authorized to issue this request.
|
588
|
+
"""
|
589
|
+
|
590
|
+
loop = asyncio.get_event_loop()
|
591
|
+
response = loop.run_until_complete(
|
592
|
+
self._async_get_elements_by_classification(classification_name, open_metadata_type_name, effective_time,
|
593
|
+
for_lineage, for_duplicate_processing, start_from, page_size, server_name, time_out))
|
594
|
+
return response
|
595
|
+
|
596
|
+
async def _async_get_elements_by_classification_with_property_value(self, classification_name: str,
|
597
|
+
property_value: str, property_names: [str], open_metadata_type_name: str = None, effective_time: str = None,
|
598
|
+
for_lineage: bool = None, for_duplicate_processing: bool = None, start_from: int = 0,
|
599
|
+
page_size: int = max_paging_size, server_name: str = None, time_out: int = default_time_out) -> list | str:
|
600
|
+
"""
|
601
|
+
Retrieve elements with the requested classification name and with the requested a value found in one of the
|
602
|
+
classification's properties specified. The value must match exactly. An open metadata type name may be supplied
|
603
|
+
to restrict the types of elements returned. Async version.
|
604
|
+
|
605
|
+
https://egeria-project.org/types/
|
606
|
+
|
607
|
+
Parameters
|
608
|
+
----------
|
609
|
+
classification_name: str
|
610
|
+
- the classification name to retrieve elements for.
|
611
|
+
property_value: str
|
612
|
+
- property value to be searched.
|
613
|
+
property_names: [str]
|
614
|
+
- property names to search in.
|
615
|
+
open_metadata_type_name : str, default = None
|
616
|
+
- open metadata type to be used to restrict the search
|
617
|
+
effective_time: str, default = None
|
618
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
619
|
+
for_lineage: bool, default is set by server
|
620
|
+
- determines if elements classified as Memento should be returned - normally false
|
621
|
+
for_duplicate_processing: bool, default is set by server
|
622
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
623
|
+
start_from: int, default = 0
|
624
|
+
- index of the list to start from (0 for start).
|
625
|
+
page_size
|
626
|
+
- maximum number of elements to return.
|
627
|
+
server_name: str, default = None
|
628
|
+
- name of the server instances for this request.
|
629
|
+
time_out: int, default = default_time_out
|
630
|
+
- http request timeout for this request
|
631
|
+
|
632
|
+
Returns
|
633
|
+
-------
|
634
|
+
[dict] | str
|
635
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
636
|
+
|
637
|
+
Raises
|
638
|
+
------
|
639
|
+
InvalidParameterException
|
640
|
+
one of the parameters is null or invalid or
|
641
|
+
PropertyServerException
|
642
|
+
There is a problem adding the element properties to the metadata repository or
|
643
|
+
UserNotAuthorizedException
|
644
|
+
the requesting user is not authorized to issue this request.
|
645
|
+
"""
|
646
|
+
if server_name is None:
|
647
|
+
server_name = self.server_name
|
648
|
+
|
649
|
+
possible_query_params = query_string(
|
650
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
651
|
+
("forDuplicateProcessing", for_duplicate_processing)])
|
652
|
+
|
653
|
+
body = {"class": "FindPropertyNamesProperties", "openMetadataTypeName": open_metadata_type_name,
|
654
|
+
"propertyValue": property_value, "propertyNames": property_names, "effectiveTime": effective_time, }
|
655
|
+
|
656
|
+
url = (f"{base_path(self, server_name)}/elements/by-classification/{classification_name}/"
|
657
|
+
f"with-exact-property-value{possible_query_params}")
|
658
|
+
response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
659
|
+
elements = response.json().get('elements', 'No elements found')
|
660
|
+
if type(elements) is list:
|
661
|
+
if len(elements) == 0:
|
662
|
+
return "No elements found"
|
663
|
+
return elements
|
664
|
+
|
665
|
+
def get_elements_by_classification_with_property_value(self, classification_name: str, property_value: str,
|
666
|
+
property_names: [str], open_metadata_type_name: str = None, effective_time: str = None,
|
667
|
+
for_lineage: bool = None, for_duplicate_processing: bool = None, start_from: int = 0,
|
668
|
+
page_size: int = max_paging_size, server_name: str = None, time_out: int = default_time_out) -> list | str:
|
669
|
+
"""
|
670
|
+
Retrieve elements by a value found in one of the properties specified. The value must match exactly.
|
671
|
+
An open metadata type name may be supplied to restrict the results.
|
672
|
+
|
673
|
+
https://egeria-project.org/types/
|
674
|
+
|
675
|
+
Parameters
|
676
|
+
----------
|
677
|
+
classification_name: str
|
678
|
+
- the classification name to retrieve elements for.
|
679
|
+
property_value: str
|
680
|
+
- property value to be searched.
|
681
|
+
property_names: [str]
|
682
|
+
- property names to search in.
|
683
|
+
open_metadata_type_name : str, default = None
|
684
|
+
- open metadata type to be used to restrict the search
|
685
|
+
effective_time: str, default = None
|
686
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
687
|
+
for_lineage: bool, default is set by server
|
688
|
+
- determines if elements classified as Memento should be returned - normally false
|
689
|
+
for_duplicate_processing: bool, default is set by server
|
690
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
691
|
+
start_from: int, default = 0
|
692
|
+
- index of the list to start from (0 for start).
|
693
|
+
page_size
|
694
|
+
- maximum number of elements to return.
|
695
|
+
server_name: str, default = None
|
696
|
+
- name of the server instances for this request.
|
697
|
+
time_out: int, default = default_time_out
|
698
|
+
- http request timeout for this request
|
699
|
+
|
700
|
+
Returns
|
701
|
+
-------
|
702
|
+
[dict] | str
|
703
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
704
|
+
|
705
|
+
Raises
|
706
|
+
------
|
707
|
+
InvalidParameterException
|
708
|
+
one of the parameters is null or invalid or
|
709
|
+
PropertyServerException
|
710
|
+
There is a problem adding the element properties to the metadata repository or
|
711
|
+
UserNotAuthorizedException
|
712
|
+
the requesting user is not authorized to issue this request.
|
713
|
+
"""
|
714
|
+
|
715
|
+
loop = asyncio.get_event_loop()
|
716
|
+
response = loop.run_until_complete(
|
717
|
+
self._async_get_elements_by_classification_with_property_value(classification_name, property_value,
|
718
|
+
property_names, open_metadata_type_name, effective_time, for_lineage, for_duplicate_processing,
|
719
|
+
start_from, page_size, server_name, time_out))
|
720
|
+
return response
|
721
|
+
|
722
|
+
async def _async_find_elements_by_classification_with_property_value(self, classification_name: str,
|
723
|
+
property_value: str, property_names: [str], open_metadata_type_name: str = None, effective_time: str = None,
|
724
|
+
for_lineage: bool = None, for_duplicate_processing: bool = None, start_from: int = 0,
|
725
|
+
page_size: int = max_paging_size, server_name: str = None, time_out: int = default_time_out) -> list | str:
|
726
|
+
"""
|
727
|
+
Retrieve elements with the requested classification name and with the requested value found in
|
728
|
+
one of the classification's properties specified. The value must only be contained in the
|
729
|
+
properties rather than needing to be an exact match.
|
730
|
+
An open metadata type name may be supplied to restrict the results. Async version.
|
731
|
+
|
732
|
+
https://egeria-project.org/types/
|
733
|
+
|
734
|
+
Parameters
|
735
|
+
----------
|
736
|
+
classification_name: str
|
737
|
+
- the classification name to retrieve elements for.
|
738
|
+
property_value: str
|
739
|
+
- property value to be searched.
|
740
|
+
property_names: [str]
|
741
|
+
- property names to search in.
|
742
|
+
open_metadata_type_name : str, default = None
|
743
|
+
- open metadata type to be used to restrict the search
|
744
|
+
effective_time: str, default = None
|
745
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
746
|
+
for_lineage: bool, default is set by server
|
747
|
+
- determines if elements classified as Memento should be returned - normally false
|
748
|
+
for_duplicate_processing: bool, default is set by server
|
749
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
750
|
+
start_from: int, default = 0
|
751
|
+
- index of the list to start from (0 for start).
|
752
|
+
page_size
|
753
|
+
- maximum number of elements to return.
|
754
|
+
server_name: str, default = None
|
755
|
+
- name of the server instances for this request.
|
756
|
+
time_out: int, default = default_time_out
|
757
|
+
- http request timeout for this request
|
758
|
+
|
759
|
+
Returns
|
760
|
+
-------
|
761
|
+
[dict] | str
|
762
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
763
|
+
|
764
|
+
Raises
|
765
|
+
------
|
766
|
+
InvalidParameterException
|
767
|
+
one of the parameters is null or invalid or
|
768
|
+
PropertyServerException
|
769
|
+
There is a problem adding the element properties to the metadata repository or
|
770
|
+
UserNotAuthorizedException
|
771
|
+
the requesting user is not authorized to issue this request.
|
772
|
+
"""
|
773
|
+
if server_name is None:
|
774
|
+
server_name = self.server_name
|
775
|
+
|
776
|
+
possible_query_params = query_string(
|
777
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
778
|
+
("forDuplicateProcessing", for_duplicate_processing)])
|
779
|
+
|
780
|
+
body = {"class": "FindPropertyNamesProperties", "openMetadataTypeName": open_metadata_type_name,
|
781
|
+
"propertyValue": property_value, "propertyNames": property_names, "effectiveTime": effective_time, }
|
782
|
+
|
783
|
+
url = (f"{base_path(self, server_name)}/elements/by-classification/{classification_name}/"
|
784
|
+
f"with-property-value-search{possible_query_params}")
|
785
|
+
response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
786
|
+
elements = response.json().get('elements', 'No elements found')
|
787
|
+
if type(elements) is list:
|
788
|
+
if len(elements) == 0:
|
789
|
+
return "No elements found"
|
790
|
+
return elements
|
791
|
+
|
792
|
+
def find_elements_by_classification_with_property_value(self, classification_name: str, property_value: str,
|
793
|
+
property_names: [str], open_metadata_type_name: str = None, effective_time: str = None,
|
794
|
+
for_lineage: bool = None, for_duplicate_processing: bool = None, start_from: int = 0,
|
795
|
+
page_size: int = max_paging_size, server_name: str = None, time_out: int = default_time_out) -> list | str:
|
796
|
+
"""
|
797
|
+
Retrieve elements with the requested classification name and with the requested a value found in
|
798
|
+
one of the classification's properties specified. The value must only be contained in the
|
799
|
+
properties rather than needing to be an exact match.
|
800
|
+
An open metadata type name may be supplied to restrict the results.
|
801
|
+
|
802
|
+
https://egeria-project.org/types/
|
803
|
+
|
804
|
+
Parameters
|
805
|
+
----------
|
806
|
+
classification_name: str
|
807
|
+
- the classification name to retrieve elements for.
|
808
|
+
property_value: str
|
809
|
+
- property value to be searched.
|
810
|
+
property_names: [str]
|
811
|
+
- property names to search in.
|
812
|
+
open_metadata_type_name : str, default = None
|
813
|
+
- open metadata type to be used to restrict the search
|
814
|
+
effective_time: str, default = None
|
815
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
816
|
+
for_lineage: bool, default is set by server
|
817
|
+
- determines if elements classified as Memento should be returned - normally false
|
818
|
+
for_duplicate_processing: bool, default is set by server
|
819
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
820
|
+
start_from: int, default = 0
|
821
|
+
- index of the list to start from (0 for start).
|
822
|
+
page_size
|
823
|
+
- maximum number of elements to return.
|
824
|
+
server_name: str, default = None
|
825
|
+
- name of the server instances for this request.
|
826
|
+
time_out: int, default = default_time_out
|
827
|
+
- http request timeout for this request
|
828
|
+
|
829
|
+
Returns
|
830
|
+
-------
|
831
|
+
[dict] | str
|
832
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
833
|
+
|
834
|
+
Raises
|
835
|
+
------
|
836
|
+
InvalidParameterException
|
837
|
+
one of the parameters is null or invalid or
|
838
|
+
PropertyServerException
|
839
|
+
There is a problem adding the element properties to the metadata repository or
|
840
|
+
UserNotAuthorizedException
|
841
|
+
the requesting user is not authorized to issue this request.
|
842
|
+
"""
|
843
|
+
|
844
|
+
loop = asyncio.get_event_loop()
|
845
|
+
response = loop.run_until_complete(
|
846
|
+
self._async_find_elements_by_classification_with_property_value(classification_name, property_value,
|
847
|
+
property_names, open_metadata_type_name, effective_time, for_lineage, for_duplicate_processing,
|
848
|
+
start_from, page_size, server_name, time_out))
|
849
|
+
return response
|
850
|
+
|
851
|
+
#
|
852
|
+
# related elements
|
853
|
+
#
|
854
|
+
async def _async_get_all_related_elements(self, element_guid: str, open_metadata_type_name: str = None,
|
855
|
+
start_at_end: int = 1, effective_time: str = None, for_lineage: bool = None,
|
856
|
+
for_duplicate_processing: bool = None, start_from: int = 0, page_size: int = max_paging_size,
|
857
|
+
server_name: str = None, time_out: int = default_time_out) -> list | str:
|
858
|
+
"""
|
859
|
+
Retrieve elements linked any relationship type name. It is also possible to limit the results by
|
860
|
+
specifying a type name for the elements that should be returned. If no type name is specified then any type of
|
861
|
+
element may be returned. Async version.
|
862
|
+
|
863
|
+
https://egeria-project.org/types/
|
864
|
+
|
865
|
+
Parameters
|
866
|
+
----------
|
867
|
+
element_guid: str
|
868
|
+
- the base element to get related elements for
|
869
|
+
open_metadata_type_name : str, default = None
|
870
|
+
- open metadata type to be used to restrict the search
|
871
|
+
start_at_end: int, default = 1
|
872
|
+
- The end of the relationship to start from - typically End1
|
873
|
+
effective_time: str, default = None
|
874
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
875
|
+
for_lineage: bool, default is set by server
|
876
|
+
- determines if elements classified as Memento should be returned - normally false
|
877
|
+
for_duplicate_processing: bool, default is set by server
|
878
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
879
|
+
start_from: int, default = 0
|
880
|
+
- index of the list to start from (0 for start).
|
881
|
+
page_size
|
882
|
+
- maximum number of elements to return.
|
883
|
+
server_name: str, default = None
|
884
|
+
- name of the server instances for this request.
|
885
|
+
time_out: int, default = default_time_out
|
886
|
+
- http request timeout for this request
|
887
|
+
|
888
|
+
Returns
|
889
|
+
-------
|
890
|
+
[dict] | str
|
891
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
892
|
+
|
893
|
+
Raises
|
894
|
+
------
|
895
|
+
InvalidParameterException
|
896
|
+
one of the parameters is null or invalid or
|
897
|
+
PropertyServerException
|
898
|
+
There is a problem adding the element properties to the metadata repository or
|
899
|
+
UserNotAuthorizedException
|
900
|
+
the requesting user is not authorized to issue this request.
|
901
|
+
"""
|
902
|
+
if server_name is None:
|
903
|
+
server_name = self.server_name
|
904
|
+
|
905
|
+
possible_query_params = query_string(
|
906
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
907
|
+
("forDuplicateProcessing", for_duplicate_processing), ("startAtEnd", start_at_end)])
|
908
|
+
|
909
|
+
body = {"class": "FindProperties", "openMetadataTypeName": open_metadata_type_name,
|
910
|
+
"effectiveTime": effective_time, }
|
911
|
+
|
912
|
+
url = (f"{base_path(self, server_name)}/elements/{element_guid}/by-relationship"
|
913
|
+
f"{possible_query_params}")
|
914
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
915
|
+
elements = response.json().get('elements', 'No elements found')
|
916
|
+
if type(elements) is list:
|
917
|
+
if len(elements) == 0:
|
918
|
+
return "No elements found"
|
919
|
+
return elements
|
920
|
+
|
921
|
+
def get_all_related_elements(self, element_guid: str, open_metadata_type_name: str = None, start_at_end: int = 1,
|
922
|
+
effective_time: str = None, for_lineage: bool = None, for_duplicate_processing: bool = None,
|
923
|
+
start_from: int = 0, page_size: int = max_paging_size, server_name: str = None,
|
924
|
+
time_out: int = default_time_out) -> list | str:
|
925
|
+
"""
|
926
|
+
Retrieve elements linked via any relationship type name. It is also possible to limit the results by
|
927
|
+
specifying a type name for the elements that should be returned. If no type name is specified then any type of
|
928
|
+
element may be returned.
|
929
|
+
|
930
|
+
https://egeria-project.org/types/
|
931
|
+
|
932
|
+
Parameters
|
933
|
+
----------
|
934
|
+
element_guid: str
|
935
|
+
- the base element to get related elements for
|
936
|
+
open_metadata_type_name : str, default = None
|
937
|
+
- open metadata type to be used to restrict the search
|
938
|
+
start_at_end: int, default = 1
|
939
|
+
- The end of the relationship to start from - typically End1
|
940
|
+
effective_time: str, default = None
|
941
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
942
|
+
for_lineage: bool, default is set by server
|
943
|
+
- determines if elements classified as Memento should be returned - normally false
|
944
|
+
for_duplicate_processing: bool, default is set by server
|
945
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
946
|
+
start_from: int, default = 0
|
947
|
+
- index of the list to start from (0 for start).
|
948
|
+
page_size
|
949
|
+
- maximum number of elements to return.
|
950
|
+
server_name: str, default = None
|
951
|
+
- name of the server instances for this request.
|
952
|
+
time_out: int, default = default_time_out
|
953
|
+
- http request timeout for this request
|
954
|
+
|
955
|
+
Returns
|
956
|
+
-------
|
957
|
+
[dict] | str
|
958
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
959
|
+
|
960
|
+
Raises
|
961
|
+
------
|
962
|
+
InvalidParameterException
|
963
|
+
one of the parameters is null or invalid or
|
964
|
+
PropertyServerException
|
965
|
+
There is a problem adding the element properties to the metadata repository or
|
966
|
+
UserNotAuthorizedException
|
967
|
+
the requesting user is not authorized to issue this request.
|
968
|
+
"""
|
969
|
+
|
970
|
+
loop = asyncio.get_event_loop()
|
971
|
+
response = loop.run_until_complete(
|
972
|
+
self._async_get_all_related_elements(element_guid, open_metadata_type_name, start_at_end, effective_time,
|
973
|
+
for_lineage, for_duplicate_processing, start_from, page_size, server_name, time_out))
|
974
|
+
return response
|
975
|
+
|
976
|
+
async def _async_get_related_elements(self, element_guid: str, relationship_type: str,
|
977
|
+
open_metadata_type_name: str = None, start_at_end: int = 1, effective_time: str = None,
|
978
|
+
for_lineage: bool = None, for_duplicate_processing: bool = None, start_from: int = 0,
|
979
|
+
page_size: int = max_paging_size, server_name: str = None, time_out: int = default_time_out) -> list | str:
|
980
|
+
"""
|
981
|
+
Retrieve elements linked any relationship type name. It is also possible to limit the results by
|
982
|
+
specifying a type name for the elements that should be returned. If no type name is specified then any type of
|
983
|
+
element may be returned. Async version.
|
984
|
+
|
985
|
+
https://egeria-project.org/types/
|
986
|
+
|
987
|
+
Parameters
|
988
|
+
----------
|
989
|
+
element_guid: str
|
990
|
+
- the base element to get related elements for
|
991
|
+
relationship_type: str
|
992
|
+
- the type of relationship to navigate to related elements
|
993
|
+
open_metadata_type_name : str, default = None
|
994
|
+
- open metadata type to be used to restrict the search
|
995
|
+
start_at_end: int, default = 1
|
996
|
+
- The end of the relationship to start from - typically End1
|
997
|
+
effective_time: str, default = None
|
998
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
999
|
+
for_lineage: bool, default is set by server
|
1000
|
+
- determines if elements classified as Memento should be returned - normally false
|
1001
|
+
for_duplicate_processing: bool, default is set by server
|
1002
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1003
|
+
start_from: int, default = 0
|
1004
|
+
- index of the list to start from (0 for start).
|
1005
|
+
page_size
|
1006
|
+
- maximum number of elements to return.
|
1007
|
+
server_name: str, default = None
|
1008
|
+
- name of the server instances for this request.
|
1009
|
+
time_out: int, default = default_time_out
|
1010
|
+
- http request timeout for this request
|
1011
|
+
|
1012
|
+
Returns
|
1013
|
+
-------
|
1014
|
+
[dict] | str
|
1015
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1016
|
+
|
1017
|
+
Raises
|
1018
|
+
------
|
1019
|
+
InvalidParameterException
|
1020
|
+
one of the parameters is null or invalid or
|
1021
|
+
PropertyServerException
|
1022
|
+
There is a problem adding the element properties to the metadata repository or
|
1023
|
+
UserNotAuthorizedException
|
1024
|
+
the requesting user is not authorized to issue this request.
|
1025
|
+
"""
|
1026
|
+
if server_name is None:
|
1027
|
+
server_name = self.server_name
|
1028
|
+
|
1029
|
+
possible_query_params = query_string(
|
1030
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
1031
|
+
("forDuplicateProcessing", for_duplicate_processing), ("startAtEnd", start_at_end)])
|
1032
|
+
|
1033
|
+
body = {"class": "FindProperties", "openMetadataTypeName": open_metadata_type_name,
|
1034
|
+
"effectiveTime": effective_time, }
|
1035
|
+
|
1036
|
+
url = (f"{base_path(self, server_name)}/elements/{element_guid}/by-relationship/"
|
1037
|
+
f"{relationship_type}{possible_query_params}")
|
1038
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
1039
|
+
elements = response.json().get('elements', 'No elements found')
|
1040
|
+
if type(elements) is list:
|
1041
|
+
if len(elements) == 0:
|
1042
|
+
return "No elements found"
|
1043
|
+
return elements
|
1044
|
+
|
1045
|
+
def get_related_elements(self, element_guid: str, relationship_type: str, open_metadata_type_name: str = None,
|
1046
|
+
start_at_end: int = 1, effective_time: str = None, for_lineage: bool = None,
|
1047
|
+
for_duplicate_processing: bool = None, start_from: int = 0, page_size: int = max_paging_size,
|
1048
|
+
server_name: str = None, time_out: int = default_time_out) -> list | str:
|
1049
|
+
"""
|
1050
|
+
Retrieve elements linked via any relationship type name. It is also possible to limit the results by
|
1051
|
+
specifying a type name for the elements that should be returned. If no type name is specified then any type of
|
1052
|
+
element may be returned.
|
1053
|
+
|
1054
|
+
https://egeria-project.org/types/
|
1055
|
+
|
1056
|
+
Parameters
|
1057
|
+
----------
|
1058
|
+
element_guid: str
|
1059
|
+
- the base element to get related elements for
|
1060
|
+
relationship_type: str
|
1061
|
+
- the type of relationship to navigate to related elements
|
1062
|
+
open_metadata_type_name : str, default = None
|
1063
|
+
- open metadata type to be used to restrict the search
|
1064
|
+
start_at_end: int, default = 1
|
1065
|
+
- The end of the relationship to start from - typically End1
|
1066
|
+
effective_time: str, default = None
|
1067
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1068
|
+
for_lineage: bool, default is set by server
|
1069
|
+
- determines if elements classified as Memento should be returned - normally false
|
1070
|
+
for_duplicate_processing: bool, default is set by server
|
1071
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1072
|
+
start_from: int, default = 0
|
1073
|
+
- index of the list to start from (0 for start).
|
1074
|
+
page_size
|
1075
|
+
- maximum number of elements to return.
|
1076
|
+
server_name: str, default = None
|
1077
|
+
- name of the server instances for this request.
|
1078
|
+
time_out: int, default = default_time_out
|
1079
|
+
- http request timeout for this request
|
1080
|
+
|
1081
|
+
Returns
|
1082
|
+
-------
|
1083
|
+
[dict] | str
|
1084
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1085
|
+
|
1086
|
+
Raises
|
1087
|
+
------
|
1088
|
+
InvalidParameterException
|
1089
|
+
one of the parameters is null or invalid or
|
1090
|
+
PropertyServerException
|
1091
|
+
There is a problem adding the element properties to the metadata repository or
|
1092
|
+
UserNotAuthorizedException
|
1093
|
+
the requesting user is not authorized to issue this request.
|
1094
|
+
"""
|
1095
|
+
|
1096
|
+
loop = asyncio.get_event_loop()
|
1097
|
+
response = loop.run_until_complete(
|
1098
|
+
self._async_get_related_elements(element_guid, relationship_type, open_metadata_type_name, start_at_end,
|
1099
|
+
effective_time, for_lineage, for_duplicate_processing, start_from, page_size, server_name, time_out))
|
1100
|
+
return response
|
1101
|
+
|
1102
|
+
async def _async_get_related_elements_with_property_value(self, element_guid: str, relationship_type: str,
|
1103
|
+
property_value: str, property_names: [str], open_metadata_type_name: str = None, start_at_end: int = 1,
|
1104
|
+
effective_time: str = None, for_lineage: bool = None, for_duplicate_processing: bool = None,
|
1105
|
+
start_from: int = 0, page_size: int = max_paging_size, server_name: str = None,
|
1106
|
+
time_out: int = default_time_out) -> list | str:
|
1107
|
+
"""
|
1108
|
+
Retrieve elements linked via the requested relationship type name and with the requested a value found in one of
|
1109
|
+
the classification's properties specified. The value must match exactly. An open metadata type name may be
|
1110
|
+
supplied to restrict the types of elements returned. Async version.
|
1111
|
+
|
1112
|
+
https://egeria-project.org/types/
|
1113
|
+
|
1114
|
+
Parameters
|
1115
|
+
----------
|
1116
|
+
element_guid: str
|
1117
|
+
- the base element to get related elements for
|
1118
|
+
relationship_type: str
|
1119
|
+
- the type of relationship to navigate to related elements
|
1120
|
+
property_value: str
|
1121
|
+
- property value to be searched.
|
1122
|
+
property_names: [str]
|
1123
|
+
- property names to search in.
|
1124
|
+
open_metadata_type_name : str, default = None
|
1125
|
+
- restrict search to elements of this open metadata type
|
1126
|
+
start_at_end: int, default = 1
|
1127
|
+
- The end of the relationship to start from - typically End1
|
1128
|
+
- open metadata type to be used to restrict the search
|
1129
|
+
effective_time: str, default = None
|
1130
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1131
|
+
for_lineage: bool, default is set by server
|
1132
|
+
- determines if elements classified as Memento should be returned - normally false
|
1133
|
+
for_duplicate_processing: bool, default is set by server
|
1134
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1135
|
+
start_from: int, default = 0
|
1136
|
+
- index of the list to start from (0 for start).
|
1137
|
+
page_size
|
1138
|
+
- maximum number of elements to return.
|
1139
|
+
server_name: str, default = None
|
1140
|
+
- name of the server instances for this request.
|
1141
|
+
time_out: int, default = default_time_out
|
1142
|
+
- http request timeout for this request
|
1143
|
+
|
1144
|
+
Returns
|
1145
|
+
-------
|
1146
|
+
[dict] | str
|
1147
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1148
|
+
|
1149
|
+
Raises
|
1150
|
+
------
|
1151
|
+
InvalidParameterException
|
1152
|
+
one of the parameters is null or invalid or
|
1153
|
+
PropertyServerException
|
1154
|
+
There is a problem adding the element properties to the metadata repository or
|
1155
|
+
UserNotAuthorizedException
|
1156
|
+
the requesting user is not authorized to issue this request.
|
1157
|
+
"""
|
1158
|
+
if server_name is None:
|
1159
|
+
server_name = self.server_name
|
1160
|
+
|
1161
|
+
possible_query_params = query_string(
|
1162
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
1163
|
+
("forDuplicateProcessing", for_duplicate_processing), ("startAtEnd", start_at_end)])
|
1164
|
+
|
1165
|
+
body = {"class": "FindPropertyNamesProperties", "openMetadataTypeName": open_metadata_type_name,
|
1166
|
+
"propertyValue": property_value, "propertyNames": property_names, "effectiveTime": effective_time, }
|
1167
|
+
|
1168
|
+
url = (f"{base_path(self, server_name)}/elements/{element_guid}/by-relationship/"
|
1169
|
+
f"{relationship_type}/with-exact-property-value{possible_query_params}")
|
1170
|
+
|
1171
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
1172
|
+
elements = response.json().get('elements', 'No elements found')
|
1173
|
+
if type(elements) is list:
|
1174
|
+
if len(elements) == 0:
|
1175
|
+
return "No elements found"
|
1176
|
+
return elements
|
1177
|
+
|
1178
|
+
def get_related_elements_with_property_value(self, element_guid: str, relationship_type: str, property_value: str,
|
1179
|
+
property_names: [str], open_metadata_type_name: str = None, start_at_end: int = 1,
|
1180
|
+
effective_time: str = None, for_lineage: bool = None, for_duplicate_processing: bool = None,
|
1181
|
+
start_from: int = 0, page_size: int = max_paging_size, server_name: str = None,
|
1182
|
+
time_out: int = default_time_out) -> list | str:
|
1183
|
+
"""
|
1184
|
+
Retrieve elements linked via the requested relationship type name and with the requested a value found in one of
|
1185
|
+
the classification's properties specified. The value must match exactly. An open metadata type name may be
|
1186
|
+
supplied to restrict the types of elements returned.
|
1187
|
+
|
1188
|
+
https://egeria-project.org/types/
|
1189
|
+
|
1190
|
+
Parameters
|
1191
|
+
----------
|
1192
|
+
element_guid: str
|
1193
|
+
- the base element to get related elements for
|
1194
|
+
relationship_type: str
|
1195
|
+
- the type of relationship to navigate to related elements
|
1196
|
+
property_value: str
|
1197
|
+
- property value to be searched.
|
1198
|
+
property_names: [str]
|
1199
|
+
- property names to search in.
|
1200
|
+
open_metadata_type_name : str, default = None
|
1201
|
+
- open metadata type to be used to restrict the search
|
1202
|
+
start_at_end: int, default = 1
|
1203
|
+
- The end of the relationship to start from - typically End1
|
1204
|
+
effective_time: str, default = None
|
1205
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1206
|
+
for_lineage: bool, default is set by server
|
1207
|
+
- determines if elements classified as Memento should be returned - normally false
|
1208
|
+
for_duplicate_processing: bool, default is set by server
|
1209
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1210
|
+
start_from: int, default = 0
|
1211
|
+
- index of the list to start from (0 for start).
|
1212
|
+
page_size
|
1213
|
+
- maximum number of elements to return.
|
1214
|
+
server_name: str, default = None
|
1215
|
+
- name of the server instances for this request.
|
1216
|
+
time_out: int, default = default_time_out
|
1217
|
+
- http request timeout for this request
|
1218
|
+
|
1219
|
+
Returns
|
1220
|
+
-------
|
1221
|
+
[dict] | str
|
1222
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1223
|
+
|
1224
|
+
Raises
|
1225
|
+
------
|
1226
|
+
InvalidParameterException
|
1227
|
+
one of the parameters is null or invalid or
|
1228
|
+
PropertyServerException
|
1229
|
+
There is a problem adding the element properties to the metadata repository or
|
1230
|
+
UserNotAuthorizedException
|
1231
|
+
the requesting user is not authorized to issue this request.
|
1232
|
+
"""
|
1233
|
+
|
1234
|
+
loop = asyncio.get_event_loop()
|
1235
|
+
response = loop.run_until_complete(
|
1236
|
+
self._async_get_related_elements_with_property_value(element_guid, relationship_type, property_value,
|
1237
|
+
property_names, open_metadata_type_name, start_at_end, effective_time, for_lineage,
|
1238
|
+
for_duplicate_processing, start_from, page_size, server_name, time_out))
|
1239
|
+
return response
|
1240
|
+
|
1241
|
+
async def _async_find_related_elements_with_property_value(self, element_guid: str, relationship_type: str,
|
1242
|
+
property_value: str, property_names: [str], open_metadata_type_name: str = None, start_at_end: int = 1,
|
1243
|
+
effective_time: str = None, for_lineage: bool = None, for_duplicate_processing: bool = None,
|
1244
|
+
start_from: int = 0, page_size: int = max_paging_size, server_name: str = None,
|
1245
|
+
time_out: int = default_time_out) -> list | str:
|
1246
|
+
"""
|
1247
|
+
Retrieve elements linked via the requested relationship type name and with the requested a value found in one of
|
1248
|
+
the classification's properties specified. The value must only be contained in the properties rather than
|
1249
|
+
needing to be an exact match An open metadata type name may be supplied to restrict the types of elements
|
1250
|
+
returned. Async version.
|
1251
|
+
|
1252
|
+
https://egeria-project.org/types/
|
1253
|
+
|
1254
|
+
Parameters
|
1255
|
+
----------
|
1256
|
+
element_guid: str
|
1257
|
+
- the base element to get related elements for
|
1258
|
+
relationship_type: str
|
1259
|
+
- the type of relationship to navigate to related elements
|
1260
|
+
property_value: str
|
1261
|
+
- property value to be searched.
|
1262
|
+
property_names: [str]
|
1263
|
+
- property names to search in.
|
1264
|
+
open_metadata_type_name : str, default = None
|
1265
|
+
- restrict search to elements of this open metadata type
|
1266
|
+
start_at_end: int, default = 1
|
1267
|
+
- The end of the relationship to start from - typically End1
|
1268
|
+
- open metadata type to be used to restrict the search
|
1269
|
+
effective_time: str, default = None
|
1270
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1271
|
+
for_lineage: bool, default is set by server
|
1272
|
+
- determines if elements classified as Memento should be returned - normally false
|
1273
|
+
for_duplicate_processing: bool, default is set by server
|
1274
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1275
|
+
start_from: int, default = 0
|
1276
|
+
- index of the list to start from (0 for start).
|
1277
|
+
page_size
|
1278
|
+
- maximum number of elements to return.
|
1279
|
+
server_name: str, default = None
|
1280
|
+
- name of the server instances for this request.
|
1281
|
+
time_out: int, default = default_time_out
|
1282
|
+
- http request timeout for this request
|
1283
|
+
|
1284
|
+
Returns
|
1285
|
+
-------
|
1286
|
+
[dict] | str
|
1287
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1288
|
+
|
1289
|
+
Raises
|
1290
|
+
------
|
1291
|
+
InvalidParameterException
|
1292
|
+
one of the parameters is null or invalid or
|
1293
|
+
PropertyServerException
|
1294
|
+
There is a problem adding the element properties to the metadata repository or
|
1295
|
+
UserNotAuthorizedException
|
1296
|
+
the requesting user is not authorized to issue this request.
|
1297
|
+
"""
|
1298
|
+
if server_name is None:
|
1299
|
+
server_name = self.server_name
|
1300
|
+
|
1301
|
+
possible_query_params = query_string(
|
1302
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
1303
|
+
("forDuplicateProcessing", for_duplicate_processing), ("startAtEnd", start_at_end)])
|
1304
|
+
|
1305
|
+
body = {"class": "FindPropertyNamesProperties", "openMetadataTypeName": open_metadata_type_name,
|
1306
|
+
"propertyValue": property_value, "propertyNames": property_names, "effectiveTime": effective_time, }
|
1307
|
+
|
1308
|
+
url = (f"{base_path(self, server_name)}/elements/{element_guid}/by-relationship/"
|
1309
|
+
f"{relationship_type}/with-property-value-search{possible_query_params}")
|
1310
|
+
|
1311
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
1312
|
+
|
1313
|
+
elements = response.json().get('elements', 'No elements found')
|
1314
|
+
if type(elements) is list:
|
1315
|
+
if len(elements) == 0:
|
1316
|
+
return "No elements found"
|
1317
|
+
return elements
|
1318
|
+
|
1319
|
+
def find_related_elements_with_property_value(self, element_guid: str, relationship_type: str, property_value: str,
|
1320
|
+
property_names: [str], open_metadata_type_name: str = None, start_at_end: int = 1,
|
1321
|
+
effective_time: str = None, for_lineage: bool = None, for_duplicate_processing: bool = None,
|
1322
|
+
start_from: int = 0, page_size: int = max_paging_size, server_name: str = None,
|
1323
|
+
time_out: int = default_time_out) -> list | str:
|
1324
|
+
"""
|
1325
|
+
Retrieve elements linked via the requested relationship type name and with the requested a value found in one of
|
1326
|
+
the classification's properties specified. The value must only be contained in the properties rather than
|
1327
|
+
needing to be an exact match An open metadata type name may be supplied to restrict the types of elements
|
1328
|
+
returned.
|
1329
|
+
|
1330
|
+
https://egeria-project.org/types/
|
1331
|
+
|
1332
|
+
Parameters
|
1333
|
+
----------
|
1334
|
+
element_guid: str
|
1335
|
+
- the base element to get related elements for
|
1336
|
+
relationship_type: str
|
1337
|
+
- the type of relationship to navigate to related elements
|
1338
|
+
property_value: str
|
1339
|
+
- property value to be searched.
|
1340
|
+
property_names: [str]
|
1341
|
+
- property names to search in.
|
1342
|
+
open_metadata_type_name : str, default = None
|
1343
|
+
- open metadata type to be used to restrict the search
|
1344
|
+
start_at_end: int, default = 1
|
1345
|
+
- The end of the relationship to start from - typically End1
|
1346
|
+
effective_time: str, default = None
|
1347
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1348
|
+
for_lineage: bool, default is set by server
|
1349
|
+
- determines if elements classified as Memento should be returned - normally false
|
1350
|
+
for_duplicate_processing: bool, default is set by server
|
1351
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1352
|
+
start_from: int, default = 0
|
1353
|
+
- index of the list to start from (0 for start).
|
1354
|
+
page_size
|
1355
|
+
- maximum number of elements to return.
|
1356
|
+
server_name: str, default = None
|
1357
|
+
- name of the server instances for this request.
|
1358
|
+
time_out: int, default = default_time_out
|
1359
|
+
- http request timeout for this request
|
1360
|
+
|
1361
|
+
Returns
|
1362
|
+
-------
|
1363
|
+
[dict] | str
|
1364
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1365
|
+
|
1366
|
+
Raises
|
1367
|
+
------
|
1368
|
+
InvalidParameterException
|
1369
|
+
one of the parameters is null or invalid or
|
1370
|
+
PropertyServerException
|
1371
|
+
There is a problem adding the element properties to the metadata repository or
|
1372
|
+
UserNotAuthorizedException
|
1373
|
+
the requesting user is not authorized to issue this request.
|
1374
|
+
"""
|
1375
|
+
|
1376
|
+
loop = asyncio.get_event_loop()
|
1377
|
+
response = loop.run_until_complete(
|
1378
|
+
self._async_find_related_elements_with_property_value(element_guid, relationship_type, property_value,
|
1379
|
+
property_names, open_metadata_type_name, start_at_end, effective_time, for_lineage,
|
1380
|
+
for_duplicate_processing, start_from, page_size, server_name, time_out))
|
1381
|
+
return response
|
1382
|
+
|
1383
|
+
#
|
1384
|
+
# relationships
|
1385
|
+
|
1386
|
+
async def _async_get_relationships(self, relationship_type: str, effective_time: str = None,
|
1387
|
+
for_lineage: bool = None, for_duplicate_processing: bool = None, start_from: int = 0,
|
1388
|
+
page_size: int = max_paging_size, server_name: str = None, time_out: int = default_time_out) -> list | str:
|
1389
|
+
"""
|
1390
|
+
Retrieve relationships of the requested relationship type name. Async version.
|
1391
|
+
|
1392
|
+
Parameters
|
1393
|
+
----------
|
1394
|
+
relationship_type: str
|
1395
|
+
- the type of relationship to navigate to related elements
|
1396
|
+
effective_time: str, default = None
|
1397
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1398
|
+
for_lineage: bool, default is set by server
|
1399
|
+
- determines if elements classified as Memento should be returned - normally false
|
1400
|
+
for_duplicate_processing: bool, default is set by server
|
1401
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1402
|
+
start_from: int, default = 0
|
1403
|
+
- index of the list to start from (0 for start).
|
1404
|
+
page_size
|
1405
|
+
- maximum number of elements to return.
|
1406
|
+
server_name: str, default = None
|
1407
|
+
- name of the server instances for this request.
|
1408
|
+
time_out: int, default = default_time_out
|
1409
|
+
- http request timeout for this request
|
1410
|
+
|
1411
|
+
Returns
|
1412
|
+
-------
|
1413
|
+
[dict] | str
|
1414
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1415
|
+
|
1416
|
+
Raises
|
1417
|
+
------
|
1418
|
+
InvalidParameterException
|
1419
|
+
one of the parameters is null or invalid or
|
1420
|
+
PropertyServerException
|
1421
|
+
There is a problem adding the element properties to the metadata repository or
|
1422
|
+
UserNotAuthorizedException
|
1423
|
+
the requesting user is not authorized to issue this request.
|
1424
|
+
"""
|
1425
|
+
if server_name is None:
|
1426
|
+
server_name = self.server_name
|
1427
|
+
|
1428
|
+
possible_query_params = query_string(
|
1429
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
1430
|
+
("forDuplicateProcessing", for_duplicate_processing)])
|
1431
|
+
|
1432
|
+
body = {"class": "FindProperties", "effectiveTime": effective_time}
|
1433
|
+
|
1434
|
+
url = (f"{base_path(self, server_name)}/relationships/{relationship_type}"
|
1435
|
+
f"{possible_query_params}")
|
1436
|
+
|
1437
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
1438
|
+
rels = response.json().get('relationships', 'No relationships found')
|
1439
|
+
|
1440
|
+
if type(rels) is list:
|
1441
|
+
if len(rels) == 0:
|
1442
|
+
return "No elements found"
|
1443
|
+
return rels
|
1444
|
+
|
1445
|
+
def get_relationships(self, relationship_type: str, effective_time: str = None, for_lineage: bool = None,
|
1446
|
+
for_duplicate_processing: bool = None, start_from: int = 0, page_size: int = max_paging_size,
|
1447
|
+
server_name: str = None, time_out: int = default_time_out) -> list | str:
|
1448
|
+
"""
|
1449
|
+
Retrieve relationships of the requested relationship type name.
|
1450
|
+
|
1451
|
+
Parameters
|
1452
|
+
----------
|
1453
|
+
relationship_type: str
|
1454
|
+
- the type of relationship to navigate to related elements
|
1455
|
+
effective_time: str, default = None
|
1456
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1457
|
+
for_lineage: bool, default is set by server
|
1458
|
+
- determines if elements classified as Memento should be returned - normally false
|
1459
|
+
for_duplicate_processing: bool, default is set by server
|
1460
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1461
|
+
start_from: int, default = 0
|
1462
|
+
- index of the list to start from (0 for start).
|
1463
|
+
page_size
|
1464
|
+
- maximum number of elements to return.
|
1465
|
+
server_name: str, default = None
|
1466
|
+
- name of the server instances for this request.
|
1467
|
+
time_out: int, default = default_time_out
|
1468
|
+
- http request timeout for this request
|
1469
|
+
|
1470
|
+
Returns
|
1471
|
+
-------
|
1472
|
+
[dict] | str
|
1473
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1474
|
+
|
1475
|
+
Raises
|
1476
|
+
------
|
1477
|
+
InvalidParameterException
|
1478
|
+
one of the parameters is null or invalid or
|
1479
|
+
PropertyServerException
|
1480
|
+
There is a problem adding the element properties to the metadata repository or
|
1481
|
+
UserNotAuthorizedException
|
1482
|
+
the requesting user is not authorized to issue this request.
|
1483
|
+
"""
|
1484
|
+
|
1485
|
+
loop = asyncio.get_event_loop()
|
1486
|
+
response = loop.run_until_complete(
|
1487
|
+
self._async_get_relationships(relationship_type, effective_time, for_lineage, for_duplicate_processing,
|
1488
|
+
start_from, page_size, server_name, time_out))
|
1489
|
+
return response
|
1490
|
+
|
1491
|
+
async def _async_get_relationships_with_property_value(self, relationship_type: str, property_value: str,
|
1492
|
+
property_names: [str], effective_time: str = None, for_lineage: bool = None,
|
1493
|
+
for_duplicate_processing: bool = None, start_from: int = 0, page_size: int = max_paging_size,
|
1494
|
+
server_name: str = None, time_out: int = default_time_out) -> list | str:
|
1495
|
+
"""
|
1496
|
+
Retrieve relationships of the requested relationship type name and with the requested a value found in
|
1497
|
+
one of the relationship's properties specified. The value must match exactly. Async version.
|
1498
|
+
|
1499
|
+
https://egeria-project.org/types/
|
1500
|
+
|
1501
|
+
Parameters
|
1502
|
+
----------
|
1503
|
+
relationship_type: str
|
1504
|
+
- the type of relationship to navigate to related elements
|
1505
|
+
property_value: str
|
1506
|
+
- property value to be searched.
|
1507
|
+
property_names: [str]
|
1508
|
+
- property names to search in.
|
1509
|
+
effective_time: str, default = None
|
1510
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1511
|
+
for_lineage: bool, default is set by server
|
1512
|
+
- determines if elements classified as Memento should be returned - normally false
|
1513
|
+
for_duplicate_processing: bool, default is set by server
|
1514
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1515
|
+
start_from: int, default = 0
|
1516
|
+
- index of the list to start from (0 for start).
|
1517
|
+
page_size
|
1518
|
+
- maximum number of elements to return.
|
1519
|
+
server_name: str, default = None
|
1520
|
+
- name of the server instances for this request.
|
1521
|
+
time_out: int, default = default_time_out
|
1522
|
+
- http request timeout for this request
|
1523
|
+
|
1524
|
+
Returns
|
1525
|
+
-------
|
1526
|
+
[dict] | str
|
1527
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1528
|
+
|
1529
|
+
Raises
|
1530
|
+
------
|
1531
|
+
InvalidParameterException
|
1532
|
+
one of the parameters is null or invalid or
|
1533
|
+
PropertyServerException
|
1534
|
+
There is a problem adding the element properties to the metadata repository or
|
1535
|
+
UserNotAuthorizedException
|
1536
|
+
the requesting user is not authorized to issue this request.
|
1537
|
+
"""
|
1538
|
+
if server_name is None:
|
1539
|
+
server_name = self.server_name
|
1540
|
+
|
1541
|
+
possible_query_params = query_string(
|
1542
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
1543
|
+
("forDuplicateProcessing", for_duplicate_processing)])
|
1544
|
+
|
1545
|
+
body = {"class": "FindPropertyNamesProperties", "propertyValue": property_value,
|
1546
|
+
"propertyNames": property_names, "effectiveTime": effective_time, }
|
1547
|
+
|
1548
|
+
url = (f"{base_path(self, server_name)}/relationships/{relationship_type}/"
|
1549
|
+
f"with-exact-property-value{possible_query_params}")
|
1550
|
+
|
1551
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
1552
|
+
rels = response.json().get('relationships', 'No elements found')
|
1553
|
+
if type(rels) is list:
|
1554
|
+
if len(rels) == 0:
|
1555
|
+
return "No elements found"
|
1556
|
+
return rels
|
1557
|
+
|
1558
|
+
def get_relationships_with_property_value(self, relationship_type: str, property_value: str, property_names: [str],
|
1559
|
+
effective_time: str = None, for_lineage: bool = None, for_duplicate_processing: bool = None,
|
1560
|
+
start_from: int = 0, page_size: int = max_paging_size, server_name: str = None,
|
1561
|
+
time_out: int = default_time_out) -> list | str:
|
1562
|
+
"""
|
1563
|
+
Retrieve relationships of the requested relationship type name and with the requested a value found in
|
1564
|
+
one of the relationship's properties specified. The value must match exactly.
|
1565
|
+
|
1566
|
+
Parameters
|
1567
|
+
----------
|
1568
|
+
relationship_type: str
|
1569
|
+
- the type of relationship to navigate to related elements
|
1570
|
+
property_value: str
|
1571
|
+
- property value to be searched.
|
1572
|
+
property_names: [str]
|
1573
|
+
- property names to search in.
|
1574
|
+
effective_time: str, default = None
|
1575
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1576
|
+
for_lineage: bool, default is set by server
|
1577
|
+
- determines if elements classified as Memento should be returned - normally false
|
1578
|
+
for_duplicate_processing: bool, default is set by server
|
1579
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1580
|
+
start_from: int, default = 0
|
1581
|
+
- index of the list to start from (0 for start).
|
1582
|
+
page_size
|
1583
|
+
- maximum number of elements to return.
|
1584
|
+
server_name: str, default = None
|
1585
|
+
- name of the server instances for this request.
|
1586
|
+
time_out: int, default = default_time_out
|
1587
|
+
- http request timeout for this request
|
1588
|
+
|
1589
|
+
Returns
|
1590
|
+
-------
|
1591
|
+
[dict] | str
|
1592
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1593
|
+
|
1594
|
+
Raises
|
1595
|
+
------
|
1596
|
+
InvalidParameterException
|
1597
|
+
one of the parameters is null or invalid or
|
1598
|
+
PropertyServerException
|
1599
|
+
There is a problem adding the element properties to the metadata repository or
|
1600
|
+
UserNotAuthorizedException
|
1601
|
+
the requesting user is not authorized to issue this request.
|
1602
|
+
"""
|
1603
|
+
|
1604
|
+
loop = asyncio.get_event_loop()
|
1605
|
+
response = loop.run_until_complete(
|
1606
|
+
self._async_get_relationships_with_property_value(relationship_type, property_value, property_names,
|
1607
|
+
effective_time, for_lineage, for_duplicate_processing, start_from, page_size, server_name, time_out))
|
1608
|
+
return response
|
1609
|
+
|
1610
|
+
async def _async_find_relationships_with_property_value(self, relationship_type: str, property_value: str,
|
1611
|
+
property_names: [str], effective_time: str = None, for_lineage: bool = None,
|
1612
|
+
for_duplicate_processing: bool = None, start_from: int = 0, page_size: int = max_paging_size,
|
1613
|
+
server_name: str = None, time_out: int = default_time_out) -> list | str:
|
1614
|
+
"""
|
1615
|
+
Retrieve relationships of the requested relationship type name and with the requested a value found in one of
|
1616
|
+
the relationship's properties specified. The value must only be contained in the properties rather than
|
1617
|
+
needing to be an exact match. Async version.
|
1618
|
+
|
1619
|
+
Parameters
|
1620
|
+
----------
|
1621
|
+
relationship_type: str
|
1622
|
+
- the type of relationship to navigate to related elements
|
1623
|
+
property_value: str
|
1624
|
+
- property value to be searched.
|
1625
|
+
property_names: [str]
|
1626
|
+
- property names to search in.
|
1627
|
+
effective_time: str, default = None
|
1628
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1629
|
+
for_lineage: bool, default is set by server
|
1630
|
+
- determines if elements classified as Memento should be returned - normally false
|
1631
|
+
for_duplicate_processing: bool, default is set by server
|
1632
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1633
|
+
start_from: int, default = 0
|
1634
|
+
- index of the list to start from (0 for start).
|
1635
|
+
page_size
|
1636
|
+
- maximum number of elements to return.
|
1637
|
+
server_name: str, default = None
|
1638
|
+
- name of the server instances for this request.
|
1639
|
+
time_out: int, default = default_time_out
|
1640
|
+
- http request timeout for this request
|
1641
|
+
|
1642
|
+
Returns
|
1643
|
+
-------
|
1644
|
+
[dict] | str
|
1645
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1646
|
+
|
1647
|
+
Raises
|
1648
|
+
------
|
1649
|
+
InvalidParameterException
|
1650
|
+
one of the parameters is null or invalid or
|
1651
|
+
PropertyServerException
|
1652
|
+
There is a problem adding the element properties to the metadata repository or
|
1653
|
+
UserNotAuthorizedException
|
1654
|
+
the requesting user is not authorized to issue this request.
|
1655
|
+
"""
|
1656
|
+
if server_name is None:
|
1657
|
+
server_name = self.server_name
|
1658
|
+
|
1659
|
+
possible_query_params = query_string(
|
1660
|
+
[("startFrom", start_from), ("pageSize", page_size), ("forLineage", for_lineage),
|
1661
|
+
("forDuplicateProcessing", for_duplicate_processing)])
|
1662
|
+
|
1663
|
+
body = {"class": "FindPropertyNamesProperties", "propertyValue": property_value,
|
1664
|
+
"propertyNames": property_names, "effectiveTime": effective_time, }
|
1665
|
+
|
1666
|
+
url = (f"{base_path(self, server_name)}/relationships/"
|
1667
|
+
f"{relationship_type}/with-property-value-search{possible_query_params}")
|
1668
|
+
|
1669
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
1670
|
+
|
1671
|
+
rels = response.json().get('relationships', 'No elements found')
|
1672
|
+
if type(rels) is list:
|
1673
|
+
if len(rels) == 0:
|
1674
|
+
return "No elements found"
|
1675
|
+
return rels
|
1676
|
+
|
1677
|
+
def find_relationships_with_property_value(self, relationship_type: str, property_value: str, property_names: [str],
|
1678
|
+
effective_time: str = None, for_lineage: bool = None, for_duplicate_processing: bool = None,
|
1679
|
+
start_from: int = 0, page_size: int = max_paging_size, server_name: str = None,
|
1680
|
+
time_out: int = default_time_out) -> list | str:
|
1681
|
+
"""
|
1682
|
+
Retrieve relationships of the requested relationship type name and with the requested a value found in one of
|
1683
|
+
the relationship's properties specified. The value must only be contained in the properties rather than
|
1684
|
+
needing to be an exact match..
|
1685
|
+
|
1686
|
+
https://egeria-project.org/types/
|
1687
|
+
|
1688
|
+
Parameters
|
1689
|
+
----------
|
1690
|
+
relationship_type: str
|
1691
|
+
- the type of relationship to navigate to related elements
|
1692
|
+
property_value: str
|
1693
|
+
- property value to be searched.
|
1694
|
+
property_names: [str]
|
1695
|
+
- property names to search in.
|
1696
|
+
effective_time: str, default = None
|
1697
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1698
|
+
for_lineage: bool, default is set by server
|
1699
|
+
- determines if elements classified as Memento should be returned - normally false
|
1700
|
+
for_duplicate_processing: bool, default is set by server
|
1701
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1702
|
+
start_from: int, default = 0
|
1703
|
+
- index of the list to start from (0 for start).
|
1704
|
+
page_size
|
1705
|
+
- maximum number of elements to return.
|
1706
|
+
server_name: str, default = None
|
1707
|
+
- name of the server instances for this request.
|
1708
|
+
time_out: int, default = default_time_out
|
1709
|
+
- http request timeout for this request
|
1710
|
+
|
1711
|
+
Returns
|
1712
|
+
-------
|
1713
|
+
[dict] | str
|
1714
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1715
|
+
|
1716
|
+
Raises
|
1717
|
+
------
|
1718
|
+
InvalidParameterException
|
1719
|
+
one of the parameters is null or invalid or
|
1720
|
+
PropertyServerException
|
1721
|
+
There is a problem adding the element properties to the metadata repository or
|
1722
|
+
UserNotAuthorizedException
|
1723
|
+
the requesting user is not authorized to issue this request.
|
1724
|
+
"""
|
1725
|
+
|
1726
|
+
loop = asyncio.get_event_loop()
|
1727
|
+
response = loop.run_until_complete(
|
1728
|
+
self._async_find_relationships_with_property_value(relationship_type, property_value, property_names,
|
1729
|
+
effective_time, for_lineage, for_duplicate_processing, start_from, page_size, server_name, time_out))
|
1730
|
+
return response
|
1731
|
+
|
1732
|
+
#
|
1733
|
+
# guid
|
1734
|
+
#
|
1735
|
+
|
1736
|
+
async def _async_retrieve_instance_for_guid(self, guid: str, effective_time: str = None, for_lineage: bool = None,
|
1737
|
+
for_duplicate_processing: bool = None, server_name: str = None,
|
1738
|
+
time_out: int = default_time_out) -> list | str:
|
1739
|
+
"""
|
1740
|
+
Retrieve the header for the instance identified by the supplied unique identifier.
|
1741
|
+
It may be an element (entity) or a relationship between elements. Async version.
|
1742
|
+
|
1743
|
+
Parameters
|
1744
|
+
----------
|
1745
|
+
guid: str
|
1746
|
+
- the identity of the instance to retrieve
|
1747
|
+
effective_time: str, default = None
|
1748
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1749
|
+
for_lineage: bool, default is set by server
|
1750
|
+
- determines if elements classified as Memento should be returned - normally false
|
1751
|
+
for_duplicate_processing: bool, default is set by server
|
1752
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1753
|
+
server_name: str, default = None
|
1754
|
+
- name of the server instances for this request.
|
1755
|
+
time_out: int, default = default_time_out
|
1756
|
+
- http request timeout for this request
|
1757
|
+
|
1758
|
+
Returns
|
1759
|
+
-------
|
1760
|
+
[dict] | str
|
1761
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1762
|
+
|
1763
|
+
Raises
|
1764
|
+
------
|
1765
|
+
InvalidParameterException
|
1766
|
+
one of the parameters is null or invalid or
|
1767
|
+
PropertyServerException
|
1768
|
+
There is a problem adding the element properties to the metadata repository or
|
1769
|
+
UserNotAuthorizedException
|
1770
|
+
the requesting user is not authorized to issue this request.
|
1771
|
+
"""
|
1772
|
+
if server_name is None:
|
1773
|
+
server_name = self.server_name
|
1774
|
+
|
1775
|
+
possible_query_params = query_string(
|
1776
|
+
[("forLineage", for_lineage), ("forDuplicateProcessing", for_duplicate_processing)])
|
1777
|
+
|
1778
|
+
body = {"class": "FindProperties", "effectiveTime": effective_time, }
|
1779
|
+
|
1780
|
+
url = f"{base_path(self, server_name)}/guids/{guid}{possible_query_params}"
|
1781
|
+
response: Response = await self._async_make_request("POST", url, body_slimmer(body), time_out=time_out)
|
1782
|
+
element = response.json().get('element', 'No elements found')
|
1783
|
+
return element
|
1784
|
+
|
1785
|
+
|
1786
|
+
|
1787
|
+
def retrieve_instance_for_guid(self, guid: str, effective_time: str = None, for_lineage: bool = None,
|
1788
|
+
for_duplicate_processing: bool = None, server_name: str = None,
|
1789
|
+
time_out: int = default_time_out) -> list | str:
|
1790
|
+
"""
|
1791
|
+
Retrieve the header for the instance identified by the supplied unique identifier.
|
1792
|
+
It may be an element (entity) or a relationship between elements.
|
1793
|
+
|
1794
|
+
Parameters
|
1795
|
+
----------
|
1796
|
+
guid: str
|
1797
|
+
- the identity of the instance to retrieve
|
1798
|
+
effective_time: str, default = None
|
1799
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1800
|
+
for_lineage: bool, default is set by server
|
1801
|
+
- determines if elements classified as Memento should be returned - normally false
|
1802
|
+
for_duplicate_processing: bool, default is set by server
|
1803
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1804
|
+
server_name: str, default = None
|
1805
|
+
- name of the server instances for this request.
|
1806
|
+
time_out: int, default = default_time_out
|
1807
|
+
- http request timeout for this request
|
1808
|
+
|
1809
|
+
Returns
|
1810
|
+
-------
|
1811
|
+
[dict] | str
|
1812
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1813
|
+
|
1814
|
+
Raises
|
1815
|
+
------
|
1816
|
+
InvalidParameterException
|
1817
|
+
one of the parameters is null or invalid or
|
1818
|
+
PropertyServerException
|
1819
|
+
There is a problem adding the element properties to the metadata repository or
|
1820
|
+
UserNotAuthorizedException
|
1821
|
+
the requesting user is not authorized to issue this request.
|
1822
|
+
"""
|
1823
|
+
|
1824
|
+
loop = asyncio.get_event_loop()
|
1825
|
+
response = loop.run_until_complete(
|
1826
|
+
self._async_retrieve_instance_for_guid(guid, effective_time, for_lineage, for_duplicate_processing,
|
1827
|
+
server_name, time_out))
|
1828
|
+
return response
|
1829
|
+
|
1830
|
+
|