zabbix_api/macro/
create.rs1use crate::r#macro::macrotype::MacroType;
2use serde::Serialize;
3use serde_with::skip_serializing_none;
4
5#[skip_serializing_none]
6#[derive(Serialize, Debug, Default)]
7pub struct CreateZabbixHostMacro {
8 #[serde(rename = "macro")]
9 pub macro_name: String,
10 #[serde(rename = "value")]
11 pub macro_value: String,
12 pub description: Option<String>,
13 #[serde(rename = "type")]
14 pub macro_type: Option<MacroType>,
15}
16
17impl CreateZabbixHostMacro {
18 pub fn builder() -> CreateZabbixHostMacroBuilder {
19 CreateZabbixHostMacroBuilder {
20 inner: CreateZabbixHostMacro::default(),
21 }
22 }
23}
24
25pub struct CreateZabbixHostMacroBuilder {
26 inner: CreateZabbixHostMacro,
27}
28
29impl CreateZabbixHostMacroBuilder {
30 pub fn macro_name(mut self, value: impl ToString) -> Self {
31 self.inner.macro_name = value.to_string();
32 self
33 }
34
35 pub fn value(mut self, value: impl ToString) -> Self {
36 self.inner.macro_value = value.to_string();
37 self
38 }
39
40 pub fn description(mut self, value: impl ToString) -> Self {
41 self.inner.description = Some(value.to_string());
42 self
43 }
44
45 pub fn text(mut self) -> Self {
46 self.inner.macro_type = Some(MacroType::Text);
47 self
48 }
49
50 pub fn secret(mut self) -> Self {
51 self.inner.macro_type = Some(MacroType::Secret);
52 self
53 }
54
55 pub fn vault(mut self) -> Self {
56 self.inner.macro_type = Some(MacroType::Vault);
57 self
58 }
59
60 pub fn build(self) -> CreateZabbixHostMacro {
61 self.inner
62 }
63}