use of com.cloudera.thunderhead.service.usermanagement.UserManagementProto.ListServicePrincipalCloudIdentitiesResponse in project cloudbreak by hortonworks.
the class GrpcUmsClient method listServicePrincipalCloudIdentities.
/**
* Retrieves list of service principal cloud identities for an environment from UMS.
*
* @param accountId the account Id
* @param environmentCrn the environment crn
* @param requestId an optional request Id
* @return list of service principal cloud identities for an environment
*/
public List<ServicePrincipalCloudIdentities> listServicePrincipalCloudIdentities(String accountId, String environmentCrn, Optional<String> requestId) {
List<ServicePrincipalCloudIdentities> spCloudIds = new ArrayList<>();
UmsClient client = makeClient(channelWrapper.getChannel(), regionAwareInternalCrnGeneratorFactory);
LOGGER.debug("Listing service principal cloud identities for account {} using request ID {}", accountId, requestId);
ListServicePrincipalCloudIdentitiesResponse response;
Optional<PageToken> pageToken = Optional.empty();
do {
response = client.listServicePrincipalCloudIdentities(RequestIdUtil.getOrGenerate(requestId), accountId, environmentCrn, pageToken);
spCloudIds.addAll(response.getServicePrincipalCloudIdentitiesList());
pageToken = Optional.ofNullable(response.getNextPageToken());
} while (response.hasNextPageToken());
LOGGER.debug("{} ServicePrincipalCloudIdentities found for account {}", spCloudIds.size(), accountId);
return spCloudIds;
}
Aggregations