use std::path::PathBuf;
use lightshuttle_manifest::ExportConfig;
use lightshuttle_spec::ContainerSpec;
#[derive(Debug, Clone)]
pub struct ExportModel {
pub project: ExportProject,
pub services: Vec<ExportService>,
pub export: Option<ExportConfig>,
}
#[derive(Debug, Clone)]
pub struct ExportProject {
pub name: String,
pub version: Option<String>,
}
#[derive(Debug, Clone)]
pub struct ExportService {
pub spec: ContainerSpec,
pub depends_on: Vec<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Target {
Compose,
Kubernetes,
Helm,
}
impl Target {
#[must_use]
pub fn label(self) -> &'static str {
match self {
Self::Compose => "compose",
Self::Kubernetes => "kubernetes",
Self::Helm => "helm",
}
}
}
impl std::fmt::Display for Target {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.label())
}
}
#[derive(Debug, Clone, Default)]
pub struct ExportArtifacts {
pub files: Vec<ExportFile>,
}
impl ExportArtifacts {
#[must_use]
pub fn new() -> Self {
Self::default()
}
pub fn push(&mut self, path: impl Into<PathBuf>, contents: impl Into<String>) {
self.files.push(ExportFile {
path: path.into(),
contents: contents.into(),
});
}
}
#[derive(Debug, Clone)]
pub struct ExportFile {
pub path: PathBuf,
pub contents: String,
}