pub struct Icinga2Async {
pub url: Url,
pub username: String,
/* private fields */
}
Expand description
the runtime object for an Icinga2 instance (blocking variant)
Fields§
§url: Url
the base URL for the Icinga API
username: String
username
Implementations§
Source§impl Icinga2Async
impl Icinga2Async
Sourcepub fn from_instance_config(config: &Icinga2Instance) -> Result<Self, Error>
pub fn from_instance_config(config: &Icinga2Instance) -> Result<Self, Error>
create a new Icinga2 instance from a config that was either manually created or previously loaded via Icinga2Instance::from_config_file
§Errors
this fails if the CA certificate file mentioned in the configuration can not be found or parsed
Sourcepub fn from_config_file(path: &Path) -> Result<Self, Error>
pub fn from_config_file(path: &Path) -> Result<Self, Error>
create a new Icinga2 instance from a TOML config file
§Errors
this fails if the configuration file can not be found or parsed or the CA certificate file mentioned in the configuration file can not be found or parsed
Sourcepub async fn rest<ApiEndpoint, Res>(
&self,
api_endpoint: ApiEndpoint,
) -> Result<Res, Error>where
ApiEndpoint: RestApiEndpoint,
<ApiEndpoint as RestApiEndpoint>::RequestBody: Clone + Serialize + Debug,
Res: DeserializeOwned + Debug + RestApiResponse<ApiEndpoint>,
pub async fn rest<ApiEndpoint, Res>(
&self,
api_endpoint: ApiEndpoint,
) -> Result<Res, Error>where
ApiEndpoint: RestApiEndpoint,
<ApiEndpoint as RestApiEndpoint>::RequestBody: Clone + Serialize + Debug,
Res: DeserializeOwned + Debug + RestApiResponse<ApiEndpoint>,
common code for the REST API calls
§Errors
this returns an error if encoding, the actual request, or decoding of the response fail
Sourcepub async fn event_stream(
&self,
types: &[IcingaEventStreamType],
queue: &str,
filter: Option<IcingaFilter>,
) -> Result<impl Stream<Item = Result<IcingaEvent, Error>>, Error>
pub async fn event_stream( &self, types: &[IcingaEventStreamType], queue: &str, filter: Option<IcingaFilter>, ) -> Result<impl Stream<Item = Result<IcingaEvent, Error>>, Error>
Long-polling on an event stream
§Errors
this returns an error if encoding or the actual request fail
Trait Implementations§
Source§impl Clone for Icinga2Async
impl Clone for Icinga2Async
Source§fn clone(&self) -> Icinga2Async
fn clone(&self) -> Icinga2Async
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for Icinga2Async
impl !RefUnwindSafe for Icinga2Async
impl Send for Icinga2Async
impl Sync for Icinga2Async
impl Unpin for Icinga2Async
impl !UnwindSafe for Icinga2Async
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