podman_client/manifests/
push_to_registry.rs

1use http_body_util::Empty;
2use hyper::body::Bytes;
3
4use crate::{
5    client::Client,
6    models::{
7        connection::SendRequestOptions,
8        lib::Error,
9        podman::manifests::push_to_registry::{
10            ManifestPushToRegistry, ManifestPushToRegistryOptions,
11        },
12    },
13    utils::bool_to_str::bool_to_str,
14};
15
16impl Client {
17    pub async fn manifest_push_to_registry(
18        &self,
19        options: ManifestPushToRegistryOptions<'_>,
20    ) -> Result<ManifestPushToRegistry, Error> {
21        let mut path = [
22            "/libpod/manifests/",
23            options.name,
24            "/push?destination=",
25            options.destination,
26        ]
27        .concat();
28
29        if let Some(all) = options.all {
30            path += &["&all=", bool_to_str(all)].concat();
31        }
32
33        let (_, data) = self
34            .send_request::<_, (), _>(SendRequestOptions {
35                method: "POST",
36                path: &path,
37                header: None,
38                body: Empty::<Bytes>::new(),
39            })
40            .await?;
41
42        Ok(data)
43    }
44}