public interface HasMetadata extends KubernetesResource
KubernetesResource which possesses a ObjectMeta and is associated with a kind and API version.| Modifier and Type | Field and Description |
|---|---|
static String |
DNS_LABEL_END |
static String |
DNS_LABEL_REGEXP |
static String |
DNS_LABEL_START |
static Pattern |
FINALIZER_NAME_MATCHER
Pattern that checks the format of finalizer identifiers, which should be in
<domain name>/<finalizer name> format. |
| Modifier and Type | Method and Description |
|---|---|
default boolean |
addFinalizer(String finalizer)
Adds the specified finalizer to this
HasMetadata if it's valid. |
default OwnerReference |
addOwnerReference(HasMetadata owner)
Adds an
OwnerReference to the specified owner if possible. |
default OwnerReference |
addOwnerReference(OwnerReference ownerReference)
Adds the specified, supposed valid (for example because validated by calling
sanitizeAndValidate(OwnerReference) beforehand), OwnerReference to this HasMetadata |
default String |
getApiVersion() |
static String |
getApiVersion(Class<?> clazz)
Computes the
apiVersion associated with this HasMetadata implementation. |
default List<String> |
getFinalizers() |
default String |
getFullResourceName() |
static String |
getFullResourceName(Class<?> clazz) |
static String |
getFullResourceName(String plural,
String group) |
static String |
getGroup(Class<?> clazz)
Retrieves the group associated with the specified HasMetadata as defined by the
Group annotation. |
default String |
getKind() |
static String |
getKind(Class<?> clazz)
Retrieves the kind associated with the specified HasMetadata implementation.
|
ObjectMeta |
getMetadata() |
default Optional<OwnerReference> |
getOwnerReferenceFor(HasMetadata owner)
Retrieves the
OwnerReference associated with the specified owner if it's part of this HasMetadata's owners. |
default Optional<OwnerReference> |
getOwnerReferenceFor(String ownerUid)
Retrieves the
OwnerReference associated with the owner identified by the specified UID if it's part of thisHasMetadata's owners. |
default String |
getPlural() |
static String |
getPlural(Class<?> clazz)
Retrieves the plural form associated with the specified class if annotated with
Plural or computes a default value using the value returned by getSingular(Class) as
input to Pluralize.toPlural(String). |
default String |
getSingular() |
static String |
getSingular(Class<?> clazz)
Retrieves the singular form associated with the specified class as defined by the
Singular annotation or computes a default value (lower-cased version of the value
returned by getKind(Class)) if the annotation is not present. |
static String |
getVersion(Class<?> clazz)
Retrieves the version associated with the specified HasMetadata as defined by the
Version annotation. |
default boolean |
hasFinalizer(String finalizer)
Determines whether this
HasMetadata holds the specified finalizer. |
default boolean |
hasOwnerReferenceFor(HasMetadata owner)
Checks whether the provided
HasMetadata is defined as an owner for this HasMetadata. |
default boolean |
hasOwnerReferenceFor(String ownerUid)
Checks whether the provided UID identifies an owner for this
HasMetadata. |
default boolean |
isFinalizerValid(String finalizer)
Determines whether the specified finalizer is valid according to the
finalizer specification.
|
default boolean |
isMarkedForDeletion()
Determines whether this
HasMetadata is marked for deletion or not. |
default Optional<ObjectMeta> |
optionalMetadata() |
default boolean |
removeFinalizer(String finalizer)
Removes the specified finalizer if it's held by this
HasMetadata. |
default void |
removeOwnerReference(HasMetadata owner)
Removes the
OwnerReference associated with the specified owner if it's part of this HasMetadata's owner references |
default void |
removeOwnerReference(String ownerUid)
Removes the
OwnerReference identified by the specified UID if it's part of this HasMetadata's owner references |
static OwnerReference |
sanitizeAndValidate(OwnerReference ownerReference)
Sanitizes and validates the specified
OwnerReference, presumably to add it |
void |
setApiVersion(String version) |
void |
setMetadata(ObjectMeta metadata) |
static final String DNS_LABEL_START
static final String DNS_LABEL_END
static final String DNS_LABEL_REGEXP
static final Pattern FINALIZER_NAME_MATCHER
<domain name>/<finalizer name> format.ObjectMeta getMetadata()
void setMetadata(ObjectMeta metadata)
static String getKind(Class<?> clazz)
Kind, the annotation value will be used, otherwise the value will be derived from the class name.clazz - the HasMetadata implementation whose Kind we want to retrievedefault String getKind()
static String getApiVersion(Class<?> clazz)
apiVersion associated with this HasMetadata implementation. The value is derived from the
Group and Version annotations.clazz - the HasMetadata whose apiVersion we want to computeapiVersion or null if neither Group or Version annotations are presentIllegalArgumentException - if only one of Group or Version is providedstatic String getGroup(Class<?> clazz)
Group annotation.clazz - the HasMetadata whose group we want to retrievenull if the HasMetadata is not annotated with Groupstatic String getVersion(Class<?> clazz)
Version annotation.clazz - the HasMetadata whose version we want to retrievenull if the HasMetadata is not annotated with Versiondefault String getApiVersion()
void setApiVersion(String version)
static String getPlural(Class<?> clazz)
Plural or computes a default value using the value returned by getSingular(Class) as
input to Pluralize.toPlural(String).clazz - the CustomResource whose plural form we want to retrievePlural annotation or a computed default valuedefault String getPlural()
static String getSingular(Class<?> clazz)
Singular annotation or computes a default value (lower-cased version of the value
returned by getKind(Class)) if the annotation is not present.clazz - the class whose singular form we want to retrieveSingular annotation or a computed default
valuedefault String getSingular()
default String getFullResourceName()
default boolean isMarkedForDeletion()
HasMetadata is marked for deletion or not.true if the cluster marked this HasMetadata for deletion, false otherwisedefault boolean hasFinalizer(String finalizer)
HasMetadata holds the specified finalizer.finalizer - the identifier of the finalizer we want to checktrue if this HasMetadata holds the specified finalizer, false otherwisedefault boolean addFinalizer(String finalizer)
HasMetadata if it's valid. See isFinalizerValid(String).finalizer - the identifier of the finalizer to add to this HasMetadata in <domain name>/<finalizer name> format.true if the finalizer was successfully added, false otherwise (in particular, if the object is marked for deletion)IllegalArgumentException - if the specified finalizer identifier is null or is invaliddefault boolean isFinalizerValid(String finalizer)
finalizer - the identifier of the finalizer which validity we want to checktrue if the identifier is valid, false otherwisedefault boolean removeFinalizer(String finalizer)
HasMetadata.finalizer - the identifier of the finalizer we want to removetrue if the finalizer was successfully removed, false otherwisedefault boolean hasOwnerReferenceFor(HasMetadata owner)
HasMetadata is defined as an owner for this HasMetadata.owner - the HasMetadata to check for potential ownershiptrue if the provided HasMetadata is an owner of this instancedefault boolean hasOwnerReferenceFor(String ownerUid)
HasMetadata.ownerUid - the UID of a HasMetadata to check for potential ownershiptrue if the provided HasMetadata is an owner of this instancedefault Optional<OwnerReference> getOwnerReferenceFor(HasMetadata owner)
OwnerReference associated with the specified owner if it's part of this HasMetadata's owners.owner - the potential owner of which we want to retrieve the associated OwnerReferenceOptional containing the OwnerReference associated with the specified owner if it exists or Optional.empty() otherwise.default Optional<OwnerReference> getOwnerReferenceFor(String ownerUid)
OwnerReference associated with the owner identified by the specified UID if it's part of thisHasMetadata's owners.ownerUid - the UID of the potential owner of which we want to retrieve the associated OwnerReferenceOptional containing the OwnerReference associated with the
owner identified by the specified UID if it exists or Optional.empty() otherwise.default OwnerReference addOwnerReference(HasMetadata owner)
OwnerReference to the specified owner if possible.owner - the owner to add a reference toOwnerReferencedefault OwnerReference addOwnerReference(OwnerReference ownerReference)
sanitizeAndValidate(OwnerReference) beforehand), OwnerReference to this HasMetadataownerReference - the OwnerReference to add to this HasMetadata's owner referencesOwnerReferencestatic OwnerReference sanitizeAndValidate(OwnerReference ownerReference)
OwnerReference, presumably to add itownerReference - the OwnerReference to sanitize and validateOwnerReference which should be used instead of the original onedefault void removeOwnerReference(String ownerUid)
OwnerReference identified by the specified UID if it's part of this HasMetadata's owner referencesownerUid - the UID of the OwnerReference to removedefault void removeOwnerReference(HasMetadata owner)
OwnerReference associated with the specified owner if it's part of this HasMetadata's owner referencesowner - the owner whose reference we want to removedefault Optional<ObjectMeta> optionalMetadata()
Copyright © 2015–2020 Red Hat. All rights reserved.