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.V1StatefulSet;
023import io.kubernetes.client.openapi.models.V1StatefulSetList;
024import java.util.List;
025
026/**
027 * A stub for stateful sets (v1).
028 */
029public class K8sV1StatefulSetStub
030        extends K8sGenericStub<V1StatefulSet, V1StatefulSetList> {
031
032    /** The stateful sets' context */
033    public static final APIResource CONTEXT
034        = new APIResource("apps", List.of("v1"), "v1", "StatefulSet", true,
035            "statefulsets", "statefulset");
036
037    /**
038     * Instantiates a new stub.
039     *
040     * @param client the client
041     * @param namespace the namespace
042     * @param name the name
043     */
044    protected K8sV1StatefulSetStub(K8sClient client, String namespace,
045            String name) {
046        super(V1StatefulSet.class, V1StatefulSetList.class, client, CONTEXT,
047            namespace, name);
048    }
049
050    /**
051     * Gets the stub for the given namespace and name.
052     *
053     * @param client the client
054     * @param namespace the namespace
055     * @param name the name
056     * @return the stateful set stub
057     */
058    public static K8sV1StatefulSetStub get(K8sClient client, String namespace,
059            String name) {
060        return new K8sV1StatefulSetStub(client, namespace, name);
061    }
062}