Search in sources :

Example 1 with APP_K8S_IO_VERSION

use of com.redhat.devtools.intellij.tektoncd.Constants.APP_K8S_IO_VERSION in project intellij-tekton by redhat-developer.

the class HubModel method getInstalledHubItems.

public List<HubItem> getInstalledHubItems() {
    List<HubItem> items = new ArrayList<>();
    List<HasMetadata> hubItemsAlreadyInstalled = getAllInstalledHubItems();
    List<ResourceData> resourceDataList = retrieveAllResources();
    for (HasMetadata task : hubItemsAlreadyInstalled) {
        Optional<HubItem> hubItem = resourceDataList.stream().filter(resourceData -> resourceData.getName().equalsIgnoreCase(task.getMetadata().getName())).map(resourceData -> {
            String version = task.getMetadata().getLabels() != null ? task.getMetadata().getLabels().get(APP_K8S_IO_VERSION) : "";
            if (!version.isEmpty()) {
                return new HubItem(resourceData, task.getKind(), version);
            } else {
                return new HubItem(resourceData);
            }
        }).findFirst();
        hubItem.ifPresent(items::add);
    }
    return items;
}
Also used : ResourceVersionData(com.redhat.devtools.intellij.tektoncd.hub.model.ResourceVersionData) HUB_CATALOG_TAG(com.redhat.devtools.intellij.tektoncd.Constants.HUB_CATALOG_TAG) URL(java.net.URL) RecognizerFactory(com.redhat.devtools.alizer.api.RecognizerFactory) LoggerFactory(org.slf4j.LoggerFactory) Watcher(io.fabric8.kubernetes.client.Watcher) APP_K8S_IO_VERSION(com.redhat.devtools.intellij.tektoncd.Constants.APP_K8S_IO_VERSION) ConfigWatcher(com.redhat.devtools.intellij.common.utils.ConfigWatcher) YAMLBuilder(com.redhat.devtools.intellij.tektoncd.utils.YAMLBuilder) Language(com.redhat.devtools.alizer.api.Language) Constants(com.redhat.devtools.intellij.tektoncd.Constants) KIND_TASKS(com.redhat.devtools.intellij.tektoncd.Constants.KIND_TASKS) ExecHelper(com.redhat.devtools.intellij.common.utils.ExecHelper) Map(java.util.Map) ApiCallback(com.redhat.devtools.intellij.tektoncd.hub.invoker.ApiCallback) Config(io.fabric8.kubernetes.api.model.Config) DeployHelper(com.redhat.devtools.intellij.tektoncd.utils.DeployHelper) KIND_CLUSTERTASK(com.redhat.devtools.intellij.tektoncd.Constants.KIND_CLUSTERTASK) Predicate(java.util.function.Predicate) Resources(com.redhat.devtools.intellij.tektoncd.hub.model.Resources) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) Collectors(java.util.stream.Collectors) ClusterTask(io.fabric8.tekton.pipeline.v1beta1.ClusterTask) List(java.util.List) ClusterTasksNode(com.redhat.devtools.intellij.tektoncd.tree.ClusterTasksNode) Optional(java.util.Optional) ApiException(com.redhat.devtools.intellij.tektoncd.hub.invoker.ApiException) KIND_PIPELINE(com.redhat.devtools.intellij.tektoncd.Constants.KIND_PIPELINE) YAMLHelper(com.redhat.devtools.intellij.common.utils.YAMLHelper) KIND_TASK(com.redhat.devtools.intellij.tektoncd.Constants.KIND_TASK) HashMap(java.util.HashMap) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ArrayList(java.util.ArrayList) KIND_PIPELINES(com.redhat.devtools.intellij.tektoncd.Constants.KIND_PIPELINES) Tkn(com.redhat.devtools.intellij.tektoncd.tkn.Tkn) TknCliFactory(com.redhat.devtools.intellij.tektoncd.tkn.TknCliFactory) WatcherException(io.fabric8.kubernetes.client.WatcherException) Project(com.intellij.openapi.project.Project) ResourceData(com.redhat.devtools.intellij.tektoncd.hub.model.ResourceData) ConfigHelper(com.redhat.devtools.intellij.common.utils.ConfigHelper) Pipeline(io.fabric8.tekton.pipeline.v1beta1.Pipeline) Logger(org.slf4j.Logger) PipelinesNode(com.redhat.devtools.intellij.tektoncd.tree.PipelinesNode) IOException(java.io.IOException) ParentableNode(com.redhat.devtools.intellij.tektoncd.tree.ParentableNode) InputStreamReader(java.io.InputStreamReader) ResourceApi(com.redhat.devtools.intellij.tektoncd.hub.api.ResourceApi) KIND_CLUSTERTASKS(com.redhat.devtools.intellij.tektoncd.Constants.KIND_CLUSTERTASKS) Paths(java.nio.file.Paths) BufferedReader(java.io.BufferedReader) Collections(java.util.Collections) Task(io.fabric8.tekton.pipeline.v1beta1.Task) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) ResourceData(com.redhat.devtools.intellij.tektoncd.hub.model.ResourceData) ArrayList(java.util.ArrayList)

Aggregations

ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 Project (com.intellij.openapi.project.Project)1 Language (com.redhat.devtools.alizer.api.Language)1 RecognizerFactory (com.redhat.devtools.alizer.api.RecognizerFactory)1 ConfigHelper (com.redhat.devtools.intellij.common.utils.ConfigHelper)1 ConfigWatcher (com.redhat.devtools.intellij.common.utils.ConfigWatcher)1 ExecHelper (com.redhat.devtools.intellij.common.utils.ExecHelper)1 YAMLHelper (com.redhat.devtools.intellij.common.utils.YAMLHelper)1 Constants (com.redhat.devtools.intellij.tektoncd.Constants)1 APP_K8S_IO_VERSION (com.redhat.devtools.intellij.tektoncd.Constants.APP_K8S_IO_VERSION)1 HUB_CATALOG_TAG (com.redhat.devtools.intellij.tektoncd.Constants.HUB_CATALOG_TAG)1 KIND_CLUSTERTASK (com.redhat.devtools.intellij.tektoncd.Constants.KIND_CLUSTERTASK)1 KIND_CLUSTERTASKS (com.redhat.devtools.intellij.tektoncd.Constants.KIND_CLUSTERTASKS)1 KIND_PIPELINE (com.redhat.devtools.intellij.tektoncd.Constants.KIND_PIPELINE)1 KIND_PIPELINES (com.redhat.devtools.intellij.tektoncd.Constants.KIND_PIPELINES)1 KIND_TASK (com.redhat.devtools.intellij.tektoncd.Constants.KIND_TASK)1 KIND_TASKS (com.redhat.devtools.intellij.tektoncd.Constants.KIND_TASKS)1 ResourceApi (com.redhat.devtools.intellij.tektoncd.hub.api.ResourceApi)1 ApiCallback (com.redhat.devtools.intellij.tektoncd.hub.invoker.ApiCallback)1 ApiException (com.redhat.devtools.intellij.tektoncd.hub.invoker.ApiException)1