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