mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-22 19:21:27 +01:00
feat(CLI): --debug-auth flag
* Allow to see all authentication related communication, similar to --debug flag otherwise. * fixed broken generator when handling request value parsing. Fixes #70
This commit is contained in:
@@ -69,5 +69,8 @@ Configuration:
|
||||
--debug
|
||||
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.
|
||||
");
|
||||
</%def>
|
||||
@@ -106,21 +106,15 @@ self.opt.${cmd_ident(method)} {
|
||||
}
|
||||
};
|
||||
|
||||
let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
||||
hyper::Client::new(),
|
||||
JsonTokenStorage {
|
||||
program_name: "${util.program_name()}",
|
||||
db_dir: config_dir.clone(),
|
||||
}, None);
|
||||
let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate,
|
||||
${self._debug_client('debug_auth') | indent_all_but_first_by(10)},
|
||||
JsonTokenStorage {
|
||||
program_name: "${util.program_name()}",
|
||||
db_dir: config_dir.clone(),
|
||||
}, None);
|
||||
|
||||
let client =
|
||||
if opt.flag_debug {
|
||||
hyper::Client::with_connector(mock::TeeConnector {
|
||||
connector: hyper::net::HttpConnector(None)
|
||||
})
|
||||
} else {
|
||||
hyper::Client::new()
|
||||
};
|
||||
${self._debug_client('debug') | indent_all_but_first_by(3)};
|
||||
let engine = Engine {
|
||||
opt: opt,
|
||||
hub: ${hub_type_name}::new(client, auth),
|
||||
@@ -140,6 +134,16 @@ self.opt.${cmd_ident(method)} {
|
||||
}
|
||||
</%def>
|
||||
|
||||
<%def name="_debug_client(flag_name)" buffered="True">\
|
||||
if opt.flag_${flag_name} {
|
||||
hyper::Client::with_connector(mock::TeeConnector {
|
||||
connector: hyper::net::HttpConnector(None)
|
||||
})
|
||||
} else {
|
||||
hyper::Client::new()
|
||||
}\
|
||||
</%def>
|
||||
|
||||
<%def name="_method_call_impl(c, resource, method)" buffered="True">\
|
||||
<%
|
||||
mc = new_method_context(resource, method, c)
|
||||
@@ -247,7 +251,7 @@ ${value_unwrap}\
|
||||
}
|
||||
% endif # handle call parameters
|
||||
% if mc.request_value:
|
||||
${self._request_value_impl(c, request_cli_schema)}\
|
||||
${self._request_value_impl(c, request_cli_schema, request_prop_type)}\
|
||||
% endif # handle struct parsing
|
||||
% if mc.media_params:
|
||||
let protocol =
|
||||
@@ -319,7 +323,7 @@ if dry_run {
|
||||
}\
|
||||
</%def>
|
||||
|
||||
<%def name="_request_value_impl(c, request_cli_schema)">
|
||||
<%def name="_request_value_impl(c, request_cli_schema, request_prop_type)">
|
||||
<%
|
||||
allow_optionals_fn = lambda s: is_schema_with_optionals(schema_markers(s, c, transitive=False))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user