Class DnsConfiguration

  • All Implemented Interfaces:
    io.smallrye.stork.api.config.ConfigWithType

    public class DnsConfiguration
    extends Object
    implements io.smallrye.stork.api.config.ConfigWithType
    Configuration for the DnsServiceDiscoveryProvider ServiceDiscovery.
    • Constructor Detail

      • DnsConfiguration

        public DnsConfiguration​(Map<String,​String> params)
        Creates a new DnsConfiguration
        Parameters:
        params - the parameters, must not be null
      • DnsConfiguration

        public DnsConfiguration()
        Creates a new DnsConfiguration
    • Method Detail

      • type

        public String type()
        Specified by:
        type in interface io.smallrye.stork.api.config.ConfigWithType
        Returns:
        the type
      • parameters

        public Map<String,​String> parameters()
        Specified by:
        parameters in interface io.smallrye.stork.api.config.ConfigWithType
        Returns:
        the parameters
      • getDnsServers

        public String getDnsServers()
        Comma separated list of dns servers. Servers can either be in the `server:port` or just `server` form. Use `none` to use the system resolver. By default: none
        Returns:
        the configured dns-servers, none if not set
      • withDnsServers

        public DnsConfiguration withDnsServers​(String value)
        Set the 'dns-servers' attribute. Default is none.
        Parameters:
        value - the value for dns-servers
        Returns:
        the current DnsConfiguration to chain calls
      • getHostname

        public String getHostname()
        The hostname to look up; if not defined Stork service name will be used.
        Returns:
        the configured hostname, @{code null} if not set
      • withHostname

        public DnsConfiguration withHostname​(String value)
        Set the 'hostname' attribute.
        Parameters:
        value - the value for hostname
        Returns:
        the current DnsConfiguration to chain calls
      • getRecordType

        public String getRecordType()
        Type of the DNS record. A, AAAA and SRV records are supported By default: SRV
        Returns:
        the configured record-type, SRV if not set
      • withRecordType

        public DnsConfiguration withRecordType​(String value)
        Set the 'record-type' attribute. Default is SRV.
        Parameters:
        value - the value for record-type
        Returns:
        the current DnsConfiguration to chain calls
      • getPort

        public String getPort()
        Port of the service instances. Required if the record type is other than SRV.
        Returns:
        the configured port, @{code null} if not set
      • withPort

        public DnsConfiguration withPort​(String value)
        Set the 'port' attribute.
        Parameters:
        value - the value for port
        Returns:
        the current DnsConfiguration to chain calls
      • getRefreshPeriod

        public String getRefreshPeriod()
        Service discovery cache refresh period. By default: 5M
        Returns:
        the configured refresh-period, 5M if not set
      • withRefreshPeriod

        public DnsConfiguration withRefreshPeriod​(String value)
        Set the 'refresh-period' attribute. Default is 5M.
        Parameters:
        value - the value for refresh-period
        Returns:
        the current DnsConfiguration to chain calls
      • getSecure

        public String getSecure()
        Whether the connection with the service should be encrypted with TLS.
        Returns:
        the configured secure, @{code null} if not set
      • withSecure

        public DnsConfiguration withSecure​(String value)
        Set the 'secure' attribute.
        Parameters:
        value - the value for secure
        Returns:
        the current DnsConfiguration to chain calls
      • getRecursionDesired

        public String getRecursionDesired()
        Whether DNS recursion is desired By default: true
        Returns:
        the configured recursion-desired, true if not set
      • withRecursionDesired

        public DnsConfiguration withRecursionDesired​(String value)
        Set the 'recursion-desired' attribute. Default is true.
        Parameters:
        value - the value for recursion-desired
        Returns:
        the current DnsConfiguration to chain calls
      • getDnsTimeout

        public String getDnsTimeout()
        Timeout for DNS queries By default: 5s
        Returns:
        the configured dns-timeout, 5s if not set
      • withDnsTimeout

        public DnsConfiguration withDnsTimeout​(String value)
        Set the 'dns-timeout' attribute. Default is 5s.
        Parameters:
        value - the value for dns-timeout
        Returns:
        the current DnsConfiguration to chain calls
      • getFailOnError

        public String getFailOnError()
        Whether an error in retrieving service instances from one of the DNS servers should cause a failure of the discovery attempt. By default: false
        Returns:
        the configured fail-on-error, false if not set
      • withFailOnError

        public DnsConfiguration withFailOnError​(String value)
        Set the 'fail-on-error' attribute. Default is false.
        Parameters:
        value - the value for fail-on-error
        Returns:
        the current DnsConfiguration to chain calls