howler-client 3.1.0.dev390__tar.gz → 3.1.0.dev397__tar.gz

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 (31) hide show
  1. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/PKG-INFO +1 -1
  2. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/client.py +2 -0
  3. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/common/utils.py +1 -1
  4. howler_client-3.1.0.dev397/howler_client/module/action.py +74 -0
  5. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/search/__init__.py +39 -0
  6. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/pyproject.toml +1 -1
  7. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/LICENSE +0 -0
  8. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/README.md +0 -0
  9. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/__init__.py +0 -0
  10. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/common/__init__.py +0 -0
  11. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/common/dict_utils.py +0 -0
  12. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/connection.py +0 -0
  13. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/logger.py +0 -0
  14. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/__init__.py +0 -0
  15. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/comment.py +0 -0
  16. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/help.py +0 -0
  17. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/hit.py +0 -0
  18. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/search/chunk.py +0 -0
  19. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/search/facet.py +0 -0
  20. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/search/fields.py +0 -0
  21. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/search/grouped.py +0 -0
  22. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/search/histogram.py +0 -0
  23. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/search/stats.py +0 -0
  24. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/search/stream.py +0 -0
  25. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/user.py +0 -0
  26. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/v2/__init__.py +0 -0
  27. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/v2/case.py +0 -0
  28. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/v2/ingest.py +0 -0
  29. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/module/v2/search.py +0 -0
  30. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/utils/__init__.py +0 -0
  31. {howler_client-3.1.0.dev390 → howler_client-3.1.0.dev397}/howler_client/utils/json_encoders.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: howler-client
3
- Version: 3.1.0.dev390
3
+ Version: 3.1.0.dev397
4
4
  Summary: The Howler client library facilitates issuing requests to Howler
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -2,6 +2,7 @@ import sys
2
2
 
3
3
  from howler_client.common.utils import walk_api_path
4
4
  from howler_client.connection import Connection
5
+ from howler_client.module.action import Action
5
6
  from howler_client.module.help import Help
6
7
  from howler_client.module.hit import Hit
7
8
  from howler_client.module.search import Search
@@ -20,6 +21,7 @@ class Client(object):
20
21
  def __init__(self: Self, connection: Connection):
21
22
  self._connection: Connection = connection
22
23
 
24
+ self.action = Action(self._connection)
23
25
  self.help = Help(self._connection)
24
26
  self.search = Search(self._connection)
25
27
  self.hit = Hit(self._connection, self.search)
@@ -5,7 +5,7 @@ from typing import cast
5
5
  from urllib.parse import quote
6
6
 
7
7
  INVALID_STREAM_SEARCH_PARAMS = ("deep_paging_id", "rows", "sort")
8
- SEARCHABLE = ["hit"]
8
+ SEARCHABLE = ["hit", "action"]
9
9
  API = "v1"
10
10
 
11
11
 
@@ -0,0 +1,74 @@
1
+ """Client module for Howler automation actions."""
2
+
3
+ import sys
4
+ from typing import TYPE_CHECKING, Any, List, Literal
5
+
6
+ from howler_client.common.utils import api_path
7
+
8
+ if sys.version_info >= (3, 11):
9
+ from typing import Self
10
+ else:
11
+ from typing_extensions import Self
12
+
13
+ if TYPE_CHECKING:
14
+ from howler_client import Connection
15
+
16
+
17
+ class Action(object):
18
+ """Operations for managing and executing Howler automation actions."""
19
+
20
+ def __init__(self: Self, connection: "Connection"):
21
+ self._connection = connection
22
+
23
+ def __call__(self: Self, action_id: str) -> dict[str, Any]:
24
+ """Return an action by ID.
25
+
26
+ Args:
27
+ action_id: Unique identifier of the action.
28
+
29
+ Returns:
30
+ The action data.
31
+ """
32
+ return self._connection.get(api_path("action", action_id))
33
+
34
+ def list(self: Self) -> list[dict[str, Any]]:
35
+ """Return up to 250 actions visible to the current user."""
36
+ return self._connection.get(api_path("action/"))
37
+
38
+ def create(
39
+ self: Self,
40
+ action_data: dict[str, Any],
41
+ refresh: bool | Literal["true", "false", "wait_for"] = False,
42
+ ) -> dict[str, Any]:
43
+ """Create an action.
44
+
45
+ Args:
46
+ action_data: Action definition, including ``name``, ``query``, and ``operations``.
47
+ refresh: Whether to refresh the index before returning.
48
+
49
+ Returns:
50
+ The created action data.
51
+ """
52
+ return self._connection.post(api_path("action/", refresh=refresh), json=action_data)
53
+
54
+ def execute(
55
+ self: Self,
56
+ action_id: str,
57
+ request_id: str,
58
+ query: str | None = None,
59
+ ) -> dict[str, List[dict[str, Any]]]:
60
+ """Execute an action, optionally overriding its configured query.
61
+
62
+ Args:
63
+ action_id: Unique identifier of the action to execute.
64
+ request_id: Identifier used to correlate websocket execution updates.
65
+ query: Optional query to run instead of the action's configured query.
66
+
67
+ Returns:
68
+ The execution reports grouped by operation ID.
69
+ """
70
+ payload: dict[str, str] = {"request_id": request_id}
71
+ if query is not None:
72
+ payload["query"] = query
73
+
74
+ return self._connection.post(api_path("action", action_id, "execute"), json=payload)
@@ -77,3 +77,42 @@ class Search(object):
77
77
  timeout=timeout,
78
78
  track_total_hits=track_total_hits,
79
79
  )
80
+
81
+ def action(
82
+ self,
83
+ query,
84
+ filters=None,
85
+ fl=None,
86
+ offset=0,
87
+ rows=25,
88
+ sort=None,
89
+ timeout=None,
90
+ track_total_hits=None,
91
+ ):
92
+ """Search actions with a lucene query.
93
+
94
+ Required:
95
+ query : lucene query (string)
96
+
97
+ Optional:
98
+ filters : Additional lucene queries used to filter the data (list of strings)
99
+ fl : List of fields to return (comma separated string of fields)
100
+ offset : Offset at which the query items should start (integer)
101
+ rows : Number of records to return (integer)
102
+ sort : Field used for sorting with direction (string: ex. 'name asc')
103
+ timeout : Max amount of milliseconds the query will run (integer)
104
+ track_total_hits : Number of actions to track (default: 10k)
105
+
106
+ Returns the matching actions and search metadata.
107
+ """
108
+ return self._do_search(
109
+ "action",
110
+ query,
111
+ filters=filters,
112
+ fl=fl,
113
+ offset=offset,
114
+ rows=rows,
115
+ sort=sort,
116
+ timeout=timeout,
117
+ track_total_hits=track_total_hits,
118
+ )
@@ -108,7 +108,7 @@ suppress-none-returning = true
108
108
  [tool.poetry]
109
109
  package-mode = true
110
110
  name = "howler-client"
111
- version = "3.1.0.dev390"
111
+ version = "3.1.0.dev397"
112
112
  description = "The Howler client library facilitates issuing requests to Howler"
113
113
  authors = [
114
114
  "Canadian Centre for Cyber Security <howler@cyber.gc.ca>",