summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorGreg Weber <greg@gregweber.info>2016-07-01 11:05:38 -0700
committerGreg Weber <greg@gregweber.info>2016-07-01 11:05:38 -0700
commit90c1f274e71df2dd47cadb95ee4e8850467490ab (patch)
tree49af268d4566601875d8bb0a894b0498d7410203 /src/lib.rs
parent9593c2a29834f373c5cd5ba419ca9556c1d2d43d (diff)
add a container deletion api that takes options
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b8b7926..9a8c436 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -36,7 +36,9 @@ mod tarball;
pub use errors::Error;
pub use builder::{BuildOptions, ContainerOptions, ContainerListOptions, ContainerFilter,
- EventsOptions, ImageFilter, ImageListOptions, LogsOptions, PullOptions};
+ EventsOptions, ImageFilter, ImageListOptions, LogsOptions,
+ PullOptions, RmContainerOptions
+ };
use hyper::{Client, Url};
use hyper::header::ContentType;
use hyper::net::{HttpsConnector, Openssl};
@@ -380,11 +382,22 @@ impl<'a, 'b> Container<'a, 'b> {
Ok(try!(json::decode::<Exit>(&raw)))
}
- /// Delete the container instance (todo: force/v)
+ /// Delete the container instance
+ /// use remove instead to use the force/v options
pub fn delete(&self) -> Result<()> {
self.docker.delete(&format!("/containers/{}", self.id)[..]).map(|_| ())
}
+ /// Delete the container instance (todo: force/v)
+ pub fn remove(&self, opts: RmContainerOptions) -> Result<()> {
+ let mut path = vec![format!("/containers/{}", self.id)];
+ if let Some(query) = opts.serialize() {
+ path.push(query)
+ }
+ try!(self.docker.delete(&path.join("?")));
+ Ok(())
+ }
+
// todo attach, attach/ws, copy, archive
}