Class HostAnnotationConfig

  • All Implemented Interfaces:
    CodecContext

    public class HostAnnotationConfig
    extends BaseConfig<HostId>
    Configuration to add extra annotations to a host via netcfg subsystem.
    • Constructor Detail

      • HostAnnotationConfig

        public HostAnnotationConfig()
        Create a detached HostAnnotationConfig.

        Note: created instance needs to be initialized by #init(..) before using.

      • HostAnnotationConfig

        public HostAnnotationConfig​(HostId hostId)
        Create a detached HostAnnotationConfig for specified host.

        Note: created instance is not bound to NetworkConfigService, thus cannot use Config.apply(). Must be passed to the service using NetworkConfigService#applyConfig

        Parameters:
        hostId - Host id
    • Method Detail

      • isValid

        public boolean isValid()
        Description copied from class: Config
        Indicates whether or not the backing JSON node contains valid data.

        Default implementation returns true. Subclasses are expected to override this with their own validation. Implementations are free to throw a RuntimeException if data is invalid.

        Overrides:
        isValid in class Config<HostId>
        Returns:
        true if the data is valid; false otherwise
      • annotations

        public java.util.Map<java.lang.String,​java.lang.String> annotations()
        Returns annotations to add to a Host.
        Returns:
        annotations as a map. null value represent key removal request
      • annotations

        public HostAnnotationConfig annotations​(java.util.Map<java.lang.String,​java.lang.String> replace)
        Sets annotations to add to a Host.
        Parameters:
        replace - annotations to be added by this configuration. null value represent key removal request
        Returns:
        self
      • annotation

        public HostAnnotationConfig annotation​(java.lang.String key,
                                               java.lang.String value)
        Add configuration to set or remove annotation entry.
        Parameters:
        key - annotations key
        value - annotations value. specifying null removes the entry.
        Returns:
        self
      • annotation

        public HostAnnotationConfig annotation​(java.lang.String key)
        Remove configuration about specified key.
        Parameters:
        key - annotations key
        Returns:
        self