orchestrator-client 0.3.0

Shared control-plane client types and connection logic for the Agent Orchestrator
Documentation
use serde::{Deserialize, Serialize};

/// Control-plane configuration file generated by the daemon and consumed
/// by clients (CLI, GUI).  Follows a kubeconfig-shaped YAML layout.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ControlPlaneConfig {
    /// Name of the currently selected context.
    pub current_context: String,
    /// Cluster entries available in the bundle.
    pub clusters: Vec<NamedCluster>,
    /// User entries available in the bundle.
    pub users: Vec<NamedUser>,
    /// Context entries available in the bundle.
    pub contexts: Vec<NamedContext>,
}

/// Named cluster entry inside a generated control-plane config file.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NamedCluster {
    /// Cluster entry name.
    pub name: String,
    /// Cluster reference payload.
    pub cluster: ClusterRef,
}

/// Server endpoint and CA bundle reference for a named cluster entry.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClusterRef {
    /// Server URL for the control-plane endpoint.
    pub server: String,
    /// Path to the CA bundle file.
    pub certificate_authority: String,
}

/// Named user entry inside a generated control-plane config file.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NamedUser {
    /// User entry name.
    pub name: String,
    /// User reference payload.
    pub user: UserRef,
}

/// Client certificate and key locations for a named user entry.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserRef {
    /// Path to the client certificate file.
    pub client_certificate: String,
    /// Path to the client private-key file.
    pub client_key: String,
}

/// Named context entry that binds a cluster and user together.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NamedContext {
    /// Context entry name.
    pub name: String,
    /// Context reference payload.
    pub context: ContextRef,
}

/// Cluster and user references selected by a named context entry.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ContextRef {
    /// Cluster name selected by the context.
    pub cluster: String,
    /// User name selected by the context.
    pub user: String,
}