Struct podman_api::api::Pod

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

Interface for accessing and manipulating Podman Pod.

Api Reference

Implementations§

Exports an interface exposing operations against a Pod instance.

A getter for Pod id

Api Reference

Start this pod.

Parameters:

  • detach_keys - Override the key sequence for detaching a pod. Format is a single character [a-Z] or ctrl- where is one of: a-z, @, ^, [, , or _.

Examples:

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

    if let Err(e) = podman.pods().get("79c93f220e3e").start().await {
        eprintln!("{}", e);
    }
};

Api Reference

Stop this pod.

Examples:

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

    if let Err(e) = podman.pods().get("79c93f220e3e").stop().await {
        eprintln!("{}", e);
    }
};

Api Reference

Stop this pod with a timeout.

Examples:

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

    if let Err(e) = podman.pods().get("79c93f220e3e").stop_with_timeout(10).await {
        eprintln!("{}", e);
    }
};

Api Reference

Return low-level information about this pod.

Examples:

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

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

Api Reference

Send a signal to this pod.

Examples:

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

    if let Err(e) = podman.pods().get("79c93f220e3e").send_signal("SIGINT").await {
        eprintln!("{}", e);
    }
};

Api Reference

Kill this pod.

Examples:

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

    if let Err(e) = podman.pods().get("79c93f220e3e").kill().await {
        eprintln!("{}", e);
    }
};

Api Reference

Pause this pod.

Examples:

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

    if let Err(e) = podman.pods().get("79c93f220e3e").pause().await {
        eprintln!("{}", e);
    }
};

Api Reference

Unpause this pod

Examples:

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

    if let Err(e) = podman.pods().get("79c93f220e3e").unpause().await {
        eprintln!("{}", e);
    }
};

Api Reference

Restart this pod.

Examples:

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

    if let Err(e) = podman.pods().get("79c93f220e3e").restart().await {
        eprintln!("{}", e);
    }
};

Api Reference

Delete this pod.

Examples:

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

    if let Err(e) = podman.pods().get("79c93f220e3e").delete().await {
        eprintln!("{}", e);
    }
};

Api Reference

Force remove this pod.

Examples:

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

    if let Err(e) = podman.pods().get("79c93f220e3e").remove().await {
        eprintln!("{}", e);
    }
};

Api Reference

Quick way to determine if a pod exists by name or ID.

Examples:

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

    match podman.pods().get("79c93f220e3e").exists().await {
        Ok(exists) => if exists {
            println!("pod exists!");
        } else {
            println!("pod doesn't exists!");
        },
        Err(e) => eprintln!("check failed: {}", e),
    }
};

Api Reference

List processes inside this pod.

Examples:

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

    match podman.pods().get("79c93f220e3e").top(&Default::default()).await {
        Ok(info) => println!("{:?}", info),
        Err(e) => eprintln!("{}", e),
    }
};

Api Reference

List processes inside this pod.

Only supported as of version > 4.0

Examples:

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

    let pod = podman.pods().get("79c93f220e3e");
    let mut stream = pod.top_stream(&Default::default());
    while let Some(chunk) = stream.next().await {
        match chunk{
            Ok(chunk) => println!("{:?}", chunk),
            Err(e) => eprintln!("{}", e),
        }
    }
};

Api Reference

Generate Systemd Units based on this pod.

Examples:

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

    match podman
        .pods()
        .get("ea03584c0fd6")
        .generate_systemd_units(&Default::default())
        .await
    {
        Ok(info) => println!("{:?}", info),
        Err(e) => eprintln!("{}", e),
    }
};

Api Reference

Generate Kubernetes YAML based on this pod

Parameters:

  • service - Generate YAML for a Kubernetes service object.

Examples:

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

    match podman
        .pods()
        .get("fc93f220e3e")
        .generate_kube_yaml(false)
        .await
    {
        Ok(yaml) => println!("{:?}", yaml),
        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