10 releases

0.1.9 Nov 15, 2023
0.1.8 Nov 14, 2023
0.1.1 Oct 31, 2023

#979 in Development tools

Download history 2/week @ 2024-09-20 6/week @ 2024-09-27 1/week @ 2024-10-04

87 downloads per month

MIT license

60KB
1.5K SLoC

scaleway-rs

A pure Rust Scaleway API binding.

Examples

Example blocking

It needs to have the feature "blocking" enabled.

scaleway-rs = { version = "*", features = ["blocking"] }
use scaleway_rs::ScalewayApi;
use scaleway_rs::ScalewayError;

fn main() -> Result<(), ScalewayError> {
    let region = "fr-par-2";
    let api = ScalewayApi::new("<KEY>");

    let types = api.get_server_types_async(region).await?;
    println!("SERVERTYPES: {:#?}", types);

    let images = api.list_images(region).run_async().await?;
    println!("IMAGES: {:#?}", images);

    let instances = api
        .list_instances(region)
        .order("creation_date_asc")
        .run_async()
        .await?;
    println!("INSTANCES: {:#?}", instances);
    Ok(())
}

Example async

scaleway-rs = { version = "*" }
use scaleway_rs::ScalewayApi;
use scaleway_rs::ScalewayError;

#[async_std::main]
async fn main() -> Result<(), ScalewayError> {
    let region = "fr-par-2";
    let api = ScalewayApi::new("<KEY>");

    let types = api.get_server_types(region)?;
    println!("SERVERTYPES: {:#?}", types);

    let images = api.list_images(region).run()?;
    println!("IMAGES: {:#?}", images);

    let instances = api.list_instances(region).order("creation_date_asc").run()?;
    println!("INSTANCES: {:#?}", instances);
    Ok(())
}

Features

  • "default" - use nativetls
  • "default-rustls" - use rusttls
  • "blocking" - enable blocking api
  • "rustls" - enable rustls for reqwest
  • "nativetls" - add support for nativetls DEFAULT
  • "gzip" - enable gzip in reqwest
  • "brotli" - enable brotli in reqwest
  • "deflate" - enable deflate in reqwest

TODO

  • Documentation
  • Full api support

Dependencies

~4–19MB
~307K SLoC