kratactl/cli/network/reservation/
mod.rs

1use anyhow::Result;
2use clap::{Parser, Subcommand};
3use list::NetworkReservationListCommand;
4use tonic::transport::Channel;
5
6use krata::events::EventStream;
7use krata::v1::control::control_service_client::ControlServiceClient;
8
9pub mod list;
10
11#[derive(Parser)]
12#[command(about = "Manage network reservations")]
13pub struct NetworkReservationCommand {
14    #[command(subcommand)]
15    subcommand: NetworkReservationCommands,
16}
17
18impl NetworkReservationCommand {
19    pub async fn run(
20        self,
21        client: ControlServiceClient<Channel>,
22        events: EventStream,
23    ) -> Result<()> {
24        self.subcommand.run(client, events).await
25    }
26}
27
28#[derive(Subcommand)]
29pub enum NetworkReservationCommands {
30    List(NetworkReservationListCommand),
31}
32
33impl NetworkReservationCommands {
34    pub async fn run(
35        self,
36        client: ControlServiceClient<Channel>,
37        events: EventStream,
38    ) -> Result<()> {
39        match self {
40            NetworkReservationCommands::List(list) => list.run(client, events).await,
41        }
42    }
43}