KEYCLOAK-5742 [Admin CLI] Output filtering for nested attributes doesn't work

This commit is contained in:
Marko Strukelj 2017-11-29 16:48:37 +01:00 committed by Stian Thorgersen
parent 17748d5ba8
commit 106599b52c
5 changed files with 27 additions and 5 deletions

View file

@ -91,7 +91,7 @@ public class CreateCmd extends AbstractRequestCmd {
out.println(); out.println();
out.println("Command to create new resources on the server."); out.println("Command to create new resources on the server.");
out.println(); out.println();
out.println("Use `" + CMD + " config credentials` to establish an authenticated sessions, or use --no-config with "); out.println("Use '" + CMD + " config credentials' to establish an authenticated sessions, or use --no-config with ");
out.println("CREDENTIALS OPTIONS to perform one time authentication."); out.println("CREDENTIALS OPTIONS to perform one time authentication.");
out.println(); out.println();
out.println("Arguments:"); out.println("Arguments:");
@ -122,6 +122,7 @@ public class CreateCmd extends AbstractRequestCmd {
out.println(" -o, --output After creation output the new resource to standard output"); out.println(" -o, --output After creation output the new resource to standard output");
out.println(" -i, --id After creation only print id of the new resource to standard output"); out.println(" -i, --id After creation only print id of the new resource to standard output");
out.println(" -F, --fields FILTER A filter pattern to specify which fields of a JSON response to output"); out.println(" -F, --fields FILTER A filter pattern to specify which fields of a JSON response to output");
out.println(" Use '" + CMD + " get --help' for more info on FILTER syntax.");
out.println(" -c, --compressed Don't pretty print the output"); out.println(" -c, --compressed Don't pretty print the output");
out.println(" -a, --admin-root URL URL of Admin REST endpoint root if not default - e.g. http://localhost:8080/auth/admin"); out.println(" -a, --admin-root URL URL of Admin REST endpoint root if not default - e.g. http://localhost:8080/auth/admin");
out.println(); out.println();

View file

@ -58,7 +58,7 @@ public class DeleteCmd extends CreateCmd {
out.println(); out.println();
out.println("Command to delete resources on the server."); out.println("Command to delete resources on the server.");
out.println(); out.println();
out.println("Use `" + CMD + " config credentials` to establish an authenticated sessions, or use CREDENTIALS OPTIONS"); out.println("Use '" + CMD + " config credentials' to establish an authenticated sessions, or use CREDENTIALS OPTIONS");
out.println("to perform one time authentication."); out.println("to perform one time authentication.");
out.println(); out.println();
out.println("Arguments:"); out.println("Arguments:");
@ -88,6 +88,7 @@ public class DeleteCmd extends CreateCmd {
out.println(" -H, --print-headers Print response headers"); out.println(" -H, --print-headers Print response headers");
out.println(" -o, --output After delete output any response to standard output"); out.println(" -o, --output After delete output any response to standard output");
out.println(" -F, --fields FILTER A filter pattern to specify which fields of a JSON response to output"); out.println(" -F, --fields FILTER A filter pattern to specify which fields of a JSON response to output");
out.println(" Use '" + CMD + " get --help' for more info on FILTER syntax.");
out.println(" -c, --compressed Don't pretty print the output"); out.println(" -c, --compressed Don't pretty print the output");
out.println(" -a, --admin-root URL URL of Admin REST endpoint root if not default - e.g. http://localhost:8080/auth/admin"); out.println(" -a, --admin-root URL URL of Admin REST endpoint root if not default - e.g. http://localhost:8080/auth/admin");
out.println(); out.println();

View file

@ -90,7 +90,7 @@ public class GetCmd extends AbstractRequestCmd {
out.println(); out.println();
out.println("Command to retrieve existing resources from the server."); out.println("Command to retrieve existing resources from the server.");
out.println(); out.println();
out.println("Use `" + CMD + " config credentials` to establish an authenticated session, or use CREDENTIALS OPTIONS"); out.println("Use '" + CMD + " config credentials' to establish an authenticated session, or use CREDENTIALS OPTIONS");
out.println("to perform one time authentication."); out.println("to perform one time authentication.");
out.println(); out.println();
out.println("Arguments:"); out.println("Arguments:");
@ -123,6 +123,18 @@ public class GetCmd extends AbstractRequestCmd {
out.println(" --noquotes Don't quote strings when output format is 'csv'"); out.println(" --noquotes Don't quote strings when output format is 'csv'");
out.println(" -a, --admin-root URL URL of Admin REST endpoint root if not default - e.g. http://localhost:8080/auth/admin"); out.println(" -a, --admin-root URL URL of Admin REST endpoint root if not default - e.g. http://localhost:8080/auth/admin");
out.println(); out.println();
out.println("Output results can be filtered by using '--fields' and a filter pattern. Filtering is performed by processing each item in a result set");
out.println("and applying filter on it. A pattern is defined as a comma separated list of attribute specifiers. Use '*' in a specifier to include all ");
out.println("attributes. Use attribute name, to include individual attributes. Use '-' prefix to exclude individual attributes.");
out.println("Use brackets after attribute specifier to specify a pattern for child attributes. For example: ");
out.println();
out.println(" 'protocolMappers(id,config)' only return attributes 'id' and 'config' of protocolMapper top level attribute");
out.println(" '*(*(*))' return all attributes three levels deep");
out.println(" '*(*),-id,-protocolMappers' return all attributes two levels deep, excluding 'id', and 'protocolMappers' top level attributes");
out.println();
out.println("If attribute of object type is included, but its children are not specified by using brackets, then an empty object will be returned - '{}'.");
out.println("Usually you will want to specify object attributes with brackets to display them fully - e.g. 'protocolMappers(*(*))'");
out.println();
out.println("Examples:"); out.println("Examples:");
out.println(); out.println();
out.println("Get all realms, displaying only some of the attributes:"); out.println("Get all realms, displaying only some of the attributes:");

View file

@ -323,7 +323,7 @@ public class GetRolesCmd extends GetCmd {
out.println(); out.println();
out.println("Command to list realm or client roles of a realm, a user, a group or a composite role."); out.println("Command to list realm or client roles of a realm, a user, a group or a composite role.");
out.println(); out.println();
out.println("Use `" + CMD + " config credentials` to establish an authenticated session, or use CREDENTIALS OPTIONS"); out.println("Use '" + CMD + " config credentials' to establish an authenticated session, or use CREDENTIALS OPTIONS");
out.println("to perform one time authentication."); out.println("to perform one time authentication.");
out.println(); out.println();
out.println("If client is specified using --cclientid or --cid then client roles are listed, otherwise realm roles are listed."); out.println("If client is specified using --cclientid or --cid then client roles are listed, otherwise realm roles are listed.");
@ -366,6 +366,13 @@ public class GetRolesCmd extends GetCmd {
out.println(" --available Return available roles - those that can still be added"); out.println(" --available Return available roles - those that can still be added");
out.println(" --effective Return effective roles - transitively taking composite roles into account"); out.println(" --effective Return effective roles - transitively taking composite roles into account");
out.println(" --all Return all client roles in addition to realm roles"); out.println(" --all Return all client roles in addition to realm roles");
out.println();
out.println(" -H, --print-headers Print response headers");
out.println(" -F, --fields FILTER A filter pattern to specify which fields of a JSON response to output");
out.println(" Use '" + CMD + " get --help' for more info on FILTER syntax.");
out.println(" -c, --compressed Don't pretty print the output");
out.println(" --format FORMAT Set output format to comma-separated-values by using 'csv'. Default format is 'json'");
out.println(" --noquotes Don't quote strings when output format is 'csv'");
out.println(" -a, --admin-root URL URL of Admin REST endpoint root if not default - e.g. http://localhost:8080/auth/admin"); out.println(" -a, --admin-root URL URL of Admin REST endpoint root if not default - e.g. http://localhost:8080/auth/admin");
out.println(" -r, --target-realm REALM Target realm to issue requests against if not the one authenticated against"); out.println(" -r, --target-realm REALM Target realm to issue requests against if not the one authenticated against");
out.println(); out.println();

View file

@ -99,7 +99,7 @@ public class UpdateCmd extends AbstractRequestCmd {
out.println(); out.println();
out.println("Command to update existing resources on the server."); out.println("Command to update existing resources on the server.");
out.println(); out.println();
out.println("Use `" + CMD + " config credentials` to establish an authenticated sessions, or use CREDENTIALS OPTIONS"); out.println("Use '" + CMD + " config credentials' to establish an authenticated sessions, or use CREDENTIALS OPTIONS");
out.println("to perform one time authentication."); out.println("to perform one time authentication.");
out.println(); out.println();
out.println("Arguments:"); out.println("Arguments:");
@ -133,6 +133,7 @@ public class UpdateCmd extends AbstractRequestCmd {
out.println(" -H, --print-headers Print response headers"); out.println(" -H, --print-headers Print response headers");
out.println(" -o, --output After update output the new resource to standard output"); out.println(" -o, --output After update output the new resource to standard output");
out.println(" -F, --fields FILTER A filter pattern to specify which fields of a JSON response to output"); out.println(" -F, --fields FILTER A filter pattern to specify which fields of a JSON response to output");
out.println(" Use '" + CMD + " get --help' for more info on FILTER syntax.");
out.println(" -c, --compressed Don't pretty print the output"); out.println(" -c, --compressed Don't pretty print the output");
out.println(" -a, --admin-root URL URL of Admin REST endpoint root if not default - e.g. http://localhost:8080/auth/admin"); out.println(" -a, --admin-root URL URL of Admin REST endpoint root if not default - e.g. http://localhost:8080/auth/admin");
out.println(); out.println();