pub struct CreateVolumeRequest {
pub name: String,
pub region: MachineRegions,
pub size_gb: u64,
pub encrypted: bool,
pub fstype: String,
pub require_unique_zone: bool,
pub compute: Option<Compute>,
pub snapshot_id: Option<String>,
pub snapshot_retention: Option<u32>,
pub source_volume_id: Option<String>,
}Fields§
§name: String§region: MachineRegions§size_gb: u64§encrypted: bool§fstype: String§require_unique_zone: bool§compute: Option<Compute>§snapshot_id: Option<String>§snapshot_retention: Option<u32>§source_volume_id: Option<String>Implementations§
Source§impl CreateVolumeRequest
impl CreateVolumeRequest
Sourcepub fn builder(
name: &str,
region: MachineRegions,
size_gb: u64,
) -> CreateVolumeRequestBuilder
pub fn builder( name: &str, region: MachineRegions, size_gb: u64, ) -> CreateVolumeRequestBuilder
Examples found in repository?
examples/volumes.rs (line 30)
6async fn main() -> Result<(), Box<dyn Error>> {
7 tracing_subscriber::registry()
8 .with(fmt::layer().with_writer(std::io::stdout))
9 .with(EnvFilter::new(
10 std::env::var("RUST_LOG").unwrap_or_else(|_| "info".into()),
11 ))
12 .init();
13 let api_token = std::env::var("FLY_ORG_TOKEN").expect("FLY_ORG_TOKEN must be set");
14 let args: Vec<String> = std::env::args().collect();
15 let org_slug = &args
16 .get(1)
17 .expect("Usage: cargo run --example apps <org_slug>");
18
19 let app_name = "rusty-app";
20 let fly = FlyControl::new(api_token.to_string());
21
22 fly.apps.create(app_name, org_slug).await?;
23
24 // VOLUMES
25 let vol_name = "test_volume";
26 let resp = fly
27 .volumes
28 .create_volume(
29 app_name,
30 volumes::CreateVolumeRequest::builder(vol_name, machines::MachineRegions::Ams, 10)
31 .build(),
32 )
33 .await?;
34 fly.volumes.list_volumes(app_name, false).await?;
35 let vol_id = resp.id.unwrap();
36 fly.volumes.destroy_volume(app_name, &vol_id).await?;
37 fly.apps.delete(app_name, false).await?;
38
39 Ok(())
40}Trait Implementations§
Source§impl Debug for CreateVolumeRequest
impl Debug for CreateVolumeRequest
Auto Trait Implementations§
impl Freeze for CreateVolumeRequest
impl RefUnwindSafe for CreateVolumeRequest
impl Send for CreateVolumeRequest
impl Sync for CreateVolumeRequest
impl Unpin for CreateVolumeRequest
impl UnwindSafe for CreateVolumeRequest
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