Interface HasMetadata

    • Method Detail

      • 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 with Kind, 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 the apiVersion associated with this HasMetadata implementation. The value is derived from the Group and Version annotations.
        Parameters:
        clazz - the HasMetadata whose apiVersion we want to compute
        Returns:
        the computed apiVersion or null if neither Group or Version annotations are present
        Throws:
        IllegalArgumentException - if only one of Group or Version is provided
      • getGroup

        static String getGroup​(Class<? extends HasMetadata> clazz)
        Retrieves the group associated with the specified HasMetadata as defined by the Group annotation.
        Parameters:
        clazz - the HasMetadata whose group we want to retrieve
        Returns:
        the associated group or null if the HasMetadata is not annotated with Group
      • getVersion

        static String getVersion​(Class<? extends HasMetadata> clazz)
        Retrieves the version associated with the specified HasMetadata as defined by the Version annotation.
        Parameters:
        clazz - the HasMetadata whose version we want to retrieve
        Returns:
        the associated version or null if the HasMetadata is not annotated with Version
      • getApiVersion

        default String getApiVersion()
      • setApiVersion

        void setApiVersion​(String version)
      • isMarkedForDeletion

        default boolean isMarkedForDeletion()
        Determines whether this HasMetadata is marked for deletion or not.
        Returns:
        true if the cluster marked this HasMetadata for deletion, false otherwise
      • hasFinalizer

        default boolean hasFinalizer​(String finalizer)
        Determines whether this HasMetadata holds the specified finalizer.
        Parameters:
        finalizer - the identifier of the finalizer we want to check
        Returns:
        true if this HasMetadata holds the specified finalizer, false otherwise
      • addFinalizer

        default boolean addFinalizer​(String finalizer)
        Adds the specified finalizer to this HasMetadata if it's valid. See isFinalizerValid(String).
        Parameters:
        finalizer - the identifier of the finalizer to add to this HasMetadata in <domain name>/<finalizer name> format.
        Returns:
        true if the finalizer was successfully added, false otherwise (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:
        true if the identifier is valid, false otherwise
      • removeFinalizer

        default boolean removeFinalizer​(String finalizer)
        Removes the specified finalizer if it's held by this HasMetadata.
        Parameters:
        finalizer - the identifier of the finalizer we want to remove
        Returns:
        true if the finalizer was successfully removed, false otherwise