Deprecate query option on List Groups REST endpoint

Support for generic group queries has been added by change I5b9168.
For this we would like to use the --query option so that handling
group queries is consistent with handling account and change queries.
However --query is already in use by the List Groups REST endpoint
and hence the option for generic group queries was named --query2.
This is a temporary naming to maintain backwards compatibility of the
old --query option. Going forward we want to clean this up. This is
why the old --query option is marked as deprecated and instead the
same functionality is offered by a new --group option. When users of
this API had enough time to migrate we may remove the old --query
option and rename the --query2 option to --query. Add this information
to the documentation so that users are warned about this well in
advance.

Change-Id: Ic0b8178593a3c0ac0f26bf96192c6d6b82bd03f8
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-01-16 14:46:43 +01:00
parent 9f77db1186
commit a757d716b6
4 changed files with 34 additions and 8 deletions

View File

@@ -106,9 +106,23 @@ public class ListGroups implements RestReadView<TopLevelResource> {
this.owned = owned;
}
@Option(name = "--query", aliases = {"-q"}, usage = "group to inspect")
public void addGroup(AccountGroup.UUID id) {
groupsToInspect.add(id);
/**
* Add a group to inspect.
*
* @param uuid UUID of the group
* @deprecated use {@link #addGroup(AccountGroup.UUID)}.
*/
@Deprecated
@Option(name = "--query", aliases = {"-q"},
usage = "group to inspect (deprecated: use --group/-g instead)")
void addGroup_Deprecated(AccountGroup.UUID uuid) {
addGroup(uuid);
}
@Option(name = "--group", aliases = {"-g"}, usage = "group to inspect")
public void addGroup(AccountGroup.UUID uuid) {
groupsToInspect.add(uuid);
}
@Option(name = "--limit", aliases = {"-n"}, metaVar = "CNT",

View File

@@ -51,6 +51,8 @@ public class QueryGroups implements RestReadView<TopLevelResource> {
private EnumSet<ListGroupsOption> options =
EnumSet.noneOf(ListGroupsOption.class);
// TODO(ekempin): --query in ListGroups is marked as deprecated, once it is
// removed we want to rename --query2 to --query here.
/** --query (-q) is already used by {@link ListGroups} */
@Option(name = "--query2", aliases = {"-q2"}, usage = "group query")
public void setQuery(String query) {