use of com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsResponse in project cloudbreak by hortonworks.
the class UmsClient method listWorkloadAdministrationGroups.
/**
* Wraps calls to ListWorkloadAdministrationGroups with an Account ID.
*
* @param requestId the request ID for the request
* @param accountId the account ID
* @return the list of workload administration groups
*/
public List<WorkloadAdministrationGroup> listWorkloadAdministrationGroups(String requestId, String accountId) {
checkNotNull(requestId, "requestId should not be null.");
validateAccountIdWithWarning(accountId);
List<WorkloadAdministrationGroup> wags = new ArrayList<>();
ListWorkloadAdministrationGroupsRequest.Builder requestBuilder = ListWorkloadAdministrationGroupsRequest.newBuilder().setAccountId(accountId).setPageSize(umsClientConfig.getListWorkloadAdministrationGroupsPageSize());
ListWorkloadAdministrationGroupsResponse response;
do {
response = newStub(requestId).listWorkloadAdministrationGroups(requestBuilder.build());
wags.addAll(response.getWorkloadAdministrationGroupList());
requestBuilder.setPageToken(response.getNextPageToken());
} while (response.hasNextPageToken());
return wags;
}
use of com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsResponse in project cloudbreak by hortonworks.
the class MockUserManagementService method listWorkloadAdministrationGroups.
@Override
public void listWorkloadAdministrationGroups(ListWorkloadAdministrationGroupsRequest request, StreamObserver<ListWorkloadAdministrationGroupsResponse> responseObserver) {
mockCrnService.ensureInternalActor();
String accountId = request.getAccountId();
LOGGER.info("List workload administration groups: {}", accountId);
ListWorkloadAdministrationGroupsResponse.Builder responseBuilder = ListWorkloadAdministrationGroupsResponse.newBuilder();
for (UmsVirtualGroupRight right : UmsVirtualGroupRight.values()) {
Group group = mockGroupManagementService.createGroup(accountId, mockGroupManagementService.generateWorkloadGroupName(right.getRight()));
responseBuilder.addWorkloadAdministrationGroup(WorkloadAdministrationGroup.newBuilder().setWorkloadAdministrationGroupName(group.getGroupName()).setRightName(right.getRight()).setResource(MOCK_RESOURCE).build());
}
responseObserver.onNext(responseBuilder.build());
responseObserver.onCompleted();
}
Aggregations