use std::path::PathBuf;
use super::{ChartPathOptions, ChartRef};
use crate::backend::Command;
use crate::options::Secret;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ChartVerification {
pub signed_by: Vec<String>,
pub fingerprint: String,
pub hash: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RegistryArtifact {
pub reference: String,
pub digest: String,
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct Pulled {
pub artifacts: Vec<RegistryArtifact>,
pub verification: Option<ChartVerification>,
pub warnings: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, bon::Builder)]
#[builder(on(PathBuf, into), on(bool, default))]
pub struct Pull {
#[builder(start_fn)]
pub chart: ChartRef,
#[builder(default)]
pub chart_path: ChartPathOptions,
pub devel: bool,
pub untar: bool,
pub untardir: Option<PathBuf>,
pub destination: Option<PathBuf>,
pub prov: bool,
}
impl Pull {
#[must_use]
pub fn new(chart: ChartRef) -> Self {
Self::builder(chart).build()
}
}
impl Command for Pull {
type Output = Pulled;
}
#[derive(Debug, Clone, PartialEq, bon::Builder)]
#[builder(
on(String, into),
on(PathBuf, into),
on(Secret, into),
on(bool, default)
)]
pub struct Push {
#[builder(start_fn)]
pub chart: PathBuf,
#[builder(start_fn)]
pub remote: String,
pub cert_file: Option<PathBuf>,
pub key_file: Option<PathBuf>,
pub ca_file: Option<PathBuf>,
pub insecure_skip_tls_verify: bool,
pub plain_http: bool,
pub username: Option<String>,
pub password: Option<Secret>,
}
impl Push {
#[must_use]
pub fn new(chart: impl Into<PathBuf>, remote: impl Into<String>) -> Self {
Self::builder(chart, remote).build()
}
}
impl Command for Push {
type Output = RegistryArtifact;
}
#[derive(Debug, Clone, PartialEq, Eq, bon::Builder)]
#[builder(on(PathBuf, into))]
pub struct Verify {
#[builder(start_fn)]
pub path: PathBuf,
pub keyring: Option<PathBuf>,
}
impl Verify {
#[must_use]
pub fn new(path: impl Into<PathBuf>) -> Self {
Self::builder(path).build()
}
}
impl Command for Verify {
type Output = ChartVerification;
}