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