use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize)]
pub struct ClusterResponse {
pub id: i64,
pub name: String,
pub master_ip: String,
pub node_count: usize,
pub status: String,
pub version: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ClustersListResponse {
pub clusters: Vec<ClusterResponse>,
pub total: usize,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct NodeResponse {
pub name: String,
pub status: String,
pub roles: Vec<String>,
pub version: String,
pub capacity: ResourceCapacity,
pub allocatable: ResourceCapacity,
pub conditions: Vec<NodeCondition>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ResourceCapacity {
pub cpu: String,
pub memory: String,
pub pods: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct NodeCondition {
pub type_: String,
pub status: String,
pub reason: Option<String>,
pub message: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct NodesListResponse {
pub nodes: Vec<NodeResponse>,
pub total: usize,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PodResponse {
pub name: String,
pub namespace: String,
pub status: String,
pub phase: String,
pub node: String,
pub ip: Option<String>,
pub containers: Vec<ContainerStatus>,
pub labels: HashMap<String, String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ContainerStatus {
pub name: String,
pub ready: bool,
pub restart_count: i32,
pub image: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PodsListResponse {
pub pods: Vec<PodResponse>,
pub total: usize,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ServiceResponse {
pub name: String,
pub namespace: String,
pub type_: String,
pub cluster_ip: String,
pub ports: Vec<ServicePort>,
pub labels: HashMap<String, String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ServicePort {
pub name: Option<String>,
pub port: i32,
pub target_port: String,
pub node_port: Option<i32>,
pub protocol: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ServicesListResponse {
pub services: Vec<ServiceResponse>,
pub total: usize,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DeploymentResponse {
pub name: String,
pub namespace: String,
pub replicas: i32,
pub ready_replicas: i32,
pub available_replicas: i32,
pub labels: HashMap<String, String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DeploymentsListResponse {
pub deployments: Vec<DeploymentResponse>,
pub total: usize,
}