1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
mod count;
mod duration;

use crate::load::IapyxLoadCommandError;
use clap::Parser;
pub use count::BurstCountIapyxLoadCommand;
pub use duration::BurstDurationIapyxLoadCommand;

#[derive(Parser, Debug)]
pub enum BurstIapyxLoadCommand {
    /// Duration based load. Defines how much time load should run
    Duration(BurstDurationIapyxLoadCommand),
    /// Requests count based load. Defines how many requests load should sent in total
    Count(BurstCountIapyxLoadCommand),
}

impl BurstIapyxLoadCommand {
    pub fn exec(&self) -> Result<(), IapyxLoadCommandError> {
        match self {
            Self::Duration(duration) => duration.exec(),
            Self::Count(count) => count.exec(),
        }
    }
}