use of org.bf2.cos.fleet.manager.model.ConnectorDeploymentList in project cos-fleetshard by bf2fc6cc711aee1a0c2a.
the class SyncTestSupport method deploymentList.
public static ObjectNode deploymentList(ConnectorDeployment... deployments) {
var items = new ConnectorDeploymentList();
items.page(1);
items.size(deployments.length);
items.total(deployments.length);
for (ConnectorDeployment deployment : deployments) {
items.addItemsItem(deployment);
}
return Serialization.jsonMapper().convertValue(items, ObjectNode.class);
}
use of org.bf2.cos.fleet.manager.model.ConnectorDeploymentList in project cos-fleetshard by bf2fc6cc711aee1a0c2a.
the class FleetManagerClient method getDeployments.
public void getDeployments(long gv, Consumer<Collection<ConnectorDeployment>> consumer) {
RestClientHelper.run(() -> {
LOGGER.debug("polling deployment with gv: {}", gv);
final AtomicInteger counter = new AtomicInteger();
final List<ConnectorDeployment> items = new ArrayList<>();
for (int i = 1; i < Integer.MAX_VALUE; i++) {
ConnectorDeploymentList list = controlPlane.getConnectorDeployments(config.cluster().id(), Integer.toString(i), null, gv);
if (list == null || list.getItems() == null || list.getItems().isEmpty()) {
LOGGER.info("No connectors for cluster {}", config.cluster().id());
break;
}
items.clear();
items.addAll(list.getItems());
items.sort(Comparator.comparingLong(d -> d.getMetadata().getResourceVersion()));
consumer.accept(items);
if (counter.addAndGet(items.size()) >= list.getTotal()) {
break;
}
}
});
}
Aggregations