brokkr-models::models::deployment_health Rust
Structs
brokkr-models::models::deployment_health::DeploymentHealth
pub
Derives: Queryable, Selectable, Identifiable, AsChangeset, Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Hash, ToSchema, ``
Represents a deployment health record in the database.
Fields
| Name | Type | Description |
|---|---|---|
id | Uuid | Unique identifier for the health record. |
agent_id | Uuid | ID of the agent that reported this health status. |
deployment_object_id | Uuid | ID of the deployment object this health status applies to. |
status | String | Health status: healthy, degraded, failing, or unknown. |
summary | Option < String > | JSON-encoded summary with pod counts, conditions, and resource details. |
checked_at | DateTime < Utc > | Timestamp when the agent last checked health. |
created_at | DateTime < Utc > | Timestamp when the record was created. |
updated_at | DateTime < Utc > | Timestamp when the record was last updated. |
brokkr-models::models::deployment_health::NewDeploymentHealth
pub
Derives: Insertable, Debug, Clone, Serialize, Deserialize, ToSchema
Represents a new deployment health record to be inserted into the database.
Fields
| Name | Type | Description |
|---|---|---|
agent_id | Uuid | ID of the agent reporting this health status. |
deployment_object_id | Uuid | ID of the deployment object this health status applies to. |
status | String | Health status: healthy, degraded, failing, or unknown. |
summary | Option < String > | JSON-encoded summary with pod counts, conditions, and resource details. |
checked_at | DateTime < Utc > | Timestamp when the agent checked health. |
Methods
new pub
#![allow(unused)]
fn main() {
fn new (agent_id : Uuid , deployment_object_id : Uuid , status : String , summary : Option < String > , checked_at : DateTime < Utc > ,) -> Result < Self , String >
}
Creates a new NewDeploymentHealth instance.
Parameters:
| Name | Type | Description |
|---|---|---|
agent_id | - | UUID of the agent reporting health. |
deployment_object_id | - | UUID of the deployment object. |
status | - | Health status (healthy, degraded, failing, unknown). |
summary | - | Optional JSON-encoded health summary. |
checked_at | - | When the health was checked. |
Returns:
Returns Ok(NewDeploymentHealth) if all parameters are valid, otherwise returns an Err with a description of the validation failure.
Source
#![allow(unused)]
fn main() {
pub fn new(
agent_id: Uuid,
deployment_object_id: Uuid,
status: String,
summary: Option<String>,
checked_at: DateTime<Utc>,
) -> Result<Self, String> {
// Validate agent_id
if agent_id.is_nil() {
return Err("Invalid agent ID".to_string());
}
// Validate deployment_object_id
if deployment_object_id.is_nil() {
return Err("Invalid deployment object ID".to_string());
}
// Validate status
if !VALID_HEALTH_STATUSES.contains(&status.as_str()) {
return Err(format!(
"Invalid health status. Must be one of: {}",
VALID_HEALTH_STATUSES.join(", ")
));
}
Ok(NewDeploymentHealth {
agent_id,
deployment_object_id,
status,
summary,
checked_at,
})
}
}
brokkr-models::models::deployment_health::UpdateDeploymentHealth
pub
Derives: AsChangeset, Debug, Clone, Serialize, Deserialize
Represents an update to an existing deployment health record.
Fields
| Name | Type | Description |
|---|---|---|
status | String | Updated health status. |
summary | Option < String > | Updated JSON-encoded summary. |
checked_at | DateTime < Utc > | Updated check timestamp. |
brokkr-models::models::deployment_health::HealthSummary
pub
Derives: Debug, Clone, Serialize, Deserialize, ToSchema
Structured health summary for serialization/deserialization.
Fields
| Name | Type | Description |
|---|---|---|
pods_ready | i32 | Number of pods in ready state. |
pods_total | i32 | Total number of pods. |
conditions | Vec < String > | List of detected problematic conditions (e.g., ImagePullBackOff). |
resources | Option < Vec < ResourceHealth > > | Optional detailed resource status. |
brokkr-models::models::deployment_health::ResourceHealth
pub
Derives: Debug, Clone, Serialize, Deserialize, ToSchema
Health status for an individual Kubernetes resource.
Fields
| Name | Type | Description |
|---|---|---|
kind | String | Resource kind (e.g., Deployment, StatefulSet). |
name | String | Resource name. |
namespace | String | Resource namespace. |
ready | bool | Whether the resource is ready. |
message | Option < String > | Optional status message. |