use of com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListMachineUsersResponse in project cloudbreak by hortonworks.
the class UmsClient method listMachineUsers.
/**
* Wraps calls to ListMachineUsers with an Account ID.
*
* @param requestId the request ID for the request
* @param accountId the account ID
* @param machineUserNameOrCrnList a list of users to list. If null or empty then all users will be listed
* @param includeInternal whether to include internal machine users
* @param includeWorkloadMachineUsers whether to include workload machine users
* @return the list of machine users
*/
public List<MachineUser> listMachineUsers(String requestId, String accountId, List<String> machineUserNameOrCrnList, boolean includeInternal, boolean includeWorkloadMachineUsers) {
checkNotNull(requestId, "requestId should not be null.");
validateAccountIdWithWarning(accountId);
List<MachineUser> machineUsers = new ArrayList<>();
ListMachineUsersRequest.Builder requestBuilder = ListMachineUsersRequest.newBuilder().setAccountId(accountId).setIncludeInternal(includeInternal).setIncludeWorkloadMachineUsers(includeWorkloadMachineUsers).setPageSize(umsClientConfig.getListMachineUsersPageSize());
if (machineUserNameOrCrnList != null && !machineUserNameOrCrnList.isEmpty()) {
requestBuilder.addAllMachineUserNameOrCrn(machineUserNameOrCrnList);
}
ListMachineUsersResponse response;
do {
response = newStub(requestId).listMachineUsers(requestBuilder.build());
machineUsers.addAll(response.getMachineUserList());
requestBuilder.setPageToken(response.getNextPageToken());
} while (response.hasNextPageToken());
return machineUsers;
}
Aggregations