brokkr-models::models::diagnostic_results
Rust
Diagnostic Result model for storing collected diagnostic data.
Diagnostic results contain the pod statuses, events, and log tails collected by agents in response to diagnostic requests.
Structs
Section titled “Structs”struct DiagnosticResult
Section titled “struct DiagnosticResult”pub
Derives: Debug, Clone, Queryable, Selectable, Identifiable, Serialize, Deserialize, ToSchema
A diagnostic result record from the database.
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
id |
Uuid |
Unique identifier for the diagnostic result. |
request_id |
Uuid |
The diagnostic request this result belongs to. |
pod_statuses |
String |
JSON-encoded pod statuses. |
events |
String |
JSON-encoded Kubernetes events. |
log_tails |
Option<String> |
JSON-encoded log tails (optional). |
collected_at |
DateTime<Utc> |
When the diagnostics were collected by the agent. |
created_at |
DateTime<Utc> |
When the result was created in the database. |
struct NewDiagnosticResult
Section titled “struct NewDiagnosticResult”pub
Derives: Debug, Clone, Insertable, Serialize, Deserialize
A new diagnostic result to be inserted.
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
request_id |
Uuid |
The diagnostic request this result belongs to. |
pod_statuses |
String |
JSON-encoded pod statuses. |
events |
String |
JSON-encoded Kubernetes events. |
log_tails |
Option<String> |
JSON-encoded log tails (optional). |
collected_at |
DateTime<Utc> |
When the diagnostics were collected by the agent. |
Methods
Section titled “Methods”pub
fn new( request_id: Uuid, pod_statuses: String, events: String, log_tails: Option<String>, collected_at: DateTime<Utc>,) -> Result<Self, String>Creates a new diagnostic result.
Parameters:
| Name | Type | Description |
|---|---|---|
request_id |
Uuid |
The diagnostic request this result belongs to. |
pod_statuses |
String |
JSON-encoded pod statuses. |
events |
String |
JSON-encoded Kubernetes events. |
log_tails |
Option<String> |
Optional JSON-encoded log tails. |
collected_at |
DateTime<Utc> |
When the diagnostics were collected. |
Returns:
A Result containing the new diagnostic result or an error.
Source
pub fn new( request_id: Uuid, pod_statuses: String, events: String, log_tails: Option<String>, collected_at: DateTime<Utc>, ) -> Result<Self, String> { // Validate request_id is not nil if request_id.is_nil() { return Err("Request ID cannot be nil".to_string()); }
// Validate pod_statuses is not empty if pod_statuses.is_empty() { return Err("Pod statuses cannot be empty".to_string()); }
// Validate events is not empty if events.is_empty() { return Err("Events cannot be empty".to_string()); }
Ok(Self { request_id, pod_statuses, events, log_tails, collected_at, }) }