mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
fix(version-up): code updated to v0.1.6, latest CLI
* also includes publishing tag files
This commit is contained in:
@@ -19,32 +19,33 @@ use std::io::{self, Write};
|
||||
|
||||
docopt!(Options derive Debug, "
|
||||
Usage:
|
||||
licensing1 [options] license-assignments delete <product-id> <sku-id> <user-id> [-p <v>]...
|
||||
licensing1 [options] license-assignments get <product-id> <sku-id> <user-id> [-p <v>]... [-o <out>]
|
||||
licensing1 [options] license-assignments insert <product-id> <sku-id> -r <kv>... [-p <v>]... [-o <out>]
|
||||
licensing1 [options] license-assignments list-for-product <product-id> <customer-id> [-p <v>]... [-o <out>]
|
||||
licensing1 [options] license-assignments list-for-product-and-sku <product-id> <sku-id> <customer-id> [-p <v>]... [-o <out>]
|
||||
licensing1 [options] license-assignments patch <product-id> <sku-id> <user-id> -r <kv>... [-p <v>]... [-o <out>]
|
||||
licensing1 [options] license-assignments update <product-id> <sku-id> <user-id> -r <kv>... [-p <v>]... [-o <out>]
|
||||
licensing1 [options] license-assignments delete <product-id> <sku-id> <user-id> [-p <v>...]
|
||||
licensing1 [options] license-assignments get <product-id> <sku-id> <user-id> [-p <v>...] [-o <out>]
|
||||
licensing1 [options] license-assignments insert <product-id> <sku-id> -r <kv>... [-p <v>...] [-o <out>]
|
||||
licensing1 [options] license-assignments list-for-product <product-id> <customer-id> [-p <v>...] [-o <out>]
|
||||
licensing1 [options] license-assignments list-for-product-and-sku <product-id> <sku-id> <customer-id> [-p <v>...] [-o <out>]
|
||||
licensing1 [options] license-assignments patch <product-id> <sku-id> <user-id> -r <kv>... [-p <v>...] [-o <out>]
|
||||
licensing1 [options] license-assignments update <product-id> <sku-id> <user-id> -r <kv>... [-p <v>...] [-o <out>]
|
||||
licensing1 --help
|
||||
|
||||
All documentation details can be found TODO: <URL to github.io docs here, see #51>
|
||||
All documentation details can be found at
|
||||
http://byron.github.io/google-apis-rs/google_licensing1_cli/index.html
|
||||
|
||||
Configuration:
|
||||
--scope <url>
|
||||
Specify the authentication a method should be executed in. Each scope requires
|
||||
the user to grant this application permission to use it.
|
||||
Specify the authentication a method should be executed in. Each scope
|
||||
requires the user to grant this application permission to use it.
|
||||
If unset, it defaults to the shortest scope url for a particular method.
|
||||
--config-dir <folder>
|
||||
A directory into which we will store our persistent data. Defaults to a user-writable
|
||||
directory that we will create during the first invocation.
|
||||
A directory into which we will store our persistent data. Defaults to
|
||||
a user-writable directory that we will create during the first invocation.
|
||||
[default: ~/.google-service-cli]
|
||||
--debug
|
||||
Output all server communication to standard error. `tx` and `rx` are placed into
|
||||
the same stream.
|
||||
Output all server communication to standard error. `tx` and `rx` are placed
|
||||
into the same stream.
|
||||
--debug-auth
|
||||
Output all communication related to authentication to standard error. `tx` and `rx` are placed into
|
||||
the same stream.
|
||||
Output all communication related to authentication to standard error. `tx`
|
||||
and `rx` are placed into the same stream.
|
||||
");
|
||||
|
||||
mod cmn;
|
||||
@@ -93,6 +94,9 @@ impl Engine {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
_ => unreachable!(),
|
||||
@@ -134,6 +138,9 @@ impl Engine {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -150,8 +157,33 @@ impl Engine {
|
||||
|
||||
fn _license_assignments_insert(&self, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Option<api::Error> {
|
||||
|
||||
let mut request = api::LicenseAssignmentInsert::default();
|
||||
let mut call = self.hub.license_assignments().insert(&request, &self.opt.arg_product_id, &self.opt.arg_sku_id);
|
||||
let mut field_cursor = FieldCursor::default();
|
||||
for kvarg in self.opt.arg_kv.iter() {
|
||||
let last_errc = err.issues.len();
|
||||
let (key, value) = parse_kv_arg(&*kvarg, err, false);
|
||||
let mut temp_cursor = field_cursor.clone();
|
||||
if let Err(field_err) = temp_cursor.set(&*key) {
|
||||
err.issues.push(field_err);
|
||||
}
|
||||
if value.is_none() {
|
||||
field_cursor = temp_cursor.clone();
|
||||
if err.issues.len() > last_errc {
|
||||
err.issues.remove(last_errc);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
match &temp_cursor.to_string()[..] {
|
||||
"user-id" => {
|
||||
request.user_id = Some(value.unwrap_or("").to_string());
|
||||
},
|
||||
_ => {
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut call = self.hub.license_assignments().insert(request, &self.opt.arg_product_id, &self.opt.arg_sku_id);
|
||||
for parg in self.opt.arg_v.iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
@@ -173,27 +205,14 @@ impl Engine {
|
||||
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
let mut field_name = FieldCursor::default();
|
||||
for kvarg in self.opt.arg_kv.iter() {
|
||||
let (key, value) = parse_kv_arg(&*kvarg, err, false);
|
||||
if let Err(field_err) = field_name.set(&*key) {
|
||||
err.issues.push(field_err);
|
||||
}
|
||||
match &field_name.to_string()[..] {
|
||||
"user-id" => {
|
||||
request.user_id = Some(value.unwrap_or("").to_string());
|
||||
},
|
||||
_ => {
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
|
||||
}
|
||||
}
|
||||
}
|
||||
let protocol = "standard-request";
|
||||
if dry_run {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -243,6 +262,9 @@ impl Engine {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -292,6 +314,9 @@ impl Engine {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -308,8 +333,48 @@ impl Engine {
|
||||
|
||||
fn _license_assignments_patch(&self, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Option<api::Error> {
|
||||
|
||||
let mut request = api::LicenseAssignment::default();
|
||||
let mut call = self.hub.license_assignments().patch(&request, &self.opt.arg_product_id, &self.opt.arg_sku_id, &self.opt.arg_user_id);
|
||||
let mut field_cursor = FieldCursor::default();
|
||||
for kvarg in self.opt.arg_kv.iter() {
|
||||
let last_errc = err.issues.len();
|
||||
let (key, value) = parse_kv_arg(&*kvarg, err, false);
|
||||
let mut temp_cursor = field_cursor.clone();
|
||||
if let Err(field_err) = temp_cursor.set(&*key) {
|
||||
err.issues.push(field_err);
|
||||
}
|
||||
if value.is_none() {
|
||||
field_cursor = temp_cursor.clone();
|
||||
if err.issues.len() > last_errc {
|
||||
err.issues.remove(last_errc);
|
||||
}
|
||||
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());
|
||||
},
|
||||
_ => {
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut call = self.hub.license_assignments().patch(request, &self.opt.arg_product_id, &self.opt.arg_sku_id, &self.opt.arg_user_id);
|
||||
for parg in self.opt.arg_v.iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
@@ -331,42 +396,14 @@ impl Engine {
|
||||
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
let mut field_name = FieldCursor::default();
|
||||
for kvarg in self.opt.arg_kv.iter() {
|
||||
let (key, value) = parse_kv_arg(&*kvarg, err, false);
|
||||
if let Err(field_err) = field_name.set(&*key) {
|
||||
err.issues.push(field_err);
|
||||
}
|
||||
match &field_name.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());
|
||||
},
|
||||
_ => {
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
|
||||
}
|
||||
}
|
||||
}
|
||||
let protocol = "standard-request";
|
||||
if dry_run {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -383,8 +420,48 @@ impl Engine {
|
||||
|
||||
fn _license_assignments_update(&self, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Option<api::Error> {
|
||||
|
||||
let mut request = api::LicenseAssignment::default();
|
||||
let mut call = self.hub.license_assignments().update(&request, &self.opt.arg_product_id, &self.opt.arg_sku_id, &self.opt.arg_user_id);
|
||||
let mut field_cursor = FieldCursor::default();
|
||||
for kvarg in self.opt.arg_kv.iter() {
|
||||
let last_errc = err.issues.len();
|
||||
let (key, value) = parse_kv_arg(&*kvarg, err, false);
|
||||
let mut temp_cursor = field_cursor.clone();
|
||||
if let Err(field_err) = temp_cursor.set(&*key) {
|
||||
err.issues.push(field_err);
|
||||
}
|
||||
if value.is_none() {
|
||||
field_cursor = temp_cursor.clone();
|
||||
if err.issues.len() > last_errc {
|
||||
err.issues.remove(last_errc);
|
||||
}
|
||||
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());
|
||||
},
|
||||
_ => {
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut call = self.hub.license_assignments().update(request, &self.opt.arg_product_id, &self.opt.arg_sku_id, &self.opt.arg_user_id);
|
||||
for parg in self.opt.arg_v.iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
@@ -406,42 +483,14 @@ impl Engine {
|
||||
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
let mut field_name = FieldCursor::default();
|
||||
for kvarg in self.opt.arg_kv.iter() {
|
||||
let (key, value) = parse_kv_arg(&*kvarg, err, false);
|
||||
if let Err(field_err) = field_name.set(&*key) {
|
||||
err.issues.push(field_err);
|
||||
}
|
||||
match &field_name.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());
|
||||
},
|
||||
_ => {
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
|
||||
}
|
||||
}
|
||||
}
|
||||
let protocol = "standard-request";
|
||||
if dry_run {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -547,6 +596,7 @@ impl Engine {
|
||||
|
||||
fn main() {
|
||||
let opts: Options = Options::docopt().decode().unwrap_or_else(|e| e.exit());
|
||||
let debug = opts.flag_debug;
|
||||
match Engine::new(opts) {
|
||||
Err(err) => {
|
||||
writeln!(io::stderr(), "{}", err).ok();
|
||||
@@ -554,8 +604,11 @@ fn main() {
|
||||
},
|
||||
Ok(engine) => {
|
||||
if let Some(err) = engine.doit() {
|
||||
writeln!(io::stderr(), "{:?}", err).ok();
|
||||
writeln!(io::stderr(), "{}", err).ok();
|
||||
if debug {
|
||||
writeln!(io::stderr(), "{:?}", err).ok();
|
||||
} else {
|
||||
writeln!(io::stderr(), "{}", err).ok();
|
||||
}
|
||||
env::set_exit_status(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user