pyegeria 5.3.9.9.3__py3-none-any.whl → 5.5.3.3__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.

Potentially problematic release.


This version of pyegeria might be problematic. Click here for more details.

Files changed (272) hide show
  1. commands/__init__.py +24 -0
  2. commands/cat/Dr-Egeria_md-orig.py +2 -2
  3. commands/cat/__init__.py +1 -17
  4. commands/cat/collection_actions.py +197 -0
  5. commands/cat/dr_egeria_command_help.py +372 -0
  6. commands/cat/dr_egeria_jupyter.py +7 -7
  7. commands/cat/dr_egeria_md.py +27 -182
  8. commands/cat/exp_list_glossaries.py +11 -14
  9. commands/cat/get_asset_graph.py +37 -267
  10. commands/cat/{get_collection.py → get_collection_tree.py} +10 -18
  11. commands/cat/get_project_dependencies.py +14 -14
  12. commands/cat/get_project_structure.py +15 -14
  13. commands/cat/get_tech_type_elements.py +16 -116
  14. commands/cat/glossary_actions.py +145 -298
  15. commands/cat/list_assets.py +3 -11
  16. commands/cat/list_cert_types.py +17 -63
  17. commands/cat/list_collections.py +46 -138
  18. commands/cat/list_deployed_catalogs.py +15 -27
  19. commands/cat/list_deployed_database_schemas.py +27 -43
  20. commands/cat/list_deployed_databases.py +16 -31
  21. commands/cat/list_deployed_servers.py +35 -54
  22. commands/cat/list_glossaries.py +18 -17
  23. commands/cat/list_projects.py +10 -12
  24. commands/cat/list_tech_type_elements.py +21 -37
  25. commands/cat/list_tech_types.py +13 -25
  26. commands/cat/list_terms.py +38 -79
  27. commands/cat/list_todos.py +4 -11
  28. commands/cat/list_user_ids.py +3 -10
  29. commands/cat/my_reports.py +559 -0
  30. commands/cat/run_report.py +394 -0
  31. commands/cat/run_report_orig.py +528 -0
  32. commands/cli/egeria.py +222 -247
  33. commands/cli/egeria_cat.py +68 -81
  34. commands/cli/egeria_my.py +13 -0
  35. commands/cli/egeria_ops.py +69 -74
  36. commands/cli/egeria_tech.py +17 -93
  37. commands/cli/ops_config.py +3 -6
  38. commands/{cat/list_categories.py → deprecated/list_data_designer.py} +53 -64
  39. commands/{cat/list_data_structures.py → deprecated/list_data_structures_full.py} +3 -6
  40. commands/deprecated/old_get_asset_graph.py +315 -0
  41. commands/my/__init__.py +0 -2
  42. commands/my/list_my_profile.py +27 -34
  43. commands/my/list_my_roles.py +1 -7
  44. commands/my/monitor_my_todos.py +1 -7
  45. commands/my/monitor_open_todos.py +6 -7
  46. commands/my/todo_actions.py +4 -5
  47. commands/ops/__init__.py +0 -2
  48. commands/ops/gov_server_actions.py +17 -21
  49. commands/ops/list_archives.py +17 -38
  50. commands/ops/list_catalog_targets.py +33 -40
  51. commands/ops/load_archive.py +35 -26
  52. commands/ops/{monitor_engine_activity_c.py → monitor_active_engine_activity.py} +51 -82
  53. commands/ops/{monitor_integ_daemon_status.py → monitor_daemon_status.py} +35 -55
  54. commands/ops/monitor_engine_activity.py +79 -77
  55. commands/ops/{monitor_gov_eng_status.py → monitor_engine_status.py} +10 -7
  56. commands/ops/monitor_platform_status.py +38 -50
  57. commands/ops/monitor_server_startup.py +6 -11
  58. commands/ops/monitor_server_status.py +7 -11
  59. commands/ops/orig_monitor_server_list.py +8 -8
  60. commands/ops/orig_monitor_server_status.py +1 -5
  61. commands/ops/refresh_integration_daemon.py +5 -5
  62. commands/ops/restart_integration_daemon.py +5 -5
  63. commands/ops/table_integ_daemon_status.py +6 -6
  64. commands/ops/x_engine_actions.py +7 -7
  65. commands/tech/__init__.py +0 -2
  66. commands/tech/{generic_actions.py → element_actions.py} +6 -11
  67. commands/tech/get_element_info.py +20 -29
  68. commands/tech/get_guid_info.py +23 -42
  69. commands/tech/get_tech_details.py +20 -35
  70. commands/tech/get_tech_type_template.py +28 -39
  71. commands/tech/list_all_om_type_elements.py +24 -30
  72. commands/tech/list_all_om_type_elements_x.py +22 -28
  73. commands/tech/list_all_related_elements.py +19 -28
  74. commands/tech/list_anchored_elements.py +22 -30
  75. commands/tech/list_asset_types.py +19 -24
  76. commands/tech/list_elements_by_classification_by_property_value.py +26 -32
  77. commands/tech/list_elements_by_property_value.py +19 -25
  78. commands/tech/list_elements_by_property_value_x.py +20 -28
  79. commands/tech/list_elements_for_classification.py +28 -41
  80. commands/tech/list_gov_action_processes.py +16 -27
  81. commands/tech/list_information_supply_chains.py +22 -30
  82. commands/tech/list_registered_services.py +14 -26
  83. commands/tech/list_related_elements_with_prop_value.py +15 -25
  84. commands/tech/list_related_specification.py +1 -4
  85. commands/tech/list_relationship_types.py +15 -25
  86. commands/tech/list_relationships.py +20 -36
  87. commands/tech/list_solution_blueprints.py +28 -33
  88. commands/tech/list_solution_components.py +23 -29
  89. commands/tech/list_solution_roles.py +21 -32
  90. commands/tech/list_tech_templates.py +51 -54
  91. commands/tech/list_valid_metadata_values.py +5 -9
  92. commands/tech/table_tech_templates.py +2 -6
  93. commands/tech/x_list_related_elements.py +1 -4
  94. examples/GeoSpatial Products Example.py +524 -0
  95. examples/Jupyter Notebooks/P-egeria-server-config.ipynb +2137 -0
  96. examples/Jupyter Notebooks/README.md +2 -0
  97. examples/Jupyter Notebooks/common/P-environment-check.ipynb +115 -0
  98. examples/Jupyter Notebooks/common/__init__.py +14 -0
  99. examples/Jupyter Notebooks/common/common-functions.ipynb +4694 -0
  100. examples/Jupyter Notebooks/common/environment-check.ipynb +52 -0
  101. examples/Jupyter Notebooks/common/globals.ipynb +184 -0
  102. examples/Jupyter Notebooks/common/globals.py +154 -0
  103. examples/Jupyter Notebooks/common/orig_globals.py +152 -0
  104. examples/format_sets/all_format_sets.json +910 -0
  105. examples/format_sets/custom_format_sets.json +268 -0
  106. examples/format_sets/subset_format_sets.json +187 -0
  107. examples/format_sets_save_load_example.py +291 -0
  108. examples/jacquard_data_sets.py +129 -0
  109. examples/output_formats_example.py +193 -0
  110. examples/test_jacquard_data_sets.py +54 -0
  111. examples/test_jacquard_data_sets_scenarios.py +94 -0
  112. md_processing/__init__.py +90 -0
  113. md_processing/command_dispatcher.py +33 -0
  114. md_processing/command_mapping.py +221 -0
  115. md_processing/data/commands/commands_data_designer.json +537 -0
  116. md_processing/data/commands/commands_external_reference.json +733 -0
  117. md_processing/data/commands/commands_feedback.json +155 -0
  118. md_processing/data/commands/commands_general.json +204 -0
  119. md_processing/data/commands/commands_glossary.json +218 -0
  120. md_processing/data/commands/commands_governance.json +3678 -0
  121. md_processing/data/commands/commands_product_manager.json +865 -0
  122. md_processing/data/commands/commands_project.json +642 -0
  123. md_processing/data/commands/commands_solution_architect.json +366 -0
  124. md_processing/data/commands.json +17568 -0
  125. md_processing/data/commands_working.json +30641 -0
  126. md_processing/data/gened_report_specs.py +6584 -0
  127. md_processing/data/generated_format_sets.json +6533 -0
  128. md_processing/data/generated_format_sets_old.json +4137 -0
  129. md_processing/data/generated_format_sets_old.py +45 -0
  130. md_processing/dr_egeria.py +182 -0
  131. md_processing/md_commands/__init__.py +3 -0
  132. md_processing/md_commands/data_designer_commands.py +1276 -0
  133. md_processing/md_commands/ext_ref_commands.py +530 -0
  134. md_processing/md_commands/feedback_commands.py +726 -0
  135. md_processing/md_commands/glossary_commands.py +684 -0
  136. md_processing/md_commands/governance_officer_commands.py +600 -0
  137. md_processing/md_commands/product_manager_commands.py +1266 -0
  138. md_processing/md_commands/project_commands.py +383 -0
  139. md_processing/md_commands/solution_architect_commands.py +1184 -0
  140. md_processing/md_commands/view_commands.py +295 -0
  141. md_processing/md_processing_utils/__init__.py +4 -0
  142. md_processing/md_processing_utils/common_md_proc_utils.py +1249 -0
  143. md_processing/md_processing_utils/common_md_utils.py +578 -0
  144. md_processing/md_processing_utils/determine_width.py +103 -0
  145. md_processing/md_processing_utils/extraction_utils.py +547 -0
  146. md_processing/md_processing_utils/gen_report_specs.py +643 -0
  147. md_processing/md_processing_utils/generate_dr_help.py +193 -0
  148. md_processing/md_processing_utils/generate_md_cmd_templates.py +144 -0
  149. md_processing/md_processing_utils/generate_md_templates.py +83 -0
  150. md_processing/md_processing_utils/md_processing_constants.py +1228 -0
  151. md_processing/md_processing_utils/message_constants.py +19 -0
  152. pyegeria/__init__.py +201 -443
  153. pyegeria/core/__init__.py +40 -0
  154. pyegeria/core/_base_platform_client.py +574 -0
  155. pyegeria/core/_base_server_client.py +573 -0
  156. pyegeria/core/_exceptions.py +457 -0
  157. pyegeria/core/_globals.py +60 -0
  158. pyegeria/core/_server_client.py +6073 -0
  159. pyegeria/core/_validators.py +257 -0
  160. pyegeria/core/config.py +654 -0
  161. pyegeria/{create_tech_guid_lists.py → core/create_tech_guid_lists.py} +0 -1
  162. pyegeria/core/load_config.py +37 -0
  163. pyegeria/core/logging_configuration.py +207 -0
  164. pyegeria/core/mcp_adapter.py +144 -0
  165. pyegeria/core/mcp_server.py +212 -0
  166. pyegeria/core/utils.py +405 -0
  167. pyegeria/deprecated/__init__.py +0 -0
  168. pyegeria/{_client.py → deprecated/_client.py} +62 -24
  169. pyegeria/{_deprecated_gov_engine.py → deprecated/_deprecated_gov_engine.py} +16 -16
  170. pyegeria/{classification_manager_omvs.py → deprecated/classification_manager_omvs.py} +1988 -1878
  171. pyegeria/deprecated/output_formatter_with_machine_keys.py +1127 -0
  172. pyegeria/{runtime_manager_omvs.py → deprecated/runtime_manager_omvs.py} +216 -229
  173. pyegeria/{valid_metadata_omvs.py → deprecated/valid_metadata_omvs.py} +93 -93
  174. pyegeria/{x_action_author_omvs.py → deprecated/x_action_author_omvs.py} +2 -3
  175. pyegeria/egeria_cat_client.py +25 -51
  176. pyegeria/egeria_client.py +140 -98
  177. pyegeria/egeria_config_client.py +48 -24
  178. pyegeria/egeria_tech_client.py +170 -83
  179. pyegeria/models/__init__.py +150 -0
  180. pyegeria/models/collection_models.py +168 -0
  181. pyegeria/models/models.py +654 -0
  182. pyegeria/omvs/__init__.py +84 -0
  183. pyegeria/omvs/action_author.py +342 -0
  184. pyegeria/omvs/actor_manager.py +5980 -0
  185. pyegeria/omvs/asset_catalog.py +842 -0
  186. pyegeria/omvs/asset_maker.py +2736 -0
  187. pyegeria/omvs/automated_curation.py +4403 -0
  188. pyegeria/omvs/classification_manager.py +11213 -0
  189. pyegeria/omvs/collection_manager.py +5780 -0
  190. pyegeria/omvs/community_matters_omvs.py +468 -0
  191. pyegeria/{core_omag_server_config.py → omvs/core_omag_server_config.py} +157 -157
  192. pyegeria/{data_designer_omvs.py → omvs/data_designer.py} +1991 -1691
  193. pyegeria/omvs/data_discovery.py +869 -0
  194. pyegeria/omvs/data_engineer.py +372 -0
  195. pyegeria/omvs/digital_business.py +1133 -0
  196. pyegeria/omvs/external_links.py +1752 -0
  197. pyegeria/omvs/feedback_manager.py +834 -0
  198. pyegeria/{full_omag_server_config.py → omvs/full_omag_server_config.py} +73 -69
  199. pyegeria/omvs/glossary_manager.py +3231 -0
  200. pyegeria/omvs/governance_officer.py +3009 -0
  201. pyegeria/omvs/lineage_linker.py +314 -0
  202. pyegeria/omvs/location_arena.py +1525 -0
  203. pyegeria/omvs/metadata_expert.py +668 -0
  204. pyegeria/omvs/metadata_explorer_omvs.py +2943 -0
  205. pyegeria/omvs/my_profile.py +1042 -0
  206. pyegeria/omvs/notification_manager.py +358 -0
  207. pyegeria/omvs/people_organizer.py +394 -0
  208. pyegeria/{platform_services.py → omvs/platform_services.py} +113 -193
  209. pyegeria/omvs/product_manager.py +1825 -0
  210. pyegeria/omvs/project_manager.py +1907 -0
  211. pyegeria/omvs/reference_data.py +1140 -0
  212. pyegeria/omvs/registered_info.py +334 -0
  213. pyegeria/omvs/runtime_manager.py +2817 -0
  214. pyegeria/omvs/schema_maker.py +446 -0
  215. pyegeria/{server_operations.py → omvs/server_operations.py} +27 -26
  216. pyegeria/omvs/solution_architect.py +6490 -0
  217. pyegeria/omvs/specification_properties.py +37 -0
  218. pyegeria/omvs/subject_area.py +1042 -0
  219. pyegeria/omvs/template_manager_omvs.py +236 -0
  220. pyegeria/omvs/time_keeper.py +1761 -0
  221. pyegeria/omvs/valid_metadata.py +3221 -0
  222. pyegeria/omvs/valid_metadata_lists.py +37 -0
  223. pyegeria/omvs/valid_type_lists.py +37 -0
  224. pyegeria/view/__init__.py +28 -0
  225. pyegeria/view/_output_format_models.py +514 -0
  226. pyegeria/view/_output_formats.py +14 -0
  227. pyegeria/view/base_report_formats.py +2719 -0
  228. pyegeria/view/dr_egeria_reports.py +56 -0
  229. pyegeria/view/format_set_executor.py +397 -0
  230. pyegeria/{md_processing_utils.py → view/md_processing_utils.py} +5 -5
  231. pyegeria/{mermaid_utilities.py → view/mermaid_utilities.py} +2 -154
  232. pyegeria/view/output_formatter.py +1297 -0
  233. pyegeria-5.5.3.3.dist-info/METADATA +218 -0
  234. pyegeria-5.5.3.3.dist-info/RECORD +241 -0
  235. {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.5.3.3.dist-info}/WHEEL +2 -1
  236. pyegeria-5.5.3.3.dist-info/entry_points.txt +103 -0
  237. pyegeria-5.5.3.3.dist-info/top_level.txt +4 -0
  238. commands/cat/.DS_Store +0 -0
  239. commands/cat/README.md +0 -16
  240. commands/cli/txt_custom_v2.tcss +0 -19
  241. commands/my/README.md +0 -17
  242. commands/ops/README.md +0 -24
  243. commands/ops/monitor_asset_events.py +0 -108
  244. commands/tech/README.md +0 -24
  245. pyegeria/.DS_Store +0 -0
  246. pyegeria/README.md +0 -35
  247. pyegeria/_globals.py +0 -47
  248. pyegeria/_validators.py +0 -385
  249. pyegeria/asset_catalog_omvs.py +0 -864
  250. pyegeria/automated_curation_omvs.py +0 -3765
  251. pyegeria/collection_manager_omvs.py +0 -2744
  252. pyegeria/dr.egeria spec.md +0 -9
  253. pyegeria/egeria_my_client.py +0 -56
  254. pyegeria/feedback_manager_omvs.py +0 -4573
  255. pyegeria/glossary_browser_omvs.py +0 -3728
  256. pyegeria/glossary_manager_omvs.py +0 -2440
  257. pyegeria/m_test.py +0 -118
  258. pyegeria/md_processing_helpers.py +0 -58
  259. pyegeria/md_processing_utils_orig.py +0 -1103
  260. pyegeria/metadata_explorer_omvs.py +0 -2326
  261. pyegeria/my_profile_omvs.py +0 -1022
  262. pyegeria/output_formatter.py +0 -389
  263. pyegeria/project_manager_omvs.py +0 -1933
  264. pyegeria/registered_info.py +0 -167
  265. pyegeria/solution_architect_omvs.py +0 -2156
  266. pyegeria/template_manager_omvs.py +0 -1414
  267. pyegeria/utils.py +0 -197
  268. pyegeria-5.3.9.9.3.dist-info/METADATA +0 -72
  269. pyegeria-5.3.9.9.3.dist-info/RECORD +0 -143
  270. pyegeria-5.3.9.9.3.dist-info/entry_points.txt +0 -99
  271. /pyegeria/{_exceptions.py → deprecated/_exceptions.py} +0 -0
  272. {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.5.3.3.dist-info/licenses}/LICENSE +0 -0
@@ -1,2744 +0,0 @@
1
- """
2
- PDX-License-Identifier: Apache-2.0
3
- Copyright Contributors to the ODPi Egeria project.
4
-
5
- Maintain and explore the contents of nested collections.
6
-
7
- """
8
-
9
- import asyncio
10
-
11
- # import json
12
- from pyegeria._client import Client
13
- from pyegeria._globals import NO_ELEMENTS_FOUND
14
- from pyegeria._validators import validate_guid, validate_search_string
15
- from pyegeria.utils import body_slimmer
16
- from pyegeria.output_formatter import (
17
- extract_mermaid_only,
18
- extract_basic_dict,
19
- generate_output,
20
- generate_entity_md,
21
- generate_entity_md_table,
22
- generate_entity_dict,
23
- make_preamble,
24
- make_md_attribute,
25
- MD_SEPARATOR
26
- )
27
-
28
-
29
- class CollectionManager(Client):
30
- """
31
- Maintain and explore the contents of nested collections. These collections can be used to represent digital
32
- products, or collections of resources for a particular project or team. They can be used to organize assets and
33
- other resources into logical groups.
34
-
35
- Attributes:
36
-
37
- server_name: str
38
- The name of the View Server to connect to.
39
- platform_url : str
40
- URL of the server platform to connect to
41
- user_id : str
42
- The identity of the user calling the method - this sets a default optionally used by the methods
43
- when the user doesn't pass the user_id on a method call.
44
- user_pwd: str
45
- The password associated with the user_id. Defaults to None
46
- token: str
47
- An optional bearer token
48
-
49
- """
50
-
51
- def __init__(self, view_server: str, platform_url: str, user_id: str, user_pwd: str = None, token: str = None, ):
52
- self.view_server = view_server
53
- self.platform_url = platform_url
54
- self.user_id = user_id
55
- self.user_pwd = user_pwd
56
-
57
- self.collection_command_root: str = (
58
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/collections")
59
- Client.__init__(self, view_server, platform_url, user_id, user_pwd, token)
60
-
61
- #
62
- # Retrieving Collections - https://egeria-project.org/concepts/collection
63
- #
64
- async def _async_get_attached_collections(self, parent_guid: str, start_from: int = 0,
65
- page_size: int = None, ) -> list:
66
- """Returns the list of collections that are linked off of the supplied element using the ResourceList
67
- relationship. Async version.
68
-
69
- Parameters
70
- ----------
71
- parent_guid: str
72
- The identity of the parent to find linked collections from.
73
-
74
-
75
-
76
- start_from: int, [default=0], optional
77
- When multiple pages of results are available, the page number to start from.
78
- page_size: int, [default=None]
79
- The number of items to return in a single page. If not specified, the default will be taken from
80
- the class instance.
81
- Returns
82
- -------
83
- List
84
-
85
- A list of collections linked off of the supplied element.
86
-
87
- Raises
88
- ------
89
-
90
- InvalidParameterException
91
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
92
- PropertyServerException
93
- Raised by the server when an issue arises in processing a valid request
94
- NotAuthorizedException
95
- The principle specified by the user_id does not have authorization for the requested action
96
-
97
- """
98
-
99
- if page_size is None:
100
- page_size = self.page_size
101
-
102
- body = {}
103
-
104
- url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/"
105
- f"metadata-elements/{parent_guid}/collections?startFrom={start_from}&pageSize={page_size}")
106
-
107
- resp = await self._async_make_request("POST", url, body)
108
- return resp.json()
109
-
110
- def get_attached_collections(self, parent_guid: str, start_from: int = 0, page_size: int = None, ) -> list:
111
- """Returns the list of collections that are linked off of the supplied element.
112
-
113
- Parameters
114
- ----------
115
- parent_guid: str
116
- The identity of the parent to find linked collections from.
117
-
118
-
119
-
120
- start_from: int, [default=0], optional
121
- When multiple pages of results are available, the page number to start from.
122
- page_size: int, [default=None]
123
- The number of items to return in a single page. If not specified, the default will be taken from
124
- the class instance.
125
- Returns
126
- -------
127
- List
128
-
129
- A list of collections linked off of the supplied element.
130
-
131
- Raises
132
- ------
133
-
134
- InvalidParameterException
135
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
136
- PropertyServerException
137
- Raised by the server when an issue arises in processing a valid request
138
- NotAuthorizedException
139
- The principle specified by the user_id does not have authorization for the requested action
140
-
141
- """
142
- loop = asyncio.get_event_loop()
143
- resp = loop.run_until_complete(self._async_get_attached_collections(parent_guid, start_from, page_size))
144
- return resp
145
-
146
- async def _async_get_classified_collections(self, classification: str, start_from: int = 0,
147
- page_size: int = None, output_format: str = 'JSON') -> list | str | dict:
148
- """Returns the list of collections with a particular classification. These classifications
149
- are typically "RootCollection", "Folder" or "DigitalProduct". Async version.
150
-
151
- Parameters
152
- ----------
153
- classification: str
154
- The classification of the collection to inspect.
155
- start_from: int, [default=0], optional
156
- When multiple pages of results are available, the page number to start from.
157
- page_size: int, [default=None]
158
- The number of items to return in a single page. If not specified, the default will be taken from
159
- the class instance.
160
- output_format: str, default = "JSON"
161
- - one of "DICT", "MERMAID" or "JSON"
162
-
163
- Returns
164
- -------
165
- List | str | dict
166
-
167
- A list of collections with the provided classification in the output format specified.
168
- Returns a string if none found.
169
-
170
- Raises
171
- ------
172
- InvalidParameterException
173
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
174
- PropertyServerException
175
- Raised by the server when an issue arises in processing a valid request.
176
- NotAuthorizedException
177
- The principle specified by the user_id does not have authorization for the requested action.
178
- Notes
179
- -----
180
- """
181
-
182
- if page_size is None:
183
- page_size = self.page_size
184
-
185
- body = {"filter": classification}
186
-
187
- url = (f"{self.collection_command_root}/by-classifications?"
188
- f"startFrom={start_from}&pageSize={page_size}")
189
-
190
- response = await self._async_make_request("POST", url, body)
191
- elements = response.json().get("elements", NO_ELEMENTS_FOUND)
192
- if type(elements) is str:
193
- return NO_ELEMENTS_FOUND
194
-
195
- if output_format != 'JSON': # return a simplified markdown representation
196
- return self.generate_collection_output(elements, filter, output_format)
197
- return elements
198
-
199
- def get_classified_collections(self, classification: str, start_from: int = 0,
200
- page_size: int = None, output_format:str = 'JSON') -> list | str | dict:
201
- """Returns the list of collections with a particular classification. These classifications
202
- are typically "RootCollection", "Folder" or "DigitalProduct".
203
-
204
- Parameters
205
- ----------
206
- classification: str
207
- The classification of the collection to inspect.
208
- start_from: int, [default=0], optional
209
- When multiple pages of results are available, the page number to start from.
210
- page_size: int, [default=None]
211
- The number of items to return in a single page. If not specified, the default will be taken from
212
- the class instance.
213
- output_format: str, default = "JSON"
214
- - one of "DICT", "MERMAID" or "JSON"
215
- Returns
216
- -------
217
- List | str | dict
218
-
219
- A list of collections with the provided classification in the output format specified.
220
- Returns a string if none found..
221
-
222
- Raises
223
- ------
224
-
225
- InvalidParameterException
226
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
227
- PropertyServerException
228
- Raised by the server when an issue arises in processing a valid request
229
- NotAuthorizedException
230
- The principle specified by the user_id does not have authorization for the requested action
231
-
232
- """
233
- loop = asyncio.get_event_loop()
234
- resp = loop.run_until_complete(self._async_get_classified_collections(classification,
235
- start_from, page_size, output_format))
236
- return resp
237
-
238
- async def _async_find_collections(self, search_string: str, effective_time: str = None, starts_with: bool = False,
239
- ends_with: bool = False, ignore_case: bool = False, start_from: int = 0, page_size: int = None,
240
- output_format: str = 'JSON') -> list | str:
241
- """Returns the list of collections matching the search string.
242
- The search string is located in the request body and is interpreted as a plain string.
243
- The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
244
-
245
- Parameters
246
- ----------
247
- search_string: str,
248
- Search string to use to find matching collections. If the search string is '*' then all glossaries returned.
249
- effective_time: str, [default=None], optional
250
- Effective time of the query. If not specified will default to any time. ISO8601 format is assumed.
251
- starts_with : bool, [default=False], optional
252
- Starts with the supplied string.
253
- ends_with : bool, [default=False], optional
254
- Ends with the supplied string
255
- ignore_case : bool, [default=False], optional
256
- Ignore case when searching
257
- start_from: int, [default=0], optional
258
- When multiple pages of results are available, the page number to start from.
259
- page_size: int, [default=None]
260
- The number of items to return in a single page. If not specified, the default will be taken from
261
- the class instance.
262
- output_format: str, default = "JSON"
263
- - one of "DICT", "MERMAID" or "JSON"
264
- Returns
265
- -------
266
- List | str
267
-
268
- A list of collections match matching the search string. Returns a string if none found.
269
-
270
- Raises
271
- ------
272
-
273
- InvalidParameterException
274
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
275
- PropertyServerException
276
- Raised by the server when an issue arises in processing a valid request
277
- NotAuthorizedException
278
- The principle specified by the user_id does not have authorization for the requested action
279
-
280
- """
281
-
282
- if page_size is None:
283
- page_size = self.page_size
284
- starts_with_s = str(starts_with).lower()
285
- ends_with_s = str(ends_with).lower()
286
- ignore_case_s = str(ignore_case).lower()
287
-
288
- validate_search_string(search_string)
289
-
290
- if search_string == "*":
291
- search_string = None
292
-
293
- body = {"filter": search_string, "effective_time": effective_time}
294
-
295
- body_s = body_slimmer(body)
296
- url = (f"{self.collection_command_root}/"
297
- f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
298
- f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}")
299
-
300
- response = await self._async_make_request("POST", url, body_s)
301
- elements = response.json().get("elements", NO_ELEMENTS_FOUND)
302
- if type(elements) is str:
303
- return NO_ELEMENTS_FOUND
304
-
305
- if output_format != 'JSON': # return a simplified markdown representation
306
- return self.generate_collection_output(elements, filter, output_format)
307
- return elements
308
-
309
- def find_collections(self, search_string: str, effective_time: str = None, starts_with: bool = False,
310
- ends_with: bool = False, ignore_case: bool = False, start_from: int = 0, page_size: int = None,
311
- output_format: str = 'JSON') -> list | str:
312
- """Returns the list of collections matching the search string. Async version.
313
- The search string is located in the request body and is interpreted as a plain string.
314
- The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
315
-
316
- Parameters
317
- ----------
318
- search_string: str,
319
- Search string to use to find matching collections. If the search string is '*' then all glossaries returned.
320
- effective_time: str, [default=None], optional
321
- Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
322
- starts_with : bool, [default=False], optional
323
- Starts with the supplied string.
324
- ends_with : bool, [default=False], optional
325
- Ends with the supplied string
326
- ignore_case : bool, [default=False], optional
327
- Ignore case when searching
328
- start_from: int, [default=0], optional
329
- When multiple pages of results are available, the page number to start from.
330
- page_size: int, [default=None]
331
- The number of items to return in a single page. If not specified, the default will be taken from
332
- the class instance.
333
- output_format: str, default = "JSON"
334
- - one of "DICT", "MERMAID" or "JSON"
335
- Returns
336
- -------
337
- List | str
338
-
339
- A list of collections match matching the search string. Returns a string if none found.
340
-
341
- Raises
342
- ------
343
-
344
- InvalidParameterException
345
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
346
- PropertyServerException
347
- Raised by the server when an issue arises in processing a valid request
348
- NotAuthorizedException
349
- The principle specified by the user_id does not have authorization for the requested action
350
-
351
- """
352
- loop = asyncio.get_event_loop()
353
- resp = loop.run_until_complete(
354
- self._async_find_collections(search_string, effective_time, starts_with, ends_with, ignore_case, start_from,
355
- page_size, output_format))
356
-
357
- return resp
358
-
359
- async def _async_get_collections_by_name(self, name: str, effective_time: str = None, start_from: int = 0,
360
- page_size: int = None, output_format: str = 'JSON') -> list | str:
361
- """Returns the list of collections with a particular name.
362
-
363
- Parameters
364
- ----------
365
- name: str,
366
- name to use to find matching collections.
367
- effective_time: str, [default=None], optional
368
- Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
369
-
370
-
371
-
372
- start_from: int, [default=0], optional
373
- When multiple pages of results are available, the page number to start from.
374
- page_size: int, [default=None]
375
- The number of items to return in a single page. If not specified, the default will be taken from
376
- the class instance.
377
- output_format: str, default = "JSON"
378
- - one of "DICT", "MERMAID" or "JSON"
379
- Returns
380
- -------
381
- List | str
382
-
383
- A list of collections match matching the name. Returns a string if none found.
384
-
385
- Raises
386
- ------
387
-
388
- InvalidParameterException
389
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
390
- PropertyServerException
391
- Raised by the server when an issue arises in processing a valid request
392
- NotAuthorizedException
393
- The principle specified by the user_id does not have authorization for the requested action
394
-
395
- """
396
-
397
- if page_size is None:
398
- page_size = self.page_size
399
-
400
- validate_search_string(name)
401
-
402
- body = {
403
- "filter": name, effective_time: effective_time,
404
- }
405
- body_s = body_slimmer(body)
406
- url = (f"{self.collection_command_root}/"
407
- f"by-name?startFrom={start_from}&pageSize={page_size}")
408
-
409
- response = await self._async_make_request("POST", url, body_s)
410
- elements = response.json().get("elements", NO_ELEMENTS_FOUND)
411
- if type(elements) is str:
412
- return NO_ELEMENTS_FOUND
413
-
414
- if output_format != 'JSON': # return a simplified markdown representation
415
- return self.generate_collection_output(elements, filter, output_format)
416
- return elements
417
-
418
- def get_collections_by_name(self, name: str, effective_time: str = None, start_from: int = 0, page_size: int = None,
419
- output_format: str = 'JSON') -> list | str:
420
- """Returns the list of collections matching the search string. Async version.
421
- The search string is located in the request body and is interpreted as a plain string.
422
- The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
423
-
424
- Parameters
425
- ----------
426
- name: str,
427
- name to use to find matching collections.
428
- effective_time: str, [default=None], optional
429
- Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
430
- start_from: int, [default=0], optional
431
- When multiple pages of results are available, the page number to start from.
432
- page_size: int, [default=None]
433
- The number of items to return in a single page. If not specified, the default will be taken from
434
- the class instance.
435
- output_format: str, default = "JSON"
436
- - one of "DICT", "MERMAID" or "JSON"
437
-
438
- Returns
439
- -------
440
- List | str
441
-
442
- A list of collections match matching the search string. Returns a string if none found.
443
-
444
- Raises
445
- ------
446
-
447
- InvalidParameterException
448
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
449
- PropertyServerException
450
- Raised by the server when an issue arises in processing a valid request
451
- NotAuthorizedException
452
- The principle specified by the user_id does not have authorization for the requested action
453
-
454
- """
455
- loop = asyncio.get_event_loop()
456
- resp = loop.run_until_complete(
457
- self._async_get_collections_by_name(name, effective_time, start_from, page_size, output_format))
458
-
459
- return resp
460
-
461
- async def _async_get_collections_by_type(self, collection_type: str, effective_time: str = None,
462
- start_from: int = 0, page_size: int = None, output_format: str = 'JSON') -> list | str:
463
- """Returns the list of collections with a particular collectionType. This is an optional text field in the
464
- collection element.
465
-
466
- Parameters
467
- ----------
468
- collection_type: str,
469
- collection_type to use to find matching collections.
470
- effective_time: str, [default=None], optional
471
- Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
472
- start_from: int, [default=0], optional
473
- When multiple pages of results are available, the page number to start from.
474
- page_size: int, [default=None]
475
- The number of items to return in a single page. If not specified, the default will be taken from
476
- the class instance.
477
- output_format: str, default = "JSON"
478
- - one of "DICT", "MERMAID" or "JSON"
479
-
480
- Returns
481
- -------
482
- List | str
483
-
484
- A list of collections match matching the name. Returns a string if none found.
485
-
486
- Raises
487
- ------
488
-
489
- InvalidParameterException
490
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
491
- PropertyServerException
492
- Raised by the server when an issue arises in processing a valid request
493
- NotAuthorizedException
494
- The principle specified by the user_id does not have authorization for the requested action
495
-
496
- """
497
-
498
- if page_size is None:
499
- page_size = self.page_size
500
-
501
- validate_search_string(collection_type)
502
-
503
- body = {
504
- "filter": collection_type, effective_time: effective_time,
505
- }
506
- body_s = body_slimmer(body)
507
-
508
- url = (f"{self.collection_command_root}/"
509
- f"by-collection-type?startFrom={start_from}&pageSize={page_size}")
510
-
511
- response = await self._async_make_request("POST", url, body_s)
512
- elements = response.json().get("elements", NO_ELEMENTS_FOUND)
513
- if type(elements) is str:
514
- return NO_ELEMENTS_FOUND
515
-
516
- if output_format != 'JSON': # return a simplified markdown representation
517
- return self.generate_collection_output(elements, filter, output_format)
518
- return elements
519
-
520
- def get_collections_by_type(self, collection_type: str, effective_time: str = None, start_from: int = 0,
521
- page_size: int = None, output_format: str = 'JSON') -> list | str:
522
- """Returns the list of collections matching the search string. Async version.
523
- The search string is located in the request body and is interpreted as a plain string.
524
- The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
525
-
526
- Parameters
527
- ----------
528
- collection_type: str,
529
- collection type to find.
530
- effective_time: str, [default=None], optional
531
- Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
532
- start_from: int, [default=0], optional
533
- When multiple pages of results are available, the page number to start from.
534
- page_size: int, [default=None]
535
- The number of items to return in a single page. If not specified, the default will be taken from
536
- the class instance.
537
- output_format: str, default = "JSON"
538
- - one of "DICT", "MERMAID" or "JSON"
539
-
540
- Returns
541
- -------
542
- List | str
543
-
544
- A list of collections match matching the search string. Returns a string if none found.
545
-
546
- Raises
547
- ------
548
-
549
- InvalidParameterException
550
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
551
- PropertyServerException
552
- Raised by the server when an issue arises in processing a valid request
553
- NotAuthorizedException
554
- The principle specified by the user_id does not have authorization for the requested action
555
-
556
- """
557
- loop = asyncio.get_event_loop()
558
- resp = loop.run_until_complete(
559
- self._async_get_collections_by_type(collection_type, effective_time, start_from, page_size, output_format))
560
-
561
- return resp
562
-
563
- async def _async_get_collection_by_guid(self, collection_guid: str, effective_time: str = None,
564
- output_format: str = 'JSON') -> dict | str:
565
- """Return the properties of a specific collection. Async version.
566
-
567
- Parameters
568
- ----------
569
- collection_guid: str,
570
- unique identifier of the collection.
571
- effective_time: str, [default=None], optional
572
- Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
573
- output_format: str, default = "JSON"
574
- - one of "DICT", "MERMAID" or "JSON"
575
-
576
- Returns
577
- -------
578
- dict | str
579
-
580
- A JSON dict representing the specified collection. Returns a string if none found.
581
-
582
- Raises
583
- ------
584
-
585
- InvalidParameterException
586
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
587
- PropertyServerException
588
- Raised by the server when an issue arises in processing a valid request
589
- NotAuthorizedException
590
- The principle specified by the user_id does not have authorization for the requested action
591
-
592
- """
593
-
594
- validate_guid(collection_guid)
595
-
596
- url = f"{self.collection_command_root}/{collection_guid}"
597
- body = {
598
- "effective_time": effective_time,
599
- }
600
- response = await self._async_make_request("GET", url, body)
601
- elements = response.json().get("element", NO_ELEMENTS_FOUND)
602
- if type(elements) is str:
603
- return NO_ELEMENTS_FOUND
604
-
605
- if output_format != 'JSON': # return a simplified markdown representation
606
- return self.generate_collection_output(elements, filter, output_format)
607
- return elements
608
-
609
- def get_collection_by_guid(self, collection_guid: str, effective_time: str = None,
610
- output_format: str = 'JSON') -> dict | str:
611
- """Return the properties of a specific collection.
612
-
613
- Parameters
614
- ----------
615
- collection_guid: str,
616
- unique identifier of the collection.
617
- effective_time: str, [default=None], optional
618
- Effective time of the query. If not specified will default to any time.
619
- output_format: str, default = "JSON"
620
- - one of "DICT", "MERMAID" or "JSON"
621
-
622
- Returns
623
- -------
624
- dict | str
625
-
626
- A JSON dict representing the specified collection. Returns a string if none found.
627
-
628
- Raises
629
- ------
630
-
631
- InvalidParameterException
632
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
633
- PropertyServerException
634
- Raised by the server when an issue arises in processing a valid request
635
- NotAuthorizedException
636
- The principle specified by the user_id does not have authorization for the requested action
637
-
638
- """
639
- loop = asyncio.get_event_loop()
640
- resp = loop.run_until_complete(
641
- self._async_get_collection_by_guid(collection_guid, effective_time, output_format))
642
-
643
- return resp
644
-
645
- #
646
- # Create collection methods
647
- #
648
-
649
- ###
650
- # =====================================================================================================================
651
- # Create Collections: https://egeria-project.org/concepts/collection
652
- # These requests use the following parameters:
653
- #
654
- # anchorGUID - the unique identifier of the element that should be the anchor for the new element. Set to null if
655
- # no anchor,
656
- # or if this collection is to be its own anchor.
657
- #
658
- # isOwnAnchor -this element should be classified as its own anchor or not. The default is false.
659
- #
660
- # parentGUID - the optional unique identifier for an element that should be connected to the newly created element.
661
- # If this property is specified, parentRelationshipTypeName must also be specified
662
- #
663
- # parentRelationshipTypeName - the name of the relationship, if any, that should be established between the new
664
- # element and the parent element.
665
- # Examples could be "ResourceList" or "DigitalServiceProduct".
666
- #
667
- # parentAtEnd1 -identifies which end any parent entity sits on the relationship.
668
- #
669
-
670
- async def _async_create_collection_w_body(self, classification_name: str, body: dict) -> str:
671
- """Create Collections: https://egeria-project.org/concepts/collection Async version.
672
-
673
- Parameters
674
- ----------
675
- classification_name: str
676
- Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
677
- body: dict
678
- A dict representing the details of the collection to create.
679
-
680
-
681
- Returns
682
- -------
683
- str - the guid of the created collection
684
-
685
- A JSON dict representing the specified collection. Returns a string if none found.
686
-
687
- Raises
688
- ------
689
- InvalidParameterException
690
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
691
- PropertyServerException
692
- Raised by the server when an issue arises in processing a valid request
693
- NotAuthorizedException
694
- The principle specified by the user_id does not have authorization for the requested action
695
-
696
- Notes:
697
- -----
698
-
699
- Sample body:
700
- {
701
- "isOwnAnchor" : true,
702
- "collectionProperties": {
703
- "class" : "CollectionProperties",
704
- "qualifiedName": "Must provide a unique name here",
705
- "name" : "Add display name here",
706
- "description" : "Add description of the collection here",
707
- "collectionType": "Add appropriate valid value for type"
708
- }
709
- }
710
- or
711
- {
712
- "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
713
- "isOwnAnchor" : false,
714
- "anchorScopeGUID" : "optional GUID of search scope",
715
- "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
716
- "parentRelationshipTypeName" : "open metadata type name",
717
- "parentAtEnd1": true,
718
- "collectionProperties": {
719
- "class" : "CollectionProperties",
720
- "qualifiedName": "Must provide a unique name here",
721
- "name" : "Add display name here",
722
- "description" : "Add description of the collection here",
723
- "collectionType": "Add appropriate valid value for type"
724
- }
725
- }
726
- """
727
-
728
- url = (f"{self.collection_command_root}?"
729
- f"classificationName={classification_name}")
730
-
731
- resp = await self._async_make_request("POST", url, body)
732
- return resp.json().get("guid", "No GUID returned")
733
-
734
- def create_collection_w_body(self, classification_name: str, body: dict) -> str:
735
- """Create Collections: https://egeria-project.org/concepts/collection
736
-
737
- Parameters
738
- ----------
739
- classification_name: str
740
- Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
741
- body: dict
742
- A dict representing the details of the collection to create.
743
-
744
- If not provided, the server name associated with the instance is
745
- used.
746
-
747
- Returns
748
- -------
749
- str - the guid of the created collection
750
-
751
- A JSON dict representing the specified collection. Returns a string if none found.
752
-
753
- Raises
754
- ------
755
- InvalidParameterException
756
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
757
- PropertyServerException
758
- Raised by the server when an issue arises in processing a valid request
759
- NotAuthorizedException
760
- The principle specified by the user_id does not have authorization for the requested action
761
-
762
-
763
- Notes:
764
- -----
765
-
766
- Sample body:
767
- {
768
- "isOwnAnchor" : true,
769
- "collectionProperties": {
770
- "class" : "CollectionProperties",
771
- "qualifiedName": "Must provide a unique name here",
772
- "name" : "Add display name here",
773
- "description" : "Add description of the collection here",
774
- "collectionType": "Add appropriate valid value for type"
775
- }
776
- }
777
- or
778
- {
779
- "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
780
- "isOwnAnchor" : false,
781
- "anchorScopeGUID" : "optional GUID of search scope",
782
- "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
783
- "parentRelationshipTypeName" : "open metadata type name",
784
- "parentAtEnd1": true,
785
- "collectionProperties": {
786
- "class" : "CollectionProperties",
787
- "qualifiedName": "Must provide a unique name here",
788
- "name" : "Add display name here",
789
- "description" : "Add description of the collection here",
790
- "collectionType": "Add appropriate valid value for type"
791
- }
792
- }
793
- """
794
- loop = asyncio.get_event_loop()
795
- resp = loop.run_until_complete(self._async_create_collection_w_body(classification_name, body))
796
- return resp
797
-
798
- async def _async_create_collection(self, classification_name: str, anchor_guid: str, parent_guid: str,
799
- parent_relationship_type_name: str, parent_at_end1: bool, display_name: str, description: str,
800
- collection_type: str, anchor_scope_guid: str = None, is_own_anchor: bool = False,
801
- collection_ordering: str = None, order_property_name: str = None, ) -> str:
802
- """Create Collections: https://egeria-project.org/concepts/collection Async version.
803
-
804
- Parameters
805
- ----------
806
- classification_name: str
807
- Type of collection to create; e.g RootCollection, Folder, ResultsSet, DigitalProduct, HomeCollection,
808
- RecentAccess, WorkItemList, etc.
809
- anchor_guid: str
810
- The unique identifier of the element that should be the anchor for the new element. Set to null if no
811
- anchor, or if this collection is to be its own anchor.
812
- parent_guid: str
813
- The optional unique identifier for an element that should be connected to the newly created element.
814
- If this property is specified, parentRelationshipTypeName must also be specified
815
- parent_relationship_type_name: str
816
- The name of the relationship, if any, that should be established between the new element and the parent
817
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
818
- parent_at_end1: bool
819
- Identifies which end any parent entity sits on the relationship.
820
- display_name: str
821
- The display name of the element. Will also be used as the basis of the qualified_name.
822
- description: str
823
- A description of the collection.
824
- collection_type: str
825
- Adds an appropriate valid value for the collection type.
826
- anchor_scope_guid: str, optional, defaults to None
827
- optional GUID of search scope
828
- is_own_anchor: bool, optional, defaults to False
829
- Indicates if the collection should be classified as its own anchor or not.
830
- collection_ordering: str, optional, defaults to "OTHER"
831
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED",
832
- "OTHER"
833
- order_property_name: str, optional, defaults to "Something"
834
- Property to use for sequencing if collection_ordering is "OTHER"
835
-
836
-
837
- Returns
838
- -------
839
- str - the guid of the created collection
840
-
841
- A JSON dict representing the specified collection. Returns a string if none found.
842
-
843
- Raises
844
- ------
845
- InvalidParameterException
846
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
847
- PropertyServerException
848
- Raised by the server when an issue arises in processing a valid request
849
- NotAuthorizedException
850
- The principle specified by the user_id does not have authorization for the requested action
851
-
852
- """
853
-
854
- if parent_guid is None:
855
- is_own_anchor = False
856
- is_own_anchor_s = str(is_own_anchor).lower()
857
- parent_at_end1_s = str(parent_at_end1).lower()
858
-
859
- url = (f"{self.collection_command_root}?"
860
- f"classificationName={classification_name}")
861
-
862
- body = {
863
- "anchorGUID": anchor_guid, "anchorScopeGUID": anchor_scope_guid, "isOwnAnchor": is_own_anchor_s,
864
- "parentGUID": parent_guid, "parentRelationshipTypeName": parent_relationship_type_name,
865
- "parentAtEnd1": parent_at_end1_s, "collectionProperties": {
866
- "class": "CollectionProperties", "qualifiedName": f"{classification_name}::{display_name}",
867
- "name": display_name, "description": description, "collectionType": collection_type,
868
- "collectionOrdering": collection_ordering, "orderPropertyName": order_property_name,
869
- },
870
- }
871
-
872
- resp = await self._async_make_request("POST", url, body_slimmer(body))
873
- return resp.json().get("guid", "No GUID returned")
874
-
875
- def create_collection(self, classification_name: str, anchor_guid: str, parent_guid: str,
876
- parent_relationship_type_name: str, parent_at_end1: bool, display_name: str, description: str,
877
- collection_type: str, anchor_scope_guid: str = None, is_own_anchor: bool = False,
878
- collection_ordering: str = "OTHER", order_property_name: str = "Something", ) -> str:
879
- """Create Collections: https://egeria-project.org/concepts/collection
880
-
881
- Parameters
882
- ----------
883
-
884
- classification_name: str
885
- Type of collection to create; e.g RootCollection, Folder, ResultsSet, DigitalProduct, HomeCollection,
886
- RecentAccess, WorkItemList, etc.
887
- anchor_guid: str
888
- The unique identifier of the element that should be the anchor for the new element.
889
- Set to null if no anchor, or if this collection is to be its own anchor.
890
- parent_guid: str
891
- The optional unique identifier for an element that should be connected to the newly created element.
892
- If this property is specified, parentRelationshipTypeName must also be specified
893
- parent_relationship_type_name: str
894
- The name of the relationship, if any, that should be established between the new element and the parent
895
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
896
- parent_at_end1: bool
897
- Identifies which end any parent entity sits on the relationship.
898
- display_name: str
899
- The display name of the element. Will also be used as the basis of the qualified_name.
900
- description: str
901
- A description of the collection.
902
- collection_type: str
903
- Adds an appropriate valid value for the collection type.
904
- anchor_scope_guid: str, optional, defaults to None
905
- optional GUID of search scope
906
- is_own_anchor: bool, optional, defaults to False
907
- Indicates if the collection should be classified as its own anchor or not.
908
- collection_ordering: str, optional, defaults to "OTHER"
909
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
910
- "DATE_CREATED", "OTHER"
911
- order_property_name: str, optional, defaults to "Something"
912
- Property to use for sequencing if collection_ordering is "OTHER"
913
-
914
-
915
- Returns
916
- -------
917
- str - the guid of the created collection
918
-
919
- Raises
920
- ------
921
- InvalidParameterException
922
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
923
- PropertyServerException
924
- Raised by the server when an issue arises in processing a valid request
925
- NotAuthorizedException
926
- The principle specified by the user_id does not have authorization for the requested action
927
-
928
- """
929
- loop = asyncio.get_event_loop()
930
- resp = loop.run_until_complete(
931
- self._async_create_collection(classification_name, anchor_guid, parent_guid, parent_relationship_type_name,
932
- parent_at_end1, display_name, description, collection_type, anchor_scope_guid, is_own_anchor,
933
- collection_ordering, order_property_name))
934
- return resp
935
-
936
- async def _async_create_root_collection(self, anchor_guid: str, parent_guid: str,
937
- parent_relationship_type_name: str, parent_at_end1: bool, display_name: str, description: str,
938
- collection_type: str, anchor_scope_guid: str = None, is_own_anchor: bool = False, ) -> str:
939
- """Create a new collection with the RootCollection classification. Used to identify the top of a
940
- collection hierarchy. Async version.
941
-
942
- Parameters
943
- ----------
944
- anchor_guid: str
945
- The unique identifier of the element that should be the anchor for the new element.
946
- Set to null if no anchor, or if this collection is to be its own anchor.
947
- parent_guid: str
948
- The optional unique identifier for an element that should be connected to the newly created element.
949
- If this property is specified, parentRelationshipTypeName must also be specified
950
- parent_relationship_type_name: str
951
- The name of the relationship, if any, that should be established between the new element and the parent
952
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
953
- parent_at_end1: bool
954
- Identifies which end any parent entity sits on the relationship.
955
- display_name: str
956
- The display name of the element. Will also be used as the basis of the qualified_name.
957
- description: str
958
- A description of the collection.
959
- collection_type: str
960
- Adds an appropriate valid value for the collection type.
961
- anchor_scope_guid: str, optional, defaults to None
962
- optional GUID of search scope
963
- is_own_anchor: bool, optional, defaults to False
964
- Indicates if the collection should be classified as its own anchor or not.
965
-
966
- Returns
967
- -------
968
- str - the guid of the created collection
969
-
970
- Raises
971
- ------
972
- InvalidParameterException
973
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
974
- PropertyServerException
975
- Raised by the server when an issue arises in processing a valid request
976
- NotAuthorizedException
977
- The principle specified by the user_id does not have authorization for the requested action
978
-
979
- """
980
-
981
- is_own_anchor_s = str(is_own_anchor).lower()
982
- parent_at_end1_s = str(parent_at_end1).lower()
983
- url = f"{self.collection_command_root}/root-collection"
984
-
985
- body = {
986
- "anchorGUID": anchor_guid, "isOwnAnchor": is_own_anchor_s, "anchorScopeGUID": anchor_scope_guid,
987
- "parentGUID": parent_guid, "parentRelationshipTypeName": parent_relationship_type_name,
988
- "parentAtEnd1": parent_at_end1_s, "collectionProperties": {
989
- "class": "CollectionProperties", "qualifiedName": f"root-collection::{display_name}",
990
- "name": display_name, "description": description, "collectionType": collection_type,
991
- },
992
- }
993
-
994
- resp = await self._async_make_request("POST", url, body_slimmer(body))
995
- return resp.json().get("guid", "No GUID Returned")
996
-
997
- def create_root_collection(self, anchor_guid: str, parent_guid: str, parent_relationship_type_name: str,
998
- parent_at_end1: bool, display_name: str, description: str, collection_type: str,
999
- anchor_scope_guid: str = None, is_own_anchor: bool = False, ) -> str:
1000
- """Create a new collection with the RootCollection classification. Used to identify the top of a
1001
- collection hierarchy.
1002
-
1003
- Parameters
1004
- ----------
1005
- anchor_guid: str
1006
- The unique identifier of the element that should be the anchor for the new element.
1007
- Set to null if no anchor,
1008
- or if this collection is to be its own anchor.
1009
- parent_guid: str
1010
- The optional unique identifier for an element that should be connected to the newly created element.
1011
- If this property is specified, parentRelationshipTypeName must also be specified
1012
- parent_relationship_type_name: str
1013
- The name of the relationship, if any, that should be established between the new element and the parent
1014
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
1015
- parent_at_end1: bool
1016
- Identifies which end any parent entity sits on the relationship.
1017
- display_name: str
1018
- The display name of the element. Will also be used as the basis of the qualified_name.
1019
- description: str
1020
- A description of the collection.
1021
- collection_type: str
1022
- Adds an appropriate valid value for the collection type.
1023
- anchor_scope_guid: str, optional, defaults to None
1024
- optional GUID of search scope
1025
- is_own_anchor: bool, optional, defaults to False
1026
- Indicates if the collection should be classified as its own anchor or not.
1027
-
1028
- Returns
1029
- -------
1030
- str - the guid of the created collection
1031
-
1032
- Raises
1033
- ------
1034
- InvalidParameterException
1035
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1036
- PropertyServerException
1037
- Raised by the server when an issue arises in processing a valid request
1038
- NotAuthorizedException
1039
- The principle specified by the user_id does not have authorization for the requested action
1040
-
1041
- """
1042
- loop = asyncio.get_event_loop()
1043
- resp = loop.run_until_complete(
1044
- self._async_create_root_collection(anchor_guid, parent_guid, parent_relationship_type_name, parent_at_end1,
1045
- display_name, description, collection_type, anchor_scope_guid, is_own_anchor, ))
1046
- return resp
1047
-
1048
- async def _async_create_data_spec_collection(self, anchor_guid: str, parent_guid: str,
1049
- parent_relationship_type_name: str, parent_at_end1: bool, display_name: str, description: str,
1050
- collection_type: str, anchor_scope_guid: str = None, is_own_anchor: bool = True,
1051
- collection_ordering: str = "OTHER", order_property_name: str = "Something",
1052
- qualified_name: str = None, ) -> str:
1053
- """Create a new collection with the DataSpec classification. Used to identify a collection of data fields
1054
- and schema types. Async version.
1055
-
1056
- Parameters
1057
- ----------
1058
- anchor_guid: str
1059
- The unique identifier of the element that should be the anchor for the new element.
1060
- Set to null if no anchor, or if this collection is to be its own anchor.
1061
- parent_guid: str
1062
- The optional unique identifier for an element that should be connected to the newly created element.
1063
- If this property is specified, parentRelationshipTypeName must also be specified
1064
- parent_relationship_type_name: str
1065
- The name of the relationship, if any, that should be established between the new element and the parent
1066
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
1067
- parent_at_end1: bool
1068
- Identifies which end any parent entity sits on the relationship.
1069
- display_name: str
1070
- The display name of the element. Will also be used as the basis of the qualified_name.
1071
- description: str
1072
- A description of the collection.
1073
- collection_type: str
1074
- Adds an appropriate valid value for the collection type.
1075
- anchor_scope_guid: str, optional, defaults to None
1076
- optional GUID of search scope
1077
- is_own_anchor: bool, optional, defaults to False
1078
- Indicates if the collection should be classified as its own anchor or not.
1079
- collection_ordering: str, optional, defaults to "OTHER"
1080
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1081
- "DATE_CREATED", "OTHER"
1082
- order_property_name: str, optional, defaults to "Something"
1083
- Property to use for sequencing if collection_ordering is "OTHER"
1084
- qualified_name: str, optional, defaults to None
1085
- If not specified, a unique name will be created for the collection.
1086
-
1087
- Returns
1088
- -------
1089
- str - the guid of the created collection
1090
-
1091
-
1092
- Raises
1093
- ------
1094
- InvalidParameterException
1095
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1096
- PropertyServerException
1097
- Raised by the server when an issue arises in processing a valid request
1098
- NotAuthorizedException
1099
- The principle specified by the user_id does not have authorization for the requested action
1100
- """
1101
-
1102
- is_own_anchor_s = str(is_own_anchor).lower()
1103
- parent_at_end1_s = str(parent_at_end1).lower()
1104
- url = f"{self.collection_command_root}/data-spec-collection"
1105
- if qualified_name is None:
1106
- qualified_name = self.__create_qualified_name__("DataSpec", display_name)
1107
-
1108
- body = {
1109
- "anchorGUID": anchor_guid, "anchorScopeGUID": anchor_scope_guid, "isOwnAnchor": is_own_anchor_s,
1110
- "parentGUID": parent_guid, "parentRelationshipTypeName": parent_relationship_type_name,
1111
- "parentAtEnd1": parent_at_end1_s, "collectionProperties": {
1112
- "class": "CollectionProperties", "qualifiedName": qualified_name, "name": display_name,
1113
- "description": description, "collectionType": collection_type,
1114
- "collectionOrdering": collection_ordering, "orderPropertyName": order_property_name,
1115
- },
1116
- }
1117
-
1118
- resp = await self._async_make_request("POST", url, body_slimmer(body))
1119
- return resp.json().get("guid", "No GUID Returned")
1120
-
1121
- def create_data_spec_collection(self, anchor_guid: str, parent_guid: str, parent_relationship_type_name: str,
1122
- parent_at_end1: bool, display_name: str, description: str, collection_type: str,
1123
- anchor_scope_guid: str = None, is_own_anchor: bool = False, collection_ordering: str = "OTHER",
1124
- order_property_name: str = "Something", qualified_name: str = None, ) -> str:
1125
- """Create a new collection with the DataSpec classification. Used to identify a collection of data fields
1126
- and schema types.
1127
-
1128
- Parameters
1129
- ----------
1130
- anchor_guid: str
1131
- The unique identifier of the element that should be the anchor for the new element.
1132
- Set to null if no anchor, or if this collection is to be its own anchor.
1133
- parent_guid: str
1134
- The optional unique identifier for an element that should be connected to the newly created element.
1135
- If this property is specified, parentRelationshipTypeName must also be specified
1136
- parent_relationship_type_name: str
1137
- The name of the relationship, if any, that should be established between the new element and the parent
1138
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
1139
- parent_at_end1: bool
1140
- Identifies which end any parent entity sits on the relationship.
1141
- display_name: str
1142
- The display name of the element. Will also be used as the basis of the qualified_name.
1143
- description: str
1144
- A description of the collection.
1145
- collection_type: str
1146
- Adds an appropriate valid value for the collection type.
1147
- anchor_scope_guid: str, optional, defaults to None
1148
- optional GUID of search scope
1149
- is_own_anchor: bool, optional, defaults to False
1150
- Indicates if the collection should be classified as its own anchor or not.
1151
- collection_ordering: str, optional, defaults to "OTHER"
1152
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED", "OTHER"
1153
- order_property_name: str, optional, defaults to "Something"
1154
- Property to use for sequencing if collection_ordering is "OTHER"
1155
- qualified_name: str, optional, defaults to None
1156
- If not specified, a unique name will be created for the collection.
1157
-
1158
- Returns
1159
- -------
1160
- str - the guid of the created collection
1161
-
1162
- Raises
1163
- ------
1164
- InvalidParameterException
1165
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1166
- PropertyServerException
1167
- Raised by the server when an issue arises in processing a valid request
1168
- NotAuthorizedException
1169
- The principle specified by the user_id does not have authorization for the requested action
1170
-
1171
- """
1172
- loop = asyncio.get_event_loop()
1173
- resp = loop.run_until_complete(
1174
- self._async_create_data_spec_collection(anchor_guid, parent_guid, parent_relationship_type_name,
1175
- parent_at_end1, display_name, description, collection_type, anchor_scope_guid, is_own_anchor,
1176
- collection_ordering, order_property_name, qualified_name, ))
1177
- return resp
1178
-
1179
- async def _async_create_data_dictionary_collection(self, anchor_guid: str, parent_guid: str,
1180
- parent_relationship_type_name: str, parent_at_end1: bool, display_name: str, description: str,
1181
- collection_type: str, anchor_scope_guid: str = None, is_own_anchor: bool = True,
1182
- collection_ordering: str = "OTHER", order_property_name: str = "Something",
1183
- qualified_name: str = None, ) -> str:
1184
- """ Create a new collection with the Data Dictionary classification. Used to identify a collection of
1185
- data fields that represent a data store collection of common data types. Async version.
1186
-
1187
- Parameters
1188
- ----------
1189
- anchor_guid: str
1190
- The unique identifier of the element that should be the anchor for the new element.
1191
- Set to null if no anchor, or if this collection is to be its own anchor.
1192
- parent_guid: str
1193
- The optional unique identifier for an element that should be connected to the newly created element.
1194
- If this property is specified, parentRelationshipTypeName must also be specified
1195
- parent_relationship_type_name: str
1196
- The name of the relationship, if any, that should be established between the new element and the parent
1197
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
1198
- parent_at_end1: bool
1199
- Identifies which end any parent entity sits on the relationship.
1200
- display_name: str
1201
- The display name of the element. Will also be used as the basis of the qualified_name.
1202
- description: str
1203
- A description of the collection.
1204
- collection_type: str
1205
- Add an appropriate valid value for the collection type.
1206
- anchor_scope_guid: str, optional, defaults to None
1207
- GUID for search scope
1208
- is_own_anchor: bool, optional, defaults to False
1209
- Indicates if the collection should be classified as its own anchor or not.
1210
- collection_ordering: str, optional, defaults to "OTHER"
1211
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1212
- "DATE_CREATED", "OTHER"
1213
- order_property_name: str, optional, defaults to "Something"
1214
- Property to use for sequencing if collection_ordering is "OTHER"
1215
- qualified_name: str, optional, defaults to None
1216
- If not specified a qualified name will be generated from the display name and the collection type.
1217
- Returns
1218
- -------
1219
- str - the guid of the created collection
1220
-
1221
-
1222
- Raises
1223
- ------
1224
- InvalidParameterException
1225
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1226
- PropertyServerException
1227
- Raised by the server when an issue arises in processing a valid request
1228
- NotAuthorizedException
1229
- The principle specified by the user_id does not have authorization for the requested action
1230
- """
1231
-
1232
- is_own_anchor_s = str(is_own_anchor).lower()
1233
- parent_at_end1_s = str(parent_at_end1).lower()
1234
- url = f"{self.collection_command_root}/data-dictionary-collection"
1235
- if qualified_name is None:
1236
- qualified_name = self.__create_qualified_name__("DataDict", display_name)
1237
-
1238
- body = {
1239
- "anchorGUID": anchor_guid, "isOwnAnchor": is_own_anchor_s, "anchorScopeGUID": anchor_scope_guid,
1240
- "parentGUID": parent_guid, "parentRelationshipTypeName": parent_relationship_type_name,
1241
- "parentAtEnd1": parent_at_end1_s, "collectionProperties": {
1242
- "class": "CollectionProperties", "qualifiedName": qualified_name, "name": display_name,
1243
- "description": description, "collectionType": collection_type,
1244
- "collectionOrdering": collection_ordering, "orderPropertyName": order_property_name,
1245
- },
1246
- }
1247
-
1248
- resp = await self._async_make_request("POST", url, body_slimmer(body))
1249
- return resp.json().get("guid", "No GUID Returned")
1250
-
1251
- def create_data_dictionary_collection(self, anchor_guid: str, parent_guid: str, parent_relationship_type_name: str,
1252
- parent_at_end1: bool, display_name: str, description: str, collection_type: str,
1253
- anchor_scope_guid: str = None, is_own_anchor: bool = False, collection_ordering: str = "OTHER",
1254
- order_property_name: str = "Something", qualified_name: str = None, ) -> str:
1255
- """Create a new collection with the DataSpec classification. Used to identify a collection of data fields
1256
- and schema types.
1257
-
1258
- Parameters
1259
- ----------
1260
- anchor_guid: str
1261
- The unique identifier of the element that should be the anchor for the new element.
1262
- Set to null if no anchor, or if this collection is to be its own anchor.
1263
- parent_guid: str
1264
- The optional unique identifier for an element that should be connected to the newly created element.
1265
- If this property is specified, parentRelationshipTypeName must also be specified
1266
- parent_relationship_type_name: str
1267
- The name of the relationship, if any, that should be established between the new element and the parent
1268
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
1269
- parent_at_end1: bool
1270
- Identifies which end any parent entity sits on the relationship.
1271
- display_name: str
1272
- The display name of the element. Will also be used as the basis of the qualified_name.
1273
- description: str
1274
- A description of the collection.
1275
- collection_type: str
1276
- Adds an appropriate valid value for the collection type.
1277
- anchor_scope_guid: str, optional, defaults to None
1278
- optional GUID of search scope
1279
- is_own_anchor: bool, optional, defaults to False
1280
- Indicates if the collection should be classified as its own anchor or not.
1281
- collection_ordering: str, optional, defaults to "OTHER"
1282
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED", "OTHER"
1283
- order_property_name: str, optional, defaults to "Something"
1284
- Property to use for sequencing if collection_ordering is "OTHER"
1285
- qualified_name: str, optional, defaults to None
1286
- If not specified a qualified name will be generated from the display name and the collection type.
1287
-
1288
- Returns
1289
- -------
1290
- str - the guid of the created collection
1291
-
1292
- Raises
1293
- ------
1294
- InvalidParameterException
1295
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1296
- PropertyServerException
1297
- Raised by the server when an issue arises in processing a valid request
1298
- NotAuthorizedException
1299
- The principle specified by the user_id does not have authorization for the requested action
1300
-
1301
- """
1302
- loop = asyncio.get_event_loop()
1303
- resp = loop.run_until_complete(
1304
- self._async_create_data_dictionary_collection(anchor_guid, parent_guid, parent_relationship_type_name,
1305
- parent_at_end1, display_name, description, collection_type, anchor_scope_guid, is_own_anchor,
1306
- collection_ordering, order_property_name, qualified_name))
1307
- return resp
1308
-
1309
- async def _async_create_folder_collection(self, anchor_guid: str, parent_guid: str,
1310
- parent_relationship_type_name: str, parent_at_end1: bool, display_name: str, description: str,
1311
- collection_type: str, anchor_scope_guid: str = None, is_own_anchor: bool = True,
1312
- collection_ordering: str = "OTHER", order_property_name: str = "Something", ) -> str:
1313
- """Create a new collection with the Folder classification. This is used to identify the organizing
1314
- collections in a collection hierarchy. Async version.
1315
-
1316
- Parameters
1317
- ----------
1318
- anchor_guid: str
1319
- The unique identifier of the element that should be the anchor for the new element.
1320
- Set to null if no anchor, or if this collection is to be its own anchor.
1321
- parent_guid: str
1322
- The optional unique identifier for an element that should be connected to the newly created element.
1323
- If this property is specified, parentRelationshipTypeName must also be specified
1324
- parent_relationship_type_name: str
1325
- The name of the relationship, if any, that should be established between the new element and the parent
1326
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
1327
- parent_at_end1: bool
1328
- Identifies which end any parent entity sits on the relationship.
1329
- display_name: str
1330
- The display name of the element. Will also be used as the basis of the qualified_name.
1331
- description: str
1332
- A description of the collection.
1333
- collection_type: str
1334
- Adds an appropriate valid value for the collection type.
1335
- anchor_scope_guid: str, optional, defaults to None
1336
- optional GUID of search scope
1337
- is_own_anchor: bool, optional, defaults to False
1338
- Indicates if the collection should be classified as its own anchor or not.
1339
- collection_ordering: str, optional, defaults to "OTHER"
1340
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1341
- "DATE_CREATED", "OTHER"
1342
- order_property_name: str, optional, defaults to "Something"
1343
- Property to use for sequencing if collection_ordering is "OTHER"
1344
-
1345
- Returns
1346
- -------
1347
- str - the guid of the created collection
1348
-
1349
- Raises
1350
- ------
1351
- InvalidParameterException
1352
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1353
- PropertyServerException
1354
- Raised by the server when an issue arises in processing a valid request
1355
- NotAuthorizedException
1356
- The principle specified by the user_id does not have authorization for the requested action
1357
-
1358
- """
1359
-
1360
- is_own_anchor_s = str(is_own_anchor).lower()
1361
- parent_at_end1_s = str(parent_at_end1).lower()
1362
- url = f"{self.collection_command_root}/folder"
1363
-
1364
- body = {
1365
- "anchorGUID": anchor_guid, "anchorScopeGUID": anchor_scope_guid, "isOwnAnchor": is_own_anchor_s,
1366
- "parentGUID": parent_guid, "parentRelationshipTypeName": parent_relationship_type_name,
1367
- "parentAtEnd1": parent_at_end1_s, "collectionProperties": {
1368
- "class": "CollectionProperties", "qualifiedName": f"folder-collection::{display_name}",
1369
- "name": display_name, "description": description, "collectionType": collection_type,
1370
- "collectionOrdering": collection_ordering, "orderPropertyName": order_property_name,
1371
- },
1372
- }
1373
-
1374
- resp = await self._async_make_request("POST", url, body_slimmer(body))
1375
- return resp.json().get("guid", "No GUID returned")
1376
-
1377
- def create_folder_collection(self, anchor_guid: str, parent_guid: str, parent_relationship_type_name: str,
1378
- parent_at_end1: bool, display_name: str, description: str, collection_type: str,
1379
- anchor_scope_guid: str = None, is_own_anchor: bool = True, collection_ordering: str = "OTHER",
1380
- order_property_name: str = "Something", ) -> str:
1381
- """Create a new collection with the Folder classification. This is used to identify the organizing
1382
- collections in a collection hierarchy.
1383
-
1384
- Parameters
1385
- ----------
1386
- anchor_guid: str
1387
- The unique identifier of the element that should be the anchor for the new element.
1388
- Set to null if no anchor, or if this collection is to be its own anchor.
1389
- parent_guid: str
1390
- The optional unique identifier for an element that should be connected to the newly created element.
1391
- If this property is specified, parentRelationshipTypeName must also be specified
1392
- parent_relationship_type_name: str
1393
- The name of the relationship, if any, that should be established between the new element and the parent
1394
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
1395
- parent_at_end1: bool
1396
- Identifies which end any parent entity sits on the relationship.
1397
- display_name: str
1398
- The display name of the element. Will also be used as the basis of the qualified_name.
1399
- description: str
1400
- A description of the collection.
1401
- collection_type: str
1402
- Adds an appropriate valid value for the collection type.
1403
- anchor_scope_guid: str, optional, defaults to None
1404
- optional GUID of search scope
1405
- is_own_anchor: bool, optional, defaults to False
1406
- Indicates if the collection should be classified as its own anchor or not.
1407
- collection_ordering: str, optional, defaults to "OTHER"
1408
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED",
1409
- "OTHER"
1410
- order_property_name: str, optional, defaults to "Something"
1411
- Property to use for sequencing if collection_ordering is "OTHER"
1412
-
1413
- Returns
1414
- -------
1415
- str - the guid of the created collection
1416
-
1417
-
1418
- Raises
1419
- ------
1420
- InvalidParameterException
1421
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1422
- PropertyServerException
1423
- Raised by the server when an issue arises in processing a valid request
1424
- NotAuthorizedException
1425
- The principle specified by the user_id does not have authorization for the requested action
1426
-
1427
- """
1428
- loop = asyncio.get_event_loop()
1429
- resp = loop.run_until_complete(
1430
- self._async_create_folder_collection(anchor_guid, parent_guid, parent_relationship_type_name,
1431
- parent_at_end1, display_name, description, collection_type, anchor_scope_guid, is_own_anchor,
1432
- collection_ordering, order_property_name, ))
1433
- return resp
1434
-
1435
- async def _async_create_collection_from_template(self, body: dict) -> str:
1436
- """Create a new metadata element to represent a collection using an existing metadata element as a template.
1437
- The template defines additional classifications and relationships that are added to the new collection.
1438
- Async version.
1439
-
1440
- Parameters
1441
- ----------
1442
-
1443
- body: dict
1444
- A dict representing the details of the collection to create.
1445
-
1446
- Returns
1447
- -------
1448
- str - the guid of the created collection
1449
-
1450
- Raises
1451
- ------
1452
- InvalidParameterException
1453
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1454
- PropertyServerException
1455
- Raised by the server when an issue arises in processing a valid request
1456
- NotAuthorizedException
1457
- The principle specified by the user_id does not have authorization for the requested action
1458
-
1459
- Notes
1460
- -----
1461
- JSON Structure looks like:
1462
-
1463
- {
1464
- "class": "TemplateRequestBody",
1465
- "anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
1466
- "isOwnAnchor": false,
1467
- "parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
1468
- "parentRelationshipTypeName": "open metadata type name",
1469
- "parentAtEnd1": true,
1470
- "templateGUID": "template GUID",
1471
- "replacementProperties": {
1472
- "class": "ElementProperties",
1473
- "propertyValueMap" : {
1474
- "propertyName" : {
1475
- "class": "PrimitiveTypePropertyValue",
1476
- "typeName": "string",
1477
- "primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
1478
- "primitiveValue" : "value of property"
1479
- }
1480
- }
1481
- },
1482
- "placeholderPropertyValues" : {
1483
- "placeholderProperty1Name" : "property1Value",
1484
- "placeholderProperty2Name" : "property2Value"
1485
- }
1486
- }
1487
-
1488
- """
1489
-
1490
- url = f"{self.collection_command_root}/from-template"
1491
-
1492
- resp = await self._async_make_request("POST", url, body)
1493
- return resp.json().get("guid", "No GUID Returned")
1494
-
1495
- def create_collection_from_template(self, body: dict) -> str:
1496
- """Create a new metadata element to represent a collection using an existing metadata element as a template.
1497
- The template defines additional classifications and relationships that are added to the new collection.
1498
-
1499
- Parameters
1500
- ----------
1501
- body: dict
1502
- A dict representing the details of the collection to create.
1503
-
1504
- Returns
1505
- -------
1506
- str - the guid of the created collection
1507
-
1508
- Raises
1509
- ------
1510
- InvalidParameterException
1511
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1512
- PropertyServerException
1513
- Raised by the server when an issue arises in processing a valid request
1514
- NotAuthorizedException
1515
- The principle specified by the user_id does not have authorization for the requested action
1516
-
1517
- Notes
1518
- -----
1519
- JSON Structure looks like:
1520
-
1521
- {
1522
- "class": "TemplateRequestBody",
1523
- "anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
1524
- "isOwnAnchor": false,
1525
- "parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
1526
- "parentRelationshipTypeName": "open metadata type name",
1527
- "parentAtEnd1": true,
1528
- "templateGUID": "template GUID",
1529
- "replacementProperties": {
1530
- "class": "ElementProperties",
1531
- "propertyValueMap" : {
1532
- "propertyName" : {
1533
- "class": "PrimitiveTypePropertyValue",
1534
- "typeName": "string",
1535
- "primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
1536
- "primitiveValue" : "value of property"
1537
- }
1538
- }
1539
- },
1540
- "placeholderPropertyValues" : {
1541
- "placeholderProperty1Name" : "property1Value",
1542
- "placeholderProperty2Name" : "property2Value"
1543
- }
1544
- }
1545
- """
1546
- loop = asyncio.get_event_loop()
1547
- resp = loop.run_until_complete(self._async_create_collection_from_template(body))
1548
- return resp
1549
-
1550
- async def _async_create_digital_product(self, body: dict) -> str:
1551
- """Create a new collection that represents a digital product. Async version.
1552
-
1553
- Parameters
1554
- ----------
1555
- body: dict
1556
- A dict representing the details of the collection to create.
1557
-
1558
- If not provided, the server name associated
1559
- with the instance is used.
1560
-
1561
- Returns
1562
- -------
1563
- str - the guid of the created collection
1564
-
1565
- Raises
1566
- ------
1567
- InvalidParameterException
1568
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1569
- PropertyServerException
1570
- Raised by the server when an issue arises in processing a valid request
1571
- NotAuthorizedException
1572
- The principle specified by the user_id does not have authorization for the requested action
1573
-
1574
- Notes
1575
- -----
1576
- JSON Structure looks like:
1577
- {
1578
- "class" : "NewDigitalProductRequestBody",
1579
- "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
1580
- "isOwnAnchor" : false,
1581
- "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
1582
- "parentRelationshipTypeName" : "open metadata type name",
1583
- "parentAtEnd1": true,
1584
- "collectionProperties": {
1585
- "class" : "CollectionProperties",
1586
- "qualifiedName": "Must provide a unique name here",
1587
- "name" : "Add display name here",
1588
- "description" : "Add description of the collection here",
1589
- "collectionType": "Add appropriate valid value for type",
1590
- "collectionOrdering" : "OTHER",
1591
- "orderPropertyName" : "Add property name if 'collectionOrdering' is OTHER"
1592
- },
1593
- "digitalProductProperties" : {
1594
- "class" : "DigitalProductProperties",
1595
- "productStatus" : "ACTIVE",
1596
- "productName" : "Add name here",
1597
- "productType" : "Add valid value here",
1598
- "description" : "Add description here",
1599
- "introductionDate" : "date",
1600
- "maturity" : "Add valid value here",
1601
- "serviceLife" : "Add the estimated lifetime of the product",
1602
- "currentVersion": "V1.0",
1603
- "nextVersion": "V1.1",
1604
- "withdrawDate": "date",
1605
- "additionalProperties": {
1606
- "property1Name" : "property1Value",
1607
- "property2Name" : "property2Value"
1608
- }
1609
- }
1610
- }
1611
- """
1612
-
1613
- url = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/digital-products"
1614
-
1615
- resp = await self._async_make_request("POST", url, body)
1616
- return resp.json().get("guid", "No GUID returned")
1617
-
1618
- def create_digital_product(self, body: dict) -> str:
1619
- """Create a new collection that represents a digital product. Async version.
1620
-
1621
- Parameters
1622
- ----------
1623
- body: dict
1624
- A dict representing the details of the collection to create.
1625
-
1626
- If not provided, the server name associated
1627
- with the instance is used.
1628
-
1629
- Returns
1630
- -------
1631
- str - the guid of the created collection
1632
-
1633
- Raises
1634
- ------
1635
- InvalidParameterException
1636
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1637
- PropertyServerException
1638
- Raised by the server when an issue arises in processing a valid request
1639
- NotAuthorizedException
1640
- The principle specified by the user_id does not have authorization for the requested action
1641
-
1642
- Notes
1643
- -----
1644
- JSON Structure looks like:
1645
- {
1646
- "class" : "NewDigitalProductRequestBody",
1647
- "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
1648
- "isOwnAnchor" : false,
1649
- "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
1650
- "parentRelationshipTypeName" : "open metadata type name",
1651
- "parentAtEnd1": true,
1652
- "collectionProperties": {
1653
- "class" : "CollectionProperties",
1654
- "qualifiedName": "Must provide a unique name here",
1655
- "name" : "Add display name here",
1656
- "description" : "Add description of the collection here",
1657
- "collectionType": "Add appropriate valid value for type",
1658
- "collectionOrdering" : "OTHER",
1659
- "orderPropertyName" : "Add property name if 'collectionOrdering' is OTHER"
1660
- },
1661
- "digitalProductProperties" : {
1662
- "class" : "DigitalProductProperties",
1663
- "productStatus" : "ACTIVE",
1664
- "productName" : "Add name here",
1665
- "productType" : "Add valid value here",
1666
- "description" : "Add description here",
1667
- "introductionDate" : "date",
1668
- "maturity" : "Add valid value here",
1669
- "serviceLife" : "Add the estimated lifetime of the product",
1670
- "currentVersion": "V1.0",
1671
- "nextVersion": "V1.1",
1672
- "withdrawDate": "date",
1673
- "additionalProperties": {
1674
- "property1Name" : "property1Value",
1675
- "property2Name" : "property2Value"
1676
- }
1677
- }
1678
- }
1679
- """
1680
- loop = asyncio.get_event_loop()
1681
- resp = loop.run_until_complete(self._async_create_digital_product(body))
1682
- return resp
1683
-
1684
- #
1685
- # Manage collections
1686
- #
1687
- async def _async_update_collection(self, collection_guid: str, qualified_name: str = None, display_name: str = None,
1688
- description: str = None, collection_type: str = None, collection_ordering: str = None,
1689
- order_property_name: str = None, replace_all_props: bool = False, ) -> None:
1690
- """Update the properties of a collection. Async version.
1691
-
1692
- Parameters
1693
- ----------
1694
- collection_guid: str
1695
- The guid of the collection to update.
1696
- qualified_name: str, optional, defaults to None
1697
- The qualified name of the collection to update.
1698
- display_name: str, optional, defaults to None
1699
- The display name of the element. Will also be used as the basis of the qualified_name.
1700
- description: str, optional, defaults to None
1701
- A description of the collection.
1702
- collection_type: str, optional, defaults to None
1703
- Add appropriate valid value for the collection type.
1704
- collection_ordering: str, optional, defaults to None
1705
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1706
- "DATE_CREATED", "OTHER"
1707
- order_property_name: str, optional, defaults to None
1708
- Property to use for sequencing if collection_ordering is "OTHER"
1709
- replace_all_props: bool, optional, defaults to False
1710
- Whether to replace all properties in the collection.
1711
-
1712
- If not provided, the server name associated
1713
- with the instance is used.
1714
-
1715
- Returns
1716
- -------
1717
- Nothing
1718
-
1719
- Raises
1720
- ------
1721
- InvalidParameterException
1722
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1723
- PropertyServerException
1724
- Raised by the server when an issue arises in processing a valid request
1725
- NotAuthorizedException
1726
- The principle specified by the user_id does not have authorization for the requested action
1727
- """
1728
-
1729
- replace_all_props_s = str(replace_all_props).lower()
1730
- url = (f"{self.collection_command_root}/{collection_guid}/update?"
1731
- f"replaceAllProperties={replace_all_props_s}")
1732
-
1733
- body = {
1734
- "class": "CollectionProperties", "qualifiedName": qualified_name, "name": display_name,
1735
- "description": description, "collectionType": collection_type, "collectionOrdering": collection_ordering,
1736
- "orderPropertyName": order_property_name,
1737
- }
1738
- body_s = body_slimmer(body)
1739
- await self._async_make_request("POST", url, body_s)
1740
- return
1741
-
1742
- def update_collection(self, collection_guid, qualified_name: str = None, display_name: str = None,
1743
- description: str = None, collection_type: str = None, collection_ordering: str = None,
1744
- order_property_name: str = None, replace_all_props: bool = False, ) -> None:
1745
- """Update the properties of a collection.
1746
-
1747
- Parameters
1748
- ----------
1749
- collection_guid: str
1750
- The guid of the collection to update.
1751
- qualified_name: str
1752
- The qualified name of the collection to update.
1753
- display_name: str
1754
- The display name of the element. Will also be used as the basis of the qualified_name.
1755
- description: str
1756
- A description of the collection.
1757
- collection_type: str
1758
- Add appropriate valid value for the collection type.
1759
- collection_ordering: str, optional, defaults to "OTHER"
1760
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1761
- "DATE_CREATED", "OTHER"
1762
- order_property_name: str, optional, defaults to "Something"
1763
- Property to use for sequencing if collection_ordering is "OTHER"
1764
- replace_all_props: bool, optional, defaults to False
1765
- Whether to replace all properties in the collection.
1766
-
1767
- If not provided, the server name associated
1768
- with the instance is used.
1769
-
1770
- Returns
1771
- -------
1772
- Nothing
1773
-
1774
- Raises
1775
- ------
1776
- InvalidParameterException
1777
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1778
- PropertyServerException
1779
- Raised by the server when an issue arises in processing a valid request
1780
- NotAuthorizedException
1781
- The principle specified by the user_id does not have authorization for the requested action
1782
- """
1783
- loop = asyncio.get_event_loop()
1784
- loop.run_until_complete(
1785
- self._async_update_collection(collection_guid, qualified_name, display_name, description, collection_type,
1786
- collection_ordering, order_property_name, replace_all_props, ))
1787
- return
1788
-
1789
- async def _async_update_digital_product(self, collection_guid: str, body: dict, replace_all_props: bool = False, ):
1790
- """Update the properties of the DigitalProduct classification attached to a collection. Async version.
1791
-
1792
- Parameters
1793
- ----------
1794
- collection_guid: str
1795
- The guid of the collection to update.
1796
- body: dict
1797
- A dict representing the details of the collection to create.
1798
- replace_all_props: bool, optional, defaults to False
1799
- Whether to replace all properties in the collection.
1800
-
1801
-
1802
- Returns
1803
- -------
1804
- Nothing
1805
-
1806
- Raises
1807
- ------
1808
- InvalidParameterException
1809
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1810
- PropertyServerException
1811
- Raised by the server when an issue arises in processing a valid request
1812
- NotAuthorizedException
1813
- The principle specified by the user_id does not have authorization for the requested action
1814
-
1815
- Notes
1816
- -----
1817
- JSON Structure looks like:
1818
- {
1819
- "class" : "DigitalProductProperties",
1820
- "productStatus" : "ACTIVE",
1821
- "productName" : "Add name here",
1822
- "productType" : "Add valid value here",
1823
- "description" : "Add description here",
1824
- "introductionDate" : "date",
1825
- "maturity" : "Add valid value here",
1826
- "serviceLife" : "Add the estimated lifetime of the product",
1827
- "currentVersion": "V1.0",
1828
- "nextVersion": "V1.1",
1829
- "withdrawDate": "date",
1830
- "additionalProperties": {
1831
- "property1Name" : "property1Value",
1832
- "property2Name" : "property2Value"
1833
- }
1834
- }
1835
- """
1836
-
1837
- replace_all_props_s = str(replace_all_props).lower()
1838
- url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/digital-products/"
1839
- f"{collection_guid}/update?replaceAllProperties={replace_all_props_s}")
1840
-
1841
- await self._async_make_request("POST", url, body)
1842
- return
1843
-
1844
- def update_digital_product(self, collection_guid: str, body: dict, replace_all_props: bool = False, ):
1845
- """Update the properties of the DigitalProduct classification attached to a collection.
1846
-
1847
- Parameters
1848
- ----------
1849
- collection_guid: str
1850
- The guid of the collection to update.
1851
- body: dict
1852
- A dict representing the details of the collection to create.
1853
- replace_all_props: bool, optional, defaults to False
1854
- Whether to replace all properties in the collection.
1855
-
1856
-
1857
- Returns
1858
- -------
1859
- Nothing
1860
-
1861
- Raises
1862
- ------
1863
- InvalidParameterException
1864
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1865
- PropertyServerException
1866
- Raised by the server when an issue arises in processing a valid request
1867
- NotAuthorizedException
1868
- The principle specified by the user_id does not have authorization for the requested action
1869
-
1870
- Notes
1871
- -----
1872
- JSON Structure looks like:
1873
- {
1874
- "class" : "DigitalProductProperties",
1875
- "productStatus" : "ACTIVE",
1876
- "productName" : "Add name here",
1877
- "productType" : "Add valid value here",
1878
- "description" : "Add description here",
1879
- "introductionDate" : "date",
1880
- "maturity" : "Add valid value here",
1881
- "serviceLife" : "Add the estimated lifetime of the product",
1882
- "currentVersion": "V1.0",
1883
- "nextVersion": "V1.1",
1884
- "withdrawDate": "date",
1885
- "additionalProperties": {
1886
- "property1Name" : "property1Value",
1887
- "property2Name" : "property2Value"
1888
- }
1889
- }
1890
- """
1891
- loop = asyncio.get_event_loop()
1892
- loop.run_until_complete(self._async_update_digital_product(collection_guid, body, replace_all_props))
1893
- return
1894
-
1895
- async def _async_attach_collection(self, collection_guid: str, element_guid: str, resource_use: str,
1896
- resource_use_description: str = None, resource_use_props: dict = None, watch_resources: bool = False,
1897
- make_anchor: bool = False, ) -> None:
1898
- """ Connect an existing collection to an element using the ResourceList relationship (0019). Async version.
1899
- Parameters
1900
- ----------
1901
- collection_guid: str
1902
- The guid of the collection to update.
1903
- element_guid: str
1904
- The guid of the element to attach.
1905
- resource_use: str,
1906
- How the resource is being used.
1907
- resource_use_description: str
1908
- Describes how the resource is being used.
1909
- resource_use_props: dict, optional, defaults to None
1910
- The properties of the resource to be used.
1911
- watch_resources, bool, optional, defaults to False
1912
- Whether to watch for the resources to be updated.
1913
- make_anchor, bool, optional, defaults to False
1914
- Whether to make this an anchor.
1915
-
1916
-
1917
- Returns
1918
- -------
1919
- Nothing
1920
-
1921
- Raises
1922
- ------
1923
- InvalidParameterException
1924
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1925
- PropertyServerException
1926
- Raised by the server when an issue arises in processing a valid request
1927
- NotAuthorizedException
1928
- The principle specified by the user_id does not have authorization for the requested action
1929
-
1930
- """
1931
-
1932
- watch_resources_s = str(watch_resources).lower()
1933
- make_anchor_s = str(make_anchor).lower()
1934
-
1935
- url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/metadata-elements/"
1936
- f"{element_guid}/collections/{collection_guid}/attach?makeAnchor={make_anchor_s}")
1937
-
1938
- body = {
1939
- "class": "ResourceListProperties", "resourceUse": resource_use,
1940
- "resourceUseDescription": resource_use_description, "watchResource": watch_resources_s,
1941
- "resourceUseProperties": resource_use_props,
1942
- }
1943
- await self._async_make_request("POST", url, body)
1944
-
1945
- def attach_collection(self, collection_guid: str, element_guid: str, resource_use: str,
1946
- resource_use_description: str, resource_use_props: dict = None, watch_resources: bool = False,
1947
- make_anchor: bool = False, ) -> None:
1948
- """Connect an existing collection to an element using the ResourceList relationship (0019).
1949
- Parameters
1950
- ----------
1951
- collection_guid: str
1952
- The guid of the collection to update.
1953
- element_guid: str
1954
- The guid of the element to attach.
1955
- resource_use: str,
1956
- How the resource is being used.
1957
- resource_use_description: str
1958
- Describe how the resource is being used.
1959
- resource_use_props: dict, optional, defaults to None
1960
- The properties of the resource to be used.
1961
- watch_resources: bool, optional, defaults to False
1962
- Whether to watch for the resources to be updated.
1963
- make_anchor: bool, optional, defaults to False
1964
- Whether to make the this an anchor.
1965
-
1966
- If not provided, the server name associated
1967
- with the instance is used.
1968
-
1969
- Returns
1970
- -------
1971
- Nothing
1972
-
1973
- Raises
1974
- ------
1975
- InvalidParameterException
1976
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1977
- PropertyServerException
1978
- Raised by the server when an issue arises in processing a valid request
1979
- NotAuthorizedException
1980
- The principle specified by the user_id does not have authorization for the requested action
1981
-
1982
- """
1983
- loop = asyncio.get_event_loop()
1984
- loop.run_until_complete(
1985
- self._async_attach_collection(collection_guid, element_guid, resource_use, resource_use_description,
1986
- resource_use_props, watch_resources, make_anchor, ))
1987
- return
1988
-
1989
- async def _async_detach_collection(self, collection_guid: str, element_guid: str) -> None:
1990
- """Detach an existing collection from an element. If the collection is anchored to the element, it is deleted.
1991
- Async version.
1992
-
1993
- Parameters
1994
- ----------
1995
- collection_guid: str
1996
- The guid of the collection to update.
1997
- element_guid: str
1998
- The guid of the element to attach.
1999
-
2000
- If not provided, the server name associated
2001
- with the instance is used.
2002
-
2003
- Returns
2004
- -------
2005
- Nothing
2006
-
2007
- Raises
2008
- ------
2009
- InvalidParameterException
2010
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2011
- PropertyServerException
2012
- Raised by the server when an issue arises in processing a valid request
2013
- NotAuthorizedException
2014
- The principle specified by the user_id does not have authorization for the requested action
2015
-
2016
- """
2017
-
2018
- url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/metadata-elements/"
2019
- f"{element_guid}/collections/{collection_guid}/detach")
2020
-
2021
- body = {"class": "NullRequestBody"}
2022
-
2023
- await self._async_make_request("POST", url, body)
2024
- return
2025
-
2026
- def detach_collection(self, collection_guid: str, element_guid: str) -> None:
2027
- """Connect an existing collection to an element using the ResourceList relationship (0019).
2028
- Parameters
2029
- ----------
2030
- collection_guid: str
2031
- The guid of the collection to update.
2032
- element_guid: str
2033
- The guid of the element to attach.
2034
-
2035
- If not provided, the server name associated
2036
- with the instance is used.
2037
-
2038
- Returns
2039
- -------
2040
- Nothing
2041
-
2042
- Raises
2043
- ------
2044
- InvalidParameterException
2045
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2046
- PropertyServerException
2047
- Raised by the server when an issue arises in processing a valid request
2048
- NotAuthorizedException
2049
- The principle specified by the user_id does not have authorization for the requested action
2050
-
2051
- """
2052
- loop = asyncio.get_event_loop()
2053
- loop.run_until_complete(self._async_detach_collection(collection_guid, element_guid))
2054
- return
2055
-
2056
- async def _async_delete_collection(self, collection_guid: str, cascade: bool = False) -> None:
2057
- """Delete a collection. It is detected from all parent elements. If members are anchored to the collection
2058
- then they are also deleted. Async version
2059
-
2060
-
2061
- Parameters
2062
- ----------
2063
- collection_guid: str
2064
- The guid of the collection to update.
2065
-
2066
- cascade: bool, optional, defaults to True
2067
- If true, a cascade delete is performed.
2068
-
2069
- Returns
2070
- -------
2071
- Nothing
2072
-
2073
- Raises
2074
- ------
2075
- InvalidParameterException
2076
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2077
- PropertyServerException
2078
- Raised by the server when an issue arises in processing a valid request
2079
- NotAuthorizedException
2080
- The principle specified by the user_id does not have authorization for the requested action
2081
-
2082
- """
2083
- cascade_s = str(cascade).lower()
2084
- url = f"{self.collection_command_root}/{collection_guid}/delete?cascadedDelete={cascade_s}"
2085
- body = {"class": "NullRequestBody"}
2086
-
2087
- await self._async_make_request("POST", url, body)
2088
- return
2089
-
2090
- def delete_collection(self, collection_guid: str, cascade:bool=False) -> None:
2091
- """Delete a collection. It is detected from all parent elements. If members are anchored to the collection
2092
- then they are also deleted.
2093
-
2094
- Parameters
2095
- ----------
2096
- collection_guid: str
2097
- The guid of the collection to update.
2098
-
2099
- cascade: bool, optional, defaults to True
2100
- If true, a cascade delete is performed.
2101
-
2102
- Returns
2103
- -------
2104
- Nothing
2105
-
2106
- Raises
2107
- ------
2108
-
2109
- InvalidParameterException
2110
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2111
- PropertyServerException
2112
- Raised by the server when an issue arises in processing a valid request
2113
- NotAuthorizedException
2114
- The principle specified by the user_id does not have authorization for the requested action
2115
-
2116
- """
2117
- loop = asyncio.get_event_loop()
2118
- loop.run_until_complete(self._async_delete_collection(collection_guid, cascade))
2119
- return
2120
-
2121
- async def _async_get_collection_members(self, collection_guid: str = None, collection_name: str = None,
2122
- collection_qname: str = None, start_from: int = 0, page_size: int = None, ) -> list | str:
2123
- """Return a list of elements that are a member of a collection. Async version.
2124
-
2125
- Parameters
2126
- ----------
2127
- collection_guid: str,
2128
- identity of the collection to return members for. If none, collection_name or
2129
- collection_qname are used.
2130
- collection_name: str,
2131
- display the name of the collection to return members for. If none, collection_guid
2132
- or collection_qname are used.
2133
- collection_qname: str,
2134
- qualified name of the collection to return members for. If none, collection_guid
2135
- or collection_name are used.
2136
- start_from: int, [default=0], optional
2137
- When multiple pages of results are available, the page number to start from.
2138
- page_size: int, [default=None]
2139
- The number of items to return in a single page. If not specified, the default will be taken from
2140
- the class instance.
2141
- Returns
2142
- -------
2143
- List | str
2144
-
2145
- A list of collection members in the collection.
2146
-
2147
- Raises
2148
- ------
2149
-
2150
- InvalidParameterException
2151
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2152
- PropertyServerException
2153
- Raised by the server when an issue arises in processing a valid request
2154
- NotAuthorizedException
2155
- The principle specified by the user_id does not have authorization for the requested action
2156
-
2157
- """
2158
-
2159
- if page_size is None:
2160
- page_size = self.page_size
2161
- if collection_guid is None:
2162
- collection_guid = self.__get_guid__(collection_guid, collection_name, "name", collection_qname, None, )
2163
-
2164
- url = (f"{self.collection_command_root}/{collection_guid}/"
2165
- f"members?startFrom={start_from}&pageSize={page_size}")
2166
-
2167
- resp = await self._async_make_request("GET", url)
2168
- return resp.json().get("elements", NO_ELEMENTS_FOUND)
2169
-
2170
- def get_collection_members(self, collection_guid: str = None, collection_name: str = None,
2171
- collection_qname: str = None, start_from: int = 0, page_size: int = None, ) -> list | str:
2172
- """Return a list of elements that are a member of a collection. Async version.
2173
-
2174
- Parameters
2175
- ----------
2176
- collection_guid: str,
2177
- identity of the collection to return members for. If none, collection_name or
2178
- collection_qname are used.
2179
- collection_name: str,
2180
- display the name of the collection to return members for. If none, collection_guid
2181
- or collection_qname are used.
2182
- collection_qname: str,
2183
- qualified name of the collection to return members for. If none, collection_guid
2184
- or collection_name are used.
2185
- start_from: int, [default=0], optional
2186
- When multiple pages of results are available, the page number to start from.
2187
- page_size: int, [default=None]
2188
- The number of items to return in a single page. If not specified, the default will be taken from
2189
- the class instance.
2190
- Returns
2191
- -------
2192
- List | str
2193
-
2194
- A list of collection members in the collection.
2195
-
2196
- Raises
2197
- ------
2198
-
2199
- InvalidParameterException
2200
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2201
- PropertyServerException
2202
- Raised by the server when an issue arises in processing a valid request
2203
- NotAuthorizedException
2204
- The principle specified by the user_id does not have authorization for the requested action
2205
-
2206
- """
2207
- loop = asyncio.get_event_loop()
2208
- resp = loop.run_until_complete(
2209
- self._async_get_collection_members(collection_guid, collection_name, collection_qname, start_from,
2210
- page_size, ))
2211
-
2212
- return resp
2213
-
2214
- async def _async_add_to_collection(self, collection_guid: str, element_guid: str, body: dict = None, ) -> None:
2215
- """Add an element to a collection. The request body is optional. Async version.
2216
-
2217
- Parameters
2218
- ----------
2219
- collection_guid: str
2220
- identity of the collection to return members for.
2221
- element_guid: str
2222
- Effective time of the query. If not specified will default to any time.
2223
- body: dict, optional, defaults to None
2224
- The body of the request to add to the collection. See notes.
2225
-
2226
- The name of the server to use.
2227
-
2228
-
2229
- Returns
2230
- -------
2231
- None
2232
-
2233
- Raises
2234
- ------
2235
-
2236
- InvalidParameterException
2237
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2238
- PropertyServerException
2239
- Raised by the server when an issue arises in processing a valid request
2240
- NotAuthorizedException
2241
- The principle specified by the user_id does not have authorization for the requested action
2242
-
2243
- Notes
2244
- -----
2245
- Example body:
2246
- {
2247
- "class" : "CollectionMembershipProperties",
2248
- "membershipRationale": "xxx",
2249
- "createdBy": "user id here",
2250
- "expression": "expression that described why the element is a part of this collection",
2251
- "confidence": 100,
2252
- "status": "PROPOSED",
2253
- "userDefinedStatus": "Add valid value here",
2254
- "steward": "identifier of steward that validated this member",
2255
- "stewardTypeName": "type name of element identifying the steward",
2256
- "stewardPropertyName": "property name if the steward's identifier",
2257
- "source": "source of the member",
2258
- "notes": "Add notes here"
2259
- }
2260
-
2261
- """
2262
-
2263
- url = (f"{self.collection_command_root}/{collection_guid}/members/"
2264
- f"{element_guid}/attach")
2265
- body_s = body_slimmer(body)
2266
- await self._async_make_request("POST", url, body_s)
2267
- return
2268
-
2269
- def add_to_collection(self, collection_guid: str, element_guid: str, body: dict = None, ) -> None:
2270
- """Add an element to a collection. The request body is optional.
2271
-
2272
- Parameters
2273
- ----------
2274
- collection_guid: str
2275
- identity of the collection to return members for.
2276
- element_guid: str
2277
- Effective time of the query. If not specified will default to any time.
2278
- body: dict, optional, defaults to None
2279
- The body of the request to add to the collection. See notes.
2280
-
2281
- The name of the server to use.
2282
-
2283
-
2284
- Returns
2285
- -------
2286
- None
2287
-
2288
- Raises
2289
- ------
2290
-
2291
- InvalidParameterException
2292
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2293
- PropertyServerException
2294
- Raised by the server when an issue arises in processing a valid request
2295
- NotAuthorizedException
2296
- The principle specified by the user_id does not have authorization for the requested action
2297
-
2298
- Notes
2299
- -----
2300
- Example body:
2301
- {
2302
- "class" : "CollectionMembershipProperties",
2303
- "membershipRationale": "xxx",
2304
- "createdBy": "user id here",
2305
- "expression": "expression that described why the element is a part of this collection",
2306
- "confidence": 100,
2307
- "status": "PROPOSED",
2308
- "userDefinedStatus": "Add valid value here",
2309
- "steward": "identifier of steward that validated this member",
2310
- "stewardTypeName": "type name of element identifying the steward",
2311
- "stewardPropertyName": "property name if the steward's identifier",
2312
- "source": "source of the member",
2313
- "notes": "Add notes here"
2314
- }
2315
-
2316
- """
2317
- loop = asyncio.get_event_loop()
2318
- loop.run_until_complete(self._async_add_to_collection(collection_guid, element_guid, body))
2319
- return
2320
-
2321
- async def _async_update_collection_membership(self, collection_guid: str, element_guid: str, body: dict = None,
2322
- replace_all_props: bool = False, ) -> None:
2323
- """Update an element's membership to a collection. Async version.
2324
-
2325
- Parameters
2326
- ----------
2327
- collection_guid: str
2328
- identity of the collection to return members for.
2329
- element_guid: str
2330
- Effective time of the query. If not specified will default to any time.
2331
- body: dict, optional, defaults to None
2332
- The body of the request to add to the collection. See notes.
2333
- replace_all_props: bool, optional, defaults to False
2334
- Replace all properties or just update ones specified in body.
2335
-
2336
- The name of the server to use.
2337
-
2338
-
2339
- Returns
2340
- -------
2341
- None
2342
-
2343
- Raises
2344
- ------
2345
-
2346
- InvalidParameterException
2347
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2348
- PropertyServerException
2349
- Raised by the server when an issue arises in processing a valid request
2350
- NotAuthorizedException
2351
- The principle specified by the user_id does not have authorization for the requested action
2352
-
2353
- Notes
2354
- -----
2355
- Example body:
2356
- {
2357
- "class" : "CollectionMembershipProperties",
2358
- "membershipRationale": "xxx",
2359
- "createdBy": "user id here",
2360
- "expression": "expression that described why the element is a part of this collection",
2361
- "confidence": 100,
2362
- "status": "PROPOSED",
2363
- "userDefinedStatus": "Add valid value here",
2364
- "steward": "identifier of steward that validated this member",
2365
- "stewardTypeName": "type name of element identifying the steward",
2366
- "stewardPropertyName": "property name if the steward's identifier",
2367
- "source": "source of the member",
2368
- "notes": "Add notes here"
2369
- }
2370
-
2371
- """
2372
-
2373
- replace_all_props_s = str(replace_all_props).lower()
2374
- url = (f"{self.collection_command_root}/{collection_guid}/members/"
2375
- f"{element_guid}/update?replaceAllProperties={replace_all_props_s}")
2376
- body_s = body_slimmer(body)
2377
- await self._async_make_request("POST", url, body_s)
2378
- return
2379
-
2380
- def update_collection_membership(self, collection_guid: str, element_guid: str, body: dict = None,
2381
- replace_all_props: bool = False, ) -> None:
2382
- """Update an element's membership to a collection.
2383
-
2384
- Parameters
2385
- ----------
2386
- collection_guid: str
2387
- identity of the collection to update members for.
2388
- element_guid: str
2389
- Effective time of the query. If not specified will default to any time.
2390
- body: dict, optional, defaults to None
2391
- The body of the request to add to the collection. See notes.
2392
- replace_all_props: bool, optional, defaults to False
2393
- Replace all properties or just update ones specified in body.
2394
-
2395
- The name of the server to use.
2396
-
2397
-
2398
- Returns
2399
- -------
2400
- None
2401
-
2402
- Raises
2403
- ------
2404
-
2405
- InvalidParameterException
2406
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2407
- PropertyServerException
2408
- Raised by the server when an issue arises in processing a valid request
2409
- NotAuthorizedException
2410
- The principle specified by the user_id does not have authorization for the requested action
2411
-
2412
- Notes
2413
- -----
2414
- Example body:
2415
- {
2416
- "class" : "CollectionMembershipProperties",
2417
- "membershipRationale": "xxx",
2418
- "createdBy": "user id here",
2419
- "expression": "expression that described why the element is a part of this collection",
2420
- "confidence": 100,
2421
- "status": "PROPOSED",
2422
- "userDefinedStatus": "Add valid value here",
2423
- "steward": "identifier of steward that validated this member",
2424
- "stewardTypeName": "type name of element identifying the steward",
2425
- "stewardPropertyName": "property name if the steward's identifier",
2426
- "source": "source of the member",
2427
- "notes": "Add notes here"
2428
- }
2429
-
2430
- """
2431
- loop = asyncio.get_event_loop()
2432
- loop.run_until_complete(
2433
- self._async_update_collection_membership(collection_guid, element_guid, body, replace_all_props))
2434
- return
2435
-
2436
- async def _async_remove_from_collection(self, collection_guid: str, element_guid: str) -> None:
2437
- """Remove an element from a collection. Async version.
2438
-
2439
- Parameters
2440
- ----------
2441
- collection_guid: str
2442
- identity of the collection to return members for.
2443
- element_guid: str
2444
- Effective time of the query. If not specified will default to any time.
2445
-
2446
- The name of the server to use.
2447
-
2448
-
2449
- Returns
2450
- -------
2451
- None
2452
-
2453
- Raises
2454
- ------
2455
-
2456
- InvalidParameterException
2457
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2458
- PropertyServerException
2459
- Raised by the server when an issue arises in processing a valid request
2460
- NotAuthorizedException
2461
- The principle specified by the user_id does not have authorization for the requested action
2462
-
2463
- """
2464
-
2465
- url = (f"{self.collection_command_root}/{collection_guid}/members/"
2466
- f"{element_guid}/detach")
2467
- body = {"class": "NullRequestBody"}
2468
- await self._async_make_request("POST", url, body)
2469
- return
2470
-
2471
- def remove_from_collection(self, collection_guid: str, element_guid: str) -> None:
2472
- """Remove an element from a collection.
2473
-
2474
- Parameters
2475
- ----------
2476
- collection_guid: str
2477
- identity of the collection to return members for.
2478
- element_guid: str
2479
- Effective time of the query. If not specified will default to any time.
2480
-
2481
- The name of the server to use.
2482
-
2483
-
2484
- Returns
2485
- -------
2486
- None
2487
-
2488
- Raises
2489
- ------
2490
-
2491
- InvalidParameterException
2492
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2493
- PropertyServerException
2494
- Raised by the server when an issue arises in processing a valid request
2495
- NotAuthorizedException
2496
- The principle specified by the user_id does not have authorization for the requested action
2497
-
2498
- """
2499
- loop = asyncio.get_event_loop()
2500
- loop.run_until_complete(self._async_remove_from_collection(collection_guid, element_guid))
2501
- return
2502
-
2503
- async def _async_get_member_list(self, collection_guid: str = None, collection_name: str = None,
2504
- collection_qname: str = None, ) -> list | bool:
2505
- """Get the member list for the collection - async version.
2506
- Parameters
2507
- ----------
2508
- collection_guid: str,
2509
- identity of the collection to return members for. If none, collection_name or
2510
- collection_qname are used.
2511
- collection_name: str,
2512
- display name of the collection to return members for. If none, collection_guid
2513
- or collection_qname are used.
2514
- collection_qname: str,
2515
- qualified name of the collection to return members for. If none, collection_guid
2516
- or collection_name are used.
2517
-
2518
- Returns
2519
- -------
2520
- list | str
2521
- The list of member information if successful, otherwise the string "No members found"
2522
-
2523
- Raises
2524
- ------
2525
- InvalidParameterException
2526
- If the root_collection_name does not have exactly one root collection.
2527
-
2528
- """
2529
-
2530
- # first find the guid for the collection we are using as root
2531
-
2532
- # now find the members of the collection
2533
- member_list = []
2534
- members = await self._async_get_collection_members(collection_guid, collection_name, collection_qname)
2535
- if (type(members) is str) or (len(members) == 0):
2536
- return "No members found"
2537
- # finally, construct a list of member information
2538
- for member_rel in members:
2539
- member_guid = member_rel["elementHeader"]["guid"]
2540
- member_resp = await self._async_get_collection_by_guid(member_guid)
2541
- if isinstance(member_resp,(dict,list)):
2542
- member = member_resp.get("element", None)
2543
- if member is None:
2544
- continue
2545
- else:
2546
- continue
2547
- # print(json.dumps(member, indent = 4))
2548
-
2549
- member_instance = {
2550
- "name": member["properties"]["name"], "qualifiedName": member["properties"]["qualifiedName"],
2551
- "guid": member["elementHeader"]["guid"], "description": member["properties"]["description"],
2552
- "collectionType": member["properties"]["collectionType"],
2553
- }
2554
- member_list.append(member_instance)
2555
-
2556
- return member_list if len(member_list) > 0 else "No members found"
2557
-
2558
- def get_member_list(self, collection_guid: str = None, collection_name: str = None,
2559
- collection_qname: str = None, ) -> list | bool:
2560
- """Get the member list for the collection - async version.
2561
- Parameters
2562
- ----------
2563
- collection_guid: str,
2564
- identity of the collection to return members for. If none, collection_name or
2565
- collection_qname are used.
2566
- collection_name: str,
2567
- display name of the collection to return members for. If none, collection_guid
2568
- or collection_qname are used.
2569
- collection_qname: str,
2570
- qualified name of the collection to return members for. If none, collection_guid
2571
- or collection_name are used.
2572
- Returns
2573
- -------
2574
- list | bool
2575
- The list of member information if successful, otherwise False.
2576
-
2577
- Raises
2578
- ------
2579
- InvalidParameterException
2580
- If the root_collection_name does not have exactly one root collection.
2581
-
2582
- """
2583
- loop = asyncio.get_event_loop()
2584
- resp = loop.run_until_complete(self._async_get_member_list(collection_guid, collection_name, collection_qname))
2585
- return resp
2586
-
2587
- def _extract_collection_properties(self, element: dict) -> dict:
2588
- """
2589
- Extract common properties from a collection element.
2590
-
2591
- Args:
2592
- element (dict): The collection element
2593
-
2594
- Returns:
2595
- dict: Dictionary of extracted properties
2596
- """
2597
- guid = element['elementHeader'].get("guid", None)
2598
- properties = element['properties']
2599
- display_name = properties.get("name", "") or ""
2600
- description = properties.get("description", "") or ""
2601
- qualified_name = properties.get("qualifiedName", "") or ""
2602
- collection_type = properties.get("collectionType", "") or ""
2603
- classifications = "\n* ".join(properties.get("classifications", [])) or ""
2604
- # classification_names = ""
2605
- # classifications = element['elementHeader'].get("classifications", [])
2606
- # for classification in classifications:
2607
- # classification_names += f"{classification['classificationName']}, "
2608
-
2609
-
2610
-
2611
- return {
2612
- 'guid': guid,
2613
- 'properties': properties,
2614
- 'display_name': display_name,
2615
- 'description': description,
2616
- 'qualified_name': qualified_name,
2617
- 'classifications': classifications,
2618
- 'collection_type': collection_type
2619
- }
2620
-
2621
- def generate_basic_structured_output(self, elements, filter, output_format) -> str | list:
2622
- """
2623
- Generate output in the specified format for the given elements.
2624
-
2625
- Args:
2626
- elements: Dictionary or list of dictionaries containing element data
2627
- filter: The search string used to find the elements
2628
- output_format: The desired output format (MD, FORM, REPORT, LIST, DICT, MERMAID)
2629
-
2630
- Returns:
2631
- Formatted output as string or list of dictionaries
2632
- """
2633
- # Handle MERMAID and DICT formats using existing methods
2634
- if output_format == "MERMAID":
2635
- return extract_mermaid_only(elements)
2636
- elif output_format == "DICT":
2637
- return extract_basic_dict(elements)
2638
-
2639
- # For other formats (MD, FORM, REPORT, LIST), use generate_output
2640
- elif output_format in ["MD", "FORM", "REPORT", "LIST"]:
2641
- # Define columns for LIST format
2642
- columns = [
2643
- {'name': 'Collection Name', 'key': 'display_name'},
2644
- {'name': 'Qualified Name', 'key': 'qualified_name'},
2645
- {'name': 'Collection Type', 'key': 'collection_type'},
2646
- {'name': 'Classifications', 'key': 'classifications'},
2647
- {'name': 'Description', 'key': 'description', 'format': True}
2648
- ]
2649
-
2650
- return generate_output(
2651
- elements=elements,
2652
- search_string=filter,
2653
- entity_type="Collection",
2654
- output_format=output_format,
2655
- extract_properties_func=self._extract_collection_properties,
2656
- columns=columns if output_format == 'LIST' else None
2657
- )
2658
-
2659
- # Default case
2660
- return None
2661
-
2662
- def generate_collection_output(self, elements, filter, output_format) -> str | list | dict:
2663
- """
2664
- Generate output in the specified format for the given elements.
2665
-
2666
- Args:
2667
- elements: Dictionary or list of dictionaries containing element data
2668
- filter: The search string used to find the elements
2669
- output_format: The desired output format (MD, FORM, REPORT, LIST, DICT, MERMAID, JSON)
2670
-
2671
- Returns:
2672
- Formatted output as string or list of dictionaries
2673
- """
2674
- # For LIST and DICT formats, get member information
2675
- if output_format in ["LIST", "DICT"]:
2676
- # Get the collection GUID
2677
- collection_guid = None
2678
- if isinstance(elements, dict):
2679
- collection_guid = elements.get('elementHeader', {}).get('guid')
2680
- elif isinstance(elements, list) and len(elements) > 0:
2681
- collection_guid = elements[0].get('elementHeader', {}).get('guid')
2682
-
2683
- # Get member list if we have a valid collection GUID
2684
- members = []
2685
- if collection_guid:
2686
- members = self.get_member_list(collection_guid=collection_guid)
2687
- if isinstance(members, str): # "No members found" case
2688
- members = []
2689
-
2690
- # For DICT format, include all member information in the result
2691
- if output_format == "DICT":
2692
- result = self.generate_basic_structured_output(elements, filter, output_format)
2693
- if isinstance(result, list):
2694
- for item in result:
2695
- item['members'] = members
2696
- return result
2697
- elif isinstance(result, dict):
2698
- result['members'] = members
2699
- return result
2700
-
2701
- # For LIST format, add a column with bulleted list of qualified names
2702
- elif output_format == "LIST":
2703
- # Define columns for LIST format, including the new Members column
2704
- columns = [
2705
- {'name': 'Collection Name', 'key': 'display_name'},
2706
- {'name': 'Qualified Name', 'key': 'qualified_name'},
2707
- {'name': 'Collection Type', 'key': 'collection_type'},
2708
- {'name': 'Description', 'key': 'description', 'format': True},
2709
- {'name': 'Classifications', 'key': 'classifications'},
2710
- {'name': 'Members', 'key': 'members', 'format': True}
2711
- ]
2712
-
2713
- # Create a function to add member information to the properties
2714
- def get_additional_props(element, guid, output_format):
2715
- if not members:
2716
- return {'members': ''}
2717
-
2718
- # Create a comma-separated list of qualified names (no newlines to avoid table formatting issues)
2719
- member_list = ", ".join([member.get('qualifiedName', '') for member in members])
2720
- return {'members': member_list}
2721
-
2722
- # Generate output with the additional properties
2723
- return generate_output(
2724
- elements=elements,
2725
- search_string=filter,
2726
- entity_type="Collection",
2727
- output_format=output_format,
2728
- extract_properties_func=self._extract_collection_properties,
2729
- get_additional_props_func=get_additional_props,
2730
- columns=columns
2731
- )
2732
-
2733
- # For FORM, REPORT, JSON formats, keep behavior unchanged
2734
- return self.generate_basic_structured_output(elements, filter, output_format)
2735
-
2736
- def generate_data_class_output(self, elements, filter, output_format) -> str | list:
2737
- return self.generate_basic_structured_output(elements, filter, output_format)
2738
-
2739
- def generate_data_field_output(self, elements, filter, output_format) -> str | list:
2740
- return self.generate_basic_structured_output(elements, filter, output_format)
2741
-
2742
-
2743
- if __name__ == "__main__":
2744
- print("Main-Collection Manager")