diff --git a/CHANGELOG.md b/CHANGELOG.md index 4faa3b47661..dbf6389da59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ * Fix #2292: Update createOrReplace to do replace when create fails with conflict #### New Features +* CSI Volume Snapshot extension * Fix #2311: Add Support for creating bootstrap project template * Fix #2287: Add support for V1 and V1Beta1 CustomResourceDefinition * Fix #2319: Create Config without using auto-configure functionality or setting env variables diff --git a/extensions/knative/client/src/main/java/io/fabric8/knative/client/KnativeExtensionAdapter.java b/extensions/knative/client/src/main/java/io/fabric8/knative/client/KnativeExtensionAdapter.java index 69670120389..ef70966393d 100644 --- a/extensions/knative/client/src/main/java/io/fabric8/knative/client/KnativeExtensionAdapter.java +++ b/extensions/knative/client/src/main/java/io/fabric8/knative/client/KnativeExtensionAdapter.java @@ -15,17 +15,16 @@ */ package io.fabric8.knative.client; +import io.fabric8.kubernetes.client.ExtensionAdapterSupport; import io.fabric8.kubernetes.client.Client; -import io.fabric8.kubernetes.api.model.RootPaths; import io.fabric8.kubernetes.client.ExtensionAdapter; import okhttp3.OkHttpClient; import java.net.URL; -import java.util.List; -import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; -public class KnativeExtensionAdapter implements ExtensionAdapter { +public class KnativeExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter { static final ConcurrentMap IS_TEKTON = new ConcurrentHashMap<>(); static final ConcurrentMap USES_TEKTON_APIGROUPS = new ConcurrentHashMap<>(); @@ -37,35 +36,11 @@ public Class getExtensionType() { @Override public Boolean isAdaptable(Client client) { - return isKnativeAvailable(client); + return isAdaptable(client, IS_TEKTON, USES_TEKTON_APIGROUPS, "knative.dev"); } @Override public KnativeClient adapt(Client client) { return new DefaultKnativeClient(client.adapt(OkHttpClient.class), client.getConfiguration()); } - - private boolean isKnativeAvailable(Client client) { - URL masterUrl = client.getMasterUrl(); - if (IS_TEKTON.containsKey(masterUrl)) { - return IS_TEKTON.get(masterUrl); - } else { - RootPaths rootPaths = client.rootPaths(); - if (rootPaths != null) { - List paths = rootPaths.getPaths(); - if (paths != null) { - for (String path : paths) { - // lets detect the new API Groups APIs for OpenShift - if (path.endsWith("knative.dev") || path.contains("knative.dev/")) { - USES_TEKTON_APIGROUPS.putIfAbsent(masterUrl, true); - IS_TEKTON.putIfAbsent(masterUrl, true); - return true; - } - } - } - } - } - IS_TEKTON.putIfAbsent(masterUrl, false); - return false; - } } diff --git a/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/ServingV1ExtensionAdapter.java b/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/ServingV1ExtensionAdapter.java index 3cf16d3c456..66fd421a572 100644 --- a/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/ServingV1ExtensionAdapter.java +++ b/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/ServingV1ExtensionAdapter.java @@ -15,17 +15,16 @@ */ package io.fabric8.knative.client.serving.v1; +import io.fabric8.kubernetes.client.ExtensionAdapterSupport; import io.fabric8.kubernetes.client.Client; -import io.fabric8.kubernetes.api.model.RootPaths; import io.fabric8.kubernetes.client.ExtensionAdapter; import okhttp3.OkHttpClient; import java.net.URL; -import java.util.List; -import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; -public class ServingV1ExtensionAdapter implements ExtensionAdapter { +public class ServingV1ExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter { static final ConcurrentMap IS_KNATIVE = new ConcurrentHashMap<>(); static final ConcurrentMap USES_KNATIVE_APIGROUPS = new ConcurrentHashMap<>(); @@ -37,35 +36,11 @@ public Class getExtensionType() { @Override public Boolean isAdaptable(Client client) { - return isServingV1Available(client); + return isAdaptable(client, IS_KNATIVE, USES_KNATIVE_APIGROUPS, "knative.dev"); } @Override public ServingV1Client adapt(Client client) { return new DefaultServingV1Client(client.adapt(OkHttpClient.class), client.getConfiguration()); } - - private boolean isServingV1Available(Client client) { - URL masterUrl = client.getMasterUrl(); - if (IS_KNATIVE.containsKey(masterUrl)) { - return IS_KNATIVE.get(masterUrl); - } else { - RootPaths rootPaths = client.rootPaths(); - if (rootPaths != null) { - List paths = rootPaths.getPaths(); - if (paths != null) { - for (String path : paths) { - // lets detect the new API Groups APIs for OpenShift - if (path.endsWith("knative.dev") || path.contains("knative.dev/")) { - USES_KNATIVE_APIGROUPS.putIfAbsent(masterUrl, true); - IS_KNATIVE.putIfAbsent(masterUrl, true); - return true; - } - } - } - } - } - IS_KNATIVE.putIfAbsent(masterUrl, false); - return false; - } } diff --git a/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1beta1/ServingV1Beta1ExtensionAdapter.java b/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1beta1/ServingV1Beta1ExtensionAdapter.java index ec410f4eb5c..841bff1cc3c 100644 --- a/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1beta1/ServingV1Beta1ExtensionAdapter.java +++ b/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1beta1/ServingV1Beta1ExtensionAdapter.java @@ -15,17 +15,16 @@ */ package io.fabric8.knative.client.serving.v1beta1; +import io.fabric8.kubernetes.client.ExtensionAdapterSupport; import io.fabric8.kubernetes.client.Client; -import io.fabric8.kubernetes.api.model.RootPaths; import io.fabric8.kubernetes.client.ExtensionAdapter; import okhttp3.OkHttpClient; import java.net.URL; -import java.util.List; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentHashMap; -public class ServingV1Beta1ExtensionAdapter implements ExtensionAdapter { +public class ServingV1Beta1ExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter { static final ConcurrentMap IS_KNATIVE = new ConcurrentHashMap<>(); static final ConcurrentMap USES_KNATIVE_APIGROUPS = new ConcurrentHashMap<>(); @@ -37,35 +36,11 @@ public Class getExtensionType() { @Override public Boolean isAdaptable(Client client) { - return isServingV1Beta1Available(client); + return isAdaptable(client, IS_KNATIVE, USES_KNATIVE_APIGROUPS, "knative.dev"); } @Override public ServingV1Beta1Client adapt(Client client) { return new DefaultServingV1Beta1Client(client.adapt(OkHttpClient.class), client.getConfiguration()); } - - private boolean isServingV1Beta1Available(Client client) { - URL masterUrl = client.getMasterUrl(); - if (IS_KNATIVE.containsKey(masterUrl)) { - return IS_KNATIVE.get(masterUrl); - } else { - RootPaths rootPaths = client.rootPaths(); - if (rootPaths != null) { - List paths = rootPaths.getPaths(); - if (paths != null) { - for (String path : paths) { - // lets detect the new API Groups APIs for OpenShift - if (path.endsWith("knative.dev") || path.contains("knative.dev/")) { - USES_KNATIVE_APIGROUPS.putIfAbsent(masterUrl, true); - IS_KNATIVE.putIfAbsent(masterUrl, true); - return true; - } - } - } - } - } - IS_KNATIVE.putIfAbsent(masterUrl, false); - return false; - } } diff --git a/extensions/pom.xml b/extensions/pom.xml index 4126c1cc478..6d75c918eb7 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -32,6 +32,7 @@ knative tekton service-catalog + volumesnapshot diff --git a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/ServiceCatalogExtensionAdapter.java b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/ServiceCatalogExtensionAdapter.java index 7f069c67d31..754735ad477 100644 --- a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/ServiceCatalogExtensionAdapter.java +++ b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/ServiceCatalogExtensionAdapter.java @@ -15,17 +15,16 @@ */ package io.fabric8.servicecatalog.client; -import io.fabric8.kubernetes.api.model.RootPaths; +import io.fabric8.kubernetes.client.ExtensionAdapterSupport; import io.fabric8.kubernetes.client.Client; import io.fabric8.kubernetes.client.ExtensionAdapter; import okhttp3.OkHttpClient; import java.net.URL; -import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -public class ServiceCatalogExtensionAdapter implements ExtensionAdapter { +public class ServiceCatalogExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter { static final ConcurrentMap IS_SERVICE_CATALOG = new ConcurrentHashMap<>(); static final ConcurrentMap USES_SERVICE_CATALOG_APIGROUPS = new ConcurrentHashMap<>(); @@ -37,35 +36,11 @@ public Class getExtensionType() { @Override public Boolean isAdaptable(Client client) { - return isServiceCatalogAvailable(client); + return isAdaptable(client, IS_SERVICE_CATALOG, USES_SERVICE_CATALOG_APIGROUPS, "servicecatalog.k8s.io"); } @Override public ServiceCatalogClient adapt(Client client) { return new DefaultServiceCatalogClient(client.adapt(OkHttpClient.class), client.getConfiguration()); } - - private boolean isServiceCatalogAvailable(Client client) { - URL masterUrl = client.getMasterUrl(); - if (IS_SERVICE_CATALOG.containsKey(masterUrl)) { - return IS_SERVICE_CATALOG.get(masterUrl); - } else { - RootPaths rootPaths = client.rootPaths(); - if (rootPaths != null) { - List paths = rootPaths.getPaths(); - if (paths != null) { - for (String path : paths) { - // lets detect the new API Groups APIs for OpenShift - if (path.endsWith("servicecatalog.k8s.io") || path.contains("servicecatalog.k8s.io/")) { - USES_SERVICE_CATALOG_APIGROUPS.putIfAbsent(masterUrl, true); - IS_SERVICE_CATALOG.putIfAbsent(masterUrl, true); - return true; - } - } - } - } - } - IS_SERVICE_CATALOG.putIfAbsent(masterUrl, false); - return false; - } } diff --git a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/TektonExtensionAdapter.java b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/TektonExtensionAdapter.java index fdc5bb61a31..b0c4643be43 100644 --- a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/TektonExtensionAdapter.java +++ b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/TektonExtensionAdapter.java @@ -15,17 +15,16 @@ */ package io.fabric8.tekton.client; +import io.fabric8.kubernetes.client.ExtensionAdapterSupport; import io.fabric8.kubernetes.client.Client; -import io.fabric8.kubernetes.api.model.RootPaths; import io.fabric8.kubernetes.client.ExtensionAdapter; import okhttp3.OkHttpClient; import java.net.URL; -import java.util.List; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentHashMap; -public class TektonExtensionAdapter implements ExtensionAdapter { +public class TektonExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter { static final ConcurrentMap IS_TEKTON = new ConcurrentHashMap<>(); static final ConcurrentMap USES_TEKTON_APIGROUPS = new ConcurrentHashMap<>(); @@ -37,35 +36,11 @@ public Class getExtensionType() { @Override public Boolean isAdaptable(Client client) { - return isTektonAvailable(client); + return isAdaptable(client, IS_TEKTON, USES_TEKTON_APIGROUPS, "tekton.dev"); } @Override public TektonClient adapt(Client client) { return new DefaultTektonClient(client.adapt(OkHttpClient.class), client.getConfiguration()); } - - private boolean isTektonAvailable(Client client) { - URL masterUrl = client.getMasterUrl(); - if (IS_TEKTON.containsKey(masterUrl)) { - return IS_TEKTON.get(masterUrl); - } else { - RootPaths rootPaths = client.rootPaths(); - if (rootPaths != null) { - List paths = rootPaths.getPaths(); - if (paths != null) { - for (String path : paths) { - // lets detect the new API Groups APIs for OpenShift - if (path.endsWith("tekton.dev") || path.contains("tekton.dev/")) { - USES_TEKTON_APIGROUPS.putIfAbsent(masterUrl, true); - IS_TEKTON.putIfAbsent(masterUrl, true); - return true; - } - } - } - } - } - IS_TEKTON.putIfAbsent(masterUrl, false); - return false; - } } diff --git a/extensions/volumesnapshot/client/pom.xml b/extensions/volumesnapshot/client/pom.xml new file mode 100644 index 00000000000..e521ca71de3 --- /dev/null +++ b/extensions/volumesnapshot/client/pom.xml @@ -0,0 +1,192 @@ + + + + 4.0.0 + + io.fabric8 + volumesnapshot + 4.10-SNAPSHOT + + + volumesnapshot-client + bundle + Fabric8 :: Volume Snapshot :: Client + + + false + + io.fabric8.kubernetes.api.builder, + !io.fabric8.volumesnapshot.client.*, + * + + + io.fabric8.volumesnapshot.client.* + + + /META-INF/services/io.fabric8.kubernetes.client.ExtensionAdapter=target/classes/META-INF/services/io.fabric8.kubernetes.client.ExtensionAdapter, + /META-INF/services/io.fabric8.kubernetes.client.ResourceHandler=target/classes/META-INF/services/io.fabric8.kubernetes.client.ResourceHandler + + + + + + io.fabric8 + volumesnapshot-model + ${project.version} + + + + io.fabric8 + kubernetes-client + + + io.sundr + * + + + + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + + + io.sundr + builder-annotations + + + io.sundr + transform-annotations + + + org.projectlombok + lombok + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-migrationsupport + test + + + + + + + org.apache.maven.plugins + maven-release-plugin + + + org.apache.maven.plugins + maven-gpg-plugin + + 4uds0n + true + + + + + io.sundr + sundr-maven-plugin + ${sundrio.version} + + + + volumesnapshot-java-api-bom + Snowdrop :: Volume Snapshot ::Bom + + true + + + + volumesnapshot-java-api-bom-with-deps + Snowdrop :: Volume Snapshot ::Bom with Dependencies + + + com.squareup*:* + com.fasterxml.jackson*:* + + + + true + + + + + + + + generate-bom + + + + + + + org.codehaus.mojo + buildnumber-maven-plugin + ${buildnumber.plugin.version} + + + get-build-timestamp + initialize + + create-timestamp + + + + EEE, d MMM yyyy HH:mm:ss Z + build.datetime + + + + get-scm-revision + initialize + + create + + + false + false + UNKNOWN + true + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + zip + gz + jar + + + + + + + diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/CodeGen.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/CodeGen.java new file mode 100644 index 00000000000..7f945fdb69a --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/CodeGen.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client; + +import io.sundr.codegen.annotations.ResourceSelector; +import io.sundr.transform.annotations.VelocityTransformation; +import io.sundr.transform.annotations.VelocityTransformations; + +@VelocityTransformations( + value = { + @VelocityTransformation("/resource-operation.vm"), + @VelocityTransformation("/resource-handler.vm"), + @VelocityTransformation(value = "/resource-handler-services.vm", gather = true, outputPath = "META-INF/services/io.fabric8.kubernetes.client.ResourceHandler") + }, + resources = { + @ResourceSelector("model.properties") + } + +) +public class CodeGen { +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/DefaultVolumeSnapshotClient.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/DefaultVolumeSnapshotClient.java new file mode 100644 index 00000000000..dbcc389f6a7 --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/DefaultVolumeSnapshotClient.java @@ -0,0 +1,87 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client; + +import io.fabric8.kubernetes.client.BaseClient; +import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.ConfigBuilder; +import io.fabric8.kubernetes.client.RequestConfig; +import io.fabric8.kubernetes.client.WithRequestCallable; +import io.fabric8.kubernetes.client.dsl.FunctionCallable; +import io.fabric8.kubernetes.client.dsl.MixedOperation; +import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshot; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshotClass; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshotContent; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshot; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClass; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClassList; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotContent; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentList; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotList; +import io.fabric8.volumesnapshot.client.internal.VolumeSnapshotClassOperationsImpl; +import io.fabric8.volumesnapshot.client.internal.VolumeSnapshotClassResource; +import io.fabric8.volumesnapshot.client.internal.VolumeSnapshotContentOperationsImpl; +import io.fabric8.volumesnapshot.client.internal.VolumeSnapshotContentResource; +import io.fabric8.volumesnapshot.client.internal.VolumeSnapshotOperationsImpl; +import io.fabric8.volumesnapshot.client.internal.VolumeSnapshotResource; +import okhttp3.OkHttpClient; + +public class DefaultVolumeSnapshotClient extends BaseClient implements NamespacedVolumeSnapshotClient { + + public DefaultVolumeSnapshotClient() { + super(); + } + + public DefaultVolumeSnapshotClient(Config configuration) { + super(configuration); + } + + public DefaultVolumeSnapshotClient(OkHttpClient httpClient, Config configuration) { + super(httpClient, configuration); + } + + public NonNamespaceOperation volumeSnapshotClasses() { + return new VolumeSnapshotClassOperationsImpl(this.getHttpClient(), this.getConfiguration()); + } + + public NonNamespaceOperation volumeSnapshotContents() { + return new VolumeSnapshotContentOperationsImpl(this.getHttpClient(), this.getConfiguration()); + } + + public MixedOperation volumeSnapshots() { + return new VolumeSnapshotOperationsImpl(this.getHttpClient(), this.getConfiguration()); + } + + @Override + public NamespacedVolumeSnapshotClient inAnyNamespace() { + return inNamespace(null); + } + + @Override + public NamespacedVolumeSnapshotClient inNamespace(String namespace) { + Config updated = new ConfigBuilder(getConfiguration()) + .withNamespace(namespace) + .build(); + + return new DefaultVolumeSnapshotClient(getHttpClient(), updated); + } + + @Override + public FunctionCallable withRequestConfig(RequestConfig requestConfig) { + return new WithRequestCallable<>(this, requestConfig); + } +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/GenericVolumeSnapshotClient.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/GenericVolumeSnapshotClient.java new file mode 100644 index 00000000000..2287980c248 --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/GenericVolumeSnapshotClient.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client; + +import io.fabric8.kubernetes.client.Client; +import io.fabric8.kubernetes.client.dsl.AnyNamespaceable; +import io.fabric8.kubernetes.client.dsl.Namespaceable; +import io.fabric8.kubernetes.client.dsl.RequestConfigurable; + +public interface GenericVolumeSnapshotClient extends Client, VolumeSnapshotClient, + Namespaceable, + AnyNamespaceable, + RequestConfigurable { +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/NamespacedVolumeSnapshotClient.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/NamespacedVolumeSnapshotClient.java new file mode 100644 index 00000000000..257da1b1e11 --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/NamespacedVolumeSnapshotClient.java @@ -0,0 +1,19 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client; + +public interface NamespacedVolumeSnapshotClient extends VolumeSnapshotClient, GenericVolumeSnapshotClient { +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotClient.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotClient.java new file mode 100644 index 00000000000..90272cd8b13 --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotClient.java @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client; + + +import io.fabric8.kubernetes.client.Client; +import io.fabric8.kubernetes.client.dsl.MixedOperation; +import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshot; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshotClass; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshotContent; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshot; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClass; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClassList; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotContent; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentList; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotList; +import io.fabric8.volumesnapshot.client.internal.VolumeSnapshotClassResource; +import io.fabric8.volumesnapshot.client.internal.VolumeSnapshotContentResource; +import io.fabric8.volumesnapshot.client.internal.VolumeSnapshotResource; + +public interface VolumeSnapshotClient extends Client { + + NonNamespaceOperation volumeSnapshotClasses(); + + NonNamespaceOperation volumeSnapshotContents(); + + MixedOperation volumeSnapshots(); +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotExtensionAdapter.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotExtensionAdapter.java new file mode 100644 index 00000000000..ed4ab63febc --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotExtensionAdapter.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client; + +import io.fabric8.kubernetes.client.ExtensionAdapterSupport; +import io.fabric8.kubernetes.client.Client; +import io.fabric8.kubernetes.client.ExtensionAdapter; +import okhttp3.OkHttpClient; + +import java.net.URL; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +public class VolumeSnapshotExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter { + + static final ConcurrentMap IS_VOLUME_SNAPSHOT = new ConcurrentHashMap<>(); + static final ConcurrentMap USES_VOLUME_SNAPSHOT_APIGROUPS = new ConcurrentHashMap<>(); + public static final String API_GROUP = "snapshot.storage.k8s.io"; + + @Override + public Class getExtensionType() { + return VolumeSnapshotClient.class; + } + + @Override + public Boolean isAdaptable(Client client) { + return isAdaptable(client, IS_VOLUME_SNAPSHOT, USES_VOLUME_SNAPSHOT_APIGROUPS, API_GROUP); + } + + @Override + public VolumeSnapshotClient adapt(Client client) { + return new DefaultVolumeSnapshotClient(client.adapt(OkHttpClient.class), client.getConfiguration()); + } + +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotClassOperationsImpl.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotClassOperationsImpl.java new file mode 100644 index 00000000000..d1eb612c0b8 --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotClassOperationsImpl.java @@ -0,0 +1,64 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client.internal; + +import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.dsl.base.BaseOperation; +import io.fabric8.kubernetes.client.dsl.base.HasMetadataOperation; +import io.fabric8.kubernetes.client.dsl.base.OperationContext; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshotClass; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClass; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClassList; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotList; +import okhttp3.OkHttpClient; + +import java.util.HashMap; +import java.util.Map; + + +public class VolumeSnapshotClassOperationsImpl extends HasMetadataOperation implements VolumeSnapshotClassResource { + + public VolumeSnapshotClassOperationsImpl(OkHttpClient client, Config config) { + this(new OperationContext().withOkhttpClient(client).withConfig(config)); + } + + public VolumeSnapshotClassOperationsImpl(OperationContext context) { + super(context.withApiGroupName("snapshot.storage.k8s.io").withApiGroupVersion("v1beta1").withPlural("volumesnapshotclasses")); + this.type = VolumeSnapshotClass.class; + this.listType = VolumeSnapshotClassList.class; + this.doneableType = DoneableVolumeSnapshotClass.class; + } + + @Override + public BaseOperation newInstance(OperationContext context) { + return new VolumeSnapshotClassOperationsImpl(context); + } + + @Override + public boolean isResourceNamespaced() { + return false; + } + + @Override + public VolumeSnapshotList listSnapshots() { + VolumeSnapshotClass item = get(); + Map fields = new HashMap<>(); + fields.put("spec.volumeSnapshotClassName", item.getMetadata().getName()); + return new VolumeSnapshotOperationsImpl(context.withName(null)) + .withFields(fields) + .list(); + } +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotClassResource.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotClassResource.java new file mode 100644 index 00000000000..187c3adb24f --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotClassResource.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client.internal; + +import io.fabric8.kubernetes.client.dsl.Resource; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshotClass; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClass; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotList; + +public interface VolumeSnapshotClassResource extends Resource { + VolumeSnapshotList listSnapshots(); +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotContentOperationsImpl.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotContentOperationsImpl.java new file mode 100644 index 00000000000..14ded75d562 --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotContentOperationsImpl.java @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client.internal; + +import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.dsl.base.BaseOperation; +import io.fabric8.kubernetes.client.dsl.base.HasMetadataOperation; +import io.fabric8.kubernetes.client.dsl.base.OperationContext; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshotContent; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotContent; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentList; +import okhttp3.OkHttpClient; + + +public class VolumeSnapshotContentOperationsImpl extends HasMetadataOperation implements VolumeSnapshotContentResource { + + public VolumeSnapshotContentOperationsImpl(OkHttpClient client, Config config) { + this(new OperationContext().withOkhttpClient(client).withConfig(config)); + } + + public VolumeSnapshotContentOperationsImpl(OperationContext context) { + super(context.withApiGroupName("snapshot.storage.k8s.io").withApiGroupVersion("v1beta1").withPlural("volumesnapshotcontents")); + this.type = VolumeSnapshotContent.class; + this.listType = VolumeSnapshotContentList.class; + this.doneableType = DoneableVolumeSnapshotContent.class; + } + + @Override + public BaseOperation newInstance(OperationContext context) { + return new VolumeSnapshotContentOperationsImpl(context); + } + + @Override + public boolean isResourceNamespaced() { + return false; + } +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotContentResource.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotContentResource.java new file mode 100644 index 00000000000..f13abf79a25 --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotContentResource.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client.internal; + +import io.fabric8.kubernetes.client.dsl.Resource; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshotContent; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotContent; + + +public interface VolumeSnapshotContentResource extends Resource { +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotOperationsImpl.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotOperationsImpl.java new file mode 100644 index 00000000000..1201e91cc9d --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotOperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client.internal; + +import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.dsl.base.BaseOperation; +import io.fabric8.kubernetes.client.dsl.base.HasMetadataOperation; +import io.fabric8.kubernetes.client.dsl.base.OperationContext; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshot; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshot; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotList; +import okhttp3.OkHttpClient; + +public class VolumeSnapshotOperationsImpl extends HasMetadataOperation implements VolumeSnapshotResource { + + public VolumeSnapshotOperationsImpl(OkHttpClient client, Config config) { + this(new OperationContext().withOkhttpClient(client).withConfig(config)); + } + + public VolumeSnapshotOperationsImpl(OperationContext ctx) { + super(ctx.withApiGroupName("snapshot.storage.k8s.io").withApiGroupVersion("v1beta1").withPlural("volumesnapshots")); + this.type = VolumeSnapshot.class; + this.listType = VolumeSnapshotList.class; + this.doneableType = DoneableVolumeSnapshot.class; + } + + @Override + public BaseOperation newInstance(OperationContext context) { + return new VolumeSnapshotOperationsImpl(context); + } + + @Override + public boolean isResourceNamespaced() { + return true; + } +} diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotResource.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotResource.java new file mode 100644 index 00000000000..711f48c674c --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/internal/VolumeSnapshotResource.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.client.internal; + +import io.fabric8.kubernetes.client.dsl.Resource; +import io.fabric8.volumesnapshot.api.model.DoneableVolumeSnapshot; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshot; + + +public interface VolumeSnapshotResource extends Resource { +} diff --git a/extensions/volumesnapshot/client/src/main/resources/META-INF/services/io.fabric8.kubernetes.client.ExtensionAdapter b/extensions/volumesnapshot/client/src/main/resources/META-INF/services/io.fabric8.kubernetes.client.ExtensionAdapter new file mode 100644 index 00000000000..7db29dd5707 --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/resources/META-INF/services/io.fabric8.kubernetes.client.ExtensionAdapter @@ -0,0 +1,17 @@ +# +# Copyright (C) 2018 Red Hat inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +io.fabric8.volumesnapshot.client.VolumeSnapshotExtensionAdapter diff --git a/extensions/volumesnapshot/client/src/main/resources/resource-handler-services.vm b/extensions/volumesnapshot/client/src/main/resources/resource-handler-services.vm new file mode 100644 index 00000000000..dd809768026 --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/resources/resource-handler-services.vm @@ -0,0 +1,18 @@ +#* + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# +#foreach ($i in ${model.values()}) +io.fabric8.volumesnapshot.client.handlers.${i.name}Handler +#end diff --git a/extensions/volumesnapshot/client/src/main/resources/resource-handler.vm b/extensions/volumesnapshot/client/src/main/resources/resource-handler.vm new file mode 100644 index 00000000000..ac168394006 --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/resources/resource-handler.vm @@ -0,0 +1,115 @@ +#* + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# + +#set ($version = "unknown") +#set ($annotations = $model.annotations) +#foreach ($annotation in $annotations) + #if ($annotation.getClassRef().getName().equals("ApiVersion")) + #set ($apiVersion = $annotation.getParameters().get("value")) + #end + #if ($annotation.getClassRef().getName().equals("ApiGroup")) + #set ($apiGroup = $annotation.getParameters().get("value")) + #end +#end + + +package io.fabric8.volumesnapshot.client.handlers; + +import java.util.function.Predicate; + +import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.ResourceHandler; +import io.fabric8.kubernetes.client.Watch; +import io.fabric8.kubernetes.client.Watcher; +import io.fabric8.volumesnapshot.client.internal.${model.name}OperationsImpl; + +import io.fabric8.kubernetes.client.dsl.base.OperationContext; +import okhttp3.OkHttpClient; + +import io.fabric8.kubernetes.api.model.DeletionPropagation; +import io.fabric8.kubernetes.api.model.ListOptions; +import ${model.fullyQualifiedName}; +import ${model.fullyQualifiedName}Builder; + +import java.util.TreeMap; +import java.util.concurrent.TimeUnit; + +public class ${model.name}Handler implements ResourceHandler<${model.name}, ${model.name}Builder> { + + @Override + public String getKind() { + return ${model.name}.class.getSimpleName(); + } + + @Override + public String getApiVersion() { + #if (${apiGroup} != "") + return "${apiGroup}/${apiVersion}"; + #else + return "${apiVersion}"; + #end + } + + @Override + public ${model.name} create(OkHttpClient client, Config config, String namespace, ${model.name} item) { + return new ${model.name}OperationsImpl(client, config).withItem(item).inNamespace(namespace).create(); + } + + @Override + public ${model.name} replace(OkHttpClient client, Config config, String namespace, ${model.name} item) { + return new ${model.name}OperationsImpl(client, config).withItem(item).inNamespace(namespace).withName(item.getMetadata().getName()).replace(item); + } + + @Override + public ${model.name} reload(OkHttpClient client, Config config, String namespace, ${model.name} item) { + return new ${model.name}OperationsImpl(client, config).withItem(item).inNamespace(namespace).withName(item.getMetadata().getName()).fromServer().get(); + } + + @Override + public ${model.name}Builder edit(${model.name} item) { + return new ${model.name}Builder(item); + } + + @Override + public Boolean delete(OkHttpClient client, Config config, String namespace, DeletionPropagation propagationPolicy, ${model.name} item) { + return new ${model.name}OperationsImpl(client, config).withItem(item).inNamespace(namespace).withName(item.getMetadata().getName()).withPropagationPolicy(propagationPolicy).delete(); + } + + @Override + public Watch watch(OkHttpClient client, Config config, String namespace, ${model.name} item, Watcher<${model.name}> watcher) { + return new ${model.name}OperationsImpl(client, config).withItem(item).inNamespace(namespace).withName(item.getMetadata().getName()).watch(watcher); + } + + @Override + public Watch watch(OkHttpClient client, Config config, String namespace, ${model.name} item, String resourceVersion, Watcher<${model.name}> watcher) { + return new ${model.name}OperationsImpl(client, config).withItem(item).inNamespace(namespace).withName(item.getMetadata().getName()).watch(resourceVersion, watcher); + } + + @Override + public Watch watch(OkHttpClient client, Config config, String namespace, ${model.name} item, ListOptions listOptions, Watcher<${model.name}> watcher) { + return new ${model.name}OperationsImpl(client, config).withItem(item).inNamespace(namespace).withName(item.getMetadata().getName()).watch(listOptions, watcher); + } + +@Override + public ${model.name} waitUntilReady(OkHttpClient client, Config config, String namespace, ${model.name} item, long amount, TimeUnit timeUnit) throws InterruptedException { + return new ${model.name}OperationsImpl(client, config).withItem(item).inNamespace(namespace).withName(item.getMetadata().getName()).waitUntilReady(amount, timeUnit); + } + + @Override + public ${model.name} waitUntilCondition(OkHttpClient client, Config config, String namespace, ${model.name} item, Predicate<${model.name}> condition, long amount, TimeUnit timeUnit) throws InterruptedException { + return new ${model.name}OperationsImpl(client, config).withItem(item).inNamespace(namespace).withName(item.getMetadata().getName()).waitUntilCondition(condition, amount, timeUnit); + } +} diff --git a/extensions/volumesnapshot/client/src/main/resources/resource-operation.vm b/extensions/volumesnapshot/client/src/main/resources/resource-operation.vm new file mode 100644 index 00000000000..d3b901de6cd --- /dev/null +++ b/extensions/volumesnapshot/client/src/main/resources/resource-operation.vm @@ -0,0 +1,79 @@ +#* + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# + +#set ($version = "unknown") +#set ($group = "") +#set ($annotations = $model.annotations) +#foreach ($annotation in $annotations) + #if ($annotation.getClassRef().getName().equals("ApiVersion")) + #set ($apiGroupVersion = $annotation.getParameters().get("value")) + #end + #if ($annotation.getClassRef().getName().equals("ApiGroup")) + #set ($apiGroupName = $annotation.getParameters().get("value")) + #end +#end + +#set ($isResourceNamespacedFlag = false) +#foreach ($impl in $model.getImplementsList()) + #if ($impl.getFullyQualifiedName().equals("io.fabric8.kubernetes.api.model.Namespaced")) + #set ($isResourceNamespacedFlag = true) + #end +#end + +package io.fabric8.volumesnapshot.client.internal; + +import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.dsl.Resource; +import io.fabric8.kubernetes.client.dsl.base.HasMetadataOperation; +import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; +import io.fabric8.kubernetes.client.utils.ApiVersionUtil; +import io.fabric8.kubernetes.client.dsl.base.OperationContext; + +import okhttp3.OkHttpClient; + +import ${model.packageName}.Doneable${model.name}; +import ${model.packageName}.${model.name}; +import ${model.packageName}.${model.name}List; +import ${model.packageName}.Doneable${model.name}; + +import java.util.Map; +import java.util.TreeMap; + + +public class ${model.name}OperationsImpl extends HasMetadataOperation<${model.name}, ${model.name}List, Doneable${model.name}, Resource<${model.name}, Doneable${model.name}>> { + + public ${model.name}OperationsImpl(OkHttpClient client, Config config) { + this(new OperationContext().withOkhttpClient(client).withConfig(config).withPropagationPolicy(DEFAULT_PROPAGATION_POLICY)); + } + + public ${model.name}OperationsImpl(OperationContext context) { + super(context.withApiGroupName("$apiGroupName") + .withApiGroupVersion("$apiGroupVersion") + .withPlural("#pluralize ($model.name.toLowerCase())")); + this.type = ${model.name}.class; + this.listType = ${model.name}List.class; + this.doneableType = Doneable${model.name}.class; + } + + public ${model.name}OperationsImpl newInstance(OperationContext context) { + return new ${model.name}OperationsImpl(context); + } + + @Override + public boolean isResourceNamespaced() { + return $isResourceNamespacedFlag; + } +} diff --git a/extensions/volumesnapshot/examples/pom.xml b/extensions/volumesnapshot/examples/pom.xml new file mode 100644 index 00000000000..003bb1b1d12 --- /dev/null +++ b/extensions/volumesnapshot/examples/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + io.fabric8 + volumesnapshot + 4.10-SNAPSHOT + + + volumesnapshot-examples + Fabric8 :: Volume Snapshot :: Examples + + + + io.fabric8 + volumesnapshot-client + ${project.version} + + + + diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ClientFactory.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ClientFactory.java new file mode 100644 index 00000000000..c9188868c2d --- /dev/null +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ClientFactory.java @@ -0,0 +1,80 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.examples; /** + * Copyright (C) 2015 Red Hat, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import io.fabric8.kubernetes.client.ConfigBuilder; +import io.fabric8.volumesnapshot.client.DefaultVolumeSnapshotClient; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; + + +public class ClientFactory { + private ClientFactory() {} + + public static VolumeSnapshotClient newClient(String[] args) { + ConfigBuilder config = new ConfigBuilder(); + for (int i = 0; i < args.length - 1; i++) { + + String key = args[i]; + String value = args[i + 1]; + + if (key.equals("--api-server")) { + config = config.withMasterUrl(value); + } + + if (key.equals("--token")) { + config = config.withOauthToken(value); + } + + if (key.equals("--username")) { + config = config.withUsername(value); + } + + if (key.equals("--password")) { + config = config.withPassword(value); + } + if (key.equals("--namespace")) { + config = config.withNamespace(value); + } + } + return new DefaultVolumeSnapshotClient(config.build()); + } + + public static String getOptions(String[] args, String name, String defaultValue) { + for (int i = 0; i < args.length - 1; i++) { + String key = args[i]; + String value = args[i + 1]; + if (key.equals(name)) { + return value; + } + } + return defaultValue; + } +} + diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshot.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshot.java new file mode 100644 index 00000000000..5e95fcf3b05 --- /dev/null +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshot.java @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.examples; /** + * Copyright (C) 2015 Red Hat, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import io.fabric8.volumesnapshot.api.model.VolumeSnapshot; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; + + +public class CreateVolumeSnapshot { + + public static void main(String[] args) { + VolumeSnapshotClient client = ClientFactory.newClient(args); + System.out.println("Creating a volume snapshot"); + VolumeSnapshot volumeSnapshot = client.volumeSnapshots().inNamespace("vlatombe").createNew() + .withNewMetadata() + .withName("my-snapshot") + .endMetadata() + .withNewSpec() + .withNewSource() + .withNewPersistentVolumeClaimName("my-pvc") + .endSource() + .endSpec() + .done(); + } +} diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshotClass.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshotClass.java new file mode 100644 index 00000000000..f77da2c985b --- /dev/null +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshotClass.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.examples; /** + * Copyright (C) 2015 Red Hat, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClass; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; + +public class CreateVolumeSnapshotClass { + + public static void main(String[] args) { + VolumeSnapshotClient client = ClientFactory.newClient(args); + VolumeSnapshotClass volumeSnapshotClass = client.volumeSnapshotClasses().createNew() + .withNewMetadata() + .withName("my-snapshot-class") + .endMetadata() + .withNewDriver("my-csi-driver") + .done(); + } +} diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshotClasses.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshotClasses.java new file mode 100644 index 00000000000..8f6fe477b18 --- /dev/null +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshotClasses.java @@ -0,0 +1,44 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.examples; /** + * Copyright (C) 2015 Red Hat, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClassList; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; + +public class ListVolumeSnapshotClasses { + + public static void main(String[] args) { + VolumeSnapshotClient client = ClientFactory.newClient(args); + System.out.println("Listing Volume Snapshot Classes:"); + VolumeSnapshotClassList list = client.volumeSnapshotClasses().list(); + list.getItems().forEach(b -> System.out.println(b.getDriver() + "\t\t\t\t" + b.getMetadata().getName())); + System.out.println("Done"); + } +} diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshotContents.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshotContents.java new file mode 100644 index 00000000000..21cfc298bdd --- /dev/null +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshotContents.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.examples; /** + * Copyright (C) 2015 Red Hat, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentList; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; + +public class ListVolumeSnapshotContents { + + public static void main(String[] args) { + VolumeSnapshotClient client = ClientFactory.newClient(args); + System.out.println("Listing Volume Snapshot Classes:"); + VolumeSnapshotContentList list = client.volumeSnapshotContents().list(); + list.getItems().forEach(b -> System.out.println( + b.getSpec().getVolumeSnapshotRef().getNamespace() + "/" + b.getSpec().getVolumeSnapshotRef().getName() + + "\t\t\t\t" + b.getSpec().getVolumeSnapshotClassName() + + "\t\t\t\t" + b.getMetadata().getName()) + ); + System.out.println("Done"); + } +} diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshots.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshots.java new file mode 100644 index 00000000000..e20d587fb9a --- /dev/null +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshots.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.examples; /** + * Copyright (C) 2015 Red Hat, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotList; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; + +public class ListVolumeSnapshots { + + public static void main(String[] args) { + VolumeSnapshotClient client = ClientFactory.newClient(args); + VolumeSnapshotList list = client.volumeSnapshots().list(); + System.out.println("Listing Volume Snapshots:"); + list.getItems().stream() + .map(b -> b.getMetadata().getName()) + .forEach(System.out::println); + System.out.println("Done"); + } +} diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/RemoveVolumeSnapshot.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/RemoveVolumeSnapshot.java new file mode 100644 index 00000000000..8af39a32f93 --- /dev/null +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/RemoveVolumeSnapshot.java @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.examples; /** + * Copyright (C) 2015 Red Hat, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; + +public class RemoveVolumeSnapshot { + + public static void main(String[] args) { + VolumeSnapshotClient client = ClientFactory.newClient(args); + if (client.volumeSnapshots().inNamespace("vlatombe").withName("my-snapshot").delete()) { + System.out.println("Volume Snapshot successfully deleted!"); + } + } +} diff --git a/extensions/volumesnapshot/generator/.gitignore b/extensions/volumesnapshot/generator/.gitignore new file mode 100644 index 00000000000..57872d0f1e5 --- /dev/null +++ b/extensions/volumesnapshot/generator/.gitignore @@ -0,0 +1 @@ +/vendor/ diff --git a/extensions/volumesnapshot/generator/Makefile b/extensions/volumesnapshot/generator/Makefile new file mode 100755 index 00000000000..297869292cb --- /dev/null +++ b/extensions/volumesnapshot/generator/Makefile @@ -0,0 +1,28 @@ +# +# Copyright (C) 2015 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +SHELL := /bin/bash + +all: build + +build: gobuild + pushd ../model && \ + mvn clean install -o && \ + popd + +gobuild: + go mod vendor + CGO_ENABLED=0 GO111MODULE=on GO15VENDOREXPERIMENT=1 go run -mod=vendor -a ./cmd/generate/generate.go > ../model/src/main/resources/schema/volumesnapshot-schema.json diff --git a/extensions/volumesnapshot/generator/cmd/generate/generate.go b/extensions/volumesnapshot/generator/cmd/generate/generate.go new file mode 100644 index 00000000000..00aeb6bbe64 --- /dev/null +++ b/extensions/volumesnapshot/generator/cmd/generate/generate.go @@ -0,0 +1,76 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package main + +import ( + "fmt" + "github.com/fabric8io/kubernetes-client/generator/pkg/schemagen" + volumesnapshot "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "reflect" +) + +func main() { + + // the CRD List types for which the model should be generated + // no other types need to be defined as they are auto discovered + crdLists := map[reflect.Type]schemagen.CrdScope{ + reflect.TypeOf(volumesnapshot.VolumeSnapshotClassList{}): schemagen.Cluster, + reflect.TypeOf(volumesnapshot.VolumeSnapshotContentList{}): schemagen.Cluster, + + reflect.TypeOf(volumesnapshot.VolumeSnapshotList{}): schemagen.Namespaced, + } + + // constraints and patterns for fields + constraints := map[reflect.Type]map[string]*schemagen.Constraint{} + + // types that are manually defined in the model + providedTypes := []schemagen.ProvidedType{} + + // go packages that are provided and where no generation is required and their corresponding java package + providedPackages := map[string]string{ + // external + "k8s.io/api/core/v1": "io.fabric8.kubernetes.api.model", + "k8s.io/apimachinery/pkg/apis/meta/v1": "io.fabric8.kubernetes.api.model", + "k8s.io/apimachinery/pkg/api/resource": "io.fabric8.kubernetes.api.model", + "k8s.io/apimachinery/pkg/runtime": "io.fabric8.kubernetes.api.model.runtime", + } + + // mapping of go packages of this module to the resulting java package + // optional ApiGroup and ApiVersion for the go package (which is added to the generated java class) + packageMapping := map[string]schemagen.PackageInformation{ + "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1": {JavaPackage: "io.fabric8.volumesnapshot.api.model", ApiGroup: "snapshot.storage.k8s.io", ApiVersion: "v1beta1"}, + } + + // converts all packages starting with to a java package using an automated scheme: + // - replace with aka "package prefix" + // - replace '/' with '.' for a valid java package name + // e.g. knative.dev/eventing/pkg/apis/messaging/v1beta1/ChannelTemplateSpec is mapped to "io.fabric8.knative.internal.eventing.pkg.apis.messaging.v1beta1.ChannelTemplateSpec" + mappingSchema := map[string]string{ + } + + // overwriting some times + manualTypeMap := map[reflect.Type]string{ + reflect.TypeOf(v1.Time{}): "java.lang.String", + reflect.TypeOf(runtime.RawExtension{}): "Map", + reflect.TypeOf([]byte{}): "java.lang.String", + } + + json := schemagen.GenerateSchema("http://fabric8.io/csi/VolumeSnapshotSchema#", crdLists, providedPackages, manualTypeMap, packageMapping, mappingSchema, providedTypes, constraints) + + fmt.Println(json) +} diff --git a/extensions/volumesnapshot/generator/go.mod b/extensions/volumesnapshot/generator/go.mod new file mode 100644 index 00000000000..0497c21d016 --- /dev/null +++ b/extensions/volumesnapshot/generator/go.mod @@ -0,0 +1,11 @@ +module github.com/fabric8io/kubernetes-client/extensions/volumesnapshot/generator + + require ( + github.com/fabric8io/kubernetes-client/generator v0.0.0 + github.com/kubernetes-csi/external-snapshotter/v2 v2.1.1 + k8s.io/apimachinery v0.18.2 + ) + + replace github.com/fabric8io/kubernetes-client/generator v0.0.0 => ./../../../generator + + go 1.13 diff --git a/extensions/volumesnapshot/generator/go.sum b/extensions/volumesnapshot/generator/go.sum new file mode 100644 index 00000000000..19777e6b565 --- /dev/null +++ b/extensions/volumesnapshot/generator/go.sum @@ -0,0 +1,290 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= +github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/container-storage-interface/spec v1.1.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4= +github.com/container-storage-interface/spec v1.2.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4= +github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= +github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= +github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/googleapis/gnostic v0.1.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kubernetes-csi/csi-lib-utils v0.7.0/go.mod h1:bze+2G9+cmoHxN6+WyG1qT4MDxgZJMLGwc7V4acPNm0= +github.com/kubernetes-csi/csi-test v2.0.0+incompatible/go.mod h1:YxJ4UiuPWIhMBkxUKY5c267DyA0uDZ/MtAimhx/2TA0= +github.com/kubernetes-csi/external-snapshotter/v2 v2.1.1 h1:t5bmB3Y8nCaLA4aFrIpX0zjHEF/HUkJp6f5rm7BsVzM= +github.com/kubernetes-csi/external-snapshotter/v2 v2.1.1/go.mod h1:dV5oB3U62KBdlf9ADWkMmjGd3USauqQtwIm2OZb5mqI= +github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220220014-0732a990476f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20191220175831-5c49e3ecc1c1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +k8s.io/api v0.17.0 h1:H9d/lw+VkZKEVIUc8F3wgiQ+FUXTTr21M87jXLU7yqM= +k8s.io/api v0.17.0/go.mod h1:npsyOePkeP0CPwyGfXDHxvypiYMJxBWAMpQxCaJ4ZxI= +k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= +k8s.io/apimachinery v0.17.1-beta.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= +k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA= +k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= +k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k= +k8s.io/code-generator v0.0.0-20191121015212-c4c8f8345c7e/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= +k8s.io/component-base v0.17.0/go.mod h1:rKuRAokNMY2nn2A6LP/MiwpoaMRHpfRnrPaUJJj1Yoc= +k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= +k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= +k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= +k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= +k8s.io/kubernetes v1.14.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= +k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= +modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= +modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= +modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= +modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= +modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= +sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e h1:4Z09Hglb792X0kfOBBJUPFEyvVfQWrYT/l8h5EKA6JQ= +sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= +sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= +sigs.k8s.io/structured-merge-diff/v3 v3.0.0 h1:dOmIZBMfhcHS09XZkMyUgkq5trg3/jRyJYFZUiaOp8E= +sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/extensions/volumesnapshot/mock/pom.xml b/extensions/volumesnapshot/mock/pom.xml new file mode 100644 index 00000000000..448ef6038d7 --- /dev/null +++ b/extensions/volumesnapshot/mock/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + io.fabric8 + volumesnapshot + 4.10-SNAPSHOT + + + volumesnapshot-server-mock + Fabric8 :: Volume Snapshot :: Server Mock + + + + io.fabric8 + kubernetes-server-mock + + + + io.fabric8 + volumesnapshot-client + ${project.version} + + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-migrationsupport + test + + + + diff --git a/extensions/volumesnapshot/mock/src/main/java/io/fabric8/volumesnapshot/server/mock/VolumeSnapshotMockServer.java b/extensions/volumesnapshot/mock/src/main/java/io/fabric8/volumesnapshot/server/mock/VolumeSnapshotMockServer.java new file mode 100644 index 00000000000..bc96ffcd30c --- /dev/null +++ b/extensions/volumesnapshot/mock/src/main/java/io/fabric8/volumesnapshot/server/mock/VolumeSnapshotMockServer.java @@ -0,0 +1,62 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.server.mock; + +import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.ConfigBuilder; +import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import io.fabric8.mockwebserver.Context; +import io.fabric8.mockwebserver.ServerRequest; +import io.fabric8.mockwebserver.ServerResponse; +import io.fabric8.volumesnapshot.client.DefaultVolumeSnapshotClient; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; +import okhttp3.mockwebserver.Dispatcher; +import okhttp3.mockwebserver.MockWebServer; + +import java.util.Map; +import java.util.Queue; + +import static okhttp3.TlsVersion.TLS_1_0; + +public class VolumeSnapshotMockServer extends KubernetesMockServer { + public VolumeSnapshotMockServer() { + super(); + } + + public VolumeSnapshotMockServer(boolean useHttps) { + super(useHttps); + } + + public VolumeSnapshotMockServer(Context context, MockWebServer server, Map> responses, Dispatcher dispatcher, boolean useHttps) { + super(context, server, responses, dispatcher, useHttps); + } + + @Override + public String[] getRootPaths() { + return new String[]{"/api", "/apis/snapshot.storage.k8s.io"}; + } + + public VolumeSnapshotClient createVolumeSnapshot() { + // FIXME + Config config = new ConfigBuilder() + .withMasterUrl(url("/")) + .withNamespace("test") + .withTrustCerts(true) + .withTlsVersions(TLS_1_0) + .build(); + return new DefaultVolumeSnapshotClient(config); + } +} diff --git a/extensions/volumesnapshot/mock/src/main/java/io/fabric8/volumesnapshot/server/mock/VolumeSnapshotServer.java b/extensions/volumesnapshot/mock/src/main/java/io/fabric8/volumesnapshot/server/mock/VolumeSnapshotServer.java new file mode 100644 index 00000000000..0315e5bef09 --- /dev/null +++ b/extensions/volumesnapshot/mock/src/main/java/io/fabric8/volumesnapshot/server/mock/VolumeSnapshotServer.java @@ -0,0 +1,70 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.server.mock; + +import io.fabric8.kubernetes.client.server.mock.KubernetesCrudDispatcher; +import io.fabric8.mockwebserver.Context; +import io.fabric8.mockwebserver.dsl.MockServerExpectation; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.rules.ExternalResource; + +import java.util.HashMap; + +public class VolumeSnapshotServer extends ExternalResource { + + protected VolumeSnapshotMockServer mock; + private VolumeSnapshotClient client; + + private boolean https; + private boolean crudMode; + + public VolumeSnapshotServer() { + this(true, false); + } + + public VolumeSnapshotServer(boolean https) { + this(https, false); + } + + public VolumeSnapshotServer(boolean https, boolean crudMode) { + this.https = https; + this.crudMode = crudMode; + } + + @Override + public void before() { + mock = crudMode + ? new VolumeSnapshotMockServer(new Context(), new MockWebServer(), new HashMap<>(), new KubernetesCrudDispatcher(), true) + : new VolumeSnapshotMockServer(https); + mock.init(); + client = mock.createVolumeSnapshot(); + } + + @Override + public void after() { + mock.destroy(); + client.close(); + } + + public VolumeSnapshotClient get() { + return client; + } + + public MockServerExpectation expect() { + return mock.expect(); + } +} diff --git a/extensions/volumesnapshot/model/pom.xml b/extensions/volumesnapshot/model/pom.xml new file mode 100755 index 00000000000..c20e997d056 --- /dev/null +++ b/extensions/volumesnapshot/model/pom.xml @@ -0,0 +1,170 @@ + + + + 4.0.0 + + io.fabric8 + volumesnapshot + 4.10-SNAPSHOT + + + volumesnapshot-model + bundle + Fabric8 :: Volume Snapshot :: Model + + + + io.fabric8.kubernetes.api.builder, + !io.fabric8.volumesnapshot.api.model.*, + * + + + io.fabric8.volumesnapshot.api.model.* + + + {maven-resources}, + /model.properties=target/classes/model.properties + + + true + + + + + io.sundr + builder-annotations + + + io.sundr + transform-annotations + + + io.fabric8 + kubernetes-model-core + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-migrationsupport + test + + + org.skyscreamer + jsonassert + test + + + org.projectlombok + lombok + + + + + + + com.mysema.maven + apt-maven-plugin + 1.1.3 + + + + process + + + ${project.build.directory}/generated-sources + io.sundr.builder.internal.processor.BuildableProcessor + + + + + + org.jsonschema2pojo + jsonschema2pojo-maven-plugin + ${jsonschema2pojo.version} + + ${project.basedir}/src/main/resources/schema + io.fabric8.volumesnapshot.api.model + true + false + false + false + ${project.build.directory}/generated-sources + io.fabric8.kubernetes.ModelAnnotator + + + + generate + generate-sources + + generate + + + + + + io.fabric8 + model-annotator + ${project.version} + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${maven.buildhelper.plugin.version} + + + attach-artifacts + package + + attach-artifact + + + + + ${project.build.outputDirectory}/schema/volumesnapshot-schema.json + json + schema + + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + + 4uds0n + true + + + + + + diff --git a/extensions/volumesnapshot/model/src/main/java/io/fabric8/volumesnapshot/api/model/Constants.java b/extensions/volumesnapshot/model/src/main/java/io/fabric8/volumesnapshot/api/model/Constants.java new file mode 100755 index 00000000000..f14744f1707 --- /dev/null +++ b/extensions/volumesnapshot/model/src/main/java/io/fabric8/volumesnapshot/api/model/Constants.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.api.model; + +public class Constants { + + private Constants() {} + + public static final String BUILDER_PACKAGE = "io.fabric8.kubernetes.api.builder"; +} diff --git a/extensions/volumesnapshot/model/src/main/java/io/fabric8/volumesnapshot/api/model/VolumeSnapshotResourceMappingProvider.java b/extensions/volumesnapshot/model/src/main/java/io/fabric8/volumesnapshot/api/model/VolumeSnapshotResourceMappingProvider.java new file mode 100644 index 00000000000..10e227e66e2 --- /dev/null +++ b/extensions/volumesnapshot/model/src/main/java/io/fabric8/volumesnapshot/api/model/VolumeSnapshotResourceMappingProvider.java @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.api.model; + +import io.fabric8.kubernetes.api.KubernetesResourceMappingProvider; +import io.fabric8.kubernetes.api.model.KubernetesResource; + +import java.util.HashMap; +import java.util.Map; + +public class VolumeSnapshotResourceMappingProvider implements KubernetesResourceMappingProvider { + + public final Map> mappings = new HashMap<>(); + + public VolumeSnapshotResourceMappingProvider() { + mappings.put("snapshot.storage.k8s.io/v1beta1#VolumeSnapshot", VolumeSnapshot.class); + mappings.put("snapshot.storage.k8s.io/v1beta1#VolumeSnapshotClass", VolumeSnapshotClass.class); + mappings.put("snapshot.storage.k8s.io/v1beta1#VolumeSnapshotContent", VolumeSnapshotContent.class); + } + + public Map> getMappings() { + return mappings; + } +} diff --git a/extensions/volumesnapshot/model/src/main/resources/META-INF/services/io.fabric8.kubernetes.api.KubernetesResourceMappingProvider b/extensions/volumesnapshot/model/src/main/resources/META-INF/services/io.fabric8.kubernetes.api.KubernetesResourceMappingProvider new file mode 100644 index 00000000000..846b17f7eac --- /dev/null +++ b/extensions/volumesnapshot/model/src/main/resources/META-INF/services/io.fabric8.kubernetes.api.KubernetesResourceMappingProvider @@ -0,0 +1,17 @@ +# +# Copyright (C) 2018 Red Hat inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +io.fabric8.volumesnapshot.api.model.VolumeSnapshotResourceMappingProvider diff --git a/extensions/volumesnapshot/model/src/main/resources/schema/volumesnapshot-schema.json b/extensions/volumesnapshot/model/src/main/resources/schema/volumesnapshot-schema.json new file mode 100644 index 00000000000..a88df429eb8 --- /dev/null +++ b/extensions/volumesnapshot/model/src/main/resources/schema/volumesnapshot-schema.json @@ -0,0 +1,440 @@ +{ + "id": "http://fabric8.io/csi/VolumeSnapshotSchema#", + "$schema": "http://json-schema.org/schema#", + "definitions": { + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshot": { + "type": "object", + "description": "", + "properties": { + "apiVersion": { + "type": "string", + "description": "", + "default": "snapshot.storage.k8s.io/v1beta1", + "required": true + }, + "kind": { + "type": "string", + "description": "", + "default": "VolumeSnapshot", + "required": true + }, + "metadata": { + "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta" + }, + "spec": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotSpec", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotSpec" + }, + "status": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotStatus", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotStatus" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshot", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.HasMetadata", + "io.fabric8.kubernetes.api.model.Namespaced" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotClass": { + "type": "object", + "description": "", + "properties": { + "apiVersion": { + "type": "string", + "description": "", + "default": "snapshot.storage.k8s.io/v1beta1", + "required": true + }, + "deletionPolicy": { + "type": "string", + "description": "" + }, + "driver": { + "type": "string", + "description": "" + }, + "kind": { + "type": "string", + "description": "", + "default": "VolumeSnapshotClass", + "required": true + }, + "metadata": { + "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta" + }, + "parameters": { + "type": "object", + "description": "", + "javaType": "java.util.Map\u003cString,String\u003e" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotClass", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.HasMetadata" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotClassList": { + "type": "object", + "description": "", + "properties": { + "apiVersion": { + "type": "string", + "description": "", + "default": "snapshot.storage.k8s.io/v1beta1", + "required": true + }, + "items": { + "type": "array", + "description": "", + "items": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotClass", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotClass" + } + }, + "kind": { + "type": "string", + "description": "", + "default": "VolumeSnapshotClassList", + "required": true + }, + "metadata": { + "javaType": "io.fabric8.kubernetes.api.model.ListMeta" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotClassList", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource", + "io.fabric8.kubernetes.api.model.KubernetesResourceList\u003cio.fabric8.volumesnapshot.api.model.VolumeSnapshotClass\u003e" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContent": { + "type": "object", + "description": "", + "properties": { + "apiVersion": { + "type": "string", + "description": "", + "default": "snapshot.storage.k8s.io/v1beta1", + "required": true + }, + "kind": { + "type": "string", + "description": "", + "default": "VolumeSnapshotContent", + "required": true + }, + "metadata": { + "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta" + }, + "spec": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentSpec", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentSpec" + }, + "status": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentStatus", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentStatus" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContent", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.HasMetadata" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentList": { + "type": "object", + "description": "", + "properties": { + "apiVersion": { + "type": "string", + "description": "", + "default": "snapshot.storage.k8s.io/v1beta1", + "required": true + }, + "items": { + "type": "array", + "description": "", + "items": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContent", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContent" + } + }, + "kind": { + "type": "string", + "description": "", + "default": "VolumeSnapshotContentList", + "required": true + }, + "metadata": { + "javaType": "io.fabric8.kubernetes.api.model.ListMeta" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentList", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource", + "io.fabric8.kubernetes.api.model.KubernetesResourceList\u003cio.fabric8.volumesnapshot.api.model.VolumeSnapshotContent\u003e" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentSource": { + "type": "object", + "description": "", + "properties": { + "snapshotHandle": { + "type": "string", + "description": "", + "javaType": "String" + }, + "volumeHandle": { + "type": "string", + "description": "", + "javaType": "String" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentSource", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentSpec": { + "type": "object", + "description": "", + "properties": { + "deletionPolicy": { + "type": "string", + "description": "" + }, + "driver": { + "type": "string", + "description": "" + }, + "source": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentSource", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentSource" + }, + "volumeSnapshotClassName": { + "type": "string", + "description": "", + "javaType": "String" + }, + "volumeSnapshotRef": { + "javaType": "io.fabric8.kubernetes.api.model.ObjectReference" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentSpec", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentStatus": { + "type": "object", + "description": "", + "properties": { + "creationTime": { + "type": "integer", + "description": "", + "javaType": "Long" + }, + "error": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotError", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotError" + }, + "readyToUse": { + "type": "boolean", + "description": "", + "javaType": "Boolean" + }, + "restoreSize": { + "type": "integer", + "description": "", + "javaType": "Long" + }, + "snapshotHandle": { + "type": "string", + "description": "", + "javaType": "String" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentStatus", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotError": { + "type": "object", + "description": "", + "properties": { + "message": { + "type": "string", + "description": "", + "javaType": "String" + }, + "time": { + "javaType": "java.lang.String" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotError", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotList": { + "type": "object", + "description": "", + "properties": { + "apiVersion": { + "type": "string", + "description": "", + "default": "snapshot.storage.k8s.io/v1beta1", + "required": true + }, + "items": { + "type": "array", + "description": "", + "items": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshot", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshot" + } + }, + "kind": { + "type": "string", + "description": "", + "default": "VolumeSnapshotList", + "required": true + }, + "metadata": { + "javaType": "io.fabric8.kubernetes.api.model.ListMeta" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotList", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource", + "io.fabric8.kubernetes.api.model.KubernetesResourceList\u003cio.fabric8.volumesnapshot.api.model.VolumeSnapshot\u003e" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotSource": { + "type": "object", + "description": "", + "properties": { + "persistentVolumeClaimName": { + "type": "string", + "description": "", + "javaType": "String" + }, + "volumeSnapshotContentName": { + "type": "string", + "description": "", + "javaType": "String" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotSource", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotSpec": { + "type": "object", + "description": "", + "properties": { + "source": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotSource", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotSource" + }, + "volumeSnapshotClassName": { + "type": "string", + "description": "", + "javaType": "String" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotSpec", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotStatus": { + "type": "object", + "description": "", + "properties": { + "boundVolumeSnapshotContentName": { + "type": "string", + "description": "", + "javaType": "String" + }, + "creationTime": { + "javaType": "java.lang.String" + }, + "error": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotError", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotError" + }, + "readyToUse": { + "type": "boolean", + "description": "", + "javaType": "Boolean" + }, + "restoreSize": { + "javaType": "io.fabric8.kubernetes.api.model.Quantity" + } + }, + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotStatus", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + } + }, + "type": "object", + "properties": { + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshot": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshot", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshot" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotClass": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotClass", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotClass" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotClassList": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotClassList", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotClassList" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContent": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContent", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContent" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentList": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentList", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentList" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentSource": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentSource", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentSource" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentSpec": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentSpec", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentSpec" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentStatus": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotContentStatus", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotContentStatus" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotError": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotError", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotError" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotList": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotList", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotList" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotSource": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotSource", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotSource" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotSpec": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotSpec", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotSpec" + }, + "github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotStatus": { + "$ref": "#/definitions/github_com_kubernetes-csi_external-snapshotter_v2_pkg_apis_volumesnapshot_v1beta1_VolumeSnapshotStatus", + "javaType": "io.fabric8.volumesnapshot.api.model.VolumeSnapshotStatus" + } + }, + "additionalProperties": false +} diff --git a/extensions/volumesnapshot/pom.xml b/extensions/volumesnapshot/pom.xml new file mode 100644 index 00000000000..a46dc033c9d --- /dev/null +++ b/extensions/volumesnapshot/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + kubernetes-extensions + io.fabric8 + 4.10-SNAPSHOT + + + volumesnapshot + pom + Fabric8 :: Volume Snapshot :: Extension + + + model + client + mock + examples + tests + + + diff --git a/extensions/volumesnapshot/tests/pom.xml b/extensions/volumesnapshot/tests/pom.xml new file mode 100644 index 00000000000..d77b61ec398 --- /dev/null +++ b/extensions/volumesnapshot/tests/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + io.fabric8 + volumesnapshot + 4.10-SNAPSHOT + + + volumesnapshot-tests + jar + Fabric8 :: Service Catalog :: Tests + + + + io.fabric8 + kubernetes-client + + + + io.fabric8 + volumesnapshot-server-mock + ${project.version} + test + + + + io.fabric8 + mockwebserver + ${mockwebserver.version} + test + + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-migrationsupport + test + + + + org.slf4j + slf4j-simple + ${slf4j.version} + test + + + + diff --git a/extensions/volumesnapshot/tests/src/test/java/io/fabric8/volumesnapshot/test/AdaptTest.java b/extensions/volumesnapshot/tests/src/test/java/io/fabric8/volumesnapshot/test/AdaptTest.java new file mode 100644 index 00000000000..b30e8c1a411 --- /dev/null +++ b/extensions/volumesnapshot/tests/src/test/java/io/fabric8/volumesnapshot/test/AdaptTest.java @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.test; + +import io.fabric8.kubernetes.client.DefaultKubernetesClient; +import io.fabric8.kubernetes.client.KubernetesClient; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; +import io.fabric8.volumesnapshot.server.mock.VolumeSnapshotMockServer; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport; + +import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@EnableRuleMigrationSupport +class AdaptTest { + + private VolumeSnapshotMockServer mock = new VolumeSnapshotMockServer(); + + @BeforeEach + public void setUp() { + mock.init(); + } + + @AfterEach + public void tearDown() throws IOException { + mock.destroy(); + } + + @Test + void testAdapt() { + VolumeSnapshotClient sc = mock.createVolumeSnapshot(); + KubernetesClient kc = new DefaultKubernetesClient(sc.getConfiguration()); + assertNotNull(kc.adapt(VolumeSnapshotClient.class)); + } +} diff --git a/extensions/volumesnapshot/tests/src/test/java/io/fabric8/volumesnapshot/test/crud/VolumeSnapshotClassTest.java b/extensions/volumesnapshot/tests/src/test/java/io/fabric8/volumesnapshot/test/crud/VolumeSnapshotClassTest.java new file mode 100644 index 00000000000..6737415349e --- /dev/null +++ b/extensions/volumesnapshot/tests/src/test/java/io/fabric8/volumesnapshot/test/crud/VolumeSnapshotClassTest.java @@ -0,0 +1,96 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.test.crud; + + +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClass; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClassBuilder; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClassList; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; +import io.fabric8.volumesnapshot.client.internal.VolumeSnapshotClassResource; +import io.fabric8.volumesnapshot.server.mock.VolumeSnapshotServer; +import org.junit.Rule; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +@EnableRuleMigrationSupport +class VolumeSnapshotClassTest { + + @Rule + public VolumeSnapshotServer server = new VolumeSnapshotServer(true, true); + + @Test + void testCrud() { + VolumeSnapshotClient client = server.get(); + VolumeSnapshotClass vsc1 = new VolumeSnapshotClassBuilder() + .withNewMetadata() + .withName("csi-snapclass1") + .addToLabels("key1", "value1") + .endMetadata() + .withDriver("foo.csi.k8s.io") + .withDeletionPolicy("Delete") + .build(); + VolumeSnapshotClass vsc2 = new VolumeSnapshotClassBuilder() + .withNewMetadata() + .withName("csi-snapclass2") + .addToLabels("key2", "value2") + .endMetadata() + .withDriver("foo.csi.k8s.io") + .withDeletionPolicy("Delete") + .build(); + VolumeSnapshotClass vsc3 = new VolumeSnapshotClassBuilder() + .withNewMetadata() + .withName("csi-snapclass3") + .addToLabels("key3", "value3") + .endMetadata() + .withDriver("foo.csi.k8s.io") + .withDeletionPolicy("Delete") + .build(); + + //Create + client.volumeSnapshotClasses().create(vsc1); + client.volumeSnapshotClasses().create(vsc2); + client.volumeSnapshotClasses().create(vsc3); + + //Read + VolumeSnapshotClassList vscList = client.volumeSnapshotClasses().list(); + assertNotNull(vscList); + assertEquals(3, vscList.getItems().size()); + + VolumeSnapshotClassResource scr1 = client.volumeSnapshotClasses().withName("csi-snapclass1"); + VolumeSnapshotClass sc1 = scr1.get(); + assertNotNull(sc1); + + //Update + VolumeSnapshotClass u1 = client.volumeSnapshotClasses().withName("csi-snapclass2").edit() + .editMetadata() + .addToLabels("updated", "true") + .endMetadata() + .done(); + + assertNotNull(u1); + assertEquals("true", u1.getMetadata().getLabels().get("updated")); + + //Delete + assertTrue(scr1.delete()); + assertNull(scr1.get()); + } +} diff --git a/extensions/volumesnapshot/tests/src/test/java/io/fabric8/volumesnapshot/test/crud/VolumeSnapshotTest.java b/extensions/volumesnapshot/tests/src/test/java/io/fabric8/volumesnapshot/test/crud/VolumeSnapshotTest.java new file mode 100644 index 00000000000..317a19a452e --- /dev/null +++ b/extensions/volumesnapshot/tests/src/test/java/io/fabric8/volumesnapshot/test/crud/VolumeSnapshotTest.java @@ -0,0 +1,107 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.volumesnapshot.test.crud; + + +import io.fabric8.volumesnapshot.api.model.VolumeSnapshot; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotBuilder; +import io.fabric8.volumesnapshot.api.model.VolumeSnapshotList; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; +import io.fabric8.volumesnapshot.server.mock.VolumeSnapshotServer; +import org.junit.Rule; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +@EnableRuleMigrationSupport +class VolumeSnapshotTest { + + @Rule + public VolumeSnapshotServer server = new VolumeSnapshotServer(true, true); + + @Test + void testCrud() { + VolumeSnapshotClient client = server.get(); + VolumeSnapshot vs1 = new VolumeSnapshotBuilder() + .withNewMetadata() + .withName("my-snapshot1") + .addToLabels("key1", "value1") + .endMetadata() + .withNewSpec() + .withNewVolumeSnapshotClassName("my-vsc") + .withNewSource() + .withNewPersistentVolumeClaimName("my-pvc1") + .endSource() + .endSpec() + .build(); + VolumeSnapshot vs2 = new VolumeSnapshotBuilder() + .withNewMetadata() + .withName("my-snapshot2") + .addToLabels("key2", "value2") + .endMetadata() + .withNewSpec() + .withNewVolumeSnapshotClassName("my-vsc") + .withNewSource() + .withNewPersistentVolumeClaimName("my-pvc1") + .endSource() + .endSpec() + .build(); + VolumeSnapshot vs3 = new VolumeSnapshotBuilder() + .withNewMetadata() + .withName("my-snapshot3") + .addToLabels("key3", "value3") + .endMetadata() + .withNewSpec() + .withNewVolumeSnapshotClassName("my-vsc") + .withNewSource() + .withNewPersistentVolumeClaimName("my-pvc2") + .endSource() + .endSpec() + .build(); + + //Create + client.volumeSnapshots().create(vs1); + client.volumeSnapshots().create(vs2); + client.volumeSnapshots().create(vs3); + + //Read + VolumeSnapshotList vsList = client.volumeSnapshots().list(); + assertNotNull(vsList); + assertEquals(3, vsList.getItems().size()); + + VolumeSnapshot s1 = client.volumeSnapshots().withName("my-snapshot1").get(); + assertNotNull(s1); + + + //Update + VolumeSnapshot u1 = client.volumeSnapshots().withName("my-snapshot1").edit() + .editMetadata() + .addToLabels("updated", "true") + .endMetadata() + .done(); + + assertNotNull(u1); + assertEquals("true", u1.getMetadata().getLabels().get("updated")); + + //Delete + assertTrue(client.volumeSnapshots().withName("my-snapshot1").delete()); + assertNull(client.volumeSnapshots().withName("my-snapshot1").get()); + } +} diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/ExtensionAdapterSupport.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/ExtensionAdapterSupport.java new file mode 100644 index 00000000000..707e14f7d98 --- /dev/null +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/ExtensionAdapterSupport.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.kubernetes.client; + +import io.fabric8.kubernetes.api.model.RootPaths; + +import java.net.URL; +import java.util.List; +import java.util.concurrent.ConcurrentMap; + +public abstract class ExtensionAdapterSupport { + protected Boolean isAdaptable(Client client, ConcurrentMap isApi, ConcurrentMap usesApiGroups, String apiGroup) { + URL masterUrl = client.getMasterUrl(); + if (isApi.containsKey(masterUrl)) { + return isApi.get(masterUrl); + } else { + RootPaths rootPaths = client.rootPaths(); + if (rootPaths != null) { + List paths = rootPaths.getPaths(); + if (paths != null) { + for (String path : paths) { + // lets detect the new API Groups APIs for OpenShift + if (path.endsWith(apiGroup) || path.contains(apiGroup + "/")) { + usesApiGroups.putIfAbsent(masterUrl, true); + isApi.putIfAbsent(masterUrl, true); + return true; + } + } + } + } + } + isApi.putIfAbsent(masterUrl, false); + return false; + } +}