The Nomad Rust API is an experimental project that provides an ergonomic, type-safe interface for interacting with the HashiCorp Nomad API using Rust.
The client can be configured automatically using environment variabeles:
use nomad_rs_api::{Config, Nomad};
let client = Nomad::new(Config::from_env());Alternatively, you can configure the client manually:
let config = Config {
address: "http://localhost:4646".to_string(),
token: None,
..Default::default()
};
let client = Nomad::new(config);The query and write options can be easily built before making a request:
use nomad_rs_api::{option};
let query_opts = option::QueryOptions::new()
.with_namespace("platform".to_string())
.with_auth_token("auth_token".to_string());
let write_opts = option::WriteOptions::new()
.with_namespace("platform".to_string())
.with_auth_token("auth_token".to_string());