helm-rs 0.1.0

Typed Rust API for Helm 4: swappable backends, native chart, values and release reading
Documentation
use super::shared::release_command;
use super::{ServerSide, ValuesMode};
use crate::backend::Command;
use crate::command::ChartRef;
use crate::release::Release;

release_command! {
    /// `helm upgrade -o json` (`pkg/cmd/upgrade.go`, `pkg/action/upgrade.go`): upgrades a release to a
    /// chart and returns the release Helm recorded. With `install`, a missing or uninstalled release
    /// is installed instead and the same JSON comes back.
    Upgrade, UpgradeBuilder, upgrade_builder {
        required {
            /// The `RELEASE` argument.
            release: String,
        }
        collections {}
        flags {
            /// Flag `--cleanup-on-fail`: delete the resources this upgrade created if it fails.
            cleanup_on_fail: bool,
            /// Flag `--hide-notes`: leave the notes out of the output.
            hide_notes: bool,
            /// Flag `--hide-secret`: hide Secrets in a dry-run (Helm requires a dry-run mode with it).
            hide_secret: bool,
            /// Flag `--history-max`: how many revisions to keep; 0 keeps all (Helm's default is 10).
            history_max: Option<u32>,
            /// Flag `--install`: install when the release does not exist.
            install: bool,
            /// Flag `--render-subchart-notes`: include the subcharts' notes.
            render_subchart_notes: bool,
            /// Flags `--reset-values`, `--reuse-values` and `--reset-then-reuse-values`.
            values_mode: Option<ValuesMode>,
            /// Flag `--server-side` (Helm's default is `auto`).
            server_side: Option<ServerSide>,
        }
    }
}

impl Upgrade {
    /// An upgrade of `release` to `chart` with every other setting left to Helm.
    #[must_use]
    pub fn new(release: impl Into<String>, chart: ChartRef) -> Self {
        Self::builder(release, chart).build()
    }
}

impl Command for Upgrade {
    type Output = Release;
}