Search in sources :

Example 1 with ListWorkloadAdministrationGroupsForMemberResponse

use of com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsForMemberResponse in project cloudbreak by hortonworks.

the class GrpcUmsClient method listWorkloadAdministrationGroupsForMember.

/**
 * Lists the workload administration groups a member belongs to.
 *
 * @param memberCrn the CRN of the user or machine user
 * @param requestId request id for getting rights
 * @return the workload administration groups associated with this user or machine user
 */
public List<String> listWorkloadAdministrationGroupsForMember(String memberCrn, Optional<String> requestId) {
    requireNonNull(memberCrn);
    List<String> wags = new ArrayList<>();
    UmsClient client = makeClient(channelWrapper.getChannel());
    LOGGER.debug("Getting workload administration groups for member {}", memberCrn);
    ListWorkloadAdministrationGroupsForMemberResponse response;
    Optional<PageToken> pageToken = Optional.empty();
    do {
        response = client.listWorkloadAdministrationGroupsForMember(RequestIdUtil.getOrGenerate(requestId), memberCrn, pageToken);
        wags.addAll(response.getWorkloadAdministrationGroupNameList());
        pageToken = Optional.ofNullable(response.getNextPageToken());
    } while (response.hasNextPageToken());
    LOGGER.debug("{} workload administration groups found for member {}", wags.size(), memberCrn);
    return wags;
}
Also used : ArrayList(java.util.ArrayList) PageToken(com.cloudera.thunderhead.service.common.paging.PagingProto.PageToken) ListWorkloadAdministrationGroupsForMemberResponse(com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsForMemberResponse)

Example 2 with ListWorkloadAdministrationGroupsForMemberResponse

use of com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsForMemberResponse in project cloudbreak by hortonworks.

the class GrpcUmsClient method listWorkloadAdministrationGroupsForMember.

/**
 * Lists the workload administration groups a member belongs to.
 *
 * @param memberCrn the CRN of the user or machine user
 * @param requestId request id for getting rights
 * @return the workload administration groups associated with this user or machine user
 */
public List<String> listWorkloadAdministrationGroupsForMember(String memberCrn, Optional<String> requestId, RegionAwareInternalCrnGeneratorFactory regionAwareInternalCrnGeneratorFactory) {
    requireNonNull(memberCrn);
    List<String> wags = new ArrayList<>();
    UmsClient client = makeClient(channelWrapper.getChannel(), regionAwareInternalCrnGeneratorFactory);
    LOGGER.debug("Getting workload administration groups for member {}", memberCrn);
    ListWorkloadAdministrationGroupsForMemberResponse response;
    Optional<PageToken> pageToken = Optional.empty();
    do {
        response = client.listWorkloadAdministrationGroupsForMember(RequestIdUtil.getOrGenerate(requestId), memberCrn, pageToken);
        wags.addAll(response.getWorkloadAdministrationGroupNameList());
        pageToken = Optional.ofNullable(response.getNextPageToken());
    } while (response.hasNextPageToken());
    LOGGER.debug("{} workload administration groups found for member {}", wags.size(), memberCrn);
    return wags;
}
Also used : ArrayList(java.util.ArrayList) PageToken(com.cloudera.thunderhead.service.common.paging.PagingProto.PageToken) ListWorkloadAdministrationGroupsForMemberResponse(com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsForMemberResponse)

Aggregations

PageToken (com.cloudera.thunderhead.service.common.paging.PagingProto.PageToken)2 ListWorkloadAdministrationGroupsForMemberResponse (com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListWorkloadAdministrationGroupsForMemberResponse)2 ArrayList (java.util.ArrayList)2