Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

NameTypeDescription
idUuidUnique identifier for the health record.
agent_idUuidID of the agent that reported this health status.
deployment_object_idUuidID of the deployment object this health status applies to.
statusStringHealth status: healthy, degraded, failing, or unknown.
summaryOption < String >JSON-encoded summary with pod counts, conditions, and resource details.
checked_atDateTime < Utc >Timestamp when the agent last checked health.
created_atDateTime < Utc >Timestamp when the record was created.
updated_atDateTime < 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

NameTypeDescription
agent_idUuidID of the agent reporting this health status.
deployment_object_idUuidID of the deployment object this health status applies to.
statusStringHealth status: healthy, degraded, failing, or unknown.
summaryOption < String >JSON-encoded summary with pod counts, conditions, and resource details.
checked_atDateTime < 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:

NameTypeDescription
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

NameTypeDescription
statusStringUpdated health status.
summaryOption < String >Updated JSON-encoded summary.
checked_atDateTime < Utc >Updated check timestamp.

brokkr-models::models::deployment_health::HealthSummary

pub

Derives: Debug, Clone, Serialize, Deserialize, ToSchema

Structured health summary for serialization/deserialization.

Fields

NameTypeDescription
pods_readyi32Number of pods in ready state.
pods_totali32Total number of pods.
conditionsVec < String >List of detected problematic conditions (e.g., ImagePullBackOff).
resourcesOption < 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

NameTypeDescription
kindStringResource kind (e.g., Deployment, StatefulSet).
nameStringResource name.
namespaceStringResource namespace.
readyboolWhether the resource is ready.
messageOption < String >Optional status message.