heddle_client/support_args.rs
1//! `heddle support` — customer-issued temporary admin grants for Heddle
2//! staff. Mirrors the `GrantSupportAccess` / `ListSupportAccessGrants` /
3//! `RevokeSupportAccess` RPCs on `HostedUserService`.
4
5use clap::{Args, Subcommand};
6
7#[derive(Clone, Debug, Subcommand)]
8pub enum SupportCommands {
9 /// Grant a Heddle staff member temporary admin on a namespace or
10 /// repository. Reason and TTL are required; the server enforces a
11 /// hard cap of 7 days.
12 Grant(SupportGrantArgs),
13 /// List active (or all) support-access grants on a namespace/repo.
14 /// Caller must hold Admin on the target.
15 List(SupportListArgs),
16 /// Revoke an active support-access grant by id.
17 Revoke(SupportRevokeArgs),
18}
19
20#[derive(Clone, Debug, Args)]
21pub struct SupportGrantArgs {
22 /// The Heddle staff email being granted access.
23 pub operator_email: String,
24 /// Namespace path, e.g. `org/acme`. Mutually exclusive with --repo.
25 #[arg(long, conflicts_with = "repo")]
26 pub namespace: Option<String>,
27 /// Repository path, e.g. `org/acme/heddle`. Mutually exclusive with
28 /// --namespace.
29 #[arg(long, conflicts_with = "namespace")]
30 pub repo: Option<String>,
31 /// Time-to-live, e.g. `2h`, `24h`, `4d`. Hard-capped at 7d server-side.
32 #[arg(long, default_value = "24h")]
33 pub ttl: String,
34 /// Free-form reason, surfaced in the audit listing. Required.
35 #[arg(long)]
36 pub reason: String,
37 /// Remote that maps to the hosted server (default: `origin`).
38 #[arg(long, default_value = "origin")]
39 pub remote: String,
40}
41
42#[derive(Clone, Debug, Args)]
43pub struct SupportListArgs {
44 /// Namespace path. Mutually exclusive with --repo.
45 #[arg(long, conflicts_with = "repo")]
46 pub namespace: Option<String>,
47 /// Repository path. Mutually exclusive with --namespace.
48 #[arg(long, conflicts_with = "namespace")]
49 pub repo: Option<String>,
50 /// Include revoked + expired entries. Defaults to active-only.
51 #[arg(long)]
52 pub include_inactive: bool,
53 /// Remote that maps to the hosted server (default: `origin`).
54 #[arg(long, default_value = "origin")]
55 pub remote: String,
56}
57
58#[derive(Clone, Debug, Args)]
59pub struct SupportRevokeArgs {
60 /// Audit-row id of the grant to revoke (UUID).
61 pub id: String,
62 /// Remote that maps to the hosted server (default: `origin`).
63 #[arg(long, default_value = "origin")]
64 pub remote: String,
65}