zabbix_api/host/
update.rs

1use serde::{Deserialize, Serialize};
2use crate::host::model::HostStatus;
3
4/// Represents a host update request in Zabbix API
5#[derive(Debug, Serialize)]
6pub struct UpdateHostRequest {
7    /// The ID of the host to update
8    pub hostid: String,
9    pub status: HostStatus,
10}
11
12impl UpdateHostRequest {
13    /// Creates a new `UpdateHost` with the given host ID and disabled status (status = 1)
14    ///
15    /// # Arguments
16    /// * `hostid` - The ID of the host to disable
17    ///
18    /// # Returns
19    /// A new `UpdateHost` instance with status set to 1 (disabled)
20    pub fn disable_host(hostid: String) -> Self {
21        Self {
22            hostid,
23            status: HostStatus::Disabled,
24        }
25    }
26}
27
28#[derive(Deserialize, Debug)]
29pub struct UpdateHostResponse {
30    #[serde(rename = "hostids")]
31    pub host_ids: Vec<String>,
32}