implemented client instance repository

This commit is contained in:
Andrey Terentev 2024-05-24 10:23:38 +07:00 committed by Andrey Terentev
parent 17b6107ce7
commit e1975532b3

View File

@ -34,9 +34,9 @@ public class InstanceRepositoryImpl implements InstanceRepository {
@Override @Override
public Map<InstanceId, Instance> getInstances(Collection<InstanceId> ids) { public Map<InstanceId, Instance> getInstances(Collection<InstanceId> ids) {
var map = new HashMap<InstanceId, Instance>(); var map = new HashMap<InstanceId, Instance>();
rest.query("/instances/target/list", HttpMethod.GET, ResponseObject.RInstance[].class, params -> { Arrays.stream(rest.query("/instances/target/list", HttpMethod.GET, ResponseObject.RInstance[].class, params -> {
params.put("id", String.join(",", ids.stream().map(InstanceId::getValue).toList())); params.put("id", String.join(",", ids.stream().map(InstanceId::getValue).toList()));
}); })).map(ResponseObject.RInstance::convert).forEach(instance -> map.put(instance.id(), instance));
return map; return map;
} }