Struct gcloud::InstanceOp
source · pub struct InstanceOp<'a> {
pub client: &'a Client<'a>,
}
Fields
client: &'a Client<'a>
Implementations
sourceimpl<'a> InstanceOp<'a>
impl<'a> InstanceOp<'a>
sourcepub fn list(&self) -> Result<InstanceItems, Box<dyn Error>>
pub fn list(&self) -> Result<InstanceItems, Box<dyn Error>>
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
Auto Trait Implementations
impl<'a> RefUnwindSafe for InstanceOp<'a>
impl<'a> Send for InstanceOp<'a>
impl<'a> Sync for InstanceOp<'a>
impl<'a> Unpin for InstanceOp<'a>
impl<'a> UnwindSafe for InstanceOp<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more