Crate node_discover[−][src]
Expand description
Retrieve IP addresses of nodes from a provider.
Query DigitalOcean for droplets in region “lon1” and with tag “cool-tag”
use node_discover::get_addresses;
#[tokio::main]
async fn main() {
let args = "provider=digitalocean region=lon1 tag_name=cool-tag".to_string();
let res = get_addresses(args).await;
match res {
Ok(addrs) => println!("{:?}", addrs),
Err(e) => println!("Error: {}", e),
};
}
Query AWS for instances in region “eu-west-1” and with name=cool-name and get their private ipv4 addrs
use node_discover::get_addresses;
#[tokio::main]
async fn main() {
let args = "provider=aws region=eu-west-1 tag_key=Name tag_value=cool-name addr_type=private_v4".to_string();
let res = get_addresses(args).await;
match res {
Ok(addrs) => println!("{:?}", addrs),
Err(e) => println!("Error: {}", e),
};
}