bedger 0.0.3__py3-none-any.whl → 0.0.5__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.

Potentially problematic release.


This version of bedger might be problematic. Click here for more details.

@@ -7,3 +7,4 @@ class Severity(str, Enum):
7
7
  MEDIUM = "MEDIUM"
8
8
  HIGH = "HIGH"
9
9
  CRITICAL = "CRITICAL"
10
+ INFO = "INFO"
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.1
2
+ Name: bedger
3
+ Version: 0.0.5
4
+ Summary: Edge monitoring software for secure and efficient device management.
5
+ Author: Henk van den Brink
6
+ Author-email: henk.vandenbrink@bedger.io
7
+ Requires-Python: >=3.8.1,<4.0.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Dist: pydantic (>=2.9.2,<3.0.0)
15
+ Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
16
+ Project-URL: homepage, https://github.com/bedger-io/BEDGER-edgeservices-securitymonitoring-sdk
17
+ Project-URL: issues, https://github.com/bedger-io/BEDGER-edgeservices-securitymonitoring-sdk/issues
18
+ Description-Content-Type: text/markdown
19
+
20
+ # ConnectionManager Class Documentation
21
+
22
+ The `ConnectionManager` class manages connections to a UNIX socket for sending and receiving messages.
23
+ It provides context management capabilities to ensure connections are properly opened and closed.
24
+
25
+ ## Features
26
+ - Context manager support for connection lifecycle management.
27
+ - Error handling for socket-related issues.
28
+ - Sends event messages with acknowledgment handling.
29
+
30
+ ## Installation
31
+ Ensure you have the `bedger` package and its dependencies installed.
32
+
33
+ ```bash
34
+ pip install bedger
35
+ ```
36
+
37
+ ## Usage
38
+ The following example demonstrates how to use the `ConnectionManager` to send events:
39
+
40
+ ```python
41
+ import time
42
+ import bedger.edge.config as config
43
+ import bedger.edge.connection as connection
44
+ import bedger.edge.entities as entities
45
+
46
+ if __name__ == "__main__":
47
+ events = [
48
+ {"event_type": "EventA", "severity": entities.Severity.HIGH, "payload": {"key": "value1"}},
49
+ {"event_type": "EventB", "severity": entities.Severity.LOW, "payload": {"key": "value2"}},
50
+ {"event_type": "EventC", "severity": entities.Severity.CRITICAL, "payload": {"key": "value3"}},
51
+ ]
52
+
53
+ with connection.ConnectionManager(config.Config()) as conn:
54
+ for event in events:
55
+ time.sleep(1)
56
+ conn.send_event(event["event_type"], event["severity"], event["payload"])
57
+ ```
58
+
59
+ ## API Reference
60
+
61
+ ### `ConnectionManager`
62
+ Manages a connection to a UNIX socket for sending and receiving messages.
63
+
64
+ #### Constructor
65
+ - **`__init__(config: Config = Config())`**
66
+ - Initializes the `ConnectionManager` with a specified configuration.
67
+ - **Parameters:**
68
+ - `config (Config)`: The configuration containing the socket path. Defaults to a new `Config` instance.
69
+
70
+ #### Context Management
71
+ - **`__enter__() -> ConnectionManager`**
72
+ - Establishes the socket connection when entering the context.
73
+ - **Returns:** The instance of the `ConnectionManager`.
74
+
75
+ - **`__exit__(exc_type, exc_value, traceback) -> None`**
76
+ - Closes the socket connection when exiting the context.
77
+
78
+ #### Methods
79
+ - **`send_event(event_type: str, severity: str | Severity, payload: dict) -> None`**
80
+ - Sends an event message through the socket.
81
+ - **Parameters:**
82
+ - `event_type (str)`: The type of event being sent.
83
+ - `severity (str | Severity)`: The severity level of the event.
84
+ - `payload (dict)`: The event's payload details.
85
+ - **Raises:**
86
+ - `SocketNotConnectedError`: If no active socket connection exists.
87
+ - `SocketBrokenPipeError`: If the socket connection is lost during transmission.
88
+ - `SocketCommunicationError`: If an error occurs during socket communication.
89
+
90
+ ## Error Handling
91
+ The `ConnectionManager` raises custom errors from the `bedger.edge.errors` module for:
92
+ - Permission issues (`SocketPermissionDeniedError`).
93
+ - Missing socket files (`SocketFileNotFoundError`).
94
+ - Connection problems (`SocketConnectionError`).
95
+ - Communication errors (`SocketCommunicationError`, `SocketBrokenPipeError`).
96
+
97
+ ## Logging
98
+ The class uses the `logging` module to log the following:
99
+ - Connection attempts and successes.
100
+ - Errors during connection, disconnection, and message sending.
101
+ - Debug information for message preparation and acknowledgments.
102
+
103
+ ## License
104
+ This project is licensed under the MIT License. See the LICENSE file for details.
105
+
@@ -4,9 +4,9 @@ bedger/edge/config.py,sha256=0fUKThP0aJFk3WBF7JUtuKKhXlV07SX5VnqVOLNou-A,152
4
4
  bedger/edge/connection.py,sha256=25h7PzRhSw8m0w679p23M6X_o-wuIOl7M1P837bpy9I,5400
5
5
  bedger/edge/entities/__init__.py,sha256=_oKO_XdDerqOwVX8izhDPtGv4HqVDwQaT-otOdY8lYg,91
6
6
  bedger/edge/entities/message.py,sha256=wLbEZik_FBboyEAvX5Uvlto1t4BsjaeLXUFGOIjIHRU,913
7
- bedger/edge/entities/severity.py,sha256=tUN7eDSEN5cc5eAqhvKzVHD1pSEmrdwvNEGsmh4Pnfw,157
7
+ bedger/edge/entities/severity.py,sha256=lzJhqjFfeJ26EWJYDIe-Fotml00dQK6_ihpc_0NzLRg,175
8
8
  bedger/edge/errors.py,sha256=6jdmhlKoWlD-kZ8-xRiAlObRHEo9PwrKqhWQ5su5TLk,266
9
- bedger-0.0.3.dist-info/LICENSE,sha256=lVrf6pfElYZ_o6ETq-XR91_7GHTzKGyeNWAKghvcNUE,1075
10
- bedger-0.0.3.dist-info/METADATA,sha256=md3fa-i_3zHQEN84mDwBea3-QgJ0xxtXnnHkR8P8X88,859
11
- bedger-0.0.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
12
- bedger-0.0.3.dist-info/RECORD,,
9
+ bedger-0.0.5.dist-info/LICENSE,sha256=lVrf6pfElYZ_o6ETq-XR91_7GHTzKGyeNWAKghvcNUE,1075
10
+ bedger-0.0.5.dist-info/METADATA,sha256=-yEloT1oseSC-2g89JZtO07GDqW5mH1RkbribcyN6hk,4144
11
+ bedger-0.0.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
12
+ bedger-0.0.5.dist-info/RECORD,,
@@ -1,20 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: bedger
3
- Version: 0.0.3
4
- Summary: Edge monitoring software for secure and efficient device management.
5
- Author: Henk van den Brink
6
- Author-email: henk.vandenbrink@bedger.io
7
- Requires-Python: >=3.8.1,<4.0.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.9
10
- Classifier: Programming Language :: Python :: 3.10
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Classifier: Programming Language :: Python :: 3.13
14
- Requires-Dist: pydantic (>=2.9.2,<3.0.0)
15
- Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
16
- Project-URL: homepage, https://github.com/bedger-io/BEDGER-edgeservices-securitymonitoring-sdk
17
- Project-URL: issues, https://github.com/bedger-io/BEDGER-edgeservices-securitymonitoring-sdk/issues
18
- Description-Content-Type: text/markdown
19
-
20
-
File without changes