pyegeria 0.7.22__py3-none-any.whl → 0.7.24__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.
@@ -120,11 +120,10 @@ def change_todo_status(server, url, userid, password, timeout, todo_guid, new_st
120
120
  try:
121
121
 
122
122
  body = {
123
- "properties": {
124
123
  "class": "ToDoProperties",
125
124
  "toDoStatus": new_status
126
- },
127
125
  }
126
+
128
127
  m_client.update_to_do(todo_guid, body, is_merge_update=True)
129
128
 
130
129
  click.echo(f"Marked todo item {todo_guid} as complete.")
@@ -148,12 +147,11 @@ def mark_todo_complete(server, url, userid, password, timeout, todo_guid):
148
147
  m_client = MyProfile(server, url, user_id=userid, user_pwd=password)
149
148
  token = m_client.create_egeria_bearer_token()
150
149
  body = {
151
- "properties": {
152
150
  "class": "ToDoProperties",
153
151
  "completionTime": time.asctime(),
154
152
  "toDoStatus": "COMPLETE"
155
- },
156
153
  }
154
+
157
155
  m_client.update_to_do(todo_guid, body, is_merge_update=True)
158
156
 
159
157
  click.echo(f"Marked todo item {todo_guid} as complete.")
@@ -95,7 +95,7 @@ def list_elements(om_type:str, server: str,
95
95
 
96
96
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
97
97
  print_exception_response(e)
98
- print("Perhaps the type name isn't known")
98
+ print("\n\nPerhaps the type name isn't known")
99
99
  finally:
100
100
  c_client.close_session()
101
101
 
@@ -0,0 +1,164 @@
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, FeedbackManager
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_x(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
+ f_client = FeedbackManager(server, url, user_id=username, user_pwd=password, token=token)
44
+
45
+ elements = c_client.get_elements(om_type)
46
+
47
+ def generate_table() -> Table:
48
+ """Make a new table."""
49
+ table = Table(
50
+ caption=f"Metadata Elements for: {url} - {server} @ {time.asctime()}",
51
+ style="bold bright_white on black",
52
+ row_styles=["bold bright_white on black"],
53
+ header_style="white on dark_blue",
54
+ title_style="bold bright_white on black",
55
+ caption_style="white on black",
56
+ show_lines=True,
57
+ box=box.ROUNDED,
58
+ title=f"Elements for Open Metadata Type: '{om_type}' ",
59
+ expand=True,
60
+ width=width
61
+ )
62
+
63
+ table.add_column("Qualified Name")
64
+ table.add_column("Type")
65
+ table.add_column("Created")
66
+ table.add_column("Home Store")
67
+ table.add_column("GUID", width = 38,no_wrap=True)
68
+ table.add_column("Properties")
69
+ table.add_column('Feedback', min_width=30)
70
+ table.add_column('Public Comments')
71
+
72
+
73
+ if type(elements) is list:
74
+ for element in elements:
75
+ header = element['elementHeader']
76
+ el_q_name = element['properties'].get('qualifiedName',"---")
77
+ el_type = header["type"]['typeName']
78
+ el_home = header['origin']['homeMetadataCollectionName']
79
+ el_create_time = header['versions']['createTime'][:-18]
80
+ el_guid = header['guid']
81
+
82
+ el_props_md = ""
83
+ for prop in element['properties'].keys():
84
+ el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
85
+
86
+ el_props_out = Markdown(el_props_md)
87
+
88
+ tags = f_client.get_attached_tags(el_guid)
89
+ tags_md = "Tags:\n"
90
+ if type(tags) is list:
91
+ for tag in tags:
92
+ tags_md += (f"* tag: {tag.get('name','---')}\n"
93
+ f"\t description: {tag.get('description','---')}\n"
94
+ f"\t assigned by: {tag.get('user','---')}\n"
95
+ )
96
+
97
+ else:
98
+ tags_md = "---"
99
+
100
+
101
+ likes = f_client.get_attached_likes(el_guid)
102
+ likes_md = "Likes:\b"
103
+ if type(likes) is list:
104
+ for like in likes:
105
+ likes_md += (f"* tag: {like['name']}\n"
106
+ f"* description: {like['description']}\n"
107
+ f"* assigned by: {like['user']}\n"
108
+ f"\n")
109
+
110
+ else:
111
+ likes_md = "---"
112
+
113
+
114
+ feedback_out = f"{tags_md}\n --- \n{likes_md}"
115
+
116
+ comments_out = " "
117
+
118
+
119
+ table.add_row(el_q_name, el_type, el_create_time, el_home, el_guid, el_props_out, feedback_out, comments_out)
120
+
121
+ return table
122
+ else:
123
+ print("No instances found")
124
+ sys.exit(1)
125
+
126
+ try:
127
+ console = Console(width=width, force_terminal=not jupyter)
128
+
129
+ with console.pager(styles=True):
130
+ console.print(generate_table())
131
+
132
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
133
+ print_exception_response(e)
134
+ print("\n\nPerhaps the type name isn't known")
135
+ finally:
136
+ c_client.close_session()
137
+
138
+
139
+ def main():
140
+ parser = argparse.ArgumentParser()
141
+ parser.add_argument("--server", help="Name of the server to display status for")
142
+ parser.add_argument("--url", help="URL Platform to connect to")
143
+ parser.add_argument("--userid", help="User Id")
144
+ parser.add_argument("--password", help="Password")
145
+
146
+ args = parser.parse_args()
147
+
148
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
149
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
150
+ userid = args.userid if args.userid is not None else EGERIA_USER
151
+ password = args.password if args.password is not None else EGERIA_USER_PASSWORD
152
+
153
+ try:
154
+ om_type = Prompt.ask("Enter the Open Metadata Type to find elements of:", default="GlossaryTerm")
155
+ list_elements_x(om_type, server, url, userid, password)
156
+ except(KeyboardInterrupt):
157
+ pass
158
+
159
+
160
+ if __name__ == "__main__":
161
+ main()
162
+
163
+
164
+
pyegeria/__init__.py CHANGED
@@ -49,6 +49,7 @@ from .action_author_omvs import GovernanceAuthor
49
49
  from .glossary_manager_omvs import GlossaryManager
50
50
  from .create_tech_guid_lists import build_global_guid_lists
51
51
  from .classification_manager_omvs import ClassificationManager
52
+ from .feedback_manager_omvs import FeedbackManager
52
53
 
53
54
 
54
55
  #
@@ -80,11 +80,13 @@ def element_response(response: dict, element_type: str, detailed_response: bool)
80
80
 
81
81
 
82
82
  def elements_response(response: dict, element_type: str, detailed_response: bool):
83
+ if type(response) != dict:
84
+ return('---')
83
85
  if detailed_response:
84
86
  return response
85
87
  else:
86
- return element_property_plus_list(response[element_type])
87
-
88
+ return element_property_plus_list(response.get(element_type,'---'))
89
+ # Todo - review with Kevin...
88
90
 
89
91
  class FeedbackManager(Client):
90
92
  """FeedbackManager is a class that extends the Client class. It
@@ -2276,7 +2278,8 @@ class FeedbackManager(Client):
2276
2278
  )
2277
2279
  url = f"{base_path(self, server_name)}/elements/{element_guid}/likes/retrieve{possible_query_params}"
2278
2280
  response = await self._async_make_request("POST", url, body)
2279
- return elements_response(response.json(), "elementList", detailed_response)
2281
+ # return elements_response(response.json(), "elementList", detailed_response)
2282
+ return response.json().get('ratings','---')
2280
2283
 
2281
2284
  def get_attached_likes(
2282
2285
  self,
@@ -2520,7 +2523,8 @@ class FeedbackManager(Client):
2520
2523
  )
2521
2524
  url = f"{base_path(self, server_name)}/elements/{element_guid}/tags/retrieve{possible_query_params}"
2522
2525
  response = await self._async_make_request("POST", url, body)
2523
- return elements_response(response.json(), "tags", detailed_response)
2526
+ return response.json().get('tags', '---')
2527
+ # return elements_response(response.json(), "tags", detailed_response)
2524
2528
 
2525
2529
  def get_attached_tags(
2526
2530
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.7.22
3
+ Version: 0.7.24
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -30,7 +30,7 @@ examples/widgets/my/list_my_roles.py,sha256=DCiNdnoHXQueUE5g73D3oRXfJ6LaUQGbibNt
30
30
  examples/widgets/my/monitor_my_todos.py,sha256=1580SOyq2RPsAyAkRxIpRHRxDvtI1xWfUrxylF6qKH4,6409
31
31
  examples/widgets/my/monitor_open_todos.py,sha256=oYmy5eRA_5BLhtkP8iI6pxci-8y6d13Vcw2F2yLawxY,5407
32
32
  examples/widgets/my/my_profile_actions.py,sha256=SrlC0PSix0b78MCWJdGJAVgai8gbJmYyz1ou2ZVOkIs,3949
33
- examples/widgets/my/todo_actions.py,sha256=a9A0ZJ_Y8zZ15Pdy6Dd5M1JZKS4-SHyiJcD_W7R8SFQ,8241
33
+ examples/widgets/my/todo_actions.py,sha256=WvxoKJZktormxQjV4ShkJPio6YoixeZBA-zl2vDEMP4,8157
34
34
  examples/widgets/ops/README.md,sha256=PJsSDcvMv6E6og6y-cwvxFX5lhCII0UCwgKiM1T17MQ,1595
35
35
  examples/widgets/ops/__init__.py,sha256=SCfzF3-aMx8EpqLWmH7JQf13gTmMAtHRbg69oseLvi8,480
36
36
  examples/widgets/ops/engine_actions.py,sha256=i0-_wRJqdKARwnEwPQMJvr5bVEGi2WE9Np0_A-o6k3A,2978
@@ -53,7 +53,8 @@ examples/widgets/tech/get_element_info.py,sha256=3B6mTu09d-FRTVWbZ5uujKBLLy8ULFy
53
53
  examples/widgets/tech/get_guid_info.py,sha256=p-peTX1Mahi8fNmcNVHOVI3OjqjlJwZjv7gRdBI4l0Q,4137
54
54
  examples/widgets/tech/get_tech_details.py,sha256=p5OgSKep3VOuuZmQXE2OSYhE-kvnI18TBcQ-PU5kEAw,6023
55
55
  examples/widgets/tech/list_asset_types.py,sha256=PHPtCXqCHhIw0K59hUvoKdybp6IKPt_9Wc0AJVDtdrg,4181
56
- examples/widgets/tech/list_elements.py,sha256=xQg-PGS2oORed2ATVNPZvGVCGLEUHO5rOeXvgS6pkrg,4726
56
+ examples/widgets/tech/list_elements.py,sha256=8P2nCtTgBhYZfxFcyG9xL7b1a66o3SU1ny-Yh-BVuII,4730
57
+ examples/widgets/tech/list_elements_x.py,sha256=E5f6hAs4OeCckz9XM8wb5eynPN6eSZrVlWLqVOaWT-c,6079
57
58
  examples/widgets/tech/list_registered_services.py,sha256=TqZbT54vMGvHUAX_bovCce3A3eV_RbjSEtPP6u6ZJV0,6388
58
59
  examples/widgets/tech/list_related_specification.py,sha256=zFOsqR-GB4VUWnZoxmaKWv1-qkI3syRoIC9iIEO6khI,5797
59
60
  examples/widgets/tech/list_relationship_types.py,sha256=0T8Sl7J3WFq_0IQLLzcL0T79pUxVENWNT95Cpjz2ukc,5633
@@ -61,7 +62,7 @@ examples/widgets/tech/list_tech_templates.py,sha256=RiyA8a4fIL9BGeGf37Bkk471mK5E
61
62
  examples/widgets/tech/list_valid_metadata_values.py,sha256=64z5tr-0VD-mPTFmr6FT76gj4MXJZLWTxT4oeIiUaiU,6043
62
63
  examples/widgets/tech/x_list_related_elements.py,sha256=hDiPThI9FLI63yoWEy7j7k_zLPBSlZIXYSaixiY_YAY,5785
63
64
  pyegeria/Xloaded_resources_omvs.py,sha256=cseWZTIwNhkzhZ0fhujI66DslNAQcjuwsz_p1GRmSPQ,3392
64
- pyegeria/__init__.py,sha256=RNkQeblUJGmnCY7U8l8xMhivpVzMcXRBafxDAzxG6Lc,7714
65
+ pyegeria/__init__.py,sha256=2iz0GmjA8xBpn8bdLhnFYcFX12k0bfoxuOHZ3Nz97DA,7765
65
66
  pyegeria/_client.py,sha256=mTK3qqaxwrwn4OiIKZkSkMVEsHPJsHxKmfz1LK_FgEg,26308
66
67
  pyegeria/_deprecated_gov_engine.py,sha256=_DAEHsksnTKGqL9-TaaMVrfnNOrvatNACfg7pJ-ZX4w,17600
67
68
  pyegeria/_exceptions.py,sha256=NJ7vAhmvusK1ENvY2MMrBB6A6TgpYjzS9QJxFH56b8c,18470
@@ -74,7 +75,7 @@ pyegeria/classification_manager_omvs.py,sha256=PzdFm5Sp69QsWeiZ4DAtOfe2BvUXLdSNc
74
75
  pyegeria/collection_manager_omvs.py,sha256=aGtzC3P8_YgY2KEzhtO19_H9drStE0hW5hUj-dA7bLo,112649
75
76
  pyegeria/core_omag_server_config.py,sha256=16ld7aBTgO3gGhvFs-_yzwqPsatdCAiKYi005_2evZU,93096
76
77
  pyegeria/create_tech_guid_lists.py,sha256=jClpvURy20o4UV83LOwhGg3TZdHGzfjZ9y0MNZyG2To,4282
77
- pyegeria/feedback_manager_omvs.py,sha256=iDTT-wj1qf-xX9yy2V8eMezR5fDwowv9bQUH4sJofPo,164575
78
+ pyegeria/feedback_manager_omvs.py,sha256=I-Qn7IcrJ5FiSjaC8dIwOmBF8XOCsjl88Anq1xNgyGI,164773
78
79
  pyegeria/full_omag_server_config.py,sha256=l4G0oM6l-axosYACypqNqzkF6wELzs9FgKJwvDMF0Fc,45817
79
80
  pyegeria/glossary_browser_omvs.py,sha256=nUCDSQ8cw8vuYgjfcaj1zLIefVI5j51evxPyXCIc4X8,101716
80
81
  pyegeria/glossary_manager_omvs.py,sha256=MsvsTyyTzLbaIQttfhM-izVP06VsdWAueJiiMeKbVwY,128512
@@ -86,8 +87,8 @@ pyegeria/runtime_manager_omvs.py,sha256=oSVFeG_yBGXIvQR0EClLZqTZ6C5z5ReZzwm8cce8
86
87
  pyegeria/server_operations.py,sha256=1z2wZLdrNZG6HlswY_Eh8qI1mlcjsQ59zO-AMy9XbUU,16605
87
88
  pyegeria/utils.py,sha256=pkVmS3RrbjaS9yz7FtOCwaOfV5FMqz-__Rt5koCnd9c,5374
88
89
  pyegeria/valid_metadata_omvs.py,sha256=aisdRodIwJSkyArAzfm_sEnBELh69xE8k4Nea-vHu8M,36745
89
- pyegeria-0.7.22.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
90
- pyegeria-0.7.22.dist-info/METADATA,sha256=esOFUT5knlHiIKdLbDEg0nyDS3CVirfT9M2301KWCWw,2775
91
- pyegeria-0.7.22.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
92
- pyegeria-0.7.22.dist-info/entry_points.txt,sha256=22oy5-EM37ldb_-MPtiJygwXU217h8vb2_zT-7vn-yc,3571
93
- pyegeria-0.7.22.dist-info/RECORD,,
90
+ pyegeria-0.7.24.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
91
+ pyegeria-0.7.24.dist-info/METADATA,sha256=-ANU8DPBhVbFoQlF5flPHC-fAqiMGYI306dBIV6t3-E,2775
92
+ pyegeria-0.7.24.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
93
+ pyegeria-0.7.24.dist-info/entry_points.txt,sha256=22oy5-EM37ldb_-MPtiJygwXU217h8vb2_zT-7vn-yc,3571
94
+ pyegeria-0.7.24.dist-info/RECORD,,