|
|
|
|
@@ -48,39 +48,7 @@ struct Engine<'n> {
|
|
|
|
|
impl<'n> Engine<'n> {
|
|
|
|
|
fn _operations_cancel(&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").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();
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let type_info: Option<(&'static str, JsonTypeInfo)> =
|
|
|
|
|
match &temp_cursor.to_string()[..] {
|
|
|
|
|
_ => {
|
|
|
|
|
let suggestion = FieldCursor::did_you_mean(key, &vec![]);
|
|
|
|
|
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::GoogleLongrunning_CancelOperationRequest = json::value::from_value(object).unwrap();
|
|
|
|
|
let mut call = self.hub.operations().cancel(request, opt.value_of("name").unwrap_or(""));
|
|
|
|
|
let mut call = self.hub.operations().cancel(opt.value_of("name").unwrap_or(""));
|
|
|
|
|
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 {
|
|
|
|
|
@@ -234,9 +202,353 @@ impl<'n> Engine<'n> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
fn _operations_projects_locations_operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.operations().list();
|
|
|
|
|
let mut call = self.hub.operations().projects_locations_operations_cancel(opt.value_of("name").unwrap_or(""));
|
|
|
|
|
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 {
|
|
|
|
|
_ => {
|
|
|
|
|
let mut found = false;
|
|
|
|
|
for param in &self.gp {
|
|
|
|
|
if key == *param {
|
|
|
|
|
found = true;
|
|
|
|
|
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let protocol = CallType::Standard;
|
|
|
|
|
if dry_run {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
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")) {
|
|
|
|
|
Ok(mut f) => f,
|
|
|
|
|
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
|
|
|
|
|
};
|
|
|
|
|
match match protocol {
|
|
|
|
|
CallType::Standard => call.doit(),
|
|
|
|
|
_ => unreachable!()
|
|
|
|
|
} {
|
|
|
|
|
Err(api_err) => Err(DoitError::ApiError(api_err)),
|
|
|
|
|
Ok((mut response, output_schema)) => {
|
|
|
|
|
let mut value = json::value::to_value(&output_schema).expect("serde to work");
|
|
|
|
|
remove_json_null_values(&mut value);
|
|
|
|
|
json::to_writer_pretty(&mut ostream, &value).unwrap();
|
|
|
|
|
ostream.flush().unwrap();
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _operations_projects_locations_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.operations().projects_locations_operations_delete(opt.value_of("name").unwrap_or(""));
|
|
|
|
|
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 {
|
|
|
|
|
_ => {
|
|
|
|
|
let mut found = false;
|
|
|
|
|
for param in &self.gp {
|
|
|
|
|
if key == *param {
|
|
|
|
|
found = true;
|
|
|
|
|
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let protocol = CallType::Standard;
|
|
|
|
|
if dry_run {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
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")) {
|
|
|
|
|
Ok(mut f) => f,
|
|
|
|
|
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
|
|
|
|
|
};
|
|
|
|
|
match match protocol {
|
|
|
|
|
CallType::Standard => call.doit(),
|
|
|
|
|
_ => unreachable!()
|
|
|
|
|
} {
|
|
|
|
|
Err(api_err) => Err(DoitError::ApiError(api_err)),
|
|
|
|
|
Ok((mut response, output_schema)) => {
|
|
|
|
|
let mut value = json::value::to_value(&output_schema).expect("serde to work");
|
|
|
|
|
remove_json_null_values(&mut value);
|
|
|
|
|
json::to_writer_pretty(&mut ostream, &value).unwrap();
|
|
|
|
|
ostream.flush().unwrap();
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _operations_projects_locations_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.operations().projects_locations_operations_get(opt.value_of("name").unwrap_or(""));
|
|
|
|
|
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 {
|
|
|
|
|
_ => {
|
|
|
|
|
let mut found = false;
|
|
|
|
|
for param in &self.gp {
|
|
|
|
|
if key == *param {
|
|
|
|
|
found = true;
|
|
|
|
|
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let protocol = CallType::Standard;
|
|
|
|
|
if dry_run {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
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")) {
|
|
|
|
|
Ok(mut f) => f,
|
|
|
|
|
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
|
|
|
|
|
};
|
|
|
|
|
match match protocol {
|
|
|
|
|
CallType::Standard => call.doit(),
|
|
|
|
|
_ => unreachable!()
|
|
|
|
|
} {
|
|
|
|
|
Err(api_err) => Err(DoitError::ApiError(api_err)),
|
|
|
|
|
Ok((mut response, output_schema)) => {
|
|
|
|
|
let mut value = json::value::to_value(&output_schema).expect("serde to work");
|
|
|
|
|
remove_json_null_values(&mut value);
|
|
|
|
|
json::to_writer_pretty(&mut ostream, &value).unwrap();
|
|
|
|
|
ostream.flush().unwrap();
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_locations_operations_cancel(&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").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();
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let type_info: Option<(&'static str, JsonTypeInfo)> =
|
|
|
|
|
match &temp_cursor.to_string()[..] {
|
|
|
|
|
_ => {
|
|
|
|
|
let suggestion = FieldCursor::did_you_mean(key, &vec![]);
|
|
|
|
|
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::GoogleLongrunning_CancelOperationRequest = json::value::from_value(object).unwrap();
|
|
|
|
|
let mut call = self.hub.projects().locations_operations_cancel(request, opt.value_of("name").unwrap_or(""));
|
|
|
|
|
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 {
|
|
|
|
|
_ => {
|
|
|
|
|
let mut found = false;
|
|
|
|
|
for param in &self.gp {
|
|
|
|
|
if key == *param {
|
|
|
|
|
found = true;
|
|
|
|
|
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let protocol = CallType::Standard;
|
|
|
|
|
if dry_run {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
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")) {
|
|
|
|
|
Ok(mut f) => f,
|
|
|
|
|
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
|
|
|
|
|
};
|
|
|
|
|
match match protocol {
|
|
|
|
|
CallType::Standard => call.doit(),
|
|
|
|
|
_ => unreachable!()
|
|
|
|
|
} {
|
|
|
|
|
Err(api_err) => Err(DoitError::ApiError(api_err)),
|
|
|
|
|
Ok((mut response, output_schema)) => {
|
|
|
|
|
let mut value = json::value::to_value(&output_schema).expect("serde to work");
|
|
|
|
|
remove_json_null_values(&mut value);
|
|
|
|
|
json::to_writer_pretty(&mut ostream, &value).unwrap();
|
|
|
|
|
ostream.flush().unwrap();
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_locations_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.projects().locations_operations_delete(opt.value_of("name").unwrap_or(""));
|
|
|
|
|
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 {
|
|
|
|
|
_ => {
|
|
|
|
|
let mut found = false;
|
|
|
|
|
for param in &self.gp {
|
|
|
|
|
if key == *param {
|
|
|
|
|
found = true;
|
|
|
|
|
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let protocol = CallType::Standard;
|
|
|
|
|
if dry_run {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
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")) {
|
|
|
|
|
Ok(mut f) => f,
|
|
|
|
|
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
|
|
|
|
|
};
|
|
|
|
|
match match protocol {
|
|
|
|
|
CallType::Standard => call.doit(),
|
|
|
|
|
_ => unreachable!()
|
|
|
|
|
} {
|
|
|
|
|
Err(api_err) => Err(DoitError::ApiError(api_err)),
|
|
|
|
|
Ok((mut response, output_schema)) => {
|
|
|
|
|
let mut value = json::value::to_value(&output_schema).expect("serde to work");
|
|
|
|
|
remove_json_null_values(&mut value);
|
|
|
|
|
json::to_writer_pretty(&mut ostream, &value).unwrap();
|
|
|
|
|
ostream.flush().unwrap();
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_locations_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.projects().locations_operations_get(opt.value_of("name").unwrap_or(""));
|
|
|
|
|
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 {
|
|
|
|
|
_ => {
|
|
|
|
|
let mut found = false;
|
|
|
|
|
for param in &self.gp {
|
|
|
|
|
if key == *param {
|
|
|
|
|
found = true;
|
|
|
|
|
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !found {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let protocol = CallType::Standard;
|
|
|
|
|
if dry_run {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
assert!(err.issues.len() == 0);
|
|
|
|
|
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")) {
|
|
|
|
|
Ok(mut f) => f,
|
|
|
|
|
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
|
|
|
|
|
};
|
|
|
|
|
match match protocol {
|
|
|
|
|
CallType::Standard => call.doit(),
|
|
|
|
|
_ => unreachable!()
|
|
|
|
|
} {
|
|
|
|
|
Err(api_err) => Err(DoitError::ApiError(api_err)),
|
|
|
|
|
Ok((mut response, output_schema)) => {
|
|
|
|
|
let mut value = json::value::to_value(&output_schema).expect("serde to work");
|
|
|
|
|
remove_json_null_values(&mut value);
|
|
|
|
|
json::to_writer_pretty(&mut ostream, &value).unwrap();
|
|
|
|
|
ostream.flush().unwrap();
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn _projects_locations_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
|
|
|
|
-> Result<(), DoitError> {
|
|
|
|
|
let mut call = self.hub.projects().locations_operations_list(opt.value_of("name").unwrap_or(""));
|
|
|
|
|
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 {
|
|
|
|
|
@@ -246,9 +558,6 @@ impl<'n> Engine<'n> {
|
|
|
|
|
"page-size" => {
|
|
|
|
|
call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer"));
|
|
|
|
|
},
|
|
|
|
|
"name" => {
|
|
|
|
|
call = call.name(value.unwrap_or(""));
|
|
|
|
|
},
|
|
|
|
|
"filter" => {
|
|
|
|
|
call = call.filter(value.unwrap_or(""));
|
|
|
|
|
},
|
|
|
|
|
@@ -265,7 +574,7 @@ impl<'n> Engine<'n> {
|
|
|
|
|
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
|
|
|
|
{let mut v = Vec::new();
|
|
|
|
|
v.extend(self.gp.iter().map(|v|*v));
|
|
|
|
|
v.extend(["filter", "page-token", "name", "page-size"].iter().map(|v|*v));
|
|
|
|
|
v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v));
|
|
|
|
|
v } ));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -324,7 +633,7 @@ impl<'n> Engine<'n> {
|
|
|
|
|
match &temp_cursor.to_string()[..] {
|
|
|
|
|
"video-context.shot-change-detection-config.model" => Some(("videoContext.shotChangeDetectionConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
"video-context.text-detection-config.language-hints" => Some(("videoContext.textDetectionConfig.languageHints", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })),
|
|
|
|
|
"video-context.explicit-content-detection-config.model" => Some(("videoContext.explicitContentDetectionConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
"video-context.text-detection-config.model" => Some(("videoContext.textDetectionConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
"video-context.speech-transcription-config.language-code" => Some(("videoContext.speechTranscriptionConfig.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
"video-context.speech-transcription-config.filter-profanity" => Some(("videoContext.speechTranscriptionConfig.filterProfanity", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })),
|
|
|
|
|
"video-context.speech-transcription-config.enable-automatic-punctuation" => Some(("videoContext.speechTranscriptionConfig.enableAutomaticPunctuation", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })),
|
|
|
|
|
@@ -338,13 +647,15 @@ impl<'n> Engine<'n> {
|
|
|
|
|
"video-context.label-detection-config.stationary-camera" => Some(("videoContext.labelDetectionConfig.stationaryCamera", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })),
|
|
|
|
|
"video-context.label-detection-config.frame-confidence-threshold" => Some(("videoContext.labelDetectionConfig.frameConfidenceThreshold", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })),
|
|
|
|
|
"video-context.label-detection-config.video-confidence-threshold" => Some(("videoContext.labelDetectionConfig.videoConfidenceThreshold", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })),
|
|
|
|
|
"video-context.explicit-content-detection-config.model" => Some(("videoContext.explicitContentDetectionConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
"video-context.object-tracking-config.model" => Some(("videoContext.objectTrackingConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
"features" => Some(("features", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })),
|
|
|
|
|
"input-content" => Some(("inputContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
"input-uri" => Some(("inputUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
"location-id" => Some(("locationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
"output-uri" => Some(("outputUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
|
|
|
|
|
_ => {
|
|
|
|
|
let suggestion = FieldCursor::did_you_mean(key, &vec!["audio-tracks", "diarization-speaker-count", "enable-automatic-punctuation", "enable-speaker-diarization", "enable-word-confidence", "explicit-content-detection-config", "features", "filter-profanity", "frame-confidence-threshold", "input-content", "input-uri", "label-detection-config", "label-detection-mode", "language-code", "language-hints", "location-id", "max-alternatives", "model", "output-uri", "shot-change-detection-config", "speech-transcription-config", "stationary-camera", "text-detection-config", "video-confidence-threshold", "video-context"]);
|
|
|
|
|
let suggestion = FieldCursor::did_you_mean(key, &vec!["audio-tracks", "diarization-speaker-count", "enable-automatic-punctuation", "enable-speaker-diarization", "enable-word-confidence", "explicit-content-detection-config", "features", "filter-profanity", "frame-confidence-threshold", "input-content", "input-uri", "label-detection-config", "label-detection-mode", "language-code", "language-hints", "location-id", "max-alternatives", "model", "object-tracking-config", "output-uri", "shot-change-detection-config", "speech-transcription-config", "stationary-camera", "text-detection-config", "video-confidence-threshold", "video-context"]);
|
|
|
|
|
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string()))));
|
|
|
|
|
None
|
|
|
|
|
}
|
|
|
|
|
@@ -420,8 +731,14 @@ impl<'n> Engine<'n> {
|
|
|
|
|
("get", Some(opt)) => {
|
|
|
|
|
call_result = self._operations_get(opt, dry_run, &mut err);
|
|
|
|
|
},
|
|
|
|
|
("list", Some(opt)) => {
|
|
|
|
|
call_result = self._operations_list(opt, dry_run, &mut err);
|
|
|
|
|
("projects-locations-operations-cancel", Some(opt)) => {
|
|
|
|
|
call_result = self._operations_projects_locations_operations_cancel(opt, dry_run, &mut err);
|
|
|
|
|
},
|
|
|
|
|
("projects-locations-operations-delete", Some(opt)) => {
|
|
|
|
|
call_result = self._operations_projects_locations_operations_delete(opt, dry_run, &mut err);
|
|
|
|
|
},
|
|
|
|
|
("projects-locations-operations-get", Some(opt)) => {
|
|
|
|
|
call_result = self._operations_projects_locations_operations_get(opt, dry_run, &mut err);
|
|
|
|
|
},
|
|
|
|
|
_ => {
|
|
|
|
|
err.issues.push(CLIError::MissingMethodError("operations".to_string()));
|
|
|
|
|
@@ -429,6 +746,26 @@ impl<'n> Engine<'n> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
("projects", Some(opt)) => {
|
|
|
|
|
match opt.subcommand() {
|
|
|
|
|
("locations-operations-cancel", Some(opt)) => {
|
|
|
|
|
call_result = self._projects_locations_operations_cancel(opt, dry_run, &mut err);
|
|
|
|
|
},
|
|
|
|
|
("locations-operations-delete", Some(opt)) => {
|
|
|
|
|
call_result = self._projects_locations_operations_delete(opt, dry_run, &mut err);
|
|
|
|
|
},
|
|
|
|
|
("locations-operations-get", Some(opt)) => {
|
|
|
|
|
call_result = self._projects_locations_operations_get(opt, dry_run, &mut err);
|
|
|
|
|
},
|
|
|
|
|
("locations-operations-list", Some(opt)) => {
|
|
|
|
|
call_result = self._projects_locations_operations_list(opt, dry_run, &mut err);
|
|
|
|
|
},
|
|
|
|
|
_ => {
|
|
|
|
|
err.issues.push(CLIError::MissingMethodError("projects".to_string()));
|
|
|
|
|
writeln!(io::stderr(), "{}\n", opt.usage()).ok();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
("videos", Some(opt)) => {
|
|
|
|
|
match opt.subcommand() {
|
|
|
|
|
("annotate", Some(opt)) => {
|
|
|
|
|
@@ -525,7 +862,7 @@ impl<'n> Engine<'n> {
|
|
|
|
|
fn main() {
|
|
|
|
|
let mut exit_status = 0i32;
|
|
|
|
|
let arg_data = [
|
|
|
|
|
("operations", "methods: 'cancel', 'delete', 'get' and 'list'", vec![
|
|
|
|
|
("operations", "methods: 'cancel', 'delete', 'get', 'projects-locations-operations-cancel', 'projects-locations-operations-delete' and 'projects-locations-operations-get'", vec![
|
|
|
|
|
("cancel",
|
|
|
|
|
Some(r##"Starts asynchronous cancellation on a long-running operation. The server
|
|
|
|
|
makes a best effort to cancel the operation, but success is not
|
|
|
|
|
@@ -545,12 +882,6 @@ fn main() {
|
|
|
|
|
Some(true),
|
|
|
|
|
Some(false)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"kv"##),
|
|
|
|
|
Some(r##"r"##),
|
|
|
|
|
Some(r##"Set various fields of the request structure, matching the key=value form"##),
|
|
|
|
|
Some(true),
|
|
|
|
|
Some(true)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"v"##),
|
|
|
|
|
Some(r##"p"##),
|
|
|
|
|
Some(r##"Set various optional parameters, matching the key=value form"##),
|
|
|
|
|
@@ -612,7 +943,176 @@ fn main() {
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("list",
|
|
|
|
|
("projects-locations-operations-cancel",
|
|
|
|
|
Some(r##"Starts asynchronous cancellation on a long-running operation. The server
|
|
|
|
|
makes a best effort to cancel the operation, but success is not
|
|
|
|
|
guaranteed. If the server doesn't support this method, it returns
|
|
|
|
|
`google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
|
|
|
|
Operations.GetOperation or
|
|
|
|
|
other methods to check whether the cancellation succeeded or whether the
|
|
|
|
|
operation completed despite cancellation. On successful cancellation,
|
|
|
|
|
the operation is not deleted; instead, it becomes an operation with
|
|
|
|
|
an Operation.error value with a google.rpc.Status.code of 1,
|
|
|
|
|
corresponding to `Code.CANCELLED`."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_videointelligence1_cli/operations_projects-locations-operations-cancel",
|
|
|
|
|
vec![
|
|
|
|
|
(Some(r##"name"##),
|
|
|
|
|
None,
|
|
|
|
|
Some(r##"The name of the operation resource to be cancelled."##),
|
|
|
|
|
Some(true),
|
|
|
|
|
Some(false)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"v"##),
|
|
|
|
|
Some(r##"p"##),
|
|
|
|
|
Some(r##"Set various optional parameters, matching the key=value form"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(true)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"out"##),
|
|
|
|
|
Some(r##"o"##),
|
|
|
|
|
Some(r##"Specify the file into which to write the program's output"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("projects-locations-operations-delete",
|
|
|
|
|
Some(r##"Deletes a long-running operation. This method indicates that the client is
|
|
|
|
|
no longer interested in the operation result. It does not cancel the
|
|
|
|
|
operation. If the server doesn't support this method, it returns
|
|
|
|
|
`google.rpc.Code.UNIMPLEMENTED`."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_videointelligence1_cli/operations_projects-locations-operations-delete",
|
|
|
|
|
vec![
|
|
|
|
|
(Some(r##"name"##),
|
|
|
|
|
None,
|
|
|
|
|
Some(r##"The name of the operation resource to be deleted."##),
|
|
|
|
|
Some(true),
|
|
|
|
|
Some(false)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"v"##),
|
|
|
|
|
Some(r##"p"##),
|
|
|
|
|
Some(r##"Set various optional parameters, matching the key=value form"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(true)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"out"##),
|
|
|
|
|
Some(r##"o"##),
|
|
|
|
|
Some(r##"Specify the file into which to write the program's output"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("projects-locations-operations-get",
|
|
|
|
|
Some(r##"Gets the latest state of a long-running operation. Clients can use this
|
|
|
|
|
method to poll the operation result at intervals as recommended by the API
|
|
|
|
|
service."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_videointelligence1_cli/operations_projects-locations-operations-get",
|
|
|
|
|
vec![
|
|
|
|
|
(Some(r##"name"##),
|
|
|
|
|
None,
|
|
|
|
|
Some(r##"The name of the operation resource."##),
|
|
|
|
|
Some(true),
|
|
|
|
|
Some(false)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"v"##),
|
|
|
|
|
Some(r##"p"##),
|
|
|
|
|
Some(r##"Set various optional parameters, matching the key=value form"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(true)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"out"##),
|
|
|
|
|
Some(r##"o"##),
|
|
|
|
|
Some(r##"Specify the file into which to write the program's output"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
("projects", "methods: 'locations-operations-cancel', 'locations-operations-delete', 'locations-operations-get' and 'locations-operations-list'", vec![
|
|
|
|
|
("locations-operations-cancel",
|
|
|
|
|
Some(r##"Starts asynchronous cancellation on a long-running operation. The server
|
|
|
|
|
makes a best effort to cancel the operation, but success is not
|
|
|
|
|
guaranteed. If the server doesn't support this method, it returns
|
|
|
|
|
`google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
|
|
|
|
Operations.GetOperation or
|
|
|
|
|
other methods to check whether the cancellation succeeded or whether the
|
|
|
|
|
operation completed despite cancellation. On successful cancellation,
|
|
|
|
|
the operation is not deleted; instead, it becomes an operation with
|
|
|
|
|
an Operation.error value with a google.rpc.Status.code of 1,
|
|
|
|
|
corresponding to `Code.CANCELLED`."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_videointelligence1_cli/projects_locations-operations-cancel",
|
|
|
|
|
vec![
|
|
|
|
|
(Some(r##"name"##),
|
|
|
|
|
None,
|
|
|
|
|
Some(r##"The name of the operation resource to be cancelled."##),
|
|
|
|
|
Some(true),
|
|
|
|
|
Some(false)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"kv"##),
|
|
|
|
|
Some(r##"r"##),
|
|
|
|
|
Some(r##"Set various fields of the request structure, matching the key=value form"##),
|
|
|
|
|
Some(true),
|
|
|
|
|
Some(true)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"v"##),
|
|
|
|
|
Some(r##"p"##),
|
|
|
|
|
Some(r##"Set various optional parameters, matching the key=value form"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(true)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"out"##),
|
|
|
|
|
Some(r##"o"##),
|
|
|
|
|
Some(r##"Specify the file into which to write the program's output"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("locations-operations-delete",
|
|
|
|
|
Some(r##"Deletes a long-running operation. This method indicates that the client is
|
|
|
|
|
no longer interested in the operation result. It does not cancel the
|
|
|
|
|
operation. If the server doesn't support this method, it returns
|
|
|
|
|
`google.rpc.Code.UNIMPLEMENTED`."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_videointelligence1_cli/projects_locations-operations-delete",
|
|
|
|
|
vec![
|
|
|
|
|
(Some(r##"name"##),
|
|
|
|
|
None,
|
|
|
|
|
Some(r##"The name of the operation resource to be deleted."##),
|
|
|
|
|
Some(true),
|
|
|
|
|
Some(false)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"v"##),
|
|
|
|
|
Some(r##"p"##),
|
|
|
|
|
Some(r##"Set various optional parameters, matching the key=value form"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(true)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"out"##),
|
|
|
|
|
Some(r##"o"##),
|
|
|
|
|
Some(r##"Specify the file into which to write the program's output"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("locations-operations-get",
|
|
|
|
|
Some(r##"Gets the latest state of a long-running operation. Clients can use this
|
|
|
|
|
method to poll the operation result at intervals as recommended by the API
|
|
|
|
|
service."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_videointelligence1_cli/projects_locations-operations-get",
|
|
|
|
|
vec![
|
|
|
|
|
(Some(r##"name"##),
|
|
|
|
|
None,
|
|
|
|
|
Some(r##"The name of the operation resource."##),
|
|
|
|
|
Some(true),
|
|
|
|
|
Some(false)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"v"##),
|
|
|
|
|
Some(r##"p"##),
|
|
|
|
|
Some(r##"Set various optional parameters, matching the key=value form"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(true)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"out"##),
|
|
|
|
|
Some(r##"o"##),
|
|
|
|
|
Some(r##"Specify the file into which to write the program's output"##),
|
|
|
|
|
Some(false),
|
|
|
|
|
Some(false)),
|
|
|
|
|
]),
|
|
|
|
|
("locations-operations-list",
|
|
|
|
|
Some(r##"Lists operations that match the specified filter in the request. If the
|
|
|
|
|
server doesn't support this method, it returns `UNIMPLEMENTED`.
|
|
|
|
|
|
|
|
|
|
@@ -623,8 +1123,14 @@ fn main() {
|
|
|
|
|
For backwards compatibility, the default name includes the operations
|
|
|
|
|
collection id, however overriding users must ensure the name binding
|
|
|
|
|
is the parent resource, without the operations collection id."##),
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_videointelligence1_cli/operations_list",
|
|
|
|
|
"Details at http://byron.github.io/google-apis-rs/google_videointelligence1_cli/projects_locations-operations-list",
|
|
|
|
|
vec![
|
|
|
|
|
(Some(r##"name"##),
|
|
|
|
|
None,
|
|
|
|
|
Some(r##"The name of the operation's parent resource."##),
|
|
|
|
|
Some(true),
|
|
|
|
|
Some(false)),
|
|
|
|
|
|
|
|
|
|
(Some(r##"v"##),
|
|
|
|
|
Some(r##"p"##),
|
|
|
|
|
Some(r##"Set various optional parameters, matching the key=value form"##),
|
|
|
|
|
@@ -671,7 +1177,7 @@ fn main() {
|
|
|
|
|
|
|
|
|
|
let mut app = App::new("videointelligence1")
|
|
|
|
|
.author("Sebastian Thiel <byronimo@gmail.com>")
|
|
|
|
|
.version("1.0.8+20190308")
|
|
|
|
|
.version("1.0.9+20190626")
|
|
|
|
|
.about("Detects objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text. Supports both asynchronous API and streaming API.")
|
|
|
|
|
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_videointelligence1_cli")
|
|
|
|
|
.arg(Arg::with_name("url")
|
|
|
|
|
|