pub struct Client { /* private fields */ }
Expand description
A client for Noxious and Toxiproxy It follows the same naming conventions for the methods.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(url: &str) -> Client
pub fn new(url: &str) -> Client
Create a new client
Panics if the given url starts with https://
.
Sourcepub async fn proxy(&self, name: &str) -> Result<Proxy, ClientError>
pub async fn proxy(&self, name: &str) -> Result<Proxy, ClientError>
Returns a proxy by name, if it already exists
Sourcepub async fn proxies(&self) -> Result<HashMap<String, Proxy>, ClientError>
pub async fn proxies(&self) -> Result<HashMap<String, Proxy>, ClientError>
Returns a map with all the proxies and their toxics
Sourcepub async fn create_proxy(
&self,
name: &str,
listen: &str,
upstream: &str,
) -> Result<Proxy, ClientError>
pub async fn create_proxy( &self, name: &str, listen: &str, upstream: &str, ) -> Result<Proxy, ClientError>
Instantiates a new proxy config, sends it to the server The server starts listening on the specified address
Sourcepub async fn populate(
&self,
proxies: &[ProxyConfig],
) -> Result<Vec<Proxy>, ClientError>
pub async fn populate( &self, proxies: &[ProxyConfig], ) -> Result<Vec<Proxy>, ClientError>
Create a list of proxies using a configuration list. If a proxy already exists, it will be replaced with the specified configuration.
Sourcepub async fn reset_state(&self) -> Result<(), ClientError>
pub async fn reset_state(&self) -> Result<(), ClientError>
Resets the state of all proxies by removing all the toxic from all proxies
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more