pyegeria 0.5.0__tar.gz → 0.5.2__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.5.0 → pyegeria-0.5.2}/PKG-INFO +8 -9
- pyegeria-0.5.2/examples/doc_samples/Create_Collection_Sample.py +292 -0
- pyegeria-0.5.2/examples/doc_samples/Create_Sustainability_Collection_Sample.py +115 -0
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/catalog_user/list_assets.py +5 -2
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/catalog_user/view_asset_graph.py +15 -11
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/catalog_user/view_collection.py +4 -1
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/catalog_user/view_glossary.py +5 -2
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/developer/get_guid_info.py +7 -8
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/developer/get_tech_details.py +10 -21
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/developer/list_asset_types.py +4 -1
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/developer/list_registered_services.py +4 -1
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/developer/list_relationship_types.py +5 -3
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/developer/list_tech_templates.py +3 -2
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/developer/list_tech_types.py +4 -2
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/developer/list_valid_metadata_values.py +14 -12
- pyegeria-0.5.2/examples/widgets/operational/__init__.py +7 -0
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/operational/get_tech_type_elements.py +4 -1
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/operational/get_tech_type_template.py +10 -13
- pyegeria-0.5.2/examples/widgets/operational/view_asset_events.py +78 -0
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/operational/view_coco_status.py +4 -1
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/operational/view_eng_action_status.py +4 -1
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/operational/view_gov_eng_status.py +4 -1
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/operational/view_integ_daemon_status.py +4 -3
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/operational/view_platform_status.py +5 -1
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/operational/view_server_list.py +4 -1
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/operational/view_server_status.py +6 -1
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/personal_organizer/get_my_profile.py +5 -2
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/personal_organizer/list_projects.py +5 -3
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/personal_organizer/list_todos.py +5 -2
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/personal_organizer/view_my_todos.py +7 -10
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/personal_organizer/view_open_todos.py +5 -1
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/__init__.py +3 -2
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/utils.py +59 -61
- pyegeria-0.5.2/pyproject.toml +77 -0
- pyegeria-0.5.0/examples/widgets/catalog_user/__init__.py +0 -10
- pyegeria-0.5.0/examples/widgets/operational/view_asset_events.py +0 -77
- pyegeria-0.5.0/pyproject.toml +0 -57
- pyegeria-0.5.0/src/pyegeria/config.toml +0 -11
- {pyegeria-0.5.0 → pyegeria-0.5.2}/LICENSE +0 -0
- {pyegeria-0.5.0 → pyegeria-0.5.2}/README.md +0 -0
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/catalog_user/README.md +0 -0
- {pyegeria-0.5.0/examples/widgets/developer → pyegeria-0.5.2/examples/widgets/catalog_user}/__init__.py +0 -0
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/developer/README.md +0 -0
- {pyegeria-0.5.0/examples/widgets/operational → pyegeria-0.5.2/examples/widgets/developer}/__init__.py +0 -0
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/operational/README.md +0 -0
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/personal_organizer/README.md +0 -0
- {pyegeria-0.5.0 → pyegeria-0.5.2}/examples/widgets/personal_organizer/__init__.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/Xfeedback_manager_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/Xloaded_resources_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/_client.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/_deprecated_gov_engine.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/_exceptions.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/_globals.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/_validators.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/action_author_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/asset_catalog_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/automated_curation_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/collection_manager_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/core_guids.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/core_omag_server_config.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/full_omag_server_config.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/glossary_browser_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/glossary_manager_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/my_profile_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/platform_services.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/project_manager_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/registered_info.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/runtime_manager_omvs.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/server_operations.py +0 -0
- {pyegeria-0.5.0/src → pyegeria-0.5.2}/pyegeria/valid_metadata_omvs.py +0 -0
@@ -1,25 +1,24 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyegeria
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.2
|
4
4
|
Summary: A python client for Egeria
|
5
5
|
Home-page: https://github.com/odpi/egeria-python
|
6
6
|
License: Apache 2.0
|
7
7
|
Keywords: egeria,metadata,governance
|
8
8
|
Author: Dan Wolfson
|
9
9
|
Author-email: dan.wolfson@pdr-associates.com
|
10
|
-
Requires-Python: >=3.
|
10
|
+
Requires-Python: >=3.12,<4.0
|
11
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
12
12
|
Classifier: License :: Other/Proprietary License
|
13
13
|
Classifier: Programming Language :: Python
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
17
15
|
Classifier: Programming Language :: Python :: 3.12
|
18
|
-
Requires-Dist:
|
19
|
-
Requires-Dist:
|
20
|
-
Requires-Dist:
|
21
|
-
Requires-Dist:
|
22
|
-
Requires-Dist:
|
16
|
+
Requires-Dist: confluent-kafka (>=2.5.0,<3.0.0)
|
17
|
+
Requires-Dist: httpx (>=0.27.0,<0.28.0)
|
18
|
+
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
19
|
+
Requires-Dist: rich (>=13.7.1,<14.0.0)
|
20
|
+
Requires-Dist: urllib3 (>=2.2.2,<3.0.0)
|
21
|
+
Requires-Dist: validators (>=0.32.0,<0.33.0)
|
23
22
|
Project-URL: Repository, https://github.com/odpi/egeria-python
|
24
23
|
Description-Content-Type: text/markdown
|
25
24
|
|
@@ -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(width=200)
|
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 = "f53ea7c8-3107-4477-8459-9bc63f9e69af"
|
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()
|
@@ -118,7 +118,7 @@ def display_assets(search_string: str, guid: str=None, server: str = good_server
|
|
118
118
|
print_exception_response(e)
|
119
119
|
assert e.related_http_code != "200", "Invalid parameters"
|
120
120
|
|
121
|
-
|
121
|
+
def main():
|
122
122
|
sus_guid = "f9b78b26-6025-43fa-9299-a905cc6d1575"
|
123
123
|
parser = argparse.ArgumentParser()
|
124
124
|
parser.add_argument("--server", help="Name of the server to display status for")
|
@@ -135,4 +135,7 @@ if __name__ == "__main__":
|
|
135
135
|
guid = sus_guid if args.sustainability else None
|
136
136
|
|
137
137
|
search_string = Prompt.ask("Enter the asset you are searching for:", default="*")
|
138
|
-
display_assets(search_string, guid,server, url, userid)
|
138
|
+
display_assets(search_string, guid,server, url, userid)
|
139
|
+
|
140
|
+
if __name__ == "__main__":
|
141
|
+
main()
|
@@ -40,7 +40,7 @@ guid_list = []
|
|
40
40
|
|
41
41
|
def asset_viewer(asset_guid: str, server_name:str, platform_url:str, user:str):
|
42
42
|
|
43
|
-
def build_classifications(classification: dict) ->
|
43
|
+
def build_classifications(classification: dict) -> Markdown:
|
44
44
|
|
45
45
|
class_md = ""
|
46
46
|
for c in classification:
|
@@ -49,7 +49,7 @@ def asset_viewer(asset_guid: str, server_name:str, platform_url:str, user:str):
|
|
49
49
|
continue
|
50
50
|
class_md += f"* Classification: {c_type}\n"
|
51
51
|
class_props = c.get("classificationProperties","---")
|
52
|
-
if type(class_props) is
|
52
|
+
if type(class_props) is list:
|
53
53
|
for prop in class_props.keys():
|
54
54
|
class_md += f"\t* {prop}: {class_props[prop]}\n"
|
55
55
|
if class_md == "":
|
@@ -125,6 +125,7 @@ def asset_viewer(asset_guid: str, server_name:str, platform_url:str, user:str):
|
|
125
125
|
asset_relationships = asset_graph["relationships"]
|
126
126
|
asset_class_md = build_classifications(asset_classifications)
|
127
127
|
|
128
|
+
|
128
129
|
asset_properties = asset_graph["extendedProperties"]
|
129
130
|
prop_md = "\n* Extended Properties:\n"
|
130
131
|
for prop in asset_properties:
|
@@ -189,24 +190,24 @@ def asset_viewer(asset_guid: str, server_name:str, platform_url:str, user:str):
|
|
189
190
|
f"* Created by: {relationship_created_by} at time {relationship_creation_time}\n"
|
190
191
|
)
|
191
192
|
rel_end1_md = (
|
192
|
-
f"
|
193
|
-
f"\
|
193
|
+
f"* End1:\n"
|
194
|
+
f"\t* Type: {rel_end1_type}\n"
|
194
195
|
f"\t* GUID: {rel_end1_guid}\n"
|
195
196
|
f"\t* Unique Name: {rel_end1_unique_name}\n"
|
196
197
|
)
|
197
198
|
|
198
|
-
|
199
|
-
|
199
|
+
if rel_end1_class_md is not None:
|
200
|
+
rel_end1_md = rel_end1_class_md + rel_end1_md
|
200
201
|
|
201
202
|
rel_end2_md = (
|
202
|
-
f"
|
203
|
-
f"\
|
203
|
+
f"* End2:\n"
|
204
|
+
f"\t* Type: {rel_end2_type}\n"
|
204
205
|
f"\t* GUID: {rel_end2_guid}\n"
|
205
206
|
f"\t* Unique Name: {rel_end2_unique_name}\n"
|
206
207
|
)
|
207
208
|
|
208
|
-
|
209
|
-
|
209
|
+
if rel_end2_class_md is not None:
|
210
|
+
rel_end1_md = rel_end2_class_md + rel_end1_md
|
210
211
|
#
|
211
212
|
# for prop in relationship_properties.keys():
|
212
213
|
# relationship_md += f"* {prop}: {relationship_properties[prop]}\n"
|
@@ -228,7 +229,7 @@ def asset_viewer(asset_guid: str, server_name:str, platform_url:str, user:str):
|
|
228
229
|
print_exception_response(e)
|
229
230
|
|
230
231
|
|
231
|
-
|
232
|
+
def main():
|
232
233
|
parser = argparse.ArgumentParser()
|
233
234
|
|
234
235
|
parser.add_argument("--server", help="Name of the server to display status for")
|
@@ -242,3 +243,6 @@ if __name__ == "__main__":
|
|
242
243
|
|
243
244
|
asset_guid = Prompt.ask("Enter the Asset GUID to view:", default="8e35b39e-6ee7-4d60-aff5-4b09406c5e79")
|
244
245
|
asset_viewer(asset_guid,server, url, userid)
|
246
|
+
|
247
|
+
if __name__ == "__main__":
|
248
|
+
main()
|
@@ -63,7 +63,7 @@ def collection_viewer(root: str, server_name: str, platform_url: str, user: str)
|
|
63
63
|
print_exception_response(e)
|
64
64
|
|
65
65
|
|
66
|
-
|
66
|
+
def main():
|
67
67
|
parser = argparse.ArgumentParser()
|
68
68
|
|
69
69
|
parser.add_argument("--server", help="Name of the server to display status for")
|
@@ -77,3 +77,6 @@ if __name__ == "__main__":
|
|
77
77
|
|
78
78
|
root_collection = Prompt.ask("Enter the Root Collection to start from:", default="Digital Products Root")
|
79
79
|
collection_viewer(root_collection, server, url, userid)
|
80
|
+
|
81
|
+
if __name__ == "__main__":
|
82
|
+
main()
|
@@ -115,7 +115,7 @@ def display_glossary_terms(search_string: str, guid: str=None, server: str = goo
|
|
115
115
|
print_exception_response(e)
|
116
116
|
assert e.related_http_code != "200", "Invalid parameters"
|
117
117
|
|
118
|
-
|
118
|
+
def main():
|
119
119
|
sus_guid = "f9b78b26-6025-43fa-9299-a905cc6d1575"
|
120
120
|
parser = argparse.ArgumentParser()
|
121
121
|
parser.add_argument("--server", help="Name of the server to display status for")
|
@@ -132,4 +132,7 @@ if __name__ == "__main__":
|
|
132
132
|
guid = sus_guid if args.sustainability else None
|
133
133
|
|
134
134
|
search_string = Prompt.ask("Enter the term you are searching for:", default="*")
|
135
|
-
display_glossary_terms(search_string, guid,server, url, userid)
|
135
|
+
display_glossary_terms(search_string, guid,server, url, userid)
|
136
|
+
|
137
|
+
if __name__ == "__main__":
|
138
|
+
main()
|
@@ -11,17 +11,13 @@ A simple display for glossary terms
|
|
11
11
|
"""
|
12
12
|
|
13
13
|
import argparse
|
14
|
-
import httpx
|
15
14
|
import json
|
16
|
-
import time
|
17
15
|
|
18
|
-
from rich import box
|
19
16
|
from rich import print
|
20
17
|
from rich.console import Console
|
21
18
|
from rich.prompt import Prompt
|
22
19
|
from rich.text import Text
|
23
20
|
from rich.tree import Tree
|
24
|
-
from rich.json import JSON
|
25
21
|
|
26
22
|
from pyegeria import (
|
27
23
|
InvalidParameterException,
|
@@ -30,7 +26,6 @@ from pyegeria import (
|
|
30
26
|
print_exception_response,
|
31
27
|
Client
|
32
28
|
)
|
33
|
-
from pyegeria import ProjectManager
|
34
29
|
|
35
30
|
|
36
31
|
def display_guid(guid: str, server: str, url: str, username: str):
|
@@ -63,11 +58,12 @@ def display_guid(guid: str, server: str, url: str, username: str):
|
|
63
58
|
|
64
59
|
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
|
65
60
|
if type(e) is str:
|
66
|
-
|
61
|
+
print(e)
|
67
62
|
else:
|
63
|
+
console.print(f"\n Looks like the GUID isn't know...detailed message follows\n")
|
68
64
|
print_exception_response(e)
|
69
65
|
|
70
|
-
|
66
|
+
def main():
|
71
67
|
|
72
68
|
parser = argparse.ArgumentParser()
|
73
69
|
parser.add_argument("--server", help="Name of the server to display status for")
|
@@ -83,4 +79,7 @@ if __name__ == "__main__":
|
|
83
79
|
|
84
80
|
guid = Prompt.ask("Enter the GUID to retrieve:", default=None)
|
85
81
|
|
86
|
-
display_guid(guid, server, url, userid)
|
82
|
+
display_guid(guid, server, url, userid)
|
83
|
+
|
84
|
+
if __name__ == "__main__":
|
85
|
+
main()
|
@@ -7,33 +7,19 @@ A simple viewer for collections - provide the root and we display the hierarchy
|
|
7
7
|
|
8
8
|
"""
|
9
9
|
|
10
|
-
import time
|
11
10
|
import argparse
|
12
11
|
|
13
|
-
from rich
|
14
|
-
from rich.
|
12
|
+
from rich import print
|
13
|
+
from rich.panel import Panel
|
15
14
|
from rich.prompt import Prompt
|
16
|
-
|
17
|
-
from pyegeria._exceptions import (
|
18
|
-
InvalidParameterException,
|
19
|
-
PropertyServerException,
|
20
|
-
UserNotAuthorizedException,
|
21
|
-
print_exception_response,
|
22
|
-
)
|
23
|
-
from rich.table import Table
|
24
|
-
from rich.live import Live
|
25
15
|
from rich.text import Text
|
26
16
|
from rich.tree import Tree
|
27
|
-
from rich.markdown import Markdown
|
28
17
|
|
29
|
-
from
|
30
|
-
from rich.console import Group
|
31
|
-
from rich.panel import Panel
|
32
|
-
from rich import box, align
|
33
|
-
from rich.layout import Layout
|
34
|
-
import rich
|
35
|
-
from pyegeria import (CollectionManager, UserNotAuthorizedException, PropertyServerException,
|
18
|
+
from pyegeria import (UserNotAuthorizedException, PropertyServerException,
|
36
19
|
InvalidParameterException, AutomatedCuration)
|
20
|
+
from pyegeria._exceptions import (
|
21
|
+
print_exception_response,
|
22
|
+
)
|
37
23
|
|
38
24
|
disable_ssl_warnings = True
|
39
25
|
|
@@ -95,7 +81,7 @@ def tech_viewer(tech: str, server_name:str, platform_url:str, user:str):
|
|
95
81
|
print_exception_response(e)
|
96
82
|
|
97
83
|
|
98
|
-
|
84
|
+
def main():
|
99
85
|
parser = argparse.ArgumentParser()
|
100
86
|
|
101
87
|
parser.add_argument("--server", help="Name of the server to display status for")
|
@@ -109,3 +95,6 @@ if __name__ == "__main__":
|
|
109
95
|
|
110
96
|
tech = Prompt.ask("Enter the Technology to start from:", default="PostgreSQL Server")
|
111
97
|
tech_viewer(tech,server, url, userid)
|
98
|
+
|
99
|
+
if __name__ == "__main__":
|
100
|
+
main()
|