Struct gcloud::InstanceOp

source ·
pub struct InstanceOp<'a> {
    pub client: &'a Client<'a>,
}

Fields

client: &'a Client<'a>

Implementations

Get Google Cloud compute instance list

Examples
use std::env;
use gcloud::{Client, InstanceOp};

fn env_var(key: &str) -> String {
    env::var(key).expect(&format!("{} environment variable is required", key))
}

let client = Client {
    project: &env_var("PROJECT"),
    zone: &env_var("ZONE"),
    client_secret: &env_var("CLIENT_SECRET"),
    client_id: &env_var("CLIENT_ID"),
    refresh_token: &env_var("REFRESH_TOKEN"),
};
let instances = InstanceOp { client: &client }.list().unwrap();
println!("{:#?}", instances);
assert!(
    instances.len() > 0,
    "instances.len() > 0 ==> {} is not higher than 0",
    instances.len()
);

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Executes a closure on an object.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.