1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use  super::{Agent, Catalog, Health, Keystore, Session};

/// provides a client to the Consul API
pub struct Client{
    /// agent endpoint
    pub agent: Agent,
    /// catalog endpoint
    pub catalog: Catalog,
    /// health endpoint
    pub health: Health,
    pub keystore: Keystore,
    pub session: Session
}

impl Client {
    /// Constructs a consul client
    pub fn new(address: &str) -> Client {
        let agent = Agent::new(address);
        let catalog = Catalog::new(address);
        let health = Health::new(address);
        let keystore = Keystore::new(address);
        let session = Session::new(address);
        Client {
            agent:agent,
            catalog: catalog,
            health: health,
            session: session,
            keystore: keystore
        }
    }
}