accsyn-python-api 3.3.0__py3-none-any.whl → 3.3.2__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.
accsyn_api/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # :coding: utf-8
2
2
  # :copyright: Copyright (c) 2015-2023 accsyn/HDR AB
3
3
 
4
- __version__ = "3.3.0-0"
4
+ __version__ = "3.3.2-0"
accsyn_api/session.py CHANGED
@@ -395,6 +395,7 @@ class Session(object):
395
395
  data: Union[str, Dict[str, Any], List[Dict[str, Any]]],
396
396
  entityid: Optional[str] = None,
397
397
  allow_duplicates: Optional[bool] = None,
398
+ replace_duplicates: Optional[bool] = None,
398
399
  ) -> Union[Dict[str, Any], List[Dict[str, Any]]]:
399
400
  """
400
401
  Create a new accsyn entity.
@@ -402,7 +403,8 @@ class Session(object):
402
403
  :param entitytype: The type of entity to create (job, share, acl)
403
404
  :param data: The entity data as a dictionary.
404
405
  :param entityid: For creating sub entities (tasks), this is the parent (job) id.
405
- :param allow_duplicates: (jobs and tasks) Allow duplicates to be created.
406
+ :param allow_duplicates: (jobs and tasks) Allow duplicate tasks (same uri), will ignore the provided task and retry the existing task instead.
407
+ :param replace_duplicates: (jobs and tasks) Do not retry the existing task, replace duplicate tasks (same uri) with the new one instead.
406
408
  :return: The created entity data, as dictionary.
407
409
  """
408
410
  entitytype = (entitytype or "").lower().strip()
@@ -429,7 +431,7 @@ class Session(object):
429
431
  data = dict(tasks=data)
430
432
  if entitytype == "file":
431
433
  uri = "add"
432
- if allow_duplicates is not None and entitytype in [
434
+ if entitytype in [
433
435
  "transfer",
434
436
  "compute",
435
437
  "delivery",
@@ -438,7 +440,10 @@ class Session(object):
438
440
  "job",
439
441
  "task",
440
442
  ]:
441
- data["allow_duplicates"] = allow_duplicates
443
+ if allow_duplicates is not None:
444
+ data["allow_duplicates"] = allow_duplicates
445
+ if replace_duplicates is not None:
446
+ data["replace_duplicates"] = replace_duplicates
442
447
  d = self._event(
443
448
  "POST",
444
449
  f"{entitytype}/{uri}",
@@ -1645,6 +1650,61 @@ class Session(object):
1645
1650
  return bool(response.get("result"))
1646
1651
 
1647
1652
 
1653
+ # Logs/audit
1654
+
1655
+ def logs(
1656
+ self,
1657
+ entitytype: Optional[str] = None,
1658
+ entityid: Optional[str] = None,
1659
+ search: Optional[str] = None,
1660
+ sort: str = "date",
1661
+ sort_reverse: bool = False,
1662
+ pagination_page: Optional[int] = None,
1663
+ pagination_limit: Optional[int] = None,
1664
+ pagination_skip: Optional[int] = None,
1665
+ ) -> Dict[str, Any]:
1666
+ """
1667
+ Return backend disk logs for an entity scope.
1668
+
1669
+ :param entitytype: Optional entity type/scope (workspace, job, user, ...), defaults to 'workspace'.
1670
+ :param entityid: Optional entity ID reference used for entity-specific logs.
1671
+ :param search: Optional free text search string to filter log rows.
1672
+ :param sort: Optional sort key, defaults to 'date'.
1673
+ :param sort_reverse: Reverse sort order when True.
1674
+ :param pagination_page: Optional pagination page number.
1675
+ :param pagination_limit: Optional pagination page size.
1676
+ :param pagination_skip: Optional pagination skip/offset.
1677
+ :return: Raw backend response dictionary, always containing ``result`` and optionally additional metadata.
1678
+ """
1679
+ if entitytype:
1680
+ entitytype = entitytype.lower().strip()
1681
+ payload: Dict[str, Any] = dict(
1682
+ entitytype=entitytype or "workspace",
1683
+ sort=(sort or "date"),
1684
+ sort_reverse=sort_reverse,
1685
+ )
1686
+ if search:
1687
+ payload["search"] = search
1688
+
1689
+ pagination: Dict[str, int] = {}
1690
+ if pagination_page is not None:
1691
+ if not isinstance(pagination_page, int):
1692
+ raise AccsynException("pagination_page must be an integer!")
1693
+ pagination["page"] = pagination_page
1694
+ if pagination_limit is not None:
1695
+ if not isinstance(pagination_limit, int):
1696
+ raise AccsynException("pagination_limit must be an integer!")
1697
+ pagination["limit"] = pagination_limit
1698
+ if pagination_skip is not None:
1699
+ if not isinstance(pagination_skip, int):
1700
+ raise AccsynException("pagination_skip must be an integer!")
1701
+ pagination["skip"] = pagination_skip
1702
+ if pagination:
1703
+ payload["pagination"] = pagination
1704
+
1705
+ response = self._event("GET", "log/find", payload, entityid=entityid)
1706
+ return cast(Dict[str, Any], response or dict(result=[]))
1707
+
1648
1708
  # Misc
1649
1709
  def get_api_key(self) -> str:
1650
1710
  """Fetch API key, by default disabled in backend."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accsyn-python-api
3
- Version: 3.3.0
3
+ Version: 3.3.2
4
4
  Summary: A Python API for accsyn programmable fast and secure data delivery software
5
5
  Home-page: https://accsyn.com
6
6
  License: Apache-2.0
@@ -0,0 +1,8 @@
1
+ accsyn_api/__init__.py,sha256=vSGlQJ7mqd5eE2vElmJ_hnvRy61FkMqFpUXyhhVapTY,121
2
+ accsyn_api/_devtools.py,sha256=nDhD_LKrgGvJXaXxP0RRPMugOLJKMxQkjr8K4gXyOKg,848
3
+ accsyn_api/_version.py,sha256=poXYNHUCOq1GI16s6_1DNOSFQVpp5oAbvhZz_OS3yAw,94
4
+ accsyn_api/session.py,sha256=cFrtqTtfSHq6S0nq0bncFJAuUlSXtLA9Y4vDvAlyhE0,89671
5
+ accsyn_python_api-3.3.2.dist-info/METADATA,sha256=1YraTPqfKEWMqLVjNjc69-2qo0aSiEZG8ZTunTS8r-I,4685
6
+ accsyn_python_api-3.3.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
+ accsyn_python_api-3.3.2.dist-info/entry_points.txt,sha256=i6jv25cTq1_QzeTlRV6MYIzsyfikRe1Bk4ETWkyXVqU,50
8
+ accsyn_python_api-3.3.2.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- accsyn_api/__init__.py,sha256=vSGlQJ7mqd5eE2vElmJ_hnvRy61FkMqFpUXyhhVapTY,121
2
- accsyn_api/_devtools.py,sha256=nDhD_LKrgGvJXaXxP0RRPMugOLJKMxQkjr8K4gXyOKg,848
3
- accsyn_api/_version.py,sha256=oF8V-dlyYy_uLbVNCbI3llxc1eMfvjBBvPc0ARG757E,94
4
- accsyn_api/session.py,sha256=4h4NN5WLuslFbu9vbpb55CKC5gJCLT_mS0xo2Th9wfA,86881
5
- accsyn_python_api-3.3.0.dist-info/METADATA,sha256=7Gkh7aY2zVtwVD9uopTcSZvOR5tS-BDrYADTUTMqoVw,4685
6
- accsyn_python_api-3.3.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
- accsyn_python_api-3.3.0.dist-info/entry_points.txt,sha256=i6jv25cTq1_QzeTlRV6MYIzsyfikRe1Bk4ETWkyXVqU,50
8
- accsyn_python_api-3.3.0.dist-info/RECORD,,