use of io.fabric8.kubernetes.api.model.DoneableResourceQuota in project camel by apache.
the class KubernetesResourcesQuotaProducer method doListResourceQuotasByLabels.
protected void doListResourceQuotasByLabels(Exchange exchange, String operation) throws Exception {
ResourceQuotaList resList = null;
Map<String, String> labels = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_RESOURCES_QUOTA_LABELS, Map.class);
String namespaceName = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class);
if (!ObjectHelper.isEmpty(namespaceName)) {
NonNamespaceOperation<ResourceQuota, ResourceQuotaList, DoneableResourceQuota, Resource<ResourceQuota, DoneableResourceQuota>> resQuota;
resQuota = getEndpoint().getKubernetesClient().resourceQuotas().inNamespace(namespaceName);
for (Map.Entry<String, String> entry : labels.entrySet()) {
resQuota.withLabel(entry.getKey(), entry.getValue());
}
resList = resQuota.list();
} else {
MixedOperation<ResourceQuota, ResourceQuotaList, DoneableResourceQuota, Resource<ResourceQuota, DoneableResourceQuota>> resQuota;
resQuota = getEndpoint().getKubernetesClient().resourceQuotas();
for (Map.Entry<String, String> entry : labels.entrySet()) {
resQuota.withLabel(entry.getKey(), entry.getValue());
}
resList = resQuota.list();
}
MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true);
exchange.getOut().setBody(resList.getItems());
}
Aggregations