use clap::{Args, Subcommand, ValueEnum};
#[derive(Debug, Args)]
pub(crate) struct HostArgs {
#[command(subcommand)]
pub command: HostCommand,
}
#[derive(Debug, Subcommand)]
pub(crate) enum HostCommand {
Lease(HostLeaseArgs),
}
#[derive(Debug, Args)]
pub(crate) struct HostLeaseArgs {
#[command(subcommand)]
pub command: HostLeaseCommand,
}
#[derive(Debug, Subcommand)]
pub(crate) enum HostLeaseCommand {
Acquire(HostLeaseAcquireArgs),
Renew(HostLeaseRenewArgs),
Release(HostLeaseReleaseArgs),
Status(HostLeaseStatusArgs),
}
#[derive(Clone, Copy, Debug, Default, ValueEnum)]
pub(crate) enum HostLeasePriorityArg {
Interactive,
Measurement,
CiVerify,
#[default]
Deferrable,
}
#[derive(Debug, Args)]
pub(crate) struct HostLeaseAcquireArgs {
#[arg(long)]
pub host: Option<String>,
#[arg(long)]
pub owner: String,
#[arg(long, value_enum, default_value_t)]
pub priority_class: HostLeasePriorityArg,
#[arg(long, default_value_t = 900_000, conflicts_with = "no_expiry")]
pub ttl_ms: u64,
#[arg(long)]
pub no_expiry: bool,
#[arg(long)]
pub owner_pid: Option<u32>,
#[arg(long, default_value_t = 0)]
pub wait_ms: u64,
#[arg(long)]
pub reason: Option<String>,
#[arg(long)]
pub json: bool,
}
#[derive(Debug, Args)]
pub(crate) struct HostLeaseRenewArgs {
#[arg(long)]
pub host: Option<String>,
#[arg(long)]
pub lease_id: String,
#[arg(long, default_value_t = 900_000)]
pub ttl_ms: u64,
#[arg(long)]
pub json: bool,
}
#[derive(Debug, Args)]
pub(crate) struct HostLeaseReleaseArgs {
#[arg(long)]
pub host: Option<String>,
#[arg(long)]
pub lease_id: String,
#[arg(long)]
pub json: bool,
}
#[derive(Debug, Args)]
pub(crate) struct HostLeaseStatusArgs {
#[arg(long)]
pub host: Option<String>,
#[arg(long)]
pub json: bool,
}