pyegeria 5.4.4.2__py3-none-any.whl → 5.4.4.4__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.
- commands/cat/list_format_set.py +6 -2
- md_processing/.obsidian/plugins/obsidian-sample-plugin/.git/index +0 -0
- md_processing/__init__.py +1 -1
- md_processing/dr_egeria.py +5 -0
- md_processing/md_commands/data_designer_commands.py +17 -11
- md_processing/md_commands/ext_ref_commands.py +9 -6
- md_processing/md_commands/glossary_commands.py +6 -2
- md_processing/md_commands/governance_officer_commands.py +122 -13
- md_processing/md_commands/product_manager_commands.py +10 -6
- md_processing/md_commands/project_commands.py +5 -2
- md_processing/md_processing_utils/md_processing_constants.py +4 -2
- pyegeria/__init__.py +1 -1
- pyegeria/_client_new.py +471 -44
- pyegeria/_output_formats.py +1384 -143
- pyegeria/classification_manager_omvs.py +4 -4
- pyegeria/collection_manager.py +2 -2
- pyegeria/external_references.py +100 -209
- pyegeria/glossary_manager.py +3 -89
- pyegeria/governance_officer.py +194 -95
- pyegeria/output_formatter.py +4 -0
- pyegeria/project_manager.py +1 -0
- pyegeria/solution_architect.py +0 -90
- pyegeria/utils.py +5 -64
- {pyegeria-5.4.4.2.dist-info → pyegeria-5.4.4.4.dist-info}/METADATA +1 -1
- {pyegeria-5.4.4.2.dist-info → pyegeria-5.4.4.4.dist-info}/RECORD +28 -31
- commands/cat/debug_log.2025-09-10_13-48-37_153090.log.zip +0 -0
- md_processing/dr-egeria-outbox/Business-Imperative-DrE-2025-09-11-21-21-15.md +0 -33
- md_processing/md_commands/old_solution_architect_commands.py +0 -1139
- {pyegeria-5.4.4.2.dist-info → pyegeria-5.4.4.4.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.4.2.dist-info → pyegeria-5.4.4.4.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.4.2.dist-info → pyegeria-5.4.4.4.dist-info}/entry_points.txt +0 -0
commands/cat/list_format_set.py
CHANGED
@@ -54,10 +54,12 @@ from pyegeria import (
|
|
54
54
|
NO_ELEMENTS_FOUND, GovernanceOfficer, GlossaryManager,
|
55
55
|
)
|
56
56
|
from pyegeria.config import settings
|
57
|
+
from pyegeria.external_references import ExternalReferences
|
57
58
|
from pyegeria.logging_configuration import config_logging
|
59
|
+
from pyegeria._output_format_models import load_format_sets_from_json
|
58
60
|
from pyegeria._output_formats import (select_output_format_set, get_output_format_set_heading,
|
59
61
|
load_user_format_sets, load_output_format_sets,
|
60
|
-
|
62
|
+
get_output_format_set_description)
|
61
63
|
from pyegeria._exceptions_new import PyegeriaException, print_exception_response
|
62
64
|
|
63
65
|
# pydevd_pycharm.settrace('host.docker.internal', # Use 'host.docker.internal' to connect to the host machine
|
@@ -166,6 +168,8 @@ def execute_format_set_action(
|
|
166
168
|
client_class = GovernanceOfficer
|
167
169
|
elif class_name == "GlossaryManager":
|
168
170
|
client_class = GlossaryManager
|
171
|
+
elif class_name == "ExternalReference":
|
172
|
+
client_class = ExternalReferences
|
169
173
|
else:
|
170
174
|
client_class = EgeriaTech
|
171
175
|
|
@@ -258,7 +262,7 @@ def execute_format_set_action(
|
|
258
262
|
return
|
259
263
|
else:
|
260
264
|
# For TABLE output, add output_format to params
|
261
|
-
params['output_format'] = "
|
265
|
+
params['output_format'] = "TABLE"
|
262
266
|
print(f"\n==> Calling function: {func} with parameters:{params}")
|
263
267
|
# Call the function and create a table
|
264
268
|
try:
|
Binary file
|
md_processing/__init__.py
CHANGED
@@ -4,7 +4,7 @@ This package contains functions to parse and process Egeria Markdown (Freddie)
|
|
4
4
|
from md_processing.md_commands.governance_officer_commands import (process_gov_definition_upsert_command,
|
5
5
|
process_gov_def_link_detach_command,
|
6
6
|
process_supporting_gov_def_link_detach_command,
|
7
|
-
process_gov_def_context_command,
|
7
|
+
process_gov_def_context_command, process_governed_by_link_detach_command
|
8
8
|
)
|
9
9
|
|
10
10
|
|
md_processing/dr_egeria.py
CHANGED
@@ -30,6 +30,7 @@ from md_processing import (extract_command, process_glossary_upsert_command, pro
|
|
30
30
|
process_digital_product_upsert_command, process_agreement_upsert_command,
|
31
31
|
process_collection_upsert_command, process_link_agreement_item_command,
|
32
32
|
process_gov_definition_upsert_command, GOV_COM_LIST, GOV_LINK_LIST,
|
33
|
+
process_governed_by_link_detach_command,
|
33
34
|
process_gov_def_link_detach_command, process_product_dependency_command,
|
34
35
|
process_add_to_collection_command, process_attach_collection_command,
|
35
36
|
# process_collection_list_command, process_gov_definition_list_command,
|
@@ -212,10 +213,14 @@ def process_md_file(input_file: str, output_folder:str, directive: str, server:
|
|
212
213
|
elif potential_command in ['Link Governance Mechanism', 'Detach Governance Mechanism',
|
213
214
|
'Link Governance Response', 'Detach Governance Response',]:
|
214
215
|
result = process_supporting_gov_def_link_detach_command(client, current_block, directive)
|
216
|
+
|
215
217
|
elif potential_command in ['Link Digital Products', 'Detach Digital Products',
|
216
218
|
'Link Product-Product', 'Detach Product-Product'
|
217
219
|
]:
|
218
220
|
result = process_product_dependency_command(client, current_block, directive)
|
221
|
+
elif potential_command in ['Link Governed By', 'Detach Governed By']
|
222
|
+
result = process_governed_by_link_detach_command(client, current_block, directive)
|
223
|
+
|
219
224
|
elif potential_command in ['Link Agreement->Item', 'Detach Agreement->Item']:
|
220
225
|
result = process_link_agreement_item_command(client, current_block, directive)
|
221
226
|
elif potential_command in ['Link Collection->Resource', 'Detach Collection->Resource']:
|
@@ -31,6 +31,7 @@ from md_processing.md_processing_utils.extraction_utils import (extract_command_
|
|
31
31
|
from md_processing.md_processing_utils.md_processing_constants import (load_commands, ERROR)
|
32
32
|
from pyegeria import DEBUG_LEVEL, body_slimmer
|
33
33
|
from pyegeria.egeria_tech_client import EgeriaTech
|
34
|
+
from pyegeria.utils import make_format_set_name_from_type
|
34
35
|
|
35
36
|
GERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
36
37
|
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
@@ -451,6 +452,7 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
451
452
|
in_data_spec_list = attributes.get('In Data Specification', {}).get('value', None)
|
452
453
|
in_data_spec_valid = attributes.get('In Data Specification', {}).get('valid', None)
|
453
454
|
in_data_spec_exists = attributes.get('In Data Specification', {}).get('exists', None)
|
455
|
+
output_set = make_format_set_name_from_type(object_type)
|
454
456
|
|
455
457
|
if directive == "display":
|
456
458
|
|
@@ -489,7 +491,7 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
489
491
|
'guid': guid, 'display_name': display_name
|
490
492
|
})
|
491
493
|
return egeria_client.get_collection_by_guid(guid, element_type='Data Specification',
|
492
|
-
output_format='MD')
|
494
|
+
output_format='MD', output_format_set=output_set)
|
493
495
|
|
494
496
|
elif object_action == "Create":
|
495
497
|
if valid is False and exists:
|
@@ -517,7 +519,7 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
517
519
|
})
|
518
520
|
msg = f"Created Element `{display_name}` with GUID {guid}\n\n___"
|
519
521
|
logger.success(msg)
|
520
|
-
return egeria_client.get_collection_by_guid(guid, object_type, output_format='MD')
|
522
|
+
return egeria_client.get_collection_by_guid(guid, object_type, output_format='MD', output_format_set=output_set)
|
521
523
|
else:
|
522
524
|
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
523
525
|
logger.error(msg)
|
@@ -562,6 +564,7 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
562
564
|
attributes = parsed_output['attributes']
|
563
565
|
display_name = attributes.get('Display Name', {}).get('value', "None Found")
|
564
566
|
status = attributes.get('Status', {}).get('value', None)
|
567
|
+
output_set = make_format_set_name_from_type(object_type)
|
565
568
|
|
566
569
|
if directive == "display":
|
567
570
|
|
@@ -600,7 +603,7 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
600
603
|
'guid': guid, 'display_name': display_name
|
601
604
|
})
|
602
605
|
return egeria_client.get_collection_by_guid(guid, element_type='Data Specification',
|
603
|
-
output_format='MD')
|
606
|
+
output_format='MD', output_format_set=output_set)
|
604
607
|
|
605
608
|
elif object_action == "Create":
|
606
609
|
if valid is False and exists:
|
@@ -627,7 +630,7 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
627
630
|
})
|
628
631
|
msg = f"Created Element `{display_name}` with GUID {guid}\n\n___"
|
629
632
|
logger.success(msg)
|
630
|
-
return egeria_client.get_collection_by_guid(guid, object_type, output_format='MD')
|
633
|
+
return egeria_client.get_collection_by_guid(guid, object_type, output_format='MD', output_format_set=output_set)
|
631
634
|
else:
|
632
635
|
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
633
636
|
logger.error(msg)
|
@@ -665,7 +668,7 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str,
|
|
665
668
|
|
666
669
|
qualified_name = parsed_output.get('qualified_name', None)
|
667
670
|
guid = parsed_output.get('guid', None)
|
668
|
-
|
671
|
+
output_set = make_format_set_name_from_type(object_type)
|
669
672
|
|
670
673
|
|
671
674
|
if directive == "display":
|
@@ -720,7 +723,7 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str,
|
|
720
723
|
})
|
721
724
|
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
|
722
725
|
|
723
|
-
core_props = egeria_client.get_data_structure_by_guid(guid, output_format='MD')
|
726
|
+
core_props = egeria_client.get_data_structure_by_guid(guid, output_format='MD', output_format_set=output_set)
|
724
727
|
|
725
728
|
update_element_dictionary(qualified_name, {
|
726
729
|
'guid': guid, 'display_name': display_name
|
@@ -757,7 +760,7 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str,
|
|
757
760
|
'guid': guid, 'display_name': display_name
|
758
761
|
})
|
759
762
|
|
760
|
-
core_props = egeria_client.get_data_structure_by_guid(guid, output_format='MD')
|
763
|
+
core_props = egeria_client.get_data_structure_by_guid(guid, output_format='MD', output_format_set=output_set)
|
761
764
|
|
762
765
|
if in_data_dictionary:
|
763
766
|
logger.info(f"Will add to data dictionary(s) `{in_data_dictionary}`")
|
@@ -809,6 +812,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
809
812
|
guid = parsed_output.get('guid', None)
|
810
813
|
valid = parsed_output['valid']
|
811
814
|
exists = parsed_output['exists']
|
815
|
+
output_set = make_format_set_name_from_type(object_type)
|
812
816
|
|
813
817
|
print(Markdown(parsed_output['display']))
|
814
818
|
|
@@ -893,7 +897,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
893
897
|
update_element_dictionary(qualified_name, {
|
894
898
|
'guid': guid, 'display_name': display_name
|
895
899
|
})
|
896
|
-
core_props = egeria_client.get_data_field_by_guid(guid, output_format='MD') ## update back to by_guid?
|
900
|
+
core_props = egeria_client.get_data_field_by_guid(guid, output_format='MD', output_format_set=output_set) ## update back to by_guid?
|
897
901
|
|
898
902
|
# existing_data_field = egeria_client.get_data_field_by_guid(guid, output_format='JSON')
|
899
903
|
|
@@ -935,7 +939,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
935
939
|
'guid': guid, 'display_name': display_name
|
936
940
|
})
|
937
941
|
# Start assembling the information we will present back out
|
938
|
-
core_props = egeria_client.get_data_field_by_guid(guid, 'MD')
|
942
|
+
core_props = egeria_client.get_data_field_by_guid(guid, 'MD', output_format_set=output_set)
|
939
943
|
|
940
944
|
# Add the field to any data dictionaries
|
941
945
|
if in_data_dictionary:
|
@@ -1032,6 +1036,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1032
1036
|
guid = parsed_output.get('guid', None)
|
1033
1037
|
valid = parsed_output['valid']
|
1034
1038
|
exists = parsed_output['exists']
|
1039
|
+
output_set = make_format_set_name_from_type(object_type)
|
1035
1040
|
|
1036
1041
|
print(Markdown(parsed_output['display']))
|
1037
1042
|
|
@@ -1082,6 +1087,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1082
1087
|
sample_values = attributes.get('Sample Values', {}).get('value', [])
|
1083
1088
|
data_patterns = attributes.get('Data Patterns', {}).get('value', [])
|
1084
1089
|
additional_properties = attributes.get('Additional Properties', {}).get('value', {})
|
1090
|
+
output_set = make_format_set_name_from_type(object_type)
|
1085
1091
|
|
1086
1092
|
###############
|
1087
1093
|
aliases = attributes.get('Aliases', {}).get('value', None)
|
@@ -1171,7 +1177,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1171
1177
|
update_element_dictionary(qualified_name, {
|
1172
1178
|
'guid': guid, 'display_name': display_name
|
1173
1179
|
})
|
1174
|
-
core_props = egeria_client.get_data_class_by_guid(guid, None, 'MD')
|
1180
|
+
core_props = egeria_client.get_data_class_by_guid(guid, None, 'MD', output_format_set=output_set)
|
1175
1181
|
|
1176
1182
|
# Sync membership in data dictionaries
|
1177
1183
|
update_data_collection_memberships(egeria_client, object_type, data_dict_guid_list, "DataDictionary",
|
@@ -1219,7 +1225,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1219
1225
|
'guid': guid, 'display_name': display_name
|
1220
1226
|
})
|
1221
1227
|
# Start assembling the information we will present back out
|
1222
|
-
core_props = egeria_client.get_data_class_by_guid(guid, None, 'MD')
|
1228
|
+
core_props = egeria_client.get_data_class_by_guid(guid, None, 'MD', output_format_set=output_set)
|
1223
1229
|
|
1224
1230
|
# Add the field to any data dictionaries
|
1225
1231
|
if in_data_dictionary:
|
@@ -44,6 +44,8 @@ from md_processing.md_processing_utils.md_processing_constants import (GLOSSARY_
|
|
44
44
|
from pyegeria import body_slimmer
|
45
45
|
from pyegeria._globals import (NO_GLOSSARIES_FOUND, NO_ELEMENTS_FOUND, NO_CATEGORIES_FOUND)
|
46
46
|
from pyegeria.egeria_tech_client import EgeriaTech
|
47
|
+
from pyegeria.utils import make_format_set_name_from_type
|
48
|
+
|
47
49
|
|
48
50
|
# EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "170"))
|
49
51
|
# console = Console(width=EGERIA_WIDTH)
|
@@ -84,6 +86,7 @@ def process_external_reference_upsert_command(egeria_client: EgeriaTech, txt: st
|
|
84
86
|
|
85
87
|
display_name = attributes['Display Name'].get('value', None)
|
86
88
|
status = attributes.get('Status', {}).get('value', None)
|
89
|
+
output_set = make_format_set_name_from_type(object_type)
|
87
90
|
#
|
88
91
|
|
89
92
|
if directive == "display":
|
@@ -111,7 +114,7 @@ def process_external_reference_upsert_command(egeria_client: EgeriaTech, txt: st
|
|
111
114
|
prop_body = set_element_prop_body(obj, qualified_name, attributes)
|
112
115
|
prop_body["referenceTitle"] = attributes.get('Reference Title', {}).get('value', None)
|
113
116
|
prop_body["referenceAbstract"] = attributes.get('Reference Abstract', {}).get('value', None)
|
114
|
-
prop_body["authors"] = attributes.get('Authors', {}).get('
|
117
|
+
prop_body["authors"] = attributes.get('Authors', {}).get('value', None)
|
115
118
|
prop_body["organization"] = attributes.get('Organization', {}).get('value', None)
|
116
119
|
prop_body["url"] = attributes.get('URL', {}).get('value', None)
|
117
120
|
prop_body["sources"] = attributes.get('Sources', {}).get('value', None)
|
@@ -161,16 +164,16 @@ def process_external_reference_upsert_command(egeria_client: EgeriaTech, txt: st
|
|
161
164
|
body = set_update_body(obj, attributes)
|
162
165
|
body['properties'] = prop_body
|
163
166
|
|
164
|
-
egeria_client.
|
165
|
-
if status:
|
166
|
-
|
167
|
+
egeria_client.update_external_reference(guid, body)
|
168
|
+
# if status:
|
169
|
+
# egeria_client.update_external_reference_status(guid, status)
|
167
170
|
|
168
171
|
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
|
169
172
|
update_element_dictionary(qualified_name, {
|
170
173
|
'guid': guid, 'display_name': display_name
|
171
174
|
})
|
172
175
|
return egeria_client.get_external_reference_by_guid(guid, element_type= object_type,
|
173
|
-
output_format='MD', output_format_set =
|
176
|
+
output_format='MD', output_format_set = output_set)
|
174
177
|
|
175
178
|
|
176
179
|
elif object_action == "Create":
|
@@ -203,7 +206,7 @@ def process_external_reference_upsert_command(egeria_client: EgeriaTech, txt: st
|
|
203
206
|
logger.success(msg)
|
204
207
|
return egeria_client.get_external_reference_by_guid(guid, element_type=object_type,
|
205
208
|
output_format='MD',
|
206
|
-
output_format_set=
|
209
|
+
output_format_set=output_set)
|
207
210
|
else:
|
208
211
|
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
209
212
|
logger.error(msg)
|
@@ -39,6 +39,8 @@ from md_processing.md_processing_utils.md_processing_constants import (GLOSSARY_
|
|
39
39
|
from pyegeria import body_slimmer
|
40
40
|
from pyegeria._globals import (NO_GLOSSARIES_FOUND, NO_ELEMENTS_FOUND, NO_CATEGORIES_FOUND)
|
41
41
|
from pyegeria.egeria_tech_client import EgeriaTech
|
42
|
+
from pyegeria.utils import make_format_set_name_from_type
|
43
|
+
|
42
44
|
|
43
45
|
# EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "170"))
|
44
46
|
# console = Console(width=EGERIA_WIDTH)
|
@@ -543,6 +545,8 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
|
|
543
545
|
get_method = egeria_client.get_term_by_guid
|
544
546
|
collection_types = ["Glossary", "Folder"]
|
545
547
|
|
548
|
+
output_set = make_format_set_name_from_type(object_type)
|
549
|
+
|
546
550
|
if object_action == "Update":
|
547
551
|
if not exists:
|
548
552
|
msg = (f" Element `{display_name}` does not exist! Updating result document with Create "
|
@@ -571,7 +575,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
|
|
571
575
|
'guid': guid, 'display_name': display_name
|
572
576
|
})
|
573
577
|
return egeria_client.get_term_by_guid(guid, element_type='GlossaryTerm',
|
574
|
-
output_format='MD', output_format_set=
|
578
|
+
output_format='MD', output_format_set=output_set)
|
575
579
|
|
576
580
|
|
577
581
|
elif object_action == "Create":
|
@@ -600,7 +604,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
|
|
600
604
|
})
|
601
605
|
msg = f"Created Element `{display_name}` with GUID {guid}\n\n___"
|
602
606
|
logger.success(msg)
|
603
|
-
return egeria_client.get_term_by_guid(guid, obj, output_format='MD')
|
607
|
+
return egeria_client.get_term_by_guid(guid, obj, output_format='MD', output_format_set=output_set)
|
604
608
|
else:
|
605
609
|
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
606
610
|
logger.error(msg)
|
@@ -8,22 +8,21 @@ from typing import Optional
|
|
8
8
|
from inflect import engine
|
9
9
|
from jsonschema import ValidationError
|
10
10
|
from loguru import logger
|
11
|
-
from
|
12
|
-
|
11
|
+
from rich import print
|
12
|
+
from rich.console import Console
|
13
|
+
from rich.markdown import Markdown
|
14
|
+
|
15
|
+
from md_processing import set_rel_prop_body
|
16
|
+
from md_processing.md_processing_utils.common_md_proc_utils import (parse_upsert_command, parse_view_command)
|
13
17
|
from md_processing.md_processing_utils.common_md_utils import (set_gov_prop_body,
|
14
18
|
set_update_body, set_create_body,
|
15
19
|
set_peer_gov_def_request_body,
|
16
|
-
ALL_GOVERNANCE_DEFINITIONS,
|
17
|
-
GOVERNANCE_CONTROLS, GOVERNANCE_DRIVERS,
|
18
|
-
set_find_body,
|
19
|
-
set_delete_request_body)
|
20
|
+
ALL_GOVERNANCE_DEFINITIONS, set_delete_request_body)
|
20
21
|
from md_processing.md_processing_utils.extraction_utils import (extract_command_plus, update_a_command)
|
21
22
|
from md_processing.md_processing_utils.md_processing_constants import (load_commands)
|
22
23
|
from pyegeria import DEBUG_LEVEL, body_slimmer, PyegeriaException, print_basic_exception, print_validation_error
|
23
24
|
from pyegeria.egeria_tech_client import EgeriaTech
|
24
|
-
from
|
25
|
-
from rich.console import Console
|
26
|
-
from rich.markdown import Markdown
|
25
|
+
from pyegeria.utils import make_format_set_name_from_type
|
27
26
|
|
28
27
|
GERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
29
28
|
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
@@ -132,6 +131,8 @@ def process_gov_definition_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
132
131
|
return valid
|
133
132
|
|
134
133
|
elif directive == "process":
|
134
|
+
output_set = make_format_set_name_from_type(object_type)
|
135
|
+
|
135
136
|
if object_action == "Update":
|
136
137
|
if not guid:
|
137
138
|
msg = (f"The `{object_type}` '{display_name}' does not yet exist.\n The result document has been "
|
@@ -150,10 +151,11 @@ def process_gov_definition_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
150
151
|
update_body = body_slimmer(update_body)
|
151
152
|
egeria_client.update_governance_definition(guid, update_body)
|
152
153
|
if status := parsed_output['attributes'].get('Status', {}).get('value', None):
|
153
|
-
egeria_client.update_governance_definition_status(guid, status)
|
154
|
+
# egeria_client.update_governance_definition_status(guid, status)
|
155
|
+
egeria_client.update_element_status(guid, status)
|
154
156
|
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}")
|
155
157
|
return egeria_client.get_governance_definition_by_guid(guid, output_format='MD',
|
156
|
-
|
158
|
+
output_format_set=output_set)
|
157
159
|
|
158
160
|
elif object_action == "Create":
|
159
161
|
if valid is False and exists:
|
@@ -173,7 +175,8 @@ def process_gov_definition_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
173
175
|
guid = egeria_client.create_governance_definition(body_slimmer(create_body))
|
174
176
|
if guid:
|
175
177
|
logger.success(f"Created {object_type} `{display_name}` with GUID {guid}")
|
176
|
-
return egeria_client.get_governance_definition_by_guid(guid, output_format='MD'
|
178
|
+
return egeria_client.get_governance_definition_by_guid(guid, output_format='MD',
|
179
|
+
output_format_set=output_set)
|
177
180
|
else:
|
178
181
|
logger.error(f"Failed to create {object_type} `{display_name}`.")
|
179
182
|
return None
|
@@ -398,7 +401,7 @@ def process_supporting_gov_def_link_detach_command(egeria_client: EgeriaTech, tx
|
|
398
401
|
"rationale": attributes.get('Rationale', {}).get('value', None),
|
399
402
|
"effectiveFrom": attributes.get('Effective From', {}).get('value', None),
|
400
403
|
"effectiveTo": attributes.get('Effective To', {}).get('value', None),
|
401
|
-
|
404
|
+
}
|
402
405
|
|
403
406
|
body = set_peer_gov_def_request_body(object_type, attributes)
|
404
407
|
body['properties'] = body_prop
|
@@ -425,6 +428,112 @@ def process_supporting_gov_def_link_detach_command(egeria_client: EgeriaTech, tx
|
|
425
428
|
return None
|
426
429
|
|
427
430
|
|
431
|
+
|
432
|
+
@logger.catch
|
433
|
+
def process_governed_by_link_detach_command(egeria_client: EgeriaTech, txt: str,
|
434
|
+
directive: str = "display") -> Optional[str]:
|
435
|
+
"""
|
436
|
+
Processes a link or unlink command to associate or break up peer governance definitions.
|
437
|
+
|
438
|
+
:param txt: A string representing the input cell to be processed for
|
439
|
+
extracting blueprint-related attributes.
|
440
|
+
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
441
|
+
:return: A string summarizing the outcome of the processing.
|
442
|
+
"""
|
443
|
+
command, object_type, object_action = extract_command_plus(txt)
|
444
|
+
print(Markdown(f"# {command}\n"))
|
445
|
+
|
446
|
+
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
447
|
+
|
448
|
+
print(Markdown(parsed_output['display']))
|
449
|
+
|
450
|
+
logger.debug(json.dumps(parsed_output, indent=4))
|
451
|
+
|
452
|
+
attributes = parsed_output['attributes']
|
453
|
+
|
454
|
+
element_guid = attributes.get('Referencable', {}).get('guid', None)
|
455
|
+
definition_guid = attributes.get('Governance Definition', {}).get('guid', None)
|
456
|
+
label = attributes.get('Link Label', {}).get('value', None)
|
457
|
+
description = attributes.get('Description', {}).get('value', None)
|
458
|
+
|
459
|
+
valid = parsed_output['valid']
|
460
|
+
exists = element_guid is not None and definition_guid is not None
|
461
|
+
|
462
|
+
if directive == "display":
|
463
|
+
|
464
|
+
return None
|
465
|
+
elif directive == "validate":
|
466
|
+
if valid:
|
467
|
+
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
468
|
+
else:
|
469
|
+
msg = f"Validation failed for object_action `{command}`\n"
|
470
|
+
return valid
|
471
|
+
|
472
|
+
elif directive == "process":
|
473
|
+
|
474
|
+
|
475
|
+
try:
|
476
|
+
if object_action == "Detach":
|
477
|
+
if not exists:
|
478
|
+
msg = (f" Link `{label}` does not exist! Updating result document with Link "
|
479
|
+
f"object_action\n")
|
480
|
+
logger.error(msg)
|
481
|
+
out = parsed_output['display'].replace('Link', 'Detach', 1)
|
482
|
+
return out
|
483
|
+
elif not valid:
|
484
|
+
return None
|
485
|
+
else:
|
486
|
+
print(Markdown(
|
487
|
+
f"==> Validation of {command} completed successfully! Proceeding to apply the changes.\n"))
|
488
|
+
body = set_delete_request_body(object_type, attributes)
|
489
|
+
|
490
|
+
egeria_client.detach_governed_by_definitions(element_guid, definition_guid, body)
|
491
|
+
|
492
|
+
logger.success(f"===> Detached segment with {label} from `{definition1}`to {definition2}\n")
|
493
|
+
out = parsed_output['display'].replace('Unlink', 'Link', 1)
|
494
|
+
|
495
|
+
return (out)
|
496
|
+
|
497
|
+
|
498
|
+
elif object_action == "Link":
|
499
|
+
if valid is False and exists:
|
500
|
+
msg = (f"--> Link called `{label}` already exists and result document updated changing "
|
501
|
+
f"`Link` to `Detach` in processed output\n")
|
502
|
+
logger.error(msg)
|
503
|
+
|
504
|
+
elif valid is False:
|
505
|
+
msg = f"==>{object_type} Link with label `{label}` is not valid and can't be created"
|
506
|
+
logger.error(msg)
|
507
|
+
return
|
508
|
+
|
509
|
+
else:
|
510
|
+
body_prop = set_rel_prop_body(object_type, attributes)
|
511
|
+
|
512
|
+
body = set_rel_request_body(object_type, attributes)
|
513
|
+
body['properties'] = body_prop
|
514
|
+
egeria_client.attach_governed_by_definition(element_guid, definition_guid, body)
|
515
|
+
msg = f"==>Created {object_type} link named `{label}`\n"
|
516
|
+
logger.success(msg)
|
517
|
+
out = parsed_output['display'].replace('Link', 'Detach', 1)
|
518
|
+
return out
|
519
|
+
|
520
|
+
except ValidationError as e:
|
521
|
+
print_validation_error(e)
|
522
|
+
logger.error(f"Validation Error performing {command}: {e}")
|
523
|
+
return None
|
524
|
+
except PyegeriaException as e:
|
525
|
+
print_basic_exception(e)
|
526
|
+
logger.error(f"PyegeriaException occurred: {e}")
|
527
|
+
return None
|
528
|
+
|
529
|
+
except Exception as e:
|
530
|
+
logger.error(f"Error performing {command}: {e}")
|
531
|
+
return None
|
532
|
+
else:
|
533
|
+
return None
|
534
|
+
|
535
|
+
|
536
|
+
|
428
537
|
@logger.catch
|
429
538
|
def process_gov_def_context_command(egeria_client: EgeriaTech, txt: str,
|
430
539
|
directive: str = "display") -> Optional[str]:
|
@@ -20,6 +20,7 @@ from md_processing.md_processing_utils.extraction_utils import (extract_command_
|
|
20
20
|
from md_processing.md_processing_utils.md_processing_constants import (load_commands, ERROR)
|
21
21
|
from pyegeria import DEBUG_LEVEL, body_slimmer, to_pascal_case, PyegeriaException, print_basic_exception, print_exception_table
|
22
22
|
from pyegeria.egeria_tech_client import EgeriaTech
|
23
|
+
from pyegeria.utils import make_format_set_name_from_type
|
23
24
|
|
24
25
|
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
25
26
|
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
@@ -179,6 +180,7 @@ def process_collection_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
179
180
|
|
180
181
|
display_name = attributes['Display Name'].get('value', None)
|
181
182
|
status = attributes.get('Status', {}).get('value', None)
|
183
|
+
output_set = make_format_set_name_from_type(object_type)
|
182
184
|
|
183
185
|
if directive == "display":
|
184
186
|
|
@@ -222,7 +224,7 @@ def process_collection_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
222
224
|
'guid': guid, 'display_name': display_name
|
223
225
|
})
|
224
226
|
return egeria_client.get_collection_by_guid(guid, element_type='Data Specification',
|
225
|
-
output_format='MD')
|
227
|
+
output_format='MD', output_format_set=output_set)
|
226
228
|
|
227
229
|
|
228
230
|
elif object_action == "Create":
|
@@ -250,7 +252,7 @@ def process_collection_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
250
252
|
})
|
251
253
|
msg = f"Created Element `{display_name}` with GUID {guid}\n\n___"
|
252
254
|
logger.success(msg)
|
253
|
-
return egeria_client.get_collection_by_guid(guid, obj, output_format='MD')
|
255
|
+
return egeria_client.get_collection_by_guid(guid, obj, output_format='MD', output_format_set=output_set)
|
254
256
|
else:
|
255
257
|
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
256
258
|
logger.error(msg)
|
@@ -299,6 +301,7 @@ def process_digital_product_upsert_command(egeria_client: EgeriaTech, txt: str,
|
|
299
301
|
display_name = attributes['Display Name'].get('value', None)
|
300
302
|
product_manager = attributes.get('Product Manager',{}).get('value', None)
|
301
303
|
product_status = attributes.get('Product Status',{}).get('value', None)
|
304
|
+
output_set = make_format_set_name_from_type(object_type)
|
302
305
|
|
303
306
|
if directive == "display":
|
304
307
|
|
@@ -340,7 +343,7 @@ def process_digital_product_upsert_command(egeria_client: EgeriaTech, txt: str,
|
|
340
343
|
'guid': guid, 'display_name': display_name
|
341
344
|
})
|
342
345
|
return egeria_client.get_collection_by_guid(guid, element_type='Digital Product',
|
343
|
-
output_format='MD')
|
346
|
+
output_format='MD', output_format_set=output_set)
|
344
347
|
|
345
348
|
|
346
349
|
elif object_action == "Create":
|
@@ -366,7 +369,7 @@ def process_digital_product_upsert_command(egeria_client: EgeriaTech, txt: str,
|
|
366
369
|
msg = f"Created Element `{display_name}` with GUID {guid}\n\n___"
|
367
370
|
logger.success(msg)
|
368
371
|
return egeria_client.get_collection_by_guid(guid, element_type='Digital Product',
|
369
|
-
output_format='MD')
|
372
|
+
output_format='MD', output_format_set=output_set)
|
370
373
|
else:
|
371
374
|
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
372
375
|
logger.error(msg)
|
@@ -411,6 +414,7 @@ def process_agreement_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
411
414
|
|
412
415
|
display_name = attributes['Display Name'].get('value', None)
|
413
416
|
status = attributes.get('Status', {}).get('value', None)
|
417
|
+
output_set = make_format_set_name_from_type(object_type)
|
414
418
|
|
415
419
|
if directive == "display":
|
416
420
|
|
@@ -454,7 +458,7 @@ def process_agreement_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
454
458
|
'guid': guid, 'display_name': display_name
|
455
459
|
})
|
456
460
|
return egeria_client.get_collection_by_guid(guid, element_type='Data Specification',
|
457
|
-
output_format='MD')
|
461
|
+
output_format='MD', output_format_set=output_set)
|
458
462
|
|
459
463
|
|
460
464
|
elif object_action == "Create":
|
@@ -479,7 +483,7 @@ def process_agreement_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
479
483
|
})
|
480
484
|
msg = f"Created Element `{display_name}` with GUID {guid}\n\n___"
|
481
485
|
logger.success(msg)
|
482
|
-
return egeria_client.get_collection_by_guid(guid, obj, output_format='MD')
|
486
|
+
return egeria_client.get_collection_by_guid(guid, obj, output_format='MD', output_format_set=output_set)
|
483
487
|
else:
|
484
488
|
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
485
489
|
logger.error(msg)
|
@@ -44,6 +44,8 @@ from md_processing.md_processing_utils.md_processing_constants import (GLOSSARY_
|
|
44
44
|
from pyegeria import body_slimmer
|
45
45
|
from pyegeria._globals import (NO_GLOSSARIES_FOUND, NO_ELEMENTS_FOUND, NO_CATEGORIES_FOUND)
|
46
46
|
from pyegeria.egeria_tech_client import EgeriaTech
|
47
|
+
from pyegeria.utils import make_format_set_name_from_type
|
48
|
+
|
47
49
|
|
48
50
|
# EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "170"))
|
49
51
|
# console = Console(width=EGERIA_WIDTH)
|
@@ -83,6 +85,7 @@ def process_project_upsert_command(egeria_client: EgeriaTech, txt: str, directiv
|
|
83
85
|
|
84
86
|
display_name = attributes['Display Name'].get('value', None)
|
85
87
|
status = attributes.get('Status', {}).get('value', None)
|
88
|
+
output_set = make_format_set_name_from_type(object_type)
|
86
89
|
#
|
87
90
|
|
88
91
|
if directive == "display":
|
@@ -142,7 +145,7 @@ def process_project_upsert_command(egeria_client: EgeriaTech, txt: str, directiv
|
|
142
145
|
'guid': guid, 'display_name': display_name
|
143
146
|
})
|
144
147
|
return egeria_client.get_project_by_guid(guid, element_type='Project',
|
145
|
-
output_format='MD', output_format_set =
|
148
|
+
output_format='MD', output_format_set = output_set)
|
146
149
|
|
147
150
|
|
148
151
|
elif object_action == "Create":
|
@@ -173,7 +176,7 @@ def process_project_upsert_command(egeria_client: EgeriaTech, txt: str, directiv
|
|
173
176
|
})
|
174
177
|
msg = f"Created Element `{display_name}` with GUID {guid}\n\n___"
|
175
178
|
logger.success(msg)
|
176
|
-
return egeria_client.get_project_by_guid(guid, output_format='MD', output_format_set =
|
179
|
+
return egeria_client.get_project_by_guid(guid, output_format='MD', output_format_set = output_set)
|
177
180
|
else:
|
178
181
|
msg = f"Failed to create element `{display_name}` with GUID {guid}\n\n___"
|
179
182
|
logger.error(msg)
|
@@ -50,7 +50,7 @@ TERM_RELATIONSHPS = ["Synonym", "Translation", "PreferredTerm", "TermISATYPEOFRe
|
|
50
50
|
GOV_LINK_LIST = [ "Link Governance Drivers", "Link Drivers", "Detach Governance Drivers", "Detach Drivers",
|
51
51
|
"Link Governance Policies", "Link Policies", "Detach Governance Policies", "Detach Policies",
|
52
52
|
"Link Governance Controls", "Link Controls", "Detach Governance Controls", "Detach Controls",
|
53
|
-
|
53
|
+
]
|
54
54
|
|
55
55
|
GOV_COM_LIST = [ "Create Business Imperative", "Update Business Imperative",
|
56
56
|
"Create Regulation Article Definition", "Update Regulation Article Definition",
|
@@ -70,7 +70,9 @@ GOV_COM_LIST = [ "Create Business Imperative", "Update Business Imperative",
|
|
70
70
|
"Create Security Group", "Update Security Group",
|
71
71
|
"Create Naming Standard Rule", "Update Naming Standard Rule",
|
72
72
|
"Create Certification Type", "Update Certification Type",
|
73
|
-
"Create License Type", "Update License Type",
|
73
|
+
"Create License Type", "Update License Type",
|
74
|
+
"Link Governed By", "Detach Governed By"
|
75
|
+
]
|
74
76
|
|
75
77
|
SIMPLE_BASE_COLLECTIONS: set = { "Collection", "Home Collection", "Digital Product", "Result Set" , "Recent Access",
|
76
78
|
"Reference List", "Work Item List", "Data Sharing Agreement", "Namespace", "Agreement",
|
pyegeria/__init__.py
CHANGED
@@ -62,7 +62,7 @@ from .registered_info import RegisteredInfo
|
|
62
62
|
from .runtime_manager_omvs import RuntimeManager
|
63
63
|
from .server_operations import ServerOps
|
64
64
|
from .solution_architect import SolutionArchitect
|
65
|
-
from .utils import body_slimmer,
|
65
|
+
from .utils import body_slimmer,to_pascal_case, to_camel_case, camel_to_title_case
|
66
66
|
from .valid_metadata_omvs import ValidMetadataManager
|
67
67
|
from .x_action_author_omvs import ActionAuthor
|
68
68
|
from .template_manager_omvs import TemplateManager
|