pyegeria 0.7.44__py3-none-any.whl → 0.7.45__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.
@@ -30,19 +30,21 @@ from pyegeria import (
30
30
  )
31
31
 
32
32
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
33
- EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
33
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("EGERIA_KAFKA_ENDPOINT", "localhost:9092")
34
34
  EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
35
- EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
35
+ EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "view-server")
36
36
  EGERIA_VIEW_SERVER_URL = os.environ.get(
37
37
  "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
38
38
  )
39
- EGERIA_ENGINE_HOST = os.environ.get("INTEGRATION_ENGINE_HOST", "engine-host")
39
+ EGERIA_ENGINE_HOST = os.environ.get("EGERIA_ENGINE_HOST", "engine-host")
40
40
  EGERIA_ENGINE_HOST_URL = os.environ.get(
41
- "INTEGRATION_ENGINE_HOST_URL", "https://localhost:9443"
41
+ "EGERIA_ENGINE_HOST_URL", "https://localhost:9443"
42
42
  )
43
- EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
44
- EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
45
- EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
43
+ EGERIA_INTEGRATION_DAEMON = os.environ.get(
44
+ "EGERIA_INTEGRATION_DAEMON", "integration-daemon"
45
+ )
46
+ EGERIA_ADMIN_USER = os.environ.get("EGERIA_ADMIN_USER", "garygeeke")
47
+ EGERIA_ADMIN_PASSWORD = os.environ.get("EGERIA_ADMIN_PASSWORD", "secret")
46
48
  EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
47
49
  EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
48
50
  EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
@@ -34,11 +34,15 @@ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
34
34
  EGERIA_VIEW_SERVER_URL = os.environ.get(
35
35
  "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
36
36
  )
37
- EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
38
- EGERIA_ENGINE_HOST = os.environ.get("ENGINE_HOST", "engine-host")
39
- EGERIA_ENGINE_HOST_URL = os.environ.get("ENGINE_HOST_URL", "https://localhost:9443")
40
- EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
41
- EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
37
+ EGERIA_INTEGRATION_DAEMON = os.environ.get(
38
+ "EGERIA_INTEGRATION_DAEMON", "integration-daemon"
39
+ )
40
+ EGERIA_ENGINE_HOST = os.environ.get("EGERIA_ENGINE_HOST", "engine-host")
41
+ EGERIA_ENGINE_HOST_URL = os.environ.get(
42
+ "EGERIA_ENGINE_HOST_URL", "https://localhost:9443"
43
+ )
44
+ EGERIA_ADMIN_USER = os.environ.get("EGERIA_ADMIN_USER", "garygeeke")
45
+ EGERIA_ADMIN_PASSWORD = os.environ.get("EGERIA_ADMIN_PASSWORD", "secret")
42
46
  EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
43
47
  EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
44
48
  EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
@@ -0,0 +1,162 @@
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 archives
11
+ """
12
+ import argparse
13
+ import json
14
+ import os
15
+ import time, datetime
16
+
17
+ from rich import box
18
+ from rich import print
19
+ from rich.console import Console
20
+ from rich.prompt import Prompt
21
+ from rich.table import Table
22
+
23
+ from pyegeria import (
24
+ InvalidParameterException,
25
+ PropertyServerException,
26
+ UserNotAuthorizedException,
27
+ print_exception_response,
28
+ )
29
+ from pyegeria import ProjectManager, ClassificationManager
30
+
31
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
32
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
33
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
34
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
35
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
36
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
37
+ )
38
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
39
+ EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
40
+ "EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
41
+ )
42
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
43
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
44
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
45
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
46
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
47
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
48
+
49
+
50
+ def display_archive_list(
51
+ server: str,
52
+ url: str,
53
+ username: str,
54
+ user_pass: str,
55
+ save_output: bool,
56
+ jupyter: bool = EGERIA_JUPYTER,
57
+ width: int = EGERIA_WIDTH,
58
+ ):
59
+ c_client = ClassificationManager(server, url, user_id=username)
60
+ token = c_client.create_egeria_bearer_token(username, user_pass)
61
+
62
+ def generate_table() -> Table:
63
+ """Make a new table."""
64
+ table = Table(
65
+ title=f"Project List: Egeria Archvies @ {time.asctime()}",
66
+ header_style="white on dark_blue",
67
+ show_lines=True,
68
+ box=box.ROUNDED,
69
+ caption=f"Archive list for Server '{server}' @ Platform - {url}",
70
+ expand=True,
71
+ )
72
+
73
+ table.add_column("Name")
74
+ table.add_column("Path Name")
75
+ table.add_column("Creation Date")
76
+ # table.add_column("Creator")
77
+ # table.add_column("Description")
78
+
79
+ open_metadata_type_name = None
80
+ property_value = "omarchive"
81
+ property_names = ["fileExtension"]
82
+ archives = c_client.get_elements_by_property_value(
83
+ property_value, property_names, open_metadata_type_name
84
+ )
85
+
86
+ if type(archives) != list:
87
+ raise ValueError("--> No archives found")
88
+ else:
89
+ sorted_archives = sorted(
90
+ archives, key=lambda k: k["properties"].get("name", "---")
91
+ )
92
+
93
+ for archive in sorted_archives:
94
+ name = archive["properties"].get("name", "---")
95
+ path_name = archive["properties"].get("pathName", "---")
96
+ creation_date_epoch = (
97
+ int(archive["properties"].get("storeCreateTime", 0)) / 1000
98
+ )
99
+ create_date = datetime.datetime.fromtimestamp(creation_date_epoch)
100
+ creator = "---"
101
+ description = "---"
102
+
103
+ table.add_row(
104
+ name, path_name, create_date.strftime("%Y-%m-%d %H:%M:%S")
105
+ )
106
+
107
+ return table
108
+
109
+ try:
110
+ # with Live(generate_table(), refresh_per_second=4, screen=True) as live:
111
+ # while True:
112
+ # time.sleep(2)
113
+ # live.update(generate_table())
114
+ console = Console(
115
+ record=True, width=width, force_terminal=not jupyter, soft_wrap=True
116
+ )
117
+ with console.pager():
118
+ console.print(generate_table(), soft_wrap=True)
119
+ if save_output:
120
+ console.save_html("archives.html")
121
+
122
+ except (
123
+ InvalidParameterException,
124
+ PropertyServerException,
125
+ UserNotAuthorizedException,
126
+ ValueError,
127
+ ) as e:
128
+ if type(e) is str:
129
+ print(e)
130
+ else:
131
+ print_exception_response(e)
132
+ except KeyboardInterrupt:
133
+ pass
134
+ finally:
135
+ c_client.close_session()
136
+
137
+
138
+ def main():
139
+ parser = argparse.ArgumentParser()
140
+ parser.add_argument("--server", help="Name of the server to display status for")
141
+ parser.add_argument("--url", help="URL Platform to connect to")
142
+ parser.add_argument("--userid", help="User Id")
143
+ parser.add_argument("--save-output", help="Save output to file?")
144
+ parser.add_argument("--password", help="User Password")
145
+ # parser.add_argument("--sponsor", help="Name of sponsor to search")
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
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
152
+
153
+ try:
154
+ save_output = args.save_output if args.save_output is not None else False
155
+ display_archive_list(server, url, userid, user_pass, save_output)
156
+
157
+ except KeyboardInterrupt:
158
+ pass
159
+
160
+
161
+ if __name__ == "__main__":
162
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.7.44
3
+ Version: 0.7.45
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -41,8 +41,8 @@ examples/widgets/ops/load_archive.py,sha256=duf3wq2ANRBiOj9KTFsw8TseEkJLKdzITAeT
41
41
  examples/widgets/ops/monitor_asset_events.py,sha256=cjdlVqE0XYnoRW3aorNbsVkjByDXefPBnllaZLelGls,3838
42
42
  examples/widgets/ops/monitor_coco_status.py,sha256=ERz3OJ0TXImNKHGD4gJvgT3pl2gS23ewAdUuYVLUhEE,3299
43
43
  examples/widgets/ops/monitor_engine_activity.py,sha256=m18OSnRoo5ut0WKKOWNoFGXJW_npjp6hzHK3RUQG8T0,8479
44
- examples/widgets/ops/monitor_engine_activity_c.py,sha256=6YAjraLXsRoy-R9vSQlDbgrMMBaxkp8nfIp-ayz3nZs,9340
45
- examples/widgets/ops/monitor_gov_eng_status.py,sha256=gAJ0m4aYnccNL2Io8XaQ-x_l7mWmDBAXIl_RoZxC-4I,6593
44
+ examples/widgets/ops/monitor_engine_activity_c.py,sha256=rSEUD3elhsiYdUhQRn613OM_R4VecFb0uq39MhYhltQ,9371
45
+ examples/widgets/ops/monitor_gov_eng_status.py,sha256=77B9KgFmFkFhthtgqIqNRAxylfWhkbIVFd8Q0rOEAnU,6640
46
46
  examples/widgets/ops/monitor_integ_daemon_status.py,sha256=u15-tvGveO7_yV7JJmYkxiEDnq5KBk8J4hkw0id_LFA,9224
47
47
  examples/widgets/ops/monitor_platform_status.py,sha256=hn96QuOjCndSDWl1-DAzk9O8D68YoRP1ALOlVfWVQgo,6400
48
48
  examples/widgets/ops/monitor_server_list.py,sha256=Uhtn8lv7QVXJBi9DSR3Nelmz8TB0vOsat10nFS6Nu20,4637
@@ -57,6 +57,7 @@ examples/widgets/tech/get_tech_details.py,sha256=p5OgSKep3VOuuZmQXE2OSYhE-kvnI18
57
57
  examples/widgets/tech/list_asset_types.py,sha256=PHPtCXqCHhIw0K59hUvoKdybp6IKPt_9Wc0AJVDtdrg,4181
58
58
  examples/widgets/tech/list_elements.py,sha256=8P2nCtTgBhYZfxFcyG9xL7b1a66o3SU1ny-Yh-BVuII,4730
59
59
  examples/widgets/tech/list_elements_x.py,sha256=E5f6hAs4OeCckz9XM8wb5eynPN6eSZrVlWLqVOaWT-c,6079
60
+ examples/widgets/tech/list_gov_processes.py,sha256=bQ0Uph35hMvufn15nO1ulYsZ20fyZmvCr57sCDgHMy8,5498
60
61
  examples/widgets/tech/list_registered_services.py,sha256=TqZbT54vMGvHUAX_bovCce3A3eV_RbjSEtPP6u6ZJV0,6388
61
62
  examples/widgets/tech/list_related_specification.py,sha256=zFOsqR-GB4VUWnZoxmaKWv1-qkI3syRoIC9iIEO6khI,5797
62
63
  examples/widgets/tech/list_relationship_types.py,sha256=0T8Sl7J3WFq_0IQLLzcL0T79pUxVENWNT95Cpjz2ukc,5633
@@ -91,8 +92,8 @@ pyegeria/server_operations.py,sha256=1z2wZLdrNZG6HlswY_Eh8qI1mlcjsQ59zO-AMy9XbUU
91
92
  pyegeria/tech_guids_31-08-2024 14:33.py,sha256=B3fytBw9dmjnlEaCKgt6oQoGh-8HUBG0mFQeyDoUEYQ,6229
92
93
  pyegeria/utils.py,sha256=pkVmS3RrbjaS9yz7FtOCwaOfV5FMqz-__Rt5koCnd9c,5374
93
94
  pyegeria/valid_metadata_omvs.py,sha256=aisdRodIwJSkyArAzfm_sEnBELh69xE8k4Nea-vHu8M,36745
94
- pyegeria-0.7.44.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
95
- pyegeria-0.7.44.dist-info/METADATA,sha256=jbP_LfJ8hVvHGQje7ZWjEpdmNPnBcQjCvLErcfF3trI,2818
96
- pyegeria-0.7.44.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
97
- pyegeria-0.7.44.dist-info/entry_points.txt,sha256=5Q9bDxIqPgdhd3lDnzdRSCYy9hZtNm_BL49bcmbBpGQ,3808
98
- pyegeria-0.7.44.dist-info/RECORD,,
95
+ pyegeria-0.7.45.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
96
+ pyegeria-0.7.45.dist-info/METADATA,sha256=m4_JeEUG9VM73yuYTXhEHrCVV3J0VqJT5IjfIRMkmuI,2818
97
+ pyegeria-0.7.45.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
98
+ pyegeria-0.7.45.dist-info/entry_points.txt,sha256=5Q9bDxIqPgdhd3lDnzdRSCYy9hZtNm_BL49bcmbBpGQ,3808
99
+ pyegeria-0.7.45.dist-info/RECORD,,