get_monitors/get_monitors.rs
1use kuma_client::{Client, Config, Url};
2
3#[tokio::main()]
4async fn main() {
5 let client = Client::connect(Config {
6 url: Url::parse("http://localhost:3001").expect("Invalid URL"),
7 username: Some("Username".to_owned()),
8 password: Some("Password".to_owned()),
9 ..Default::default()
10 })
11 .await
12 .expect("Failed to connect to server");
13
14 let monitors = client.get_monitors().await.expect("Failed to get monitors");
15 println!("{:?}", monitors);
16}