Struct podman_api::api::Pod
source · pub struct Pod { /* private fields */ }
Expand description
Interface for accessing and manipulating Podman Pod.
Implementations§
source§impl Pod
impl Pod
sourcepub async fn start(&self) -> Result<PodStartReport>
pub async fn start(&self) -> Result<PodStartReport>
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);
}
};
sourcepub async fn stop(&self) -> Result<PodStopReport>
pub async fn stop(&self) -> Result<PodStopReport>
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);
}
};
sourcepub async fn stop_with_timeout(&self, t: usize) -> Result<PodStopReport>
pub async fn stop_with_timeout(&self, t: usize) -> Result<PodStopReport>
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);
}
};
sourcepub async fn inspect(&self) -> Result<PodInspectResponse>
pub async fn inspect(&self) -> Result<PodInspectResponse>
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),
}
};
sourcepub async fn send_signal(
&self,
signal: impl Into<String>
) -> Result<PodKillReport>
pub async fn send_signal(
&self,
signal: impl Into<String>
) -> Result<PodKillReport>
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);
}
};
sourcepub async fn kill(&self) -> Result<PodKillReport>
pub async fn kill(&self) -> Result<PodKillReport>
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);
}
};
sourcepub async fn pause(&self) -> Result<PodPauseReport>
pub async fn pause(&self) -> Result<PodPauseReport>
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);
}
};
sourcepub async fn unpause(&self) -> Result<PodUnpauseReport>
pub async fn unpause(&self) -> Result<PodUnpauseReport>
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);
}
};
sourcepub async fn restart(&self) -> Result<PodRestartReport>
pub async fn restart(&self) -> Result<PodRestartReport>
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);
}
};
sourcepub async fn delete(&self) -> Result<PodRmReport>
pub async fn delete(&self) -> Result<PodRmReport>
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);
}
};
sourcepub async fn remove(&self) -> Result<PodRmReport>
pub async fn remove(&self) -> Result<PodRmReport>
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);
}
};
sourcepub async fn exists(&self) -> Result<bool>
pub async fn exists(&self) -> Result<bool>
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),
}
};
sourcepub async fn top(&self, opts: &PodTopOpts) -> Result<PodTopResponse>
pub async fn top(&self, opts: &PodTopOpts) -> Result<PodTopResponse>
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),
}
};
sourcepub fn top_stream(
&self,
opts: &PodTopOpts
) -> impl Stream<Item = Result<PodTopResponse>> + Unpin + '_
pub fn top_stream(
&self,
opts: &PodTopOpts
) -> impl Stream<Item = Result<PodTopResponse>> + Unpin + '_
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),
}
}
};
sourcepub async fn generate_systemd_units(
&self,
opts: &SystemdUnitsOpts
) -> Result<Value>
pub async fn generate_systemd_units(
&self,
opts: &SystemdUnitsOpts
) -> Result<Value>
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),
}
};
sourcepub async fn generate_kube_yaml(&self, service: bool) -> Result<String>
pub async fn generate_kube_yaml(&self, service: bool) -> Result<String>
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),
}
};