Expand description
Client library for the https://www.upcloud.com/ API which is documented at https://developers.upcloud.com/
§Example blocking
It needs to have the feature “blocking” enabled.
upcloud_rs = { version = "*", features = ["blocking"] }
ⓘ
use upcloud_rs::{UpcloudApi, UpcloudError};
fn main() -> Result<(), UpcloudError> {
let api = UpcloudApi::new("username", "password");
let account = api.get_account_info()?;
println!("ACCOUNT: {:?}", account);
let account_list = api.get_account_list()?;
println!("ACCOUNT LIST: {:?}", account_list);
let prices = api.get_prices()?;
println!("PRICES: {:#?}", prices);
let zones = api.get_zones()?;
println!("ZONES: {:#?}", zones);
Ok(())
}
§Example async
upcloud_rs = { version = "*" }
use upcloud_rs::{UpcloudApi, UpcloudError};
#[async_std::main]
async fn main() -> Result<(), UpcloudError> {
let api = UpcloudApi::new("username", "password");
let account = api.get_account_info_async().await?;
println!("ACCOUNT: {:?}", account);
let account_list = api.get_account_list_async().await?;
println!("ACCOUNT LIST: {:?}", account_list);
let prices = api.get_prices_async().await?;
println!("PRICES: {:#?}", prices);
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
Structs§
- Create
Instance Builder - Builder struct for creating instances.
- Upcloud
Account - Upcloud
Accounts List Item - Upcloud
Api - Upcloud
Label - Upcloud
Label List - Upcloud
Plan - Upcloud
Price - Upcloud
Prices Zone - Upcloud
Server - Upcloud
Server Template - Upcloud
TagList - Upcloud
Zone