001/*
002 * VM-Operator
003 * Copyright (C) 2024 Michael N. Lipp
004 * 
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
017 */
018
019package org.jdrupes.vmoperator.common;
020
021import io.kubernetes.client.Discovery.APIResource;
022import io.kubernetes.client.openapi.models.V1ConfigMap;
023import io.kubernetes.client.openapi.models.V1ConfigMapList;
024import java.util.List;
025
026/**
027 * A stub for config maps (v1).
028 */
029@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
030public class K8sV1ConfigMapStub
031        extends K8sGenericStub<V1ConfigMap, V1ConfigMapList> {
032
033    public static final APIResource CONTEXT = new APIResource("", List.of("v1"),
034        "v1", "ConfigMap", true, "configmaps", "configmap");
035
036    /**
037     * Instantiates a new stub.
038     *
039     * @param client the client
040     * @param namespace the namespace
041     * @param name the name
042     */
043    protected K8sV1ConfigMapStub(K8sClient client, String namespace,
044            String name) {
045        super(V1ConfigMap.class, V1ConfigMapList.class, client,
046            CONTEXT, namespace, name);
047    }
048
049    /**
050     * Gets the stub for the given namespace and name.
051     *
052     * @param client the client
053     * @param namespace the namespace
054     * @param name the name
055     * @return the config map stub
056     */
057    public static K8sV1ConfigMapStub get(K8sClient client, String namespace,
058            String name) {
059        return new K8sV1ConfigMapStub(client, namespace, name);
060    }
061}