pyegeria 0.3.4__py3-none-any.whl → 0.3.6__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 (25) hide show
  1. pyegeria/__init__.py +3 -1
  2. pyegeria/automated_curation_omvs.py +73 -20
  3. pyegeria/collection_manager_omvs.py +2428 -0
  4. pyegeria/core_omag_server_config.py +5 -2
  5. pyegeria/project_manager_omvs.py +1689 -0
  6. pyegeria/valid_metadata_omvs.py +779 -0
  7. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/engine_action_status.py +8 -10
  8. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/list_asset_types.py +2 -3
  9. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/multi-server_status.py +1 -4
  10. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/view_my_profile.py +1 -1
  11. {pyegeria-0.3.4.dist-info → pyegeria-0.3.6.dist-info}/METADATA +1 -1
  12. pyegeria-0.3.6.dist-info/RECORD +36 -0
  13. pyegeria/exceptions.py +0 -382
  14. pyegeria-0.3.4.dist-info/RECORD +0 -34
  15. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/find_todos.py +0 -0
  16. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/glossary_view.py +0 -0
  17. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/gov_engine_status.py +0 -0
  18. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/integration_daemon_status.py +0 -0
  19. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/my_todos.py +0 -0
  20. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/open_todos.py +0 -0
  21. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/server_status.py +0 -0
  22. {pyegeria-0.3.4.data → pyegeria-0.3.6.data}/scripts/server_status_widget.py +0 -0
  23. {pyegeria-0.3.4.dist-info → pyegeria-0.3.6.dist-info}/LICENSE +0 -0
  24. {pyegeria-0.3.4.dist-info → pyegeria-0.3.6.dist-info}/WHEEL +0 -0
  25. {pyegeria-0.3.4.dist-info → pyegeria-0.3.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,1689 @@
1
+ """
2
+ PDX-License-Identifier: Apache-2.0
3
+ Copyright Contributors to the ODPi Egeria project.
4
+
5
+ Create, maintain and explore projects.
6
+ https://egeria-project.org/concepts/project
7
+
8
+ """
9
+ import asyncio
10
+ import time
11
+
12
+ # import json
13
+ from pyegeria._client import Client
14
+ from pyegeria._globals import enable_ssl_check
15
+ from pyegeria._validators import (
16
+ validate_guid,
17
+ validate_search_string,
18
+ )
19
+ from pyegeria.utils import body_slimmer
20
+
21
+
22
+ class ProjectManager(Client):
23
+ """
24
+ Create and manage projects. Projects may be organized in a hierarchy.
25
+ See https://egeria-project.org/types/1/0130-Projects
26
+
27
+ Attributes:
28
+
29
+ server_name: str
30
+ The name of the View Server to connect to.
31
+ platform_url : str
32
+ URL of the server platform to connect to
33
+ user_id : str
34
+ The identity of the user calling the method - this sets a default optionally used by the methods
35
+ when the user doesn't pass the user_id on a method call.
36
+ user_pwd: str
37
+ The password associated with the user_id. Defaults to None
38
+ verify_flag: bool
39
+ Flag to indicate if SSL Certificates should be verified in the HTTP requests.
40
+ Defaults to False.
41
+
42
+ """
43
+
44
+ def __init__(
45
+ self,
46
+ server_name: str,
47
+ platform_url: str,
48
+ token: str = None,
49
+ user_id: str = None,
50
+ user_pwd: str = None,
51
+ verify_flag: bool = enable_ssl_check,
52
+ sync_mode: bool = True
53
+ ):
54
+ self.command_base: str = f"/api/open-metadata/project-manager/metadata-elements"
55
+ Client.__init__(self, server_name, platform_url, user_id=user_id, token=token, async_mode=sync_mode)
56
+
57
+ #
58
+ # Retrieving Projects= Information - https://egeria-project.org/concepts/project
59
+ #
60
+ async def _async_get_linked_projects(self, parent_guid: str, project_status: str = None, effective_time: str = None,
61
+ server_name: str = None, start_from: int = 0, page_size: int = None) \
62
+ -> list | str:
63
+ """ Returns the list of projects that are linked off of the supplied element. Any relationship will do.
64
+ The request body is optional, but if supplied acts as a filter on project status. Async version.
65
+
66
+ Parameters
67
+ ----------
68
+ parent_guid: str
69
+ The identity of the parent to find linked projects from.
70
+ project_status: str, optional
71
+ Optionally, filter results by project status.
72
+ effective_time: str, optional
73
+ Time at which to query for projects. Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
74
+ server_name : str, optional
75
+ The name of the server to configure.
76
+ If not provided, the server name associated with the instance is used.
77
+ start_from: int, [default=0], optional
78
+ When multiple pages of results are available, the page number to start from.
79
+ page_size: int, [default=None]
80
+ The number of items to return in a single page. If not specified, the default will be taken from
81
+ the class instance.
82
+ Returns
83
+ -------
84
+ List | str
85
+
86
+ A list of projects linked off of the supplied element filtered by project status and effective time.
87
+
88
+ Raises
89
+ ------
90
+
91
+ InvalidParameterException
92
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
93
+ PropertyServerException
94
+ Raised by the server when an issue arises in processing a valid request
95
+ NotAuthorizedException
96
+ The principle specified by the user_id does not have authorization for the requested action
97
+
98
+ """
99
+ if server_name is None:
100
+ server_name = self.server_name
101
+ if page_size is None:
102
+ page_size = self.page_size
103
+
104
+ body = {
105
+ "filter": project_status,
106
+ "effectiveTime": effective_time,
107
+ }
108
+ body_s = body_slimmer(body)
109
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/"
110
+ f"metadata-elements/{parent_guid}/projects?startFrom={start_from}&pageSize={page_size}")
111
+
112
+ resp = await self._async_make_request("POST", url, body_s)
113
+ return resp.json()
114
+
115
+ def get_linked_projects(self, parent_guid: str, project_status: str = None, effective_time: str = None,
116
+ server_name: str = None, start_from: int = 0, page_size: int = None) -> list | str:
117
+ """ Returns the list of projects that are linked off of the supplied element. Any relationship will do.
118
+ The request body is optional, but if supplied acts as a filter on project status.
119
+
120
+ Parameters
121
+ ----------
122
+ parent_guid: str
123
+ The identity of the parent to find linked projects from
124
+ project_status: str, optional
125
+ Optionally, filter results by project status.
126
+ effective_time: str, optional
127
+ Time at which to query for projects. Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
128
+ server_name : str, optional
129
+ The name of the server to configure.
130
+ If not provided, the server name associated with the instance is used.
131
+ start_from: int, [default=0], optional
132
+ When multiple pages of results are available, the page number to start from.
133
+ page_size: int, [default=None]
134
+ The number of items to return in a single page. If not specified, the default will be taken from
135
+ the class instance.
136
+ Returns
137
+ -------
138
+ List | str
139
+
140
+ A list of projects linked off of the supplied element filtered by project status and effective time.
141
+
142
+ Raises
143
+ ------
144
+
145
+ InvalidParameterException
146
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
147
+ PropertyServerException
148
+ Raised by the server when an issue arises in processing a valid request
149
+ NotAuthorizedException
150
+ The principle specified by the user_id does not have authorization for the requested action
151
+
152
+ """
153
+ loop = asyncio.get_event_loop()
154
+ resp = loop.run_until_complete(self._async_get_linked_projects(parent_guid, project_status,
155
+ effective_time, server_name,
156
+ start_from, page_size)),
157
+ return resp
158
+
159
+ async def _async_get_classified_projects(self, project_classification: str, effective_time: str = None,
160
+ server_name: str = None, start_from: int = 0, page_size: int = None) \
161
+ -> list | str:
162
+ """ Returns the list of projects with a particular classification. The name of the classification is
163
+ supplied in the request body. Examples of these classifications include StudyProject, PersonalProject,
164
+ Campaign or Task. There is also GlossaryProject and GovernanceProject. Async version.
165
+
166
+ Parameters
167
+ ----------
168
+ project_classification: str
169
+ The project classification to search for.
170
+ effective_time: str, optional
171
+ Time at which to query for projects. Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
172
+ server_name : str, optional
173
+ The name of the server to configure.
174
+ If not provided, the server name associated with the instance is used.
175
+ start_from: int, [default=0], optional
176
+ When multiple pages of results are available, the page number to start from.
177
+ page_size: int, [default=None]
178
+ The number of items to return in a single page. If not specified, the default will be taken from
179
+ the class instance.
180
+ Returns
181
+ -------
182
+ List | str
183
+
184
+ A list of projects filtered by project classification, and effective time.
185
+
186
+ Raises
187
+ ------
188
+
189
+ InvalidParameterException
190
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
191
+ PropertyServerException
192
+ Raised by the server when an issue arises in processing a valid request
193
+ NotAuthorizedException
194
+ The principle specified by the user_id does not have authorization for the requested action
195
+
196
+ """
197
+ if server_name is None:
198
+ server_name = self.server_name
199
+ if page_size is None:
200
+ page_size = self.page_size
201
+
202
+ body = {
203
+ "filter": project_classification,
204
+ "effectiveTime": effective_time,
205
+ }
206
+ body_s = body_slimmer(body)
207
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/"
208
+ f"projects/by-classifications?startFrom={start_from}&pageSize={page_size}")
209
+
210
+ resp = await self._async_make_request("POST", url, body_s)
211
+ return resp.json()
212
+
213
+ def get_classified_projects(self, project_classification: str, effective_time: str = None, server_name: str = None,
214
+ start_from: int = 0, page_size: int = None) -> list | str:
215
+ """ Returns the list of projects with a particular classification. The name of the classification is
216
+ supplied in the request body. Examples of these classifications include StudyProject, PersonalProject,
217
+ Campaign or Task. There is also GlossaryProject and GovernanceProject.
218
+
219
+ Parameters
220
+ ----------
221
+ project_classification: str
222
+ The project classification to search for.
223
+ effective_time: str, optional
224
+ Time at which to query for projects. Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
225
+ server_name : str, optional
226
+ The name of the server to configure.
227
+ If not provided, the server name associated with the instance is used.
228
+ start_from: int, [default=0], optional
229
+ When multiple pages of results are available, the page number to start from.
230
+ page_size: int, [default=None]
231
+ The number of items to return in a single page. If not specified, the default will be taken from
232
+ the class instance.
233
+ Returns
234
+ -------
235
+ List | str
236
+
237
+ A list of projects filtered by project classification, and effective time.
238
+
239
+ Raises
240
+ ------
241
+
242
+ InvalidParameterException
243
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
244
+ PropertyServerException
245
+ Raised by the server when an issue arises in processing a valid request
246
+ NotAuthorizedException
247
+ The principle specified by the user_id does not have authorization for the requested action
248
+
249
+ """
250
+ loop = asyncio.get_event_loop()
251
+ resp = loop.run_until_complete(self._async_get_classified_projects(project_classification,
252
+ effective_time, server_name,
253
+ start_from, page_size)),
254
+ return resp
255
+
256
+ async def _async_get_project_team(self, project_guid: str, team_role: str = None, effective_time: str = None,
257
+ server_name: str = None, start_from: int = 0,
258
+ page_size: int = None) -> list | str:
259
+ """ Returns the list of actors that are linked off of the project. This includes the project managers.
260
+ The optional request body allows a teamRole to be specified as a filter. To filter out the project managers,
261
+ specify ProjectManagement as the team role. See https://egeria-project.org/concepts/project for details.
262
+ Async version.
263
+
264
+ Parameters
265
+ ----------
266
+ project_guid: str
267
+ The identity of the project to return team information about.
268
+ team_role: str, optional
269
+ team role to filter on. Project managers would be "ProjectManagement".
270
+ effective_time: str, optional
271
+ Time at which to query the team role. Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
272
+ server_name : str, optional
273
+ The name of the server to configure.
274
+ If not provided, the server name associated with the instance is used.
275
+ start_from: int, [default=0], optional
276
+ When multiple pages of results are available, the page number to start from.
277
+ page_size: int, [default=None]
278
+ The number of items to return in a single page. If not specified, the default will be taken from
279
+ the class instance.
280
+
281
+ Returns
282
+ -------
283
+ list | str
284
+ The list of actors linked off the project, including project managers Returns a string if none found.
285
+
286
+ Raises
287
+ ------
288
+ InvalidParameterException
289
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
290
+ PropertyServerException
291
+ Raised by the server when an issue arises in processing a valid request.
292
+ NotAuthorizedException
293
+ The principle specified by the user_id does not have authorization for the requested action.
294
+ Notes
295
+ -----
296
+ """
297
+ if server_name is None:
298
+ server_name = self.server_name
299
+ if page_size is None:
300
+ page_size = self.page_size
301
+
302
+ body = {
303
+ effective_time: effective_time,
304
+ "filter": team_role
305
+ }
306
+ body_s = body_slimmer(body)
307
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/"
308
+ f"{project_guid}/team?startFrom={start_from}&pageSize={page_size}")
309
+
310
+ resp = await self._async_make_request("POST", url, body_s)
311
+
312
+ result = resp.json().get('elements', 'No elements found')
313
+ return result
314
+
315
+ def get_project_team(self, project_guid: str, team_role: str = None, effective_time: str = None,
316
+ server_name: str = None, start_from: int = 0, page_size: int = None) -> list | str:
317
+ """ Returns the list of actors that are linked off of the project. This includes the project managers.
318
+ The optional request body allows a teamRole to be specified as a filter. To filter out the project managers,
319
+ specify ProjectManagement as the team role. See https://egeria-project.org/concepts/project for details.
320
+ Async version.
321
+
322
+ Parameters
323
+ ----------
324
+ project_guid: str
325
+ The identity of the project to return team information about.
326
+ team_role: str, optional
327
+ team role to filter on. Project managers would be "ProjectManagement".
328
+ effective_time: str, optional
329
+ Time at which to query the team role. Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
330
+ server_name : str, optional
331
+ The name of the server to configure.
332
+ If not provided, the server name associated with the instance is used.
333
+ start_from: int, [default=0], optional
334
+ When multiple pages of results are available, the page number to start from.
335
+ page_size: int, [default=None]
336
+ The number of items to return in a single page. If not specified, the default will be taken from
337
+ the class instance.
338
+
339
+ Returns
340
+ -------
341
+ list | str
342
+ The list of actors linked off the project, including project managers Returns a string if none found.
343
+
344
+ Raises
345
+ ------
346
+ InvalidParameterException
347
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
348
+ PropertyServerException
349
+ Raised by the server when an issue arises in processing a valid request.
350
+ NotAuthorizedException
351
+ The principle specified by the user_id does not have authorization for the requested action.
352
+ Notes
353
+ -----
354
+ """
355
+ loop = asyncio.get_event_loop()
356
+ resp = loop.run_until_complete(self._async_get_project_team(project_guid, team_role, effective_time,
357
+ server_name, start_from, page_size)),
358
+ return resp
359
+
360
+ async def _async_find_projects(self, search_string: str, effective_time: str = None, starts_with: bool = False,
361
+ ends_with: bool = False, ignore_case: bool = False,
362
+ server_name: str = None,
363
+ start_from: int = 0, page_size: int = None) -> list | str:
364
+ """ Returns the list of projects matching the search string.
365
+ The search string is located in the request body and is interpreted as a plain string.
366
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
367
+ Async version.
368
+
369
+ Parameters
370
+ ----------
371
+ search_string: str,
372
+ Search string to use to find matching projects. If the search string is '*' then all projects returned.
373
+ effective_time: str, [default=None], optional
374
+ Effective time of the query. If not specified will default to any time.
375
+ server_name : str, optional
376
+ The name of the server to configure.
377
+ If not provided, the server name associated with the instance is used.
378
+ starts_with : bool, [default=False], optional
379
+ Starts with the supplied string.
380
+ ends_with : bool, [default=False], optional
381
+ Ends with the supplied string
382
+ ignore_case : bool, [default=False], optional
383
+ Ignore case when searching
384
+ start_from: int, [default=0], optional
385
+ When multiple pages of results are available, the page number to start from.
386
+ page_size: int, [default=None]
387
+ The number of items to return in a single page. If not specified, the default will be taken from
388
+ the class instance.
389
+ Returns
390
+ -------
391
+ List | str
392
+
393
+ A list of projects matching the search string. Returns a string if none found.
394
+
395
+ Raises
396
+ ------
397
+
398
+ InvalidParameterException
399
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
400
+ PropertyServerException
401
+ Raised by the server when an issue arises in processing a valid request
402
+ NotAuthorizedException
403
+ The principle specified by the user_id does not have authorization for the requested action
404
+
405
+ """
406
+ if server_name is None:
407
+ server_name = self.server_name
408
+ if page_size is None:
409
+ page_size = self.page_size
410
+ starts_with_s = str(starts_with).lower()
411
+ ends_with_s = str(ends_with).lower()
412
+ ignore_case_s = str(ignore_case).lower()
413
+
414
+ validate_search_string(search_string)
415
+
416
+ if search_string == '*':
417
+ search_string = None
418
+
419
+ body = {
420
+ "filter": search_string,
421
+ "effective_time": effective_time,
422
+ }
423
+ body_s = body_slimmer(body)
424
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/"
425
+ f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
426
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}")
427
+
428
+ resp = await self._async_make_request("POST", url, body_s)
429
+ return resp.json().get("elements", "No elements found")
430
+
431
+ def find_projects(self, search_string: str, effective_time: str = None, starts_with: bool = False,
432
+ ends_with: bool = False, ignore_case: bool = False, server_name: str = None,
433
+ start_from: int = 0, page_size: int = None) -> list | str:
434
+ """ Returns the list of projects matching the search string.
435
+ The search string is located in the request body and is interpreted as a plain string.
436
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
437
+
438
+ Parameters
439
+ ----------
440
+ search_string: str,
441
+ Search string to use to find matching projects. If the search string is '*' then all projects returned.
442
+ effective_time: str, [default=None], optional
443
+ Effective time of the query. If not specified will default to any time.
444
+ server_name : str, optional
445
+ The name of the server to configure.
446
+ If not provided, the server name associated with the instance is used.
447
+ starts_with : bool, [default=False], optional
448
+ Starts with the supplied string.
449
+ ends_with : bool, [default=False], optional
450
+ Ends with the supplied string
451
+ ignore_case : bool, [default=False], optional
452
+ Ignore case when searching
453
+ start_from: int, [default=0], optional
454
+ When multiple pages of results are available, the page number to start from.
455
+ page_size: int, [default=None]
456
+ The number of items to return in a single page. If not specified, the default will be taken from
457
+ the class instance.
458
+ Returns
459
+ -------
460
+ List | str
461
+
462
+ A list of projects matching the search string. Returns a string if none found.
463
+
464
+ Raises
465
+ ------
466
+
467
+ InvalidParameterException
468
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
469
+ PropertyServerException
470
+ Raised by the server when an issue arises in processing a valid request
471
+ NotAuthorizedException
472
+ The principle specified by the user_id does not have authorization for the requested action
473
+
474
+ """
475
+ loop = asyncio.get_event_loop()
476
+ resp = loop.run_until_complete(self._async_find_projects(search_string, effective_time, starts_with,
477
+ ends_with, ignore_case,
478
+ server_name, start_from, page_size))
479
+
480
+ return resp
481
+
482
+ async def _async_get_projects_by_name(self, name: str, effective_time: str = None,
483
+ server_name: str = None,
484
+ start_from: int = 0, page_size: int = None) -> list | str:
485
+
486
+ """ Returns the list of projects with a particular name. Async version.
487
+
488
+ Parameters
489
+ ----------
490
+ name: str,
491
+ name to use to find matching collections.
492
+ effective_time: str, [default=None], optional
493
+ Effective time of the query. If not specified will default to any time. ISO 8601 format.
494
+ server_name : str, optional
495
+ The name of the server to configure.
496
+ If not provided, the server name associated with the instance is used.
497
+ start_from: int, [default=0], optional
498
+ When multiple pages of results are available, the page number to start from.
499
+ page_size: int, [default=None]
500
+ The number of items to return in a single page. If not specified, the default will be taken from
501
+ the class instance.
502
+ Returns
503
+ -------
504
+ List | str
505
+
506
+ A list of collections match matching the name. Returns a string if none found.
507
+
508
+ Raises
509
+ ------
510
+
511
+ InvalidParameterException
512
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
513
+ PropertyServerException
514
+ Raised by the server when an issue arises in processing a valid request
515
+ NotAuthorizedException
516
+ The principle specified by the user_id does not have authorization for the requested action
517
+
518
+ """
519
+ if server_name is None:
520
+ server_name = self.server_name
521
+ if page_size is None:
522
+ page_size = self.page_size
523
+
524
+ validate_search_string(name)
525
+
526
+ body = {
527
+ "filter": name,
528
+ "effective_time": effective_time,
529
+ }
530
+ body_s = body_slimmer(body)
531
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/"
532
+ f"by-name?startFrom={start_from}&pageSize={page_size}")
533
+
534
+ resp = await self._async_make_request("POST", url, body_s)
535
+ return resp.json().get("elements", "No elements found")
536
+
537
+ def get_projects_by_name(self, name: str, effective_time: str = None, server_name: str = None,
538
+ start_from: int = 0, page_size: int = None) -> list | str:
539
+ """ Returns the list of projects with a particular name.
540
+
541
+ Parameters
542
+ ----------
543
+ name: str,
544
+ name to use to find matching collections.
545
+ effective_time: str, [default=None], optional
546
+ Effective time of the query. If not specified will default to any time. ISO 8601 format.
547
+ server_name : str, optional
548
+ The name of the server to configure.
549
+ If not provided, the server name associated with the instance is used.
550
+ start_from: int, [default=0], optional
551
+ When multiple pages of results are available, the page number to start from.
552
+ page_size: int, [default=None]
553
+ The number of items to return in a single page. If not specified, the default will be taken from
554
+ the class instance.
555
+ Returns
556
+ -------
557
+ List | str
558
+
559
+ A list of collections match matching the name. Returns a string if none found.
560
+
561
+ Raises
562
+ ------
563
+
564
+ InvalidParameterException
565
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
566
+ PropertyServerException
567
+ Raised by the server when an issue arises in processing a valid request
568
+ NotAuthorizedException
569
+ The principle specified by the user_id does not have authorization for the requested action
570
+
571
+ """
572
+ loop = asyncio.get_event_loop()
573
+ resp = loop.run_until_complete(self._async_get_projects_by_name(name, effective_time,
574
+ server_name, start_from, page_size))
575
+
576
+ return resp
577
+
578
+ async def _async_get_project(self, project_guid: str, effective_time: str = None,
579
+ server_name: str = None) -> dict | str:
580
+ """ Return the properties of a specific project. Async version.
581
+
582
+ Parameters
583
+ ----------
584
+ project_guid: str,
585
+ unique identifier of the project.
586
+ effective_time: str, [default=None], optional
587
+ Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
588
+ server_name : str, optional
589
+ The name of the server to configure.
590
+ If not provided, the server name associated with the instance is used.
591
+
592
+ Returns
593
+ -------
594
+ dict | str
595
+
596
+ A JSON dict representing the specified project. Returns a string if none found.
597
+
598
+ Raises
599
+ ------
600
+
601
+ InvalidParameterException
602
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
603
+ PropertyServerException
604
+ Raised by the server when an issue arises in processing a valid request
605
+ NotAuthorizedException
606
+ The principle specified by the user_id does not have authorization for the requested action
607
+
608
+ """
609
+ if server_name is None:
610
+ server_name = self.server_name
611
+
612
+ validate_guid(project_guid)
613
+ body = {
614
+ "effective_time": effective_time,
615
+ }
616
+ url = f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/{project_guid}"
617
+
618
+ resp = await self._async_make_request("GET", url, body)
619
+ return resp.json()
620
+
621
+ def get_project(self, project_guid: str, server_name: str = None) -> dict | str:
622
+ """ Return the properties of a specific project.
623
+
624
+ Parameters
625
+ ----------
626
+ project_guid: str,
627
+ unique identifier of the project.
628
+ server_name : str, optional
629
+ The name of the server to configure.
630
+ If not provided, the server name associated with the instance is used.
631
+
632
+ Returns
633
+ -------
634
+ dict | str
635
+
636
+ A JSON dict representing the specified project. Returns a string if none found.
637
+
638
+ Raises
639
+ ------
640
+
641
+ InvalidParameterException
642
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
643
+ PropertyServerException
644
+ Raised by the server when an issue arises in processing a valid request
645
+ NotAuthorizedException
646
+ The principle specified by the user_id does not have authorization for the requested action
647
+
648
+ """
649
+ loop = asyncio.get_event_loop()
650
+ resp = loop.run_until_complete(self._async_get_project(project_guid, server_name))
651
+
652
+ return resp
653
+
654
+ #
655
+ # Create project methods
656
+ #
657
+ async def _async_create_project_w_body(self, body: dict, classification: str = None,
658
+ server_name: str = None) -> str:
659
+ """ Create project: https://egeria-project.org/concepts/project Async version.
660
+
661
+ Parameters
662
+ ----------.
663
+ body: dict
664
+ A dict representing the details of the project to create.
665
+ classification: str, optional
666
+ An optional project classification. See https://egeria-project.org/types/1/0130-Projects for values.
667
+ server_name: str, optional, defaults to None
668
+ The name of the server to configure. If not provided, the server name associated with the
669
+ instance is used.
670
+
671
+ Returns
672
+ -------
673
+ str - the guid of the created project
674
+
675
+ Raises
676
+ ------
677
+ InvalidParameterException
678
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
679
+ PropertyServerException
680
+ Raised by the server when an issue arises in processing a valid request
681
+ NotAuthorizedException
682
+ The principle specified by the user_id does not have authorization for the requested action
683
+ Notes
684
+ -----
685
+
686
+ Body structure like:
687
+ {
688
+ "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
689
+ "isOwnAnchor" : False,
690
+ "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
691
+ "parentRelationshipTypeName" : "open metadata type name",
692
+ "parentAtEnd1": True,
693
+ "projectProperties": {
694
+ "class" : "ProjectProperties",
695
+ "qualifiedName": "Must provide a unique name here",
696
+ "identifier" : "Add business identifier",
697
+ "name" : "Add display name here",
698
+ "description" : "Add description of the project here",
699
+ "projectStatus": "Add appropriate valid value for type",
700
+ "projectPhase" : "Add appropriate valid value for phase",
701
+ "projectHealth" : "Add appropriate valid value for health",
702
+ "startDate" : "date/time",
703
+ "plannedEndDate" : "date/time"
704
+ }
705
+ }
706
+
707
+ """
708
+ if server_name is None:
709
+ server_name = self.server_name
710
+ if classification is None:
711
+ url = f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects"
712
+ else:
713
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects?"
714
+ f"classificationName={classification}")
715
+ body_s = body_slimmer(body)
716
+ resp = await self._async_make_request("POST", url, body_s)
717
+ return resp.json().get("guid", "No GUID returned")
718
+
719
+ def create_project_w_body(self, body: dict, classification: str = None, server_name: str = None) -> str:
720
+ """ Create project: https://egeria-project.org/concepts/project
721
+
722
+ Parameters
723
+ ----------.
724
+ body: dict
725
+ A dict representing the details of the project to create.
726
+ classification: str, optional
727
+ An optional project classification. See https://egeria-project.org/types/1/0130-Projects for values.
728
+ server_name: str, optional, defaults to None
729
+ The name of the server to configure. If not provided, the server name associated with the instance
730
+ is used.
731
+
732
+ Returns
733
+ -------
734
+ str - the guid of the created collection
735
+
736
+ Raises
737
+ ------
738
+ InvalidParameterException
739
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
740
+ PropertyServerException
741
+ Raised by the server when an issue arises in processing a valid request
742
+ NotAuthorizedException
743
+ The principle specified by the user_id does not have authorization for the requested action
744
+
745
+ Notes
746
+ -----
747
+ Body structure like:
748
+ {
749
+ "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
750
+ "isOwnAnchor" : False,
751
+ "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
752
+ "parentRelationshipTypeName" : "open metadata type name",
753
+ "parentAtEnd1": True,
754
+ "projectProperties": {
755
+ "class" : "ProjectProperties",
756
+ "qualifiedName": "Must provide a unique name here",
757
+ "identifier" : "Add business identifier",
758
+ "name" : "Add display name here",
759
+ "description" : "Add description of the project here",
760
+ "projectStatus": "Add appropriate valid value for type",
761
+ "projectPhase" : "Add appropriate valid value for phase",
762
+ "projectHealth" : "Add appropriate valid value for health",
763
+ "startDate" : "date/time",
764
+ "plannedEndDate" : "date/time"
765
+ }
766
+ }
767
+
768
+ """
769
+ loop = asyncio.get_event_loop()
770
+ resp = loop.run_until_complete(self._async_create_project_w_body(body, classification, server_name))
771
+ return resp
772
+
773
+ async def _async_create_project(self, anchor_guid: str, parent_guid: str,
774
+ parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
775
+ description: str, classification_name: str = None, identifier: str = None,
776
+ is_own_anchor: bool = False, project_status: str = None, project_phase: str = None,
777
+ project_health: str = None, start_date: str = None,
778
+ planned_end_date: str = None, server_name: str = None) -> str:
779
+ """ Create Project: https://egeria-project.org/concepts/project Async version.
780
+
781
+ Parameters
782
+ ----------
783
+ classification_name: str, optional
784
+ Type of project to create; "PersonalProject", "Campaign", etc. If not provided, project will not
785
+ be classified.
786
+ anchor_guid: str
787
+ The unique identifier of the element that should be the anchor for the new element. Set to null if no
788
+ anchor, or if this collection is to be its own anchor.
789
+ parent_guid: str
790
+ The optional unique identifier for an element that should be connected to the newly created element.
791
+ If this property is specified, parentRelationshipTypeName must also be specified
792
+ parent_relationship_type_name: str
793
+ The name of the relationship, if any, that should be established between the new element and the parent
794
+ element. Examples could be "ResourceList".
795
+ parent_at_end1: bool
796
+ Identifies which end any parent entity sits on the relationship.
797
+ display_name: str
798
+ The display name of the element. Will also be used as the basis of the qualified_name.
799
+ description: str
800
+ A description of the collection.
801
+ identifier: str
802
+ A project identifier.
803
+ is_own_anchor: bool, optional, defaults to False
804
+ Indicates if the collection should be classified as its own anchor or not.
805
+ project_status: str, optional
806
+ The project status
807
+ project_phase: str, optional
808
+ Project phase as defined in valid values
809
+ project_health: str, optional
810
+ Project health as defined in valid values
811
+ start_date: str, optional, defaults to None
812
+ Start date of the project in ISO 8601 string format.
813
+ planned_end_date: str, optional, defaults to None
814
+ Planned completion date in ISO 8601 string format.
815
+ server_name: str, optional, defaults to None
816
+ The name of the server to configure. If not provided, the server name associated with the instance is
817
+ used.
818
+
819
+ Returns
820
+ -------
821
+ str - the guid of the created project
822
+
823
+ Raises
824
+ ------
825
+ InvalidParameterException
826
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
827
+ PropertyServerException
828
+ Raised by the server when an issue arises in processing a valid request
829
+ NotAuthorizedException
830
+ The principle specified by the user_id does not have authorization for the requested action
831
+
832
+ """
833
+ if server_name is None:
834
+ server_name = self.server_name
835
+
836
+ if parent_guid is None:
837
+ is_own_anchor = False
838
+
839
+ if classification_name is None:
840
+ url = f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects"
841
+ else:
842
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects?"
843
+ f"classificationName={classification_name}")
844
+
845
+ body = {
846
+ "anchorGUID": anchor_guid,
847
+ "isOwnAnchor": str(is_own_anchor).lower(),
848
+ "parentGUID": parent_guid,
849
+ "parentRelationshipTypeName": parent_relationship_type_name,
850
+ "parentAtEnd1": str(parent_at_end1).lower(),
851
+ "projectProperties": {
852
+ "class": "ProjectProperties",
853
+ "qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
854
+ "identifier": identifier,
855
+ "name": display_name,
856
+ "description": description,
857
+ "projectStatus": project_status,
858
+ "projectPhase": project_phase,
859
+ "projectHealth": project_health,
860
+ "startDate": start_date,
861
+ "plannedEndDate": planned_end_date
862
+ }
863
+ }
864
+ body_s = body_slimmer(body)
865
+ resp = await self._async_make_request("POST", url, body_s)
866
+ return resp.json().get("guid", "No GUID returned")
867
+
868
+ def create_project(self, anchor_guid: str, parent_guid: str,
869
+ parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
870
+ description: str, classification_name: str, identifier: str = None, is_own_anchor: bool = False,
871
+ project_status: str = None, project_phase: str = None, project_health: str = None,
872
+ start_date: str = None, planned_end_date: str = None, server_name: str = None) -> str:
873
+ """ Create Project: https://egeria-project.org/concepts/project
874
+
875
+ Parameters
876
+ ----------
877
+ classification_name: str
878
+ Type of project to create; "PersonalProject", "Campaign", etc. If not provided, the project will not
879
+ have a project classification.
880
+ anchor_guid: str
881
+ The unique identifier of the element that should be the anchor for the new element. Set to null if no
882
+ anchor, or if this collection is to be its own anchor.
883
+ parent_guid: str
884
+ The optional unique identifier for an element that should be connected to the newly created element.
885
+ If this property is specified, parentRelationshipTypeName must also be specified
886
+ parent_relationship_type_name: str
887
+ The name of the relationship, if any, that should be established between the new element and the parent
888
+ element. Examples could be "ResourceList".
889
+ parent_at_end1: bool
890
+ Identifies which end any parent entity sits on the relationship.
891
+ display_name: str
892
+ The display name of the element. Will also be used as the basis of the qualified_name.
893
+ description: str
894
+ A description of the collection.
895
+ identifier: str
896
+ A project identifier.
897
+ is_own_anchor: bool, optional, defaults to False
898
+ Indicates if the collection should be classified as its own anchor or not.
899
+ project_status: str, optional
900
+ The project status
901
+ project_phase: str, optional
902
+ Project phase as defined in valid values
903
+ project_health: str, optional
904
+ Project health as defined in valid values
905
+ start_date: str, optional, defaults to None
906
+ Start date of the project in ISO 8601 string format.
907
+ planned_end_date: str, optional, defaults to None
908
+ Planned completion date in ISO 8601 string format.
909
+ server_name: str, optional, defaults to None
910
+ The name of the server to configure. If not provided, the server name associated with the instance is
911
+ used.
912
+
913
+ Returns
914
+ -------
915
+ str - the guid of the created project
916
+
917
+ Raises
918
+ ------
919
+ InvalidParameterException
920
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
921
+ PropertyServerException
922
+ Raised by the server when an issue arises in processing a valid request
923
+ NotAuthorizedException
924
+ The principle specified by the user_id does not have authorization for the requested action
925
+
926
+ """
927
+ loop = asyncio.get_event_loop()
928
+ resp = loop.run_until_complete(self._async_create_project(anchor_guid, parent_guid,
929
+ parent_relationship_type_name, parent_at_end1,
930
+ display_name, description,
931
+ classification_name, identifier, is_own_anchor,
932
+ project_status, project_phase, project_health,
933
+ start_date, planned_end_date, server_name))
934
+ return resp
935
+
936
+ async def _async_create_project_task(self, project_guid: str, display_name: str, identifier: str = None,
937
+ description: str = None, project_status: str = None, project_phase: str = None,
938
+ project_health: str = None, start_date: str = None,
939
+ planned_end_date: str = None, server_name: str = None) -> str:
940
+ """ Create a new project with the Task classification and link it to a project. Async version.
941
+
942
+ Parameters
943
+ ----------
944
+ project_guid: str
945
+ The unique identifier of the project to create the task for (the parent).
946
+ display_name: str
947
+ The display name of the element. Will also be used as the basis of the qualified_name.
948
+ identifier: str
949
+ A project identifier.
950
+ description: str
951
+ A description of the collection.
952
+ project_status: str, optional, defaults to "OTHER"
953
+ The project status
954
+ project_phase: str, optional
955
+ Project phase as defined in valid values
956
+ project_health: str, optional
957
+ Project health as defined in valid values
958
+ start_date: str, optional, defaults to None
959
+ Start date of the project in ISO 8601 string format.
960
+ planned_end_date: str, optional, defaults to None
961
+ Planned completion date in ISO 8601 string format.
962
+ server_name: str, optional, defaults to None
963
+ The name of the server to configure. If not provided, the server name associated with the instance is
964
+ used.
965
+ Returns
966
+ -------
967
+ str - the guid of the created project task
968
+
969
+ Raises
970
+ ------
971
+ InvalidParameterException
972
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
973
+ PropertyServerException
974
+ Raised by the server when an issue arises in processing a valid request
975
+ NotAuthorizedException
976
+ The principle specified by the user_id does not have authorization for the requested action
977
+
978
+ """
979
+ if server_name is None:
980
+ server_name = self.server_name
981
+
982
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/"
983
+ f"{project_guid}/task")
984
+
985
+ body = {
986
+ "class": "ProjectProperties",
987
+ "qualifiedName": f"task-{display_name}-{time.asctime()}",
988
+ "identifier": identifier,
989
+ "name": display_name,
990
+ "description": description,
991
+ "projectStatus": project_status,
992
+ "projectPhase": project_phase,
993
+ "projectHealth": project_health,
994
+ "startDate": start_date,
995
+ "plannedEndDate": planned_end_date
996
+ }
997
+ body_s = body_slimmer(body)
998
+ resp = await self._async_make_request("POST", url, body_s)
999
+ return resp.json().get("guid", "No GUID Returned")
1000
+
1001
+ def create_project_task(self, project_guid: str, display_name: str, identifier: str = None,
1002
+ description: str = None, project_status: str = None, project_phase: str = None,
1003
+ project_health: str = None,
1004
+ start_date: str = None, planned_end_date: str = None, server_name: str = None) -> str:
1005
+ """ Create a new project with the Task classification and link it to a project.
1006
+
1007
+ Parameters
1008
+ ----------
1009
+ project_guid: str
1010
+ The unique identifier of the project to create the task for.The parent.
1011
+ display_name: str
1012
+ The display name of the element. Will also be used as the basis of the qualified_name.
1013
+ identifier: str
1014
+ A project identifier.
1015
+ description: str
1016
+ A description of the collection.
1017
+ project_status: str, optional, defaults to "OTHER"
1018
+ The project status
1019
+ project_phase: str, optional
1020
+ Project phase as defined in valid values
1021
+ project_health: str, optional
1022
+ Project health as defined in valid values
1023
+ start_date: str, optional, defaults to None
1024
+ Start date of the project in ISO 8601 string format.
1025
+ planned_end_date: str, optional, defaults to None
1026
+ Planned completion date in ISO 8601 string format.
1027
+ server_name: str, optional, defaults to None
1028
+ The name of the server to configure. If not provided, the server name associated with the instance is
1029
+ used.
1030
+ Returns
1031
+ -------
1032
+ str - the guid of the created project task
1033
+
1034
+ Raises
1035
+ ------
1036
+ InvalidParameterException
1037
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1038
+ PropertyServerException
1039
+ Raised by the server when an issue arises in processing a valid request
1040
+ NotAuthorizedException
1041
+ The principle specified by the user_id does not have authorization for the requested action
1042
+
1043
+ """
1044
+ loop = asyncio.get_event_loop()
1045
+ resp = loop.run_until_complete(self._async_create_project_task(project_guid, display_name,
1046
+ identifier, description, project_status,
1047
+ project_phase, project_health, start_date,
1048
+ planned_end_date,
1049
+ server_name))
1050
+ return resp
1051
+
1052
+ async def _async_create_project_from_template(self, body: dict, server_name: str = None) -> str:
1053
+ """ Create a new metadata element to represent a project using an existing metadata element as a template.
1054
+ The template defines additional classifications and relationships that should be added to the new project.
1055
+ Async version.
1056
+
1057
+ Parameters
1058
+ ----------
1059
+
1060
+ body: dict
1061
+ A dict representing the details of the collection to create.
1062
+ server_name: str, optional, defaults to None
1063
+ The name of the server to configure. If not provided, the server name associated with the instance
1064
+ is used.
1065
+
1066
+ Returns
1067
+ -------
1068
+ str - the guid of the created project.
1069
+
1070
+ Raises
1071
+ ------
1072
+ InvalidParameterException
1073
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1074
+ PropertyServerException
1075
+ Raised by the server when an issue arises in processing a valid request
1076
+ NotAuthorizedException
1077
+ The principle specified by the user_id does not have authorization for the requested action
1078
+
1079
+ Notes
1080
+ -----
1081
+ JSON Structure looks like:
1082
+ {
1083
+ "class": "TemplateRequestBody",
1084
+ "anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
1085
+ "isOwnAnchor": false,
1086
+ "parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
1087
+ "parentRelationshipTypeName": "open metadata type name",
1088
+ "parentAtEnd1": true,
1089
+ "templateGUID": "template GUID",
1090
+ "replacementProperties": {
1091
+ "class": "ElementProperties",
1092
+ "propertyValueMap" : {
1093
+ "propertyName" : {
1094
+ "class": "PrimitiveTypePropertyValue",
1095
+ "typeName": "string",
1096
+ "primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
1097
+ "primitiveValue" : "value of property"
1098
+ }
1099
+ }
1100
+ },
1101
+ "placeholderPropertyValues" : {
1102
+ "placeholderProperty1Name" : "property1Value",
1103
+ "placeholderProperty2Name" : "property2Value"
1104
+ }
1105
+ }
1106
+
1107
+
1108
+ """
1109
+ if server_name is None:
1110
+ server_name = self.server_name
1111
+
1112
+ url = f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/from-template"
1113
+ body_s = body_slimmer(body)
1114
+ resp = await self._async_make_request("POST", url, body_s)
1115
+ return resp.json().get("guid", "No GUID Returned")
1116
+
1117
+ def create_project_from_template(self, body: dict, server_name: str = None) -> str:
1118
+ """ Create a new metadata element to represent a project using an existing metadata element as a template.
1119
+ The template defines additional classifications and relationships that should be added to the new project.
1120
+
1121
+ Parameters
1122
+ ----------
1123
+
1124
+ body: dict
1125
+ A dict representing the details of the collection to create.
1126
+ server_name: str, optional, defaults to None
1127
+ The name of the server to configure. If not provided, the server name associated with the instance
1128
+ is used.
1129
+
1130
+ Returns
1131
+ -------
1132
+ str - the guid of the created project.
1133
+
1134
+ Raises
1135
+ ------
1136
+ InvalidParameterException
1137
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1138
+ PropertyServerException
1139
+ Raised by the server when an issue arises in processing a valid request
1140
+ NotAuthorizedException
1141
+ The principle specified by the user_id does not have authorization for the requested action
1142
+
1143
+ Notes
1144
+ -----
1145
+ JSON Structure looks like:
1146
+ {
1147
+ "class": "TemplateRequestBody",
1148
+ "anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
1149
+ "isOwnAnchor": false,
1150
+ "parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
1151
+ "parentRelationshipTypeName": "open metadata type name",
1152
+ "parentAtEnd1": true,
1153
+ "templateGUID": "template GUID",
1154
+ "replacementProperties": {
1155
+ "class": "ElementProperties",
1156
+ "propertyValueMap" : {
1157
+ "propertyName" : {
1158
+ "class": "PrimitiveTypePropertyValue",
1159
+ "typeName": "string",
1160
+ "primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
1161
+ "primitiveValue" : "value of property"
1162
+ }
1163
+ }
1164
+ },
1165
+ "placeholderPropertyValues" : {
1166
+ "placeholderProperty1Name" : "property1Value",
1167
+ "placeholderProperty2Name" : "property2Value"
1168
+ }
1169
+ }
1170
+ """
1171
+ loop = asyncio.get_event_loop()
1172
+ resp = loop.run_until_complete(self._async_create_project_from_template(body, server_name))
1173
+ return resp
1174
+
1175
+ async def _async_update_project(self, project_guid: str, qualified_name: str = None, identifier: str = None,
1176
+ display_name: str = None, description: str = None,
1177
+ project_status: str = None, project_phase: str = None, project_health: str = None,
1178
+ start_date: str = None, planned_end_date: str = None,
1179
+ replace_all_props: bool = False, server_name: str = None) -> None:
1180
+ """ Update the properties of a project. Async Version.
1181
+
1182
+ Parameters
1183
+ ----------
1184
+ project_guid: str
1185
+ Unique identifier for the project.
1186
+ qualified_name: str, optional, defaults to None
1187
+ The unique identifier of the project.
1188
+ identifier: str
1189
+ A project identifier.
1190
+ display_name: str
1191
+ The display name of the element. Will also be used as the basis of the qualified_name.
1192
+ description: str
1193
+ A description of the collection.
1194
+ project_status: str, optional
1195
+ The project status
1196
+ project_phase: str, optional
1197
+ Project phase as defined in valid values
1198
+ project_health: str, optional
1199
+ Project health as defined in valid values
1200
+ start_date: str, optional, defaults to None
1201
+ Start date of the project in ISO 8601 string format.
1202
+ planned_end_date: str, optional, defaults to None
1203
+ Planned completion date in ISO 8601 string format.
1204
+ replace_all_props: bool, optional, defaults to False
1205
+ If True, then all the properties of the project will be replaced with the specified properties.
1206
+ server_name: str, optional, defaults to None
1207
+ The name of the server to configure. If not provided, the server name associated with the instance is
1208
+ used.
1209
+ Returns
1210
+ -------
1211
+ str - the guid of the created project task
1212
+
1213
+ Raises
1214
+ ------
1215
+ InvalidParameterException
1216
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1217
+ PropertyServerException
1218
+ Raised by the server when an issue arises in processing a valid request
1219
+ NotAuthorizedException
1220
+ The principle specified by the user_id does not have authorization for the requested action
1221
+ """
1222
+ if server_name is None:
1223
+ server_name = self.server_name
1224
+ replace_all_props_s = str(replace_all_props).lower()
1225
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/{project_guid}/"
1226
+ f"update?replaceAllProperties={replace_all_props_s}")
1227
+
1228
+ body = {
1229
+ "class": "ProjectProperties",
1230
+ "qualifiedName": qualified_name,
1231
+ "identifier": identifier,
1232
+ "name": display_name,
1233
+ "description": description,
1234
+ "projectStatus": project_status,
1235
+ "projectPhase": project_phase,
1236
+ "projectHealth": project_health,
1237
+ "startDate": start_date,
1238
+ "plannedEndDate": planned_end_date
1239
+ }
1240
+ body_s = body_slimmer(body)
1241
+ await self._async_make_request("POST", url, body_s)
1242
+ return
1243
+
1244
+ def update_project(self, project_guid: str, qualified_name: str = None, identifier: str = None,
1245
+ display_name: str = None, description: str = None, project_status: str = None,
1246
+ project_phase: str = None, project_health: str = None, start_date: str = None,
1247
+ planned_end_date: str = None, replace_all_props: bool = False, server_name: str = None) -> None:
1248
+ """ Update the properties of a project.
1249
+
1250
+ Parameters
1251
+ ----------
1252
+ project_guid: str
1253
+ Unique identifier for the project.
1254
+ qualified_name: str, optional, defaults to None
1255
+ The unique identifier of the project.
1256
+ identifier: str
1257
+ A project identifier.
1258
+ display_name: str
1259
+ The display name of the element. Will also be used as the basis of the qualified_name.
1260
+ description: str
1261
+ A description of the collection.
1262
+ project_status: str, optional
1263
+ The project status
1264
+ project_phase: str, optional
1265
+ Project phase as defined in valid values
1266
+ project_health: str, optional
1267
+ Project health as defined in valid values
1268
+ start_date: str, optional, defaults to None
1269
+ Start date of the project in ISO 8601 string format.
1270
+ planned_end_date: str, optional, defaults to None
1271
+ Planned completion date in ISO 8601 string format.
1272
+ replace_all_props: bool, optional, defaults to False
1273
+ If True, then all the properties of the project will be replaced with the specified properties.
1274
+ server_name: str, optional, defaults to None
1275
+ The name of the server to configure. If not provided, the server name associated with the instance is
1276
+ used.
1277
+ Returns
1278
+ -------
1279
+ str - the guid of the created project task
1280
+
1281
+ Raises
1282
+ ------
1283
+ InvalidParameterException
1284
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1285
+ PropertyServerException
1286
+ Raised by the server when an issue arises in processing a valid request
1287
+ NotAuthorizedException
1288
+ The principle specified by the user_id does not have authorization for the requested action
1289
+ """
1290
+ loop = asyncio.get_event_loop()
1291
+ loop.run_until_complete(self._async_update_project(project_guid, qualified_name, identifier,
1292
+ display_name, description, project_status,
1293
+ project_phase, project_health, start_date,
1294
+ planned_end_date,
1295
+ replace_all_props, server_name))
1296
+ return
1297
+
1298
+ async def _async_delete_project(self, project_guid: str, server_name: str = None) -> None:
1299
+ """ Delete a project. It is detected from all parent elements. Async version
1300
+
1301
+ Parameters
1302
+ ----------
1303
+ project_guid: str
1304
+ The guid of the project to update.
1305
+ server_name: str, optional, defaults to None
1306
+ The name of the server to configure. If not provided, the server name associated with the instance
1307
+ is used.
1308
+
1309
+ Returns
1310
+ -------
1311
+ Nothing
1312
+
1313
+ Raises
1314
+ ------
1315
+ InvalidParameterException
1316
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1317
+ PropertyServerException
1318
+ Raised by the server when an issue arises in processing a valid request
1319
+ NotAuthorizedException
1320
+ The principle specified by the user_id does not have authorization for the requested action
1321
+
1322
+ """
1323
+ if server_name is None:
1324
+ server_name = self.server_name
1325
+
1326
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/"
1327
+ f"{project_guid}/delete")
1328
+
1329
+ body = {
1330
+ "class": "NullRequestBody"
1331
+ }
1332
+
1333
+ await self._async_make_request("POST", url, body)
1334
+ return
1335
+
1336
+ def delete_project(self, project_guid: str, server_name: str = None) -> None:
1337
+ """ Delete a project. It is detected from all parent elements.
1338
+
1339
+ Parameters
1340
+ ----------
1341
+ project_guid: str
1342
+ The guid of the collection to update.
1343
+ server_name: str, optional, defaults to None
1344
+ The name of the server to configure. If not provided, the server name associated with the instance
1345
+ is used.
1346
+
1347
+ Returns
1348
+ -------
1349
+ Nothing
1350
+
1351
+ Raises
1352
+ ------
1353
+
1354
+ InvalidParameterException
1355
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1356
+ PropertyServerException
1357
+ Raised by the server when an issue arises in processing a valid request
1358
+ NotAuthorizedException
1359
+ The principle specified by the user_id does not have authorization for the requested action
1360
+
1361
+ """
1362
+ loop = asyncio.get_event_loop()
1363
+ loop.run_until_complete(self._async_delete_project(project_guid, server_name))
1364
+ return
1365
+
1366
+ async def _async_add_to_project_team(self, project_guid: str, actor_guid: str, team_role: str = None,
1367
+ effective_from: str = None, effective_to: str = None, server_name: str = None) \
1368
+ -> None:
1369
+ """ Add an actor to a project. The request body is optional. If supplied, it contains the name of the role that
1370
+ the actor plays in the project. Async version.
1371
+
1372
+ Parameters
1373
+ ----------
1374
+ project_guid: str
1375
+ identity of the project to update.
1376
+ actor_guid: str
1377
+ identity of the actor to add.
1378
+ team_role: str, optional, defaults to None
1379
+ Name of the role the actor plays in the project.
1380
+ effective_from: str, optional, defaults to None
1381
+ Date at which the actor becomes active in the project. Date format is ISO 8601 string format.
1382
+ effective_to: str, optional, defaults to None
1383
+ Date at which the actor is no longer active in the project. Date format is ISO 8601 string format.
1384
+ server_name : str, optional
1385
+ The name of the server to use.
1386
+ If not provided, the server name associated with the instance is used.
1387
+
1388
+ Returns
1389
+ -------
1390
+ None
1391
+
1392
+ Raises
1393
+ ------
1394
+
1395
+ InvalidParameterException
1396
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1397
+ PropertyServerException
1398
+ Raised by the server when an issue arises in processing a valid request
1399
+ NotAuthorizedException
1400
+ The principle specified by the user_id does not have authorization for the requested action
1401
+
1402
+ """
1403
+ if server_name is None:
1404
+ server_name = self.server_name
1405
+
1406
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/{project_guid}/"
1407
+ f"members/{actor_guid}/attach")
1408
+ body = {
1409
+ "class": "ProjectTeamProperties",
1410
+ "teamRole": team_role,
1411
+ "effectiveFrom": effective_from,
1412
+ "effectiveTo": effective_to
1413
+ }
1414
+ body_s = body_slimmer(body)
1415
+ if body_s is None:
1416
+ await self._async_make_request("POST", url)
1417
+ else:
1418
+ await self._async_make_request("POST", url, body_s)
1419
+ return
1420
+
1421
+ def add_to_project_team(self, project_guid: str, actor_guid: str, team_role: str = None,
1422
+ effective_from: str = None, effective_to: str = None,
1423
+ server_name: str = None) -> None:
1424
+ """ Add an actor to a project. The request body is optional. If supplied, it contains the name of the role that
1425
+ the actor plays in the project.
1426
+
1427
+ Parameters
1428
+ ----------
1429
+ project_guid: str
1430
+ identity of the project to update.
1431
+ actor_guid: str
1432
+ identity of the actor to add.
1433
+ team_role: str, optional, defaults to None
1434
+ Name of the role the actor plays in the project.
1435
+ effective_from: str, optional, defaults to None
1436
+ Date at which the actor becomes active in the project. Date format is ISO 8601 string format.
1437
+ effective_to: str, optional, defaults to None
1438
+ Date at which the actor is no longer active in the project. Date format is ISO 8601 string format.
1439
+ server_name : str, optional
1440
+ The name of the server to use.
1441
+ If not provided, the server name associated with the instance is used.
1442
+
1443
+ Returns
1444
+ -------
1445
+ None
1446
+
1447
+ Raises
1448
+ ------
1449
+
1450
+ InvalidParameterException
1451
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1452
+ PropertyServerException
1453
+ Raised by the server when an issue arises in processing a valid request
1454
+ NotAuthorizedException
1455
+ The principle specified by the user_id does not have authorization for the requested action
1456
+
1457
+ """
1458
+ loop = asyncio.get_event_loop()
1459
+ loop.run_until_complete(self._async_add_to_project_team(project_guid, actor_guid,
1460
+ team_role, effective_from,
1461
+ effective_to, server_name))
1462
+ return
1463
+
1464
+ async def _async_remove_from_project_team(self, project_guid: str, actor_guid: str,
1465
+ server_name: str = None) -> None:
1466
+ """ Remove an actor from a project. Async version.
1467
+
1468
+ Parameters
1469
+ ----------
1470
+ project_guid: str
1471
+ identity of the project to remove members from.
1472
+ actor_guid: str
1473
+ identity of the actor to remove.
1474
+ server_name : str, optional
1475
+ The name of the server to use.
1476
+ If not provided, the server name associated with the instance is used.
1477
+
1478
+ Returns
1479
+ -------
1480
+ None
1481
+
1482
+ Raises
1483
+ ------
1484
+
1485
+ InvalidParameterException
1486
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1487
+ PropertyServerException
1488
+ Raised by the server when an issue arises in processing a valid request
1489
+ NotAuthorizedException
1490
+ The principle specified by the user_id does not have authorization for the requested action
1491
+
1492
+ """
1493
+ if server_name is None:
1494
+ server_name = self.server_name
1495
+
1496
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/{project_guid}/"
1497
+ f"members/{actor_guid}/detach")
1498
+
1499
+ body = {
1500
+ "class": "NullRequestBody"
1501
+ }
1502
+ await self._async_make_request("POST", url, body)
1503
+ return
1504
+
1505
+ def remove_from_project_team(self, project_guid: str, actor_guid: str,
1506
+ server_name: str = None) -> None:
1507
+ """ Remove an actor from a project.
1508
+
1509
+ Parameters
1510
+ ----------
1511
+ project_guid: str
1512
+ identity of the project.
1513
+ actor_guid: str
1514
+ identity of the actor to remove.
1515
+ server_name : str, optional
1516
+ The name of the server to use.
1517
+ If not provided, the server name associated with the instance is used.
1518
+
1519
+ Returns
1520
+ -------
1521
+ None
1522
+
1523
+ Raises
1524
+ ------
1525
+
1526
+ InvalidParameterException
1527
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1528
+ PropertyServerException
1529
+ Raised by the server when an issue arises in processing a valid request
1530
+ NotAuthorizedException
1531
+ The principle specified by the user_id does not have authorization for the requested action
1532
+
1533
+ """
1534
+ loop = asyncio.get_event_loop()
1535
+ loop.run_until_complete(self._async_remove_from_project_team(project_guid, actor_guid,
1536
+ server_name))
1537
+ return
1538
+
1539
+ async def _async_setup_project_management_role(self, project_guid: str, project_role_guid: str,
1540
+ server_name: str = None) -> None:
1541
+ """ Create a ProjectManagement relationship between a project and a person role to show that anyone appointed to
1542
+ the role is a member of the project. Async version.
1543
+
1544
+ Parameters
1545
+ ----------
1546
+ project_guid: str
1547
+ identity of the project.
1548
+ project_role_guid: str
1549
+ guid of the role to assign to the project.
1550
+ server_name : str, optional
1551
+ The name of the server to use.
1552
+ If not provided, the server name associated with the instance is used.
1553
+
1554
+ Returns
1555
+ -------
1556
+ None
1557
+
1558
+ Raises
1559
+ ------
1560
+
1561
+ InvalidParameterException
1562
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1563
+ PropertyServerException
1564
+ Raised by the server when an issue arises in processing a valid request
1565
+ NotAuthorizedException
1566
+ The principle specified by the user_id does not have authorization for the requested action
1567
+
1568
+ """
1569
+ if server_name is None:
1570
+ server_name = self.server_name
1571
+
1572
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/{project_guid}/"
1573
+ f"project-management-roles/{project_role_guid}/attach")
1574
+
1575
+ body = {
1576
+ "class": "NullRequestBody"
1577
+ }
1578
+ await self._async_make_request("POST", url, body)
1579
+ return
1580
+
1581
+ def setup_project_management_role(self, project_guid: str, project_role_guid: str,
1582
+ server_name: str = None) -> None:
1583
+ """ Create a ProjectManagement relationship between a project and a person role to show that anyone appointed to
1584
+ the role is a member of the project. Async version.
1585
+
1586
+ Parameters
1587
+ ----------
1588
+ project_guid: str
1589
+ identity of the project.
1590
+ project_role_guid: str
1591
+ guid of the role to assign to the project.
1592
+ server_name : str, optional
1593
+ The name of the server to use.
1594
+ If not provided, the server name associated with the instance is used.
1595
+
1596
+ Returns
1597
+ -------
1598
+ None
1599
+
1600
+ Raises
1601
+ ------
1602
+
1603
+ InvalidParameterException
1604
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1605
+ PropertyServerException
1606
+ Raised by the server when an issue arises in processing a valid request
1607
+ NotAuthorizedException
1608
+ The principle specified by the user_id does not have authorization for the requested action
1609
+
1610
+ """
1611
+ loop = asyncio.get_event_loop()
1612
+ loop.run_until_complete(self._async_setup_project_management_role(project_guid, project_role_guid,
1613
+ server_name))
1614
+ return
1615
+
1616
+ async def _async_clear_project_management_role(self, project_guid: str, project_role_guid: str,
1617
+ server_name: str = None) -> None:
1618
+ """ Remove a ProjectManagement relationship between a project and a person role. Async version.
1619
+
1620
+ Parameters
1621
+ ----------
1622
+ project_guid: str
1623
+ identity of the project.
1624
+ project_role_guid: str
1625
+ guid of the role to assign to the project.
1626
+ server_name : str, optional
1627
+ The name of the server to use.
1628
+ If not provided, the server name associated with the instance is used.
1629
+
1630
+ Returns
1631
+ -------
1632
+ None
1633
+
1634
+ Raises
1635
+ ------
1636
+
1637
+ InvalidParameterException
1638
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1639
+ PropertyServerException
1640
+ Raised by the server when an issue arises in processing a valid request
1641
+ NotAuthorizedException
1642
+ The principle specified by the user_id does not have authorization for the requested action
1643
+
1644
+ """
1645
+ if server_name is None:
1646
+ server_name = self.server_name
1647
+
1648
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/project-manager/projects/{project_guid}/"
1649
+ f"project-management-roles/{project_role_guid}/detach")
1650
+
1651
+ body = {
1652
+ "class": "NullRequestBody"
1653
+ }
1654
+ await self._async_make_request("POST", url, body)
1655
+ return
1656
+
1657
+ def clear_project_management_role(self, project_guid: str, project_role_guid: str,
1658
+ server_name: str = None) -> None:
1659
+ """ Clear a ProjectManagement relationship between a project and a person role.
1660
+
1661
+ Parameters
1662
+ ----------
1663
+ project_guid: str
1664
+ identity of the project.
1665
+ project_role_guid: str
1666
+ guid of the role to assign to the project.
1667
+ server_name : str, optional
1668
+ The name of the server to use.
1669
+ If not provided, the server name associated with the instance is used.
1670
+
1671
+ Returns
1672
+ -------
1673
+ None
1674
+
1675
+ Raises
1676
+ ------
1677
+
1678
+ InvalidParameterException
1679
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1680
+ PropertyServerException
1681
+ Raised by the server when an issue arises in processing a valid request
1682
+ NotAuthorizedException
1683
+ The principle specified by the user_id does not have authorization for the requested action
1684
+
1685
+ """
1686
+ loop = asyncio.get_event_loop()
1687
+ loop.run_until_complete(self._async_clear_project_management_role(project_guid, project_role_guid,
1688
+ server_name))
1689
+ return