From 1415ee4f1efd9cbfa25bff1cc0851a14504542d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de> Date: Mon, 14 Mar 2022 15:52:53 +0100 Subject: [PATCH] Remove CustomResourceWrapper class --- .../theodolite/k8s/CustomResourceWrapper.kt | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 theodolite/src/main/kotlin/theodolite/k8s/CustomResourceWrapper.kt diff --git a/theodolite/src/main/kotlin/theodolite/k8s/CustomResourceWrapper.kt b/theodolite/src/main/kotlin/theodolite/k8s/CustomResourceWrapper.kt deleted file mode 100644 index 0ac0b42c4..000000000 --- a/theodolite/src/main/kotlin/theodolite/k8s/CustomResourceWrapper.kt +++ /dev/null @@ -1,48 +0,0 @@ -package theodolite.k8s - -import io.fabric8.kubernetes.api.model.KubernetesResource -import io.fabric8.kubernetes.client.NamespacedKubernetesClient -import io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext -import mu.KotlinLogging - -private val logger = KotlinLogging.logger {} - -@Deprecated("") -class CustomResourceWrapper( - val crAsMap: Map<String, String>, - private val context: CustomResourceDefinitionContext -) : KubernetesResource { - /** - * Deploy a service monitor - * - * @param client a namespaced Kubernetes client which are used to deploy the CR object. - * - * @throws java.io.IOException if the resource could not be deployed. - */ - fun deploy(client: NamespacedKubernetesClient) { - client.customResource(this.context) - .createOrReplace(client.configuration.namespace, this.crAsMap as Map<String, Any>) - } - - /** - * Delete a service monitor - * - * @param client a namespaced Kubernetes client which are used to delete the CR object. - */ - fun delete(client: NamespacedKubernetesClient) { - try { - client.customResource(this.context) - .delete(client.configuration.namespace, this.getName()) - } catch (e: Exception) { - logger.warn { "Could not delete custom resource" } - } - } - - /** - * @throws NullPointerException if name or metadata is null - */ - fun getName(): String { - val metadataAsMap = this.crAsMap["metadata"]!! as Map<String, String> - return metadataAsMap["name"]!! - } -} -- GitLab