pub struct Icinga2 {
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 Icinga2
impl Icinga2
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 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 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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Icinga2
impl !RefUnwindSafe for Icinga2
impl Send for Icinga2
impl Sync for Icinga2
impl Unpin for Icinga2
impl !UnwindSafe for Icinga2
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