|
1 | 1 | # Models API |
2 | 2 |
|
3 | | -This page documents the Pydantic models used for representing events and reports. |
| 3 | +This page documents the Pydantic models used for representing events and reports in the legacy codebase. |
4 | 4 |
|
5 | | -::: linux_edr.models.CommandLine |
| 5 | +## Event Models |
6 | 6 |
|
7 | | -::: linux_edr.models.ProcessEvents |
| 7 | +### CommandLine |
8 | 8 |
|
9 | | -::: linux_edr.models.SummaryReport |
| 9 | +Represents a command line with command name and arguments. |
10 | 10 |
|
11 | | -::: linux_edr.models.Cell |
| 11 | +```python |
| 12 | +from linux_edr.models import CommandLine |
12 | 13 |
|
13 | | -::: linux_edr.models.Block |
| 14 | +cmd = CommandLine( |
| 15 | + command="ls", |
| 16 | + args=["-la", "/home"] |
| 17 | +) |
| 18 | +``` |
14 | 19 |
|
15 | | -::: linux_edr.models.DailyReport |
| 20 | +### ProcessEvents |
16 | 21 |
|
17 | | -::: linux_edr.models.WeeklyReport |
| 22 | +Collection of process execution events. |
18 | 23 |
|
19 | | -::: linux_edr.models.MonthlyReport |
| 24 | +```python |
| 25 | +from linux_edr.models import ProcessEvents |
20 | 26 |
|
21 | | -::: linux_edr.models.DailySummary |
| 27 | +events = ProcessEvents( |
| 28 | + events=[event1, event2, event3] |
| 29 | +) |
| 30 | +``` |
| 31 | + |
| 32 | +## Report Models |
| 33 | + |
| 34 | +### SummaryReport |
| 35 | + |
| 36 | +Base class for all summary reports. |
| 37 | + |
| 38 | +```python |
| 39 | +from linux_edr.models import SummaryReport |
| 40 | + |
| 41 | +# Used as a base class for specific report types |
| 42 | +``` |
| 43 | + |
| 44 | +### Cell |
| 45 | + |
| 46 | +Represents a 5-minute report cell. |
| 47 | + |
| 48 | +```python |
| 49 | +from linux_edr.models import Cell |
| 50 | + |
| 51 | +cell = Cell( |
| 52 | + id="cell-2023-05-12-12-00", |
| 53 | + start_time=datetime.now(), |
| 54 | + end_time=datetime.now() + timedelta(minutes=5), |
| 55 | + command_count=42, |
| 56 | + unique_commands=15, |
| 57 | + # other fields... |
| 58 | +) |
| 59 | +``` |
| 60 | + |
| 61 | +### Block |
| 62 | + |
| 63 | +Represents an hourly report block containing multiple cells. |
| 64 | + |
| 65 | +```python |
| 66 | +from linux_edr.models import Block |
| 67 | + |
| 68 | +block = Block( |
| 69 | + id="block-2023-05-12-12", |
| 70 | + start_time=datetime.now(), |
| 71 | + end_time=datetime.now() + timedelta(hours=1), |
| 72 | + cells=["cell-1", "cell-2", "cell-3"], |
| 73 | + # other fields... |
| 74 | +) |
| 75 | +``` |
| 76 | + |
| 77 | +### DailyReport |
| 78 | + |
| 79 | +Represents a daily report containing multiple blocks. |
| 80 | + |
| 81 | +```python |
| 82 | +from linux_edr.models import DailyReport |
| 83 | + |
| 84 | +daily = DailyReport( |
| 85 | + id="daily-2023-05-12", |
| 86 | + start_time=datetime.now(), |
| 87 | + end_time=datetime.now() + timedelta(days=1), |
| 88 | + blocks=["block-1", "block-2", "block-3"], |
| 89 | + # other fields... |
| 90 | +) |
| 91 | +``` |
| 92 | + |
| 93 | +### WeeklyReport |
| 94 | + |
| 95 | +Represents a weekly report containing multiple daily reports. |
| 96 | + |
| 97 | +```python |
| 98 | +from linux_edr.models import WeeklyReport |
| 99 | + |
| 100 | +weekly = WeeklyReport( |
| 101 | + id="weekly-2023-05-12", |
| 102 | + start_time=datetime.now(), |
| 103 | + end_time=datetime.now() + timedelta(weeks=1), |
| 104 | + dailies=["daily-1", "daily-2", "daily-3"], |
| 105 | + # other fields... |
| 106 | +) |
| 107 | +``` |
| 108 | + |
| 109 | +### MonthlyReport |
| 110 | + |
| 111 | +Represents a monthly report containing multiple weekly reports. |
| 112 | + |
| 113 | +```python |
| 114 | +from linux_edr.models import MonthlyReport |
| 115 | + |
| 116 | +monthly = MonthlyReport( |
| 117 | + id="monthly-2023-05", |
| 118 | + start_time=datetime.now(), |
| 119 | + end_time=datetime.now() + timedelta(days=30), |
| 120 | + weeklies=["weekly-1", "weekly-2", "weekly-3", "weekly-4"], |
| 121 | + # other fields... |
| 122 | +) |
| 123 | +``` |
0 commit comments