pyegeria 0.3.8__py3-none-any.whl → 0.4.0__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.
- pyegeria/Xfeedback_manager_omvs.py +238 -0
- pyegeria/Xloaded_resources_omvs.py +91 -0
- pyegeria/__init__.py +15 -12
- pyegeria/_client.py +4 -6
- pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
- pyegeria/_exceptions.py +5 -6
- pyegeria/_globals.py +3 -1
- pyegeria/asset_catalog_omvs.py +672 -0
- pyegeria/automated_curation_omvs.py +627 -359
- pyegeria/collection_manager_omvs.py +187 -248
- pyegeria/core_guids.py +128 -0
- pyegeria/core_omag_server_config.py +1 -5
- pyegeria/full_omag_server_config.py +53 -83
- pyegeria/glossary_browser_omvs.py +2208 -0
- pyegeria/glossary_manager_omvs.py +3002 -0
- pyegeria/my_profile_omvs.py +2 -7
- pyegeria/platform_services.py +0 -3
- pyegeria/project_manager_omvs.py +9 -15
- pyegeria/registered_info.py +12 -52
- pyegeria/runtime_manager_omvs.py +967 -0
- pyegeria/server_operations.py +1 -5
- pyegeria/valid_metadata_omvs.py +204 -43
- pyegeria-0.4.0.data/scripts/Create_Collection_Sample.py +292 -0
- pyegeria-0.4.0.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
- pyegeria-0.4.0.data/scripts/get_guid_info.py +86 -0
- pyegeria-0.3.8.data/scripts/view_my_profile.py → pyegeria-0.4.0.data/scripts/get_my_profile.py +8 -34
- {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/get_tech_details.py +1 -37
- pyegeria-0.4.0.data/scripts/get_tech_type_elements.py +137 -0
- pyegeria-0.4.0.data/scripts/get_tech_type_template.py +137 -0
- {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/list_asset_types.py +3 -25
- pyegeria-0.4.0.data/scripts/list_assets.py +138 -0
- pyegeria-0.3.8.data/scripts/project_list_viewer.py → pyegeria-0.4.0.data/scripts/list_projects.py +13 -27
- pyegeria-0.4.0.data/scripts/list_registered_services.py +135 -0
- pyegeria-0.3.8.data/scripts/get_relationship_types.py → pyegeria-0.4.0.data/scripts/list_relationship_types.py +25 -43
- pyegeria-0.4.0.data/scripts/list_tech_templates.py +134 -0
- pyegeria-0.3.8.data/scripts/find_todos.py → pyegeria-0.4.0.data/scripts/list_todos.py +11 -39
- pyegeria-0.4.0.data/scripts/list_valid_metadata_values.py +144 -0
- pyegeria-0.4.0.data/scripts/view_asset_graph.py +236 -0
- pyegeria-0.3.8.data/scripts/multi-server_status.py → pyegeria-0.4.0.data/scripts/view_coco_status.py +17 -39
- pyegeria-0.3.8.data/scripts/collection_viewer.py → pyegeria-0.4.0.data/scripts/view_collection.py +12 -31
- pyegeria-0.3.8.data/scripts/engine_action_status.py → pyegeria-0.4.0.data/scripts/view_eng_action_status.py +17 -31
- pyegeria-0.3.8.data/scripts/glossary_view.py → pyegeria-0.4.0.data/scripts/view_glossary.py +2 -2
- pyegeria-0.3.8.data/scripts/gov_engine_status.py → pyegeria-0.4.0.data/scripts/view_gov_eng_status.py +0 -1
- pyegeria-0.3.8.data/scripts/integration_daemon_status.py → pyegeria-0.4.0.data/scripts/view_integ_daemon_status.py +30 -42
- pyegeria-0.3.8.data/scripts/my_todos.py → pyegeria-0.4.0.data/scripts/view_my_todos.py +1 -1
- pyegeria-0.3.8.data/scripts/open_todos.py → pyegeria-0.4.0.data/scripts/view_open_todos.py +3 -24
- pyegeria-0.4.0.data/scripts/view_platform_status.py +123 -0
- pyegeria-0.3.8.data/scripts/server_status.py → pyegeria-0.4.0.data/scripts/view_server_status.py +1 -20
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/METADATA +5 -4
- pyegeria-0.4.0.dist-info/RECORD +58 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/WHEEL +1 -1
- pyegeria/glossary_omvs.py +0 -789
- pyegeria/loaded_resources_omvs.py +0 -159
- pyegeria-0.3.8.dist-info/RECORD +0 -42
- /pyegeria/{governance_author.py → action_author_omvs.py} +0 -0
- /pyegeria-0.3.8.data/scripts/get_tech_types.py → /pyegeria-0.4.0.data/scripts/list_tech_types.py +0 -0
- /pyegeria-0.3.8.data/scripts/server_status_widget.py → /pyegeria-0.4.0.data/scripts/view_server_list.py +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/LICENSE +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,292 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
This sample creates the collection structure show in https://egeria-project.org/types/0/0021-Collections
|
6
|
+
|
7
|
+
"""
|
8
|
+
|
9
|
+
import time
|
10
|
+
|
11
|
+
from rich import print
|
12
|
+
from rich.console import Console
|
13
|
+
|
14
|
+
from pyegeria import CollectionManager, InvalidParameterException, PropertyServerException, UserNotAuthorizedException
|
15
|
+
|
16
|
+
view_server = 'view-server'
|
17
|
+
platform_url = 'https://localhost:9443'
|
18
|
+
user = 'erinoverview'
|
19
|
+
console = Console()
|
20
|
+
|
21
|
+
try:
|
22
|
+
c_client = CollectionManager(view_server, platform_url,
|
23
|
+
user_id=user)
|
24
|
+
|
25
|
+
token = c_client.create_egeria_bearer_token(user, "secret")
|
26
|
+
start_time = time.perf_counter()
|
27
|
+
|
28
|
+
# Create a Data Products Root collection
|
29
|
+
anchor_guid = None
|
30
|
+
parent_guid = None
|
31
|
+
parent_relationship_type_name = None
|
32
|
+
parent_at_end1 = False
|
33
|
+
display_name = "Digital Products Root"
|
34
|
+
description = "This is the root catalog for digital products"
|
35
|
+
collection_type = "Digital Products Root"
|
36
|
+
is_own_anchor = True
|
37
|
+
|
38
|
+
response = c_client.create_root_collection(anchor_guid, parent_guid,
|
39
|
+
parent_relationship_type_name, parent_at_end1,
|
40
|
+
display_name, description, collection_type,
|
41
|
+
is_own_anchor)
|
42
|
+
# Create first folder for Agriculture Insights
|
43
|
+
parent_guid = "97bbfe07-6696-4550-bf8b-6b577d25bef0"
|
44
|
+
parent_relationship_type_name = "CollectionMembership"
|
45
|
+
display_name = "Agriculture Insights Collection"
|
46
|
+
description = "A folder for agricultural insights data product collections"
|
47
|
+
collection_type = "Digital Product Marketplace"
|
48
|
+
|
49
|
+
folder1 = c_client.create_folder_collection(None, parent_guid,
|
50
|
+
parent_relationship_type_name,
|
51
|
+
True, display_name, description,
|
52
|
+
collection_type, True, "DATE_CREATED",
|
53
|
+
None
|
54
|
+
)
|
55
|
+
print(f"\n\n created a folder with guid {folder1}")
|
56
|
+
# create second folder for Earth Observations
|
57
|
+
display_name = "Earth Observation Data Collection"
|
58
|
+
description = "A folder for Earth Observation data product collections"
|
59
|
+
|
60
|
+
folder2 = c_client.create_folder_collection(None, parent_guid,
|
61
|
+
parent_relationship_type_name,
|
62
|
+
True, display_name, description,
|
63
|
+
collection_type, True, "DATE_CREATED",
|
64
|
+
None
|
65
|
+
)
|
66
|
+
print(f"\n\n created a folder with guid {folder2}")
|
67
|
+
|
68
|
+
# create a digital product, child of folder 1, for Land Use products
|
69
|
+
parent_guid = folder1
|
70
|
+
parent_relationship_type_name = "CollectionMembership"
|
71
|
+
display_name = "Land Use Classification"
|
72
|
+
description = "Land use classification assets"
|
73
|
+
collection_type = "Digital Product"
|
74
|
+
classification_name = "Digital Product"
|
75
|
+
body_3 = {
|
76
|
+
"class": "NewDigitalProductRequestBody",
|
77
|
+
"isOwnAnchor": True,
|
78
|
+
"parentGUID": parent_guid,
|
79
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
80
|
+
"parentAtEnd1": True,
|
81
|
+
"collectionProperties": {
|
82
|
+
"class": "CollectionProperties",
|
83
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
84
|
+
"name": display_name,
|
85
|
+
"description": description,
|
86
|
+
"collectionType": collection_type,
|
87
|
+
"collectionOrdering": "DATE_CREATED",
|
88
|
+
},
|
89
|
+
"digitalProductProperties": {
|
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
|
+
}
|
106
|
+
}
|
107
|
+
folder3 = c_client.create_digital_product(body_3)
|
108
|
+
print(f"\n\n created a collection with guid {folder3}")
|
109
|
+
|
110
|
+
# create a fourth collection, a digital product, child of folder 2, for Landsat 8
|
111
|
+
parent_guid = folder2
|
112
|
+
display_name = "Landsat 8"
|
113
|
+
description = "Landsat 8 data products"
|
114
|
+
|
115
|
+
body_4 = {
|
116
|
+
"class": "NewDigitalProductRequestBody",
|
117
|
+
"isOwnAnchor": True,
|
118
|
+
"parentGUID": parent_guid,
|
119
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
120
|
+
"parentAtEnd1": True,
|
121
|
+
"collectionProperties": {
|
122
|
+
"class": "CollectionProperties",
|
123
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
124
|
+
"name": display_name,
|
125
|
+
"description": description,
|
126
|
+
"collectionType": collection_type,
|
127
|
+
"collectionOrdering": "DATE_CREATED",
|
128
|
+
},
|
129
|
+
"digitalProductProperties": {
|
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
|
+
}
|
146
|
+
}
|
147
|
+
folder4 = c_client.create_digital_product(body_4)
|
148
|
+
print(f"\n\n created a collection with guid {folder4}")
|
149
|
+
|
150
|
+
# Now create a 5th collection for sentinel 2 data
|
151
|
+
parent_guid = folder2
|
152
|
+
display_name = "Sentinel 2"
|
153
|
+
description = "Sentinel 2 products"
|
154
|
+
parent_relationship_type_name = "CollectionMembership"
|
155
|
+
collection_type = "Digital Product Marketplace"
|
156
|
+
|
157
|
+
folder5 = c_client.create_folder_collection(None, parent_guid,
|
158
|
+
parent_relationship_type_name,
|
159
|
+
True, display_name, description,
|
160
|
+
collection_type, True, "DATE_CREATED",
|
161
|
+
None
|
162
|
+
)
|
163
|
+
# Create a DigitalProduct for Level-1B
|
164
|
+
parent_guid = folder5
|
165
|
+
display_name = "Sentinel 2 - Level 1B"
|
166
|
+
description = "Level 1B of Sentinel 2"
|
167
|
+
|
168
|
+
body_6 = {
|
169
|
+
"class": "NewDigitalProductRequestBody",
|
170
|
+
"anchor_guid": parent_guid,
|
171
|
+
"isOwnAnchor": False,
|
172
|
+
"parentGUID": parent_guid,
|
173
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
174
|
+
"parentAtEnd1": True,
|
175
|
+
"collectionProperties": {
|
176
|
+
"class": "CollectionProperties",
|
177
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
178
|
+
"name": display_name,
|
179
|
+
"description": description,
|
180
|
+
"collectionType": collection_type,
|
181
|
+
"collectionOrdering": "DATE_CREATED",
|
182
|
+
},
|
183
|
+
"digitalProductProperties": {
|
184
|
+
"class": "DigitalProductProperties",
|
185
|
+
"productStatus": "ACTIVE",
|
186
|
+
"productName": "Sentinel 2 - Level 1B",
|
187
|
+
"productType": "Geospatial Data Assets",
|
188
|
+
"description": description,
|
189
|
+
"introductionDate": "2024-01-01",
|
190
|
+
"maturity": "Mature",
|
191
|
+
"serviceLife": "3 years",
|
192
|
+
"currentVersion": "V1.5",
|
193
|
+
"nextVersion": "2024-06-01",
|
194
|
+
"withdrawDate": "2030-01-01",
|
195
|
+
"additionalProperties": {
|
196
|
+
"thought_id": "a guid",
|
197
|
+
"license": "cc-by-sa",
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
folder6 = c_client.create_digital_product(body_6)
|
202
|
+
print(f"\n\n created a collection with guid {folder6}")
|
203
|
+
|
204
|
+
# now lets create a digital product for - Level - 1c
|
205
|
+
parent_guid = folder5
|
206
|
+
display_name = "Sentinel 2 - Level 1C"
|
207
|
+
description = "Level 1C of Sentinel 2"
|
208
|
+
body_7 = {
|
209
|
+
"class": "NewDigitalProductRequestBody",
|
210
|
+
"anchor_guid": parent_guid,
|
211
|
+
"isOwnAnchor": False,
|
212
|
+
"parentGUID": parent_guid,
|
213
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
214
|
+
"parentAtEnd1": True,
|
215
|
+
"collectionProperties": {
|
216
|
+
"class": "CollectionProperties",
|
217
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
218
|
+
"name": display_name,
|
219
|
+
"description": description,
|
220
|
+
"collectionType": collection_type,
|
221
|
+
"collectionOrdering": "DATE_CREATED",
|
222
|
+
},
|
223
|
+
"digitalProductProperties": {
|
224
|
+
"class": "DigitalProductProperties",
|
225
|
+
"productStatus": "ACTIVE",
|
226
|
+
"productName": "Sentinel 2 - Level 1B",
|
227
|
+
"productType": "Geospatial Data Assets",
|
228
|
+
"description": description,
|
229
|
+
"introductionDate": "2024-01-01",
|
230
|
+
"maturity": "Mature",
|
231
|
+
"serviceLife": "3 years",
|
232
|
+
"currentVersion": "V1.5",
|
233
|
+
"nextVersion": "2024-06-01",
|
234
|
+
"withdrawDate": "2030-01-01",
|
235
|
+
"additionalProperties": {
|
236
|
+
"thought_id": "a guid",
|
237
|
+
"license": "cc-by-sa",
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
folder7 = c_client.create_digital_product(body_7)
|
242
|
+
print(f"\n\n created a collection with guid {folder7}")
|
243
|
+
|
244
|
+
# now let's create a digital product for - Level - 2A
|
245
|
+
parent_guid = folder5
|
246
|
+
display_name = "Sentinel 2 - Level 2A"
|
247
|
+
description = "Level 2A of Sentinel 2"
|
248
|
+
body_8 = {
|
249
|
+
"class": "NewDigitalProductRequestBody",
|
250
|
+
"anchor_guid": parent_guid,
|
251
|
+
"isOwnAnchor": False,
|
252
|
+
"parentGUID": parent_guid,
|
253
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
254
|
+
"parentAtEnd1": True,
|
255
|
+
"collectionProperties": {
|
256
|
+
"class": "CollectionProperties",
|
257
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
258
|
+
"name": display_name,
|
259
|
+
"description": description,
|
260
|
+
"collectionType": collection_type,
|
261
|
+
"collectionOrdering": "DATE_CREATED",
|
262
|
+
},
|
263
|
+
"digitalProductProperties": {
|
264
|
+
"class": "DigitalProductProperties",
|
265
|
+
"productStatus": "ACTIVE",
|
266
|
+
"productName": "Sentinel 2 - Level 1B",
|
267
|
+
"productType": "Geospatial Data Assets",
|
268
|
+
"description": description,
|
269
|
+
"introductionDate": "2024-01-01",
|
270
|
+
"maturity": "Mature",
|
271
|
+
"serviceLife": "3 years",
|
272
|
+
"currentVersion": "V1.5",
|
273
|
+
"nextVersion": "2024-06-01",
|
274
|
+
"withdrawDate": "2030-01-01",
|
275
|
+
"additionalProperties": {
|
276
|
+
"thought_id": "a guid",
|
277
|
+
"license": "cc-by-sa",
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}
|
281
|
+
folder8 = c_client.create_digital_product(body_8)
|
282
|
+
print(f"\n\n created a collection with guid {folder8}")
|
283
|
+
|
284
|
+
except (
|
285
|
+
InvalidParameterException,
|
286
|
+
PropertyServerException,
|
287
|
+
UserNotAuthorizedException
|
288
|
+
) as e:
|
289
|
+
console.print_exception(show_locals=True)
|
290
|
+
|
291
|
+
finally:
|
292
|
+
c_client.close_session()
|
@@ -0,0 +1,115 @@
|
|
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 CollectionManager, InvalidParameterException, PropertyServerException, UserNotAuthorizedException
|
17
|
+
|
18
|
+
view_server = 'view-server'
|
19
|
+
platform_url = 'https://localhost:9443'
|
20
|
+
user = 'erinoverview'
|
21
|
+
console = Console()
|
22
|
+
|
23
|
+
try:
|
24
|
+
c_client = CollectionManager(view_server, platform_url,
|
25
|
+
user_id=user)
|
26
|
+
|
27
|
+
token = c_client.create_egeria_bearer_token(user, "secret")
|
28
|
+
start_time = time.perf_counter()
|
29
|
+
|
30
|
+
# Create a root collection for the sustainability project
|
31
|
+
parent_guid = None
|
32
|
+
parent_relationship_type_name = None
|
33
|
+
display_name = "Root Sustainability Collection"
|
34
|
+
description = "The root collection for our sustainability reporting project."
|
35
|
+
collection_type = "Sustainability Collection"
|
36
|
+
|
37
|
+
root = c_client.create_root_collection(None, parent_guid,
|
38
|
+
parent_relationship_type_name,
|
39
|
+
False, display_name, description,
|
40
|
+
collection_type, True)
|
41
|
+
print(f"\n\n created a root with guid {root}")
|
42
|
+
# create a folder for Scope 1 Emissions
|
43
|
+
anchor_guid = root
|
44
|
+
parent_guid = root
|
45
|
+
parent_relationship_type_name = "CollectionMembership"
|
46
|
+
display_name = "Scope 1 Emissions"
|
47
|
+
description = "A folder for information about scope 1 emissions."
|
48
|
+
collection_type = "Sustainability Collection"
|
49
|
+
|
50
|
+
scope1_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
51
|
+
parent_relationship_type_name,
|
52
|
+
True, display_name, description,
|
53
|
+
collection_type, False, "DATE_CREATED",
|
54
|
+
None
|
55
|
+
)
|
56
|
+
print(f"\n\n created scope1_folder with guid {scope1_folder}")
|
57
|
+
|
58
|
+
# create a folder for Scope 2 Emissions.
|
59
|
+
anchor_guid = root
|
60
|
+
parent_guid = root
|
61
|
+
parent_relationship_type_name = "CollectionMembership"
|
62
|
+
display_name = "Scope 2 Emissions"
|
63
|
+
description = "A folder for information about scope 2 emissions."
|
64
|
+
collection_type = "Sustainability Collection"
|
65
|
+
|
66
|
+
scope2_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
67
|
+
parent_relationship_type_name,
|
68
|
+
True, display_name, description,
|
69
|
+
collection_type, False, "DATE_CREATED",
|
70
|
+
None
|
71
|
+
)
|
72
|
+
print(f"\n\n created scope2_folder with guid {scope2_folder}")
|
73
|
+
|
74
|
+
# create a folder for Scope 3 Emissions.
|
75
|
+
anchor_guid = root
|
76
|
+
parent_guid = root
|
77
|
+
parent_relationship_type_name = "CollectionMembership"
|
78
|
+
display_name = "Scope 3 Emissions"
|
79
|
+
description = "A folder for information about scope 3 emissions."
|
80
|
+
collection_type = "Sustainability Collection"
|
81
|
+
|
82
|
+
scope3_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
83
|
+
parent_relationship_type_name,
|
84
|
+
True, display_name, description,
|
85
|
+
collection_type, False, "DATE_CREATED",
|
86
|
+
None
|
87
|
+
)
|
88
|
+
print(f"\n\n created scope3_folder with guid {scope3_folder}")
|
89
|
+
|
90
|
+
# create a folder for Business Travel Emissions.
|
91
|
+
anchor_guid = root
|
92
|
+
parent_guid = scope3_folder
|
93
|
+
parent_relationship_type_name = "CollectionMembership"
|
94
|
+
display_name = "Business Travel Emissions"
|
95
|
+
description = "A folder for information about scope 3 business travel emissions."
|
96
|
+
collection_type = "Sustainability Collection"
|
97
|
+
|
98
|
+
travel_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
99
|
+
parent_relationship_type_name,
|
100
|
+
True, display_name, description,
|
101
|
+
collection_type, False, "DATE_CREATED",
|
102
|
+
None
|
103
|
+
)
|
104
|
+
print(f"\n\n created travel_folder with guid {travel_folder}")
|
105
|
+
|
106
|
+
|
107
|
+
except (
|
108
|
+
InvalidParameterException,
|
109
|
+
PropertyServerException,
|
110
|
+
UserNotAuthorizedException
|
111
|
+
) as e:
|
112
|
+
console.print_exception(show_locals=True)
|
113
|
+
|
114
|
+
finally:
|
115
|
+
c_client.close_session()
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#!python
|
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
|
+
|
13
|
+
import argparse
|
14
|
+
import httpx
|
15
|
+
import json
|
16
|
+
import time
|
17
|
+
|
18
|
+
from rich import box
|
19
|
+
from rich import print
|
20
|
+
from rich.console import Console
|
21
|
+
from rich.prompt import Prompt
|
22
|
+
from rich.text import Text
|
23
|
+
from rich.tree import Tree
|
24
|
+
from rich.json import JSON
|
25
|
+
|
26
|
+
from pyegeria import (
|
27
|
+
InvalidParameterException,
|
28
|
+
PropertyServerException,
|
29
|
+
UserNotAuthorizedException,
|
30
|
+
print_exception_response,
|
31
|
+
Client
|
32
|
+
)
|
33
|
+
from pyegeria import ProjectManager
|
34
|
+
|
35
|
+
|
36
|
+
def display_guid(guid: str, server: str, url: str, username: str):
|
37
|
+
|
38
|
+
c = Client(server, url, user_id=username)
|
39
|
+
url = (f"{url}/servers/{server}/open-metadata/repository-services/users/{username}/"
|
40
|
+
f"instances/entity/{guid}")
|
41
|
+
|
42
|
+
|
43
|
+
try:
|
44
|
+
console = Console(width = 180)
|
45
|
+
r = c.make_request("GET", url)
|
46
|
+
e = r.json()['entity']
|
47
|
+
p = e['properties']['instanceProperties']
|
48
|
+
|
49
|
+
type_name = Text(f"Type is: {e['type']['typeDefName']}")
|
50
|
+
metadataCollection = Text(f"Metadadata Collection: {e['metadataCollectionName']}")
|
51
|
+
created = Text(f"Created at: {e['createTime']}")
|
52
|
+
details = Text(f"Details: {json.dumps(p, indent=2)}")
|
53
|
+
|
54
|
+
tree = Tree(f"[bold bright green]{guid}", guide_style="bold bright_blue")
|
55
|
+
|
56
|
+
tree = tree.add(type_name)
|
57
|
+
tree.add(metadataCollection)
|
58
|
+
tree.add(created)
|
59
|
+
tree.add(details)
|
60
|
+
print(tree)
|
61
|
+
|
62
|
+
c.close_session()
|
63
|
+
|
64
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
|
65
|
+
if type(e) is str:
|
66
|
+
print(e)
|
67
|
+
else:
|
68
|
+
print_exception_response(e)
|
69
|
+
|
70
|
+
if __name__ == "__main__":
|
71
|
+
|
72
|
+
parser = argparse.ArgumentParser()
|
73
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
74
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
75
|
+
parser.add_argument("--userid", help="User Id")
|
76
|
+
|
77
|
+
# parser.add_argument("--sponsor", help="Name of sponsor to search")
|
78
|
+
args = parser.parse_args()
|
79
|
+
|
80
|
+
server = args.server if args.server is not None else "active-metadata-store"
|
81
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
82
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
83
|
+
|
84
|
+
guid = Prompt.ask("Enter the GUID to retrieve:", default=None)
|
85
|
+
|
86
|
+
display_guid(guid, server, url, userid)
|
pyegeria-0.3.8.data/scripts/view_my_profile.py → pyegeria-0.4.0.data/scripts/get_my_profile.py
RENAMED
@@ -9,51 +9,25 @@ Unit tests for the Utils helper functions using the Pytest framework.
|
|
9
9
|
A simple display for my profile
|
10
10
|
"""
|
11
11
|
|
12
|
-
import time
|
13
|
-
import json
|
14
12
|
import argparse
|
13
|
+
import time
|
14
|
+
|
15
|
+
from rich import box
|
16
|
+
from rich.console import Console
|
17
|
+
from rich.table import Table
|
18
|
+
|
15
19
|
from pyegeria import (
|
16
20
|
InvalidParameterException,
|
17
21
|
PropertyServerException,
|
18
22
|
UserNotAuthorizedException,
|
19
23
|
print_exception_response,
|
20
24
|
)
|
21
|
-
from rich.table import Table
|
22
|
-
from rich.live import Live
|
23
|
-
from rich import box
|
24
|
-
from rich.prompt import Prompt
|
25
|
-
from rich.tree import Tree
|
26
|
-
from rich import print
|
27
|
-
from rich.console import Console
|
28
25
|
from pyegeria.my_profile_omvs import MyProfile
|
29
26
|
|
30
|
-
from pyegeria.server_operations import ServerOps
|
31
|
-
from pyegeria.gov_engine import GovEng
|
32
|
-
from pyegeria.glossary_omvs import GlossaryBrowser
|
33
27
|
disable_ssl_warnings = True
|
34
28
|
|
35
|
-
good_platform1_url = "https://127.0.0.1:9443"
|
36
|
-
good_platform2_url = "https://egeria.pdr-associates.com:7443"
|
37
|
-
bad_platform1_url = "https://localhost:9443"
|
38
|
-
|
39
|
-
# good_platform1_url = "https://127.0.0.1:30080"
|
40
|
-
# good_platform2_url = "https://127.0.0.1:30081"
|
41
|
-
# bad_platform1_url = "https://localhost:9443"
|
42
|
-
|
43
|
-
good_user_1 = "garygeeke"
|
44
|
-
good_user_2 = "erinoverview"
|
45
|
-
bad_user_1 = "eviledna"
|
46
|
-
bad_user_2 = ""
|
47
|
-
|
48
|
-
good_server_1 = "active-metadata-store"
|
49
|
-
good_server_2 = "simple-metadata-store"
|
50
|
-
good_server_3 = "view-server"
|
51
|
-
good_server_4 = "engine-host"
|
52
|
-
bad_server_1 = "coco"
|
53
|
-
bad_server_2 = ""
|
54
|
-
|
55
29
|
|
56
|
-
def display_my_profiles(server: str
|
30
|
+
def display_my_profiles(server: str, url: str, username: str):
|
57
31
|
|
58
32
|
m_client = MyProfile(server, url, user_id=username)
|
59
33
|
token = m_client.create_egeria_bearer_token(username, "secret")
|
@@ -62,7 +36,7 @@ def display_my_profiles(server: str = good_server_3, url: str = good_platform1_u
|
|
62
36
|
def generate_table() -> Table:
|
63
37
|
"""Make a new table."""
|
64
38
|
table = Table(
|
65
|
-
title=f"My Profile Information {
|
39
|
+
title=f"My Profile Information {url} @ {time.asctime()}",
|
66
40
|
# style = "black on grey66",
|
67
41
|
header_style="white on dark_blue",
|
68
42
|
show_lines=True,
|
@@ -49,7 +49,7 @@ def tech_viewer(tech: str, server_name:str, platform_url:str, user:str):
|
|
49
49
|
tech_details = a_client.get_technology_type_detail(tech)
|
50
50
|
if type(tech_details) is dict:
|
51
51
|
style = ""
|
52
|
-
l2 = tree.add(Text(f"Name: {tech_details
|
52
|
+
l2 = tree.add(Text(f"Name: {tech_details.get('name',' ')}", "bold red"))
|
53
53
|
l2 = tree.add(Text(f"* QualifiedName: {tech_details['qualifiedName']}","bold white"))
|
54
54
|
l2 = tree.add(Text(f"* Category: {tech_details['category']}", "bold white"))
|
55
55
|
l2 = tree.add(Text(f"* Technology Description: {tech_details['description']}", "bold white"))
|
@@ -57,42 +57,6 @@ def tech_viewer(tech: str, server_name:str, platform_url:str, user:str):
|
|
57
57
|
if ext_ref is not None:
|
58
58
|
l2 = tree.add(Text(f'* URI: {ext_ref[0]["properties"]["uri"]}', "bold white"))
|
59
59
|
|
60
|
-
# catalog_temp = tech_details.get("catalogTemplates", None)
|
61
|
-
# if catalog_temp is not None:
|
62
|
-
# l2 = tree.add("Catalog Templates")
|
63
|
-
# for catalog in catalog_temp:
|
64
|
-
# cat_name = catalog["relatedElement"].get("name", None)
|
65
|
-
# if cat_name is None:
|
66
|
-
# continue
|
67
|
-
# l3 = l2.add(f'[white] Template Name: {cat_name}, style=style)')
|
68
|
-
# l3 = l2.add(f'[white] Template GUID: {catalog["relatedElement"].get("guid", None)}, style=style)')
|
69
|
-
# classifications = catalog["relatedElement"].get("classifications", None)
|
70
|
-
# if classifications is not None:
|
71
|
-
# l4 = l3.add(f"[red]Classifications")
|
72
|
-
# for classification in classifications:
|
73
|
-
# props = classification['classificationProperties']
|
74
|
-
# c_name = Text(f'[white] Name: {props.get("name", None)}[white]')
|
75
|
-
# c_ver = Text(f'[white] Version: {props.get("versionIdentifier", None)}')
|
76
|
-
# c_desc = Text(f'[white] Description: {props.get("description", None)}')
|
77
|
-
# class_text = (f"[bold red]Classification \n"
|
78
|
-
# f"[white] Name: {c_name} \n"
|
79
|
-
# f"[white] Version: {c_ver} \n"
|
80
|
-
# f"[white] Description: {c_desc}")
|
81
|
-
# c = Panel.fit(class_text)
|
82
|
-
# l4 = l3.add(c, style = style)
|
83
|
-
#
|
84
|
-
# placeholders = catalog.get("specification", None)
|
85
|
-
# if placeholders is not None:
|
86
|
-
# specs = placeholders.get("placeholderProperty", None)
|
87
|
-
# if specs is not None:
|
88
|
-
# l4 = l3.add(f"[red]Placeholder Properties")
|
89
|
-
# for spec in specs:
|
90
|
-
# l5 = l4.add(f'[white] Placeholder Name: {spec.get("placeholderName", None)})')
|
91
|
-
# l5 = l4.add(f'[white] Data Type: {spec["dataType"]}')
|
92
|
-
# l5 = l4.add(f'[white] Placeholder Name: {str(spec["required"])})')
|
93
|
-
# l5 = l4.add(f'[white] Example: {spec.get("example", None)})')
|
94
|
-
# l5 = l4.add(f'[white] Description: {spec.get("description", None)}[white])')
|
95
|
-
|
96
60
|
|
97
61
|
resource_list = tech_details.get('resourceList',None)
|
98
62
|
if resource_list:
|