pyegeria 0.8.1__tar.gz → 0.8.3__tar.gz
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.
- {pyegeria-0.8.1 → pyegeria-0.8.3}/PKG-INFO +1 -1
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/doc_samples/Create_Collection_Sample.py +121 -93
- pyegeria-0.8.3/examples/doc_samples/Create_Sustainability_Collection_Sample.py +149 -0
- pyegeria-0.8.3/examples/widgets/cat/get_collection.py +139 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/list_todos.py +59 -33
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/my/list_my_profile.py +61 -36
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/my/list_my_roles.py +40 -23
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/my/monitor_my_todos.py +45 -23
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/my/monitor_open_todos.py +36 -22
- pyegeria-0.8.3/examples/widgets/my/todo_actions.py +249 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/__init__.py +1 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/_client.py +9 -11
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/collection_manager_omvs.py +1 -2
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/egeria_cat_client.py +1 -6
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/egeria_my_client.py +1 -1
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/egeria_ops_client.py +6 -2
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyproject.toml +1 -1
- pyegeria-0.8.1/examples/doc_samples/Create_Sustainability_Collection_Sample.py +0 -115
- pyegeria-0.8.1/examples/widgets/cat/get_collection.py +0 -98
- pyegeria-0.8.1/examples/widgets/my/todo_actions.py +0 -188
- {pyegeria-0.8.1 → pyegeria-0.8.3}/LICENSE +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/README.md +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/README.md +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/__init__.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/get_asset_graph.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/get_project_dependencies.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/get_project_structure.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/get_tech_type_elements.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/get_tech_type_template.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/list_archives.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/list_assets.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/list_cert_types.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/list_glossary.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/list_projects.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/list_relationships.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/list_tech_types.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cat/list_user_ids.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cli/__init__.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cli/egeria.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cli/egeria_cat.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cli/egeria_my.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cli/egeria_ops.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cli/egeria_tech.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/cli/ops_config.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/my/README.md +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/my/__init__.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/my/my_profile_actions.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/README.md +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/__init__.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/engine_actions.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/integration_daemon_actions.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/list_catalog_targets.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/load_archive.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/monitor_asset_events.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/monitor_coco_status.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/monitor_engine_activity.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/monitor_engine_activity_c.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/monitor_gov_eng_status.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/monitor_integ_daemon_status.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/monitor_platform_status.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/monitor_server_list.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/monitor_server_status.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/refresh_integration_daemon.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/ops/restart_integration_daemon.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/README.md +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/__init__.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/get_element_info.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/get_guid_info.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/get_tech_details.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/list_asset_types.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/list_elements.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/list_elements_x.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/list_registered_services.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/list_related_specification.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/list_relationship_types.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/list_tech_templates.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/list_valid_metadata_values.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/examples/widgets/tech/x_list_related_elements.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/Xloaded_resources_omvs.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/_deprecated_gov_engine.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/_exceptions.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/_globals.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/_validators.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/action_author_omvs.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/asset_catalog_omvs.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/automated_curation_omvs.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/classification_manager_omvs.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/core_omag_server_config.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/create_tech_guid_lists.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/egeria_config_client.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/egeria_tech_client.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/feedback_manager_omvs.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/full_omag_server_config.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/glossary_browser_omvs.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/glossary_manager_omvs.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/mermaid_utilities.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/my_profile_omvs.py +1 -1
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/platform_services.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/project_manager_omvs.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/registered_info.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/runtime_manager_omvs.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/server_operations.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/utils.py +0 -0
- {pyegeria-0.8.1 → pyegeria-0.8.3}/pyegeria/valid_metadata_omvs.py +0 -0
@@ -11,16 +11,20 @@ import time
|
|
11
11
|
from rich import print
|
12
12
|
from rich.console import Console
|
13
13
|
|
14
|
-
from pyegeria import
|
14
|
+
from pyegeria import (
|
15
|
+
CollectionManager,
|
16
|
+
InvalidParameterException,
|
17
|
+
PropertyServerException,
|
18
|
+
UserNotAuthorizedException,
|
19
|
+
)
|
15
20
|
|
16
|
-
view_server =
|
17
|
-
platform_url =
|
18
|
-
user =
|
21
|
+
view_server = "view-server"
|
22
|
+
platform_url = "https://localhost:9443"
|
23
|
+
user = "erinoverview"
|
19
24
|
console = Console(width=200)
|
20
25
|
|
21
26
|
try:
|
22
|
-
c_client = CollectionManager(view_server, platform_url,
|
23
|
-
user_id=user)
|
27
|
+
c_client = CollectionManager(view_server, platform_url, user_id=user)
|
24
28
|
|
25
29
|
token = c_client.create_egeria_bearer_token(user, "secret")
|
26
30
|
start_time = time.perf_counter()
|
@@ -35,10 +39,16 @@ try:
|
|
35
39
|
collection_type = "Digital Products Root"
|
36
40
|
is_own_anchor = True
|
37
41
|
|
38
|
-
response = c_client.create_root_collection(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
response = c_client.create_root_collection(
|
43
|
+
anchor_guid,
|
44
|
+
parent_guid,
|
45
|
+
parent_relationship_type_name,
|
46
|
+
parent_at_end1,
|
47
|
+
display_name,
|
48
|
+
description,
|
49
|
+
collection_type,
|
50
|
+
is_own_anchor,
|
51
|
+
)
|
42
52
|
# Create first folder for Agriculture Insights
|
43
53
|
parent_guid = response
|
44
54
|
parent_relationship_type_name = "CollectionMembership"
|
@@ -46,23 +56,35 @@ try:
|
|
46
56
|
description = "A folder for agricultural insights data product collections"
|
47
57
|
collection_type = "Digital Product Marketplace"
|
48
58
|
|
49
|
-
folder1 = c_client.create_folder_collection(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
59
|
+
folder1 = c_client.create_folder_collection(
|
60
|
+
None,
|
61
|
+
parent_guid,
|
62
|
+
parent_relationship_type_name,
|
63
|
+
True,
|
64
|
+
display_name,
|
65
|
+
description,
|
66
|
+
collection_type,
|
67
|
+
True,
|
68
|
+
"DATE_CREATED",
|
69
|
+
None,
|
70
|
+
)
|
55
71
|
print(f"\n\n created a folder with guid {folder1}")
|
56
72
|
# create second folder for Earth Observations
|
57
73
|
display_name = "Earth Observation Data Collection"
|
58
74
|
description = "A folder for Earth Observation data product collections"
|
59
75
|
|
60
|
-
folder2 = c_client.create_folder_collection(
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
76
|
+
folder2 = c_client.create_folder_collection(
|
77
|
+
None,
|
78
|
+
parent_guid,
|
79
|
+
parent_relationship_type_name,
|
80
|
+
True,
|
81
|
+
display_name,
|
82
|
+
description,
|
83
|
+
collection_type,
|
84
|
+
True,
|
85
|
+
"DATE_CREATED",
|
86
|
+
None,
|
87
|
+
)
|
66
88
|
print(f"\n\n created a folder with guid {folder2}")
|
67
89
|
|
68
90
|
# create a digital product, child of folder 1, for Land Use products
|
@@ -73,36 +95,36 @@ try:
|
|
73
95
|
collection_type = "Digital Product"
|
74
96
|
classification_name = "Digital Product"
|
75
97
|
body_3 = {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
98
|
+
"class": "NewDigitalProductRequestBody",
|
99
|
+
"isOwnAnchor": True,
|
100
|
+
"parentGUID": parent_guid,
|
101
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
102
|
+
"parentAtEnd1": True,
|
103
|
+
"collectionProperties": {
|
104
|
+
"class": "CollectionProperties",
|
105
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
106
|
+
"name": display_name,
|
107
|
+
"description": description,
|
108
|
+
"collectionType": collection_type,
|
109
|
+
"collectionOrdering": "DATE_CREATED",
|
110
|
+
},
|
111
|
+
"digitalProductProperties": {
|
112
|
+
"class": "DigitalProductProperties",
|
113
|
+
"productStatus": "ACTIVE",
|
114
|
+
"productName": "Land Use Classifications",
|
115
|
+
"productType": "Geospatial Data Assets",
|
116
|
+
"description": "Land use classification assets",
|
117
|
+
"introductionDate": "2023-12-01",
|
118
|
+
"maturity": "Nacent",
|
119
|
+
"serviceLife": "3 years",
|
120
|
+
"currentVersion": "V.5",
|
121
|
+
"nextVersionDate": "2024-12-01",
|
122
|
+
"withdrawDate": "2030-01-01",
|
123
|
+
"additionalProperties": {
|
124
|
+
"thought_id": "a guid",
|
125
|
+
"license": "cc-by-sa",
|
88
126
|
},
|
89
|
-
|
90
|
-
"class": "DigitalProductProperties",
|
91
|
-
"productStatus": "ACTIVE",
|
92
|
-
"productName": "Land Use Classifications",
|
93
|
-
"productType": "Geospatial Data Assets",
|
94
|
-
"description": "Land use classification assets",
|
95
|
-
"introductionDate": "2023-12-01",
|
96
|
-
"maturity": "Nacent",
|
97
|
-
"serviceLife": "3 years",
|
98
|
-
"currentVersion": "V.5",
|
99
|
-
"nextVersionDate": "2024-12-01",
|
100
|
-
"withdrawDate": "2030-01-01",
|
101
|
-
"additionalProperties": {
|
102
|
-
"thought_id": "a guid",
|
103
|
-
"license": "cc-by-sa",
|
104
|
-
}
|
105
|
-
}
|
127
|
+
},
|
106
128
|
}
|
107
129
|
folder3 = c_client.create_digital_product(body_3)
|
108
130
|
print(f"\n\n created a collection with guid {folder3}")
|
@@ -113,36 +135,36 @@ try:
|
|
113
135
|
description = "Landsat 8 data products"
|
114
136
|
|
115
137
|
body_4 = {
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
138
|
+
"class": "NewDigitalProductRequestBody",
|
139
|
+
"isOwnAnchor": True,
|
140
|
+
"parentGUID": parent_guid,
|
141
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
142
|
+
"parentAtEnd1": True,
|
143
|
+
"collectionProperties": {
|
144
|
+
"class": "CollectionProperties",
|
145
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
146
|
+
"name": display_name,
|
147
|
+
"description": description,
|
148
|
+
"collectionType": collection_type,
|
149
|
+
"collectionOrdering": "DATE_CREATED",
|
150
|
+
},
|
151
|
+
"digitalProductProperties": {
|
152
|
+
"class": "DigitalProductProperties",
|
153
|
+
"productStatus": "ACTIVE",
|
154
|
+
"productName": "Landsat 8 Imagery",
|
155
|
+
"productType": "Geospatial Data Assets",
|
156
|
+
"description": description,
|
157
|
+
"introductionDate": "2024-01-01",
|
158
|
+
"maturity": "Mature",
|
159
|
+
"serviceLife": "3 years",
|
160
|
+
"currentVersion": "V1.5",
|
161
|
+
"nextVersion": "2024-06-01",
|
162
|
+
"withdrawDate": "2030-01-01",
|
163
|
+
"additionalProperties": {
|
164
|
+
"thought_id": "a guid",
|
165
|
+
"license": "cc-by-sa",
|
128
166
|
},
|
129
|
-
|
130
|
-
"class": "DigitalProductProperties",
|
131
|
-
"productStatus": "ACTIVE",
|
132
|
-
"productName": "Landsat 8 Imagery",
|
133
|
-
"productType": "Geospatial Data Assets",
|
134
|
-
"description": description,
|
135
|
-
"introductionDate": "2024-01-01",
|
136
|
-
"maturity": "Mature",
|
137
|
-
"serviceLife": "3 years",
|
138
|
-
"currentVersion": "V1.5",
|
139
|
-
"nextVersion": "2024-06-01",
|
140
|
-
"withdrawDate": "2030-01-01",
|
141
|
-
"additionalProperties": {
|
142
|
-
"thought_id": "a guid",
|
143
|
-
"license": "cc-by-sa",
|
144
|
-
}
|
145
|
-
}
|
167
|
+
},
|
146
168
|
}
|
147
169
|
folder4 = c_client.create_digital_product(body_4)
|
148
170
|
print(f"\n\n created a collection with guid {folder4}")
|
@@ -154,12 +176,18 @@ try:
|
|
154
176
|
parent_relationship_type_name = "CollectionMembership"
|
155
177
|
collection_type = "Digital Product Marketplace"
|
156
178
|
|
157
|
-
folder5 = c_client.create_folder_collection(
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
179
|
+
folder5 = c_client.create_folder_collection(
|
180
|
+
None,
|
181
|
+
parent_guid,
|
182
|
+
parent_relationship_type_name,
|
183
|
+
True,
|
184
|
+
display_name,
|
185
|
+
description,
|
186
|
+
collection_type,
|
187
|
+
True,
|
188
|
+
"DATE_CREATED",
|
189
|
+
None,
|
190
|
+
)
|
163
191
|
# Create a DigitalProduct for Level-1B
|
164
192
|
parent_guid = folder5
|
165
193
|
display_name = "Sentinel 2 - Level 1B"
|
@@ -195,8 +223,8 @@ try:
|
|
195
223
|
"additionalProperties": {
|
196
224
|
"thought_id": "a guid",
|
197
225
|
"license": "cc-by-sa",
|
198
|
-
}
|
199
|
-
}
|
226
|
+
},
|
227
|
+
},
|
200
228
|
}
|
201
229
|
folder6 = c_client.create_digital_product(body_6)
|
202
230
|
print(f"\n\n created a collection with guid {folder6}")
|
@@ -235,8 +263,8 @@ try:
|
|
235
263
|
"additionalProperties": {
|
236
264
|
"thought_id": "a guid",
|
237
265
|
"license": "cc-by-sa",
|
238
|
-
}
|
239
|
-
}
|
266
|
+
},
|
267
|
+
},
|
240
268
|
}
|
241
269
|
folder7 = c_client.create_digital_product(body_7)
|
242
270
|
print(f"\n\n created a collection with guid {folder7}")
|
@@ -275,8 +303,8 @@ try:
|
|
275
303
|
"additionalProperties": {
|
276
304
|
"thought_id": "a guid",
|
277
305
|
"license": "cc-by-sa",
|
278
|
-
}
|
279
|
-
}
|
306
|
+
},
|
307
|
+
},
|
280
308
|
}
|
281
309
|
folder8 = c_client.create_digital_product(body_8)
|
282
310
|
print(f"\n\n created a collection with guid {folder8}")
|
@@ -284,7 +312,7 @@ try:
|
|
284
312
|
except (
|
285
313
|
InvalidParameterException,
|
286
314
|
PropertyServerException,
|
287
|
-
UserNotAuthorizedException
|
315
|
+
UserNotAuthorizedException,
|
288
316
|
) as e:
|
289
317
|
console.print_exception(show_locals=True)
|
290
318
|
|
@@ -0,0 +1,149 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
This sample creates a collection structure for a sustainability reporting project. It is
|
6
|
+
simplistic but shows how we can set up a collection hierarchy that can hold different kinds of
|
7
|
+
assets.
|
8
|
+
|
9
|
+
"""
|
10
|
+
|
11
|
+
import time
|
12
|
+
|
13
|
+
from rich import print
|
14
|
+
from rich.console import Console
|
15
|
+
|
16
|
+
from pyegeria import (
|
17
|
+
CollectionManager,
|
18
|
+
InvalidParameterException,
|
19
|
+
PropertyServerException,
|
20
|
+
UserNotAuthorizedException,
|
21
|
+
)
|
22
|
+
|
23
|
+
view_server = "view-server"
|
24
|
+
platform_url = "https://localhost:9443"
|
25
|
+
user = "erinoverview"
|
26
|
+
console = Console()
|
27
|
+
|
28
|
+
try:
|
29
|
+
c_client = CollectionManager(view_server, platform_url, user_id=user)
|
30
|
+
|
31
|
+
token = c_client.create_egeria_bearer_token(user, "secret")
|
32
|
+
start_time = time.perf_counter()
|
33
|
+
|
34
|
+
# Create a root collection for the sustainability project
|
35
|
+
parent_guid = None
|
36
|
+
parent_relationship_type_name = None
|
37
|
+
display_name = "Root Sustainability Collection"
|
38
|
+
description = "The root collection for our sustainability reporting project."
|
39
|
+
collection_type = "Sustainability Collection"
|
40
|
+
|
41
|
+
root = c_client.create_root_collection(
|
42
|
+
None,
|
43
|
+
parent_guid,
|
44
|
+
parent_relationship_type_name,
|
45
|
+
False,
|
46
|
+
display_name,
|
47
|
+
description,
|
48
|
+
collection_type,
|
49
|
+
True,
|
50
|
+
)
|
51
|
+
print(f"\n\n created a root with guid {root}")
|
52
|
+
# create a folder for Scope 1 Emissions
|
53
|
+
anchor_guid = root
|
54
|
+
parent_guid = root
|
55
|
+
parent_relationship_type_name = "CollectionMembership"
|
56
|
+
display_name = "Scope 1 Emissions"
|
57
|
+
description = "A folder for information about scope 1 emissions."
|
58
|
+
collection_type = "Sustainability Collection"
|
59
|
+
|
60
|
+
scope1_folder = c_client.create_folder_collection(
|
61
|
+
anchor_guid,
|
62
|
+
parent_guid,
|
63
|
+
parent_relationship_type_name,
|
64
|
+
True,
|
65
|
+
display_name,
|
66
|
+
description,
|
67
|
+
collection_type,
|
68
|
+
False,
|
69
|
+
"DATE_CREATED",
|
70
|
+
None,
|
71
|
+
)
|
72
|
+
print(f"\n\n created scope1_folder with guid {scope1_folder}")
|
73
|
+
|
74
|
+
# create a folder for Scope 2 Emissions.
|
75
|
+
anchor_guid = root
|
76
|
+
parent_guid = root
|
77
|
+
parent_relationship_type_name = "CollectionMembership"
|
78
|
+
display_name = "Scope 2 Emissions"
|
79
|
+
description = "A folder for information about scope 2 emissions."
|
80
|
+
collection_type = "Sustainability Collection"
|
81
|
+
|
82
|
+
scope2_folder = c_client.create_folder_collection(
|
83
|
+
anchor_guid,
|
84
|
+
parent_guid,
|
85
|
+
parent_relationship_type_name,
|
86
|
+
True,
|
87
|
+
display_name,
|
88
|
+
description,
|
89
|
+
collection_type,
|
90
|
+
False,
|
91
|
+
"DATE_CREATED",
|
92
|
+
None,
|
93
|
+
)
|
94
|
+
print(f"\n\n created scope2_folder with guid {scope2_folder}")
|
95
|
+
|
96
|
+
# create a folder for Scope 3 Emissions.
|
97
|
+
anchor_guid = root
|
98
|
+
parent_guid = root
|
99
|
+
parent_relationship_type_name = "CollectionMembership"
|
100
|
+
display_name = "Scope 3 Emissions"
|
101
|
+
description = "A folder for information about scope 3 emissions."
|
102
|
+
collection_type = "Sustainability Collection"
|
103
|
+
|
104
|
+
scope3_folder = c_client.create_folder_collection(
|
105
|
+
anchor_guid,
|
106
|
+
parent_guid,
|
107
|
+
parent_relationship_type_name,
|
108
|
+
True,
|
109
|
+
display_name,
|
110
|
+
description,
|
111
|
+
collection_type,
|
112
|
+
False,
|
113
|
+
"DATE_CREATED",
|
114
|
+
None,
|
115
|
+
)
|
116
|
+
print(f"\n\n created scope3_folder with guid {scope3_folder}")
|
117
|
+
|
118
|
+
# create a folder for Business Travel Emissions.
|
119
|
+
anchor_guid = root
|
120
|
+
parent_guid = scope3_folder
|
121
|
+
parent_relationship_type_name = "CollectionMembership"
|
122
|
+
display_name = "Business Travel Emissions"
|
123
|
+
description = "A folder for information about scope 3 business travel emissions."
|
124
|
+
collection_type = "Sustainability Collection"
|
125
|
+
|
126
|
+
travel_folder = c_client.create_folder_collection(
|
127
|
+
anchor_guid,
|
128
|
+
parent_guid,
|
129
|
+
parent_relationship_type_name,
|
130
|
+
True,
|
131
|
+
display_name,
|
132
|
+
description,
|
133
|
+
collection_type,
|
134
|
+
False,
|
135
|
+
"DATE_CREATED",
|
136
|
+
None,
|
137
|
+
)
|
138
|
+
print(f"\n\n created travel_folder with guid {travel_folder}")
|
139
|
+
|
140
|
+
|
141
|
+
except (
|
142
|
+
InvalidParameterException,
|
143
|
+
PropertyServerException,
|
144
|
+
UserNotAuthorizedException,
|
145
|
+
) as e:
|
146
|
+
console.print_exception(show_locals=True)
|
147
|
+
|
148
|
+
finally:
|
149
|
+
c_client.close_session()
|
@@ -0,0 +1,139 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
A simple viewer for collections - provide the root and we display the hierarchy
|
7
|
+
|
8
|
+
"""
|
9
|
+
|
10
|
+
import argparse
|
11
|
+
import os
|
12
|
+
from rich import print
|
13
|
+
from rich.panel import Panel
|
14
|
+
from rich.prompt import Prompt
|
15
|
+
from rich.text import Text
|
16
|
+
from rich.tree import Tree
|
17
|
+
|
18
|
+
from pyegeria import (
|
19
|
+
CollectionManager,
|
20
|
+
UserNotAuthorizedException,
|
21
|
+
PropertyServerException,
|
22
|
+
InvalidParameterException,
|
23
|
+
)
|
24
|
+
from pyegeria._exceptions import (
|
25
|
+
print_exception_response,
|
26
|
+
)
|
27
|
+
|
28
|
+
disable_ssl_warnings = True
|
29
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
30
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
31
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
32
|
+
EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
|
33
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
34
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
35
|
+
)
|
36
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
37
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
38
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
39
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
40
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
41
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
42
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
43
|
+
|
44
|
+
|
45
|
+
def collection_viewer(
|
46
|
+
root: str,
|
47
|
+
server_name: str,
|
48
|
+
platform_url: str,
|
49
|
+
user: str,
|
50
|
+
user_password: str,
|
51
|
+
jupyter: bool = EGERIA_JUPYTER,
|
52
|
+
width: int = EGERIA_WIDTH,
|
53
|
+
):
|
54
|
+
"""A simple collection viewer"""
|
55
|
+
|
56
|
+
def walk_collection_hierarchy(
|
57
|
+
collection_client: CollectionManager, root_collection_name: str, tree: Tree
|
58
|
+
) -> None:
|
59
|
+
"""Recursively build a Tree with collection contents."""
|
60
|
+
members = collection_client.get_member_list(root_collection_name)
|
61
|
+
if members:
|
62
|
+
for member in members:
|
63
|
+
style = "bold white on black"
|
64
|
+
text_collection_name = Text(
|
65
|
+
f"[bold white on black]Name: {member['name']}", style=style
|
66
|
+
)
|
67
|
+
text_qualified_name = Text(
|
68
|
+
f"* QualifiedName: {member['qualifiedName']}"
|
69
|
+
)
|
70
|
+
text_guid = Text(f"* GUID: {member['guid']}", "green")
|
71
|
+
text_collection_type = Text(
|
72
|
+
f"* Collection Type: {member['collectionType']}"
|
73
|
+
)
|
74
|
+
text_description = Text(f"* Description: {member['description']}")
|
75
|
+
p = Panel.fit(
|
76
|
+
f"{text_collection_name}[green]\n{text_qualified_name}\n{text_guid}\n"
|
77
|
+
f"{text_collection_type}\n{text_description}"
|
78
|
+
)
|
79
|
+
tt = tree.add(p, style=style)
|
80
|
+
|
81
|
+
children = collection_client.get_collection_members(member["guid"])
|
82
|
+
if type(children) is list:
|
83
|
+
branch = tt.add(
|
84
|
+
f"[bold magenta on black]Members",
|
85
|
+
style=style,
|
86
|
+
guide_style=style,
|
87
|
+
)
|
88
|
+
walk_collection_hierarchy(
|
89
|
+
collection_client, member["qualifiedName"], branch
|
90
|
+
),
|
91
|
+
else:
|
92
|
+
tt = tree.add(
|
93
|
+
f"[bold magenta on black]No collections match {root_collection_name}"
|
94
|
+
)
|
95
|
+
|
96
|
+
try:
|
97
|
+
tree = Tree(
|
98
|
+
f"[bold bright green on black]{root}", guide_style="bold bright_blue"
|
99
|
+
)
|
100
|
+
c_client = CollectionManager(server_name, platform_url, user_id=user)
|
101
|
+
|
102
|
+
token = c_client.create_egeria_bearer_token(user, user_password)
|
103
|
+
walk_collection_hierarchy(c_client, root, tree)
|
104
|
+
print(tree)
|
105
|
+
|
106
|
+
except (
|
107
|
+
InvalidParameterException,
|
108
|
+
PropertyServerException,
|
109
|
+
UserNotAuthorizedException,
|
110
|
+
) as e:
|
111
|
+
print_exception_response(e)
|
112
|
+
|
113
|
+
|
114
|
+
def main():
|
115
|
+
parser = argparse.ArgumentParser()
|
116
|
+
|
117
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
118
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
119
|
+
parser.add_argument("--userid", help="User Id")
|
120
|
+
parser.add_argument("--password", help="User Password")
|
121
|
+
args = parser.parse_args()
|
122
|
+
|
123
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
124
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
125
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
126
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
127
|
+
|
128
|
+
try:
|
129
|
+
root_collection = Prompt.ask(
|
130
|
+
"Enter the Root Collection to start from:",
|
131
|
+
default="Root Sustainability Collection",
|
132
|
+
)
|
133
|
+
collection_viewer(root_collection, server, url, userid, user_pass)
|
134
|
+
except KeyboardInterrupt:
|
135
|
+
pass
|
136
|
+
|
137
|
+
|
138
|
+
if __name__ == "__main__":
|
139
|
+
main()
|