Struct podman_api::api::Pods

source ·
pub struct Pods { /* private fields */ }
Expand description

Handle for Podman Pods.

Implementations§

Exports an interface for interacting with Podman Pods.

Returns a reference to a set of operations available to a specific Pod.

Api Reference

Returns a list of pods.

Examples:

async {
    use podman_api::Podman;
    use podman_api::opts::{PodListOpts, PodListFilter};
    use podman_api::models::PodStatus;
    let podman = Podman::unix("/run/user/1000/podman/podman.sock");

    for pod in podman
        .pods()
        .list(
            &PodListOpts::builder()
                .filter([PodListFilter::Status(PodStatus::Degraded)])
                .build(),
        )
        .await
        .unwrap()
    {
        println!("{:?}", pod);
    }
};

Api Reference

Returns a list of pods.

Examples:

async {
    use podman_api::Podman;
    let podman = Podman::unix("/run/user/1000/podman/podman.sock");

    match podman.pods().prune().await {
        Ok(info) => println!("{:?}", info),
        Err(e) => eprintln!("{}", e),
    }
};

Api Reference

Display a live stream of resource usage statistics for the containers in one or more pods.

Examples:

async {
    use podman_api::Podman;
    use podman_api::opts::PodStatsOpts;
    use futures_util::StreamExt;
    let podman = Podman::unix("/run/user/1000/podman/podman.sock");

    let pods = podman.pods();
    let mut stream = pods.stats(&PodStatsOpts::builder().all(true).build());
    while let Some(chunk) = stream.next().await {
        match chunk{
            Ok(chunk) => println!("{:?}", chunk),
            Err(e) => eprintln!("{}", e),
        }
    }
};

Api Reference

Create a pod with specified options.

Examples:

async {
    use podman_api::Podman;
    use podman_api::opts::PodCreateOpts;
    let podman = Podman::unix("/run/user/1000/podman/podman.sock");

    match podman
        .pods()
        .create(&PodCreateOpts::builder().name("my-pod").build())
        .await
    {
        Ok(pod) => { /* do something with the pod */ }
        Err(e) => eprintln!("{}", e),
    }
};

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more