life_cli/deploy/
backend.rs1use std::collections::HashMap;
4
5use anyhow::Result;
6use async_trait::async_trait;
7use serde::{Deserialize, Serialize};
8
9use crate::template::AgentTemplate;
10
11#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct DeployedService {
14 pub service_id: String,
16 pub url: Option<String>,
18 pub status: String,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize)]
24pub struct DeploymentResult {
25 pub project_id: String,
27 pub environment_id: String,
29 pub services: HashMap<String, DeployedService>,
31}
32
33#[async_trait]
38pub trait DeployBackend: Send + Sync {
39 async fn deploy(
41 &self,
42 project_name: &str,
43 template: &AgentTemplate,
44 extra_env: &HashMap<String, String>,
45 ) -> Result<DeploymentResult>;
46
47 async fn status(&self, project_id: &str) -> Result<HashMap<String, DeployedService>>;
49
50 async fn destroy(&self, project_id: &str) -> Result<()>;
52
53 #[allow(dead_code)]
55 async fn restart(&self, project_id: &str) -> Result<()>;
56
57 #[allow(dead_code)]
59 async fn scale(&self, project_id: &str, service_name: &str, replicas: u32) -> Result<()>;
60}