pyegeria 0.7.5__py3-none-any.whl → 0.7.7__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.
@@ -50,7 +50,8 @@ from examples.widgets.tech.list_registered_services import display_registered_sv
50
50
  from examples.widgets.tech.list_relationship_types import display_relationship_types
51
51
  from examples.widgets.tech.list_tech_templates import display_templates_spec
52
52
  from examples.widgets.tech.list_valid_metadata_values import display_metadata_values
53
-
53
+ from examples.widgets.tech.get_element_info import display_elements
54
+ from examples.widgets.tech.list_elements import list_elements
54
55
 
55
56
  @tui()
56
57
  # @tui('menu', 'menu', 'A textual command line interface')
@@ -195,6 +196,25 @@ def show(ctx):
195
196
  """Display an Egeria Object"""
196
197
  pass
197
198
 
199
+ @show.command("get-element-info")
200
+ @click.pass_context
201
+ @click.option('--om_type', default='Project', help='Metadata type to query')
202
+ def get_element_info(ctx, om_type):
203
+ """Display the valid metadata values for a property and type"""
204
+ c = ctx.obj
205
+ display_elements(om_type, c.view_server, c.view_server_url,
206
+ c.userid, c.password, c.jupyter, c.width)
207
+
208
+ @show.command("list-elements")
209
+ @click.pass_context
210
+ @click.option('--om_type', default='Project', help='Metadata type to query')
211
+ def get_element_info(ctx, om_type):
212
+ """Display the valid metadata values for a property and type"""
213
+ c = ctx.obj
214
+ list_elements(om_type, c.view_server, c.view_server_url,
215
+ c.userid, c.password, c.jupyter, c.width)
216
+
217
+
198
218
 
199
219
  @show.command('guid-info')
200
220
  @click.argument('guid', nargs=1)
@@ -22,6 +22,9 @@ from examples.widgets.tech.list_relationship_types import display_relationship_t
22
22
  from examples.widgets.tech.list_tech_templates import display_templates_spec
23
23
  from examples.widgets.tech.list_valid_metadata_values import display_metadata_values
24
24
  from examples.widgets.cat.get_tech_type_template import template_viewer
25
+ from examples.widgets.tech.get_element_info import display_elements
26
+ from examples.widgets.tech.list_elements import list_elements
27
+
25
28
 
26
29
 
27
30
  # from pyegeria import ServerOps
@@ -204,6 +207,25 @@ def valid_metadata_values(ctx, property, type_name):
204
207
  display_metadata_values(property, type_name, c.view_server, c.view_server_url,
205
208
  c.userid, c.password, False, c.jupyter, c.width)
206
209
 
210
+ @show.command("get-element-info")
211
+ @click.pass_context
212
+ @click.option('--om_type', default='Project', help='Metadata type to query')
213
+ def get_element_info(ctx, om_type):
214
+ """Display the valid metadata values for a property and type"""
215
+ c = ctx.obj
216
+ display_elements(om_type, c.view_server, c.view_server_url,
217
+ c.userid, c.password, c.jupyter, c.width)
218
+
219
+ @show.command("list-elements")
220
+ @click.pass_context
221
+ @click.option('--om_type', default='Project', help='Metadata type to query')
222
+ def get_element_info(ctx, om_type):
223
+ """Display the valid metadata values for a property and type"""
224
+ c = ctx.obj
225
+ list_elements(om_type, c.view_server, c.view_server_url,
226
+ c.userid, c.password, c.jupyter, c.width)
227
+
228
+
207
229
 
208
230
  #
209
231
  # Tell
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SPDX-Lic
4
+ ense-Identifier: Apache-2.0
5
+ Copyright Contributors to the ODPi Egeria project.
6
+
7
+ Unit tests for the Utils helper functions using the Pytest framework.
8
+
9
+
10
+ A simple display for glossary terms
11
+ """
12
+ import argparse
13
+ import json
14
+ import os
15
+ import sys
16
+
17
+ from rich import print, box
18
+ from rich.console import Console
19
+ from rich.markdown import Markdown
20
+ from rich.panel import Panel
21
+
22
+ from rich.prompt import Prompt
23
+ from rich.text import Text
24
+ from rich.tree import Tree
25
+
26
+ from pyegeria import (
27
+ InvalidParameterException,
28
+ PropertyServerException,
29
+ UserNotAuthorizedException,
30
+ Client, ClassificationManager
31
+ )
32
+
33
+
34
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
35
+ EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
36
+ EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
37
+ EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
38
+ EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
39
+ EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
40
+ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
41
+ EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
42
+ EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
43
+ EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
44
+ EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
45
+ EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
46
+
47
+
48
+ def display_elements(om_type: str, server: str, url: str, username: str, user_password: str,
49
+ jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH
50
+ ):
51
+ c = ClassificationManager(server, url, user_id=username, user_pwd=user_password)
52
+
53
+ bearer_token = c.create_egeria_bearer_token(username, user_password)
54
+
55
+ try:
56
+ console = Console(width=width, force_terminal=not jupyter, style="bold white on black")
57
+ r = c.get_elements(om_type)
58
+ if type(r) is not list:
59
+ print(f"\n\n\tno elements found: {r}")
60
+ sys.exit(1)
61
+
62
+ tree = Tree(f"Elements for Open Metadata Type:{om_type}\n* There are {len(r)} elements", style="bold bright_white on black",
63
+ guide_style="bold bright_blue")
64
+ t = tree.add(f"Elements for {om_type}", style="bold bright_white on black")
65
+ for element in r:
66
+ header = element['elementHeader']
67
+ el_type = header["type"]['typeName']
68
+ el_home = header['origin']['homeMetadataCollectionName']
69
+ el_create_time = header['versions']['createTime']
70
+ el_guid = header['guid']
71
+
72
+ el_md = (f"#### Element Basics\n"
73
+ f"* **Type**: {el_type}\n"
74
+ f"* **Home**: {el_home}\n"
75
+ f"* **Created**: {el_create_time}\n"
76
+ f"* **GUID**: {el_guid}\n ---\n")
77
+ for prop in element['properties'].keys():
78
+ el_md += f"* **{prop}**: {element['properties'][prop]}\n"
79
+
80
+ el_out = Markdown(el_md)
81
+ p = Panel.fit(el_out, title=element['properties']['qualifiedName'],
82
+ style = "bold white on black")
83
+ t = tree.add(p)
84
+
85
+ print(tree)
86
+
87
+ c.close_session()
88
+
89
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
90
+ if type(e) is str:
91
+ console.print_exception()
92
+ else:
93
+ # console.print_exception(show_locals=True)
94
+ console.print(f"\n ===> Looks like the type {om_type} isn't known...\n")
95
+
96
+
97
+
98
+ def main():
99
+ parser = argparse.ArgumentParser()
100
+ parser.add_argument("--server", help="Name of the server to display status for")
101
+ parser.add_argument("--url", help="URL Platform to connect to")
102
+ parser.add_argument("--userid", help="User Id")
103
+ parser.add_argument("--password", help="User Password")
104
+
105
+ # parser.add_argument("--sponsor", help="Name of sponsor to search")
106
+ args = parser.parse_args()
107
+
108
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
109
+ url = args.url if args.url is not None else EGERIA_VIEW_SERVER_URL
110
+ userid = args.userid if args.userid is not None else EGERIA_USER
111
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
112
+
113
+ try:
114
+ om_type = Prompt.ask("Enter the Open Metadata Type to find Elements for", default=None)
115
+ display_elements(om_type, server, url, userid, user_pass)
116
+ except (KeyboardInterrupt):
117
+ pass
118
+
119
+
120
+ if __name__ == "__main__":
121
+ main()
@@ -0,0 +1,127 @@
1
+ """This creates a templates guid file from the core metadata archive"""
2
+ from rich.markdown import Markdown
3
+ from rich.prompt import Prompt
4
+ import os
5
+ import argparse
6
+ import time
7
+ import sys
8
+ from rich import box
9
+ from rich.console import Console
10
+ from rich.table import Table
11
+
12
+ from pyegeria import (
13
+ InvalidParameterException,
14
+ PropertyServerException,
15
+ UserNotAuthorizedException,
16
+ print_exception_response,
17
+ ClassificationManager
18
+ )
19
+
20
+
21
+ console = Console()
22
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
23
+ EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
24
+ EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
25
+ EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
26
+ EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
27
+ EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
28
+ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
29
+ EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
30
+ EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
31
+ EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
32
+ EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
33
+ EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
34
+
35
+
36
+
37
+ def list_elements(om_type:str, server: str,
38
+ url: str, username: str, password: str, jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH
39
+ ):
40
+
41
+ c_client = ClassificationManager(server, url, user_id=username, user_pwd=password)
42
+ token = c_client.create_egeria_bearer_token()
43
+ elements = c_client.get_elements(om_type)
44
+
45
+ def generate_table() -> Table:
46
+ """Make a new table."""
47
+ table = Table(
48
+ caption=f"Metadata Elements for: {url} - {server} @ {time.asctime()}",
49
+ style="bold bright_white on black",
50
+ row_styles=["bold bright_white on black"],
51
+ header_style="white on dark_blue",
52
+ title_style="bold bright_white on black",
53
+ caption_style="white on black",
54
+ show_lines=True,
55
+ box=box.ROUNDED,
56
+ title=f"Elements for Open Metadata Type: '{om_type}' ",
57
+ expand=True,
58
+ # width=500
59
+ )
60
+
61
+ table.add_column("Qualified Name")
62
+ table.add_column("Created")
63
+ table.add_column("Home Store")
64
+ table.add_column("GUID", width = 38,no_wrap=True)
65
+ table.add_column("Properties")
66
+
67
+
68
+ if type(elements) is list:
69
+ for element in elements:
70
+ header = element['elementHeader']
71
+ el_q_name = element['properties']['qualifiedName']
72
+ el_type = header["type"]['typeName']
73
+ el_home = header['origin']['homeMetadataCollectionName']
74
+ el_create_time = header['versions']['createTime'][:-10]
75
+ el_guid = header['guid']
76
+
77
+ el_props_md = ""
78
+ for prop in element['properties'].keys():
79
+ el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
80
+
81
+ el_props_out = Markdown(el_props_md)
82
+ table.add_row(el_q_name, el_create_time, el_home, el_guid, el_props_out)
83
+
84
+ return table
85
+ else:
86
+ print("Unknown Open Metadata type")
87
+ sys.exit(1)
88
+
89
+ try:
90
+ console = Console(width=width, force_terminal=not jupyter)
91
+
92
+ with console.pager(styles=True):
93
+ console.print(generate_table())
94
+
95
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
96
+ print_exception_response(e)
97
+ assert e.related_http_code != "200", "Invalid parameters"
98
+ finally:
99
+ c_client.close_session()
100
+
101
+
102
+ def main():
103
+ parser = argparse.ArgumentParser()
104
+ parser.add_argument("--server", help="Name of the server to display status for")
105
+ parser.add_argument("--url", help="URL Platform to connect to")
106
+ parser.add_argument("--userid", help="User Id")
107
+ parser.add_argument("--password", help="Password")
108
+
109
+ args = parser.parse_args()
110
+
111
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
112
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
113
+ userid = args.userid if args.userid is not None else EGERIA_USER
114
+ password = args.password if args.password is not None else EGERIA_USER_PASSWORD
115
+
116
+ try:
117
+ om_type = Prompt.ask("Enter the Open Metadata Type to find elements of:", default="GlossaryTerm")
118
+ list_elements(om_type, server, url, userid, password)
119
+ except(KeyboardInterrupt):
120
+ pass
121
+
122
+
123
+ if __name__ == "__main__":
124
+ main()
125
+
126
+
127
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.7.5
3
+ Version: 0.7.7
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -14,11 +14,11 @@ examples/widgets/cat/list_projects.py,sha256=jP6HoVqGi-w4R1itgdAW1zamPLsgkvjvh8r
14
14
  examples/widgets/cat/list_tech_types.py,sha256=20T4v6L5qeebSsaL1nGkFMDAIsy2W3A3SMm1RcgFoh0,4609
15
15
  examples/widgets/cat/list_todos.py,sha256=wD9HevGcc4G_bxV25VUz1rRssdZHE33mF5zmJ6Lprt8,5522
16
16
  examples/widgets/cli/__init__.py,sha256=6d_R0KZBNnJy9EBz9J2xvGFlx-3j_ZPqPCxKgdvYeDQ,291
17
- examples/widgets/cli/egeria.py,sha256=Uh_OUMmh223H9c5wNjUtM3lNZP1m9oVRApolCtlSq6s,22879
17
+ examples/widgets/cli/egeria.py,sha256=WGq_GZbOQMLvY_Oi_aox6iN049qdfr6Yw80gvjfQD9Y,23777
18
18
  examples/widgets/cli/egeria_cat.py,sha256=f9KxOPAEFbeEtSAdk_czcBDLqCKsHkrpdiBuDDo-iUw,10301
19
19
  examples/widgets/cli/egeria_my.py,sha256=xi2j1hzNnjDruJeR1qa8K9JPDgzaL_COsMkcieT4Vo8,5653
20
20
  examples/widgets/cli/egeria_ops.py,sha256=ZOIQdpRZ5VgL282OpjNVmXvxxmmVxnOaEGF0sNIpzF0,10011
21
- examples/widgets/cli/egeria_tech.py,sha256=C7eooVyjHTYwA-aEEaeqJgDgJRdmiK0M3dca70bNZYQ,8901
21
+ examples/widgets/cli/egeria_tech.py,sha256=xcDvd7TcpOKsLxDYOvSq3FWiK6_slO3oAnwDvyvPkGE,9801
22
22
  examples/widgets/cli/ops_config.py,sha256=m4AfPjf-fR4EBTx8Dc2mcgrfWwAxb30YGeV-v79bg4U,1450
23
23
  examples/widgets/my/README.md,sha256=ZheFhj_VoPMhcWjW3pGchHB0vH_A9PklSmrSkzKdrcQ,844
24
24
  examples/widgets/my/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -45,9 +45,11 @@ examples/widgets/ops/refresh_integration_daemon.py,sha256=QDB3dpAlLY8PhrGhAZG4tW
45
45
  examples/widgets/ops/restart_integration_daemon.py,sha256=fID7qGFL5RD6rfn9PgXf5kwI4MU0Ho_IGXnDVbKT5nU,2710
46
46
  examples/widgets/tech/README.md,sha256=nxDnfr3BCiGgW5G1VxWxiwUWJXIe5wreNuUeRyIt_hY,1343
47
47
  examples/widgets/tech/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
+ examples/widgets/tech/get_element_info.py,sha256=zhgnsCRuw-rWwo4QVrVfzwfFqksj21QglSMJxY064Kw,4620
48
49
  examples/widgets/tech/get_guid_info.py,sha256=p-peTX1Mahi8fNmcNVHOVI3OjqjlJwZjv7gRdBI4l0Q,4137
49
50
  examples/widgets/tech/get_tech_details.py,sha256=b7i3kSTaZ2pZPcxkDccqY27bqeHJoYnPCxOvlKPH0hw,5753
50
51
  examples/widgets/tech/list_asset_types.py,sha256=PHPtCXqCHhIw0K59hUvoKdybp6IKPt_9Wc0AJVDtdrg,4181
52
+ examples/widgets/tech/list_elements.py,sha256=OsxovF9igZy57PsqYZE7nYfJyI2YGvLtipSQuKW_fx8,4697
51
53
  examples/widgets/tech/list_registered_services.py,sha256=TqZbT54vMGvHUAX_bovCce3A3eV_RbjSEtPP6u6ZJV0,6388
52
54
  examples/widgets/tech/list_relationship_types.py,sha256=0T8Sl7J3WFq_0IQLLzcL0T79pUxVENWNT95Cpjz2ukc,5633
53
55
  examples/widgets/tech/list_tech_templates.py,sha256=RiyA8a4fIL9BGeGf37Bkk471mK5ECkDJMN9QVNReC1M,6192
@@ -78,8 +80,8 @@ pyegeria/runtime_manager_omvs.py,sha256=oSVFeG_yBGXIvQR0EClLZqTZ6C5z5ReZzwm8cce8
78
80
  pyegeria/server_operations.py,sha256=1z2wZLdrNZG6HlswY_Eh8qI1mlcjsQ59zO-AMy9XbUU,16605
79
81
  pyegeria/utils.py,sha256=pkVmS3RrbjaS9yz7FtOCwaOfV5FMqz-__Rt5koCnd9c,5374
80
82
  pyegeria/valid_metadata_omvs.py,sha256=aisdRodIwJSkyArAzfm_sEnBELh69xE8k4Nea-vHu8M,36745
81
- pyegeria-0.7.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
82
- pyegeria-0.7.5.dist-info/METADATA,sha256=TWtu7bswf5h0sWUuoIddepQPSEhhxtHc7Lgc_Z-Xxp0,2774
83
- pyegeria-0.7.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
84
- pyegeria-0.7.5.dist-info/entry_points.txt,sha256=tgDYOGHc_YWRsrz0kyvouqOTdrHgiITKzF3GLVV-GvQ,2727
85
- pyegeria-0.7.5.dist-info/RECORD,,
83
+ pyegeria-0.7.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
84
+ pyegeria-0.7.7.dist-info/METADATA,sha256=SIG-wWB13mXFRst7fWJbhZfOmb6O5wNB7VF5t5-DEQs,2774
85
+ pyegeria-0.7.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
86
+ pyegeria-0.7.7.dist-info/entry_points.txt,sha256=UJ9j8ILCKryCUhbEIktWwLvJf0Isbuvpxv4TExaHJiA,2859
87
+ pyegeria-0.7.7.dist-info/RECORD,,
@@ -1,20 +1,22 @@
1
1
  [console_scripts]
2
- egeria_cat=examples.widgets.cli.egeria_cat:cli
3
- egeria_ops=examples.widgets.cli.egeria_ops:cli
4
- egeria_per=examples.widgets.cli.egeria_per:cli
5
- egeria_tech=examples.widgets.cli.egeria_cat:cli
6
2
  get_asset_graph=examples.widgets.cat.get_asset_graph:main
7
3
  get_collection=examples.widgets.cat.get_collection:main
4
+ get_element_info=examples.widgets.tech.get_element_info:main
8
5
  get_guid_info=examples.widgets.tech.get_guid_info:main
9
6
  get_project_structure=examples.widgets.cat.get_project_structure:main
10
7
  get_tech_details=examples.widgets.tech.get_tech_details:main
11
8
  get_tech_type_elements=examples.widgets.cat.get_tech_type_elements:main
12
9
  get_tech_type_template=examples.widgets.cat.get_tech_type_template:main
13
10
  hey_egeria=examples.widgets.cli.egeria:cli
11
+ hey_egeria_cat=examples.widgets.cli.egeria_cat:cli
12
+ hey_egeria_ops=examples.widgets.cli.egeria_ops:cli
13
+ hey_egeria_per=examples.widgets.cli.egeria_per:cli
14
+ hey_egeria_tech=examples.widgets.cli.egeria_cat:cli
14
15
  list_asset_types=examples.widgets.tech.list_asset_types:main
15
16
  list_assets=examples.widgets.cat.list_assets:main
16
17
  list_catalog_targets=examples.widgets.ops.list_catalog_targets:main
17
18
  list_cert_types=examples.widgets.cat.list_cert_types:main
19
+ list_elements=examples.widgets.tech.list_elements:main
18
20
  list_engine_activity=examples.widgets.ops.monitor_engine_activity:main_paging
19
21
  list_glossary=examples.widgets.cat.list_glossary:main
20
22
  list_gov_eng_status=examples.widgets.ops.monitor_gov_eng_status:main_paging