Struct podman_api::api::Pods
source · [−]pub struct Pods<'podman> { /* private fields */ }
Expand description
Handle for Podman Pods.
Implementations
sourceimpl<'podman> Pods<'podman>
impl<'podman> Pods<'podman>
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<LibpodPodTopResponse>> + Unpin + 'podman
pub fn stats(
&self,
opts: &PodStatsOpts
) -> impl Stream<Item = Result<LibpodPodTopResponse>> + Unpin + 'podman
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 mut stream = podman.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 container 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<'podman> !RefUnwindSafe for Pods<'podman>
impl<'podman> Send for Pods<'podman>
impl<'podman> Sync for Pods<'podman>
impl<'podman> Unpin for Pods<'podman>
impl<'podman> !UnwindSafe for Pods<'podman>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more