Search in sources :

Example 1 with PersistentVolumeList

use of io.fabric8.kubernetes.api.model.PersistentVolumeList in project camel by apache.

the class KubernetesPersistentVolumesProducer method doListPersistentVolumesByLabels.

protected void doListPersistentVolumesByLabels(Exchange exchange, String operation) throws Exception {
    PersistentVolumeList pvList = null;
    Map<String, String> labels = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_PERSISTENT_VOLUMES_LABELS, Map.class);
    NonNamespaceOperation<PersistentVolume, PersistentVolumeList, DoneablePersistentVolume, Resource<PersistentVolume, DoneablePersistentVolume>> pvs;
    pvs = getEndpoint().getKubernetesClient().persistentVolumes();
    for (Map.Entry<String, String> entry : labels.entrySet()) {
        pvs.withLabel(entry.getKey(), entry.getValue());
    }
    pvList = pvs.list();
    MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true);
    exchange.getOut().setBody(pvList.getItems());
}
Also used : Resource(io.fabric8.kubernetes.client.dsl.Resource) DoneablePersistentVolume(io.fabric8.kubernetes.api.model.DoneablePersistentVolume) PersistentVolume(io.fabric8.kubernetes.api.model.PersistentVolume) DoneablePersistentVolume(io.fabric8.kubernetes.api.model.DoneablePersistentVolume) Map(java.util.Map) PersistentVolumeList(io.fabric8.kubernetes.api.model.PersistentVolumeList)

Example 2 with PersistentVolumeList

use of io.fabric8.kubernetes.api.model.PersistentVolumeList in project camel by apache.

the class KubernetesPersistentVolumesProducer method doList.

protected void doList(Exchange exchange, String operation) throws Exception {
    PersistentVolumeList persistentVolumeList = getEndpoint().getKubernetesClient().persistentVolumes().list();
    MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true);
    exchange.getOut().setBody(persistentVolumeList.getItems());
}
Also used : PersistentVolumeList(io.fabric8.kubernetes.api.model.PersistentVolumeList)

Aggregations

PersistentVolumeList (io.fabric8.kubernetes.api.model.PersistentVolumeList)2 DoneablePersistentVolume (io.fabric8.kubernetes.api.model.DoneablePersistentVolume)1 PersistentVolume (io.fabric8.kubernetes.api.model.PersistentVolume)1 Resource (io.fabric8.kubernetes.client.dsl.Resource)1 Map (java.util.Map)1