pyegeria 0.2.3__py3-none-any.whl → 0.3.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.
@@ -1,446 +0,0 @@
1
- """
2
- SPDX-License-Identifier: Apache-2.0
3
- Copyright Contributors to the ODPi Egeria project.
4
-
5
- Automated Curation
6
-
7
- """
8
-
9
- from requests import Response
10
-
11
- from pyegeria.exceptions import (
12
- InvalidParameterException,
13
- )
14
- from pyegeria import Platform
15
- import asyncio
16
-
17
- class AutomatedCuration(Platform):
18
- """
19
- Client to issue Curation requests.
20
-
21
- Attributes:
22
-
23
- platform_url : str
24
- URL of the server platform to connect to
25
- user_id : str
26
- The identity of the user calling the method - this sets a default optionally used by the methods
27
- when the user doesn't pass the user_id on a method call.
28
- user_pwd: str
29
- The password associated with the user_id. Defaults to None
30
- verify_flag: bool
31
- Flag to indicate if SSL Certificates should be verified in the HTTP requests.
32
- Defaults to False.
33
-
34
- Methods:
35
-
36
- """
37
-
38
-
39
- def __init__(
40
- self,
41
- server_name: str,
42
- platform_url: str,
43
- user_id: str,
44
- user_pwd: str = None,
45
- verify_flag: bool = False,
46
- ):
47
- Platform.__init__(self, server_name, platform_url, user_id, user_pwd, verify_flag)
48
- self.ops_command_root = (self.platform_url +
49
- "/open-metadata/server-operations/users/" +
50
- user_id)
51
- async def _async_create_gov_action_type(self, body: dict, server_name:str=None)-> None:
52
- pass
53
-
54
- async def _async_update_gov_action_type(self, gov_action_type_id: str, body: dict, server_name:str = None)-> None:
55
- pass
56
-
57
- async def _async_remove_gov_action_type(self, server_name:str=None)-> None:
58
- pass
59
-
60
- async def _async_find_gov_action_types(self, search_string: str='*', server_name:str=None)-> dict | str:
61
- pass
62
-
63
- async def _async_get_gov_action_types_by_name(self, server_name:str=None) -> dict | str:
64
- pass
65
-
66
- async def _async_find_gov_action_types_by_guid(self, guid: str, server_name:str=None) -> dict | str:
67
- pass
68
-
69
- # Governance Action Processes
70
-
71
- async def _async_create_gov_action_process(self, body: dict, server_name:str=None) -> None:
72
- pass
73
-
74
- async def _async_update_gov_action_process(self, process_id: str, body: dict, server_name:str=None) -> None:
75
- pass
76
-
77
- async def _async_publish_gov_action_process(self, process_id:str, server_name:str=None) -> None:
78
- pass
79
-
80
- async def _async_withdraw_gov_action_process(self, process_id:str, server_name:str=None) -> None:
81
- pass
82
-
83
- async def _async_remove_gov_action_process(self, process_id: str, server_name: str = None) -> None:
84
- pass
85
-
86
- async def _async_find_gov_action_processes(self, search_string:str, server_name:str=None) -> dict | str:
87
- pass
88
-
89
- async def _async_get_gov_action_processes_by_name(self, name:str, server_name:str=None) -> dict | str:
90
- pass
91
-
92
- async def _async_get_gov_action_processes_by_guid(self, guid:str, server_name:str=None) -> dict | str:
93
- pass
94
-
95
- async def _async_get_gov_action_process_graph(self, guid:str, server_name:str=None) -> dict | str:
96
- pass
97
-
98
- # Process Steps
99
- async def _async_create_gov_action_process_step(self, body: dict, server_name:str=None) -> None:
100
- pass
101
-
102
- async def _async_update_gov_action_process_step(self, guid: str, body: dict, server_name:str=None) -> None:
103
- pass
104
-
105
- async def _async_remove_gov_action_process_step(self, guid: str, server_name:str=None) -> None:
106
- pass
107
-
108
-
109
- async def _async_find_gov_action_process_step(self, search_string: str, server_name: str = None) -> dict | str:
110
- pass
111
-
112
-
113
- async def _async_get_gov_action_process_step_by_name(self, name: str, server_name: str = None) -> dict | str:
114
- pass
115
-
116
-
117
- async def _async_get_gov_action_process_step_by_guid(self, guid: str, server_name: str = None) -> dict | str:
118
- pass
119
-
120
-
121
- async def _async_setup_first_action_process_step(self, process_guid: str, process_step_guid:str,
122
- server_name: str = None) -> dict | str:
123
- pass
124
-
125
- async def _async_get_first_action_process_step(self, process_guid: str, server_name: str = None) -> dict | str:
126
- pass
127
-
128
- async def _async_remove_first_action_process_step(self, process_guid: str, server_name: str = None) -> None:
129
- pass
130
-
131
- async def _async_setup_next_action_process_step(self, process_guid: str, process_step_guid:str,
132
- next_process_step_guid:str, server_name: str = None) -> None:
133
- pass
134
-
135
-
136
- async def _async_update_next_action_process_step(self, guid: str, body: dict, server_name: str = None) -> None:
137
- pass
138
-
139
-
140
- async def _async_remove_next_action_process_step(self, guid: str, server_name: str = None) -> None:
141
- pass
142
-
143
-
144
- async def _async_get_next_action_process_step(self, guid: str, server_name: str = None) -> dict | str:
145
- pass
146
-
147
- # Engine Actions
148
-
149
- async def _async_initiate_Engine_action(self, gov_eng_name: str, body: dict, server_name: str = None) -> None:
150
- pass
151
-
152
-
153
- async def _async_initiate_gov_action_type(self, body: dict, server_name: str = None) -> None:
154
- pass
155
-
156
-
157
- async def _async_find_gov_action_process_step(self, search_string: str, server_name: str = None) -> dict | str:
158
- pass
159
-
160
-
161
- async def _async_get_gov_action_process_step_by_name(self, name: str, server_name: str = None) -> dict | str:
162
- pass
163
-
164
-
165
- async def _async_get_gov_action_process_step_by_guid(self, guid: str, server_name: str = None) -> dict | str:
166
- pass
167
-
168
-
169
- async def _async_get_active_configuration(self, server: str = None) -> dict | str:
170
- """
171
- Return the configuration of the server if it is running. Return invalidParameter Exception if not running.
172
-
173
- Parameters
174
- ----------
175
- server: str - name of the server to get the configuration for.
176
-
177
- Returns
178
- -------
179
- Returns configuration if server is active; InvalidParameter exception thrown otherwise
180
-
181
- """
182
- if server is None:
183
- server = self.server_name
184
-
185
- is_known = await self._async_is_server_known(server)
186
- if is_known is False:
187
- return "No active configuration found"
188
-
189
- url = self.ops_command_root + "/servers/" + server + "/instance/configuration"
190
-
191
- response = await self._async_make_request("GET", url)
192
- return response.json().get("omagserverConfig", "No active configuration found")
193
-
194
- def get_active_configuration(self, server: str = None) -> dict | str:
195
- """
196
- Return the configuration of the server if it is running. Return invalidParameter Exception if not running.
197
-
198
- Parameters
199
- ----------
200
- server: str - name of the server to get the configuration for.
201
-
202
- Returns
203
- -------
204
- Returns configuration if server is active; InvalidParameter exception thrown otherwise
205
-
206
- """
207
- loop = asyncio.get_event_loop()
208
- response = loop.run_until_complete(self._async_get_active_configuration(server))
209
- return response
210
-
211
-
212
-
213
-
214
- async def _async_add_archive_file(self, archive_file: str, server: str = None) -> None:
215
- """
216
- Load the server with the contents of the indicated archive file.
217
-
218
- Parameters
219
- ----------
220
- archive_file: the name of the archive file to load
221
- - note that the path is relative to the working directory of the platform.
222
- server : Use the server if specified. If None, use the default server associated with the Platform object.
223
-
224
- Returns
225
- -------
226
- Response object. Also throws exceptions if no viable server or endpoint errors
227
-
228
- """
229
- if server is None:
230
- server = self.server_name
231
-
232
- url = (
233
- self.ops_command_root
234
- + "/servers/" + server
235
- + "/instance/open-metadata-archives/file"
236
- )
237
-
238
- await self._async_make_request("POST-DATA", url, archive_file)
239
-
240
- def add_archive_file(self, archive_file: str, server: str = None) -> None:
241
- """
242
- Load the server with the contents of the indicated archive file.
243
-
244
- Parameters
245
- ----------
246
- archive_file: the name of the archive file to load
247
- - note that the path is relative to the working directory of the platform.
248
- server : Use the server if specified. If None, use the default server associated with the Platform object.
249
-
250
- Returns
251
- -------
252
- Response object. Also throws exceptions if no viable server or endpoint errors
253
-
254
- """
255
- loop = asyncio.get_event_loop()
256
- loop.run_until_complete(self._async_add_archive_file(archive_file, server))
257
-
258
- async def _async_add_archive(self, archive_connection: str, server: str = None) -> None:
259
- """ Load the server with the contents of the indicated archive file.
260
-
261
- /open-metadata/server-operations/users/{userId}/server-platform/servers/{serverName}/instance/open-metadata-archives/connection
262
-
263
- Parameters
264
- ----------
265
- archive_connection: str
266
- the name of the archive connection to load from
267
- server: str
268
- Use the server if specified. If None, use the default server associated with the Platform object.
269
-
270
- Returns
271
- -------
272
- Response object. Also throws exceptions if no viable server or endpoint errors
273
-
274
- Todo: Need to find a good example of an archive connection to test with
275
- """
276
- if server is None:
277
- server = self.server_name
278
-
279
- url = (
280
- self.ops_command_root
281
- + "/servers/" + server
282
- + "/instance/open-metadata-archives/connection"
283
- )
284
- await self._async_make_request("POST-DATA", url, archive_connection)
285
-
286
-
287
- def add_archive(self, archive_connection: str, server: str = None) -> None:
288
- """
289
- Load the server with the contents of the indicated archive file.
290
-
291
- /open-metadata/server-operations/users/{userId}/server-platform/servers/{serverName}/instance/open-metadata-archives/connection
292
-
293
- Parameters
294
- ----------
295
- archive_connection: str
296
- the name of the archive connection to load from
297
- server: str
298
- Use the server if specified. If None, use the default server associated with the Platform object.
299
-
300
- Returns
301
- -------
302
- Response object. Also throws exceptions if no viable server or endpoint errors
303
-
304
- """
305
- loop = asyncio.get_event_loop()
306
- loop.run_until_complete(self._async_add_archive_file(archive_connection,server))
307
-
308
- async def _async_get_active_server_status(self, server:str = None) -> dict:
309
- """ Get the status for the specified server.
310
-
311
- Parameters
312
- ----------
313
- server : Use the server if specified. If None, use the default server associated with the Platform object.
314
-
315
- Returns
316
- -------
317
- dict: a json object containing the status of the specified server
318
-
319
- Raises
320
- ------
321
- InvalidParameterException
322
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
323
- PropertyServerException
324
- Raised by the server when an issue arises in processing a valid request
325
- NotAuthorizedException
326
- The principle specified by the user_id does not have authorization for the requested action
327
- """
328
- if server is None:
329
- server = self.server_name
330
-
331
- url = self.admin_command_root + "/servers/" + server + "/instance/status"
332
-
333
- response = await self._async_make_request("GET", url)
334
- return response
335
-
336
- def get_active_server_status(self, server: str = None) -> dict:
337
- """
338
- Get the status for the specified server.
339
- /open-metadata/platform-services/users/{userId}/server-platform/servers/{server}/instance/status
340
-
341
- Parameters
342
- ----------
343
- server : Use the server if specified. If None, use the default server associated with the Platform object.
344
-
345
- Returns
346
- -------
347
- dict: a json object containing the status of the specified server
348
-
349
- Raises
350
- ------
351
- InvalidParameterException
352
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
353
- PropertyServerException
354
- Raised by the server when an issue arises in processing a valid request
355
- NotAuthorizedException
356
- The principle specified by the user_id does not have authorization for the requested action
357
- """
358
- loop = asyncio.get_event_loop()
359
- response = loop.run_until_complete(self._async_get_active_server_status(server))
360
- return response.json()
361
-
362
- async def _async_get_active_service_list_for_server(self, server: str = None) -> Response:
363
- """
364
- List all known active servers on the associated platform.
365
-
366
- /open-metadata/server-operations/users/{userId}/server-platform/servers/{server}/services
367
-
368
- Parameters
369
- ----------
370
- server : Use the server if specified. If None, use the default server associated with the Platform object.
371
-
372
- Returns
373
- -------
374
- Response object. Also throws exceptions if no viable endpoint or errors
375
-
376
- """
377
- if server is None:
378
- server = self.server_name
379
-
380
- url = self.ops_command_root + "/servers/" + server + "/services"
381
- response = await self._async_make_request("GET", url)
382
- return response.json().get("serverServicesList")
383
-
384
- def get_active_service_list_for_server(self, server: str = None) -> Response:
385
- """
386
- List all known active servers on the associated platform.
387
-
388
- /open-metadata/server-operations/users/{userId}/server-platform/servers/{server}/services
389
-
390
- Parameters
391
- ----------
392
- server : Use the server if specified. If None, use the default server associated with the Platform object.
393
-
394
- Returns
395
- -------
396
- Response object. Also throws exceptions if no viable endpoint or errors
397
-
398
- """
399
- loop = asyncio.get_event_loop()
400
- response = loop.run_until_complete(self._async_get_active_service_list_for_server(server))
401
- return response
402
-
403
- async def _async_get_governance_engine_summaries(self, server: str = None) -> dict:
404
- """ Get Governance Engine Summaries. Async version.
405
- Parameters
406
- ----------
407
- server : str, optional
408
- The name of the server to get governance engine summaries from. If not provided, the default server name will be used.
409
-
410
- Returns
411
- -------
412
- Response
413
- The response object containing the governance engine summaries.
414
-
415
- """
416
- if server is None:
417
- server = self.server_name
418
-
419
- url = (f"{self.platform_url}/servers/{server}/open-metadata/engine-host/users/{self.user_id}"
420
- f"/governance-engines/summary")
421
- response = await self._async_make_request("GET", url)
422
- return response.json().get("governanceEngineSummaries")
423
-
424
- def get_governance_engine_summaries(self, server: str = None) -> dict:
425
- """Get Governance Engine Summaries.
426
- Parameters
427
- ----------
428
- server : str, optional
429
- The name of the server to get governance engine summaries from. If not provided, the default server name will be used.
430
-
431
- Returns
432
- -------
433
- Response
434
- The response object containing the governance engine summaries.
435
-
436
- """
437
- loop = asyncio.get_event_loop()
438
- response = loop.run_until_complete(self._async_get_governance_engine_summaries(server))
439
- return response
440
-
441
-
442
- if __name__ == "__main__":
443
- p = AutomatedCuration("meow", "https://127.0.0.1:9443", "garygeeke", verify_flag=False)
444
- response = p.get_active_service_list_for_server()
445
- out = response.json()["result"]
446
- print(out)
pyegeria/config.toml DELETED
@@ -1,11 +0,0 @@
1
-
2
- # SPDX-License-Identifier: Apache-2.0
3
- # Copyright Contributors to the ODPi Egeria project.
4
-
5
- # config.toml for connected_asset_client_base
6
-
7
- [egeria_platform]
8
- url = "https://localhost:9443"
9
-
10
- [config]
11
- isDebug = false