Nomad Client

License Lines of code Crates.io Crates.io

Nomad HTTP API Client

Table of contents

Overview

HTTP API Version : v1.4.x

Quick start

Install the package over cli

bash cargo add nomad-client-rs

or add the following to your Cargo.toml

toml [dependencies] nomad-client-rs = "x.x.x"

Usage

Default nomad client uses environment variables / default values

rust let client = NomadClient::default();

Nomad client with custom config

```rust let clientconfig = Config { baseurl: "http://example".into(), port: 1234, api_version: "v1".into(), token: None, };

let client = NomadClient::new(client_config); ```

Implemented API Endpoints

| Class | Method | HTTP Request | |------------|----------------------------|-------------------------------------------------| | client | clientlistfiles | GET /client/fs/ls/{allocid} | | client | clientgetfile | GET /client/fs/cat/{allocid}?path={filepath} | | client | clientgetfileinfo | GET /client/fs/stat/{allocid}?path={filepath} | | deployment | deploymentlist | GET /deployments | | deployment | deploymentget | GET /deployments/{id} | | deployment | deploymentallocationlist | GET /deployment/allocations/{id} | | deployment | deploymentfail | POST /deployment/fail/{id} | | event | eventssubscribe | GET /event/stream |
| job | jobdispatch | POST /job/{jobname}/dispatch | | job | jobparse | POST /job/parse | | job | jobcreate | POST /jobs | | namespace | namespacelist | GET /namespaces | | namespace | namespaceget | GET /namespace/{namespace} | | namespace | namespacecreate | POST /namespace | | namespace | namespacedelete | DELETE /namespace/{namespace} | | status | statusgetpeers | GET /status/peers | | status | statusgetleader | GET /status/leader |

Environment

Variables

NomadClient can be configured by env variables.
If env variable is not available it will use specified default value.

| Variable | Default | |--------------------|------------------| | NOMADBASEURL | http://localhost | | NOMADPORT | 4646 | | NOMADAPIVERSION | v1 | | NOMADSECRET_TOKEN | |

ToDo's