| 1 | from typing import Any |
| 2 | from typing import Dict |
| 3 | from typing import List |
| 4 | from typing import Optional |
| 5 | |
| 6 | from pydantic import BaseModel |
| 7 | from pydantic import Field |
| 8 | |
| 9 | |
| 10 | class GraylogMessages(BaseModel): |
| 11 | caller: str |
| 12 | content: str |
| 13 | node_id: str |
| 14 | timestamp: str |
| 15 | |
| 16 | |
| 17 | class GraylogTotalMessages(BaseModel): |
| 18 | total: int |
| 19 | |
| 20 | |
| 21 | class GraylogMessagesResponse(BaseModel): |
| 22 | graylog_messages: List[GraylogMessages] |
| 23 | success: bool |
| 24 | message: str |
| 25 | total_messages: int |
| 26 | |
| 27 | |
| 28 | class GraylogThroughputMetrics(BaseModel): |
| 29 | metric: str |
| 30 | value: float |
| 31 | |
| 32 | |
| 33 | class GraylogThroughputMetricsCollection(BaseModel): |
| 34 | graylog2_buffers_input_usage: Optional[str] = Field( |
| 35 | None, |
| 36 | alias="org.graylog2.buffers.input.usage", |
| 37 | ) |
| 38 | graylog2_buffers_output_usage: Optional[str] = Field( |
| 39 | None, |
| 40 | alias="org.graylog2.buffers.output.usage", |
| 41 | ) |
| 42 | graylog2_buffers_process_usage: Optional[str] = Field( |
| 43 | None, |
| 44 | alias="org.graylog2.buffers.process.usage", |
| 45 | ) |
| 46 | graylog2_throughput_input_1_sec_rate: Optional[str] = Field( |
| 47 | None, |
| 48 | alias="org.graylog2.throughput.input.1-sec-rate", |
| 49 | ) |
| 50 | graylog2_throughput_output_1_sec_rate: Optional[str] = Field( |
| 51 | None, |
| 52 | alias="org.graylog2.throughput.output.1-sec-rate", |
| 53 | ) |
| 54 | graylog2_throughput_output: Optional[str] = Field( |
| 55 | None, |
| 56 | alias="org.graylog2.throughput.output", |
| 57 | ) |
| 58 | graylog2_throughput_input: Optional[str] = Field( |
| 59 | None, |
| 60 | alias="org.graylog2.throughput.input", |
| 61 | ) |
| 62 | |
| 63 | |
| 64 | class GraylogThroughputMetricsList(BaseModel): |
| 65 | throughput_metrics: List[GraylogThroughputMetrics] |
| 66 | |
| 67 | |
| 68 | class GraylogUncommittedJournalEntries(BaseModel): |
| 69 | uncommitted_journal_entries: int |
| 70 | |
| 71 | |
| 72 | class GraylogMetricsResponse(BaseModel): |
| 73 | throughput_metrics: List[GraylogThroughputMetrics] |
| 74 | uncommitted_journal_entries: int |
| 75 | message: str |
| 76 | success: bool |
| 77 | |
| 78 | |
| 79 | #### ! Graylog Event Notifications ! #### |
| 80 | class GraylogEventNotificationsBasicAuth(BaseModel): |
| 81 | is_set: bool |
| 82 | |
| 83 | |
| 84 | class GraylogEventNotificationsApiSecret(BaseModel): |
| 85 | is_set: bool |
| 86 | |
| 87 | |
| 88 | class GraylogEventNotificationsConfig(BaseModel): |
| 89 | type: str |
| 90 | basic_auth: GraylogEventNotificationsBasicAuth |
| 91 | api_key: str |
| 92 | api_secret: GraylogEventNotificationsApiSecret |
| 93 | url: str |
| 94 | |
| 95 | |
| 96 | class GraylogEventNotificationsNotification(BaseModel): |
| 97 | id: str |
| 98 | title: str |
| 99 | description: str |
| 100 | # config: GraylogEventNotificationsConfig |
| 101 | config: Optional[Dict[str, Any]] = None |
| 102 | |
| 103 | |
| 104 | class GraylogEventNotifications(BaseModel): |
| 105 | total: int |
| 106 | page: int |
| 107 | per_page: int |
| 108 | count: int |
| 109 | notifications: List[GraylogEventNotificationsNotification] |
| 110 | query: str |
| 111 | grand_total: int |
| 112 | |
| 113 | |
| 114 | class GraylogEventNotificationsResponse(BaseModel): |
| 115 | event_notifications: Optional[GraylogEventNotifications] = None |
| 116 | message: str |
| 117 | success: bool |