Struct doapi::DoManager [] [src]

pub struct DoManager<'t> {
    // some fields omitted
}

The main structure through which all calls are made. This holds a slice of the AUTH TOKEN

Methods

impl<'t> DoManager<'t>

fn with_token(token: &'t str) -> DoManager<'t>

Creates a new instance of DoManager with a string slice of your AUTH TOKEN

fn account(&self) -> RequestBuilder<'t, Account>

Returns a request that can be used to view account information.

Example

let domgr = DoManager::with_token("asfasdfasdf");
match domgr.account()
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}

fn regions(&self) -> RequestBuilder<'t, Regions>

Returns a request that can be used to list all regions

Example

let domgr = DoManager::with_token("asfasdfasdf");
match domgr.regions()
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}

fn sizes(&self) -> RequestBuilder<'t, Sizes>

Returns a request that can be used to list all available sizes

Example

let domgr = DoManager::with_token("asfasdfasdf");
match domgr.sizes()
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}

fn image(&self, id: &str) -> RequestBuilder<'t, Image>

Returns a request that can be used gain additional requests for a particular image

NOTE: id may either be an image ID, or slug

Example

let domgr = DoManager::with_token("asfasdfasdf");
// Or domgr.image("some slug")
match domgr.image("1234")
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}

fn images(&self) -> RequestBuilder<'t, Images>

Returns a request that can be used to view all available images, or actions on multiple

Example

let domgr = DoManager::with_token("asfasdfasdf");
match domgr.images()
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}

fn ssh_keys(&self) -> RequestBuilder<'t, SshKeys>

Returns a request that can be used to view all SSH keys or actions on multiple keys

Example

let domgr = DoManager::with_token("asfasdfasdf");
match domgr.ssh_keys()
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}

fn ssh_key(&self, id: &str) -> RequestBuilder<'t, SshKey>

Returns a request that can be used to view a single SSH key, or actions that apply to only one key

NOTE: id may either be an image ID, or slug

Example

let domgr = DoManager::with_token("asfasdfasdf");
// or domgr.ssh_key("some finger print")
match domgr.ssh_key("1234")
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}

fn droplet(&self, id: &str) -> RequestBuilder<'t, Droplet>

Returns a request that can be used to view a single droplet, or actions that only apply to one droplet

NOTE: id may either be an image ID, or slug

Example

let domgr = DoManager::with_token("asfasdfasdf");
match domgr.droplet("1234")
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}

fn droplets(&self) -> RequestBuilder<'t, Droplets>

Returns a request that can be used to view all available droplets, or actions that apply to multiple droplets

Example

let domgr = DoManager::with_token("asfasdfasdf");
match domgr.droplets()
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}

fn domains(&self) -> RequestBuilder<'t, Domains>

Returns a request that can be used to view all domains, or actions that apply to multiple

Example

let domgr = DoManager::with_token("asfasdfasdf");
match domgr.domains()
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}

fn domain(&self, name: &str) -> RequestBuilder<'t, Domain>

Returns a request that can be used to view a single domain, or actions that apply to only one

Example

let domgr = DoManager::with_token("asfasdfasdf");
match domgr.domain("super.com")
           .retrieve() {
    Ok(_)  => println!("Success"),
    Err(_) => println!("Error")
}