pub struct VolumeManager { /* private fields */ }Implementations§
source§impl VolumeManager
impl VolumeManager
pub fn new(client: Client, api_token: String) -> Self
sourcepub async fn list_volumes(
&self,
app_name: &str,
summary: bool,
) -> Result<Vec<Volume>, Box<dyn Error>>
pub async fn list_volumes( &self, app_name: &str, summary: bool, ) -> Result<Vec<Volume>, Box<dyn Error>>
Examples found in repository?
examples/volumes.rs (line 34)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
async fn main() -> Result<(), Box<dyn Error>> {
tracing_subscriber::registry()
.with(fmt::layer().with_writer(std::io::stdout))
.with(EnvFilter::new(
std::env::var("RUST_LOG").unwrap_or_else(|_| "info".into()),
))
.init();
let api_token = std::env::var("FLY_ORG_TOKEN").expect("FLY_ORG_TOKEN must be set");
let args: Vec<String> = std::env::args().collect();
let org_slug = &args
.get(1)
.expect("Usage: cargo run --example apps <org_slug>");
let app_name = "rusty-app";
let fly = FlyControl::new(api_token.to_string());
fly.apps.create(app_name, org_slug).await?;
// VOLUMES
let vol_name = "test_volume";
let resp = fly
.volumes
.create_volume(
app_name,
volumes::CreateVolumeRequest::builder(vol_name, machines::MachineRegions::Ams, 10)
.build(),
)
.await?;
fly.volumes.list_volumes(app_name, false).await?;
let vol_id = resp.id.unwrap();
fly.volumes.destroy_volume(app_name, &vol_id).await?;
fly.apps.delete(app_name, false).await?;
Ok(())
}sourcepub async fn create_volume(
&self,
app_name: &str,
volume_request: CreateVolumeRequest,
) -> Result<Volume, Box<dyn Error>>
pub async fn create_volume( &self, app_name: &str, volume_request: CreateVolumeRequest, ) -> Result<Volume, Box<dyn Error>>
Examples found in repository?
examples/volumes.rs (lines 28-32)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
async fn main() -> Result<(), Box<dyn Error>> {
tracing_subscriber::registry()
.with(fmt::layer().with_writer(std::io::stdout))
.with(EnvFilter::new(
std::env::var("RUST_LOG").unwrap_or_else(|_| "info".into()),
))
.init();
let api_token = std::env::var("FLY_ORG_TOKEN").expect("FLY_ORG_TOKEN must be set");
let args: Vec<String> = std::env::args().collect();
let org_slug = &args
.get(1)
.expect("Usage: cargo run --example apps <org_slug>");
let app_name = "rusty-app";
let fly = FlyControl::new(api_token.to_string());
fly.apps.create(app_name, org_slug).await?;
// VOLUMES
let vol_name = "test_volume";
let resp = fly
.volumes
.create_volume(
app_name,
volumes::CreateVolumeRequest::builder(vol_name, machines::MachineRegions::Ams, 10)
.build(),
)
.await?;
fly.volumes.list_volumes(app_name, false).await?;
let vol_id = resp.id.unwrap();
fly.volumes.destroy_volume(app_name, &vol_id).await?;
fly.apps.delete(app_name, false).await?;
Ok(())
}pub async fn get_volume( &self, app_name: &str, volume_id: &str, ) -> Result<Volume, Box<dyn Error>>
pub async fn update_volume( &self, app_name: &str, volume_id: &str, update_request: UpdateVolumeRequest, ) -> Result<Volume, Box<dyn Error>>
sourcepub async fn destroy_volume(
&self,
app_name: &str,
volume_id: &str,
) -> Result<(), Box<dyn Error>>
pub async fn destroy_volume( &self, app_name: &str, volume_id: &str, ) -> Result<(), Box<dyn Error>>
Examples found in repository?
examples/volumes.rs (line 36)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
async fn main() -> Result<(), Box<dyn Error>> {
tracing_subscriber::registry()
.with(fmt::layer().with_writer(std::io::stdout))
.with(EnvFilter::new(
std::env::var("RUST_LOG").unwrap_or_else(|_| "info".into()),
))
.init();
let api_token = std::env::var("FLY_ORG_TOKEN").expect("FLY_ORG_TOKEN must be set");
let args: Vec<String> = std::env::args().collect();
let org_slug = &args
.get(1)
.expect("Usage: cargo run --example apps <org_slug>");
let app_name = "rusty-app";
let fly = FlyControl::new(api_token.to_string());
fly.apps.create(app_name, org_slug).await?;
// VOLUMES
let vol_name = "test_volume";
let resp = fly
.volumes
.create_volume(
app_name,
volumes::CreateVolumeRequest::builder(vol_name, machines::MachineRegions::Ams, 10)
.build(),
)
.await?;
fly.volumes.list_volumes(app_name, false).await?;
let vol_id = resp.id.unwrap();
fly.volumes.destroy_volume(app_name, &vol_id).await?;
fly.apps.delete(app_name, false).await?;
Ok(())
}pub async fn extend_volume( &self, app_name: &str, volume_id: &str, extend_request: ExtendVolumeRequest, ) -> Result<Volume, Box<dyn Error>>
pub async fn list_snapshots( &self, app_name: &str, volume_id: &str, ) -> Result<Vec<Snapshot>, Box<dyn Error>>
pub async fn create_snapshot( &self, app_name: &str, volume_id: &str, ) -> Result<(), Box<dyn Error>>
Auto Trait Implementations§
impl Freeze for VolumeManager
impl !RefUnwindSafe for VolumeManager
impl Send for VolumeManager
impl Sync for VolumeManager
impl Unpin for VolumeManager
impl !UnwindSafe for VolumeManager
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