Enum kuma_client::monitor::Monitor
source · pub enum Monitor {
Show 22 variants
Group {
value: MonitorGroup,
},
Http {
value: MonitorHttp,
},
Port {
value: MonitorPort,
},
Ping {
value: MonitorPing,
},
Keyword {
value: MonitorKeyword,
},
JsonQuery {
value: MonitorJsonQuery,
},
GrpcKeyword {
value: MonitorGrpcKeyword,
},
Dns {
value: MonitorDns,
},
Docker {
value: MonitorDocker,
},
RealBrowser {
value: MonitorRealBrowser,
},
Push {
value: MonitorPush,
},
Steam {
value: MonitorSteam,
},
GameDig {
value: MonitorGameDig,
},
Mqtt {
value: MonitorMqtt,
},
KafkaProducer {
value: MonitorKafkaProducer,
},
SqlServer {
value: MonitorSqlServer,
},
Postgres {
value: MonitorPostgres,
},
Mysql {
value: MonitorMysql,
},
Mongodb {
value: MonitorMongoDB,
},
Radius {
value: MonitorRadius,
},
Redis {
value: MonitorRedis,
},
TailscalePing {
value: MonitorTailscalePing,
},
}Variants§
Group
Fields
§
value: MonitorGroupHttp
Fields
§
value: MonitorHttpPort
Fields
§
value: MonitorPortPing
Fields
§
value: MonitorPingKeyword
Fields
§
value: MonitorKeywordJsonQuery
Fields
§
value: MonitorJsonQueryGrpcKeyword
Fields
§
value: MonitorGrpcKeywordDns
Fields
§
value: MonitorDnsDocker
Fields
§
value: MonitorDockerRealBrowser
Fields
§
value: MonitorRealBrowserPush
Fields
§
value: MonitorPushSteam
Fields
§
value: MonitorSteamGameDig
Fields
§
value: MonitorGameDigMqtt
Fields
§
value: MonitorMqttKafkaProducer
Fields
§
value: MonitorKafkaProducerSqlServer
Fields
§
value: MonitorSqlServerPostgres
Fields
§
value: MonitorPostgresMysql
Fields
§
value: MonitorMysqlMongodb
Fields
§
value: MonitorMongoDBRadius
Fields
§
value: MonitorRadiusRedis
Fields
§
value: MonitorRedisTailscalePing
Fields
§
value: MonitorTailscalePingImplementations§
source§impl Monitor
impl Monitor
pub fn monitor_type(&self) -> MonitorType
sourcepub fn common(&self) -> Box<&dyn MonitorCommon>
pub fn common(&self) -> Box<&dyn MonitorCommon>
Examples found in repository?
examples/create_monitor.rs (line 62)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
async fn main() {
// Connect to the server
let client = Client::connect(Config {
url: Url::parse("http://localhost:3001").expect("Invalid URL"),
username: Some("Username".to_owned()),
password: Some("Password".to_owned()),
..Default::default()
})
.await
.expect("Failed to connect to server");
// Create a tag
let tag_definition = client
.add_tag(TagDefinition {
name: Some("example_tag".to_owned()),
color: Some("red".to_owned()),
..Default::default()
})
.await
.expect("Failed to add tag");
// Create a group
let group = client
.add_monitor(MonitorGroup {
name: Some("Example Group".to_owned()),
tags: vec![Tag {
tag_id: tag_definition.tag_id,
value: Some("example_group".to_owned()),
..Default::default()
}],
..Default::default()
})
.await
.expect("Failed to add group");
// Createa a notification
let notification = client
.add_notification(Notification {
name: Some("Example Notification".to_owned()),
config: Some(serde_json::json!({
"webhookURL": "https://webhook.site/304eeaf2-0248-49be-8985-2c86175520ca",
"webhookContentType": "json"
})),
..Default::default()
})
.await
.expect("Failed to add notification");
// Create a monitor
client
.add_monitor(MonitorHttp {
name: Some("Monitor Name".to_owned()),
url: Some("https://example.com".to_owned()),
parent: group.common().id().clone(),
tags: vec![Tag {
tag_id: tag_definition.tag_id,
value: Some("example_monitor".to_owned()),
..Default::default()
}],
notification_id_list: Some(
vec![(
notification.id.expect("No notification ID").to_string(),
true,
)]
.into_iter()
.collect(),
),
..Default::default()
})
.await
.expect("Failed to add monitor");
let monitors = client.get_monitors().await.expect("Failed to get monitors");
println!("{:?}", monitors);
}pub fn common_mut(&mut self) -> Box<&mut dyn MonitorCommon>
pub fn validate(&self, id: impl AsRef<str>) -> Result<()>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Monitor
impl<'de> Deserialize<'de> for Monitor
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<MonitorDns> for Monitor
impl From<MonitorDns> for Monitor
source§fn from(value: MonitorDns) -> Self
fn from(value: MonitorDns) -> Self
Converts to this type from the input type.
source§impl From<MonitorDocker> for Monitor
impl From<MonitorDocker> for Monitor
source§fn from(value: MonitorDocker) -> Self
fn from(value: MonitorDocker) -> Self
Converts to this type from the input type.
source§impl From<MonitorGameDig> for Monitor
impl From<MonitorGameDig> for Monitor
source§fn from(value: MonitorGameDig) -> Self
fn from(value: MonitorGameDig) -> Self
Converts to this type from the input type.
source§impl From<MonitorGroup> for Monitor
impl From<MonitorGroup> for Monitor
source§fn from(value: MonitorGroup) -> Self
fn from(value: MonitorGroup) -> Self
Converts to this type from the input type.
source§impl From<MonitorGrpcKeyword> for Monitor
impl From<MonitorGrpcKeyword> for Monitor
source§fn from(value: MonitorGrpcKeyword) -> Self
fn from(value: MonitorGrpcKeyword) -> Self
Converts to this type from the input type.
source§impl From<MonitorHttp> for Monitor
impl From<MonitorHttp> for Monitor
source§fn from(value: MonitorHttp) -> Self
fn from(value: MonitorHttp) -> Self
Converts to this type from the input type.
source§impl From<MonitorJsonQuery> for Monitor
impl From<MonitorJsonQuery> for Monitor
source§fn from(value: MonitorJsonQuery) -> Self
fn from(value: MonitorJsonQuery) -> Self
Converts to this type from the input type.
source§impl From<MonitorKafkaProducer> for Monitor
impl From<MonitorKafkaProducer> for Monitor
source§fn from(value: MonitorKafkaProducer) -> Self
fn from(value: MonitorKafkaProducer) -> Self
Converts to this type from the input type.
source§impl From<MonitorKeyword> for Monitor
impl From<MonitorKeyword> for Monitor
source§fn from(value: MonitorKeyword) -> Self
fn from(value: MonitorKeyword) -> Self
Converts to this type from the input type.
source§impl From<MonitorMongoDB> for Monitor
impl From<MonitorMongoDB> for Monitor
source§fn from(value: MonitorMongoDB) -> Self
fn from(value: MonitorMongoDB) -> Self
Converts to this type from the input type.
source§impl From<MonitorMqtt> for Monitor
impl From<MonitorMqtt> for Monitor
source§fn from(value: MonitorMqtt) -> Self
fn from(value: MonitorMqtt) -> Self
Converts to this type from the input type.
source§impl From<MonitorMysql> for Monitor
impl From<MonitorMysql> for Monitor
source§fn from(value: MonitorMysql) -> Self
fn from(value: MonitorMysql) -> Self
Converts to this type from the input type.
source§impl From<MonitorPing> for Monitor
impl From<MonitorPing> for Monitor
source§fn from(value: MonitorPing) -> Self
fn from(value: MonitorPing) -> Self
Converts to this type from the input type.
source§impl From<MonitorPort> for Monitor
impl From<MonitorPort> for Monitor
source§fn from(value: MonitorPort) -> Self
fn from(value: MonitorPort) -> Self
Converts to this type from the input type.
source§impl From<MonitorPostgres> for Monitor
impl From<MonitorPostgres> for Monitor
source§fn from(value: MonitorPostgres) -> Self
fn from(value: MonitorPostgres) -> Self
Converts to this type from the input type.
source§impl From<MonitorPush> for Monitor
impl From<MonitorPush> for Monitor
source§fn from(value: MonitorPush) -> Self
fn from(value: MonitorPush) -> Self
Converts to this type from the input type.
source§impl From<MonitorRadius> for Monitor
impl From<MonitorRadius> for Monitor
source§fn from(value: MonitorRadius) -> Self
fn from(value: MonitorRadius) -> Self
Converts to this type from the input type.
source§impl From<MonitorRealBrowser> for Monitor
impl From<MonitorRealBrowser> for Monitor
source§fn from(value: MonitorRealBrowser) -> Self
fn from(value: MonitorRealBrowser) -> Self
Converts to this type from the input type.
source§impl From<MonitorRedis> for Monitor
impl From<MonitorRedis> for Monitor
source§fn from(value: MonitorRedis) -> Self
fn from(value: MonitorRedis) -> Self
Converts to this type from the input type.
source§impl From<MonitorSqlServer> for Monitor
impl From<MonitorSqlServer> for Monitor
source§fn from(value: MonitorSqlServer) -> Self
fn from(value: MonitorSqlServer) -> Self
Converts to this type from the input type.
source§impl From<MonitorSteam> for Monitor
impl From<MonitorSteam> for Monitor
source§fn from(value: MonitorSteam) -> Self
fn from(value: MonitorSteam) -> Self
Converts to this type from the input type.
source§impl From<MonitorTailscalePing> for Monitor
impl From<MonitorTailscalePing> for Monitor
source§fn from(value: MonitorTailscalePing) -> Self
fn from(value: MonitorTailscalePing) -> Self
Converts to this type from the input type.
source§impl PartialEq for Monitor
impl PartialEq for Monitor
impl StructuralPartialEq for Monitor
Auto Trait Implementations§
impl Freeze for Monitor
impl RefUnwindSafe for Monitor
impl Send for Monitor
impl Sync for Monitor
impl Unpin for Monitor
impl UnwindSafe for Monitor
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