Search in sources :

Example 1 with BuildList

use of io.fabric8.openshift.api.model.BuildList in project fabric8 by fabric8io.

the class OpenShiftAssert method builds.

public BuildsAssert builds() {
    BuildList listObject = client.builds().list();
    assertThat(listObject).describedAs("No BuildList found!").isNotNull();
    List<Build> list = listObject.getItems();
    assertThat(list).describedAs("No Build Items found!").isNotNull();
    return new BuildsAssert(list, client);
}
Also used : BuildList(io.fabric8.openshift.api.model.BuildList) Build(io.fabric8.openshift.api.model.Build)

Example 2 with BuildList

use of io.fabric8.openshift.api.model.BuildList in project camel by apache.

the class KubernetesBuildsProducer method doList.

protected void doList(Exchange exchange, String operation) throws Exception {
    BuildList buildList = getEndpoint().getKubernetesClient().adapt(OpenShiftClient.class).builds().list();
    exchange.getOut().setBody(buildList.getItems());
}
Also used : BuildList(io.fabric8.openshift.api.model.BuildList)

Example 3 with BuildList

use of io.fabric8.openshift.api.model.BuildList in project camel by apache.

the class KubernetesBuildsProducer method doListBuildByLabels.

protected void doListBuildByLabels(Exchange exchange, String operation) throws Exception {
    BuildList buildList = null;
    Map<String, String> labels = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_BUILDS_LABELS, Map.class);
    String namespaceName = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class);
    if (!ObjectHelper.isEmpty(namespaceName)) {
        NonNamespaceOperation<Build, BuildList, DoneableBuild, BuildResource<Build, DoneableBuild, String, LogWatch>> builds = getEndpoint().getKubernetesClient().adapt(OpenShiftClient.class).builds().inNamespace(namespaceName);
        for (Map.Entry<String, String> entry : labels.entrySet()) {
            builds.withLabel(entry.getKey(), entry.getValue());
        }
        buildList = builds.list();
    } else {
        MixedOperation<Build, BuildList, DoneableBuild, BuildResource<Build, DoneableBuild, String, LogWatch>> builds = getEndpoint().getKubernetesClient().adapt(OpenShiftClient.class).builds();
        for (Map.Entry<String, String> entry : labels.entrySet()) {
            builds.withLabel(entry.getKey(), entry.getValue());
        }
        buildList = builds.list();
    }
    MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true);
    exchange.getOut().setBody(buildList.getItems());
}
Also used : BuildList(io.fabric8.openshift.api.model.BuildList) DoneableBuild(io.fabric8.openshift.api.model.DoneableBuild) DoneableBuild(io.fabric8.openshift.api.model.DoneableBuild) Build(io.fabric8.openshift.api.model.Build) OpenShiftClient(io.fabric8.openshift.client.OpenShiftClient) Map(java.util.Map) BuildResource(io.fabric8.openshift.client.dsl.BuildResource)

Example 4 with BuildList

use of io.fabric8.openshift.api.model.BuildList in project fabric8 by fabric8io.

the class BuildWatcher method poll.

public void poll() {
    boolean foundBuild = false;
    BuildList buildList = client.builds().inNamespace(namespace).list();
    if (buildList != null) {
        List<Build> items = buildList.getItems();
        if (items != null) {
            for (Build build : items) {
                buildPolled(build);
                foundBuild = true;
            }
        }
    }
    if (foundBuild) {
        loading = false;
    }
}
Also used : BuildList(io.fabric8.openshift.api.model.BuildList) Build(io.fabric8.openshift.api.model.Build)

Aggregations

BuildList (io.fabric8.openshift.api.model.BuildList)4 Build (io.fabric8.openshift.api.model.Build)3 DoneableBuild (io.fabric8.openshift.api.model.DoneableBuild)1 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)1 BuildResource (io.fabric8.openshift.client.dsl.BuildResource)1 Map (java.util.Map)1