pyegeria 0.3.8__py3-none-any.whl → 0.3.9__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.
- pyegeria/Xasset_catalog_omvs.py +539 -0
- pyegeria/Xfeedback_manager_omvs.py +251 -0
- pyegeria/Xglossary_manager_omvs.py +3001 -0
- pyegeria/Xloaded_resources_omvs.py +91 -0
- pyegeria/__init__.py +6 -10
- pyegeria/_client.py +4 -6
- pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
- pyegeria/_exceptions.py +5 -6
- pyegeria/_globals.py +1 -1
- pyegeria/automated_curation_omvs.py +320 -315
- pyegeria/collection_manager_omvs.py +187 -248
- pyegeria/core_omag_server_config.py +1 -5
- pyegeria/full_omag_server_config.py +53 -83
- pyegeria/glossary_browser_omvs.py +2208 -0
- pyegeria/my_profile_omvs.py +2 -7
- pyegeria/platform_services.py +0 -3
- pyegeria/project_manager_omvs.py +9 -15
- pyegeria/registered_info.py +12 -52
- pyegeria/server_operations.py +1 -5
- pyegeria/valid_metadata_omvs.py +11 -23
- pyegeria-0.3.9.data/scripts/Create_Collection_Sample.py +292 -0
- pyegeria-0.3.9.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
- pyegeria-0.3.9.data/scripts/coco_status.py +98 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/collection_viewer.py +12 -31
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/engine_action_status.py +9 -28
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/find_todos.py +9 -38
- pyegeria-0.3.9.data/scripts/get_registered_services.py +135 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/get_relationship_types.py +16 -35
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/glossary_view.py +2 -2
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/gov_engine_status.py +0 -1
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/list_asset_types.py +3 -25
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/my_todos.py +1 -1
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/open_todos.py +3 -24
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/project_list_viewer.py +12 -26
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/server_status.py +1 -20
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/view_my_profile.py +8 -34
- {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/METADATA +1 -3
- pyegeria-0.3.9.dist-info/RECORD +49 -0
- pyegeria/glossary_omvs.py +0 -789
- pyegeria/loaded_resources_omvs.py +0 -159
- pyegeria-0.3.8.dist-info/RECORD +0 -42
- /pyegeria/{governance_author.py → Xaction_author_omvs.py} +0 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/get_tech_details.py +0 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/get_tech_types.py +0 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/integration_daemon_status.py +0 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/multi-server_status.py +0 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/server_status_widget.py +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/LICENSE +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/WHEEL +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/top_level.txt +0 -0
pyegeria/my_profile_omvs.py
CHANGED
@@ -4,10 +4,9 @@ This module contains the MyProfile class and its methods.
|
|
4
4
|
|
5
5
|
"""
|
6
6
|
import asyncio
|
7
|
-
|
8
7
|
import json
|
8
|
+
|
9
9
|
from pyegeria._client import Client
|
10
|
-
from pyegeria._globals import enable_ssl_check
|
11
10
|
from pyegeria._validators import validate_name, validate_search_string
|
12
11
|
|
13
12
|
|
@@ -29,9 +28,6 @@ class MyProfile(Client):
|
|
29
28
|
The user ID. Default is None.
|
30
29
|
user_pwd : str, optional
|
31
30
|
The user password. Default is None.
|
32
|
-
verify_flag : bool, optional
|
33
|
-
The flag indicating whether to enable SSL check. Default is
|
34
|
-
enable_ssl_check.
|
35
31
|
sync_mode : bool, optional
|
36
32
|
The flag indicating whether to use synchronous mode. Default
|
37
33
|
is True.
|
@@ -44,7 +40,6 @@ class MyProfile(Client):
|
|
44
40
|
token: str = None,
|
45
41
|
user_id: str = None,
|
46
42
|
user_pwd: str = None,
|
47
|
-
verify_flag: bool = enable_ssl_check,
|
48
43
|
sync_mode: bool = True
|
49
44
|
):
|
50
45
|
|
@@ -761,7 +756,7 @@ class MyProfile(Client):
|
|
761
756
|
ends_with_s = str(ends_with).lower()
|
762
757
|
ignore_case_s = str(ignore_case).lower()
|
763
758
|
|
764
|
-
if search_string
|
759
|
+
if search_string == '*':
|
765
760
|
search_string = " "
|
766
761
|
|
767
762
|
body = {
|
pyegeria/platform_services.py
CHANGED
@@ -39,9 +39,6 @@ class Platform(Client):
|
|
39
39
|
when the user doesn't pass the user_id on a method call.
|
40
40
|
user_pwd: str
|
41
41
|
The password associated with the user_id. Defaults to None
|
42
|
-
verify_flag: bool
|
43
|
-
Flag to indicate if SSL Certificates should be verified in the HTTP requests.
|
44
|
-
Defaults to False.
|
45
42
|
|
46
43
|
"""
|
47
44
|
|
pyegeria/project_manager_omvs.py
CHANGED
@@ -11,7 +11,6 @@ import time
|
|
11
11
|
|
12
12
|
# import json
|
13
13
|
from pyegeria._client import Client
|
14
|
-
from pyegeria._globals import enable_ssl_check
|
15
14
|
from pyegeria._validators import (
|
16
15
|
validate_guid,
|
17
16
|
validate_search_string,
|
@@ -35,11 +34,7 @@ class ProjectManager(Client):
|
|
35
34
|
when the user doesn't pass the user_id on a method call.
|
36
35
|
user_pwd: str
|
37
36
|
The password associated with the user_id. Defaults to None
|
38
|
-
|
39
|
-
Flag to indicate if SSL Certificates should be verified in the HTTP requests.
|
40
|
-
Defaults to False.
|
41
|
-
|
42
|
-
"""
|
37
|
+
"""
|
43
38
|
|
44
39
|
def __init__(
|
45
40
|
self,
|
@@ -48,7 +43,6 @@ class ProjectManager(Client):
|
|
48
43
|
token: str = None,
|
49
44
|
user_id: str = None,
|
50
45
|
user_pwd: str = None,
|
51
|
-
verify_flag: bool = enable_ssl_check,
|
52
46
|
sync_mode: bool = True
|
53
47
|
):
|
54
48
|
self.command_base: str = f"/api/open-metadata/project-manager/metadata-elements"
|
@@ -153,7 +147,7 @@ class ProjectManager(Client):
|
|
153
147
|
loop = asyncio.get_event_loop()
|
154
148
|
resp = loop.run_until_complete(self._async_get_linked_projects(parent_guid, project_status,
|
155
149
|
effective_time, server_name,
|
156
|
-
start_from, page_size))
|
150
|
+
start_from, page_size))
|
157
151
|
return resp
|
158
152
|
|
159
153
|
async def _async_get_classified_projects(self, project_classification: str, effective_time: str = None,
|
@@ -250,7 +244,7 @@ class ProjectManager(Client):
|
|
250
244
|
loop = asyncio.get_event_loop()
|
251
245
|
resp = loop.run_until_complete(self._async_get_classified_projects(project_classification,
|
252
246
|
effective_time, server_name,
|
253
|
-
start_from, page_size))
|
247
|
+
start_from, page_size))
|
254
248
|
return resp
|
255
249
|
|
256
250
|
async def _async_get_project_team(self, project_guid: str, team_role: str = None, effective_time: str = None,
|
@@ -354,7 +348,7 @@ class ProjectManager(Client):
|
|
354
348
|
"""
|
355
349
|
loop = asyncio.get_event_loop()
|
356
350
|
resp = loop.run_until_complete(self._async_get_project_team(project_guid, team_role, effective_time,
|
357
|
-
server_name, start_from, page_size))
|
351
|
+
server_name, start_from, page_size))
|
358
352
|
return resp
|
359
353
|
|
360
354
|
async def _async_find_projects(self, search_string: str, effective_time: str = None, starts_with: bool = False,
|
@@ -429,8 +423,8 @@ class ProjectManager(Client):
|
|
429
423
|
return resp.json().get("elements", "No elements found")
|
430
424
|
|
431
425
|
def find_projects(self, search_string: str, effective_time: str = None, starts_with: bool = False,
|
432
|
-
|
433
|
-
|
426
|
+
ends_with: bool = False, ignore_case: bool = False, server_name: str = None,
|
427
|
+
start_from: int = 0, page_size: int = None) -> list | str:
|
434
428
|
""" Returns the list of projects matching the search string.
|
435
429
|
The search string is located in the request body and is interpreted as a plain string.
|
436
430
|
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
@@ -535,7 +529,7 @@ class ProjectManager(Client):
|
|
535
529
|
return resp.json().get("elements", "No elements found")
|
536
530
|
|
537
531
|
def get_projects_by_name(self, name: str, effective_time: str = None, server_name: str = None,
|
538
|
-
|
532
|
+
start_from: int = 0, page_size: int = None) -> list | str:
|
539
533
|
""" Returns the list of projects with a particular name.
|
540
534
|
|
541
535
|
Parameters
|
@@ -1364,8 +1358,8 @@ class ProjectManager(Client):
|
|
1364
1358
|
return
|
1365
1359
|
|
1366
1360
|
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,
|
1368
|
-
|
1361
|
+
effective_from: str = None, effective_to: str = None,
|
1362
|
+
server_name: str = None) -> None:
|
1369
1363
|
""" Add an actor to a project. The request body is optional. If supplied, it contains the name of the role that
|
1370
1364
|
the actor plays in the project. Async version.
|
1371
1365
|
|
pyegeria/registered_info.py
CHANGED
@@ -6,18 +6,10 @@ Copyright Contributors to the ODPi Egeria project.
|
|
6
6
|
|
7
7
|
This module allows users to query the available (registered) capabilities of Egeria. Detailed information is returned
|
8
8
|
to provide both insight and understanding in how to use these capabilities. For example, when configuring an Egeria
|
9
|
-
integration service, it is
|
10
|
-
companion service is also configured and running.
|
9
|
+
integration service, it is import registered_info.pyant to know what companion service it depends on so that you can
|
10
|
+
make sure the companion service is also configured and running.
|
11
11
|
|
12
12
|
"""
|
13
|
-
import json
|
14
|
-
from rich.console import Console
|
15
|
-
from rich import print, print_json
|
16
|
-
|
17
|
-
import pandas as pd
|
18
|
-
from tabulate import tabulate
|
19
|
-
|
20
|
-
from pyegeria.utils import wrap_text
|
21
13
|
|
22
14
|
from pyegeria._client import Client
|
23
15
|
|
@@ -25,7 +17,7 @@ from pyegeria._client import Client
|
|
25
17
|
class RegisteredInfo(Client):
|
26
18
|
""" Client to discover Egeria services and capabilities
|
27
19
|
|
28
|
-
|
20
|
+
Parameters:
|
29
21
|
----------
|
30
22
|
server_name: str
|
31
23
|
Name of the server to use.
|
@@ -70,28 +62,18 @@ class RegisteredInfo(Client):
|
|
70
62
|
self.admin_command_root = (f"{self.platform_url}/open-metadata/platform-services/users/"
|
71
63
|
f"{self.user_id}/server-platform/registered-services")
|
72
64
|
|
73
|
-
def list_registered_svcs(self, kind: str = None
|
74
|
-
wrap_len: int = 30) -> list | str:
|
65
|
+
def list_registered_svcs(self, kind: str = None) -> list | str:
|
75
66
|
""" Get the registered services for the OMAG Server Platform
|
76
67
|
|
77
68
|
Parameters
|
78
69
|
----------
|
79
70
|
kind: str, optional
|
80
71
|
The kind of service to return information for. If None, then provide back a list of service kinds.
|
81
|
-
|
82
|
-
If fmt is 'json', then return the result as a JSON string. If fmt is 'table', then
|
83
|
-
return the result as a nicely formatted table string.
|
84
|
-
skinny: bool, optional, default = True
|
85
|
-
If a table is being created and `skinny` is true, then return a subset of the information,
|
86
|
-
if false return all columns.
|
87
|
-
wrap_len: int, optional, default = 30
|
88
|
-
If a table is being created, the width of the column to wrap text to.
|
72
|
+
|
89
73
|
Returns
|
90
74
|
-------
|
91
75
|
dict | str
|
92
|
-
|
93
|
-
platform. If fmt is 'table' then return the result as a nicely formatted printable table string.
|
94
|
-
|
76
|
+
Returns JSON dict of the requested information or a help string if input is 'help'.
|
95
77
|
Raises
|
96
78
|
------
|
97
79
|
InvalidParameterException
|
@@ -112,7 +94,7 @@ class RegisteredInfo(Client):
|
|
112
94
|
governance-services.....lists all registered governance services
|
113
95
|
integration-services....lists all registered integration services
|
114
96
|
view-services...........lists all registered view services
|
115
|
-
|
97
|
+
|
116
98
|
Pass in a parameter from the left-hand column into the function to
|
117
99
|
get more details on the specified service category.
|
118
100
|
""")
|
@@ -122,34 +104,18 @@ class RegisteredInfo(Client):
|
|
122
104
|
url = f"{self.admin_command_root}/{kind}"
|
123
105
|
response = self.make_request("GET", url)
|
124
106
|
|
125
|
-
|
126
|
-
return response.json().get("services", "No services found")
|
127
|
-
elif fmt == 'table':
|
128
|
-
df = pd.DataFrame(response.json().get("services", []))
|
129
|
-
if skinny:
|
130
|
-
df = df.drop(columns=['serviceId', 'serviceDevelopmentStatus'])
|
131
|
-
return tabulate(wrap_text(df, wrap_len=wrap_len), headers='keys', tablefmt='psql')
|
107
|
+
return response.json().get("services", "No services found")
|
132
108
|
|
133
|
-
def list_severity_definitions(self
|
109
|
+
def list_severity_definitions(self) -> list | str:
|
134
110
|
""" Get the registered severities for the OMAG Server
|
135
111
|
|
136
112
|
Parameters
|
137
113
|
----------
|
138
|
-
fmt: str, optional, default = 'json'
|
139
|
-
If fmt is 'json', then return the result as a JSON string. If fmt is 'table', then
|
140
|
-
return the result as a nicely formatted table string.
|
141
|
-
skinny: bool, optional, default = True
|
142
|
-
If a table is being created and `skinny` is true, then return a subset of the information,
|
143
|
-
if false return all columns.
|
144
|
-
wrap_len: int, optional, default = 30
|
145
|
-
If a table is being created, the width of the column to wrap text to.
|
146
114
|
|
147
115
|
Returns
|
148
116
|
-------
|
149
117
|
dict | str
|
150
|
-
|
151
|
-
platform. If fmt is 'table' then return the result as a nicely formatted printable table string.
|
152
|
-
|
118
|
+
Return a dictionary containing the registered services for the specified platform.
|
153
119
|
Raises
|
154
120
|
------
|
155
121
|
InvalidParameterException
|
@@ -164,13 +130,7 @@ class RegisteredInfo(Client):
|
|
164
130
|
f"/users/{self.user_id}/audit-log/severity-definitions"
|
165
131
|
)
|
166
132
|
response = self.make_request("GET", url)
|
167
|
-
|
168
|
-
return response.json().get("severities", "No severities found")
|
169
|
-
elif fmt == 'table':
|
170
|
-
df = pd.DataFrame(response.json().get("severities", []))
|
171
|
-
if skinny:
|
172
|
-
df = df.drop(columns=['ordinal'])
|
173
|
-
return tabulate(wrap_text(df, wrap_len=wrap_len), headers='keys', tablefmt='psql')
|
133
|
+
return response.json().get("severities", "No severities found")
|
174
134
|
|
175
135
|
def list_asset_types(self, server: str = None) -> list | str:
|
176
136
|
""" Get the registered severities for the OMAG Server
|
@@ -195,7 +155,7 @@ class RegisteredInfo(Client):
|
|
195
155
|
|
196
156
|
"""
|
197
157
|
server = self.server_name if server is None else server
|
198
|
-
url = f"{self.platform_url}/servers/{
|
158
|
+
url = f"{self.platform_url}/servers/{server}/api/open-metadata/asset-catalog/assets/types"
|
199
159
|
|
200
160
|
response = self.make_request("GET", url)
|
201
161
|
return response.json().get('types', 'no types found')
|
pyegeria/server_operations.py
CHANGED
@@ -28,10 +28,6 @@ class ServerOps(Platform):
|
|
28
28
|
when the user doesn't pass the user_id on a method call.
|
29
29
|
user_pwd: str
|
30
30
|
The password associated with the user_id. Defaults to None
|
31
|
-
verify_flag: bool
|
32
|
-
Flag to indicate if SSL Certificates should be verified in the HTTP requests.
|
33
|
-
Defaults to False.
|
34
|
-
|
35
31
|
|
36
32
|
"""
|
37
33
|
def __init__(
|
@@ -370,7 +366,7 @@ class ServerOps(Platform):
|
|
370
366
|
|
371
367
|
def get_integration_connector_status(self, server: str = None) -> None:
|
372
368
|
""" Get the current status of the integration connector. Async version."""
|
373
|
-
|
369
|
+
self.get_integration_daemon_status(server)
|
374
370
|
# todo - finish this? (and do async)
|
375
371
|
pass
|
376
372
|
|
pyegeria/valid_metadata_omvs.py
CHANGED
@@ -6,20 +6,10 @@ Copyright Contributors to the ODPi Egeria project.
|
|
6
6
|
|
7
7
|
"""
|
8
8
|
import asyncio
|
9
|
-
import json
|
10
|
-
import time
|
11
9
|
|
12
10
|
# import json
|
13
11
|
from pyegeria._client import Client
|
14
|
-
from pyegeria.
|
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
|
12
|
+
from pyegeria._globals import enable_ssl_check, max_paging_size
|
23
13
|
|
24
14
|
|
25
15
|
class ValidMetadataManager(Client):
|
@@ -37,9 +27,6 @@ class ValidMetadataManager(Client):
|
|
37
27
|
when the user doesn't pass the user_id on a method call.
|
38
28
|
user_pwd: str
|
39
29
|
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
30
|
|
44
31
|
"""
|
45
32
|
|
@@ -53,6 +40,7 @@ class ValidMetadataManager(Client):
|
|
53
40
|
verify_flag: bool = enable_ssl_check,
|
54
41
|
):
|
55
42
|
self.command_base: str = f"/api/open-metadata/valid-metadata"
|
43
|
+
self.page_size = max_paging_size
|
56
44
|
Client.__init__(self, server_name, platform_url, user_id=user_id, token=token)
|
57
45
|
|
58
46
|
async def _async_get_valid_metadata_values(self, property_name: str, type_name: str = None,
|
@@ -134,7 +122,7 @@ class ValidMetadataManager(Client):
|
|
134
122
|
"""
|
135
123
|
loop = asyncio.get_event_loop()
|
136
124
|
resp = loop.run_until_complete(self._async_get_valid_metadata_values(property_name, type_name,
|
137
|
-
server_name))
|
125
|
+
server_name))
|
138
126
|
return resp
|
139
127
|
|
140
128
|
async def _async_get_valid_metadata_value(self, property_name: str, type_name: str, preferred_value: str,
|
@@ -155,16 +143,16 @@ class ValidMetadataManager(Client):
|
|
155
143
|
|
156
144
|
Parameters
|
157
145
|
----------
|
158
|
-
|
159
|
-
The
|
160
|
-
|
146
|
+
property_name: str
|
147
|
+
The property name of the valid metadata value to retrieve
|
148
|
+
type_name: str
|
149
|
+
Type of the metadata value to retrieve
|
150
|
+
preferred_value: str
|
151
|
+
The preferred value of the valid metadata value to retrieve
|
152
|
+
server_name : str, opt
|
161
153
|
The name of the server to configure.
|
162
154
|
If not provided, the server name associated with the instance is used.
|
163
|
-
|
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.
|
155
|
+
|
168
156
|
Returns
|
169
157
|
-------
|
170
158
|
List | str
|
@@ -0,0 +1,292 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
This sample creates the collection structure show in https://egeria-project.org/types/0/0021-Collections
|
6
|
+
|
7
|
+
"""
|
8
|
+
|
9
|
+
import time
|
10
|
+
|
11
|
+
from rich import print
|
12
|
+
from rich.console import Console
|
13
|
+
|
14
|
+
from pyegeria import CollectionManager, InvalidParameterException, PropertyServerException, UserNotAuthorizedException
|
15
|
+
|
16
|
+
view_server = 'view-server'
|
17
|
+
platform_url = 'https://localhost:9443'
|
18
|
+
user = 'erinoverview'
|
19
|
+
console = Console()
|
20
|
+
|
21
|
+
try:
|
22
|
+
c_client = CollectionManager(view_server, platform_url,
|
23
|
+
user_id=user)
|
24
|
+
|
25
|
+
token = c_client.create_egeria_bearer_token(user, "secret")
|
26
|
+
start_time = time.perf_counter()
|
27
|
+
|
28
|
+
# Create a Data Products Root collection
|
29
|
+
anchor_guid = None
|
30
|
+
parent_guid = None
|
31
|
+
parent_relationship_type_name = None
|
32
|
+
parent_at_end1 = False
|
33
|
+
display_name = "Digital Products Root"
|
34
|
+
description = "This is the root catalog for digital products"
|
35
|
+
collection_type = "Digital Products Root"
|
36
|
+
is_own_anchor = True
|
37
|
+
|
38
|
+
response = c_client.create_root_collection(anchor_guid, parent_guid,
|
39
|
+
parent_relationship_type_name, parent_at_end1,
|
40
|
+
display_name, description, collection_type,
|
41
|
+
is_own_anchor)
|
42
|
+
# Create first folder for Agriculture Insights
|
43
|
+
parent_guid = "97bbfe07-6696-4550-bf8b-6b577d25bef0"
|
44
|
+
parent_relationship_type_name = "CollectionMembership"
|
45
|
+
display_name = "Agriculture Insights Collection"
|
46
|
+
description = "A folder for agricultural insights data product collections"
|
47
|
+
collection_type = "Digital Product Marketplace"
|
48
|
+
|
49
|
+
folder1 = c_client.create_folder_collection(None, parent_guid,
|
50
|
+
parent_relationship_type_name,
|
51
|
+
True, display_name, description,
|
52
|
+
collection_type, True, "DATE_CREATED",
|
53
|
+
None
|
54
|
+
)
|
55
|
+
print(f"\n\n created a folder with guid {folder1}")
|
56
|
+
# create second folder for Earth Observations
|
57
|
+
display_name = "Earth Observation Data Collection"
|
58
|
+
description = "A folder for Earth Observation data product collections"
|
59
|
+
|
60
|
+
folder2 = c_client.create_folder_collection(None, parent_guid,
|
61
|
+
parent_relationship_type_name,
|
62
|
+
True, display_name, description,
|
63
|
+
collection_type, True, "DATE_CREATED",
|
64
|
+
None
|
65
|
+
)
|
66
|
+
print(f"\n\n created a folder with guid {folder2}")
|
67
|
+
|
68
|
+
# create a digital product, child of folder 1, for Land Use products
|
69
|
+
parent_guid = folder1
|
70
|
+
parent_relationship_type_name = "CollectionMembership"
|
71
|
+
display_name = "Land Use Classification"
|
72
|
+
description = "Land use classification assets"
|
73
|
+
collection_type = "Digital Product"
|
74
|
+
classification_name = "Digital Product"
|
75
|
+
body_3 = {
|
76
|
+
"class": "NewDigitalProductRequestBody",
|
77
|
+
"isOwnAnchor": True,
|
78
|
+
"parentGUID": parent_guid,
|
79
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
80
|
+
"parentAtEnd1": True,
|
81
|
+
"collectionProperties": {
|
82
|
+
"class": "CollectionProperties",
|
83
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
84
|
+
"name": display_name,
|
85
|
+
"description": description,
|
86
|
+
"collectionType": collection_type,
|
87
|
+
"collectionOrdering": "DATE_CREATED",
|
88
|
+
},
|
89
|
+
"digitalProductProperties": {
|
90
|
+
"class": "DigitalProductProperties",
|
91
|
+
"productStatus": "ACTIVE",
|
92
|
+
"productName": "Land Use Classifications",
|
93
|
+
"productType": "Geospatial Data Assets",
|
94
|
+
"description": "Land use classification assets",
|
95
|
+
"introductionDate": "2023-12-01",
|
96
|
+
"maturity": "Nacent",
|
97
|
+
"serviceLife": "3 years",
|
98
|
+
"currentVersion": "V.5",
|
99
|
+
"nextVersionDate": "2024-12-01",
|
100
|
+
"withdrawDate": "2030-01-01",
|
101
|
+
"additionalProperties": {
|
102
|
+
"thought_id": "a guid",
|
103
|
+
"license": "cc-by-sa",
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
folder3 = c_client.create_digital_product(body_3)
|
108
|
+
print(f"\n\n created a collection with guid {folder3}")
|
109
|
+
|
110
|
+
# create a fourth collection, a digital product, child of folder 2, for Landsat 8
|
111
|
+
parent_guid = folder2
|
112
|
+
display_name = "Landsat 8"
|
113
|
+
description = "Landsat 8 data products"
|
114
|
+
|
115
|
+
body_4 = {
|
116
|
+
"class": "NewDigitalProductRequestBody",
|
117
|
+
"isOwnAnchor": True,
|
118
|
+
"parentGUID": parent_guid,
|
119
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
120
|
+
"parentAtEnd1": True,
|
121
|
+
"collectionProperties": {
|
122
|
+
"class": "CollectionProperties",
|
123
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
124
|
+
"name": display_name,
|
125
|
+
"description": description,
|
126
|
+
"collectionType": collection_type,
|
127
|
+
"collectionOrdering": "DATE_CREATED",
|
128
|
+
},
|
129
|
+
"digitalProductProperties": {
|
130
|
+
"class": "DigitalProductProperties",
|
131
|
+
"productStatus": "ACTIVE",
|
132
|
+
"productName": "Landsat 8 Imagery",
|
133
|
+
"productType": "Geospatial Data Assets",
|
134
|
+
"description": description,
|
135
|
+
"introductionDate": "2024-01-01",
|
136
|
+
"maturity": "Mature",
|
137
|
+
"serviceLife": "3 years",
|
138
|
+
"currentVersion": "V1.5",
|
139
|
+
"nextVersion": "2024-06-01",
|
140
|
+
"withdrawDate": "2030-01-01",
|
141
|
+
"additionalProperties": {
|
142
|
+
"thought_id": "a guid",
|
143
|
+
"license": "cc-by-sa",
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
folder4 = c_client.create_digital_product(body_4)
|
148
|
+
print(f"\n\n created a collection with guid {folder4}")
|
149
|
+
|
150
|
+
# Now create a 5th collection for sentinel 2 data
|
151
|
+
parent_guid = folder2
|
152
|
+
display_name = "Sentinel 2"
|
153
|
+
description = "Sentinel 2 products"
|
154
|
+
parent_relationship_type_name = "CollectionMembership"
|
155
|
+
collection_type = "Digital Product Marketplace"
|
156
|
+
|
157
|
+
folder5 = c_client.create_folder_collection(None, parent_guid,
|
158
|
+
parent_relationship_type_name,
|
159
|
+
True, display_name, description,
|
160
|
+
collection_type, True, "DATE_CREATED",
|
161
|
+
None
|
162
|
+
)
|
163
|
+
# Create a DigitalProduct for Level-1B
|
164
|
+
parent_guid = folder5
|
165
|
+
display_name = "Sentinel 2 - Level 1B"
|
166
|
+
description = "Level 1B of Sentinel 2"
|
167
|
+
|
168
|
+
body_6 = {
|
169
|
+
"class": "NewDigitalProductRequestBody",
|
170
|
+
"anchor_guid": parent_guid,
|
171
|
+
"isOwnAnchor": False,
|
172
|
+
"parentGUID": parent_guid,
|
173
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
174
|
+
"parentAtEnd1": True,
|
175
|
+
"collectionProperties": {
|
176
|
+
"class": "CollectionProperties",
|
177
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
178
|
+
"name": display_name,
|
179
|
+
"description": description,
|
180
|
+
"collectionType": collection_type,
|
181
|
+
"collectionOrdering": "DATE_CREATED",
|
182
|
+
},
|
183
|
+
"digitalProductProperties": {
|
184
|
+
"class": "DigitalProductProperties",
|
185
|
+
"productStatus": "ACTIVE",
|
186
|
+
"productName": "Sentinel 2 - Level 1B",
|
187
|
+
"productType": "Geospatial Data Assets",
|
188
|
+
"description": description,
|
189
|
+
"introductionDate": "2024-01-01",
|
190
|
+
"maturity": "Mature",
|
191
|
+
"serviceLife": "3 years",
|
192
|
+
"currentVersion": "V1.5",
|
193
|
+
"nextVersion": "2024-06-01",
|
194
|
+
"withdrawDate": "2030-01-01",
|
195
|
+
"additionalProperties": {
|
196
|
+
"thought_id": "a guid",
|
197
|
+
"license": "cc-by-sa",
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
folder6 = c_client.create_digital_product(body_6)
|
202
|
+
print(f"\n\n created a collection with guid {folder6}")
|
203
|
+
|
204
|
+
# now lets create a digital product for - Level - 1c
|
205
|
+
parent_guid = folder5
|
206
|
+
display_name = "Sentinel 2 - Level 1C"
|
207
|
+
description = "Level 1C of Sentinel 2"
|
208
|
+
body_7 = {
|
209
|
+
"class": "NewDigitalProductRequestBody",
|
210
|
+
"anchor_guid": parent_guid,
|
211
|
+
"isOwnAnchor": False,
|
212
|
+
"parentGUID": parent_guid,
|
213
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
214
|
+
"parentAtEnd1": True,
|
215
|
+
"collectionProperties": {
|
216
|
+
"class": "CollectionProperties",
|
217
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
218
|
+
"name": display_name,
|
219
|
+
"description": description,
|
220
|
+
"collectionType": collection_type,
|
221
|
+
"collectionOrdering": "DATE_CREATED",
|
222
|
+
},
|
223
|
+
"digitalProductProperties": {
|
224
|
+
"class": "DigitalProductProperties",
|
225
|
+
"productStatus": "ACTIVE",
|
226
|
+
"productName": "Sentinel 2 - Level 1B",
|
227
|
+
"productType": "Geospatial Data Assets",
|
228
|
+
"description": description,
|
229
|
+
"introductionDate": "2024-01-01",
|
230
|
+
"maturity": "Mature",
|
231
|
+
"serviceLife": "3 years",
|
232
|
+
"currentVersion": "V1.5",
|
233
|
+
"nextVersion": "2024-06-01",
|
234
|
+
"withdrawDate": "2030-01-01",
|
235
|
+
"additionalProperties": {
|
236
|
+
"thought_id": "a guid",
|
237
|
+
"license": "cc-by-sa",
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
folder7 = c_client.create_digital_product(body_7)
|
242
|
+
print(f"\n\n created a collection with guid {folder7}")
|
243
|
+
|
244
|
+
# now let's create a digital product for - Level - 2A
|
245
|
+
parent_guid = folder5
|
246
|
+
display_name = "Sentinel 2 - Level 2A"
|
247
|
+
description = "Level 2A of Sentinel 2"
|
248
|
+
body_8 = {
|
249
|
+
"class": "NewDigitalProductRequestBody",
|
250
|
+
"anchor_guid": parent_guid,
|
251
|
+
"isOwnAnchor": False,
|
252
|
+
"parentGUID": parent_guid,
|
253
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
254
|
+
"parentAtEnd1": True,
|
255
|
+
"collectionProperties": {
|
256
|
+
"class": "CollectionProperties",
|
257
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
258
|
+
"name": display_name,
|
259
|
+
"description": description,
|
260
|
+
"collectionType": collection_type,
|
261
|
+
"collectionOrdering": "DATE_CREATED",
|
262
|
+
},
|
263
|
+
"digitalProductProperties": {
|
264
|
+
"class": "DigitalProductProperties",
|
265
|
+
"productStatus": "ACTIVE",
|
266
|
+
"productName": "Sentinel 2 - Level 1B",
|
267
|
+
"productType": "Geospatial Data Assets",
|
268
|
+
"description": description,
|
269
|
+
"introductionDate": "2024-01-01",
|
270
|
+
"maturity": "Mature",
|
271
|
+
"serviceLife": "3 years",
|
272
|
+
"currentVersion": "V1.5",
|
273
|
+
"nextVersion": "2024-06-01",
|
274
|
+
"withdrawDate": "2030-01-01",
|
275
|
+
"additionalProperties": {
|
276
|
+
"thought_id": "a guid",
|
277
|
+
"license": "cc-by-sa",
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}
|
281
|
+
folder8 = c_client.create_digital_product(body_8)
|
282
|
+
print(f"\n\n created a collection with guid {folder8}")
|
283
|
+
|
284
|
+
except (
|
285
|
+
InvalidParameterException,
|
286
|
+
PropertyServerException,
|
287
|
+
UserNotAuthorizedException
|
288
|
+
) as e:
|
289
|
+
console.print_exception(show_locals=True)
|
290
|
+
|
291
|
+
finally:
|
292
|
+
c_client.close_session()
|