pyegeria 5.4.7.4__py3-none-any.whl → 5.4.7.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.
- commands/ops/__init__.py +0 -2
- commands/ops/list_catalog_targets.py +0 -1
- commands/ops/load_archive.py +3 -3
- commands/ops/monitor_engine_activity.py +1 -1
- commands/tech/__init__.py +0 -2
- md_processing/md_commands/solution_architect_commands.py +1 -1
- pyegeria/__init__.py +3 -3
- pyegeria/_client_new.py +386 -172
- pyegeria/automated_curation.py +686 -837
- pyegeria/classification_manager.py +2413 -837
- pyegeria/external_references.py +1 -1
- pyegeria/full_omag_server_config.py +1 -1
- pyegeria/project_manager.py +8 -0
- pyegeria/reference_data.py +4 -0
- pyegeria/solution_architect.py +6 -4
- {pyegeria-5.4.7.4.dist-info → pyegeria-5.4.7.6.dist-info}/METADATA +1 -1
- {pyegeria-5.4.7.4.dist-info → pyegeria-5.4.7.6.dist-info}/RECORD +21 -21
- {pyegeria-5.4.7.4.dist-info → pyegeria-5.4.7.6.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.7.4.dist-info → pyegeria-5.4.7.6.dist-info}/entry_points.txt +0 -0
- {pyegeria-5.4.7.4.dist-info → pyegeria-5.4.7.6.dist-info}/licenses/LICENSE +0 -0
- {pyegeria-5.4.7.4.dist-info → pyegeria-5.4.7.6.dist-info}/top_level.txt +0 -0
pyegeria/automated_curation.py
CHANGED
@@ -10,16 +10,25 @@ import asyncio
|
|
10
10
|
import datetime
|
11
11
|
|
12
12
|
from httpx import Response
|
13
|
-
|
13
|
+
from loguru import logger
|
14
|
+
from pydantic import HttpUrl
|
15
|
+
from pyegeria._globals import NO_ELEMENTS_FOUND
|
14
16
|
from pyegeria._client_new import Client2
|
17
|
+
from pyegeria._validators import validate_guid, validate_name, validate_search_string
|
15
18
|
# from pyegeria._exceptions import (
|
16
19
|
# InvalidParameterException,
|
17
20
|
# PropertyServerException,
|
18
21
|
# UserNotAuthorizedException,
|
19
22
|
# )
|
20
|
-
from pyegeria.models import GetRequestBody, FilterRequestBody
|
23
|
+
from pyegeria.models import GetRequestBody, FilterRequestBody, SearchStringRequestBody
|
21
24
|
from pyegeria.utils import body_slimmer
|
22
|
-
from pyegeria.
|
25
|
+
from pyegeria._output_formats import select_output_format_set, get_output_format_type_match
|
26
|
+
from pyegeria.output_formatter import (
|
27
|
+
generate_output,
|
28
|
+
_extract_referenceable_properties,
|
29
|
+
populate_columns_from_properties,
|
30
|
+
get_required_relationships,
|
31
|
+
)
|
23
32
|
|
24
33
|
|
25
34
|
class AutomatedCuration(Client2):
|
@@ -54,6 +63,350 @@ class AutomatedCuration(Client2):
|
|
54
63
|
Client2.__init__(self, view_server, platform_url, user_id, user_pwd, token=token)
|
55
64
|
self.curation_command_root = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/automated-curation"
|
56
65
|
|
66
|
+
# Default entity label used by the output formatter for Technology Types
|
67
|
+
self.TECH_TYPE_ENTITY_LABEL = "TechType"
|
68
|
+
self.GOV_ACTION_TYPE_LABEL = "GovActionType"
|
69
|
+
self.CATALOG_TARGET_LABEL = "CatalogTarget"
|
70
|
+
self.ENGINE_ACTION_LABEL = "EngineAction"
|
71
|
+
self.GOV_ACTION_PROCESS_LABEL = "GovActionProcess"
|
72
|
+
|
73
|
+
def _extract_tech_type_properties(self, element: dict, columns_struct: dict) -> dict:
|
74
|
+
"""
|
75
|
+
Extract properties from a technology type element and populate the provided columns_struct.
|
76
|
+
Tolerant to missing fields.
|
77
|
+
"""
|
78
|
+
# Populate direct properties first
|
79
|
+
col_data = populate_columns_from_properties(element, columns_struct)
|
80
|
+
columns_list = col_data.get("formats", {}).get("columns", [])
|
81
|
+
|
82
|
+
# Referenceable header extraction (GUID, qualifiedName, displayName, etc.)
|
83
|
+
header_props = _extract_referenceable_properties(element)
|
84
|
+
for column in columns_list:
|
85
|
+
key = column.get("key")
|
86
|
+
if key in header_props:
|
87
|
+
column["value"] = header_props.get(key)
|
88
|
+
elif isinstance(key, str) and key.lower() == "guid":
|
89
|
+
column["value"] = header_props.get("GUID")
|
90
|
+
|
91
|
+
# Try common category/type fields
|
92
|
+
category = (
|
93
|
+
element.get("properties", {}).get("category")
|
94
|
+
or element.get("elementProperties", {}).get("category")
|
95
|
+
or element.get("elementType", {}).get("typeName")
|
96
|
+
or ""
|
97
|
+
)
|
98
|
+
for column in columns_list:
|
99
|
+
if column.get("key") in ("category", "type_name"):
|
100
|
+
column["value"] = category
|
101
|
+
|
102
|
+
# Classification names if present
|
103
|
+
class_names = []
|
104
|
+
for c in (element.get("elementHeader", {}).get("classifications") or []):
|
105
|
+
name = c.get("classificationName")
|
106
|
+
if name:
|
107
|
+
class_names.append(name)
|
108
|
+
if class_names:
|
109
|
+
for column in columns_list:
|
110
|
+
if column.get("key") == "classifications":
|
111
|
+
column["value"] = ", ".join(class_names)
|
112
|
+
break
|
113
|
+
|
114
|
+
# Relationship-driven fields (generic handling)
|
115
|
+
col_data = get_required_relationships(element, col_data)
|
116
|
+
|
117
|
+
# Mermaid graph support if present
|
118
|
+
mermaid_val = element.get("mermaidGraph", "") or ""
|
119
|
+
for column in columns_list:
|
120
|
+
if column.get("key") == "mermaid":
|
121
|
+
column["value"] = mermaid_val
|
122
|
+
break
|
123
|
+
|
124
|
+
return col_data
|
125
|
+
|
126
|
+
def _generate_tech_type_output(
|
127
|
+
self,
|
128
|
+
elements: dict | list[dict],
|
129
|
+
filter: str | None,
|
130
|
+
element_type_name: str | None,
|
131
|
+
output_format: str = "DICT",
|
132
|
+
output_format_set: dict | str | None = None,
|
133
|
+
) -> str | list[dict]:
|
134
|
+
"""Generate output for technology types in the specified format."""
|
135
|
+
entity_type = element_type_name or self.TECH_TYPE_ENTITY_LABEL
|
136
|
+
|
137
|
+
# Resolve output format set
|
138
|
+
get_additional_props_func = None
|
139
|
+
if output_format_set:
|
140
|
+
if isinstance(output_format_set, str):
|
141
|
+
output_formats = select_output_format_set(output_format_set, output_format)
|
142
|
+
else:
|
143
|
+
output_formats = get_output_format_type_match(output_format_set, output_format)
|
144
|
+
elif element_type_name:
|
145
|
+
output_formats = select_output_format_set(element_type_name, output_format)
|
146
|
+
else:
|
147
|
+
output_formats = select_output_format_set(entity_type, output_format)
|
148
|
+
|
149
|
+
if output_formats is None:
|
150
|
+
output_formats = select_output_format_set("Default", output_format)
|
151
|
+
|
152
|
+
# Optional hook for extra server calls to enrich rows
|
153
|
+
get_additional_props_name = (
|
154
|
+
output_formats.get("get_additional_props", {}).get("function") if output_formats else None
|
155
|
+
)
|
156
|
+
if isinstance(get_additional_props_name, str):
|
157
|
+
parts = get_additional_props_name.split(".")
|
158
|
+
method_name = parts[-1] if parts else None
|
159
|
+
if method_name and hasattr(self, method_name):
|
160
|
+
get_additional_props_func = getattr(self, method_name)
|
161
|
+
|
162
|
+
return generate_output(
|
163
|
+
elements,
|
164
|
+
filter,
|
165
|
+
entity_type,
|
166
|
+
output_format,
|
167
|
+
self._extract_tech_type_properties,
|
168
|
+
get_additional_props_func,
|
169
|
+
output_formats,
|
170
|
+
)
|
171
|
+
|
172
|
+
def _extract_gov_action_type_properties(self, element: dict, columns_struct: dict) -> dict:
|
173
|
+
col_data = populate_columns_from_properties(element, columns_struct)
|
174
|
+
columns_list = col_data.get("formats", {}).get("columns", [])
|
175
|
+
header_props = _extract_referenceable_properties(element)
|
176
|
+
for column in columns_list:
|
177
|
+
key = column.get("key")
|
178
|
+
if key in header_props:
|
179
|
+
column["value"] = header_props.get(key)
|
180
|
+
elif isinstance(key, str) and key.lower() == "guid":
|
181
|
+
column["value"] = header_props.get("GUID")
|
182
|
+
col_data = get_required_relationships(element, col_data)
|
183
|
+
mermaid_val = element.get("mermaidGraph", "") or ""
|
184
|
+
for column in columns_list:
|
185
|
+
if column.get("key") == "mermaid":
|
186
|
+
column["value"] = mermaid_val
|
187
|
+
break
|
188
|
+
return col_data
|
189
|
+
|
190
|
+
def _generate_gov_action_type_output(self, elements: dict | list[dict], filter: str | None,
|
191
|
+
element_type_name: str | None, output_format: str = "DICT",
|
192
|
+
output_format_set: dict | str | None = None) -> str | list[dict]:
|
193
|
+
entity_type = element_type_name or self.GOV_ACTION_TYPE_LABEL
|
194
|
+
get_additional_props_func = None
|
195
|
+
if output_format_set:
|
196
|
+
if isinstance(output_format_set, str):
|
197
|
+
output_formats = select_output_format_set(output_format_set, output_format)
|
198
|
+
else:
|
199
|
+
output_formats = get_output_format_type_match(output_format_set, output_format)
|
200
|
+
elif element_type_name:
|
201
|
+
output_formats = select_output_format_set(element_type_name, output_format)
|
202
|
+
else:
|
203
|
+
output_formats = select_output_format_set(entity_type, output_format)
|
204
|
+
if output_formats is None:
|
205
|
+
output_formats = select_output_format_set("Default", output_format)
|
206
|
+
get_additional_props_name = (
|
207
|
+
output_formats.get("get_additional_props", {}).get("function") if output_formats else None
|
208
|
+
)
|
209
|
+
if isinstance(get_additional_props_name, str):
|
210
|
+
method_name = get_additional_props_name.split(".")[-1]
|
211
|
+
if hasattr(self, method_name):
|
212
|
+
get_additional_props_func = getattr(self, method_name)
|
213
|
+
return generate_output(
|
214
|
+
elements,
|
215
|
+
filter,
|
216
|
+
entity_type,
|
217
|
+
output_format,
|
218
|
+
self._extract_gov_action_type_properties,
|
219
|
+
get_additional_props_func,
|
220
|
+
output_formats,
|
221
|
+
)
|
222
|
+
|
223
|
+
def _extract_catalog_target_properties(self, element: dict, columns_struct: dict) -> dict:
|
224
|
+
col_data = populate_columns_from_properties(element, columns_struct)
|
225
|
+
columns_list = col_data.get("formats", {}).get("columns", [])
|
226
|
+
header_props = _extract_referenceable_properties(element)
|
227
|
+
for column in columns_list:
|
228
|
+
key = column.get("key")
|
229
|
+
if key in header_props:
|
230
|
+
column["value"] = header_props.get(key)
|
231
|
+
elif isinstance(key, str) and key.lower() == "guid":
|
232
|
+
column["value"] = header_props.get("GUID")
|
233
|
+
col_data = get_required_relationships(element, col_data)
|
234
|
+
mermaid_val = element.get("mermaidGraph", "") or ""
|
235
|
+
for column in columns_list:
|
236
|
+
if column.get("key") == "mermaid":
|
237
|
+
column["value"] = mermaid_val
|
238
|
+
break
|
239
|
+
return col_data
|
240
|
+
|
241
|
+
def _generate_catalog_target_output(self, elements: dict | list[dict], filter: str | None,
|
242
|
+
element_type_name: str | None, output_format: str = "DICT",
|
243
|
+
output_format_set: dict | str | None = None) -> str | list[dict]:
|
244
|
+
entity_type = element_type_name or self.CATALOG_TARGET_LABEL
|
245
|
+
get_additional_props_func = None
|
246
|
+
if output_format_set:
|
247
|
+
if isinstance(output_format_set, str):
|
248
|
+
output_formats = select_output_format_set(output_format_set, output_format)
|
249
|
+
else:
|
250
|
+
output_formats = get_output_format_type_match(output_format_set, output_format)
|
251
|
+
elif element_type_name:
|
252
|
+
output_formats = select_output_format_set(element_type_name, output_format)
|
253
|
+
else:
|
254
|
+
output_formats = select_output_format_set(entity_type, output_format)
|
255
|
+
if output_formats is None:
|
256
|
+
output_formats = select_output_format_set("Default", output_format)
|
257
|
+
return generate_output(
|
258
|
+
elements,
|
259
|
+
filter,
|
260
|
+
entity_type,
|
261
|
+
output_format,
|
262
|
+
self._extract_catalog_target_properties,
|
263
|
+
None,
|
264
|
+
output_formats,
|
265
|
+
)
|
266
|
+
|
267
|
+
def _extract_engine_action_properties(self, element: dict, columns_struct: dict) -> dict:
|
268
|
+
col_data = populate_columns_from_properties(element, columns_struct)
|
269
|
+
columns_list = col_data.get("formats", {}).get("columns", [])
|
270
|
+
header_props = _extract_referenceable_properties(element)
|
271
|
+
for col in columns_list:
|
272
|
+
key = col.get("key")
|
273
|
+
if key in header_props:
|
274
|
+
col["value"] = header_props.get(key)
|
275
|
+
elif isinstance(key, str) and key.lower() == "guid":
|
276
|
+
col["value"] = header_props.get("GUID")
|
277
|
+
# EngineAction specifics: status, process_name, received_guards, completion_guards, request_type
|
278
|
+
status = (
|
279
|
+
element.get("properties", {}).get("status")
|
280
|
+
or element.get("elementProperties", {}).get("status")
|
281
|
+
or element.get("status")
|
282
|
+
)
|
283
|
+
process_name = (
|
284
|
+
element.get("properties", {}).get("processName")
|
285
|
+
or element.get("elementProperties", {}).get("processName")
|
286
|
+
or element.get("processName")
|
287
|
+
)
|
288
|
+
req_type = (
|
289
|
+
element.get("properties", {}).get("requestType")
|
290
|
+
or element.get("elementProperties", {}).get("requestType")
|
291
|
+
or element.get("requestType")
|
292
|
+
)
|
293
|
+
rec_guards = element.get("receivedGuards") or element.get("received_guards") or []
|
294
|
+
comp_guards = element.get("completionGuards") or element.get("completion_guards") or []
|
295
|
+
# assign to columns if present
|
296
|
+
for col in columns_list:
|
297
|
+
key = col.get("key")
|
298
|
+
if key == "status":
|
299
|
+
col["value"] = status
|
300
|
+
elif key in ("process_name", "processName"):
|
301
|
+
col["value"] = process_name
|
302
|
+
elif key in ("request_type", "requestType"):
|
303
|
+
col["value"] = req_type
|
304
|
+
elif key in ("received_guards", "receivedGuards"):
|
305
|
+
col["value"] = ", ".join(map(str, rec_guards)) if isinstance(rec_guards, list) else rec_guards
|
306
|
+
elif key in ("completion_guards", "completionGuards"):
|
307
|
+
col["value"] = ", ".join(map(str, comp_guards)) if isinstance(comp_guards, list) else comp_guards
|
308
|
+
col_data = get_required_relationships(element, col_data)
|
309
|
+
mermaid_val = element.get("mermaidGraph", "") or ""
|
310
|
+
for col in columns_list:
|
311
|
+
if col.get("key") == "mermaid":
|
312
|
+
col["value"] = mermaid_val
|
313
|
+
break
|
314
|
+
return col_data
|
315
|
+
|
316
|
+
def _generate_engine_action_output(self, elements: dict | list[dict], filter: str | None,
|
317
|
+
element_type_name: str | None, output_format: str = "DICT",
|
318
|
+
output_format_set: dict | str | None = None) -> str | list[dict]:
|
319
|
+
entity_type = element_type_name or self.ENGINE_ACTION_LABEL
|
320
|
+
get_additional_props_func = None
|
321
|
+
if output_format_set:
|
322
|
+
if isinstance(output_format_set, str):
|
323
|
+
output_formats = select_output_format_set(output_format_set, output_format)
|
324
|
+
else:
|
325
|
+
output_formats = get_output_format_type_match(output_format_set, output_format)
|
326
|
+
elif element_type_name:
|
327
|
+
output_formats = select_output_format_set(element_type_name, output_format)
|
328
|
+
else:
|
329
|
+
output_formats = select_output_format_set(entity_type, output_format)
|
330
|
+
if output_formats is None:
|
331
|
+
output_formats = select_output_format_set("Default", output_format)
|
332
|
+
get_additional_props_name = (
|
333
|
+
output_formats.get("get_additional_props", {}).get("function") if output_formats else None
|
334
|
+
)
|
335
|
+
if isinstance(get_additional_props_name, str):
|
336
|
+
method_name = get_additional_props_name.split(".")[-1]
|
337
|
+
if hasattr(self, method_name):
|
338
|
+
get_additional_props_func = getattr(self, method_name)
|
339
|
+
return generate_output(
|
340
|
+
elements,
|
341
|
+
filter,
|
342
|
+
entity_type,
|
343
|
+
output_format,
|
344
|
+
self._extract_engine_action_properties,
|
345
|
+
get_additional_props_func,
|
346
|
+
output_formats,
|
347
|
+
)
|
348
|
+
|
349
|
+
def _extract_gov_action_process_properties(self, element: dict, columns_struct: dict) -> dict:
|
350
|
+
col_data = populate_columns_from_properties(element, columns_struct)
|
351
|
+
columns_list = col_data.get("formats", {}).get("columns", [])
|
352
|
+
header_props = _extract_referenceable_properties(element)
|
353
|
+
for col in columns_list:
|
354
|
+
key = col.get("key")
|
355
|
+
if key in header_props:
|
356
|
+
col["value"] = header_props.get(key)
|
357
|
+
elif isinstance(key, str) and key.lower() == "guid":
|
358
|
+
col["value"] = header_props.get("GUID")
|
359
|
+
# GAP specifics: processStatus, elementTypeName, stepCount
|
360
|
+
proc_status = (
|
361
|
+
element.get("properties", {}).get("processStatus")
|
362
|
+
or element.get("elementProperties", {}).get("processStatus")
|
363
|
+
or element.get("processStatus")
|
364
|
+
)
|
365
|
+
step_count = (
|
366
|
+
element.get("properties", {}).get("stepCount")
|
367
|
+
or element.get("elementProperties", {}).get("stepCount")
|
368
|
+
or element.get("stepCount")
|
369
|
+
)
|
370
|
+
for col in columns_list:
|
371
|
+
key = col.get("key")
|
372
|
+
if key in ("process_status", "processStatus"):
|
373
|
+
col["value"] = proc_status
|
374
|
+
elif key == "stepCount":
|
375
|
+
col["value"] = step_count
|
376
|
+
col_data = get_required_relationships(element, col_data)
|
377
|
+
mermaid_val = element.get("mermaidGraph", "") or ""
|
378
|
+
for col in columns_list:
|
379
|
+
if col.get("key") == "mermaid":
|
380
|
+
col["value"] = mermaid_val
|
381
|
+
break
|
382
|
+
return col_data
|
383
|
+
|
384
|
+
def _generate_gov_action_process_output(self, elements: dict | list[dict], filter: str | None,
|
385
|
+
element_type_name: str | None, output_format: str = "DICT",
|
386
|
+
output_format_set: dict | str | None = None) -> str | list[dict]:
|
387
|
+
entity_type = element_type_name or self.GOV_ACTION_PROCESS_LABEL
|
388
|
+
get_additional_props_func = None
|
389
|
+
if output_format_set:
|
390
|
+
if isinstance(output_format_set, str):
|
391
|
+
output_formats = select_output_format_set(output_format_set, output_format)
|
392
|
+
else:
|
393
|
+
output_formats = get_output_format_type_match(output_format_set, output_format)
|
394
|
+
elif element_type_name:
|
395
|
+
output_formats = select_output_format_set(element_type_name, output_format)
|
396
|
+
else:
|
397
|
+
output_formats = select_output_format_set(entity_type, output_format)
|
398
|
+
if output_formats is None:
|
399
|
+
output_formats = select_output_format_set("Default", output_format)
|
400
|
+
return generate_output(
|
401
|
+
elements,
|
402
|
+
filter,
|
403
|
+
entity_type,
|
404
|
+
output_format,
|
405
|
+
self._extract_gov_action_process_properties,
|
406
|
+
None,
|
407
|
+
output_formats,
|
408
|
+
)
|
409
|
+
|
57
410
|
async def _async_create_elem_from_template(self, body: dict) -> str:
|
58
411
|
"""Create a new metadata element from a template. Async version.
|
59
412
|
Parameters
|
@@ -148,7 +501,6 @@ class AutomatedCuration(Client2):
|
|
148
501
|
)
|
149
502
|
return response
|
150
503
|
|
151
|
-
|
152
504
|
async def _async_create_kafka_server_element_from_template(
|
153
505
|
self,
|
154
506
|
kafka_server: str,
|
@@ -379,7 +731,7 @@ class AutomatedCuration(Client2):
|
|
379
731
|
"class": "TemplateRequestBody",
|
380
732
|
"templateGUID": template_guid,
|
381
733
|
"isOwnAnchor": True,
|
382
|
-
"allowRetrieve"
|
734
|
+
"allowRetrieve": True,
|
383
735
|
"placeholderPropertyValues": {
|
384
736
|
"fileName": file_name,
|
385
737
|
"fileType": file_type,
|
@@ -1385,148 +1737,6 @@ class AutomatedCuration(Client2):
|
|
1385
1737
|
#
|
1386
1738
|
# Engine Actions
|
1387
1739
|
#
|
1388
|
-
async def _async_get_engine_actions(
|
1389
|
-
self, start_from: int = 0, page_size: int = 0, body: dict | GetRequestBody = None
|
1390
|
-
) -> list:
|
1391
|
-
"""Retrieve the engine actions that are known to the server. Async version.
|
1392
|
-
Parameters
|
1393
|
-
----------
|
1394
|
-
|
1395
|
-
start_from : int, optional
|
1396
|
-
The starting index of the actions to retrieve. Default is 0.
|
1397
|
-
page_size : int, optional
|
1398
|
-
The maximum number of actions to retrieve per page. Default is the global maximum paging size.
|
1399
|
-
body: dict, optional
|
1400
|
-
If provided, supersedes the other parameters. Allows advanced options.
|
1401
|
-
|
1402
|
-
Returns
|
1403
|
-
-------
|
1404
|
-
[dict]
|
1405
|
-
A list of engine action descriptions as JSON.
|
1406
|
-
|
1407
|
-
Raises
|
1408
|
-
------
|
1409
|
-
PyegeriaException
|
1410
|
-
ValidationError
|
1411
|
-
|
1412
|
-
Notes
|
1413
|
-
-----
|
1414
|
-
For more information see: https://egeria-project.org/concepts/engine-action
|
1415
|
-
sample body:
|
1416
|
-
{
|
1417
|
-
"class": "GetRequestBody",
|
1418
|
-
"asOfTime": "{{$isoTimestamp}}",
|
1419
|
-
"effectiveTime": "{{$isoTimestamp}}",
|
1420
|
-
"forLineage": false,
|
1421
|
-
"forDuplicateProcessing": false
|
1422
|
-
}
|
1423
|
-
"""
|
1424
|
-
url = (
|
1425
|
-
f"{self.curation_command_root}/engine-actions?startFrom={start_from}&pageSize={page_size}"
|
1426
|
-
)
|
1427
|
-
|
1428
|
-
# return await self._async_get_guid_request(url, "EngineAction", _generate_default_output,
|
1429
|
-
# output_format="JSON", output_format_set="Referenceable", body=body )
|
1430
|
-
response = await self._async_make_request("GET", url)
|
1431
|
-
return response.json().get("elements", "No element found")
|
1432
|
-
|
1433
|
-
def get_engine_actions(
|
1434
|
-
self, start_from: int = 0, page_size: int = 0, body: dict | GetRequestBody = None
|
1435
|
-
) -> list:
|
1436
|
-
"""Retrieve the engine actions that are known to the server.
|
1437
|
-
Parameters
|
1438
|
-
----------
|
1439
|
-
start_from : int, optional
|
1440
|
-
The starting index of the actions to retrieve. Default is 0.
|
1441
|
-
page_size : int, optional
|
1442
|
-
The maximum number of actions to retrieve per page. Default is the global maximum paging size.
|
1443
|
-
body: dict, optional
|
1444
|
-
If provided, supersedes the other parameters. Allows advanced options.
|
1445
|
-
|
1446
|
-
Returns
|
1447
|
-
-------
|
1448
|
-
[dict]
|
1449
|
-
A list of engine action descriptions as JSON.
|
1450
|
-
|
1451
|
-
Raises
|
1452
|
-
------
|
1453
|
-
PyegeriaException
|
1454
|
-
ValidationError
|
1455
|
-
|
1456
|
-
Notes
|
1457
|
-
-----
|
1458
|
-
For more information see: https://egeria-project.org/concepts/engine-action
|
1459
|
-
sample body:
|
1460
|
-
{
|
1461
|
-
"class": "GetRequestBody",
|
1462
|
-
"asOfTime": "{{$isoTimestamp}}",
|
1463
|
-
"effectiveTime": "{{$isoTimestamp}}",
|
1464
|
-
"forLineage": false,
|
1465
|
-
"forDuplicateProcessing": false
|
1466
|
-
}
|
1467
|
-
"""
|
1468
|
-
loop = asyncio.get_event_loop()
|
1469
|
-
response = loop.run_until_complete(
|
1470
|
-
self._async_get_engine_actions(start_from, page_size, body)
|
1471
|
-
)
|
1472
|
-
return response
|
1473
|
-
|
1474
|
-
async def _async_get_engine_action(self, engine_action_guid: str) -> dict:
|
1475
|
-
"""Request the status and properties of an executing engine action request. Async version.
|
1476
|
-
Parameters
|
1477
|
-
----------
|
1478
|
-
engine_action_guid : str
|
1479
|
-
The GUID of the engine action to retrieve.
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
Returns
|
1484
|
-
-------
|
1485
|
-
dict
|
1486
|
-
The JSON representation of the engine action.
|
1487
|
-
|
1488
|
-
Raises
|
1489
|
-
------
|
1490
|
-
PyegeriaException
|
1491
|
-
ValidationError
|
1492
|
-
|
1493
|
-
|
1494
|
-
Notes
|
1495
|
-
-----
|
1496
|
-
For more information see: https://egeria-project.org/concepts/engine-action
|
1497
|
-
"""
|
1498
|
-
|
1499
|
-
url = f"{self.curation_command_root}/engine-actions/{engine_action_guid}"
|
1500
|
-
|
1501
|
-
response = await self._async_make_request("GET", url)
|
1502
|
-
return response.json().get("element", "No element found")
|
1503
|
-
|
1504
|
-
def get_engine_action(self, engine_action_guid: str) -> dict:
|
1505
|
-
"""Request the status and properties of an executing engine action request.
|
1506
|
-
Parameters
|
1507
|
-
----------
|
1508
|
-
engine_action_guid : str
|
1509
|
-
The GUID of the engine action to retrieve.
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
Returns
|
1514
|
-
-------
|
1515
|
-
dict
|
1516
|
-
The JSON representation of the engine action.
|
1517
|
-
|
1518
|
-
Raises
|
1519
|
-
------
|
1520
|
-
PyegeriaException
|
1521
|
-
Notes
|
1522
|
-
-----
|
1523
|
-
For more information see: https://egeria-project.org/concepts/engine-action
|
1524
|
-
"""
|
1525
|
-
loop = asyncio.get_event_loop()
|
1526
|
-
response = loop.run_until_complete(
|
1527
|
-
self._async_get_engine_action(engine_action_guid)
|
1528
|
-
)
|
1529
|
-
return response
|
1530
1740
|
|
1531
1741
|
async def _async_cancel_engine_action(self, engine_action_guid: str) -> None:
|
1532
1742
|
"""Request that an engine action request is cancelled and any running governance service is stopped. Async Ver.
|
@@ -1585,7 +1795,8 @@ class AutomatedCuration(Client2):
|
|
1585
1795
|
return
|
1586
1796
|
|
1587
1797
|
async def _async_get_active_engine_actions(
|
1588
|
-
self, start_from: int = 0, page_size: int = 0
|
1798
|
+
self, start_from: int = 0, page_size: int = 0,
|
1799
|
+
output_format: str = "JSON", output_format_set: str | dict = "EngineAction",
|
1589
1800
|
) -> list | str:
|
1590
1801
|
"""Retrieve the engine actions that are still in process. Async Version.
|
1591
1802
|
|
@@ -1617,10 +1828,20 @@ class AutomatedCuration(Client2):
|
|
1617
1828
|
)
|
1618
1829
|
|
1619
1830
|
response = await self._async_make_request("GET", url)
|
1620
|
-
|
1831
|
+
elements = response.json().get("elements", "No actions found")
|
1832
|
+
if type(elements) is str:
|
1833
|
+
logger.info("No Actions Found")
|
1834
|
+
return "No Actions Found"
|
1835
|
+
|
1836
|
+
if output_format.upper() != 'JSON': # return a simplified markdown representation
|
1837
|
+
# logger.info(f"Found elements, output format: {output_format} and output_format_set: {output_format_set}")
|
1838
|
+
return self._generate_engine_action_output(elements, None, "EngineAction",
|
1839
|
+
output_format, output_format_set)
|
1840
|
+
return elements
|
1621
1841
|
|
1622
1842
|
def get_active_engine_actions(
|
1623
|
-
self, start_from: int = 0, page_size: int = 0
|
1843
|
+
self, start_from: int = 0, page_size: int = 0,
|
1844
|
+
output_format: str = "JSON", output_format_set: str | dict = "EngineAction",
|
1624
1845
|
) -> list | str:
|
1625
1846
|
"""Retrieve the engine actions that are still in process.
|
1626
1847
|
|
@@ -1647,7 +1868,8 @@ class AutomatedCuration(Client2):
|
|
1647
1868
|
"""
|
1648
1869
|
loop = asyncio.get_event_loop()
|
1649
1870
|
response = loop.run_until_complete(
|
1650
|
-
self._async_get_active_engine_actions(start_from, page_size
|
1871
|
+
self._async_get_active_engine_actions(start_from, page_size,
|
1872
|
+
output_format=output_format, output_format_set=output_format_set)
|
1651
1873
|
)
|
1652
1874
|
return response
|
1653
1875
|
|
@@ -1740,6 +1962,8 @@ class AutomatedCuration(Client2):
|
|
1740
1962
|
ignore_case: bool = False,
|
1741
1963
|
start_from: int = 0,
|
1742
1964
|
page_size: int = 0,
|
1965
|
+
output_format: str = "JSON",
|
1966
|
+
output_format_set: str | dict = "EngineAction",
|
1743
1967
|
) -> list | str:
|
1744
1968
|
"""Retrieve the list of engine action metadata elements that contain the search string. Async Version.
|
1745
1969
|
Parameters
|
@@ -1781,17 +2005,24 @@ class AutomatedCuration(Client2):
|
|
1781
2005
|
validate_search_string(search_string)
|
1782
2006
|
if search_string == "*":
|
1783
2007
|
search_string = None
|
1784
|
-
starts_with_s = str(starts_with).lower()
|
1785
|
-
ends_with_s = str(ends_with).lower()
|
1786
|
-
ignore_case_s = str(ignore_case).lower()
|
1787
2008
|
|
1788
|
-
url = (
|
1789
|
-
|
1790
|
-
|
2009
|
+
url = str(HttpUrl(f"{self.curation_command_root}/assets/by-search-string"))
|
2010
|
+
return await self._async_find_request(
|
2011
|
+
url,
|
2012
|
+
_type=self.ENGINE_ACTION_LABEL,
|
2013
|
+
search_string=search_string,
|
2014
|
+
_gen_output=self._generate_engine_action_output,
|
2015
|
+
classification_names=None,
|
2016
|
+
metadata_element_types=["EngineAction"],
|
2017
|
+
starts_with=starts_with,
|
2018
|
+
ends_with=ends_with,
|
2019
|
+
ignore_case=ignore_case,
|
2020
|
+
start_from=start_from,
|
2021
|
+
page_size=page_size,
|
2022
|
+
output_format=output_format,
|
2023
|
+
output_format_set=output_format_set,
|
2024
|
+
body=None,
|
1791
2025
|
)
|
1792
|
-
body = {"class": "SearchStringRequestBody", "name": search_string}
|
1793
|
-
response = await self._async_make_request("POST", url, body)
|
1794
|
-
return response.json().get("elements", "no actions")
|
1795
2026
|
|
1796
2027
|
def find_engine_actions(
|
1797
2028
|
self,
|
@@ -1801,6 +2032,8 @@ class AutomatedCuration(Client2):
|
|
1801
2032
|
ignore_case: bool = False,
|
1802
2033
|
start_from: int = 0,
|
1803
2034
|
page_size: int = 0,
|
2035
|
+
output_format: str = "JSON",
|
2036
|
+
output_format_set: str | dict = "EngineAction",
|
1804
2037
|
) -> list | str:
|
1805
2038
|
"""Retrieve the list of engine action metadata elements that contain the search string.
|
1806
2039
|
Parameters
|
@@ -1848,6 +2081,8 @@ class AutomatedCuration(Client2):
|
|
1848
2081
|
ignore_case,
|
1849
2082
|
start_from,
|
1850
2083
|
page_size,
|
2084
|
+
output_format=output_format,
|
2085
|
+
output_format_set=output_format_set,
|
1851
2086
|
)
|
1852
2087
|
)
|
1853
2088
|
return response
|
@@ -1856,679 +2091,128 @@ class AutomatedCuration(Client2):
|
|
1856
2091
|
# Governance action processes
|
1857
2092
|
#
|
1858
2093
|
|
1859
|
-
async def _async_get_governance_action_process_by_guid(
|
1860
|
-
self, process_guid: str
|
1861
|
-
) -> dict | str:
|
1862
|
-
"""Retrieve the governance action process metadata element with the supplied unique identifier. Async Version.
|
1863
2094
|
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
2095
|
+
async def _async_initiate_gov_action_process(
|
2096
|
+
self,
|
2097
|
+
action_type_qualified_name: str,
|
2098
|
+
request_source_guids: [str] = None,
|
2099
|
+
action_targets: list = None,
|
2100
|
+
start_time: datetime = None,
|
2101
|
+
request_parameters: dict = None,
|
2102
|
+
orig_service_name: str = None,
|
2103
|
+
orig_engine_name: str = None,
|
2104
|
+
) -> str:
|
2105
|
+
"""Using the named governance action process as a template, initiate a chain of engine actions. Async version.
|
1868
2106
|
|
2107
|
+
Parameters
|
2108
|
+
----------
|
2109
|
+
action_type_qualified_name: str
|
2110
|
+
- unique name for the governance process
|
2111
|
+
request_source_guids: [str], optional
|
2112
|
+
- request source elements for the resulting governance action service
|
2113
|
+
action_targets: [str], optional
|
2114
|
+
-list of action target names to GUIDs for the resulting governance action service
|
2115
|
+
start_time: datetime, optional
|
2116
|
+
- time to start the process
|
2117
|
+
request_parameters: [str], optional
|
2118
|
+
- parameters passed into the process
|
2119
|
+
orig_service_name: str, optional
|
2120
|
+
- unique name of the requesting governance service (if initiated by a governance engine)
|
2121
|
+
orig_engine_name: str, optional
|
2122
|
+
- optional unique name of the governance engine (if initiated by a governance engine).
|
1869
2123
|
|
1870
|
-
Returns
|
2124
|
+
Returns
|
1871
2125
|
-------
|
1872
|
-
|
2126
|
+
Unique id (guid) of the newly started governance engine process
|
1873
2127
|
|
1874
|
-
Raises
|
2128
|
+
Raises
|
1875
2129
|
------
|
1876
|
-
|
1877
|
-
this exception is raised with details from the response content.
|
1878
|
-
PropertyServerException: If the API response indicates a server side error.
|
1879
|
-
UserNotAuthorizedException:
|
2130
|
+
PyegeriaException
|
1880
2131
|
"""
|
1881
2132
|
|
1882
|
-
|
1883
|
-
|
1884
|
-
url = (
|
1885
|
-
f"{self.curation_command_root}/"
|
1886
|
-
f"governance-action-processes/{process_guid}"
|
2133
|
+
start_time: datetime = (
|
2134
|
+
datetime.datetime.now() if start_time is None else start_time
|
1887
2135
|
)
|
1888
2136
|
|
1889
|
-
|
1890
|
-
|
2137
|
+
url = f"{self.curation_command_root}/governance-action-processes/initiate"
|
2138
|
+
body = {
|
2139
|
+
"class": "GovernanceActionProcessRequestBody",
|
2140
|
+
"processQualifiedName": action_type_qualified_name,
|
2141
|
+
"requestSourceGUIDs": request_source_guids,
|
2142
|
+
"actionTargets": action_targets,
|
2143
|
+
"startTime": int(start_time.timestamp() * 1000),
|
2144
|
+
"requestParameters": request_parameters,
|
2145
|
+
"originatorServiceName": orig_service_name,
|
2146
|
+
"originatorEngineName": orig_engine_name,
|
2147
|
+
}
|
2148
|
+
new_body = body_slimmer(body)
|
2149
|
+
response = await self._async_make_request("POST", url, new_body)
|
2150
|
+
return response.json().get("guid", "Action not initiated")
|
1891
2151
|
|
1892
|
-
def
|
1893
|
-
|
2152
|
+
def initiate_gov_action_process(
|
2153
|
+
self,
|
2154
|
+
action_type_qualified_name: str,
|
2155
|
+
request_source_guids: [str] = None,
|
2156
|
+
action_targets: [str] = None,
|
2157
|
+
start_time: datetime = None,
|
2158
|
+
request_parameters: dict = None,
|
2159
|
+
orig_service_name: str = None,
|
2160
|
+
orig_engine_name: str = None,
|
2161
|
+
) -> str:
|
2162
|
+
"""Using the named governance action process as a template, initiate a chain of engine actions.
|
1894
2163
|
|
1895
|
-
Parameters
|
2164
|
+
Parameters
|
1896
2165
|
----------
|
1897
|
-
|
1898
|
-
|
2166
|
+
action_type_qualified_name: str
|
2167
|
+
- unique name for the governance process
|
2168
|
+
request_source_guids: [str], optional
|
2169
|
+
- request source elements for the resulting governance action service
|
2170
|
+
action_targets: [str], optional
|
2171
|
+
-list of action target names to GUIDs for the resulting governance action service
|
2172
|
+
start_time: datetime, optional
|
2173
|
+
- time to start the process
|
2174
|
+
request_parameters: [str], optional
|
2175
|
+
- parameters passed into the process
|
2176
|
+
orig_service_name: str, optional
|
2177
|
+
- unique name of the requesting governance service (if initiated by a governance engine)
|
2178
|
+
orig_engine_name: str, optional
|
2179
|
+
- optional unique name of the governance engine (if initiated by a governance engine).
|
1899
2180
|
|
1900
|
-
Returns
|
2181
|
+
Returns
|
1901
2182
|
-------
|
1902
|
-
|
2183
|
+
Unique id (guid) of the newly started governance engine process
|
1903
2184
|
|
1904
|
-
Raises
|
2185
|
+
Raises
|
1905
2186
|
------
|
1906
|
-
|
1907
|
-
this exception is raised with details from the response content.
|
1908
|
-
PropertyServerException: If the API response indicates a server side error.
|
1909
|
-
UserNotAuthorizedException:
|
2187
|
+
PyegeriaException
|
1910
2188
|
"""
|
1911
2189
|
loop = asyncio.get_event_loop()
|
1912
2190
|
response = loop.run_until_complete(
|
1913
|
-
self.
|
2191
|
+
self._async_initiate_gov_action_process(
|
2192
|
+
action_type_qualified_name,
|
2193
|
+
request_source_guids,
|
2194
|
+
action_targets,
|
2195
|
+
start_time,
|
2196
|
+
request_parameters,
|
2197
|
+
orig_service_name,
|
2198
|
+
orig_engine_name,
|
2199
|
+
)
|
1914
2200
|
)
|
1915
2201
|
return response
|
1916
2202
|
|
1917
|
-
async def _async_get_gov_action_process_graph(
|
1918
|
-
self, process_guid: str
|
1919
|
-
) -> dict | str:
|
1920
|
-
"""Retrieve the governance action process metadata element with the supplied unique
|
1921
|
-
identifier along with the flow definition describing its implementation. Async Version.
|
1922
|
-
Parameters
|
1923
|
-
----------
|
1924
|
-
process_guid : str
|
1925
|
-
The process GUID to retrieve the graph for.
|
1926
|
-
|
1927
|
-
Returns
|
1928
|
-
-------
|
1929
|
-
dict or str
|
1930
|
-
A dictionary representing the graph of the governance action process, or the string "no actions"
|
1931
|
-
if no actions are found.
|
1932
|
-
Raises:
|
1933
|
-
------
|
1934
|
-
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1935
|
-
this exception is raised with details from the response content.
|
1936
|
-
PropertyServerException: If the API response indicates a server side error.
|
1937
|
-
UserNotAuthorizedException:
|
1938
|
-
|
1939
|
-
"""
|
1940
|
-
|
1941
|
-
validate_guid(process_guid)
|
1942
2203
|
|
1943
|
-
url = (
|
1944
|
-
f"{self.curation_command_root}/"
|
1945
|
-
f"governance-action-processes/{process_guid}/graph"
|
1946
|
-
)
|
1947
2204
|
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
Returns
|
1960
|
-
-------
|
1961
|
-
dict or str
|
1962
|
-
A dictionary representing the graph of the governance action process, or the string "no actions"
|
1963
|
-
if no actions are found.
|
1964
|
-
Raises:
|
1965
|
-
------
|
1966
|
-
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1967
|
-
this exception is raised with details from the response content.
|
1968
|
-
PropertyServerException: If the API response indicates a server side error.
|
1969
|
-
UserNotAuthorizedException:
|
1970
|
-
|
1971
|
-
"""
|
1972
|
-
loop = asyncio.get_event_loop()
|
1973
|
-
response = loop.run_until_complete(
|
1974
|
-
self._async_get_gov_action_process_graph(process_guid)
|
1975
|
-
)
|
1976
|
-
return response
|
1977
|
-
|
1978
|
-
async def _async_get_gov_action_processes_by_name(
|
1979
|
-
self,
|
1980
|
-
name: str,
|
1981
|
-
start_from: int = None,
|
1982
|
-
page_size: int = 0,
|
1983
|
-
) -> list | str:
|
1984
|
-
"""Retrieve the list of governance action process metadata elements with a matching qualified or display name.
|
1985
|
-
There are no wildcards supported on this request. Async Version.
|
1986
|
-
|
1987
|
-
Parameters
|
1988
|
-
----------
|
1989
|
-
name : str
|
1990
|
-
The name of the engine action to retrieve.
|
1991
|
-
|
1992
|
-
start_from : int, optional
|
1993
|
-
The index to start retrieving engine actions from. If not provided, the default value will be used.
|
1994
|
-
page_size : int, optional
|
1995
|
-
The maximum number of engine actions to retrieve in a single request. If not provided, the default
|
1996
|
-
global maximum paging size will be used.
|
1997
|
-
|
1998
|
-
Returns
|
1999
|
-
-------
|
2000
|
-
list of dict | str
|
2001
|
-
A list of dictionaries representing the retrieved engine actions,
|
2002
|
-
or "no actions" if no engine actions were found with the given name.
|
2003
|
-
Raises:
|
2004
|
-
------
|
2005
|
-
PyegeriaException """
|
2006
|
-
|
2007
|
-
validate_name(name)
|
2008
|
-
|
2009
|
-
url = (
|
2010
|
-
f"{self.curation_command_root}/governance-action-processes/"
|
2011
|
-
f"by-name"
|
2012
|
-
)
|
2013
|
-
body = {"filter": name}
|
2014
|
-
response = await self._async_make_request("POST", url, body)
|
2015
|
-
return response.json().get("elements", "no actions")
|
2016
|
-
|
2017
|
-
def get_gov_action_processes_by_name(
|
2018
|
-
self,
|
2019
|
-
name: str,
|
2020
|
-
start_from: int = 0,
|
2021
|
-
page_size: int = 0,
|
2022
|
-
) -> list | str:
|
2023
|
-
"""Retrieve the list of governance action process metadata elements with a matching qualified or display name.
|
2024
|
-
There are no wildcards supported on this request.
|
2025
|
-
|
2026
|
-
Parameters
|
2027
|
-
----------
|
2028
|
-
name : str
|
2029
|
-
The name of the engine action to retrieve.
|
2030
|
-
|
2031
|
-
start_from : int, optional
|
2032
|
-
The index to start retrieving engine actions from. If not provided, the default value will be used.
|
2033
|
-
page_size : int, optional
|
2034
|
-
The maximum number of engine actions to retrieve in a single request. If not provided, the default global
|
2035
|
-
maximum paging size will be used.
|
2036
|
-
|
2037
|
-
Returns
|
2038
|
-
-------
|
2039
|
-
list of dict | str
|
2040
|
-
A list of dictionaries representing the retrieved engine actions,
|
2041
|
-
or "no actions" if no engine actions were found with the given name.
|
2042
|
-
Raises:
|
2043
|
-
------
|
2044
|
-
PyegeriaException """
|
2045
|
-
loop = asyncio.get_event_loop()
|
2046
|
-
response = loop.run_until_complete(
|
2047
|
-
self._async_get_gov_action_processes_by_name(name, start_from, page_size)
|
2048
|
-
)
|
2049
|
-
return response
|
2050
|
-
|
2051
|
-
async def _async_find_gov_action_processes(
|
2052
|
-
self,
|
2053
|
-
search_string: str,
|
2054
|
-
starts_with: bool = False,
|
2055
|
-
ends_with: bool = False,
|
2056
|
-
ignore_case: bool = False,
|
2057
|
-
start_from: int = 0,
|
2058
|
-
page_size: int = 0,
|
2059
|
-
) -> list | str:
|
2060
|
-
"""Retrieve the list of governance action process metadata elements that contain the search string. Async ver.
|
2061
|
-
|
2062
|
-
Parameters
|
2063
|
-
----------
|
2064
|
-
search_string : str
|
2065
|
-
The string used for searching engine actions by name.
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
starts_with : bool, optional
|
2070
|
-
Whether to search engine actions that start with the given search string. Default is False.
|
2071
|
-
|
2072
|
-
ends_with : bool, optional
|
2073
|
-
Whether to search engine actions that end with the given search string. Default is False.
|
2074
|
-
|
2075
|
-
ignore_case : bool, optional
|
2076
|
-
Whether to ignore case while searching engine actions. Default is False.
|
2077
|
-
|
2078
|
-
start_from : int, optional
|
2079
|
-
The index from which to start fetching the engine actions. Default is 0.
|
2080
|
-
|
2081
|
-
page_size : int, optional
|
2082
|
-
The maximum number of engine actions to fetch in a single request. Default is `0`.
|
2083
|
-
|
2084
|
-
Returns
|
2085
|
-
-------
|
2086
|
-
List[dict] or str
|
2087
|
-
A list of dictionaries representing the governance action processes found based on the search query.
|
2088
|
-
If no actions are found, returns the string "no actions".
|
2089
|
-
|
2090
|
-
Raises:
|
2091
|
-
------
|
2092
|
-
PyegeriaException """
|
2093
|
-
|
2094
|
-
validate_search_string(search_string)
|
2095
|
-
if search_string == "*":
|
2096
|
-
search_string = None
|
2097
|
-
starts_with_s = str(starts_with).lower()
|
2098
|
-
ends_with_s = str(ends_with).lower()
|
2099
|
-
ignore_case_s = str(ignore_case).lower()
|
2100
|
-
|
2101
|
-
url = (
|
2102
|
-
f"{self.curation_command_root}/governance-action-processes/"
|
2103
|
-
f"by-search-string"
|
2104
|
-
)
|
2105
|
-
|
2106
|
-
if search_string:
|
2107
|
-
body = {"filter": search_string}
|
2108
|
-
response = await self._async_make_request("POST", url, body)
|
2109
|
-
else:
|
2110
|
-
response = await self._async_make_request("POST", url)
|
2111
|
-
|
2112
|
-
return response.json().get("elements", "no actions")
|
2113
|
-
|
2114
|
-
def find_gov_action_processes(
|
2115
|
-
self,
|
2116
|
-
search_string: str = "*",
|
2117
|
-
starts_with: bool = False,
|
2118
|
-
ends_with: bool = False,
|
2119
|
-
ignore_case: bool = False,
|
2120
|
-
start_from: int = 0,
|
2121
|
-
page_size: int = 0,
|
2122
|
-
) -> list | str:
|
2123
|
-
"""Retrieve the list of governance action process metadata elements that contain the search string.
|
2124
|
-
|
2125
|
-
Parameters
|
2126
|
-
----------
|
2127
|
-
search_string : str
|
2128
|
-
The string used for searching engine actions by name.
|
2129
|
-
|
2130
|
-
|
2131
|
-
|
2132
|
-
starts_with : bool, optional
|
2133
|
-
Whether to search engine actions that start with the given search string. Default is False.
|
2134
|
-
|
2135
|
-
ends_with : bool, optional
|
2136
|
-
Whether to search engine actions that end with the given search string. Default is False.
|
2137
|
-
|
2138
|
-
ignore_case : bool, optional
|
2139
|
-
Whether to ignore case while searching engine actions. Default is False.
|
2140
|
-
|
2141
|
-
start_from : int, optional
|
2142
|
-
The index from which to start fetching the engine actions. Default is 0.
|
2143
|
-
|
2144
|
-
page_size : int, optional
|
2145
|
-
The maximum number of engine actions to fetch in a single request. Default is `0`.
|
2146
|
-
|
2147
|
-
Returns
|
2148
|
-
-------
|
2149
|
-
List[dict] or str
|
2150
|
-
A list of dictionaries representing the governance action processes found based on the search query.
|
2151
|
-
If no actions are found, returns the string "no actions".
|
2152
|
-
|
2153
|
-
Raises:
|
2154
|
-
------
|
2155
|
-
PyegeriaException """
|
2156
|
-
|
2157
|
-
loop = asyncio.get_event_loop()
|
2158
|
-
response = loop.run_until_complete(
|
2159
|
-
self._async_find_gov_action_processes(
|
2160
|
-
search_string,
|
2161
|
-
starts_with,
|
2162
|
-
ends_with,
|
2163
|
-
ignore_case,
|
2164
|
-
start_from,
|
2165
|
-
page_size,
|
2166
|
-
)
|
2167
|
-
)
|
2168
|
-
return response
|
2169
|
-
|
2170
|
-
async def _async_initiate_gov_action_process(
|
2171
|
-
self,
|
2172
|
-
action_type_qualified_name: str,
|
2173
|
-
request_source_guids: [str] = None,
|
2174
|
-
action_targets: list = None,
|
2175
|
-
start_time: datetime = None,
|
2176
|
-
request_parameters: dict = None,
|
2177
|
-
orig_service_name: str = None,
|
2178
|
-
orig_engine_name: str = None,
|
2179
|
-
) -> str:
|
2180
|
-
"""Using the named governance action process as a template, initiate a chain of engine actions. Async version.
|
2181
|
-
|
2182
|
-
Parameters
|
2183
|
-
----------
|
2184
|
-
action_type_qualified_name: str
|
2185
|
-
- unique name for the governance process
|
2186
|
-
request_source_guids: [str], optional
|
2187
|
-
- request source elements for the resulting governance action service
|
2188
|
-
action_targets: [str], optional
|
2189
|
-
-list of action target names to GUIDs for the resulting governance action service
|
2190
|
-
start_time: datetime, optional
|
2191
|
-
- time to start the process
|
2192
|
-
request_parameters: [str], optional
|
2193
|
-
- parameters passed into the process
|
2194
|
-
orig_service_name: str, optional
|
2195
|
-
- unique name of the requesting governance service (if initiated by a governance engine)
|
2196
|
-
orig_engine_name: str, optional
|
2197
|
-
- optional unique name of the governance engine (if initiated by a governance engine).
|
2198
|
-
|
2199
|
-
Returns
|
2200
|
-
-------
|
2201
|
-
Unique id (guid) of the newly started governance engine process
|
2202
|
-
|
2203
|
-
Raises
|
2204
|
-
------
|
2205
|
-
PyegeriaException
|
2206
|
-
"""
|
2207
|
-
|
2208
|
-
start_time: datetime = (
|
2209
|
-
datetime.datetime.now() if start_time is None else start_time
|
2210
|
-
)
|
2211
|
-
|
2212
|
-
url = f"{self.curation_command_root}/governance-action-processes/initiate"
|
2213
|
-
body = {
|
2214
|
-
"class": "GovernanceActionProcessRequestBody",
|
2215
|
-
"processQualifiedName": action_type_qualified_name,
|
2216
|
-
"requestSourceGUIDs": request_source_guids,
|
2217
|
-
"actionTargets": action_targets,
|
2218
|
-
"startTime": int(start_time.timestamp() * 1000),
|
2219
|
-
"requestParameters": request_parameters,
|
2220
|
-
"originatorServiceName": orig_service_name,
|
2221
|
-
"originatorEngineName": orig_engine_name,
|
2222
|
-
}
|
2223
|
-
new_body = body_slimmer(body)
|
2224
|
-
response = await self._async_make_request("POST", url, new_body)
|
2225
|
-
return response.json().get("guid", "Action not initiated")
|
2226
|
-
|
2227
|
-
def initiate_gov_action_process(
|
2228
|
-
self,
|
2229
|
-
action_type_qualified_name: str,
|
2230
|
-
request_source_guids: [str] = None,
|
2231
|
-
action_targets: [str] = None,
|
2232
|
-
start_time: datetime = None,
|
2233
|
-
request_parameters: dict = None,
|
2234
|
-
orig_service_name: str = None,
|
2235
|
-
orig_engine_name: str = None,
|
2236
|
-
) -> str:
|
2237
|
-
"""Using the named governance action process as a template, initiate a chain of engine actions.
|
2238
|
-
|
2239
|
-
Parameters
|
2240
|
-
----------
|
2241
|
-
action_type_qualified_name: str
|
2242
|
-
- unique name for the governance process
|
2243
|
-
request_source_guids: [str], optional
|
2244
|
-
- request source elements for the resulting governance action service
|
2245
|
-
action_targets: [str], optional
|
2246
|
-
-list of action target names to GUIDs for the resulting governance action service
|
2247
|
-
start_time: datetime, optional
|
2248
|
-
- time to start the process
|
2249
|
-
request_parameters: [str], optional
|
2250
|
-
- parameters passed into the process
|
2251
|
-
orig_service_name: str, optional
|
2252
|
-
- unique name of the requesting governance service (if initiated by a governance engine)
|
2253
|
-
orig_engine_name: str, optional
|
2254
|
-
- optional unique name of the governance engine (if initiated by a governance engine).
|
2255
|
-
|
2256
|
-
Returns
|
2257
|
-
-------
|
2258
|
-
Unique id (guid) of the newly started governance engine process
|
2259
|
-
|
2260
|
-
Raises
|
2261
|
-
------
|
2262
|
-
PyegeriaException
|
2263
|
-
"""
|
2264
|
-
loop = asyncio.get_event_loop()
|
2265
|
-
response = loop.run_until_complete(
|
2266
|
-
self._async_initiate_gov_action_process(
|
2267
|
-
action_type_qualified_name,
|
2268
|
-
request_source_guids,
|
2269
|
-
action_targets,
|
2270
|
-
start_time,
|
2271
|
-
request_parameters,
|
2272
|
-
orig_service_name,
|
2273
|
-
orig_engine_name,
|
2274
|
-
)
|
2275
|
-
)
|
2276
|
-
return response
|
2277
|
-
|
2278
|
-
async def _async_get_gov_action_types_by_guid(
|
2279
|
-
self, gov_action_type_guid: str
|
2280
|
-
) -> dict | str:
|
2281
|
-
"""Retrieve the governance action type metadata element with the supplied unique identifier. Async version.
|
2282
|
-
|
2283
|
-
Parameters:
|
2284
|
-
----------
|
2285
|
-
gov_action_type_guid: str
|
2286
|
-
The GUID (Globally Unique Identifier) of the governance action type to retrieve.
|
2287
|
-
|
2288
|
-
Returns:
|
2289
|
-
-------
|
2290
|
-
dict: The JSON representation of the governance action type element.
|
2291
|
-
|
2292
|
-
Raises:
|
2293
|
-
------
|
2294
|
-
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
2295
|
-
this exception is raised with details from the response content.
|
2296
|
-
PropertyServerException: If the API response indicates a server side error.
|
2297
|
-
UserNotAuthorizedException:
|
2298
|
-
"""
|
2299
|
-
|
2300
|
-
validate_guid(gov_action_type_guid)
|
2301
|
-
|
2302
|
-
url = (
|
2303
|
-
f"{self.curation_command_root}/"
|
2304
|
-
f"governance-action-types/{gov_action_type_guid}"
|
2305
|
-
)
|
2306
|
-
|
2307
|
-
response = await self._async_make_request("GET", url)
|
2308
|
-
return response.json().get("element", "no actions")
|
2309
|
-
|
2310
|
-
def get_gov_action_types_by_guid(self, gov_action_type_guid: str) -> dict | str:
|
2311
|
-
"""Retrieve the governance action type metadata element with the supplied unique identifier.
|
2312
|
-
|
2313
|
-
Parameters:
|
2314
|
-
----------
|
2315
|
-
gov_action_type_guid: str
|
2316
|
-
The GUID (Globally Unique Identifier) of the governance action type to retrieve.
|
2317
|
-
|
2318
|
-
Returns:
|
2319
|
-
-------
|
2320
|
-
dict: The JSON representation of the governance action type element.
|
2321
|
-
|
2322
|
-
Raises:
|
2323
|
-
------
|
2324
|
-
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
2325
|
-
this exception is raised with details from the response content.
|
2326
|
-
PropertyServerException: If the API response indicates a server side error.
|
2327
|
-
UserNotAuthorizedException:
|
2328
|
-
"""
|
2329
|
-
loop = asyncio.get_event_loop()
|
2330
|
-
response = loop.run_until_complete(
|
2331
|
-
self._async_get_gov_action_types_by_guid(gov_action_type_guid)
|
2332
|
-
)
|
2333
|
-
return response
|
2334
|
-
|
2335
|
-
async def _async_get_gov_action_types_by_name(
|
2336
|
-
self,
|
2337
|
-
action_type_name,
|
2338
|
-
start_from: int = 0,
|
2339
|
-
page_size: int = 0,
|
2340
|
-
) -> list | str:
|
2341
|
-
"""Retrieve the list of governance action type metadata elements with a matching qualified or display name.
|
2342
|
-
There are no wildcards supported on this request. Async version.
|
2343
|
-
|
2344
|
-
Parameters:
|
2345
|
-
----------
|
2346
|
-
action_type_name: str
|
2347
|
-
The name of the governance action type to retrieve.
|
2348
|
-
|
2349
|
-
Returns:
|
2350
|
-
-------
|
2351
|
-
dict: The JSON representation of the governance action type element.
|
2352
|
-
|
2353
|
-
Raises:
|
2354
|
-
------
|
2355
|
-
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
2356
|
-
this exception is raised with details from the response content.
|
2357
|
-
PropertyServerException: If the API response indicates a server side error.
|
2358
|
-
UserNotAuthorizedException:
|
2359
|
-
"""
|
2360
|
-
|
2361
|
-
validate_name(action_type_name)
|
2362
|
-
|
2363
|
-
url = (
|
2364
|
-
f"{self.curation_command_root}/"
|
2365
|
-
f"governance-action-types/by-name"
|
2366
|
-
)
|
2367
|
-
|
2368
|
-
body = {"filter": action_type_name}
|
2369
|
-
|
2370
|
-
response = await self._async_make_request("POST", url, body)
|
2371
|
-
return response.json().get("elements", "no actions")
|
2372
|
-
|
2373
|
-
def get_gov_action_types_by_name(
|
2374
|
-
self,
|
2375
|
-
action_type_name,
|
2376
|
-
start_from: int = 0,
|
2377
|
-
page_size: int = 0,
|
2378
|
-
) -> list | str:
|
2379
|
-
"""Retrieve the list of governance action type metadata elements with a matching qualified or display name.
|
2380
|
-
There are no wildcards supported on this request. Async version.
|
2381
|
-
|
2382
|
-
Parameters:
|
2383
|
-
----------
|
2384
|
-
action_type_name: str
|
2385
|
-
The name of the governance action type to retrieve.
|
2386
|
-
|
2387
|
-
Returns:
|
2388
|
-
-------
|
2389
|
-
dict: The JSON representation of the governance action type element.
|
2390
|
-
|
2391
|
-
Raises:
|
2392
|
-
------
|
2393
|
-
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
2394
|
-
this exception is raised with details from the response content.
|
2395
|
-
PropertyServerException: If the API response indicates a server side error.
|
2396
|
-
UserNotAuthorizedException:
|
2397
|
-
"""
|
2398
|
-
loop = asyncio.get_event_loop()
|
2399
|
-
response = loop.run_until_complete(
|
2400
|
-
self._async_get_gov_action_types_by_name(
|
2401
|
-
action_type_name, start_from, page_size
|
2402
|
-
)
|
2403
|
-
)
|
2404
|
-
return response
|
2405
|
-
|
2406
|
-
async def _async_find_gov_action_types(
|
2407
|
-
self,
|
2408
|
-
search_string: str = "*",
|
2409
|
-
starts_with: bool = False,
|
2410
|
-
ends_with: bool = False,
|
2411
|
-
ignore_case: bool = True,
|
2412
|
-
start_from: int = 0,
|
2413
|
-
page_size: int = 0,
|
2414
|
-
) -> list | str:
|
2415
|
-
"""Retrieve the list of governance action type metadata elements that contain the search string.
|
2416
|
-
Async Version.
|
2417
|
-
|
2418
|
-
Parameters
|
2419
|
-
----------
|
2420
|
-
search_string : str
|
2421
|
-
The string used for searching engine actions by name.
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
starts_with : bool, optional
|
2426
|
-
Whether to search engine actions that start with the given search string. Default is False.
|
2427
|
-
|
2428
|
-
ends_with : bool, optional
|
2429
|
-
Whether to search engine actions that end with the given search string. Default is False.
|
2430
|
-
|
2431
|
-
ignore_case : bool, optional
|
2432
|
-
Whether to ignore case while searching engine actions. Default is False.
|
2433
|
-
|
2434
|
-
start_from : int, optional
|
2435
|
-
The index from which to start fetching the engine actions. Default is 0.
|
2436
|
-
|
2437
|
-
page_size : int, optional
|
2438
|
-
The maximum number of engine actions to fetch in a single request. Default is `0`.
|
2439
|
-
|
2440
|
-
Returns
|
2441
|
-
-------
|
2442
|
-
List[dict] or str
|
2443
|
-
A list of dictionaries representing the governance action types found based on the search query.
|
2444
|
-
If no actions are found, returns the string "no action types".
|
2445
|
-
|
2446
|
-
Raises
|
2447
|
-
------
|
2448
|
-
PyegeriaException
|
2449
|
-
"""
|
2450
|
-
|
2451
|
-
validate_search_string(search_string)
|
2452
|
-
if search_string == "*":
|
2453
|
-
search_string = None
|
2454
|
-
starts_with_s = str(starts_with).lower()
|
2455
|
-
ends_with_s = str(ends_with).lower()
|
2456
|
-
ignore_case_s = str(ignore_case).lower()
|
2457
|
-
|
2458
|
-
url = (
|
2459
|
-
f"{self.curation_command_root}/governance-action-types/"
|
2460
|
-
f"by-search-string"
|
2461
|
-
)
|
2462
|
-
body = {"filter": search_string}
|
2463
|
-
response = await self._async_make_request("POST", url, body)
|
2464
|
-
return response.json().get("elements", "no action types")
|
2465
|
-
|
2466
|
-
def find_gov_action_types(
|
2467
|
-
self,
|
2468
|
-
search_string: str = "*",
|
2469
|
-
starts_with: bool = False,
|
2470
|
-
ends_with: bool = False,
|
2471
|
-
ignore_case: bool = False,
|
2472
|
-
start_from: int = 0,
|
2473
|
-
page_size: int = 0,
|
2474
|
-
) -> list | str:
|
2475
|
-
"""Retrieve the list of governance action type metadata elements that contain the search string.
|
2476
|
-
|
2477
|
-
Parameters
|
2478
|
-
----------
|
2479
|
-
search_string : str
|
2480
|
-
The string used for searching engine actions by name.
|
2481
|
-
|
2482
|
-
|
2483
|
-
starts_with : bool, optional
|
2484
|
-
Whether to search engine actions that start with the given search string. Default is False.
|
2485
|
-
|
2486
|
-
ends_with : bool, optional
|
2487
|
-
Whether to search engine actions that end with the given search string. Default is False.
|
2488
|
-
|
2489
|
-
ignore_case : bool, optional
|
2490
|
-
Whether to ignore case while searching engine actions. Default is False.
|
2491
|
-
|
2492
|
-
start_from : int, optional
|
2493
|
-
The index from which to start fetching the engine actions. Default is 0.
|
2494
|
-
|
2495
|
-
page_size : int, optional
|
2496
|
-
The maximum number of engine actions to fetch in a single request. Default is `0`.
|
2497
|
-
|
2498
|
-
Returns
|
2499
|
-
-------
|
2500
|
-
List[dict] or str
|
2501
|
-
A list of dictionaries representing the governance action types found based on the search query.
|
2502
|
-
If no actions are found, returns the string "no action types".
|
2503
|
-
|
2504
|
-
Raises
|
2505
|
-
------
|
2506
|
-
PyegeriaException
|
2507
|
-
"""
|
2508
|
-
loop = asyncio.get_event_loop()
|
2509
|
-
response = loop.run_until_complete(
|
2510
|
-
self._async_find_gov_action_types(
|
2511
|
-
search_string,
|
2512
|
-
starts_with,
|
2513
|
-
ends_with,
|
2514
|
-
ignore_case,
|
2515
|
-
start_from,
|
2516
|
-
page_size,
|
2517
|
-
)
|
2518
|
-
)
|
2519
|
-
return response
|
2520
|
-
|
2521
|
-
async def _async_initiate_gov_action_type(
|
2522
|
-
self,
|
2523
|
-
action_type_qualified_name: str,
|
2524
|
-
request_source_guids: [str],
|
2525
|
-
action_targets: list,
|
2526
|
-
start_time: datetime = None,
|
2527
|
-
request_parameters: dict = None,
|
2528
|
-
orig_service_name: str = None,
|
2529
|
-
orig_engine_name: str = None,
|
2530
|
-
) -> str:
|
2531
|
-
"""Using the named governance action type as a template, initiate an engine action. Async version.
|
2205
|
+
async def _async_initiate_gov_action_type(
|
2206
|
+
self,
|
2207
|
+
action_type_qualified_name: str,
|
2208
|
+
request_source_guids: [str],
|
2209
|
+
action_targets: list,
|
2210
|
+
start_time: datetime = None,
|
2211
|
+
request_parameters: dict = None,
|
2212
|
+
orig_service_name: str = None,
|
2213
|
+
orig_engine_name: str = None,
|
2214
|
+
) -> str:
|
2215
|
+
"""Using the named governance action type as a template, initiate an engine action. Async version.
|
2532
2216
|
|
2533
2217
|
Parameters
|
2534
2218
|
----------
|
@@ -3101,6 +2785,8 @@ class AutomatedCuration(Client2):
|
|
3101
2785
|
integ_connector_guid: str,
|
3102
2786
|
start_from: int = 0,
|
3103
2787
|
page_size: int = 0,
|
2788
|
+
output_format: str = "JSON",
|
2789
|
+
output_format_set: str | dict = "CatalogTarget",
|
3104
2790
|
) -> list | str:
|
3105
2791
|
"""Retrieve the details of the metadata elements identified as catalog targets with an integration connector.
|
3106
2792
|
Async version.
|
@@ -3129,13 +2815,20 @@ class AutomatedCuration(Client2):
|
|
3129
2815
|
)
|
3130
2816
|
|
3131
2817
|
response = await self._async_make_request("GET", url)
|
3132
|
-
|
2818
|
+
elements = response.json().get("elements", "no targets")
|
2819
|
+
if isinstance(elements, str):
|
2820
|
+
return elements
|
2821
|
+
return self._generate_catalog_target_output(elements, None, self.CATALOG_TARGET_LABEL,
|
2822
|
+
output_format=output_format,
|
2823
|
+
output_format_set=output_format_set)
|
3133
2824
|
|
3134
2825
|
def get_catalog_targets(
|
3135
2826
|
self,
|
3136
2827
|
integ_connector_guid: str,
|
3137
2828
|
start_from: int = 0,
|
3138
2829
|
page_size: int = 0,
|
2830
|
+
output_format: str = "JSON",
|
2831
|
+
output_format_set: str | dict = "CatalogTarget",
|
3139
2832
|
) -> list | str:
|
3140
2833
|
"""Retrieve the details of the metadata elements identified as catalog targets with an integration connector.
|
3141
2834
|
|
@@ -3157,11 +2850,16 @@ class AutomatedCuration(Client2):
|
|
3157
2850
|
|
3158
2851
|
loop = asyncio.get_event_loop()
|
3159
2852
|
response = loop.run_until_complete(
|
3160
|
-
self._async_get_catalog_targets(integ_connector_guid, start_from, page_size
|
2853
|
+
self._async_get_catalog_targets(integ_connector_guid, start_from, page_size,
|
2854
|
+
output_format=output_format,
|
2855
|
+
output_format_set=output_format_set)
|
3161
2856
|
)
|
3162
2857
|
return response
|
3163
2858
|
|
3164
|
-
async def _async_get_catalog_target(self, relationship_guid: str
|
2859
|
+
async def _async_get_catalog_target(self, relationship_guid: str,
|
2860
|
+
output_format: str = "JSON",
|
2861
|
+
output_format_set: str | dict = "CatalogTarget",
|
2862
|
+
body: dict | GetRequestBody = None) -> dict | str:
|
3165
2863
|
"""Retrieve a specific catalog target associated with an integration connector. Further Information:
|
3166
2864
|
https://egeria-project.org/concepts/integration-connector/ . Async version.
|
3167
2865
|
|
@@ -3184,12 +2882,21 @@ class AutomatedCuration(Client2):
|
|
3184
2882
|
|
3185
2883
|
validate_guid(relationship_guid)
|
3186
2884
|
|
3187
|
-
url = f"{self.curation_command_root}/catalog-targets/{relationship_guid}"
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
2885
|
+
url = str(HttpUrl(f"{self.curation_command_root}/catalog-targets/{relationship_guid}"))
|
2886
|
+
response = await self._async_get_guid_request(
|
2887
|
+
url,
|
2888
|
+
_type=self.CATALOG_TARGET_LABEL,
|
2889
|
+
_gen_output=self._generate_catalog_target_output,
|
2890
|
+
output_format=output_format,
|
2891
|
+
output_format_set=output_format_set,
|
2892
|
+
body=body,
|
2893
|
+
)
|
2894
|
+
return response
|
3191
2895
|
|
3192
|
-
def get_catalog_target(self, relationship_guid: str
|
2896
|
+
def get_catalog_target(self, relationship_guid: str,
|
2897
|
+
output_format: str = "JSON",
|
2898
|
+
output_format_set: str | dict = "CatalogTarget",
|
2899
|
+
body: dict | GetRequestBody = None) -> dict | str:
|
3193
2900
|
"""Retrieve a specific catalog target associated with an integration connector. Further Information:
|
3194
2901
|
https://egeria-project.org/concepts/integration-connector/ .
|
3195
2902
|
|
@@ -3212,7 +2919,10 @@ class AutomatedCuration(Client2):
|
|
3212
2919
|
|
3213
2920
|
loop = asyncio.get_event_loop()
|
3214
2921
|
response = loop.run_until_complete(
|
3215
|
-
self._async_get_catalog_target(relationship_guid
|
2922
|
+
self._async_get_catalog_target(relationship_guid,
|
2923
|
+
output_format=output_format,
|
2924
|
+
output_format_set=output_format_set,
|
2925
|
+
body=body)
|
3216
2926
|
)
|
3217
2927
|
return response
|
3218
2928
|
|
@@ -3597,7 +3307,9 @@ class AutomatedCuration(Client2):
|
|
3597
3307
|
return response
|
3598
3308
|
|
3599
3309
|
async def _async_get_technology_type_detail(self, type_name: str, template_only: bool = False,
|
3600
|
-
body: dict | FilterRequestBody = None
|
3310
|
+
body: dict | FilterRequestBody = None,
|
3311
|
+
output_format: str = "JSON",
|
3312
|
+
output_format_set: str | dict = "TechType") -> list | str:
|
3601
3313
|
"""Retrieve the details of the named technology type. This name should be the name of the technology type
|
3602
3314
|
and contain no wild cards. Async version.
|
3603
3315
|
Parameters
|
@@ -3642,20 +3354,32 @@ class AutomatedCuration(Client2):
|
|
3642
3354
|
"""
|
3643
3355
|
|
3644
3356
|
# validate_name(type_name)
|
3645
|
-
url = f"{self.curation_command_root}/technology-types/by-name"
|
3357
|
+
url = str(HttpUrl(f"{self.curation_command_root}/technology-types/by-name"))
|
3646
3358
|
if body is None:
|
3647
3359
|
classified_elements = ["Template"] if template_only else []
|
3648
3360
|
body = {
|
3649
3361
|
"class": "FilterRequestBody",
|
3650
3362
|
"filter": type_name,
|
3651
|
-
"includeOnlyClassifiedElements": classified_elements
|
3363
|
+
"includeOnlyClassifiedElements": classified_elements,
|
3652
3364
|
}
|
3653
|
-
|
3654
|
-
|
3655
|
-
|
3365
|
+
response = await self._async_get_name_request(
|
3366
|
+
url,
|
3367
|
+
_type=self.TECH_TYPE_ENTITY_LABEL,
|
3368
|
+
_gen_output=self._generate_tech_type_output,
|
3369
|
+
filter_string=type_name,
|
3370
|
+
classification_names=classified_elements if template_only else None,
|
3371
|
+
start_from=0,
|
3372
|
+
page_size=0,
|
3373
|
+
output_format=output_format,
|
3374
|
+
output_format_set=output_format_set,
|
3375
|
+
body=body,
|
3376
|
+
)
|
3377
|
+
return response
|
3656
3378
|
|
3657
3379
|
def get_technology_type_detail(self, type_name: str, template_only: bool = False,
|
3658
|
-
body: dict | FilterRequestBody = None
|
3380
|
+
body: dict | FilterRequestBody = None,
|
3381
|
+
output_format: str = "JSON",
|
3382
|
+
output_format_set: str | dict = "TechType") -> list | str:
|
3659
3383
|
"""Retrieve the details of the named technology type. This name should be the name of the technology type
|
3660
3384
|
and contain no wild cards.
|
3661
3385
|
Parameters
|
@@ -3701,7 +3425,9 @@ class AutomatedCuration(Client2):
|
|
3701
3425
|
|
3702
3426
|
loop = asyncio.get_event_loop()
|
3703
3427
|
response = loop.run_until_complete(
|
3704
|
-
self._async_get_technology_type_detail(type_name, template_only=template_only, body=body
|
3428
|
+
self._async_get_technology_type_detail(type_name, template_only=template_only, body=body,
|
3429
|
+
output_format=output_format,
|
3430
|
+
output_format_set=output_format_set)
|
3705
3431
|
)
|
3706
3432
|
return response
|
3707
3433
|
|
@@ -3720,7 +3446,7 @@ class AutomatedCuration(Client2):
|
|
3720
3446
|
)
|
3721
3447
|
return response
|
3722
3448
|
|
3723
|
-
async def
|
3449
|
+
async def async_find_technology_types(
|
3724
3450
|
self,
|
3725
3451
|
search_string: str = "*",
|
3726
3452
|
start_from: int = 0,
|
@@ -3728,6 +3454,8 @@ class AutomatedCuration(Client2):
|
|
3728
3454
|
starts_with: bool = False,
|
3729
3455
|
ends_with: bool = False,
|
3730
3456
|
ignore_case: bool = True,
|
3457
|
+
output_format: str = "JSON",
|
3458
|
+
output_format_set: str | dict = "TechType"
|
3731
3459
|
) -> list | str:
|
3732
3460
|
"""Retrieve the list of technology types that contain the search string. Async version.
|
3733
3461
|
|
@@ -3765,10 +3493,6 @@ class AutomatedCuration(Client2):
|
|
3765
3493
|
For more information see: https://egeria-project.org/concepts/deployed-implementation-type
|
3766
3494
|
"""
|
3767
3495
|
|
3768
|
-
starts_with_s = str(starts_with).lower()
|
3769
|
-
ends_with_s = str(ends_with).lower()
|
3770
|
-
ignore_case_s = str(ignore_case).lower()
|
3771
|
-
validate_name(search_string)
|
3772
3496
|
if search_string == "*":
|
3773
3497
|
search_string = None
|
3774
3498
|
|
@@ -3790,7 +3514,17 @@ class AutomatedCuration(Client2):
|
|
3790
3514
|
}
|
3791
3515
|
|
3792
3516
|
response = await self._async_make_request("POST", url, body)
|
3793
|
-
|
3517
|
+
elements = response.json().get("elements", NO_ELEMENTS_FOUND)
|
3518
|
+
if type(elements) is str:
|
3519
|
+
logger.info(NO_ELEMENTS_FOUND)
|
3520
|
+
return NO_ELEMENTS_FOUND
|
3521
|
+
|
3522
|
+
if output_format.upper() != 'JSON': # return a simplified markdown representation
|
3523
|
+
# logger.info(f"Found elements, output format: {output_format} and output_format_set: {output_format_set}")
|
3524
|
+
return self._generate_tech_type_output(elements, search_string, "TechType",
|
3525
|
+
output_format, output_format_set)
|
3526
|
+
return elements
|
3527
|
+
|
3794
3528
|
|
3795
3529
|
def find_technology_types(
|
3796
3530
|
self,
|
@@ -3800,6 +3534,122 @@ class AutomatedCuration(Client2):
|
|
3800
3534
|
starts_with: bool = False,
|
3801
3535
|
ends_with: bool = False,
|
3802
3536
|
ignore_case: bool = True,
|
3537
|
+
output_format: str = "JSON",
|
3538
|
+
output_format_set: str | dict = "TechType",
|
3539
|
+
) -> list | str:
|
3540
|
+
"""Retrieve the list of technology types that contain the search string. Async version.
|
3541
|
+
|
3542
|
+
Parameters:
|
3543
|
+
----------
|
3544
|
+
type_name: str
|
3545
|
+
The technology type we are looking for.
|
3546
|
+
|
3547
|
+
Returns:
|
3548
|
+
-------
|
3549
|
+
[dict] | str: List of elements describing the technology - or "no tech found" if not found.
|
3550
|
+
|
3551
|
+
Raises:
|
3552
|
+
------
|
3553
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
3554
|
+
this exception is raised with details from the response content.
|
3555
|
+
PropertyServerException: If the API response indicates a server side error.
|
3556
|
+
UserNotAuthorizedException:
|
3557
|
+
|
3558
|
+
Notes
|
3559
|
+
-----
|
3560
|
+
For more information see: https://egeria-project.org/concepts/deployed-implementation-type
|
3561
|
+
"""
|
3562
|
+
|
3563
|
+
loop = asyncio.get_event_loop()
|
3564
|
+
response = loop.run_until_complete(
|
3565
|
+
self.async_find_technology_types(
|
3566
|
+
search_string,
|
3567
|
+
start_from,
|
3568
|
+
page_size,
|
3569
|
+
starts_with,
|
3570
|
+
ends_with,
|
3571
|
+
ignore_case,
|
3572
|
+
output_format,
|
3573
|
+
output_format_set
|
3574
|
+
)
|
3575
|
+
)
|
3576
|
+
return response
|
3577
|
+
|
3578
|
+
async def async_find_technology_types_body(
|
3579
|
+
self,
|
3580
|
+
search_string: str = "*",
|
3581
|
+
start_from: int = 0,
|
3582
|
+
page_size: int = 0,
|
3583
|
+
starts_with: bool = False,
|
3584
|
+
ends_with: bool = False,
|
3585
|
+
ignore_case: bool = True,
|
3586
|
+
output_format: str = "JSON",
|
3587
|
+
output_format_set: str | dict = "TechType",
|
3588
|
+
body: dict | SearchStringRequestBody = None
|
3589
|
+
) -> list | str:
|
3590
|
+
"""Retrieve the list of technology types that contain the search string. Async version.
|
3591
|
+
|
3592
|
+
Parameters:
|
3593
|
+
----------
|
3594
|
+
type_name: str
|
3595
|
+
The technology type we are looking for.
|
3596
|
+
starts_with : bool, optional
|
3597
|
+
Whether to search engine actions that start with the given search string. Default is False.
|
3598
|
+
|
3599
|
+
ends_with : bool, optional
|
3600
|
+
Whether to search engine actions that end with the given search string. Default is False.
|
3601
|
+
|
3602
|
+
ignore_case : bool, optional
|
3603
|
+
Whether to ignore case while searching engine actions. Default is True.
|
3604
|
+
|
3605
|
+
start_from : int, optional
|
3606
|
+
The index from which to start fetching the engine actions. Default is 0.
|
3607
|
+
|
3608
|
+
page_size : int, optional
|
3609
|
+
The maximum number of engine actions to fetch in a single request. Default is `0`.
|
3610
|
+
body: dict | SearchStringRequestBody, optional
|
3611
|
+
Full request body, if provided, overrides other parameters.
|
3612
|
+
|
3613
|
+
Returns:
|
3614
|
+
-------
|
3615
|
+
[dict] | str: List of elements describing the technology - or "no tech found" if not found.
|
3616
|
+
|
3617
|
+
Raises:
|
3618
|
+
------
|
3619
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
3620
|
+
this exception is raised with details from the response content.
|
3621
|
+
PropertyServerException: If the API response indicates a server side error.
|
3622
|
+
UserNotAuthorizedException:
|
3623
|
+
|
3624
|
+
Notes
|
3625
|
+
-----
|
3626
|
+
For more information see: https://egeria-project.org/concepts/deployed-implementation-type
|
3627
|
+
"""
|
3628
|
+
|
3629
|
+
if search_string == "*":
|
3630
|
+
search_string = None
|
3631
|
+
|
3632
|
+
url = str(HttpUrl(f"{self.curation_command_root}/technology-types/by-search-string"))
|
3633
|
+
response = await self._async_find_request(url, _type="TechType", search_string=search_string,
|
3634
|
+
_gen_output=self._generate_tech_type_output,
|
3635
|
+
classification_names=None,
|
3636
|
+
metadata_element_types='ValidMetadataValue',
|
3637
|
+
starts_with=starts_with, ends_with=ends_with, ignore_case=ignore_case,
|
3638
|
+
start_from=start_from, page_size=page_size,
|
3639
|
+
output_format=output_format, output_format_set=output_format_set,
|
3640
|
+
body=body)
|
3641
|
+
|
3642
|
+
return response
|
3643
|
+
|
3644
|
+
|
3645
|
+
def find_technology_types_body(
|
3646
|
+
self,
|
3647
|
+
search_string: str = "*",
|
3648
|
+
start_from: int = 0,
|
3649
|
+
page_size: int = 0,
|
3650
|
+
starts_with: bool = False,
|
3651
|
+
ends_with: bool = False,
|
3652
|
+
ignore_case: bool = True,
|
3803
3653
|
) -> list | str:
|
3804
3654
|
"""Retrieve the list of technology types that contain the search string. Async version.
|
3805
3655
|
|
@@ -3826,7 +3676,7 @@ class AutomatedCuration(Client2):
|
|
3826
3676
|
|
3827
3677
|
loop = asyncio.get_event_loop()
|
3828
3678
|
response = loop.run_until_complete(
|
3829
|
-
self.
|
3679
|
+
self.async_find_technology_types_body(
|
3830
3680
|
search_string,
|
3831
3681
|
start_from,
|
3832
3682
|
page_size,
|
@@ -3838,16 +3688,16 @@ class AutomatedCuration(Client2):
|
|
3838
3688
|
return response
|
3839
3689
|
|
3840
3690
|
async def _async_get_all_technology_types(
|
3841
|
-
self, start_from: int = 0, page_size: int = 0
|
3691
|
+
self, start_from: int = 0, page_size: int = 0, output_format: str = "JSON", output_format_set: str = "TechType"
|
3842
3692
|
) -> list | str:
|
3843
3693
|
"""Get all technology types - async version"""
|
3844
|
-
return await self._async_find_technology_types("*", start_from, page_size)
|
3694
|
+
return await self._async_find_technology_types("*", start_from, page_size, output_format, output_format_set)
|
3845
3695
|
|
3846
3696
|
def get_all_technology_types(
|
3847
|
-
self, start_from: int = 0, page_size: int = 0
|
3697
|
+
self, start_from: int = 0, page_size: int = 0, output_format: str = "JSON", output_format_set: str = "TechType"
|
3848
3698
|
) -> list | str:
|
3849
3699
|
"""Get all technology types"""
|
3850
|
-
return self.find_technology_types("*", start_from, page_size)
|
3700
|
+
return self.find_technology_types("*", start_from, page_size, output_format, output_format_set)
|
3851
3701
|
|
3852
3702
|
def print_engine_action_summary(self, governance_action: dict):
|
3853
3703
|
"""print_governance_action_summary
|
@@ -4014,6 +3864,5 @@ class AutomatedCuration(Client2):
|
|
4014
3864
|
return response
|
4015
3865
|
|
4016
3866
|
|
4017
|
-
|
4018
3867
|
if __name__ == "__main__":
|
4019
3868
|
print("Main-Automated Curation")
|