2022-06-11 07:24:29 +02:00
|
|
|
#[derive(Debug, Args)]
|
2021-02-13 04:46:22 +01:00
|
|
|
struct CommonOpt {
|
2022-08-18 02:36:45 +02:00
|
|
|
#[clap(parse(from_os_str), default_value = "", short, long = "config", env = "KANIDM_CONFIG")]
|
2021-02-13 04:46:22 +01:00
|
|
|
/// Path to the server's configuration file. If it does not exist, it will be created.
|
|
|
|
config_path: PathBuf,
|
2022-06-26 10:02:16 +02:00
|
|
|
/// Log format (still in very early development)
|
|
|
|
#[clap(short, long = "output", env = "KANIDM_OUTPUT", default_value="text")]
|
|
|
|
output_mode: String,
|
2021-02-13 04:46:22 +01:00
|
|
|
}
|
|
|
|
|
2022-06-11 07:24:29 +02:00
|
|
|
#[derive(Debug, Args)]
|
2021-02-13 04:46:22 +01:00
|
|
|
struct BackupOpt {
|
2022-06-11 07:24:29 +02:00
|
|
|
#[clap(parse(from_os_str))]
|
2021-02-13 04:46:22 +01:00
|
|
|
/// Output path for the backup content.
|
|
|
|
path: PathBuf,
|
2022-06-11 07:24:29 +02:00
|
|
|
#[clap(flatten)]
|
2021-02-13 04:46:22 +01:00
|
|
|
commonopts: CommonOpt,
|
|
|
|
}
|
|
|
|
|
2022-06-11 07:24:29 +02:00
|
|
|
#[derive(Debug, Args)]
|
2021-02-13 04:46:22 +01:00
|
|
|
struct RestoreOpt {
|
2022-06-11 07:24:29 +02:00
|
|
|
#[clap(parse(from_os_str))]
|
2021-05-09 14:06:58 +02:00
|
|
|
/// Restore from this path. Should be created with "backup".
|
2021-02-13 04:46:22 +01:00
|
|
|
path: PathBuf,
|
2022-06-11 07:24:29 +02:00
|
|
|
#[clap(flatten)]
|
2021-02-13 04:46:22 +01:00
|
|
|
commonopts: CommonOpt,
|
|
|
|
}
|
|
|
|
|
2022-06-11 07:24:29 +02:00
|
|
|
#[derive(Debug, Args)]
|
2021-02-13 04:46:22 +01:00
|
|
|
struct RecoverAccountOpt {
|
2022-06-26 10:02:16 +02:00
|
|
|
#[clap(value_parser)]
|
2021-02-13 04:46:22 +01:00
|
|
|
/// The account name to recover credentials for.
|
|
|
|
name: String,
|
2022-06-11 07:24:29 +02:00
|
|
|
#[clap(flatten)]
|
2021-02-13 04:46:22 +01:00
|
|
|
commonopts: CommonOpt,
|
|
|
|
}
|
|
|
|
|
2022-07-07 05:03:08 +02:00
|
|
|
|
|
|
|
#[derive(Debug, Subcommand)]
|
|
|
|
enum DomainSettingsCmds {
|
|
|
|
#[clap(name = "rename")]
|
|
|
|
/// Change the IDM domain name
|
|
|
|
DomainChange(CommonOpt),
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Subcommand)]
|
|
|
|
enum DbCommands {
|
|
|
|
#[clap(name = "vacuum")]
|
|
|
|
/// Vacuum the database to reclaim space or change db_fs_type/page_size (offline)
|
|
|
|
Vacuum(CommonOpt),
|
|
|
|
#[clap(name = "backup")]
|
|
|
|
/// Backup the database content (offline)
|
|
|
|
Backup(BackupOpt),
|
|
|
|
#[clap(name = "restore")]
|
|
|
|
/// Restore the database content (offline)
|
|
|
|
Restore(RestoreOpt),
|
|
|
|
#[clap(name = "verify")]
|
|
|
|
/// Verify database and entity consistency.
|
|
|
|
Verify(CommonOpt),
|
|
|
|
#[clap(name = "reindex")]
|
|
|
|
/// Reindex the database (offline)
|
|
|
|
Reindex(CommonOpt),
|
|
|
|
}
|
|
|
|
|
2022-06-11 07:24:29 +02:00
|
|
|
#[derive(Debug, Args)]
|
2021-07-01 06:51:25 +02:00
|
|
|
struct DbScanListIndex {
|
|
|
|
/// The name of the index to list
|
|
|
|
index_name: String,
|
2022-06-11 07:24:29 +02:00
|
|
|
#[clap(flatten)]
|
2021-07-01 06:51:25 +02:00
|
|
|
commonopts: CommonOpt,
|
|
|
|
}
|
|
|
|
|
2023-01-23 10:58:13 +01:00
|
|
|
|
|
|
|
#[derive(Debug,Parser)]
|
|
|
|
struct HealthCheckArgs {
|
|
|
|
/// Disable TLS verification
|
|
|
|
#[clap(short, long, action)]
|
|
|
|
no_verify_tls: bool,
|
|
|
|
#[clap(flatten)]
|
|
|
|
commonopts: CommonOpt,
|
|
|
|
}
|
|
|
|
|
2021-12-16 01:13:03 +01:00
|
|
|
/*
|
2022-06-11 07:24:29 +02:00
|
|
|
#[derive(Debug, Args)]
|
2021-07-01 06:51:25 +02:00
|
|
|
struct DbScanGetIndex {
|
|
|
|
/// The name of the index to list
|
|
|
|
index_name: String,
|
|
|
|
/// The name of the index key to retrieve
|
|
|
|
key: String,
|
2022-06-11 07:24:29 +02:00
|
|
|
#[clap(flatten)]
|
2021-07-01 06:51:25 +02:00
|
|
|
commonopts: CommonOpt,
|
|
|
|
}
|
2021-12-16 01:13:03 +01:00
|
|
|
*/
|
2021-07-01 06:51:25 +02:00
|
|
|
|
2022-06-11 07:24:29 +02:00
|
|
|
#[derive(Debug, Args)]
|
2021-07-01 06:51:25 +02:00
|
|
|
struct DbScanGetId2Entry {
|
|
|
|
/// The id of the entry to display
|
|
|
|
id: u64,
|
2022-06-11 07:24:29 +02:00
|
|
|
#[clap(flatten)]
|
2021-07-01 06:51:25 +02:00
|
|
|
commonopts: CommonOpt,
|
|
|
|
}
|
|
|
|
|
2022-06-11 07:24:29 +02:00
|
|
|
#[derive(Debug, Subcommand)]
|
2021-07-01 06:51:25 +02:00
|
|
|
enum DbScanOpt {
|
2023-03-02 03:47:23 +01:00
|
|
|
#[clap(name = "list-all-indexes")]
|
2021-07-01 06:51:25 +02:00
|
|
|
/// List all index tables that exist on the system.
|
|
|
|
ListIndexes(CommonOpt),
|
2023-03-02 03:47:23 +01:00
|
|
|
#[clap(name = "list-index")]
|
2021-07-01 06:51:25 +02:00
|
|
|
/// List all content of a named index
|
|
|
|
ListIndex(DbScanListIndex),
|
|
|
|
// #[structopt(name = "get_index")]
|
|
|
|
// /// Display the content of a single index key
|
|
|
|
// GetIndex(DbScanGetIndex),
|
2023-03-02 03:47:23 +01:00
|
|
|
#[clap(name = "list-id2entry")]
|
2021-07-01 06:51:25 +02:00
|
|
|
/// List all id2entry values with reduced entry content
|
|
|
|
ListId2Entry(CommonOpt),
|
2023-03-02 03:47:23 +01:00
|
|
|
#[clap(name = "get-id2entry")]
|
2021-07-01 06:51:25 +02:00
|
|
|
/// View the data of a specific entry from id2entry
|
|
|
|
GetId2Entry(DbScanGetId2Entry),
|
2023-03-02 03:47:23 +01:00
|
|
|
#[clap(name = "list-index-analysis")]
|
2021-07-01 06:51:25 +02:00
|
|
|
/// List all content of index analysis
|
|
|
|
ListIndexAnalysis(CommonOpt),
|
|
|
|
}
|
|
|
|
|
2022-06-11 07:24:29 +02:00
|
|
|
#[derive(Debug, Parser)]
|
|
|
|
struct KanidmdParser {
|
|
|
|
#[clap(subcommand)]
|
|
|
|
commands: KanidmdOpt,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Subcommand)]
|
2021-02-13 04:46:22 +01:00
|
|
|
enum KanidmdOpt {
|
2022-06-11 07:24:29 +02:00
|
|
|
#[clap(name = "server")]
|
2021-02-13 04:46:22 +01:00
|
|
|
/// Start the IDM Server
|
|
|
|
Server(CommonOpt),
|
2022-06-11 07:24:29 +02:00
|
|
|
#[clap(name = "configtest")]
|
2022-02-15 07:17:43 +01:00
|
|
|
/// Test the IDM Server configuration, without starting network listeners.
|
|
|
|
ConfigTest(CommonOpt),
|
2023-03-02 03:47:23 +01:00
|
|
|
#[clap(name = "recover-account")]
|
2021-02-13 04:46:22 +01:00
|
|
|
/// Recover an account's password
|
|
|
|
RecoverAccount(RecoverAccountOpt),
|
2022-06-11 07:24:29 +02:00
|
|
|
// #[clap(name = "reset_server_id")]
|
2021-02-13 04:46:22 +01:00
|
|
|
// ResetServerId(CommonOpt),
|
2023-03-02 03:47:23 +01:00
|
|
|
#[clap(name = "db-scan")]
|
2021-07-01 06:51:25 +02:00
|
|
|
/// Inspect the internal content of the database datastructures.
|
2022-06-11 07:24:29 +02:00
|
|
|
DbScan {
|
|
|
|
#[clap(subcommand)]
|
|
|
|
commands: DbScanOpt,
|
|
|
|
},
|
2022-07-07 05:03:08 +02:00
|
|
|
/// Database maintenance, backups, restoration etc.
|
|
|
|
#[clap(name = "database")]
|
|
|
|
Database {
|
|
|
|
#[clap(subcommand)]
|
|
|
|
commands: DbCommands,
|
|
|
|
},
|
|
|
|
/// Change domain settings
|
|
|
|
#[clap(name = "domain")]
|
|
|
|
DomainSettings {
|
|
|
|
#[clap(subcommand)]
|
|
|
|
commands: DomainSettingsCmds,
|
|
|
|
},
|
2023-01-23 10:58:13 +01:00
|
|
|
/// Load the server config and check services are listening
|
|
|
|
#[clap(name = "healthcheck")]
|
|
|
|
HealthCheck(HealthCheckArgs),
|
|
|
|
|
2022-08-18 02:36:45 +02:00
|
|
|
/// Print the program version and exit
|
|
|
|
#[clap(name="version")]
|
|
|
|
Version(CommonOpt)
|
2021-02-13 04:46:22 +01:00
|
|
|
}
|