diff options
author | MHamill98 <53518452+MHamill98@users.noreply.github.com> | 2019-08-10 23:12:06 +0100 |
---|---|---|
committer | Doug Tangren <d.tangren@gmail.com> | 2019-08-10 18:12:06 -0400 |
commit | 779ac244658d7641458ad669620c02f71037a8d3 (patch) | |
tree | 5b9311c803e1d099829b067c9446932f89319dd9 /src/lib.rs | |
parent | 7d9718b33764dea4a85859e94337e471de091332 (diff) |
Added function to tag an image (#187)
* Added function to tag an image
* Removed debug and println
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -30,7 +30,7 @@ pub use crate::{ BuildOptions, ContainerConnectionOptions, ContainerFilter, ContainerListOptions, ContainerOptions, EventsOptions, ExecContainerOptions, ImageFilter, ImageListOptions, LogsOptions, NetworkCreateOptions, NetworkListOptions, PullOptions, RegistryAuth, - RmContainerOptions, VolumeCreateOptions, + RmContainerOptions, TagOptions, VolumeCreateOptions, }, errors::Error, }; @@ -113,6 +113,18 @@ impl<'a, 'b> Image<'a, 'b> { .stream_get(&format!("/images/{}/get", self.name)[..]) .map(|c| c.to_vec()) } + + /// Adds a tag to an image + pub fn tag( + &self, + opts: &TagOptions, + ) -> impl Future<Item = (), Error = Error> { + let mut path = vec![format!("/images/{}/tag", self.name)]; + if let Some(query) = opts.serialize() { + path.push(query) + } + self.docker.post::<Body>(&path.join("?"), None).map(|_| ()) + } } /// Interface for docker images |