podman_client/images/
tag.rs

1use http_body_util::Empty;
2use hyper::body::Bytes;
3
4use crate::{
5    client::Client,
6    models::{connection::SendRequestOptions, lib::Error, podman::images::tag::ImageTagOptions},
7};
8
9impl Client {
10    pub async fn image_tag(&self, options: ImageTagOptions<'_>) -> Result<(), Error> {
11        let mut path = ["/libpod/images/", options.name, "/tag?repo=", options.repo].concat();
12        if let Some(tag) = options.tag {
13            path += &["tag=", tag].concat();
14        }
15
16        let (_, data) = self
17            .send_request::<_, (), _>(SendRequestOptions {
18                method: "POST",
19                path: &path,
20                header: None,
21                body: Empty::<Bytes>::new(),
22            })
23            .await?;
24
25        Ok(data)
26    }
27}