/** * Get map of {@link StorageSpec} from Core API, given a collection of storageId. */ public Map<String, StorageSpec> getStorageSpecs(Iterable<String> storageIds) { try { GetStorageRequest request = GetStorageRequest.newBuilder().addAllIds(storageIds).build(); GetStorageResponse response = blockingStub.getStorage(request); return response .getStorageSpecsList() .stream() .collect(Collectors.toMap(StorageSpec::getId, Function.identity())); } catch (StatusRuntimeException e) { log.error("GRPC error in getStorageSpecs: {}", e.getStatus()); throw new SpecRetrievalException("Unable to retrieve storage specs", e); } }
/** * Get map of {@link StorageSpec} from Core API, given a collection of storageId. * * @param storageIds collection of storageId to retrieve. * @return map of storage id as key and {@link StorageSpec} as value. * @throws SpecRetrievalException if any error happens during retrieval */ public Map<String, StorageSpec> getStorageSpecs(Iterable<String> storageIds) { try { GetStorageRequest request = GetStorageRequest.newBuilder().addAllIds(storageIds).build(); GetStorageResponse response = blockingStub.getStorage(request); return response .getStorageSpecsList() .stream() .collect(Collectors.toMap(StorageSpec::getId, Function.identity())); } catch (StatusRuntimeException e) { log.error("GRPC error in getStorageSpecs: {}", e.getStatus()); throw new SpecRetrievalException("Unable to retrieve storage specs", e); } }