Skip to main content

tuwunel_admin/token/
mod.rs

1mod issue;
2mod list;
3mod revoke;
4
5use clap::Subcommand;
6use tuwunel_core::Result;
7
8use crate::admin_command_dispatch;
9
10#[admin_command_dispatch]
11#[derive(Debug, Subcommand)]
12pub(crate) enum TokenCommand {
13	/// - Issue a new registration token
14	Issue {
15		/// The maximum number of times this token is allowed to be used before
16		/// it expires.
17		#[arg(long)]
18		max_uses: Option<u64>,
19
20		/// The maximum age of this token (e.g. 30s, 5m, 7d). It will expire
21		/// after this much time has passed.
22		#[arg(long)]
23		max_age: Option<String>,
24
25		/// A shortcut for `--max-uses 1`.
26		#[arg(long)]
27		once: bool,
28	},
29
30	/// - Revoke a registration token
31	Revoke {
32		/// The token to revoke.
33		token: String,
34	},
35
36	/// - List all registration tokens
37	List,
38}