kratactl: implement guest resolution and rename console to attach

This commit is contained in:
Alex Zenla
2024-03-23 09:48:53 +00:00
parent 7b2de22320
commit e25cbf087d
10 changed files with 136 additions and 58 deletions

View File

@ -4,7 +4,7 @@ use krata::control::{control_service_client::ControlServiceClient, DestroyGuestR
use tonic::{transport::Channel, Request};
use crate::events::EventStream;
use crate::cli::resolve_guest;
#[derive(Parser)]
pub struct DestroyCommand {
@ -13,15 +13,10 @@ pub struct DestroyCommand {
}
impl DestroyCommand {
pub async fn run(
self,
mut client: ControlServiceClient<Channel>,
_events: EventStream,
) -> Result<()> {
pub async fn run(self, mut client: ControlServiceClient<Channel>) -> Result<()> {
let guest_id: String = resolve_guest(&mut client, &self.guest).await?;
let _ = client
.destroy_guest(Request::new(DestroyGuestRequest {
guest_id: self.guest.clone(),
}))
.destroy_guest(Request::new(DestroyGuestRequest { guest_id }))
.await?
.into_inner();
println!("destroyed guest: {}", self.guest);