Package io.fabric8.kubernetes.client
Class CustomResource<S,T>
- java.lang.Object
-
- io.fabric8.kubernetes.client.CustomResource<S,T>
-
- Type Parameters:
S- the class providing theSpecpart of this CustomResourceT- the class providing theStatuspart of this CustomResource
- All Implemented Interfaces:
io.fabric8.kubernetes.api.model.HasMetadata,io.fabric8.kubernetes.api.model.KubernetesResource,Serializable
public abstract class CustomResource<S,T> extends Object implements io.fabric8.kubernetes.api.model.HasMetadata
A base class for implementing a custom resource kind. Implementations must be annotated withGroupandVersion. Properties are set up automatically as follows:- group is set using
HasMetadata.getGroup(Class) - version is set using
HasMetadata.getVersion(Class) - singular is set using
HasMetadata.getSingular(Class) - plural is set using
HasMetadata.getPlural(Class) - computed CRD name using
getCRDName(Class)
setApiVersion(String)andsetKind(String)are overridden to not do anything since these values are set.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CustomResource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)StringgetApiVersion()static String[]getCategories(Class<?> clazz)Retrieves the categories associated with this CustomResource or an empty array if none was providedStringgetCRDName()static StringgetCRDName(Class<?> clazz)Computes the name of the Custom Resource Definition (CRD) associated with the specified CustomResource.static booleangetDeprecated(Class<?> clazz)StringgetDeprecationWarning()static StringgetDeprecationWarning(Class<?> clazz)StringgetGroup()StringgetKind()io.fabric8.kubernetes.api.model.ObjectMetagetMetadata()StringgetPlural()StringgetScope()Retrieves the scope that this CustomResource targetsstatic booleangetServed(Class<?> clazz)static String[]getShortNames(Class<?> clazz)Retrieves the short names associated with this CustomResource or an empty array if none was providedStringgetSingular()SgetSpec()TgetStatus()static booleangetStorage(Class<?> clazz)StringgetVersion()inthashCode()protected SinitSpec()Override to provide your own Spec instanceprotected TinitStatus()Override to provide your own Status instancebooleanisDeprecated()booleanisServed()booleanisStorage()voidsetApiVersion(String version)voidsetKind(String kind)voidsetMetadata(io.fabric8.kubernetes.api.model.ObjectMeta metadata)voidsetSpec(S spec)voidsetStatus(T status)StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.fabric8.kubernetes.api.model.HasMetadata
addFinalizer, addOwnerReference, addOwnerReference, getFinalizers, getFullResourceName, getOwnerReferenceFor, getOwnerReferenceFor, hasFinalizer, hasOwnerReferenceFor, hasOwnerReferenceFor, initNameAndNamespaceFrom, isFinalizerValid, isMarkedForDeletion, optionalMetadata, removeFinalizer, removeOwnerReference, removeOwnerReference
-
-
-
-
Method Detail
-
getServed
public static boolean getServed(Class<?> clazz)
-
getStorage
public static boolean getStorage(Class<?> clazz)
-
getDeprecated
public static boolean getDeprecated(Class<?> clazz)
-
initSpec
protected S initSpec()
Override to provide your own Spec instance- Returns:
- a new Spec instance or
nullif the responsibility of instantiating the Spec is left to users of this CustomResource
-
initStatus
protected T initStatus()
Override to provide your own Status instance- Returns:
- a new Status instance or
nullif the responsibility of instantiating the Status is left to users of this CustomResource
-
getApiVersion
public String getApiVersion()
- Specified by:
getApiVersionin interfaceio.fabric8.kubernetes.api.model.HasMetadata
-
setApiVersion
public void setApiVersion(String version)
- Specified by:
setApiVersionin interfaceio.fabric8.kubernetes.api.model.HasMetadata
-
getKind
public String getKind()
- Specified by:
getKindin interfaceio.fabric8.kubernetes.api.model.HasMetadata
-
setKind
public void setKind(String kind)
-
getMetadata
public io.fabric8.kubernetes.api.model.ObjectMeta getMetadata()
- Specified by:
getMetadatain interfaceio.fabric8.kubernetes.api.model.HasMetadata
-
setMetadata
public void setMetadata(io.fabric8.kubernetes.api.model.ObjectMeta metadata)
- Specified by:
setMetadatain interfaceio.fabric8.kubernetes.api.model.HasMetadata
-
getPlural
public String getPlural()
- Specified by:
getPluralin interfaceio.fabric8.kubernetes.api.model.HasMetadata
-
getSingular
public String getSingular()
- Specified by:
getSingularin interfaceio.fabric8.kubernetes.api.model.HasMetadata
-
getCRDName
public static String getCRDName(Class<?> clazz)
Computes the name of the Custom Resource Definition (CRD) associated with the specified CustomResource. See https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/ for more details.- Parameters:
clazz- the CustomResource whose CRD name we want to compute- Returns:
- the CRD name associated with the CustomResource
-
getCRDName
public String getCRDName()
-
getShortNames
public static String[] getShortNames(Class<?> clazz)
Retrieves the short names associated with this CustomResource or an empty array if none was provided- Parameters:
clazz- the CustomResource class which short names we want to retrieve- Returns:
- the short names associated with this CustomResource or an empty array if none was provided
-
getCategories
public static String[] getCategories(Class<?> clazz)
Retrieves the categories associated with this CustomResource or an empty array if none was provided- Parameters:
clazz- the CustomResource class for which the categories are to be retrieved- Returns:
- the categories associated with this CustomResource or an empty array if none was provided
-
getScope
public String getScope()
Retrieves the scope that this CustomResource targets- Returns:
- the scope that this CustomResource targets. Possible values are
Scope.CLUSTERorScope.NAMESPACED.
-
getGroup
public String getGroup()
-
getVersion
public String getVersion()
-
isServed
public boolean isServed()
-
isStorage
public boolean isStorage()
-
isDeprecated
public boolean isDeprecated()
-
getDeprecationWarning
public String getDeprecationWarning()
-
getSpec
public S getSpec()
-
setSpec
public void setSpec(S spec)
-
getStatus
public T getStatus()
-
setStatus
public void setStatus(T status)
-
-