Search in sources :

Example 1 with ListWorkloadAdministrationGroupsResponse

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;
}
Also used : ArrayList(java.util.ArrayList) ListWorkloadAdministrationGroupsRequest(com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsRequest) WorkloadAdministrationGroup(com.cloudera.thunderhead.service.usermanagement.UserManagementProto.WorkloadAdministrationGroup) ListWorkloadAdministrationGroupsResponse(com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsResponse)

Example 2 with ListWorkloadAdministrationGroupsResponse

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();
}
Also used : UmsVirtualGroupRight(com.sequenceiq.cloudbreak.auth.altus.UmsVirtualGroupRight) Group(com.cloudera.thunderhead.service.usermanagement.UserManagementProto.Group) WorkloadAdministrationGroup(com.cloudera.thunderhead.service.usermanagement.UserManagementProto.WorkloadAdministrationGroup) ListWorkloadAdministrationGroupsResponse(com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsResponse)

Aggregations

ListWorkloadAdministrationGroupsResponse (com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsResponse)2 WorkloadAdministrationGroup (com.cloudera.thunderhead.service.usermanagement.UserManagementProto.WorkloadAdministrationGroup)2 Group (com.cloudera.thunderhead.service.usermanagement.UserManagementProto.Group)1 ListWorkloadAdministrationGroupsRequest (com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsRequest)1 UmsVirtualGroupRight (com.sequenceiq.cloudbreak.auth.altus.UmsVirtualGroupRight)1 ArrayList (java.util.ArrayList)1