#hetzner #server-api #api-bindings

hcloud

Unofficial Rust crate for accessing the Hetzner Cloud API

20 breaking releases

0.21.0 Nov 10, 2024
0.20.0 Aug 9, 2024
0.19.0 Feb 1, 2024
0.18.0 Dec 18, 2023
0.1.0 Jun 4, 2020

#167 in Web programming

Download history 1/week @ 2024-08-21 4/week @ 2024-08-28 92/week @ 2024-09-04 110/week @ 2024-09-11 281/week @ 2024-09-18 215/week @ 2024-09-25 15/week @ 2024-10-02 33/week @ 2024-10-09 10/week @ 2024-10-16 153/week @ 2024-10-23 28/week @ 2024-10-30 146/week @ 2024-11-06 63/week @ 2024-11-13 131/week @ 2024-11-20 29/week @ 2024-11-27 30/week @ 2024-12-04

267 downloads per month

MIT/Apache

1MB
16K SLoC

hcloud for Rust

Crates.io Documentation Build and test

Unofficial Rust crate for accessing the Hetzner Cloud API

Overview

The hcloud crate can be used for managing the endpoints provided by the Hetzner Cloud API in your Rust project.

The API client code of this crate has been auto-generated from the Unofficial OpenAPI Description for the Hetzner Cloud API using OpenAPI Generator.

Example

A very basic example for listing all existing servers:

use hcloud::apis::configuration::Configuration;
use hcloud::apis::servers_api;

// set up basic configuration using API token
let mut configuration = Configuration::new();
configuration.bearer_access_token =
   Some("YOUR_HCLOUD_API_TOKEN".to_string());

// get list of all existing servers from servers API
let servers = servers_api::list_servers(&configuration, Default::default())
   .await?
   .servers;

// handle server data
for server in servers {
   println!("{:?}", server);
}

For more examples check out the examples folder in the Git repository.

Selecting TLS implementation

The underlying TLS implementation for reqwest can be selected using Cargo features:

  • default-tls (enabled by default): Provides TLS support to connect over HTTPS.
  • native-tls: Enables TLS functionality provided by native-tls.
  • native-tls-vendored: Enables the vendored feature of native-tls.
  • rustls-tls: Enables TLS functionality provided by rustls.

(Refer to Optional Features in the reqwest documentation.)

Example for using the TLS functionality provided by rustls:

[dependencies]
hcloud = { version = "*", default-features = false, features = ["rustls-tls"] }

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~8–24MB
~389K SLoC