Skip to content

Commit

Permalink
feat(block_storage): add delete to Volume implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Sandro-Alessio Gierens <[email protected]>
  • Loading branch information
gierens committed Mar 9, 2024
1 parent f9676ec commit 8b918a5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/block_storage/volumes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
use async_trait::async_trait;
use futures::stream::{Stream, TryStreamExt};
use std::fmt::{self, Display, Formatter};
use std::time::Duration;

use super::super::common::{Refresh, ResourceIterator, ResourceQuery};
use super::super::waiter::DeletionWaiter;
use super::super::session::Session;
use super::super::utils::Query;
use super::super::{Result, Sort};
Expand Down Expand Up @@ -62,6 +64,16 @@ impl Volume {
#[doc = "Volume name."]
name: ref String
}

/// Delete the volume.
pub async fn delete(self) -> Result<DeletionWaiter<Volume>> {
api::delete_volume(&self.session, &self.inner.id).await?;
Ok(DeletionWaiter::new(
self,
Duration::new(120, 0),
Duration::new(1, 0),
))
}
}

#[async_trait]
Expand Down

0 comments on commit 8b918a5

Please sign in to comment.