pyegeria 5.3.5.1__py3-none-any.whl → 5.3.5.2__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.
@@ -16,11 +16,7 @@ import time
16
16
  from datetime import datetime
17
17
 
18
18
  import click
19
- from rich import box
20
- from rich.console import Console
21
- from rich.prompt import Prompt
22
- from rich.table import Table
23
- from rich.text import Text
19
+
24
20
 
25
21
  from pyegeria import EgeriaTech, body_slimmer
26
22
  from pyegeria._exceptions import (
@@ -264,9 +260,9 @@ def delete_term(server, url, userid, password, timeout, term_guid):
264
260
  m_client.close_session()
265
261
 
266
262
 
267
- @click.command("import-terms")
263
+ @click.command("import-terms-from-csv")
268
264
  @click.option("--glossary_name", help="Name of Glossary", required=True)
269
- @click.option("--file_name", help="Path of CSV file", required=True)
265
+ @click.option("--file_name", help="Name of CSV file", required=True)
270
266
  @click.option(
271
267
  "--file_path", help="Path of CSV file", default=EGERIA_GLOSSARY_PATH, required=False
272
268
  )
@@ -289,7 +285,7 @@ def delete_term(server, url, userid, password, timeout, term_guid):
289
285
  @click.option("--userid", default=EGERIA_USER, help="Egeria user")
290
286
  @click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
291
287
  @click.option("--timeout", default=60, help="Number of seconds to wait")
292
- def import_terms(
288
+ def import_terms_csv(
293
289
  glossary_name: str,
294
290
  file_path: str,
295
291
  file_name: str,
@@ -305,7 +301,7 @@ def import_terms(
305
301
  m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
306
302
  token = m_client.create_egeria_bearer_token()
307
303
  try:
308
- result = m_client.load_terms_from_file(
304
+ result = m_client.load_terms_from_csv_file(
309
305
  glossary_name,
310
306
  file_name,
311
307
  file_path=file_path,
@@ -325,13 +321,13 @@ def import_terms(
325
321
  m_client.close_session()
326
322
 
327
323
 
328
- @click.command("export-terms")
324
+ @click.command("export-terms-csv")
329
325
  @click.option(
330
326
  "--glossary_guid",
331
327
  help="GUID of Glossary to export",
332
328
  required=True,
333
329
  )
334
- @click.option("--file_name", help="Path of CSV file", required=True)
330
+ @click.option("--file_name", help="Name of CSV file", required=True)
335
331
  @click.option(
336
332
  "--file_path", help="Path of CSV file", default=EGERIA_GLOSSARY_PATH, required=False
337
333
  )
@@ -342,7 +338,7 @@ def import_terms(
342
338
  @click.option("--userid", default=EGERIA_USER, help="Egeria user")
343
339
  @click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
344
340
  @click.option("--timeout", default=60, help="Number of seconds to wait")
345
- def export_terms(
341
+ def export_terms_csv(
346
342
  glossary_guid: str, file_name, file_path, server, url, userid, password, timeout
347
343
  ):
348
344
  """Export the glossary specified"""
@@ -359,3 +355,107 @@ def export_terms(
359
355
  print_exception_response(e)
360
356
  finally:
361
357
  m_client.close_session()
358
+
359
+
360
+ @click.command("create-category")
361
+ @click.option("--name", help="Name of glossary Category", required=True)
362
+ @click.option("--glossary_name", help="Glossary name", required=True)
363
+ @click.option(
364
+ "--description",
365
+ help="Description of Category",
366
+ default="A description goes here",
367
+ )
368
+ @click.option(
369
+ "--is_root",
370
+ help="Is this a root category?",
371
+ default=False,
372
+ is_flag=True,
373
+ )
374
+ @click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use.")
375
+ @click.option(
376
+ "--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to"
377
+ )
378
+ @click.option("--userid", default=EGERIA_USER, help="Egeria user")
379
+ @click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
380
+ @click.option("--timeout", default=60, help="Number of seconds to wait")
381
+ def create_category(
382
+ server: str,
383
+ url: str,
384
+ userid: str,
385
+ password: str,
386
+ timeout: int,
387
+ name: str,
388
+ glossary_name: str,
389
+ description: str,
390
+ is_root: bool,
391
+ ) -> None:
392
+ """Create a new Glossary Category"""
393
+
394
+ try:
395
+ m_client = EgeriaTech(server, url, userid, password)
396
+ token = m_client.create_egeria_bearer_token()
397
+
398
+ existing_glossary = m_client.find_glossaries(glossary_name)
399
+ if type(existing_glossary) is str:
400
+ click.echo(existing_glossary)
401
+ sys.exit(0)
402
+ if type(existing_glossary) is list and len(existing_glossary) == 1:
403
+ q_name = existing_glossary["glossaryProperties"]["qualifiedName"]
404
+ glossary_guid = existing_glossary["elementHeader"]["guid"]
405
+ category_guid = m_client.create_category(glossary_guid,name,description, is_root)
406
+ print(f"New categry \'{name}\' created with id of \'{category_guid}\'")
407
+
408
+ except (InvalidParameterException, PropertyServerException) as e:
409
+ print_exception_response(e)
410
+ finally:
411
+ m_client.close_session()
412
+
413
+
414
+ @click.command("update-category")
415
+ @click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use")
416
+ @click.option(
417
+ "--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to"
418
+ )
419
+ @click.option("--userid", default=EGERIA_USER, help="Egeria user")
420
+ @click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
421
+ @click.option("--timeout", default=60, help="Number of seconds to wait")
422
+ @click.argument("category-guid")
423
+ @click.option("--name", help="Name of glossary Category", required=True)
424
+ @click.option("--glossary_name", help="Glossary name", required=True)
425
+ @click.option("--description", help="Description of Category", default="A description goes here")
426
+ def update_category(category_guid, name, description, server, url, userid, password, timeout, ):
427
+ """Delete the glossary specified"""
428
+ m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
429
+ token = m_client.create_egeria_bearer_token()
430
+ try:
431
+ m_client.update_category(category_guid, name, description)
432
+
433
+ click.echo(f"Updated glossary: {category_guid}")
434
+
435
+ except (InvalidParameterException, PropertyServerException) as e:
436
+ print_exception_response(e)
437
+ finally:
438
+ m_client.close_session()
439
+
440
+ @click.command("delete-category")
441
+ @click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use")
442
+ @click.option(
443
+ "--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to"
444
+ )
445
+ @click.option("--userid", default=EGERIA_USER, help="Egeria user")
446
+ @click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
447
+ @click.option("--timeout", default=60, help="Number of seconds to wait")
448
+ @click.argument("category-guid")
449
+ def delete_category(server, url, userid, password, timeout, category_guid):
450
+ """Delete the glossary specified"""
451
+ m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
452
+ token = m_client.create_egeria_bearer_token()
453
+ try:
454
+ m_client.delete_category(category_guid)
455
+
456
+ click.echo(f"Deleted glossary: {category_guid}")
457
+
458
+ except (InvalidParameterException, PropertyServerException) as e:
459
+ print_exception_response(e)
460
+ finally:
461
+ m_client.close_session()
@@ -25,8 +25,8 @@ from pyegeria.commands.cat.glossary_actions import (
25
25
  create_term,
26
26
  delete_glossary,
27
27
  delete_term,
28
- export_terms,
29
- import_terms,
28
+ export_terms_csv,
29
+ import_terms_csv,
30
30
  )
31
31
  from pyegeria.commands.cat.list_assets import display_assets
32
32
  from pyegeria.commands.cat.list_cert_types import display_certifications
@@ -1399,8 +1399,8 @@ tell_glossary.add_command(create_glossary)
1399
1399
  tell_glossary.add_command(delete_glossary)
1400
1400
  tell_glossary.add_command(delete_term)
1401
1401
  tell_glossary.add_command(create_term)
1402
- tell_glossary.add_command(import_terms)
1403
- tell_glossary.add_command(export_terms)
1402
+ tell_glossary.add_command(import_terms_csv)
1403
+ tell_glossary.add_command(export_terms_csv)
1404
1404
 
1405
1405
 
1406
1406
  @tell_cat.group("todo")
@@ -24,8 +24,8 @@ from pyegeria.commands.cat.glossary_actions import (
24
24
  create_term,
25
25
  delete_glossary,
26
26
  delete_term,
27
- export_terms,
28
- import_terms,
27
+ export_terms_csv,
28
+ import_terms_csv,
29
29
  )
30
30
  from pyegeria.commands.cat.list_assets import display_assets
31
31
  from pyegeria.commands.cat.list_cert_types import display_certifications
@@ -609,8 +609,8 @@ def tell_glossary(ctx):
609
609
  tell_glossary.add_command(create_glossary)
610
610
  tell_glossary.add_command(delete_glossary)
611
611
  tell_glossary.add_command(create_term)
612
- tell_glossary.add_command(import_terms)
613
- tell_glossary.add_command(export_terms)
612
+ tell_glossary.add_command(import_terms_csv)
613
+ tell_glossary.add_command(export_terms_csv)
614
614
  tell_glossary.add_command(delete_term)
615
615
 
616
616
 
@@ -10,7 +10,7 @@ added in subsequent versions of the glossary_omvs module.
10
10
  import asyncio
11
11
  from datetime import datetime
12
12
 
13
- from pyegeria import NO_GLOSSARIES_FOUND
13
+ from pyegeria import NO_GLOSSARIES_FOUND, NO_CATEGORIES_FOUND
14
14
  # import json
15
15
  from pyegeria._client import Client
16
16
  from pyegeria._validators import validate_guid, validate_name, validate_search_string
@@ -713,7 +713,7 @@ class GlossaryBrowser(Client):
713
713
  )
714
714
 
715
715
  response = await self._async_make_request("POST", url, body)
716
- return response.json().get("elementList", "No Categories found")
716
+ return response.json().get("elementList", NO_CATEGORIES_FOUND)
717
717
 
718
718
  def find_glossary_categories(
719
719
  self,