pyegeria 0.7.45.1__py3-none-any.whl → 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- examples/widgets/cat/list_cert_types.py +61 -43
- examples/widgets/cat/list_projects.py +1 -1
- examples/widgets/my/my_profile_actions.py +51 -32
- examples/widgets/ops/engine_actions.py +35 -23
- examples/widgets/ops/integration_daemon_actions.py +51 -32
- examples/widgets/tech/get_element_info.py +63 -38
- examples/widgets/tech/get_guid_info.py +50 -27
- examples/widgets/tech/list_asset_types.py +33 -23
- examples/widgets/tech/list_elements.py +44 -34
- examples/widgets/tech/list_elements_x.py +69 -49
- examples/widgets/tech/list_registered_services.py +44 -24
- examples/widgets/tech/list_related_specification.py +70 -45
- examples/widgets/tech/list_relationship_types.py +50 -31
- examples/widgets/tech/list_valid_metadata_values.py +57 -28
- examples/widgets/tech/x_list_related_elements.py +54 -34
- pyegeria/Xloaded_resources_omvs.py +43 -41
- pyegeria/__init__.py +5 -1
- pyegeria/_client.py +142 -102
- pyegeria/_deprecated_gov_engine.py +218 -167
- pyegeria/action_author_omvs.py +107 -88
- pyegeria/asset_catalog_omvs.py +467 -395
- pyegeria/automated_curation_omvs.py +2 -2
- pyegeria/classification_manager_omvs.py +3 -9
- pyegeria/collection_manager_omvs.py +1957 -1519
- pyegeria/core_omag_server_config.py +310 -192
- pyegeria/egeria_cat_client.py +88 -0
- pyegeria/egeria_config_client.py +37 -0
- pyegeria/egeria_my_client.py +47 -0
- pyegeria/egeria_ops_client.py +67 -0
- pyegeria/egeria_tech_client.py +77 -0
- pyegeria/feedback_manager_omvs.py +633 -631
- pyegeria/full_omag_server_config.py +330 -158
- pyegeria/glossary_browser_omvs.py +927 -474
- pyegeria/glossary_manager_omvs.py +1033 -543
- pyegeria/my_profile_omvs.py +714 -574
- pyegeria/platform_services.py +228 -176
- pyegeria/project_manager_omvs.py +1158 -903
- pyegeria/registered_info.py +76 -74
- pyegeria/runtime_manager_omvs.py +749 -670
- pyegeria/server_operations.py +123 -85
- pyegeria/valid_metadata_omvs.py +268 -168
- {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/METADATA +1 -1
- {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/RECORD +46 -42
- pyegeria/tech_guids_31-08-2024 14:33.py +0 -79
- {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/LICENSE +0 -0
- {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/WHEEL +0 -0
- {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/entry_points.txt +0 -0
pyegeria/asset_catalog_omvs.py
CHANGED
@@ -21,7 +21,7 @@ from ._validators import validate_search_string
|
|
21
21
|
|
22
22
|
|
23
23
|
class AssetCatalog(Client):
|
24
|
-
"""
|
24
|
+
"""Set up and maintain automation services in Egeria.
|
25
25
|
|
26
26
|
Attributes:
|
27
27
|
server_name : str
|
@@ -37,60 +37,63 @@ class AssetCatalog(Client):
|
|
37
37
|
"""
|
38
38
|
|
39
39
|
def __init__(
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
self,
|
41
|
+
server_name: str,
|
42
|
+
platform_url: str,
|
43
|
+
user_id: str,
|
44
|
+
user_pwd: str = None,
|
45
|
+
token: str = None,
|
45
46
|
):
|
46
|
-
Client.__init__(self, server_name, platform_url, user_id, user_pwd)
|
47
|
+
Client.__init__(self, server_name, platform_url, user_id, user_pwd, token=token)
|
47
48
|
self.cur_command_root = f"{platform_url}/servers/"
|
48
49
|
|
49
|
-
async def _async_create_element_from_template(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
50
|
+
async def _async_create_element_from_template(
|
51
|
+
self, body: dict, server: str = None
|
52
|
+
) -> str:
|
53
|
+
"""Create a new metadata element from a template. Async version.
|
54
|
+
Parameters
|
55
|
+
----------
|
56
|
+
body : str
|
57
|
+
The json body used to instantiate the template.
|
58
|
+
server : str, optional
|
59
|
+
The name of the view server to use. If not provided, the default server name will be used.
|
60
|
+
|
61
|
+
Returns
|
62
|
+
-------
|
63
|
+
Response
|
64
|
+
The guid of the resulting element
|
65
|
+
|
66
|
+
Raises
|
67
|
+
------
|
68
|
+
InvalidParameterException
|
69
|
+
PropertyServerException
|
70
|
+
UserNotAuthorizedException
|
71
|
+
|
72
|
+
Notes
|
73
|
+
-----
|
74
|
+
See also: https://egeria-project.org/features/templated-cataloguing/overview/
|
75
|
+
The full description of the body is shown below:
|
76
|
+
{
|
77
|
+
"typeName" : "",
|
78
|
+
"initialStatus" : "",
|
79
|
+
"initialClassifications" : "",
|
80
|
+
"anchorGUID" : "",
|
81
|
+
"isOwnAnchor" : "",
|
82
|
+
"effectiveFrom" : "",
|
83
|
+
"effectiveTo" : "",
|
84
|
+
"templateGUID" : "",
|
85
|
+
"templateProperties" : {},
|
86
|
+
"placeholderPropertyValues" : {
|
87
|
+
"placeholderPropertyName1" : "placeholderPropertyValue1",
|
88
|
+
"placeholderPropertyName2" : "placeholderPropertyValue2"
|
89
|
+
},
|
90
|
+
"parentGUID" : "",
|
91
|
+
"parentRelationshipTypeName" : "",
|
92
|
+
"parentRelationshipProperties" : "",
|
93
|
+
"parentAtEnd1" : "",
|
94
|
+
"effectiveTime" : ""
|
95
|
+
}
|
96
|
+
"""
|
94
97
|
|
95
98
|
server = self.server_name if server is None else server
|
96
99
|
|
@@ -99,49 +102,49 @@ class AssetCatalog(Client):
|
|
99
102
|
return response.json().get("guid", "GUID failed to be returned")
|
100
103
|
|
101
104
|
def create_element_from_template(self, body: dict, server: str = None) -> str:
|
102
|
-
"""
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
105
|
+
"""Create a new metadata element from a template. Async version.
|
106
|
+
Parameters
|
107
|
+
----------
|
108
|
+
body : str
|
109
|
+
The json body used to instantiate the template.
|
110
|
+
server : str, optional
|
111
|
+
The name of the view server to use. If not provided, the default server name will be used.
|
112
|
+
|
113
|
+
Returns
|
114
|
+
-------
|
115
|
+
Response
|
116
|
+
The guid of the resulting element
|
117
|
+
|
118
|
+
Raises
|
119
|
+
------
|
120
|
+
InvalidParameterException
|
121
|
+
PropertyServerException
|
122
|
+
UserNotAuthorizedException
|
123
|
+
|
124
|
+
Notes
|
125
|
+
-----
|
126
|
+
See also: https://egeria-project.org/features/templated-cataloguing/overview/
|
127
|
+
The full description of the body is shown below:
|
128
|
+
{
|
129
|
+
"typeName" : "",
|
130
|
+
"initialStatus" : "",
|
131
|
+
"initialClassifications" : "",
|
132
|
+
"anchorGUID" : "",
|
133
|
+
"isOwnAnchor" : "",
|
134
|
+
"effectiveFrom" : "",
|
135
|
+
"effectiveTo" : "",
|
136
|
+
"templateGUID" : "",
|
137
|
+
"templateProperties" : {},
|
138
|
+
"placeholderPropertyValues" : {
|
139
|
+
"placeholderPropertyName1" : "placeholderPropertyValue1",
|
140
|
+
"placeholderPropertyName2" : "placeholderPropertyValue2"
|
141
|
+
},
|
142
|
+
"parentGUID" : "",
|
143
|
+
"parentRelationshipTypeName" : "",
|
144
|
+
"parentRelationshipProperties" : "",
|
145
|
+
"parentAtEnd1" : "",
|
146
|
+
"effectiveTime" : ""
|
147
|
+
}
|
145
148
|
"""
|
146
149
|
loop = asyncio.get_event_loop()
|
147
150
|
response = loop.run_until_complete(
|
@@ -149,147 +152,166 @@ class AssetCatalog(Client):
|
|
149
152
|
)
|
150
153
|
return response
|
151
154
|
|
152
|
-
async def _async_create_kafka_server_element_from_template(
|
153
|
-
|
154
|
-
|
155
|
+
async def _async_create_kafka_server_element_from_template(
|
156
|
+
self, kafka_server: str, host_name: str, port: str, server: str = None
|
157
|
+
) -> str:
|
158
|
+
"""Create a Kafka server element from a template. Async version.
|
155
159
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
+
Parameters
|
161
|
+
----------
|
162
|
+
kafka_server : str
|
163
|
+
The name of the Kafka server.
|
160
164
|
|
161
|
-
|
162
|
-
|
165
|
+
host_name : str
|
166
|
+
The host name of the Kafka server.
|
163
167
|
|
164
|
-
|
165
|
-
|
168
|
+
port : str
|
169
|
+
The port number of the Kafka server.
|
166
170
|
|
167
|
-
|
168
|
-
|
171
|
+
server : str, optional
|
172
|
+
The name of the view server to use. Default uses the client instance.
|
169
173
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
+
Returns
|
175
|
+
-------
|
176
|
+
str
|
177
|
+
The GUID of the Kafka server element.
|
174
178
|
"""
|
175
179
|
|
176
180
|
body = {
|
177
|
-
"templateGUID": TEMPLATE_GUIDS[
|
178
|
-
"isOwnAnchor":
|
181
|
+
"templateGUID": TEMPLATE_GUIDS["Apache Kafka Server"],
|
182
|
+
"isOwnAnchor": "true",
|
179
183
|
"placeholderPropertyValues": {
|
180
184
|
"serverName": kafka_server,
|
181
185
|
"hostIdentifier": host_name,
|
182
|
-
"portNumber": port
|
183
|
-
}
|
186
|
+
"portNumber": port,
|
187
|
+
},
|
184
188
|
}
|
185
189
|
response = await self._async_create_element_from_template(body, server)
|
186
190
|
return response
|
187
191
|
|
188
|
-
def create_kafka_server_element_from_template(
|
189
|
-
|
190
|
-
|
192
|
+
def create_kafka_server_element_from_template(
|
193
|
+
self, kafka_server: str, host_name: str, port: str, server: str = None
|
194
|
+
) -> str:
|
195
|
+
"""Create a Kafka server element from a template.
|
191
196
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
197
|
+
Parameters
|
198
|
+
----------
|
199
|
+
kafka_server : str
|
200
|
+
The name of the Kafka server.
|
196
201
|
|
197
|
-
|
198
|
-
|
202
|
+
host_name : str
|
203
|
+
The host name of the Kafka server.
|
199
204
|
|
200
|
-
|
201
|
-
|
205
|
+
port : str
|
206
|
+
The port number of the Kafka server.
|
202
207
|
|
203
|
-
|
204
|
-
|
208
|
+
server : str, optional
|
209
|
+
The name of the view server to use. Default uses the client instance.
|
205
210
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
+
Returns
|
212
|
+
-------
|
213
|
+
str
|
214
|
+
The GUID of the Kafka server element.
|
215
|
+
"""
|
211
216
|
loop = asyncio.get_event_loop()
|
212
217
|
response = loop.run_until_complete(
|
213
|
-
self._async_create_kafka_server_element_from_template(
|
218
|
+
self._async_create_kafka_server_element_from_template(
|
219
|
+
kafka_server, host_name, port, server
|
220
|
+
)
|
214
221
|
)
|
215
222
|
return response
|
216
223
|
|
217
|
-
async def _async_create_postgres_server_element_from_template(
|
218
|
-
|
219
|
-
|
224
|
+
async def _async_create_postgres_server_element_from_template(
|
225
|
+
self,
|
226
|
+
postgres_server: str,
|
227
|
+
host_name: str,
|
228
|
+
port: str,
|
229
|
+
db_user: str,
|
230
|
+
db_pwd: str,
|
231
|
+
server: str = None,
|
232
|
+
) -> str:
|
233
|
+
"""Create a Postgres server element from a template. Async version.
|
220
234
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
235
|
+
Parameters
|
236
|
+
----------
|
237
|
+
postgres_server : str
|
238
|
+
The name of the Postgres server.
|
225
239
|
|
226
|
-
|
227
|
-
|
240
|
+
host_name : str
|
241
|
+
The host name of the Postgres server.
|
228
242
|
|
229
|
-
|
230
|
-
|
243
|
+
port : str
|
244
|
+
The port number of the Postgres server.
|
231
245
|
|
232
|
-
|
233
|
-
|
246
|
+
db_user: str
|
247
|
+
User name to connect to the database
|
234
248
|
|
235
|
-
|
236
|
-
|
249
|
+
db_pwd: str
|
250
|
+
User password to connect to the database
|
237
251
|
|
238
|
-
|
239
|
-
|
252
|
+
server : str, optional
|
253
|
+
The name of the view server to use. Default uses the client instance.
|
240
254
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
255
|
+
Returns
|
256
|
+
-------
|
257
|
+
str
|
258
|
+
The GUID of the Kafka server element.
|
245
259
|
"""
|
246
260
|
body = {
|
247
|
-
"templateGUID": TEMPLATE_GUIDS[
|
248
|
-
"isOwnAnchor":
|
261
|
+
"templateGUID": TEMPLATE_GUIDS["PostgreSQL Server"],
|
262
|
+
"isOwnAnchor": "true",
|
249
263
|
"placeholderPropertyValues": {
|
250
264
|
"serverName": postgres_server,
|
251
265
|
"hostIdentifier": host_name,
|
252
266
|
"portNumber": port,
|
253
267
|
"databaseUserId": db_user,
|
254
|
-
"databasePassword": db_pwd
|
255
|
-
}
|
268
|
+
"databasePassword": db_pwd,
|
269
|
+
},
|
256
270
|
}
|
257
271
|
response = await self._async_create_element_from_template(body, server)
|
258
272
|
return response
|
259
273
|
|
260
|
-
def create_postgres_server_element_from_template(
|
261
|
-
|
262
|
-
|
274
|
+
def create_postgres_server_element_from_template(
|
275
|
+
self,
|
276
|
+
postgres_server: str,
|
277
|
+
host_name: str,
|
278
|
+
port: str,
|
279
|
+
db_user: str,
|
280
|
+
db_pwd: str,
|
281
|
+
server: str = None,
|
282
|
+
) -> str:
|
283
|
+
"""Create a Postgres server element from a template.
|
263
284
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
285
|
+
Parameters
|
286
|
+
----------
|
287
|
+
postgres_server : str
|
288
|
+
The name of the Postgres server.
|
268
289
|
|
269
|
-
|
270
|
-
|
290
|
+
host_name : str
|
291
|
+
The host name of the Postgres server.
|
271
292
|
|
272
|
-
|
273
|
-
|
293
|
+
port : str
|
294
|
+
The port number of the Postgres server.
|
274
295
|
|
275
|
-
|
276
|
-
|
296
|
+
server : str, optional
|
297
|
+
The name of the view server to use. Default uses the client instance.
|
277
298
|
|
278
|
-
|
279
|
-
|
299
|
+
db_user: str
|
300
|
+
User name to connect to the database
|
280
301
|
|
281
|
-
|
282
|
-
|
302
|
+
db_pwd: str
|
303
|
+
User password to connect to the database
|
283
304
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
305
|
+
Returns
|
306
|
+
-------
|
307
|
+
str
|
308
|
+
The GUID of the Postgres server element.
|
309
|
+
"""
|
289
310
|
loop = asyncio.get_event_loop()
|
290
311
|
response = loop.run_until_complete(
|
291
|
-
self._async_create_postgres_server_element_from_template(
|
292
|
-
|
312
|
+
self._async_create_postgres_server_element_from_template(
|
313
|
+
postgres_server, host_name, port, db_user, db_pwd, server
|
314
|
+
)
|
293
315
|
)
|
294
316
|
return response
|
295
317
|
|
@@ -297,11 +319,18 @@ class AssetCatalog(Client):
|
|
297
319
|
# Engine Actions
|
298
320
|
#
|
299
321
|
|
300
|
-
async def _async_find_assets_in_domain(
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
322
|
+
async def _async_find_assets_in_domain(
|
323
|
+
self,
|
324
|
+
search_string: str,
|
325
|
+
start_from: int = 0,
|
326
|
+
page_size: int = max_paging_size,
|
327
|
+
starts_with: bool = True,
|
328
|
+
ends_with: bool = False,
|
329
|
+
ignore_case: bool = True,
|
330
|
+
server: str = None,
|
331
|
+
time_out: int = 60,
|
332
|
+
) -> list | str:
|
333
|
+
"""Retrieve the list of engine action metadata elements that contain the search string. Async Version.
|
305
334
|
Parameters
|
306
335
|
----------
|
307
336
|
search_string : str
|
@@ -349,21 +378,27 @@ class AssetCatalog(Client):
|
|
349
378
|
ends_with_s = str(ends_with).lower()
|
350
379
|
ignore_case_s = str(ignore_case).lower()
|
351
380
|
|
352
|
-
url = (
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
}
|
381
|
+
url = (
|
382
|
+
f"{self.platform_url}/servers/{server}/api/open-metadata/asset-catalog/assets/in-domain/"
|
383
|
+
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
384
|
+
f"endWith={ends_with_s}&ignoreCase={ignore_case_s}"
|
385
|
+
)
|
386
|
+
body = {"filter": search_string}
|
359
387
|
response = await self._async_make_request("POST", url, body, time_out=time_out)
|
360
388
|
return response.json().get("searchMatches", "no assets found")
|
361
389
|
|
362
|
-
def find_assets_in_domain(
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
390
|
+
def find_assets_in_domain(
|
391
|
+
self,
|
392
|
+
search_string: str,
|
393
|
+
start_from: int = 0,
|
394
|
+
page_size: int = max_paging_size,
|
395
|
+
starts_with: bool = True,
|
396
|
+
ends_with: bool = False,
|
397
|
+
ignore_case: bool = True,
|
398
|
+
server: str = None,
|
399
|
+
time_out: int = 60,
|
400
|
+
) -> list | str:
|
401
|
+
"""Retrieve the list of engine action metadata elements that contain the search string. Async Version.
|
367
402
|
Parameters
|
368
403
|
----------
|
369
404
|
search_string : str
|
@@ -405,79 +440,99 @@ class AssetCatalog(Client):
|
|
405
440
|
"""
|
406
441
|
loop = asyncio.get_event_loop()
|
407
442
|
response = loop.run_until_complete(
|
408
|
-
self._async_find_assets_in_domain(
|
409
|
-
|
443
|
+
self._async_find_assets_in_domain(
|
444
|
+
search_string,
|
445
|
+
start_from,
|
446
|
+
page_size,
|
447
|
+
starts_with,
|
448
|
+
ends_with,
|
449
|
+
ignore_case,
|
450
|
+
server,
|
451
|
+
time_out,
|
452
|
+
)
|
410
453
|
)
|
411
454
|
return response
|
412
455
|
|
413
|
-
async def _async_get_asset_graph(
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
456
|
+
async def _async_get_asset_graph(
|
457
|
+
self,
|
458
|
+
asset_guid: str,
|
459
|
+
server: str = None,
|
460
|
+
start_from: int = 0,
|
461
|
+
page_size: int = max_paging_size,
|
462
|
+
) -> str | dict:
|
463
|
+
"""Return all the elements that are anchored to an asset plus relationships between these elements and to
|
464
|
+
other elements. Async Version.
|
465
|
+
Parameters
|
466
|
+
----------
|
467
|
+
asset_guid : str
|
468
|
+
The unique identity of the asset to get the graph for.
|
469
|
+
|
470
|
+
server : str, optional
|
471
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
472
|
+
|
473
|
+
start_from : int, optional
|
474
|
+
The index from which to start fetching the engine actions. Default is 0.
|
475
|
+
|
476
|
+
page_size : int, optional
|
477
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
478
|
+
|
479
|
+
Returns
|
480
|
+
-------
|
481
|
+
dict or str
|
482
|
+
A dictionary of the asset graph.
|
483
|
+
|
484
|
+
Raises:
|
485
|
+
------
|
486
|
+
InvalidParameterException
|
487
|
+
PropertyServerException
|
488
|
+
UserNotAuthorizedException
|
435
489
|
|
436
|
-
|
437
|
-
------
|
438
|
-
InvalidParameterException
|
439
|
-
PropertyServerException
|
440
|
-
UserNotAuthorizedException
|
441
|
-
|
442
|
-
"""
|
490
|
+
"""
|
443
491
|
server = self.server_name if server is None else server
|
444
492
|
|
445
|
-
url = (
|
446
|
-
|
493
|
+
url = (
|
494
|
+
f"{self.platform_url}/servers/{server}/api/open-metadata/asset-catalog/assets/{asset_guid}/"
|
495
|
+
f"as-graph?startFrom={start_from}&pageSize={page_size}"
|
496
|
+
)
|
447
497
|
|
448
498
|
response = await self._async_make_request("GET", url)
|
449
499
|
return response.json().get("assetGraph", "no asset found")
|
450
500
|
|
451
|
-
def get_asset_graph(
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
501
|
+
def get_asset_graph(
|
502
|
+
self,
|
503
|
+
asset_guid: str,
|
504
|
+
server: str = None,
|
505
|
+
start_from: int = 0,
|
506
|
+
page_size: int = max_paging_size,
|
507
|
+
) -> str | dict:
|
508
|
+
"""Return all the elements that are anchored to an asset plus relationships between these elements and to
|
509
|
+
other elements.
|
510
|
+
Parameters
|
511
|
+
----------
|
512
|
+
asset_guid : str
|
513
|
+
The unique identity of the asset to get the graph for.
|
514
|
+
|
515
|
+
server : str, optional
|
516
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
517
|
+
|
518
|
+
start_from : int, optional
|
519
|
+
The index from which to start fetching the engine actions. Default is 0.
|
520
|
+
|
521
|
+
page_size : int, optional
|
522
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
523
|
+
|
524
|
+
Returns
|
525
|
+
-------
|
526
|
+
dict or str
|
527
|
+
A dictionary of the asset graph.
|
528
|
+
|
529
|
+
Raises:
|
530
|
+
------
|
531
|
+
InvalidParameterException
|
532
|
+
PropertyServerException
|
533
|
+
UserNotAuthorizedException
|
465
534
|
|
466
|
-
|
467
|
-
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
468
|
-
|
469
|
-
Returns
|
470
|
-
-------
|
471
|
-
dict or str
|
472
|
-
A dictionary of the asset graph.
|
473
|
-
|
474
|
-
Raises:
|
475
|
-
------
|
476
|
-
InvalidParameterException
|
477
|
-
PropertyServerException
|
478
|
-
UserNotAuthorizedException
|
479
|
-
|
480
|
-
"""
|
535
|
+
"""
|
481
536
|
|
482
537
|
loop = asyncio.get_event_loop()
|
483
538
|
response = loop.run_until_complete(
|
@@ -485,183 +540,200 @@ class AssetCatalog(Client):
|
|
485
540
|
)
|
486
541
|
return response
|
487
542
|
|
488
|
-
async def _async_get_assets_by_metadata_collection_id(
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
543
|
+
async def _async_get_assets_by_metadata_collection_id(
|
544
|
+
self,
|
545
|
+
metadata_collection_id: str,
|
546
|
+
type_name: str = None,
|
547
|
+
effective_time: str = None,
|
548
|
+
server: str = None,
|
549
|
+
start_from: int = 0,
|
550
|
+
page_size: int = max_paging_size,
|
551
|
+
) -> str | list:
|
552
|
+
"""Return a list of assets that come from the requested metadata collection. Can optionally
|
553
|
+
specify an type name as a filter and an effective time. Async Version.
|
554
|
+
|
555
|
+
Parameters
|
556
|
+
----------
|
557
|
+
metadata_collection_id : str
|
558
|
+
The unique identity of the metadata collection to return assets from.
|
559
|
+
|
560
|
+
type_name: str, optional
|
561
|
+
An asset type to optionally filter on. If not specified, all assets in the collection will be returned.
|
562
|
+
|
563
|
+
effective_time: str, optional
|
564
|
+
The effective time to filter on. If not specified, the current time is used.
|
565
|
+
|
566
|
+
server : str, optional
|
567
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
508
568
|
|
509
|
-
|
510
|
-
|
569
|
+
start_from : int, optional
|
570
|
+
The index from which to start fetching the engine actions. Default is 0.
|
511
571
|
|
512
|
-
|
513
|
-
|
572
|
+
page_size : int, optional
|
573
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
514
574
|
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
575
|
+
Returns
|
576
|
+
-------
|
577
|
+
list or str
|
578
|
+
A list of assets in a [dict].
|
519
579
|
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
580
|
+
Raises:
|
581
|
+
------
|
582
|
+
InvalidParameterException
|
583
|
+
PropertyServerException
|
584
|
+
UserNotAuthorizedException
|
525
585
|
|
526
|
-
|
586
|
+
"""
|
527
587
|
server = self.server_name if server is None else server
|
528
588
|
|
529
|
-
url = (
|
530
|
-
|
589
|
+
url = (
|
590
|
+
f"{self.platform_url}/servers/{server}/api/open-metadata/asset-catalog/assets/by-metadata-collection-id/"
|
591
|
+
f"{metadata_collection_id}?startFrom={start_from}&pageSize={page_size}"
|
592
|
+
)
|
531
593
|
|
532
|
-
body = {
|
533
|
-
"filter": type_name,
|
534
|
-
"effectiveTime": effective_time
|
535
|
-
}
|
594
|
+
body = {"filter": type_name, "effectiveTime": effective_time}
|
536
595
|
body_s = body_slimmer(body)
|
537
596
|
print(json.dumps(body_s))
|
538
597
|
response = await self._async_make_request("POST", url, body_s)
|
539
598
|
return response.json().get("assets", "no assets found")
|
540
599
|
|
541
|
-
def get_assets_by_metadata_collection_id(
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
600
|
+
def get_assets_by_metadata_collection_id(
|
601
|
+
self,
|
602
|
+
metadata_collection_id: str,
|
603
|
+
type_name: str = None,
|
604
|
+
effective_time: str = None,
|
605
|
+
server: str = None,
|
606
|
+
start_from: int = 0,
|
607
|
+
page_size: int = max_paging_size,
|
608
|
+
) -> str | list:
|
609
|
+
"""Return a list of assets that come from the requested metadata collection. Can optionally
|
610
|
+
specify an type name as a filter and an effective time. Async Version.
|
611
|
+
|
612
|
+
Parameters
|
613
|
+
----------
|
614
|
+
metadata_collection_id : str
|
615
|
+
The unique identity of the metadata collection to return assets from.
|
616
|
+
|
617
|
+
type_name: str, optional
|
618
|
+
An asset type to optionally filter on. If not specified, all assets in the collection will be returned.
|
619
|
+
|
620
|
+
effective_time: str, optional
|
621
|
+
The effective time to filter on. If not specified, the current time is used.
|
622
|
+
|
623
|
+
server : str, optional
|
624
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
561
625
|
|
562
|
-
|
563
|
-
|
626
|
+
start_from : int, optional
|
627
|
+
The index from which to start fetching the engine actions. Default is 0.
|
564
628
|
|
565
|
-
|
566
|
-
|
629
|
+
page_size : int, optional
|
630
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
567
631
|
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
632
|
+
Returns
|
633
|
+
-------
|
634
|
+
list or str
|
635
|
+
A list of assets in a [dict].
|
572
636
|
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
637
|
+
Raises:
|
638
|
+
------
|
639
|
+
InvalidParameterException
|
640
|
+
PropertyServerException
|
641
|
+
UserNotAuthorizedException
|
578
642
|
|
579
|
-
|
643
|
+
"""
|
580
644
|
|
581
645
|
loop = asyncio.get_event_loop()
|
582
646
|
response = loop.run_until_complete(
|
583
|
-
self._async_get_assets_by_metadata_collection_id(
|
584
|
-
|
585
|
-
|
647
|
+
self._async_get_assets_by_metadata_collection_id(
|
648
|
+
metadata_collection_id,
|
649
|
+
type_name,
|
650
|
+
effective_time,
|
651
|
+
server,
|
652
|
+
start_from,
|
653
|
+
page_size,
|
654
|
+
)
|
586
655
|
)
|
587
656
|
return response
|
588
657
|
|
589
658
|
async def _async_get_asset_catalog_types(self, server: str = None) -> str | dict:
|
590
|
-
"""
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
659
|
+
"""Return all the elements that are anchored to an asset plus relationships between these elements and to
|
660
|
+
other elements. Async Version.
|
661
|
+
Parameters
|
662
|
+
----------
|
663
|
+
asset_guid : str
|
664
|
+
The unique identity of the asset to get the graph for.
|
665
|
+
|
666
|
+
server : str, optional
|
667
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
668
|
+
|
669
|
+
start_from : int, optional
|
670
|
+
The index from which to start fetching the engine actions. Default is 0.
|
671
|
+
|
672
|
+
page_size : int, optional
|
673
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
674
|
+
|
675
|
+
Returns
|
676
|
+
-------
|
677
|
+
dict or str
|
678
|
+
A dictionary of the asset graph.
|
679
|
+
|
680
|
+
Raises:
|
681
|
+
------
|
682
|
+
InvalidParameterException
|
683
|
+
PropertyServerException
|
684
|
+
UserNotAuthorizedException
|
685
|
+
|
686
|
+
"""
|
618
687
|
server = self.server_name if server is None else server
|
619
688
|
|
620
689
|
url = f"{self.platform_url}/servers/{server}/api/open-metadata/asset-catalog/assets/types"
|
621
690
|
|
622
691
|
response = await self._async_make_request("GET", url)
|
623
692
|
|
624
|
-
return response.json().get(
|
693
|
+
return response.json().get("types", "No assets found")
|
625
694
|
|
626
695
|
def get_asset_catalog_types(self, server: str = None) -> str | dict:
|
627
|
-
"""
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
696
|
+
"""Return all the elements that are anchored to an asset plus relationships between these elements and to
|
697
|
+
other elements.
|
698
|
+
Parameters
|
699
|
+
----------
|
700
|
+
asset_guid : str
|
701
|
+
The unique identity of the asset to get the graph for.
|
633
702
|
|
634
|
-
|
635
|
-
|
703
|
+
server : str, optional
|
704
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
636
705
|
|
637
|
-
|
638
|
-
|
706
|
+
start_from : int, optional
|
707
|
+
The index from which to start fetching the engine actions. Default is 0.
|
639
708
|
|
640
|
-
|
641
|
-
|
709
|
+
page_size : int, optional
|
710
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
642
711
|
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
712
|
+
Returns
|
713
|
+
-------
|
714
|
+
dict or str
|
715
|
+
A dictionary of the asset graph.
|
647
716
|
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
717
|
+
Raises:
|
718
|
+
------
|
719
|
+
InvalidParameterException
|
720
|
+
PropertyServerException
|
721
|
+
UserNotAuthorizedException
|
653
722
|
|
654
|
-
|
723
|
+
"""
|
655
724
|
|
656
725
|
loop = asyncio.get_event_loop()
|
657
|
-
response = loop.run_until_complete(
|
658
|
-
self._async_get_asset_catalog_types(server)
|
659
|
-
)
|
726
|
+
response = loop.run_until_complete(self._async_get_asset_catalog_types(server))
|
660
727
|
return response
|
661
728
|
|
662
729
|
|
663
730
|
if __name__ == "__main__":
|
664
|
-
p = AssetCatalog(
|
731
|
+
p = AssetCatalog(
|
732
|
+
"active-metadata-store",
|
733
|
+
"https://127.0.0.1:9443",
|
734
|
+
"garygeeke",
|
735
|
+
verify_flag=False,
|
736
|
+
)
|
665
737
|
response = p.get_assets_by_metadata_collection_id()
|
666
738
|
out = response.json()
|
667
739
|
print(out)
|