RestApiEndpoint

Trait RestApiEndpoint 

Source
pub trait RestApiEndpoint {
    type RequestBody;

    // Required methods
    fn method(&self) -> Result<Method, Error>;
    fn url(&self, base_url: &Url) -> Result<Url, Error>;
    fn request_body(&self) -> Result<Option<Cow<'_, Self::RequestBody>>, Error>
       where Self::RequestBody: Clone + Serialize + Debug;
}
Expand description

a trait for objects describing a REST API endpoint

this is implemented by types which contain all the necessary information for a request.

Required Associated Types§

Source

type RequestBody

the type of the request body

Required Methods§

Source

fn method(&self) -> Result<Method, Error>

returns the HTTP method to use

since this is Icinga this is the method passed to X-HTTP-Method-Override

the actual HTTP method will always be POST if there is a request body

§Errors

this should return an error if something went wrong in determining the request method

Source

fn url(&self, base_url: &Url) -> Result<Url, Error>

returns the URL to use for the request based on the base URL passed in as a parameter

§Errors

this should return an error if something went wrong in determining the URL (e.g. parse error on the fragment joined to the base URL)

Source

fn request_body(&self) -> Result<Option<Cow<'_, Self::RequestBody>>, Error>
where Self::RequestBody: Clone + Serialize + Debug,

the request body which must be a JSON serializable type

since it is always JSON we do not need to return a Content-Type

§Errors

this should return an error if something went wrong in determining the request body

Implementors§

Source§

impl RestApiEndpoint for AcknowledgeProblem

Source§

impl RestApiEndpoint for AddComment

Source§

impl RestApiEndpoint for DelayNotification

Source§

impl RestApiEndpoint for ExecuteCommand

Source§

impl RestApiEndpoint for GenerateTicket

Source§

impl RestApiEndpoint for ProcessCheckResult

Source§

impl RestApiEndpoint for RemoveAcknowledgement

Source§

impl RestApiEndpoint for RemoveComment

Source§

impl RestApiEndpoint for RemoveDowntime

Source§

impl RestApiEndpoint for RescheduleCheck

Source§

impl RestApiEndpoint for RestartProcess

Source§

impl RestApiEndpoint for ScheduleDowntime

Source§

impl RestApiEndpoint for SendCustomNotification

Source§

impl RestApiEndpoint for ShutdownProcess

Source§

impl RestApiEndpoint for ListApiUsers

Source§

impl RestApiEndpoint for ListCheckCommands

Source§

impl RestApiEndpoint for ListEndpoints

Source§

impl RestApiEndpoint for ListEventCommands

Source§

impl RestApiEndpoint for ListHostGroups

Source§

impl RestApiEndpoint for ListNotificationCommands

Source§

impl RestApiEndpoint for ListScheduledDowntimes

Source§

impl RestApiEndpoint for ListServiceGroups

Source§

impl RestApiEndpoint for ListTimePeriods

Source§

impl RestApiEndpoint for ListUserGroups

Source§

impl RestApiEndpoint for ListComments

Source§

impl RestApiEndpoint for ListDowntimes

Source§

impl<'a> RestApiEndpoint for ListDependencies<'a>

Source§

impl<'a> RestApiEndpoint for ListHosts<'a>

Source§

impl<'a> RestApiEndpoint for ListNotifications<'a>

Source§

impl<'a> RestApiEndpoint for ListServices<'a>

Source§

impl<'a> RestApiEndpoint for ListUsers<'a>

Source§

impl<'a> RestApiEndpoint for ListZones<'a>