|
|
|
|
@@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg};
|
|
|
|
|
|
|
|
|
|
mod cmn;
|
|
|
|
|
|
|
|
|
|
use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg,
|
|
|
|
|
use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg,
|
|
|
|
|
input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol,
|
|
|
|
|
calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo};
|
|
|
|
|
|
|
|
|
|
@@ -36,19 +36,19 @@ enum DoitError {
|
|
|
|
|
ApiError(api::Error),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Engine<'n, 'a> {
|
|
|
|
|
opt: ArgMatches<'n, 'a>,
|
|
|
|
|
struct Engine<'n> {
|
|
|
|
|
opt: ArgMatches<'n>,
|
|
|
|
|
hub: api::Container<hyper::Client, Authenticator<DefaultAuthenticatorDelegate, JsonTokenStorage, hyper::Client>>,
|
|
|
|
|
gp: Vec<&'static str>,
|
|
|
|
|
gpm: Vec<(&'static str, &'static str)>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
fn _projects_clusters_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
impl<'n> Engine<'n> {
|
|
|
|
|
fn _projects_clusters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.projects().clusters_list(opt.value_of("project-id").unwrap_or(""));
|
|
|
|
|
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
let (key, value) = parse_kv_arg(&*parg, err, false);
|
|
|
|
|
match key {
|
|
|
|
|
_ => {
|
|
|
|
|
@@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
@@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
call = call.add_scope(scope);
|
|
|
|
|
}
|
|
|
|
|
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
|
|
|
|
@@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
fn _projects_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.projects().operations_list(opt.value_of("project-id").unwrap_or(""));
|
|
|
|
|
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
let (key, value) = parse_kv_arg(&*parg, err, false);
|
|
|
|
|
match key {
|
|
|
|
|
_ => {
|
|
|
|
|
@@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
@@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
call = call.add_scope(scope);
|
|
|
|
|
}
|
|
|
|
|
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
|
|
|
|
@@ -149,13 +149,13 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_zones_clusters_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
fn _projects_zones_clusters_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
|
|
|
|
|
let mut field_cursor = FieldCursor::default();
|
|
|
|
|
let mut object = json::value::Value::Object(Default::default());
|
|
|
|
|
|
|
|
|
|
for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
let last_errc = err.issues.len();
|
|
|
|
|
let (key, value) = parse_kv_arg(&*kvarg, err, false);
|
|
|
|
|
let mut temp_cursor = field_cursor.clone();
|
|
|
|
|
@@ -169,8 +169,8 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let type_info: Option<(&'static str, JsonTypeInfo)> =
|
|
|
|
|
|
|
|
|
|
let type_info: Option<(&'static str, JsonTypeInfo)> =
|
|
|
|
|
match &temp_cursor.to_string()[..] {
|
|
|
|
|
"cluster.status" => Some(("cluster.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
"cluster.container-ipv4-cidr" => Some(("cluster.containerIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
@@ -209,7 +209,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
let mut request: api::CreateClusterRequest = json::value::from_value(object).unwrap();
|
|
|
|
|
let mut call = self.hub.projects().zones_clusters_create(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or(""));
|
|
|
|
|
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
let (key, value) = parse_kv_arg(&*parg, err, false);
|
|
|
|
|
match key {
|
|
|
|
|
_ => {
|
|
|
|
|
@@ -222,7 +222,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
@@ -235,7 +235,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
call = call.add_scope(scope);
|
|
|
|
|
}
|
|
|
|
|
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
|
|
|
|
@@ -258,10 +258,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_zones_clusters_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
fn _projects_zones_clusters_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.projects().zones_clusters_delete(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or(""), opt.value_of("cluster-id").unwrap_or(""));
|
|
|
|
|
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
let (key, value) = parse_kv_arg(&*parg, err, false);
|
|
|
|
|
match key {
|
|
|
|
|
_ => {
|
|
|
|
|
@@ -274,7 +274,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
@@ -287,7 +287,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
call = call.add_scope(scope);
|
|
|
|
|
}
|
|
|
|
|
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
|
|
|
|
@@ -310,10 +310,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_zones_clusters_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
fn _projects_zones_clusters_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.projects().zones_clusters_get(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or(""), opt.value_of("cluster-id").unwrap_or(""));
|
|
|
|
|
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
let (key, value) = parse_kv_arg(&*parg, err, false);
|
|
|
|
|
match key {
|
|
|
|
|
_ => {
|
|
|
|
|
@@ -326,7 +326,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
@@ -339,7 +339,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
call = call.add_scope(scope);
|
|
|
|
|
}
|
|
|
|
|
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
|
|
|
|
@@ -362,10 +362,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_zones_clusters_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
fn _projects_zones_clusters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.projects().zones_clusters_list(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or(""));
|
|
|
|
|
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
let (key, value) = parse_kv_arg(&*parg, err, false);
|
|
|
|
|
match key {
|
|
|
|
|
_ => {
|
|
|
|
|
@@ -378,7 +378,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
@@ -391,7 +391,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
call = call.add_scope(scope);
|
|
|
|
|
}
|
|
|
|
|
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
|
|
|
|
@@ -414,10 +414,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_zones_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
fn _projects_zones_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.projects().zones_operations_get(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or(""), opt.value_of("operation-id").unwrap_or(""));
|
|
|
|
|
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
let (key, value) = parse_kv_arg(&*parg, err, false);
|
|
|
|
|
match key {
|
|
|
|
|
_ => {
|
|
|
|
|
@@ -430,7 +430,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
@@ -443,7 +443,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
call = call.add_scope(scope);
|
|
|
|
|
}
|
|
|
|
|
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
|
|
|
|
@@ -466,10 +466,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_zones_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
fn _projects_zones_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.projects().zones_operations_list(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or(""));
|
|
|
|
|
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
let (key, value) = parse_kv_arg(&*parg, err, false);
|
|
|
|
|
match key {
|
|
|
|
|
_ => {
|
|
|
|
|
@@ -482,7 +482,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
@@ -495,7 +495,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
|
|
|
|
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
|
|
|
|
call = call.add_scope(scope);
|
|
|
|
|
}
|
|
|
|
|
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
|
|
|
|
@@ -572,14 +572,14 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Please note that this call will fail if any part of the opt can't be handled
|
|
|
|
|
fn new(opt: ArgMatches<'a, 'n>) -> Result<Engine<'a, 'n>, InvalidOptionsError> {
|
|
|
|
|
fn new(opt: ArgMatches<'n>) -> Result<Engine<'n>, InvalidOptionsError> {
|
|
|
|
|
let (config_dir, secret) = {
|
|
|
|
|
let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) {
|
|
|
|
|
Err(e) => return Err(InvalidOptionsError::single(e, 3)),
|
|
|
|
|
Ok(p) => p,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
match cmn::application_secret_from_directory(&config_dir, "container1-beta1-secret.json",
|
|
|
|
|
match cmn::application_secret_from_directory(&config_dir, "container1-beta1-secret.json",
|
|
|
|
|
"{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") {
|
|
|
|
|
Ok(secret) => (config_dir, secret),
|
|
|
|
|
Err(e) => return Err(InvalidOptionsError::single(e, 4))
|
|
|
|
|
@@ -599,7 +599,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
|
|
|
|
db_dir: config_dir.clone(),
|
|
|
|
|
}, None);
|
|
|
|
|
|
|
|
|
|
let client =
|
|
|
|
|
let client =
|
|
|
|
|
if opt.is_present("debug") {
|
|
|
|
|
hyper::Client::with_connector(mock::TeeConnector {
|
|
|
|
|
connector: hyper::net::HttpsConnector::<hyper::net::Openssl>::default()
|
|
|
|
|
@@ -638,7 +638,7 @@ fn main() {
|
|
|
|
|
let mut exit_status = 0i32;
|
|
|
|
|
let arg_data = [
|
|
|
|
|
("projects", "methods: 'clusters-list', 'operations-list', 'zones-clusters-create', 'zones-clusters-delete', 'zones-clusters-get', 'zones-clusters-list', 'zones-operations-get' and 'zones-operations-list'", vec![
|
|
|
|
|
("clusters-list",
|
|
|
|
|
("clusters-list",
|
|
|
|
|
Some(r##"Lists all clusters owned by a project across all zones."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_clusters-list",
|
|
|
|
|
vec![
|
|
|
|
|
@@ -660,7 +660,7 @@ fn main() {
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("operations-list",
|
|
|
|
|
("operations-list",
|
|
|
|
|
Some(r##"Lists all operations in a project, across all zones."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_operations-list",
|
|
|
|
|
vec![
|
|
|
|
|
@@ -682,7 +682,7 @@ fn main() {
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("zones-clusters-create",
|
|
|
|
|
("zones-clusters-create",
|
|
|
|
|
Some(r##"Creates a cluster, consisting of the specified number and type of Google Compute Engine instances, plus a Kubernetes master instance.
|
|
|
|
|
|
|
|
|
|
The cluster is created in the project's default network.
|
|
|
|
|
@@ -722,7 +722,7 @@ fn main() {
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("zones-clusters-delete",
|
|
|
|
|
("zones-clusters-delete",
|
|
|
|
|
Some(r##"Deletes the cluster, including the Kubernetes master and all worker nodes.
|
|
|
|
|
|
|
|
|
|
Firewalls and routes that were configured at cluster creation are also deleted."##),
|
|
|
|
|
@@ -758,7 +758,7 @@ fn main() {
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("zones-clusters-get",
|
|
|
|
|
("zones-clusters-get",
|
|
|
|
|
Some(r##"Gets a specific cluster."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_zones-clusters-get",
|
|
|
|
|
vec![
|
|
|
|
|
@@ -792,7 +792,7 @@ fn main() {
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("zones-clusters-list",
|
|
|
|
|
("zones-clusters-list",
|
|
|
|
|
Some(r##"Lists all clusters owned by a project in the specified zone."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_zones-clusters-list",
|
|
|
|
|
vec![
|
|
|
|
|
@@ -820,7 +820,7 @@ fn main() {
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("zones-operations-get",
|
|
|
|
|
("zones-operations-get",
|
|
|
|
|
Some(r##"Gets the specified operation."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_zones-operations-get",
|
|
|
|
|
vec![
|
|
|
|
|
@@ -854,7 +854,7 @@ fn main() {
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("zones-operations-list",
|
|
|
|
|
("zones-operations-list",
|
|
|
|
|
Some(r##"Lists all operations in a project in a specific zone."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_zones-operations-list",
|
|
|
|
|
vec![
|
|
|
|
|
@@ -888,7 +888,7 @@ fn main() {
|
|
|
|
|
|
|
|
|
|
let mut app = App::new("container1-beta1")
|
|
|
|
|
.author("Sebastian Thiel <byronimo@gmail.com>")
|
|
|
|
|
.version("0.3.2+20151005")
|
|
|
|
|
.version("0.3.3+20151005")
|
|
|
|
|
.about("The Google Container Engine API is used for building and managing container based applications, powered by the open source Kubernetes technology.")
|
|
|
|
|
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_container1_beta1_cli")
|
|
|
|
|
.arg(Arg::with_name("url")
|
|
|
|
|
@@ -912,7 +912,7 @@ fn main() {
|
|
|
|
|
.multiple(false)
|
|
|
|
|
.takes_value(false));
|
|
|
|
|
|
|
|
|
|
for &(main_command_name, ref about, ref subcommands) in arg_data.iter() {
|
|
|
|
|
for &(main_command_name, about, ref subcommands) in arg_data.iter() {
|
|
|
|
|
let mut mcmd = SubCommand::with_name(main_command_name).about(about);
|
|
|
|
|
|
|
|
|
|
for &(sub_command_name, ref desc, url_info, ref args) in subcommands {
|
|
|
|
|
@@ -923,7 +923,7 @@ fn main() {
|
|
|
|
|
scmd = scmd.after_help(url_info);
|
|
|
|
|
|
|
|
|
|
for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args {
|
|
|
|
|
let arg_name_str =
|
|
|
|
|
let arg_name_str =
|
|
|
|
|
match (arg_name, flag) {
|
|
|
|
|
(&Some(an), _ ) => an,
|
|
|
|
|
(_ , &Some(f)) => f,
|
|
|
|
|
|