pub struct Network<'podman> { /* private fields */ }
Expand description

Interface for accessing and manipulating Podman Network.

Api Reference

Implementations

Exports an interface exposing operations against a Network instance.

A getter for Network name

Api Reference

Delete this container. To delete this network forcefully use Network::force_delete.

Examples:

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

    match podman.networks().get("some-network").delete().await {
        Ok(info) => println!("{:?}", info),
        Err(e) => eprintln!("{}", e),
    }
};

Api Reference

Force remove this network removing associated containers. To delete network normally use Network::delete.

Examples:

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

    match podman.networks().get("some-network").force_delete().await {
        Ok(info) => println!("{:?}", info),
        Err(e) => eprintln!("{}", e),
    }
};

Api Reference

Quick way to determine if a network exists by name or id.

Examples:

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

    match podman.networks().get("some-network").exists().await {
        Ok(exists) => if exists {
            println!("network exists!");
        } else {
            println!("network doesn't exists!");
        },
        Err(e) => eprintln!("check failed: {}", e),
    }
};

Api Reference

Display low level configuration for this CNI network.

Examples:

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

    match podman.networks().get("some-network").inspect().await {
        Ok(info) => println!("{:?}", info),
        Err(e) => eprintln!("{}", e),
    }
};

Api Reference

Disconnect a container from this network.

Examples:

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

    match podman
        .networks()
        .get("some-network")
        .disconnect_container(
            &NetworkDisconnectOpts::builder()
                .container("containerid")
                .force(true)
                .build()
        )
        .await {
        Ok(info) => println!("{:?}", info),
        Err(e) => eprintln!("{}", e),
    }
};

Api Reference

Connect a container to this network.

Examples:

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

    match podman
        .networks()
        .get("some-network")
        .connect_container(
            &NetworkConnectOpts::builder()
                .container("containerid")
                .interface_name("eno128")
                .build()
        )
        .await {
        Ok(info) => println!("{:?}", info),
        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