#digitalocean #api-bindings #iaa-s #api

digitalocean-rs

A pure Rust digitalocean API binding

6 releases

0.1.9 Nov 6, 2023
0.1.8 Nov 5, 2023

#1564 in Development tools

Download history 32/week @ 2024-07-29 18/week @ 2024-08-05 11/week @ 2024-08-12 15/week @ 2024-08-19 7/week @ 2024-08-26 14/week @ 2024-09-02 12/week @ 2024-09-09 13/week @ 2024-09-16 117/week @ 2024-09-23 24/week @ 2024-09-30 23/week @ 2024-10-07 24/week @ 2024-10-14 13/week @ 2024-10-21 7/week @ 2024-10-28 19/week @ 2024-11-04 10/week @ 2024-11-11

52 downloads per month

MIT license

32KB
719 lines

digitalocean-rs

A pure Rust DigitalOcean API binding.

Examples

Example blocking

It needs to have the feature "blocking" enabled.

digitalocean-rs = { version = "*", features = ["blocking"] }
use digitalocean_rs::DigitalOceanApi;
use digitalocean_rs::DigitalOceanError;

fn main() -> Result<(), DigitalOceanError> {
    let api = DigitalOceanApi::new("api key");

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

    let sizes = api.list_sizes()?;
    println!("SIZES: {:#?}", sizes);
    Ok(())
}

Example async

digitalocean-rs = { version = "*" }
use digitalocean_rs::DigitalOceanApi;
use digitalocean_rs::DigitalOceanError;

#[async_std::main]
async fn main() -> Result<(), DigitalOceanError> {
    let api = DigitalOceanApi::new("api key");

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

    let sizes = api.list_sizes_async().await?;
    println!("SIZES: {:#?}", sizes);

    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
~308K SLoC