Struct extrahop::Client
[−]
[src]
pub struct Client { /* fields omitted */ }
A client for making authenticated requests to the ExtraHop REST API.
The client encapsulates the host name and API key needed to make calls to the appliance.
Methods
impl Client
[src]
fn new<IS: Into<String>>(host: IS, api_key: ApiKey) -> Self
Creates a new client which connects to the specified host using the provided key.
fn host(&self) -> &str
Gets the appliance's host string.
fn get(&self, path: &str) -> RequestBuilder
Creates a GET request builder for the provided relative path with the
Authorization
header included.
The path should not include the /api/v1
prefix.
let client = Client::new("extrahop.i.northwind.com", ApiKey::new("key".to_string())); client.get("/whitelist/devices").send().unwrap();
fn post(&self, path: &str) -> RequestBuilder
Creates a POST request builder for the provided relative path with the
Authorization
header included.
The path should not include the /api/v1
prefix.
fn patch(&self, path: &str) -> RequestBuilder
Creates a PATCH request builder for the provided relative path with the
Authorization
header included.
The path should not include the /api/v1
prefix.
fn put(&self, path: &str) -> RequestBuilder
Creates a PUT request builder for the provided relative path with the
Authorization
header included.
The path should not include the /api/v1
prefix.
fn delete(&self, path: &str) -> RequestBuilder
Creates a DELETE request builder for the provided relative path with the
Authorization
header included.
The path should not include the /api/v1/
prefix.
fn request(&self, method: Method, path: &str) -> RequestBuilder
Creates a request builder for the provided relative path with the
Authorization
header included.
The path should not include the /api/v1
prefix.
use reqwest::Method; let client = Client::new("extrahop", ApiKey::new("key".to_string())); client.request(Method::Get, "/whitelist/devices").send().unwrap();