Struct podman_api::api::Pods
source · [−]pub struct Pods { /* private fields */ }
Expand description
Handle for Podman Pods.
Implementations
sourceimpl 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 !RefUnwindSafe for Pods
impl Send for Pods
impl Sync for Pods
impl Unpin for Pods
impl !UnwindSafe for Pods
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