Package io.fabric8.kubernetes.api.model
Interface HasMetadata
-
- All Superinterfaces:
KubernetesResource,Serializable
- All Known Implementing Classes:
APIService,Binding,ComponentStatus,ConfigMap,Endpoints,Event,LimitRange,Namespace,Node,PersistentVolume,PersistentVolumeClaim,Pod,PodTemplate,ReplicationController,ResourceQuota,Secret,Service,ServiceAccount
public interface HasMetadata extends KubernetesResource
Represents anyKubernetesResourcewhich possesses aObjectMetaand is associated with a kind and API version.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDNS_LABEL_ENDstatic StringDNS_LABEL_REGEXPstatic StringDNS_LABEL_STARTstatic PatternFINALIZER_NAME_MATCHERPattern that checks the format of finalizer identifiers, which should be in<domain name>/<finalizer name>format.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleanaddFinalizer(String finalizer)Adds the specified finalizer to thisHasMetadataif it's valid.default StringgetApiVersion()static StringgetApiVersion(Class<? extends HasMetadata> clazz)Computes theapiVersionassociated with this HasMetadata implementation.static StringgetGroup(Class<? extends HasMetadata> clazz)Retrieves the group associated with the specified HasMetadata as defined by theGroupannotation.default StringgetKind()static StringgetKind(Class<? extends HasMetadata> clazz)Retrieves the kind associated with the specified HasMetadata implementation.ObjectMetagetMetadata()static StringgetVersion(Class<? extends HasMetadata> clazz)Retrieves the version associated with the specified HasMetadata as defined by theVersionannotation.default booleanhasFinalizer(String finalizer)Determines whether thisHasMetadataholds the specified finalizer.default booleanisFinalizerValid(String finalizer)Determines whether the specified finalizer is valid according to the finalizer specification.default booleanisMarkedForDeletion()Determines whether thisHasMetadatais marked for deletion or not.default booleanremoveFinalizer(String finalizer)Removes the specified finalizer if it's held by thisHasMetadata.voidsetApiVersion(String version)voidsetMetadata(ObjectMeta metadata)
-
-
-
Field Detail
-
DNS_LABEL_START
static final String DNS_LABEL_START
- See Also:
- Constant Field Values
-
DNS_LABEL_END
static final String DNS_LABEL_END
- See Also:
- Constant Field Values
-
DNS_LABEL_REGEXP
static final String DNS_LABEL_REGEXP
- See Also:
- Constant Field Values
-
FINALIZER_NAME_MATCHER
static final Pattern FINALIZER_NAME_MATCHER
Pattern that checks the format of finalizer identifiers, which should be in<domain name>/<finalizer name>format.
-
-
Method Detail
-
getMetadata
ObjectMeta getMetadata()
-
setMetadata
void setMetadata(ObjectMeta metadata)
-
getKind
static String getKind(Class<? extends HasMetadata> clazz)
Retrieves the kind associated with the specified HasMetadata implementation. If the implementation is annotated withKind, the annotation value will be used, otherwise the value will be derived from the class name.- Parameters:
clazz- the HasMetadata implementation whose Kind we want to retrieve- Returns:
- the kind associated with the specified HasMetadata
-
getKind
default String getKind()
-
getApiVersion
static String getApiVersion(Class<? extends HasMetadata> clazz)
Computes theapiVersionassociated with this HasMetadata implementation. The value is derived from theGroupandVersionannotations.- Parameters:
clazz- the HasMetadata whoseapiVersionwe want to compute- Returns:
- the computed
apiVersionornullif neitherGrouporVersionannotations are present - Throws:
IllegalArgumentException- if only one ofGrouporVersionis provided
-
getGroup
static String getGroup(Class<? extends HasMetadata> clazz)
Retrieves the group associated with the specified HasMetadata as defined by theGroupannotation.- Parameters:
clazz- the HasMetadata whose group we want to retrieve- Returns:
- the associated group or
nullif the HasMetadata is not annotated withGroup
-
getVersion
static String getVersion(Class<? extends HasMetadata> clazz)
Retrieves the version associated with the specified HasMetadata as defined by theVersionannotation.- Parameters:
clazz- the HasMetadata whose version we want to retrieve- Returns:
- the associated version or
nullif the HasMetadata is not annotated withVersion
-
getApiVersion
default String getApiVersion()
-
setApiVersion
void setApiVersion(String version)
-
isMarkedForDeletion
default boolean isMarkedForDeletion()
Determines whether thisHasMetadatais marked for deletion or not.- Returns:
trueif the cluster marked thisHasMetadatafor deletion,falseotherwise
-
hasFinalizer
default boolean hasFinalizer(String finalizer)
Determines whether thisHasMetadataholds the specified finalizer.- Parameters:
finalizer- the identifier of the finalizer we want to check- Returns:
trueif thisHasMetadataholds the specified finalizer,falseotherwise
-
addFinalizer
default boolean addFinalizer(String finalizer)
Adds the specified finalizer to thisHasMetadataif it's valid. SeeisFinalizerValid(String).- Parameters:
finalizer- the identifier of the finalizer to add to thisHasMetadatain<domain name>/<finalizer name>format.- Returns:
trueif the finalizer was successfully added,falseotherwise (in particular, if the object is marked for deletion)- Throws:
IllegalArgumentException- if the specified finalizer identifier is null or is invalid
-
isFinalizerValid
default boolean isFinalizerValid(String finalizer)
Determines whether the specified finalizer is valid according to the finalizer specification.- Parameters:
finalizer- the identifier of the finalizer which validity we want to check- Returns:
trueif the identifier is valid,falseotherwise
-
removeFinalizer
default boolean removeFinalizer(String finalizer)
Removes the specified finalizer if it's held by thisHasMetadata.- Parameters:
finalizer- the identifier of the finalizer we want to remove- Returns:
trueif the finalizer was successfully removed,falseotherwise
-
-