pub struct Client { /* private fields */ }Expand description
A blocking icinga API client
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(
url: IcingaUrl,
maybe_cert_path: Option<PathBuf>,
credentials: Option<Credentials>,
) -> Result<Client>
pub fn new( url: IcingaUrl, maybe_cert_path: Option<PathBuf>, credentials: Option<Credentials>, ) -> Result<Client>
Create a new client with url as base uri. If provided, uses the given certificate to authenticate the server.
Sourcepub fn send_request<T: DeserializeOwned>(
&self,
request: RequestBuilder,
) -> Result<T>
pub fn send_request<T: DeserializeOwned>( &self, request: RequestBuilder, ) -> Result<T>
Send a request to the icinga API as specified by the given RequestBuilder.
This method adds credentials and an application/json ACCEPT header to request, sends it
with the underlying Client and deserializes the response.
Sourcepub fn request(
&self,
method: Method,
path: &str,
) -> Result<RequestBuilder, ParseError>
pub fn request( &self, method: Method, path: &str, ) -> Result<RequestBuilder, ParseError>
Get a RequestBuilder from the underlying Client for the given path under
self.base_uri
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