pyegeria 0.3.3__py3-none-any.whl → 0.3.5__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.
Files changed (33) hide show
  1. pyegeria/__init__.py +3 -1
  2. pyegeria/automated_curation_omvs.py +15 -10
  3. pyegeria/collection_manager_omvs.py +2428 -0
  4. pyegeria/core_omag_server_config.py +15 -22
  5. pyegeria/full_omag_server_config.py +0 -1
  6. pyegeria/glossary_omvs.py +14 -2
  7. pyegeria/gov_engine.py +1 -8
  8. pyegeria/governance_author.py +2 -0
  9. pyegeria/my_profile_omvs.py +1 -1
  10. pyegeria/platform_services.py +2 -39
  11. pyegeria/project_manager_omvs.py +1689 -0
  12. pyegeria/registered_info.py +3 -1
  13. pyegeria/server_operations.py +2 -2
  14. pyegeria/valid_metadata_omvs.py +779 -0
  15. pyegeria-0.3.5.data/scripts/engine_action_status.py +145 -0
  16. pyegeria-0.3.5.data/scripts/find_todos.py +152 -0
  17. pyegeria-0.3.5.data/scripts/glossary_view.py +135 -0
  18. pyegeria-0.3.5.data/scripts/gov_engine_status.py +120 -0
  19. pyegeria-0.3.5.data/scripts/integration_daemon_status.py +130 -0
  20. pyegeria-0.3.5.data/scripts/list_asset_types.py +114 -0
  21. pyegeria-0.3.5.data/scripts/multi-server_status.py +120 -0
  22. pyegeria-0.3.5.data/scripts/my_todos.py +162 -0
  23. pyegeria-0.3.5.data/scripts/open_todos.py +140 -0
  24. pyegeria-0.3.5.data/scripts/server_status.py +105 -0
  25. pyegeria-0.3.5.data/scripts/server_status_widget.py +93 -0
  26. pyegeria-0.3.5.data/scripts/view_my_profile.py +140 -0
  27. {pyegeria-0.3.3.dist-info → pyegeria-0.3.5.dist-info}/METADATA +1 -1
  28. pyegeria-0.3.5.dist-info/RECORD +36 -0
  29. pyegeria/exceptions.py +0 -382
  30. pyegeria-0.3.3.dist-info/RECORD +0 -22
  31. {pyegeria-0.3.3.dist-info → pyegeria-0.3.5.dist-info}/LICENSE +0 -0
  32. {pyegeria-0.3.3.dist-info → pyegeria-0.3.5.dist-info}/WHEEL +0 -0
  33. {pyegeria-0.3.3.dist-info → pyegeria-0.3.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,779 @@
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
+ import asyncio
9
+ import json
10
+ import time
11
+
12
+ # import json
13
+ from pyegeria._client import Client
14
+ from pyegeria._exceptions import (
15
+ InvalidParameterException,
16
+ )
17
+ from pyegeria._globals import enable_ssl_check
18
+ from pyegeria._validators import (
19
+ validate_guid,
20
+ validate_search_string,
21
+ )
22
+ from pyegeria.utils import body_slimmer
23
+
24
+
25
+ class ValidMetadataManager(Client):
26
+ """ The Valid Metadata OMVS provides APIs for retrieving and updating lists of valid metadata values.
27
+ For more details see: https://egeria-project.org/guides/planning/valid-values/overview/
28
+
29
+ Attributes:
30
+
31
+ server_name: str
32
+ The name of the View Server to connect to.
33
+ platform_url : str
34
+ URL of the server platform to connect to
35
+ user_id : str
36
+ The identity of the user calling the method - this sets a default optionally used by the methods
37
+ when the user doesn't pass the user_id on a method call.
38
+ user_pwd: str
39
+ The password associated with the user_id. Defaults to None
40
+ verify_flag: bool
41
+ Flag to indicate if SSL Certificates should be verified in the HTTP requests.
42
+ Defaults to False.
43
+
44
+ """
45
+
46
+ def __init__(
47
+ self,
48
+ server_name: str,
49
+ platform_url: str,
50
+ token: str = None,
51
+ user_id: str = None,
52
+ user_pwd: str = None,
53
+ verify_flag: bool = enable_ssl_check,
54
+ ):
55
+ self.command_base: str = f"/api/open-metadata/valid-metadata"
56
+ Client.__init__(self, server_name, platform_url, user_id=user_id, token=token)
57
+
58
+ async def _async_get_valid_metadata_values(self, property_name: str, type_name: str = None,
59
+ server_name: str = None,
60
+ start_value: int = 0,page_size: int = None) -> list | str:
61
+ """ Retrieve list of values for the property. Async version.
62
+
63
+ Parameters
64
+ ----------
65
+ property_name: str
66
+ The property to query.
67
+ type_name: str, opt
68
+ The Open Metadata type to get the property values for. If not specified then all property values
69
+ will be returned.
70
+ server_name : str, optional
71
+ The name of the server to configure.
72
+ If not provided, the server name associated with the instance is used.
73
+
74
+ Returns
75
+ -------
76
+ List | str
77
+
78
+ A list of collections linked off of the supplied element.
79
+
80
+ Raises
81
+ ------
82
+
83
+ InvalidParameterException
84
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
85
+ PropertyServerException
86
+ Raised by the server when an issue arises in processing a valid request
87
+ NotAuthorizedException
88
+ The principle specified by the user_id does not have authorization for the requested action
89
+
90
+ """
91
+ if server_name is None:
92
+ server_name = self.server_name
93
+ if page_size is None:
94
+ page_size = self.page_size
95
+
96
+
97
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/get-valid-metadata-values/{property_name}"
98
+ f"?typeName={type_name}&startFrom={start_value}&pageSize={page_size}")
99
+
100
+ resp = await self._async_make_request("GET", url)
101
+ return resp.json().get("elementList","No elements found")
102
+
103
+ def get_valid_metadata_values(self, property_name: str, type_name: str = None,
104
+ server_name: str = None) -> list | str:
105
+ """ Retrieve list of values for the property.
106
+
107
+ Parameters
108
+ ----------
109
+ property_name: str
110
+ The property to query.
111
+ type_name: str, opt
112
+ The Open Metadata type to get the property values for. If not specified then all property values
113
+ will be returned.
114
+ server_name : str, optional
115
+ The name of the server to configure.
116
+ If not provided, the server name associated with the instance is used.
117
+
118
+ Returns
119
+ -------
120
+ List | str
121
+
122
+ A list of collections linked off of the supplied element.
123
+
124
+ Raises
125
+ ------
126
+
127
+ InvalidParameterException
128
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
129
+ PropertyServerException
130
+ Raised by the server when an issue arises in processing a valid request
131
+ NotAuthorizedException
132
+ The principle specified by the user_id does not have authorization for the requested action
133
+
134
+ """
135
+ loop = asyncio.get_event_loop()
136
+ resp = loop.run_until_complete(self._async_get_valid_metadata_values(property_name, type_name,
137
+ server_name)),
138
+ return resp
139
+
140
+ async def _async_get_valid_metadata_value(self, property_name: str, type_name: str, preferred_value: str,
141
+ server_name: str = None) -> list | str:
142
+ if server_name is None:
143
+ server_name = self.server_name
144
+
145
+
146
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/get-value/{property_name}"
147
+ f"?typeName={type_name}&preferredValue={preferred_value}")
148
+
149
+ resp = await self._async_make_request("GET", url)
150
+ return resp.json()
151
+
152
+ def get_valid_metadata_value(self, property_name: str, type_name: str, preferred_value: str,
153
+ server_name: str = None) -> list | str:
154
+ """ Retrieve details of a specific valid value for a property.
155
+
156
+ Parameters
157
+ ----------
158
+ classification: str
159
+ The classification of the collection to inspect.
160
+ server_name : str, optional
161
+ The name of the server to configure.
162
+ If not provided, the server name associated with the instance is used.
163
+ start_from: int, [default=0], optional
164
+ When multiple pages of results are available, the page number to start from.
165
+ page_size: int, [default=None]
166
+ The number of items to return in a single page. If not specified, the default will be taken from
167
+ the class instance.
168
+ Returns
169
+ -------
170
+ List | str
171
+
172
+ A list of collections linked off of the supplied element.
173
+
174
+ Raises
175
+ ------
176
+
177
+ InvalidParameterException
178
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
179
+ PropertyServerException
180
+ Raised by the server when an issue arises in processing a valid request
181
+ NotAuthorizedException
182
+ The principle specified by the user_id does not have authorization for the requested action
183
+
184
+ """
185
+ loop = asyncio.get_event_loop()
186
+ resp = loop.run_until_complete(self._async_get_valid_metadata_value(property_name, type_name,
187
+ preferred_value, server_name)),
188
+ return resp
189
+
190
+
191
+ async def _async_get_consistent_metadata_values(self, property_name:str, type_name:str, map_name: str,
192
+ preferred_value: str, server_name: str = None,
193
+ start_from: int = 0, page_size: int = None) -> list | str:
194
+ """ Retrieve all the consistent valid values for the requested property. Async version.
195
+
196
+ Parameters
197
+ ----------
198
+ property_name : str
199
+ The name of the property to retrieve the valid values for.
200
+ type_name : str
201
+ The open metadata type that the property is associated with.
202
+ map_name : str
203
+ A valid map name that associates a property with a value.
204
+ preferred_value : str
205
+
206
+ server_name : str, optional
207
+ The name of the server to configure.
208
+ If not provided, the server name associated with the instance is used.
209
+ start_from: int, [default=0], optional
210
+ When multiple pages of results are available, the page number to start from.
211
+ page_size: int, [default=None]
212
+ The number of items to return in a single page. If not specified, the default will be taken from
213
+ the class instance.
214
+ Returns
215
+ -------
216
+ List | str
217
+
218
+ A list of collections linked off of the supplied element.
219
+
220
+ Raises
221
+ ------
222
+
223
+ InvalidParameterException
224
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
225
+ PropertyServerException
226
+ Raised by the server when an issue arises in processing a valid request
227
+ NotAuthorizedException
228
+ The principle specified by the user_id does not have authorization for the requested action
229
+
230
+ """
231
+ if server_name is None:
232
+ server_name = self.server_name
233
+ if page_size is None:
234
+ page_size = self.page_size
235
+
236
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{property_name}/"
237
+ f"consistent-metadata-values?typeName={type_name}&mapName={map_name}&preferredValue={preferred_value}"
238
+ f"&startFrom={start_from}&pageSize={page_size}")
239
+
240
+ resp = await self._async_make_request("GET", url)
241
+ return resp.json()
242
+
243
+ def get_consistent_metadata_values(self, property_name:str, type_name:str, map_name: str,
244
+ preferred_value: str, server_name: str = None,
245
+ start_from: int = 0, page_size: int = None) -> list | str:
246
+ """ Retrieve all the consistent valid values for the requested property.
247
+
248
+ Parameters
249
+ ----------
250
+ property_name : str
251
+ The name of the property to retrieve the valid values for.
252
+ type_name : str
253
+ The open metadata type that the property is associated with.
254
+ map_name : str
255
+ A valid map name that associates a property with a value.
256
+ preferred_value : str
257
+
258
+ server_name : str, optional
259
+ The name of the server to configure.
260
+ If not provided, the server name associated with the instance is used.
261
+ start_from: int, [default=0], optional
262
+ When multiple pages of results are available, the page number to start from.
263
+ page_size: int, [default=None]
264
+ The number of items to return in a single page. If not specified, the default will be taken from
265
+ the class instance.
266
+ Returns
267
+ -------
268
+ List | str
269
+
270
+ A list of collections linked off of the supplied element.
271
+
272
+ Raises
273
+ ------
274
+
275
+ InvalidParameterException
276
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
277
+ PropertyServerException
278
+ Raised by the server when an issue arises in processing a valid request
279
+ NotAuthorizedException
280
+ The principle specified by the user_id does not have authorization for the requested action
281
+
282
+ """
283
+ loop = asyncio.get_event_loop()
284
+ resp = loop.run_until_complete(
285
+ self._async_get_consistent_metadata_values(property_name,type_name,
286
+ map_name,preferred_value,
287
+ server_name,start_from,page_size)
288
+ )
289
+ return resp
290
+ #
291
+ # Get all ...
292
+ #
293
+ async def _async_get_all_entity_types(self, server_name: str = None) -> list | str:
294
+ """ Returns the list of different types of metadata organized into two groups. The first are the
295
+ attribute type definitions (AttributeTypeDefs). These provide types for attributes in full
296
+ type definitions. Full type definitions (TypeDefs) describe types for entities, relationships
297
+ and classifications. Async version.
298
+
299
+ Parameters
300
+ ----------
301
+ server_name : str, optional
302
+ The name of the server to configure.
303
+ If not provided, the server name associated with the instance is used.
304
+
305
+ Returns
306
+ -------
307
+ List | str
308
+
309
+ A list of all entity types.
310
+
311
+ Raises
312
+ ------
313
+
314
+ InvalidParameterException
315
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
316
+ PropertyServerException
317
+ Raised by the server when an issue arises in processing a valid request
318
+ NotAuthorizedException
319
+ The principle specified by the user_id does not have authorization for the requested action
320
+
321
+ """
322
+ if server_name is None:
323
+ server_name = self.server_name
324
+
325
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/open-metadata-types"
326
+
327
+ resp = await self._async_make_request("GET", url)
328
+ return resp.json().get("typeDefs", "No TypeDefs Found")
329
+
330
+ def get_all_entity_types(self, server_name: str = None) -> list | str:
331
+ """ Returns the list of different types of metadata organized into two groups. The first are the
332
+ attribute type definitions (AttributeTypeDefs). These provide types for attributes in full
333
+ type definitions. Full type definitions (TypeDefs) describe types for entities, relationships
334
+ and classifications. Async version.
335
+
336
+ Parameters
337
+ ----------
338
+ server_name : str, optional
339
+ The name of the server to configure.
340
+ If not provided, the server name associated with the instance is used.
341
+
342
+ Returns
343
+ -------
344
+ List | str
345
+
346
+ A list of all entity types.
347
+
348
+ Raises
349
+ ------
350
+
351
+ InvalidParameterException
352
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
353
+ PropertyServerException
354
+ Raised by the server when an issue arises in processing a valid request
355
+ NotAuthorizedException
356
+ The principle specified by the user_id does not have authorization for the requested action
357
+
358
+ """
359
+ loop = asyncio.get_event_loop()
360
+ resp = loop.run_until_complete(
361
+ self._async_get_all_entity_types(server_name))
362
+ return resp
363
+
364
+ async def _async_get_all_entity_defs(self, server_name: str = None) -> list | str:
365
+ """ GReturns all the entity type definitions. Async version.
366
+
367
+ Parameters
368
+ ----------
369
+ server_name : str, optional
370
+ The name of the server to configure.
371
+ If not provided, the server name associated with the instance is used.
372
+
373
+ Returns
374
+ -------
375
+ List | str
376
+
377
+ A list of all entity types.
378
+
379
+ Raises
380
+ ------
381
+
382
+ InvalidParameterException
383
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
384
+ PropertyServerException
385
+ Raised by the server when an issue arises in processing a valid request
386
+ NotAuthorizedException
387
+ The principle specified by the user_id does not have authorization for the requested action
388
+
389
+ """
390
+ if server_name is None:
391
+ server_name = self.server_name
392
+
393
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/open-metadata-types/entity-defs"
394
+
395
+ resp = await self._async_make_request("GET", url)
396
+ return resp.json().get("typeDefs", "No TypeDefs Found")
397
+
398
+ def get_all_entity_defs(self, server_name: str = None) -> list | str:
399
+ """ Returns all the entity type definitions.
400
+
401
+ Parameters
402
+ ----------
403
+ server_name : str, optional
404
+ The name of the server to configure.
405
+ If not provided, the server name associated with the instance is used.
406
+
407
+ Returns
408
+ -------
409
+ List | str
410
+
411
+ A list of all entity types.
412
+
413
+ Raises
414
+ ------
415
+
416
+ InvalidParameterException
417
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
418
+ PropertyServerException
419
+ Raised by the server when an issue arises in processing a valid request
420
+ NotAuthorizedException
421
+ The principle specified by the user_id does not have authorization for the requested action
422
+
423
+ """
424
+ loop = asyncio.get_event_loop()
425
+ resp = loop.run_until_complete(
426
+ self._async_get_all_entity_defs(server_name))
427
+ return resp
428
+
429
+ async def _async_get_all_relationship_defs(self, server_name: str = None) -> list | str:
430
+ """ Returns all the relationship type definitions. Async version.
431
+
432
+ Parameters
433
+ ----------
434
+ server_name : str, optional
435
+ The name of the server to configure.
436
+ If not provided, the server name associated with the instance is used.
437
+
438
+ Returns
439
+ -------
440
+ List | str
441
+
442
+ A list of all entity types.
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
+ if server_name is None:
456
+ server_name = self.server_name
457
+
458
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/open-metadata-types/relationship-defs"
459
+
460
+ resp = await self._async_make_request("GET", url)
461
+ return resp.json().get("typeDefs", "No TypeDefs Found")
462
+
463
+ def get_all_relationship_defs(self, server_name: str = None) -> list | str:
464
+ """ Returns all the relationship type definitions.
465
+
466
+ Parameters
467
+ ----------
468
+ server_name : str, optional
469
+ The name of the server to configure.
470
+ If not provided, the server name associated with the instance is used.
471
+
472
+ Returns
473
+ -------
474
+ List | str
475
+
476
+ A list of all entity types.
477
+
478
+ Raises
479
+ ------
480
+
481
+ InvalidParameterException
482
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
483
+ PropertyServerException
484
+ Raised by the server when an issue arises in processing a valid request
485
+ NotAuthorizedException
486
+ The principle specified by the user_id does not have authorization for the requested action
487
+
488
+ """
489
+ loop = asyncio.get_event_loop()
490
+ resp = loop.run_until_complete(
491
+ self._async_get_all_relationship_defs(server_name))
492
+ return resp
493
+
494
+ async def _async_get_all_classification_defs(self, server_name: str = None) -> list | str:
495
+ """ Returns all the classification type definitions. Async version.
496
+
497
+ Parameters
498
+ ----------
499
+ server_name : str, optional
500
+ The name of the server to configure.
501
+ If not provided, the server name associated with the instance is used.
502
+
503
+ Returns
504
+ -------
505
+ List | str
506
+
507
+ A list of all entity types.
508
+
509
+ Raises
510
+ ------
511
+
512
+ InvalidParameterException
513
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
514
+ PropertyServerException
515
+ Raised by the server when an issue arises in processing a valid request
516
+ NotAuthorizedException
517
+ The principle specified by the user_id does not have authorization for the requested action
518
+
519
+ """
520
+ if server_name is None:
521
+ server_name = self.server_name
522
+
523
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/open-metadata-types/classification-defs"
524
+
525
+ resp = await self._async_make_request("GET", url)
526
+ return resp.json().get("typeDefs", "No TypeDefs Found")
527
+
528
+ def get_all_classification_defs(self, server_name: str = None) -> list | str:
529
+ """ Returns all the classification type definitions.
530
+
531
+ Parameters
532
+ ----------
533
+ server_name : str, optional
534
+ The name of the server to configure.
535
+ If not provided, the server name associated with the instance is used.
536
+
537
+ Returns
538
+ -------
539
+ List | str
540
+
541
+ A list of all entity types.
542
+
543
+ Raises
544
+ ------
545
+
546
+ InvalidParameterException
547
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
548
+ PropertyServerException
549
+ Raised by the server when an issue arises in processing a valid request
550
+ NotAuthorizedException
551
+ The principle specified by the user_id does not have authorization for the requested action
552
+
553
+ """
554
+ loop = asyncio.get_event_loop()
555
+ resp = loop.run_until_complete(
556
+ self._async_get_all_classification_defs(server_name))
557
+ return resp
558
+
559
+ #
560
+ # Get valid ...
561
+ #
562
+ async def _async_get_valid_relationship_types(self, entity_type:str, server_name: str = None) -> list | str:
563
+ """ Returns all the TypeDefs for relationships that can be attached to the requested entity type.
564
+ Async version.
565
+
566
+ Parameters
567
+ ----------
568
+ entity_type : str
569
+ The name of the entity type to retrieve the valid relationships for.
570
+ server_name : str, optional
571
+ The name of the server to configure.
572
+ If not provided, the server name associated with the instance is used.
573
+
574
+ Returns
575
+ -------
576
+ List | str
577
+
578
+ A list of TypeDefs that can be attached to the specified entity type.
579
+
580
+ Raises
581
+ ------
582
+
583
+ InvalidParameterException
584
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
585
+ PropertyServerException
586
+ Raised by the server when an issue arises in processing a valid request
587
+ NotAuthorizedException
588
+ The principle specified by the user_id does not have authorization for the requested action
589
+
590
+ """
591
+ if server_name is None:
592
+ server_name = self.server_name
593
+
594
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/open-metadata-types/{entity_type}/"
595
+ f"attached-relationships")
596
+
597
+ resp = await self._async_make_request("GET", url)
598
+ return resp.json().get("typeDefs", "No TypeDefs Found")
599
+
600
+ def get_valid_relationship_types(self, entity_type:str, server_name: str = None) -> list | str:
601
+ """ Returns all the TypeDefs for relationships that can be attached to the requested entity type.
602
+ Async version.
603
+
604
+ Parameters
605
+ ----------
606
+ entity_type : str
607
+ The name of the entity type to retrieve the valid relationships for.
608
+ server_name : str, optional
609
+ The name of the server to configure.
610
+ If not provided, the server name associated with the instance is used.
611
+
612
+ Returns
613
+ -------
614
+ List | str
615
+
616
+ A list of TypeDefs that can be attached to the specified entity type.
617
+
618
+ Raises
619
+ ------
620
+
621
+ InvalidParameterException
622
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
623
+ PropertyServerException
624
+ Raised by the server when an issue arises in processing a valid request
625
+ NotAuthorizedException
626
+ The principle specified by the user_id does not have authorization for the requested action
627
+
628
+ """
629
+ loop = asyncio.get_event_loop()
630
+ resp = loop.run_until_complete(
631
+ self._async_get_valid_relationship_types(entity_type,
632
+ server_name)
633
+ )
634
+ return resp
635
+
636
+ async def _async_get_valid_classification_types(self, entity_type:str, server_name: str = None) -> list | str:
637
+ """ Returns all the TypeDefs for classifications that can be attached to the requested entity type.
638
+ Async version.
639
+
640
+ Parameters
641
+ ----------
642
+ entity_type : str
643
+ The name of the entity type to retrieve the classifications for.
644
+ server_name : str, optional
645
+ The name of the server to configure.
646
+ If not provided, the server name associated with the instance is used.
647
+
648
+ Returns
649
+ -------
650
+ List | str
651
+
652
+ A list of classifications that can be attached to the specified entity type.
653
+
654
+ Raises
655
+ ------
656
+
657
+ InvalidParameterException
658
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
659
+ PropertyServerException
660
+ Raised by the server when an issue arises in processing a valid request
661
+ NotAuthorizedException
662
+ The principle specified by the user_id does not have authorization for the requested action
663
+
664
+ """
665
+ if server_name is None:
666
+ server_name = self.server_name
667
+
668
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/open-metadata-types/{entity_type}/"
669
+ f"attached-classifications")
670
+
671
+ resp = await self._async_make_request("GET", url)
672
+ return resp.json().get("typeDefs", "No TypeDefs Found")
673
+
674
+ def get_valid_classification_types(self, entity_type:str, server_name: str = None) -> list | str:
675
+ """ Returns all the TypeDefs for relationships that can be attached to the requested entity type.
676
+ Async version.
677
+
678
+ Parameters
679
+ ----------
680
+ entity_type : str
681
+ The name of the entity type to retrieve the classifications for.
682
+ server_name : str, optional
683
+ The name of the server to configure.
684
+ If not provided, the server name associated with the instance is used.
685
+
686
+ Returns
687
+ -------
688
+ List | str
689
+
690
+ A list of classifications that can be attached to the specified entity type.
691
+
692
+ Raises
693
+ ------
694
+
695
+ InvalidParameterException
696
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
697
+ PropertyServerException
698
+ Raised by the server when an issue arises in processing a valid request
699
+ NotAuthorizedException
700
+ The principle specified by the user_id does not have authorization for the requested action
701
+
702
+ """
703
+ loop = asyncio.get_event_loop()
704
+ resp = loop.run_until_complete(
705
+ self._async_get_valid_classification_types(entity_type,
706
+ server_name)
707
+ )
708
+ return resp
709
+
710
+ async def _async_get_typedef_by_name(self, entity_type:str, server_name: str = None) -> dict | str:
711
+ """ Return the TypeDef identified by the unique name.
712
+ Async version.
713
+
714
+ Parameters
715
+ ----------
716
+ entity_type : str
717
+ The name of the entity type to retrieve the typedef for.
718
+ server_name : str, optional
719
+ The name of the server to configure.
720
+ If not provided, the server name associated with the instance is used.
721
+
722
+ Returns
723
+ -------
724
+ dict | str
725
+
726
+ The typedef associated with the type name
727
+
728
+ Raises
729
+ ------
730
+
731
+ InvalidParameterException
732
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
733
+ PropertyServerException
734
+ Raised by the server when an issue arises in processing a valid request
735
+ NotAuthorizedException
736
+ The principle specified by the user_id does not have authorization for the requested action
737
+
738
+ """
739
+ if server_name is None:
740
+ server_name = self.server_name
741
+
742
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/open-metadata-types/name/{entity_type}"
743
+
744
+ resp = await self._async_make_request("GET", url)
745
+ return resp.json().get("typeDef", "No TypeDefs Found")
746
+
747
+ def get_typedef_by_name(self, entity_type:str, server_name: str = None) -> dict | str:
748
+ """ Return the TypeDef identified by the unique name.
749
+
750
+ Parameters
751
+ ----------
752
+ entity_type : str
753
+ The name of the entity type to retrieve the typedef for.
754
+ server_name : str, optional
755
+ The name of the server to configure.
756
+ If not provided, the server name associated with the instance is used.
757
+
758
+ Returns
759
+ -------
760
+ dict | str
761
+
762
+ The typedef associated with the type name
763
+
764
+ Raises
765
+ ------
766
+
767
+ InvalidParameterException
768
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
769
+ PropertyServerException
770
+ Raised by the server when an issue arises in processing a valid request
771
+ NotAuthorizedException
772
+ The principle specified by the user_id does not have authorization for the requested action
773
+
774
+ """
775
+ loop = asyncio.get_event_loop()
776
+ resp = loop.run_until_complete(
777
+ self._async_get_typedef_by_name(entity_type, server_name))
778
+ return resp
779
+