Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/HenningHolmDE/hcloud-rust
Unofficial Rust crate for accessing the Hetzner Cloud API
https://github.com/HenningHolmDE/hcloud-rust
api api-client hcloud hetzner hetzner-cloud rust rust-lang
Last synced: about 1 month ago
JSON representation
Unofficial Rust crate for accessing the Hetzner Cloud API
- Host: GitHub
- URL: https://github.com/HenningHolmDE/hcloud-rust
- Owner: HenningHolmDE
- License: other
- Created: 2020-05-28T20:42:00.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-06T16:59:18.000Z (3 months ago)
- Last Synced: 2024-10-16T04:01:45.777Z (2 months ago)
- Topics: api, api-client, hcloud, hetzner, hetzner-cloud, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 1.13 MB
- Stars: 64
- Watchers: 3
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-hcloud - hcloud-rust
README
# hcloud for Rust
[![Crates.io](https://img.shields.io/crates/v/hcloud.svg)](https://crates.io/crates/hcloud)
[![Documentation](https://docs.rs/hcloud/badge.svg)](https://docs.rs/hcloud/)
![Build and test](https://github.com/HenningHolmDE/hcloud-rust/workflows/Build%20and%20test/badge.svg)Unofficial Rust crate for accessing the [Hetzner Cloud API](https://docs.hetzner.cloud/)
## 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](https://github.com/MaximilianKoestler/hcloud-openapi) using [OpenAPI Generator](https://openapi-generator.tech/).
## Example
A very basic example for listing all existing servers:
```rust
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](https://github.com/HenningHolmDE/hcloud-rust/tree/master/examples) folder in the Git repository.
## Selecting TLS implementation
The underlying TLS implementation for `reqwest` can be selected using [Cargo features](https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-features-section):
- **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](https://docs.rs/reqwest/latest/reqwest/#optional-features) in the `reqwest` documentation.)
Example for using the TLS functionality provided by `rustls`:
```toml
[dependencies]
hcloud = { version = "*", default-features = false, features = ["rustls-tls"] }
```## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)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.