use of com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListGroupsResponse in project cloudbreak by hortonworks.
the class UmsClient method listGroups.
/**
* Wraps calls to ListGroups with an Account ID.
*
* @param requestId the request ID for the request
* @param accountId the account ID
* @param groupNameOrCrnList the groups to list. if null or empty then all groups will be listed
* @return the list of groups
*/
public List<Group> listGroups(String requestId, String accountId, List<String> groupNameOrCrnList) {
checkNotNull(requestId, "requestId should not be null.");
validateAccountIdWithWarning(accountId);
List<Group> groups = new ArrayList<>();
ListGroupsRequest.Builder requestBuilder = ListGroupsRequest.newBuilder().setAccountId(accountId).setPageSize(umsClientConfig.getListGroupsPageSize());
if (groupNameOrCrnList != null && !groupNameOrCrnList.isEmpty()) {
requestBuilder.addAllGroupNameOrCrn(groupNameOrCrnList);
}
ListGroupsResponse response;
do {
response = newStub(requestId).listGroups(requestBuilder.build());
groups.addAll(response.getGroupList());
requestBuilder.setPageToken(response.getNextPageToken());
} while (response.hasNextPageToken());
return groups;
}
Aggregations