pub struct Pods { /* private fields */ }
Expand description
Handle for Podman Pods.
Implementations§
Source§impl Pods
impl Pods
Sourcepub async fn list(&self, opts: &PodListOpts) -> Result<Vec<ListPodsReport>>
pub async fn list(&self, opts: &PodListOpts) -> Result<Vec<ListPodsReport>>
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);
}
};
Sourcepub async fn prune(&self) -> Result<Vec<PodPruneReport>>
pub async fn prune(&self) -> Result<Vec<PodPruneReport>>
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),
}
};
Sourcepub fn stats(
&self,
opts: &PodStatsOpts,
) -> impl Stream<Item = Result<PodStatsResponse>> + Unpin + '_
pub fn stats( &self, opts: &PodStatsOpts, ) -> impl Stream<Item = Result<PodStatsResponse>> + Unpin + '_
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),
}
}
};
Sourcepub async fn create(&self, opts: &PodCreateOpts) -> Result<Pod>
pub async fn create(&self, opts: &PodCreateOpts) -> Result<Pod>
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§
Auto Trait Implementations§
impl Freeze for Pods
impl !RefUnwindSafe for Pods
impl Send for Pods
impl Sync for Pods
impl Unpin for Pods
impl !UnwindSafe for Pods
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more