Crate hrobot

source ·
Expand description

hrobot is an unofficial asynchronous Rust client for interacting with the Hetzner Robot API

See the AsyncRobot struct for a complete list of supported API Endpoints.

Disclaimer: the authors are not associated with Hetzner (except as customers), and the crate is in no way endorsed or supported by Hetzner Online GmbH.

§Requirements for usage

A Hetzner WebService/app user is required to make use of this library.

If you already have a Hetzner account, you can create one through the Hetzner Robot web interface under Settings/Preferences.

§Example

Here’s a quick example showing how to instantiate the AsyncRobot client object and fetching a list of all dedicated servers owned by the account identified by username

use hrobot::*;

#[tokio::main]
async fn main() {
    // Robot is instantiated using the environment
    // variables HROBOT_USERNAME an HROBOT_PASSWORD.
    let robot = AsyncRobot::default();

    for server in robot.list_servers().await.unwrap() {
        println!("{name}: {product} in {location}",
            name = server.name,
            product = server.product,
            location = server.dc
        );
    }
}

Running the above example should yield something similar to the output below:

foo: AX51-NVMe in FSN1-DC18
bar: Server Auction in FSN1-DC5

Re-exports§

Modules§

  • Request Builders and Response Models.
  • Typed error handling for API responses.

Structs§

  • Handles authentication and exposes the Hetzner Robot API functionality with a simple interface.