pyegeria 5.4.4.2__py3-none-any.whl → 5.4.4.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyegeria/_client_new.py CHANGED
@@ -25,18 +25,18 @@ from pydantic import TypeAdapter
25
25
  from pyegeria._exceptions_new import (
26
26
  PyegeriaAPIException, PyegeriaConnectionException, PyegeriaInvalidParameterException,
27
27
  PyegeriaUnknownException, PyegeriaClientException
28
- )
28
+ )
29
29
  from pyegeria._globals import enable_ssl_check, max_paging_size, NO_ELEMENTS_FOUND
30
30
  from pyegeria._validators import (
31
31
  validate_name,
32
32
  validate_server_name,
33
33
  validate_url,
34
34
  validate_user_id,
35
- )
35
+ )
36
36
  from pyegeria.models import SearchStringRequestBody, FilterRequestBody, GetRequestBody, NewElementRequestBody, \
37
37
  TemplateRequestBody, UpdateStatusRequestBody, UpdateElementRequestBody, NewRelationshipRequestBody, \
38
38
  DeleteRequestBody, UpdateRelationshipRequestBody, ResultsRequestBody, NewClassificationRequestBody
39
- from pyegeria.utils import body_slimmer
39
+ from pyegeria.utils import body_slimmer, dynamic_catch
40
40
 
41
41
  ...
42
42
 
@@ -91,7 +91,7 @@ class Client2:
91
91
  token_src: str = None,
92
92
  api_key: str = None,
93
93
  page_size: int = max_paging_size,
94
- ):
94
+ ):
95
95
  self.server_name = validate_server_name(server_name)
96
96
  self.platform_url = validate_url(platform_url)
97
97
  self.user_id = user_id
@@ -119,10 +119,10 @@ class Client2:
119
119
 
120
120
  self.headers = {
121
121
  "Content-Type": "application/json",
122
- }
122
+ }
123
123
  self.text_headers = {
124
124
  "Content-Type": "text/plain",
125
- }
125
+ }
126
126
  if self.api_key is not None:
127
127
  self.headers["X-Api-Key"] = self.api_key
128
128
  self.text_headers["X-Api-Key"] = self.api_key
@@ -138,7 +138,7 @@ class Client2:
138
138
  if validate_server_name(server_name):
139
139
  self.server_name = server_name
140
140
  self.session = AsyncClient(verify=enable_ssl_check)
141
-
141
+ self.command_root: str = f"{self.platform_url}/servers/{self.server_name}/api/open-metadata/generic"
142
142
  self._search_string_request_adapter = TypeAdapter(SearchStringRequestBody)
143
143
  self._filter_request_adapter = TypeAdapter(FilterRequestBody)
144
144
  self._get_request_adapter = TypeAdapter(GetRequestBody)
@@ -180,7 +180,7 @@ class Client2:
180
180
 
181
181
  async def _async_create_egeria_bearer_token(
182
182
  self, user_id: str = None, password: str = None
183
- ) -> str:
183
+ ) -> str:
184
184
  """Create and set an Egeria Bearer Token for the user. Async version
185
185
  Parameters
186
186
  ----------
@@ -237,7 +237,7 @@ class Client2:
237
237
 
238
238
  def create_egeria_bearer_token(
239
239
  self, user_id: str = None, password: str = None
240
- ) -> str:
240
+ ) -> str:
241
241
  """Create and set an Egeria Bearer Token for the user
242
242
  Parameters
243
243
  ----------
@@ -269,7 +269,7 @@ class Client2:
269
269
  loop = asyncio.get_event_loop()
270
270
  response = loop.run_until_complete(
271
271
  self._async_create_egeria_bearer_token(user_id, password)
272
- )
272
+ )
273
273
  return response
274
274
 
275
275
  async def _async_refresh_egeria_bearer_token(self) -> str:
@@ -296,7 +296,7 @@ class Client2:
296
296
  ):
297
297
  token = await self._async_create_egeria_bearer_token(
298
298
  self.user_id, self.user_pwd
299
- )
299
+ )
300
300
  return token
301
301
  else:
302
302
  additional_info = {"reason": "Invalid token source"}
@@ -383,7 +383,7 @@ class Client2:
383
383
  payload: str | dict = None,
384
384
  time_out: int = 30,
385
385
  is_json: bool = True
386
- ) -> Response | str:
386
+ ) -> Response | str:
387
387
  """Make a request to the Egeria API."""
388
388
  try:
389
389
  loop = asyncio.get_running_loop()
@@ -404,7 +404,7 @@ class Client2:
404
404
  payload: str | dict = None,
405
405
  time_out: int = 30,
406
406
  is_json: bool = True
407
- ) -> Response | str:
407
+ ) -> Response | str:
408
408
  """Make a request to the Egeria API - Async Version
409
409
  Function to make an API call via the self.session Library. Raise an exception if the HTTP response code
410
410
  is not 200/201. IF there is a REST communication exception, raise InvalidParameterException.
@@ -429,17 +429,17 @@ class Client2:
429
429
  if request_type == "GET":
430
430
  response = await self.session.get(
431
431
  endpoint, params=payload, headers=self.headers, timeout=time_out
432
- )
432
+ )
433
433
 
434
434
  elif request_type == "POST":
435
435
  if payload is None:
436
436
  response = await self.session.post(
437
437
  endpoint, headers=self.headers, timeout=time_out
438
- )
438
+ )
439
439
  elif type(payload) is dict:
440
440
  response = await self.session.post(
441
441
  endpoint, json=payload, headers=self.headers, timeout=time_out
442
- )
442
+ )
443
443
  elif type(payload) is str:
444
444
  # if is_json:
445
445
  # response = await self.session.post(
@@ -451,7 +451,7 @@ class Client2:
451
451
  headers=self.headers,
452
452
  content=payload,
453
453
  timeout=time_out,
454
- )
454
+ )
455
455
  else:
456
456
  # response = await self.session.post(
457
457
  # endpoint, headers=self.headers, json=payload, timeout=time_out)
@@ -462,12 +462,12 @@ class Client2:
462
462
  if True:
463
463
  response = await self.session.post(
464
464
  endpoint, headers=self.headers, data=payload, timeout=time_out
465
- )
465
+ )
466
466
  elif request_type == "DELETE":
467
467
  if True:
468
468
  response = await self.session.delete(
469
469
  endpoint, headers=self.headers, timeout=time_out
470
- )
470
+ )
471
471
  response.raise_for_status()
472
472
 
473
473
  status_code = response.status_code
@@ -520,7 +520,7 @@ class Client2:
520
520
  context['caught_exception'] = e
521
521
  raise PyegeriaInvalidParameterException(
522
522
  response, context, e=e
523
- )
523
+ )
524
524
 
525
525
  def build_global_guid_lists(self) -> None:
526
526
  global template_guids, integration_guids
@@ -579,7 +579,7 @@ class Client2:
579
579
  property_name: str = "qualifiedName",
580
580
  qualified_name: str = None,
581
581
  tech_type: str = None,
582
- ) -> str:
582
+ ) -> str:
583
583
  """Helper function to return a server_guid - one of server_guid, qualified_name or display_name should
584
584
  contain information. If all are None, an exception will be thrown. If all contain
585
585
  values, server_guid will be used first, followed by qualified_name. If the tech_type is supplied and the
@@ -602,7 +602,7 @@ class Client2:
602
602
  "forLineage": False,
603
603
  "forDuplicateProcessing": False,
604
604
  "effectiveTime": None,
605
- }
605
+ }
606
606
  url = (
607
607
  f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/classification-manager/"
608
608
  f"elements/guid-by-unique-name?forLineage=false&forDuplicateProcessing=false"
@@ -626,7 +626,7 @@ class Client2:
626
626
  "forLineage": False,
627
627
  "forDuplicateProcessing": False,
628
628
  "effectiveTime": None,
629
- }
629
+ }
630
630
  url = (
631
631
  f"{self.platform_url}/servers/{view_server}/api/open-metadata/classification-manager/"
632
632
  f"elements/guid-by-unique-name?forLineage=false&forDuplicateProcessing=false"
@@ -642,7 +642,7 @@ class Client2:
642
642
  "forLineage": False,
643
643
  "forDuplicateProcessing": False,
644
644
  "effectiveTime": None,
645
- }
645
+ }
646
646
  url = (
647
647
  f"{self.platform_url}/servers/{view_server}/api/open-metadata/classification-manager/"
648
648
  f"elements/guid-by-unique-name?forLineage=false&forDuplicateProcessing=false"
@@ -655,7 +655,7 @@ class Client2:
655
655
  "reason": "Neither server_guid nor server_name were provided - please provide.",
656
656
  "parameters": (f"GUID={guid}, display_name={display_name}, property_name={property_name},"
657
657
  f"qualified_name={qualified_name}, tech_type={tech_type}")
658
- }
658
+ }
659
659
  raise PyegeriaInvalidParameterException(None, None, additional_info)
660
660
 
661
661
  def __get_guid__(
@@ -665,7 +665,7 @@ class Client2:
665
665
  property_name: str = "qualifiedName",
666
666
  qualified_name: str = None,
667
667
  tech_type: str = None,
668
- ) -> str:
668
+ ) -> str:
669
669
  """Helper function to return a server_guid - one of server_guid, qualified_name or display_name should
670
670
  contain information. If all are None, an exception will be thrown. If all contain
671
671
  values, server_guid will be used first, followed by qualified_name. If the tech_type is supplied and the
@@ -680,8 +680,8 @@ class Client2:
680
680
  result = loop.run_until_complete(
681
681
  self.__async_get_guid__(
682
682
  guid, display_name, property_name, qualified_name, tech_type
683
- )
684
683
  )
684
+ )
685
685
  return result
686
686
 
687
687
  def __create_qualified_name__(self, type: str, display_name: str, local_qualifier: str = None,
@@ -728,7 +728,7 @@ class Client2:
728
728
  body = {
729
729
  "class": "EffectiveTimeQueryRequestBody",
730
730
  "effectiveTime": None,
731
- }
731
+ }
732
732
 
733
733
  url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/classification-manager/elements/"
734
734
  f"{element_guid}?forLineage=false&forDuplicateProcessing=false")
@@ -759,7 +759,7 @@ class Client2:
759
759
  return validated_body
760
760
 
761
761
  def validate_new_element_from_template_request(self, body: dict | TemplateRequestBody
762
- ) -> NewElementRequestBody | None:
762
+ ) -> NewElementRequestBody | None:
763
763
  if isinstance(body, TemplateRequestBody):
764
764
  validated_body = body
765
765
 
@@ -791,7 +791,7 @@ class Client2:
791
791
  return validated_body
792
792
 
793
793
  def validate_new_classification_request(self, body: dict | NewClassificationRequestBody,
794
- prop: str = None) -> NewClassificationRequestBody | None:
794
+ prop: str = None) -> NewClassificationRequestBody | None:
795
795
  if isinstance(body, NewClassificationRequestBody):
796
796
  if (prop and body.properties.class_ == prop) or (prop is None):
797
797
  validated_body = body
@@ -816,12 +816,12 @@ class Client2:
816
816
  validated_body = body
817
817
  elif isinstance(body, dict):
818
818
  validated_body = self._delete_request_adapter.validate_python(body)
819
- else: # handle case where body not provided
820
- body= {
819
+ else: # handle case where body not provided
820
+ body = {
821
821
  "class": "DeleteRequestBody",
822
822
  "cascadeDelete": cascade_delete
823
- }
824
- validated_body= DeleteRequestBody.model_validate(body)
823
+ }
824
+ validated_body = DeleteRequestBody.model_validate(body)
825
825
  return validated_body
826
826
 
827
827
  def validate_update_element_request(self, body: dict | UpdateElementRequestBody,
@@ -855,7 +855,7 @@ class Client2:
855
855
  body = {
856
856
  "class": "UpdateStatusRequestBody",
857
857
  "newStatus": status
858
- }
858
+ }
859
859
  validated_body = UpdateStatusRequestBody.model_validate(body)
860
860
  else:
861
861
  raise PyegeriaInvalidParameterException(additional_info={"reason": "invalid parameters"})
@@ -905,7 +905,7 @@ class Client2:
905
905
  "page_size": page_size,
906
906
  "include_only_classified_elements": classification_names,
907
907
  "metadata_element_subtype_names": metadata_element_types,
908
- }
908
+ }
909
909
  validated_body = SearchStringRequestBody.model_validate(body)
910
910
 
911
911
  # classification_names = validated_body.include_only_classified_elements
@@ -944,7 +944,7 @@ class Client2:
944
944
  "start_from": start_from,
945
945
  "page_size": page_size,
946
946
  "include_only_classified_elements": classification_names,
947
- }
947
+ }
948
948
  validated_body = FilterRequestBody.model_validate(body)
949
949
 
950
950
  # classification_names = validated_body.include_only_classified_elements
@@ -976,7 +976,7 @@ class Client2:
976
976
  body = {
977
977
  "class": "GetRequestBody",
978
978
  "metadataElementTypeName": _type
979
- }
979
+ }
980
980
  validated_body = GetRequestBody.model_validate(body)
981
981
 
982
982
  json_body = validated_body.model_dump_json(indent=2, exclude_none=True)
@@ -1005,7 +1005,7 @@ class Client2:
1005
1005
  "class": "ResultsRequestBody",
1006
1006
  "start_from": start_from,
1007
1007
  "page_size": page_size,
1008
- }
1008
+ }
1009
1009
  validated_body = ResultsRequestBody.model_validate(body)
1010
1010
 
1011
1011
  json_body = validated_body.model_dump_json(indent=2, exclude_none=True)
@@ -1069,7 +1069,7 @@ class Client2:
1069
1069
  await self._async_make_request("POST", url)
1070
1070
 
1071
1071
  async def _async_new_classification_request(self, url: str, prop: str,
1072
- body: dict | NewRelationshipRequestBody = None) -> None:
1072
+ body: dict | NewRelationshipRequestBody = None) -> None:
1073
1073
  validated_body = self.validate_new_classification_request(body, prop)
1074
1074
  if validated_body:
1075
1075
  json_body = validated_body.model_dump_json(indent=2, exclude_none=True)
@@ -1088,9 +1088,8 @@ class Client2:
1088
1088
  else:
1089
1089
  await self._async_make_request("POST", url)
1090
1090
 
1091
-
1092
1091
  async def _async_update_relationship_request(self, url: str, prop: str,
1093
- body: dict | UpdateRelationshipRequestBody = None) -> None:
1092
+ body: dict | UpdateRelationshipRequestBody = None) -> None:
1094
1093
  validated_body = self.validate_update_relationship_request(body, prop)
1095
1094
  if validated_body:
1096
1095
  json_body = validated_body.model_dump_json(indent=2, exclude_none=True)
@@ -1099,6 +1098,432 @@ class Client2:
1099
1098
  else:
1100
1099
  await self._async_make_request("POST", url)
1101
1100
 
1101
+ @dynamic_catch
1102
+ async def _async_update_element_status(self, guid: str, status: str = None,
1103
+ body: dict | UpdateStatusRequestBody = None) -> None:
1104
+ """ Update the status of an element. Async version.
1105
+
1106
+ Parameters
1107
+ ----------
1108
+ guid: str
1109
+ The guid of the element to update.
1110
+ status: str, optional
1111
+ The new lifecycle status for the element. Ignored, if the body is provided.
1112
+ body: dict | UpdateStatusRequestBody, optional
1113
+ A structure representing the details of the element status to update. If supplied, these details
1114
+ supersede the status parameter provided.
1115
+
1116
+ Returns
1117
+ -------
1118
+ Nothing
1119
+
1120
+ Raises
1121
+ ------
1122
+ PyegeriaException
1123
+ ValidationError
1124
+
1125
+ Notes
1126
+ -----
1127
+ JSON Structure looks like:
1128
+ {
1129
+ "class": "UpdateStatusRequestBody",
1130
+ "newStatus": "APPROVED",
1131
+ "externalSourceGUID": "add guid here",
1132
+ "externalSourceName": "add qualified name here",
1133
+ "effectiveTime": "{{$isoTimestamp}}",
1134
+ "forLineage": false,
1135
+ "forDuplicateProcessing": false
1136
+ }
1137
+ """
1138
+
1139
+ url = f"{self.command_root}/metadata-elements/{guid}/update-status"
1140
+ await self._async_update_status_request(url, status, body)
1141
+
1142
+ @dynamic_catch
1143
+ def update_element_status(self, guid: str, status: str = None,
1144
+ body: dict | UpdateStatusRequestBody = None) -> None:
1145
+ """ Update the status of an element. Async version.
1146
+
1147
+ Parameters
1148
+ ----------
1149
+ guid: str
1150
+ The guid of the element to update.
1151
+ status: str, optional
1152
+ The new lifecycle status for the element. Ignored, if the body is provided.
1153
+ body: dict | UpdateStatusRequestBody, optional
1154
+ A structure representing the details of the element status to update. If supplied, these details
1155
+ supersede the status parameter provided.
1156
+
1157
+ Returns
1158
+ -------
1159
+ Nothing
1160
+
1161
+ Raises
1162
+ ------
1163
+ PyegeriaException
1164
+ ValidationError
1165
+
1166
+ Notes
1167
+ -----
1168
+ JSON Structure looks like:
1169
+ {
1170
+ "class": "UpdateStatusRequestBody",
1171
+ "newStatus": "APPROVED",
1172
+ "externalSourceGUID": "add guid here",
1173
+ "externalSourceName": "add qualified name here",
1174
+ "effectiveTime": "{{$isoTimestamp}}",
1175
+ "forLineage": false,
1176
+ "forDuplicateProcessing": false
1177
+ }
1178
+ """
1179
+ loop = asyncio.get_event_loop()
1180
+ loop.run_until_complete(self._async_update_element_status(guid, status, body))
1181
+
1182
+ @dynamic_catch
1183
+ async def _async_update_element_effectivity(self, guid: str, effectivity_time: str = None, body: dict = None) -> None:
1184
+ """ Update the status of an element. Async version.
1185
+
1186
+ Parameters
1187
+ ----------
1188
+ guid: str
1189
+ The guid of the element to update.
1190
+ effectivity_time: str, optional
1191
+ The new effectivity time for the element.
1192
+ body: dict, optional
1193
+ A structure representing the details of the effectivity time to update. If supplied, these details
1194
+ supersede the effectivity time parameter provided.
1195
+
1196
+ Returns
1197
+ -------
1198
+ Nothing
1199
+
1200
+ Raises
1201
+ ------
1202
+ PyegeriaException
1203
+ ValidationError
1204
+
1205
+ Notes
1206
+ -----
1207
+ JSON Structure looks like:
1208
+ {
1209
+ "class" : "UpdateEffectivityDatesRequestBody",
1210
+ "externalSourceGUID" : "",
1211
+ "externalSourceName" : "",
1212
+ "effectiveFrom" : "{{$isoTimestamp}}",
1213
+ "effectiveTo": "{{$isoTimestamp}}",
1214
+ "forLineage" : false,
1215
+ "forDuplicateProcessing" : false,
1216
+ "effectiveTime" : "{{$isoTimestamp}}"
1217
+ }
1218
+ """
1102
1219
 
1103
- if __name__ == "__main__":
1104
- print("Main-__client")
1220
+ url = f"{self.command_root}/metadata-elements/{guid}/update-effectivity"
1221
+ if body is None:
1222
+ body = {
1223
+ "class": "UpdateEffectivityRequestBody",
1224
+ "effectiveTime": effectivity_time
1225
+ }
1226
+ logger.info(body)
1227
+ await self._async_make_request("POST", url, body)
1228
+
1229
+
1230
+
1231
+ @dynamic_catch
1232
+ def update_element_effectivity(self, guid: str, status: str = None,
1233
+ body: dict = None) -> None:
1234
+ """ Update the status of an element. Async version.
1235
+
1236
+ Parameters
1237
+ ----------
1238
+ guid: str
1239
+ The guid of the element to update.
1240
+ effectivity_time: str, optional
1241
+ The new effectivity time for the element.
1242
+ body: dict, optional
1243
+ A structure representing the details of the effectivity time to update. If supplied, these details
1244
+ supersede the effectivity time parameter provided.
1245
+
1246
+ Returns
1247
+ -------
1248
+ Nothing
1249
+
1250
+ Raises
1251
+ ------
1252
+ PyegeriaException
1253
+ ValidationError
1254
+
1255
+ Notes
1256
+ -----
1257
+ JSON Structure looks like:
1258
+ {
1259
+ "class" : "UpdateEffectivityDatesRequestBody",
1260
+ "externalSourceGUID" : "",
1261
+ "externalSourceName" : "",
1262
+ "effectiveFrom" : "{{$isoTimestamp}}",
1263
+ "effectiveTo": "{{$isoTimestamp}}",
1264
+ "forLineage" : false,
1265
+ "forDuplicateProcessing" : false,
1266
+ "effectiveTime" : "{{$isoTimestamp}}"
1267
+ }
1268
+ """
1269
+ loop = asyncio.get_event_loop()
1270
+ loop.run_until_complete(self._async_update_element_status(guid, status, body))
1271
+ #
1272
+ # @dynamic_catch
1273
+ # async def _async_classify_element(self, guid: str, status: str = None,
1274
+ # body: dict | UpdateStatusRequestBody = None) -> None:
1275
+ # """ Update the status of an element. Async version.
1276
+ #
1277
+ # Parameters
1278
+ # ----------
1279
+ # guid: str
1280
+ # The guid of the element to update.
1281
+ # status: str, optional
1282
+ # The new lifecycle status for the element. Ignored, if the body is provided.
1283
+ # body: dict | UpdateStatusRequestBody, optional
1284
+ # A structure representing the details of the element status to update. If supplied, these details
1285
+ # supersede the status parameter provided.
1286
+ #
1287
+ # Returns
1288
+ # -------
1289
+ # Nothing
1290
+ #
1291
+ # Raises
1292
+ # ------
1293
+ # PyegeriaException
1294
+ # ValidationError
1295
+ #
1296
+ # Notes
1297
+ # -----
1298
+ # JSON Structure looks like:
1299
+ # {
1300
+ # "class": "UpdateStatusRequestBody",
1301
+ # "newStatus": "APPROVED",
1302
+ # "externalSourceGUID": "add guid here",
1303
+ # "externalSourceName": "add qualified name here",
1304
+ # "effectiveTime": "{{$isoTimestamp}}",
1305
+ # "forLineage": false,
1306
+ # "forDuplicateProcessing": false
1307
+ # }
1308
+ # """
1309
+ #
1310
+ # url = f"{self.command_root}/metadata-elements/{guid}/update-status"
1311
+ # await self._async_update_status_request(url, status, body)
1312
+ #
1313
+ # @dynamic_catch
1314
+ # def classify_element(self, guid: str, status: str = None,
1315
+ # body: dict | UpdateStatusRequestBody = None) -> None:
1316
+ # """ Update the status of an element. Async version.
1317
+ #
1318
+ # Parameters
1319
+ # ----------
1320
+ # guid: str
1321
+ # The guid of the element to update.
1322
+ # status: str, optional
1323
+ # The new lifecycle status for the element. Ignored, if the body is provided.
1324
+ # body: dict | UpdateStatusRequestBody, optional
1325
+ # A structure representing the details of the element status to update. If supplied, these details
1326
+ # supersede the status parameter provided.
1327
+ #
1328
+ # Returns
1329
+ # -------
1330
+ # Nothing
1331
+ #
1332
+ # Raises
1333
+ # ------
1334
+ # PyegeriaException
1335
+ # ValidationError
1336
+ #
1337
+ # Notes
1338
+ # -----
1339
+ # JSON Structure looks like:
1340
+ # {
1341
+ # "class": "UpdateStatusRequestBody",
1342
+ # "newStatus": "APPROVED",
1343
+ # "externalSourceGUID": "add guid here",
1344
+ # "externalSourceName": "add qualified name here",
1345
+ # "effectiveTime": "{{$isoTimestamp}}",
1346
+ # "forLineage": false,
1347
+ # "forDuplicateProcessing": false
1348
+ # }
1349
+ # """
1350
+ # loop = asyncio.get_event_loop()
1351
+ # loop.run_until_complete(self._async_update_element_status(guid, status, body))
1352
+ #
1353
+ # @dynamic_catch
1354
+ # async def _async_reclassify_element(self, guid: str, effectivity_time: str = None,
1355
+ # body: dict = None) -> None:
1356
+ # """ Update the status of an element. Async version.
1357
+ #
1358
+ # Parameters
1359
+ # ----------
1360
+ # guid: str
1361
+ # The guid of the element to update.
1362
+ # effectivity_time: str, optional
1363
+ # The new effectivity time for the element.
1364
+ # body: dict, optional
1365
+ # A structure representing the details of the effectivity time to update. If supplied, these details
1366
+ # supersede the effectivity time parameter provided.
1367
+ #
1368
+ # Returns
1369
+ # -------
1370
+ # Nothing
1371
+ #
1372
+ # Raises
1373
+ # ------
1374
+ # PyegeriaException
1375
+ # ValidationError
1376
+ #
1377
+ # Notes
1378
+ # -----
1379
+ # JSON Structure looks like:
1380
+ # {
1381
+ # "class" : "UpdateEffectivityDatesRequestBody",
1382
+ # "externalSourceGUID" : "",
1383
+ # "externalSourceName" : "",
1384
+ # "effectiveFrom" : "{{$isoTimestamp}}",
1385
+ # "effectiveTo": "{{$isoTimestamp}}",
1386
+ # "forLineage" : false,
1387
+ # "forDuplicateProcessing" : false,
1388
+ # "effectiveTime" : "{{$isoTimestamp}}"
1389
+ # }
1390
+ # """
1391
+ #
1392
+ # url = f"{self.command_root}/metadata-elements/{guid}/update-effectivity"
1393
+ # if body is None:
1394
+ # body = {
1395
+ # "class": "UpdateEffectivityRequestBody",
1396
+ # "effectiveTime": effectivity_time
1397
+ # }
1398
+ # logger.info(body)
1399
+ # await self._async_make_request("POST", url, body)
1400
+ #
1401
+ # @dynamic_catch
1402
+ # def reclassify_element(self, guid: str, status: str = None,
1403
+ # body: dict = None) -> None:
1404
+ # """ Update the status of an element. Async version.
1405
+ #
1406
+ # Parameters
1407
+ # ----------
1408
+ # guid: str
1409
+ # The guid of the element to update.
1410
+ # effectivity_time: str, optional
1411
+ # The new effectivity time for the element.
1412
+ # body: dict, optional
1413
+ # A structure representing the details of the effectivity time to update. If supplied, these details
1414
+ # supersede the effectivity time parameter provided.
1415
+ #
1416
+ # Returns
1417
+ # -------
1418
+ # Nothing
1419
+ #
1420
+ # Raises
1421
+ # ------
1422
+ # PyegeriaException
1423
+ # ValidationError
1424
+ #
1425
+ # Notes
1426
+ # -----
1427
+ # JSON Structure looks like:
1428
+ # {
1429
+ # "class" : "UpdateEffectivityDatesRequestBody",
1430
+ # "externalSourceGUID" : "",
1431
+ # "externalSourceName" : "",
1432
+ # "effectiveFrom" : "{{$isoTimestamp}}",
1433
+ # "effectiveTo": "{{$isoTimestamp}}",
1434
+ # "forLineage" : false,
1435
+ # "forDuplicateProcessing" : false,
1436
+ # "effectiveTime" : "{{$isoTimestamp}}"
1437
+ # }
1438
+ # """
1439
+ # loop = asyncio.get_event_loop()
1440
+ # loop.run_until_complete(self._async_update_element_status(guid, status, body))
1441
+ #
1442
+ # @dynamic_catch
1443
+ # async def _async_declassify_element(self, guid: str, effectivity_time: str = None,
1444
+ # body: dict = None) -> None:
1445
+ # """ Update the status of an element. Async version.
1446
+ #
1447
+ # Parameters
1448
+ # ----------
1449
+ # guid: str
1450
+ # The guid of the element to update.
1451
+ # effectivity_time: str, optional
1452
+ # The new effectivity time for the element.
1453
+ # body: dict, optional
1454
+ # A structure representing the details of the effectivity time to update. If supplied, these details
1455
+ # supersede the effectivity time parameter provided.
1456
+ #
1457
+ # Returns
1458
+ # -------
1459
+ # Nothing
1460
+ #
1461
+ # Raises
1462
+ # ------
1463
+ # PyegeriaException
1464
+ # ValidationError
1465
+ #
1466
+ # Notes
1467
+ # -----
1468
+ # JSON Structure looks like:
1469
+ # {
1470
+ # "class" : "UpdateEffectivityDatesRequestBody",
1471
+ # "externalSourceGUID" : "",
1472
+ # "externalSourceName" : "",
1473
+ # "effectiveFrom" : "{{$isoTimestamp}}",
1474
+ # "effectiveTo": "{{$isoTimestamp}}",
1475
+ # "forLineage" : false,
1476
+ # "forDuplicateProcessing" : false,
1477
+ # "effectiveTime" : "{{$isoTimestamp}}"
1478
+ # }
1479
+ # """
1480
+ #
1481
+ # url = f"{self.command_root}/metadata-elements/{guid}/update-effectivity"
1482
+ # if body is None:
1483
+ # body = {
1484
+ # "class": "UpdateEffectivityRequestBody",
1485
+ # "effectiveTime": effectivity_time
1486
+ # }
1487
+ # logger.info(body)
1488
+ # await self._async_make_request("POST", url, body)
1489
+ #
1490
+ # @dynamic_catch
1491
+ # def declassify_element(self, guid: str, status: str = None,
1492
+ # body: dict = None) -> None:
1493
+ # """ Update the status of an element. Async version.
1494
+ #
1495
+ # Parameters
1496
+ # ----------
1497
+ # guid: str
1498
+ # The guid of the element to update.
1499
+ # effectivity_time: str, optional
1500
+ # The new effectivity time for the element.
1501
+ # body: dict, optional
1502
+ # A structure representing the details of the effectivity time to update. If supplied, these details
1503
+ # supersede the effectivity time parameter provided.
1504
+ #
1505
+ # Returns
1506
+ # -------
1507
+ # Nothing
1508
+ #
1509
+ # Raises
1510
+ # ------
1511
+ # PyegeriaException
1512
+ # ValidationError
1513
+ #
1514
+ # Notes
1515
+ # -----
1516
+ # JSON Structure looks like:
1517
+ # {
1518
+ # "class" : "UpdateEffectivityDatesRequestBody",
1519
+ # "externalSourceGUID" : "",
1520
+ # "externalSourceName" : "",
1521
+ # "effectiveFrom" : "{{$isoTimestamp}}",
1522
+ # "effectiveTo": "{{$isoTimestamp}}",
1523
+ # "forLineage" : false,
1524
+ # "forDuplicateProcessing" : false,
1525
+ # "effectiveTime" : "{{$isoTimestamp}}"
1526
+ # }
1527
+ # """
1528
+ # loop = asyncio.get_event_loop()
1529
+ # loop.run_until_complete(self._async_update_element_status(guid, status, body))