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;
022
023/**
024 * A stub for namespaced custom objects. It uses a dynamic model
025 * (see {@link K8sDynamicModel}) for representing the object's
026 * state and can therefore be used for any kind of object, especially
027 * custom objects.
028 */
029@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
030public abstract class K8sDynamicStubBase<O extends K8sDynamicModel,
031        L extends K8sDynamicModelsBase<O>> extends K8sGenericStub<O, L> {
032
033    /**
034     * Instantiates a new dynamic stub.
035     *
036     * @param objectClass the object class
037     * @param objectListClass the object list class
038     * @param client the client
039     * @param context the context
040     * @param namespace the namespace
041     * @param name the name
042     */
043    @SuppressWarnings("PMD.ConstructorCallsOverridableMethod")
044    public K8sDynamicStubBase(Class<O> objectClass,
045            Class<L> objectListClass, DynamicTypeAdapterFactory<O, L> taf,
046            K8sClient client, APIResource context, String namespace,
047            String name) {
048        super(objectClass, objectListClass, client, context, namespace, name);
049        taf.register(client);
050    }
051}