Struct podman_api::api::Volumes
source · pub struct Volumes { /* private fields */ }
Expand description
Handle for Podman Volumes.
Implementations§
source§impl Volumes
impl Volumes
sourcepub async fn create(
&self,
opts: &VolumeCreateOpts
) -> Result<VolumeCreateResponse>
pub async fn create(
&self,
opts: &VolumeCreateOpts
) -> Result<VolumeCreateResponse>
Create a volume with specified options.
Examples:
async {
use podman_api::Podman;
use podman_api::opts::VolumeCreateOpts;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
match podman
.volumes()
.create(
&VolumeCreateOpts::builder()
.driver("my-driver")
.name("my-vol")
.build(),
)
.await
{
Ok(info) => println!("{:?}", info),
Err(e) => eprintln!("{}", e),
}
};
sourcepub async fn list(&self, opts: &VolumeListOpts) -> Result<Vec<Volume>>
pub async fn list(&self, opts: &VolumeListOpts) -> Result<Vec<Volume>>
Returns a list of volumes.
Examples:
async {
use podman_api::Podman;
use podman_api::opts::{VolumeListOpts, VolumeListFilter};
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
for volume in podman
.volumes()
.list(
&VolumeListOpts::builder()
.filter([VolumeListFilter::Driver("my-sd".into())])
.build(),
)
.await
.unwrap()
{
println!("{:?}", volume);
}
};
sourcepub async fn prune(&self, opts: &VolumePruneOpts) -> Result<Vec<PruneReport>>
pub async fn prune(&self, opts: &VolumePruneOpts) -> Result<Vec<PruneReport>>
Delete unused volumes.
Examples:
async {
use podman_api::Podman;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
match podman.volumes().prune(&Default::default()).await {
Ok(info) => println!("{:?}", info),
Err(e) => eprintln!("{}", e),
}
};