orca/
opt.rs

1use std::path::PathBuf;
2
3use clap::Parser;
4
5use crate::state::Model;
6
7#[derive(Debug, Parser)]
8pub struct CommonOpt {
9    #[clap(short, long)]
10    /// Enable debug logging
11    pub debug: bool,
12}
13
14#[derive(Debug, Parser)]
15#[clap(name = "orca", about = "Orca Load Testing Utility")]
16pub enum OrcaOpt {
17    /*
18            #[clap(name = "conntest")]
19            /// Perform a connection test against the specified target
20            TestConnection(SetupOpt),
21            #[clap(name = "generate")]
22            /// Generate a new dataset that can be used for testing. Parameters can
23    use state::Model; be provided
24            ///
25        use state::Model; to affect the type and quantity of data created.
26            Generate(GenerateOpt),
27            #[clap(name = "preprocess")]
28            /// Preprocess a dataset that can be used for testing
29            PreProc(PreProcOpt),
30            #[clap(name = "setup")]
31            /// Setup a server as defined by a test profile
32            Setup(SetupOpt),
33            #[clap(name = "run")]
34            /// Run the load test as defined by the test profile
35            Run(RunOpt),
36            #[clap(name = "configure")]
37            /// Update a config file
38            Configure(ConfigOpt),
39            */
40    SetupWizard {
41        #[clap(flatten)]
42        common: CommonOpt,
43
44        #[clap(long)]
45        /// Update the admin password
46        admin_password: String,
47
48        #[clap(long)]
49        /// Update the idm_admin password
50        idm_admin_password: String,
51
52        #[clap(long)]
53        /// Update the Kanidm URI
54        control_uri: String,
55
56        #[clap(long)]
57        /// Optional RNG seed. Takes a signed 64bit integer and turns it into an unsigned one for use.
58        /// This allows deterministic regeneration of a test state file.
59        seed: Option<i64>,
60
61        // TODO - support the extra uris field for replicated tests.
62        #[clap(long = "profile")]
63        /// The configuration file path to update (or create)
64        profile_path: PathBuf,
65
66        #[clap(long)]
67        /// Optional thread count, defaults to maximum available on the system
68        threads: Option<usize>,
69
70        #[clap(long, default_value_t, value_enum)]
71        // Optional model to run the benchmark, defaults to the `Basic` model
72        model: Model,
73
74        #[clap(long, default_value_t)]
75        /// Dump raw data to a separate csv file, defaults to false
76        dump_raw_data: bool,
77    },
78
79    #[clap(name = "conntest")]
80    /// Perform a connection test
81    TestConnection {
82        #[clap(flatten)]
83        common: CommonOpt,
84        #[clap(long = "profile")]
85        /// Path to the test profile.
86        profile_path: PathBuf,
87    },
88
89    #[clap(name = "generate")]
90    /// Create a new state file that is populated with a complete dataset, ready
91    /// to be loaded into a kanidm instance.
92    GenerateData {
93        #[clap(flatten)]
94        common: CommonOpt,
95        #[clap(long = "profile")]
96        /// Path to the test profile.
97        profile_path: PathBuf,
98        #[clap(long = "state")]
99        /// Path to the state file.
100        state_path: PathBuf,
101    },
102
103    #[clap(name = "populate")]
104    /// Populate the data for the test into the Kanidm instance.
105    PopulateData {
106        #[clap(flatten)]
107        common: CommonOpt,
108        #[clap(long = "state")]
109        /// Path to the state file.
110        state_path: PathBuf,
111    },
112
113    #[clap(name = "run")]
114    /// Run the simulation.
115    Run {
116        #[clap(flatten)]
117        common: CommonOpt,
118        #[clap(long = "state")]
119        /// Path to the state file.
120        state_path: PathBuf,
121    },
122
123    #[clap(name = "version")]
124    /// Print version info and exit
125    Version {
126        #[clap(flatten)]
127        common: CommonOpt,
128    },
129}