chore(code-update):added latest version of api+cli

APIs have additional files thanks to the build-script
requirement.
CLI has just seen minor changes though, making it
usable with a stable compiler.
This commit is contained in:
Sebastian Thiel
2015-06-19 13:27:40 +02:00
parent e336d37d13
commit 3484fecf9c
835 changed files with 641668 additions and 659095 deletions

View File

@@ -1,7 +1,6 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/mako/cli/main.rs.mako'
// DO NOT EDIT !
#![feature(plugin, exit_status)]
#![allow(unused_variables, unused_imports, dead_code, unused_mut)]
#[macro_use]
@@ -22,7 +21,7 @@ mod cmn;
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};
calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo};
use std::default::Default;
use std::str::FromStr;
@@ -61,9 +60,11 @@ impl<'n, 'a> Engine<'n, 'a> {
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
Vec::new() + &self.gp + &[]
));
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v.extend([].iter().map(|v|*v));
v } ));
}
}
}
@@ -104,9 +105,11 @@ impl<'n, 'a> Engine<'n, 'a> {
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
Vec::new() + &self.gp + &[]
));
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v.extend([].iter().map(|v|*v));
v } ));
}
}
}
@@ -131,7 +134,7 @@ impl<'n, 'a> Engine<'n, 'a> {
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema);
remove_json_null_values(&mut value);
serde::json::to_writer_pretty(&mut ostream, &value).unwrap();
json::to_writer_pretty(&mut ostream, &value).unwrap();
Ok(())
}
}
@@ -141,8 +144,9 @@ impl<'n, 'a> Engine<'n, 'a> {
fn _license_assignments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
-> Result<(), DoitError> {
let mut request = api::LicenseAssignmentInsert::default();
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() {
let last_errc = err.issues.len();
let (key, value) = parse_kv_arg(&*kvarg, err, false);
@@ -157,16 +161,21 @@ impl<'n, 'a> Engine<'n, 'a> {
}
continue;
}
match &temp_cursor.to_string()[..] {
"user-id" => {
request.user_id = Some(value.unwrap_or("").to_string());
},
_ => {
let suggestion = FieldCursor::did_you_mean(key, &vec!["user-id"]);
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string()))));
}
let type_info =
match &temp_cursor.to_string()[..] {
"user-id" => Some(("userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
_ => {
let suggestion = FieldCursor::did_you_mean(key, &vec!["user-id"]);
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string()))));
None
}
};
if let Some((field_cursor_str, type_info)) = type_info {
FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor);
}
}
let mut request: api::LicenseAssignmentInsert = json::value::from_value(object).unwrap();
let mut call = self.hub.license_assignments().insert(request, opt.value_of("product-id").unwrap_or(""), opt.value_of("sku-id").unwrap_or(""));
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
@@ -181,9 +190,11 @@ impl<'n, 'a> Engine<'n, 'a> {
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
Vec::new() + &self.gp + &[]
));
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v.extend([].iter().map(|v|*v));
v } ));
}
}
}
@@ -208,7 +219,7 @@ impl<'n, 'a> Engine<'n, 'a> {
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema);
remove_json_null_values(&mut value);
serde::json::to_writer_pretty(&mut ostream, &value).unwrap();
json::to_writer_pretty(&mut ostream, &value).unwrap();
Ok(())
}
}
@@ -237,9 +248,11 @@ impl<'n, 'a> Engine<'n, 'a> {
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
Vec::new() + &self.gp + &["page-token", "max-results"]
));
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v.extend(["page-token", "max-results"].iter().map(|v|*v));
v } ));
}
}
}
@@ -264,7 +277,7 @@ impl<'n, 'a> Engine<'n, 'a> {
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema);
remove_json_null_values(&mut value);
serde::json::to_writer_pretty(&mut ostream, &value).unwrap();
json::to_writer_pretty(&mut ostream, &value).unwrap();
Ok(())
}
}
@@ -293,9 +306,11 @@ impl<'n, 'a> Engine<'n, 'a> {
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
Vec::new() + &self.gp + &["page-token", "max-results"]
));
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v.extend(["page-token", "max-results"].iter().map(|v|*v));
v } ));
}
}
}
@@ -320,7 +335,7 @@ impl<'n, 'a> Engine<'n, 'a> {
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema);
remove_json_null_values(&mut value);
serde::json::to_writer_pretty(&mut ostream, &value).unwrap();
json::to_writer_pretty(&mut ostream, &value).unwrap();
Ok(())
}
}
@@ -330,8 +345,9 @@ impl<'n, 'a> Engine<'n, 'a> {
fn _license_assignments_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
-> Result<(), DoitError> {
let mut request = api::LicenseAssignment::default();
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() {
let last_errc = err.issues.len();
let (key, value) = parse_kv_arg(&*kvarg, err, false);
@@ -346,31 +362,26 @@ impl<'n, 'a> Engine<'n, 'a> {
}
continue;
}
match &temp_cursor.to_string()[..] {
"sku-id" => {
request.sku_id = Some(value.unwrap_or("").to_string());
},
"kind" => {
request.kind = Some(value.unwrap_or("").to_string());
},
"user-id" => {
request.user_id = Some(value.unwrap_or("").to_string());
},
"etags" => {
request.etags = Some(value.unwrap_or("").to_string());
},
"self-link" => {
request.self_link = Some(value.unwrap_or("").to_string());
},
"product-id" => {
request.product_id = Some(value.unwrap_or("").to_string());
},
_ => {
let suggestion = FieldCursor::did_you_mean(key, &vec!["etags", "kind", "product-id", "self-link", "sku-id", "user-id"]);
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string()))));
}
let type_info =
match &temp_cursor.to_string()[..] {
"sku-id" => Some(("skuId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"user-id" => Some(("userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"etags" => Some(("etags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
_ => {
let suggestion = FieldCursor::did_you_mean(key, &vec!["etags", "kind", "product-id", "self-link", "sku-id", "user-id"]);
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string()))));
None
}
};
if let Some((field_cursor_str, type_info)) = type_info {
FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor);
}
}
let mut request: api::LicenseAssignment = json::value::from_value(object).unwrap();
let mut call = self.hub.license_assignments().patch(request, opt.value_of("product-id").unwrap_or(""), opt.value_of("sku-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""));
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
@@ -385,9 +396,11 @@ impl<'n, 'a> Engine<'n, 'a> {
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
Vec::new() + &self.gp + &[]
));
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v.extend([].iter().map(|v|*v));
v } ));
}
}
}
@@ -412,7 +425,7 @@ impl<'n, 'a> Engine<'n, 'a> {
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema);
remove_json_null_values(&mut value);
serde::json::to_writer_pretty(&mut ostream, &value).unwrap();
json::to_writer_pretty(&mut ostream, &value).unwrap();
Ok(())
}
}
@@ -422,8 +435,9 @@ impl<'n, 'a> Engine<'n, 'a> {
fn _license_assignments_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
-> Result<(), DoitError> {
let mut request = api::LicenseAssignment::default();
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() {
let last_errc = err.issues.len();
let (key, value) = parse_kv_arg(&*kvarg, err, false);
@@ -438,31 +452,26 @@ impl<'n, 'a> Engine<'n, 'a> {
}
continue;
}
match &temp_cursor.to_string()[..] {
"sku-id" => {
request.sku_id = Some(value.unwrap_or("").to_string());
},
"kind" => {
request.kind = Some(value.unwrap_or("").to_string());
},
"user-id" => {
request.user_id = Some(value.unwrap_or("").to_string());
},
"etags" => {
request.etags = Some(value.unwrap_or("").to_string());
},
"self-link" => {
request.self_link = Some(value.unwrap_or("").to_string());
},
"product-id" => {
request.product_id = Some(value.unwrap_or("").to_string());
},
_ => {
let suggestion = FieldCursor::did_you_mean(key, &vec!["etags", "kind", "product-id", "self-link", "sku-id", "user-id"]);
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string()))));
}
let type_info =
match &temp_cursor.to_string()[..] {
"sku-id" => Some(("skuId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"user-id" => Some(("userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"etags" => Some(("etags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
_ => {
let suggestion = FieldCursor::did_you_mean(key, &vec!["etags", "kind", "product-id", "self-link", "sku-id", "user-id"]);
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string()))));
None
}
};
if let Some((field_cursor_str, type_info)) = type_info {
FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor);
}
}
let mut request: api::LicenseAssignment = json::value::from_value(object).unwrap();
let mut call = self.hub.license_assignments().update(request, opt.value_of("product-id").unwrap_or(""), opt.value_of("sku-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""));
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
@@ -477,9 +486,11 @@ impl<'n, 'a> Engine<'n, 'a> {
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
Vec::new() + &self.gp + &[]
));
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v.extend([].iter().map(|v|*v));
v } ));
}
}
}
@@ -504,7 +515,7 @@ impl<'n, 'a> Engine<'n, 'a> {
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema);
remove_json_null_values(&mut value);
serde::json::to_writer_pretty(&mut ostream, &value).unwrap();
json::to_writer_pretty(&mut ostream, &value).unwrap();
Ok(())
}
}
@@ -625,6 +636,7 @@ impl<'n, 'a> Engine<'n, 'a> {
}
fn main() {
let mut exit_status = 0i32;
let arg_data = [
("license-assignments", "methods: 'delete', 'get', 'insert', 'list-for-product', 'list-for-product-and-sku', 'patch' and 'update'", vec![
("delete",
@@ -871,7 +883,7 @@ fn main() {
let mut app = App::new("licensing1")
.author("Sebastian Thiel <byronimo@gmail.com>")
.version("0.2.0+20140122")
.version("0.3.0+20140122")
.about("Licensing API to view and manage license for your domain.")
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_licensing1_cli")
.arg(Arg::with_name("url")
@@ -912,7 +924,8 @@ fn main() {
(_ , &Some(f)) => f,
_ => unreachable!(),
};
let mut arg = Arg::with_name(arg_name_str);
let mut arg = Arg::with_name(arg_name_str)
.empty_values(false);
if let &Some(short_flag) = flag {
arg = arg.short(short_flag);
}
@@ -940,12 +953,12 @@ fn main() {
let debug = matches.is_present("debug");
match Engine::new(matches) {
Err(err) => {
env::set_exit_status(err.exit_code);
exit_status = err.exit_code;
writeln!(io::stderr(), "{}", err).ok();
},
Ok(engine) => {
if let Err(doit_err) = engine.doit() {
env::set_exit_status(1);
exit_status = 1;
match doit_err {
DoitError::IoError(path, err) => {
writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok();
@@ -961,4 +974,6 @@ fn main() {
}
}
}
std::process::exit(exit_status);
}