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

§

Http

Fields

§

Port

Fields

§

Ping

Fields

§

Keyword

Fields

§

JsonQuery

Fields

§

GrpcKeyword

§

Dns

Fields

§

Docker

Fields

§

RealBrowser

§

Push

Fields

§

Steam

Fields

§

GameDig

Fields

§

Mqtt

Fields

§

KafkaProducer

§

SqlServer

Fields

§

Postgres

Fields

§

Mysql

Fields

§

Mongodb

Fields

§

Radius

Fields

§

Redis

Fields

§

TailscalePing

Implementations§

source§

impl Monitor

source

pub fn monitor_type(&self) -> MonitorType

source

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);
}
source

pub fn common_mut(&mut self) -> Box<&mut dyn MonitorCommon>

source

pub fn validate(&self, id: impl AsRef<str>) -> Result<()>

Trait Implementations§

source§

impl Clone for Monitor

source§

fn clone(&self) -> Monitor

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Monitor

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Monitor

source§

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

source§

fn from(value: MonitorDns) -> Self

Converts to this type from the input type.
source§

impl From<MonitorDocker> for Monitor

source§

fn from(value: MonitorDocker) -> Self

Converts to this type from the input type.
source§

impl From<MonitorGameDig> for Monitor

source§

fn from(value: MonitorGameDig) -> Self

Converts to this type from the input type.
source§

impl From<MonitorGroup> for Monitor

source§

fn from(value: MonitorGroup) -> Self

Converts to this type from the input type.
source§

impl From<MonitorGrpcKeyword> for Monitor

source§

fn from(value: MonitorGrpcKeyword) -> Self

Converts to this type from the input type.
source§

impl From<MonitorHttp> for Monitor

source§

fn from(value: MonitorHttp) -> Self

Converts to this type from the input type.
source§

impl From<MonitorJsonQuery> for Monitor

source§

fn from(value: MonitorJsonQuery) -> Self

Converts to this type from the input type.
source§

impl From<MonitorKafkaProducer> for Monitor

source§

fn from(value: MonitorKafkaProducer) -> Self

Converts to this type from the input type.
source§

impl From<MonitorKeyword> for Monitor

source§

fn from(value: MonitorKeyword) -> Self

Converts to this type from the input type.
source§

impl From<MonitorMongoDB> for Monitor

source§

fn from(value: MonitorMongoDB) -> Self

Converts to this type from the input type.
source§

impl From<MonitorMqtt> for Monitor

source§

fn from(value: MonitorMqtt) -> Self

Converts to this type from the input type.
source§

impl From<MonitorMysql> for Monitor

source§

fn from(value: MonitorMysql) -> Self

Converts to this type from the input type.
source§

impl From<MonitorPing> for Monitor

source§

fn from(value: MonitorPing) -> Self

Converts to this type from the input type.
source§

impl From<MonitorPort> for Monitor

source§

fn from(value: MonitorPort) -> Self

Converts to this type from the input type.
source§

impl From<MonitorPostgres> for Monitor

source§

fn from(value: MonitorPostgres) -> Self

Converts to this type from the input type.
source§

impl From<MonitorPush> for Monitor

source§

fn from(value: MonitorPush) -> Self

Converts to this type from the input type.
source§

impl From<MonitorRadius> for Monitor

source§

fn from(value: MonitorRadius) -> Self

Converts to this type from the input type.
source§

impl From<MonitorRealBrowser> for Monitor

source§

fn from(value: MonitorRealBrowser) -> Self

Converts to this type from the input type.
source§

impl From<MonitorRedis> for Monitor

source§

fn from(value: MonitorRedis) -> Self

Converts to this type from the input type.
source§

impl From<MonitorSqlServer> for Monitor

source§

fn from(value: MonitorSqlServer) -> Self

Converts to this type from the input type.
source§

impl From<MonitorSteam> for Monitor

source§

fn from(value: MonitorSteam) -> Self

Converts to this type from the input type.
source§

impl From<MonitorTailscalePing> for Monitor

source§

fn from(value: MonitorTailscalePing) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Monitor

source§

fn eq(&self, other: &Monitor) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Monitor

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for Monitor

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,