bedger 0.0.3__tar.gz → 0.0.4__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.

Potentially problematic release.


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

bedger-0.0.4/PKG-INFO ADDED
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.1
2
+ Name: bedger
3
+ Version: 0.0.4
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
+
bedger-0.0.4/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # ConnectionManager Class Documentation
2
+
3
+ The `ConnectionManager` class manages connections to a UNIX socket for sending and receiving messages.
4
+ It provides context management capabilities to ensure connections are properly opened and closed.
5
+
6
+ ## Features
7
+ - Context manager support for connection lifecycle management.
8
+ - Error handling for socket-related issues.
9
+ - Sends event messages with acknowledgment handling.
10
+
11
+ ## Installation
12
+ Ensure you have the `bedger` package and its dependencies installed.
13
+
14
+ ```bash
15
+ pip install bedger
16
+ ```
17
+
18
+ ## Usage
19
+ The following example demonstrates how to use the `ConnectionManager` to send events:
20
+
21
+ ```python
22
+ import time
23
+ import bedger.edge.config as config
24
+ import bedger.edge.connection as connection
25
+ import bedger.edge.entities as entities
26
+
27
+ if __name__ == "__main__":
28
+ events = [
29
+ {"event_type": "EventA", "severity": entities.Severity.HIGH, "payload": {"key": "value1"}},
30
+ {"event_type": "EventB", "severity": entities.Severity.LOW, "payload": {"key": "value2"}},
31
+ {"event_type": "EventC", "severity": entities.Severity.CRITICAL, "payload": {"key": "value3"}},
32
+ ]
33
+
34
+ with connection.ConnectionManager(config.Config()) as conn:
35
+ for event in events:
36
+ time.sleep(1)
37
+ conn.send_event(event["event_type"], event["severity"], event["payload"])
38
+ ```
39
+
40
+ ## API Reference
41
+
42
+ ### `ConnectionManager`
43
+ Manages a connection to a UNIX socket for sending and receiving messages.
44
+
45
+ #### Constructor
46
+ - **`__init__(config: Config = Config())`**
47
+ - Initializes the `ConnectionManager` with a specified configuration.
48
+ - **Parameters:**
49
+ - `config (Config)`: The configuration containing the socket path. Defaults to a new `Config` instance.
50
+
51
+ #### Context Management
52
+ - **`__enter__() -> ConnectionManager`**
53
+ - Establishes the socket connection when entering the context.
54
+ - **Returns:** The instance of the `ConnectionManager`.
55
+
56
+ - **`__exit__(exc_type, exc_value, traceback) -> None`**
57
+ - Closes the socket connection when exiting the context.
58
+
59
+ #### Methods
60
+ - **`send_event(event_type: str, severity: str | Severity, payload: dict) -> None`**
61
+ - Sends an event message through the socket.
62
+ - **Parameters:**
63
+ - `event_type (str)`: The type of event being sent.
64
+ - `severity (str | Severity)`: The severity level of the event.
65
+ - `payload (dict)`: The event's payload details.
66
+ - **Raises:**
67
+ - `SocketNotConnectedError`: If no active socket connection exists.
68
+ - `SocketBrokenPipeError`: If the socket connection is lost during transmission.
69
+ - `SocketCommunicationError`: If an error occurs during socket communication.
70
+
71
+ ## Error Handling
72
+ The `ConnectionManager` raises custom errors from the `bedger.edge.errors` module for:
73
+ - Permission issues (`SocketPermissionDeniedError`).
74
+ - Missing socket files (`SocketFileNotFoundError`).
75
+ - Connection problems (`SocketConnectionError`).
76
+ - Communication errors (`SocketCommunicationError`, `SocketBrokenPipeError`).
77
+
78
+ ## Logging
79
+ The class uses the `logging` module to log the following:
80
+ - Connection attempts and successes.
81
+ - Errors during connection, disconnection, and message sending.
82
+ - Debug information for message preparation and acknowledgments.
83
+
84
+ ## License
85
+ This project is licensed under the MIT License. See the LICENSE file for details.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "bedger"
3
- version = "0.0.3"
3
+ version = "0.0.4"
4
4
  description = "Edge monitoring software for secure and efficient device management."
5
5
  authors = ["Henk van den Brink <henk.vandenbrink@bedger.io>"]
6
6
  readme = "README.md"
bedger-0.0.3/PKG-INFO DELETED
@@ -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
-
bedger-0.0.3/README.md DELETED
File without changes
File without changes
File without changes
File without changes
File without changes