use of io.fabric8.kubernetes.api.model.PersistentVolumeClaimList in project camel by apache.
the class KubernetesPersistentVolumesClaimsProducer method doListPersistentVolumesClaimsByLabels.
protected void doListPersistentVolumesClaimsByLabels(Exchange exchange, String operation) throws Exception {
PersistentVolumeClaimList pvcList = null;
Map<String, String> labels = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_PERSISTENT_VOLUMES_CLAIMS_LABELS, Map.class);
String namespaceName = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class);
if (!ObjectHelper.isEmpty(namespaceName)) {
NonNamespaceOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> pvcs = getEndpoint().getKubernetesClient().persistentVolumeClaims().inNamespace(namespaceName);
for (Map.Entry<String, String> entry : labels.entrySet()) {
pvcs.withLabel(entry.getKey(), entry.getValue());
}
pvcList = pvcs.list();
} else {
MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> pvcs = getEndpoint().getKubernetesClient().persistentVolumeClaims();
for (Map.Entry<String, String> entry : labels.entrySet()) {
pvcs.withLabel(entry.getKey(), entry.getValue());
}
pvcList = pvcs.list();
}
MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true);
exchange.getOut().setBody(pvcList.getItems());
}
use of io.fabric8.kubernetes.api.model.PersistentVolumeClaimList in project camel by apache.
the class KubernetesPersistentVolumesClaimsProducer method doList.
protected void doList(Exchange exchange, String operation) throws Exception {
PersistentVolumeClaimList persistentVolumeClaimList = getEndpoint().getKubernetesClient().persistentVolumeClaims().list();
exchange.getOut().setBody(persistentVolumeClaimList.getItems());
}
Aggregations