Class DnsConfiguration
- java.lang.Object
-
- io.smallrye.stork.servicediscovery.dns.DnsConfiguration
-
- All Implemented Interfaces:
io.smallrye.stork.api.config.ConfigWithType
public class DnsConfiguration extends Object implements io.smallrye.stork.api.config.ConfigWithType
Configuration for theDnsServiceDiscoveryProviderServiceDiscovery.
-
-
Constructor Summary
Constructors Constructor Description DnsConfiguration()Creates a new DnsConfigurationDnsConfiguration(Map<String,String> params)Creates a new DnsConfiguration
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDnsServers()Comma separated list of dns servers.StringgetDnsTimeout()Timeout for DNS queries By default: 5sStringgetFailOnError()Whether an error in retrieving service instances from one of the DNS servers should cause a failure of the discovery attempt.StringgetHostname()The hostname to look up; if not defined Stork service name will be used.StringgetPort()Port of the service instances.StringgetRecordType()Type of the DNS record.StringgetRecursionDesired()Whether DNS recursion is desired By default: trueStringgetRefreshPeriod()Service discovery cache refresh period.StringgetSecure()Whether the connection with the service should be encrypted with TLS.Map<String,String>parameters()Stringtype()DnsConfigurationwithDnsServers(String value)Set the 'dns-servers' attribute.DnsConfigurationwithDnsTimeout(String value)Set the 'dns-timeout' attribute.DnsConfigurationwithFailOnError(String value)Set the 'fail-on-error' attribute.DnsConfigurationwithHostname(String value)Set the 'hostname' attribute.DnsConfigurationwithPort(String value)Set the 'port' attribute.DnsConfigurationwithRecordType(String value)Set the 'record-type' attribute.DnsConfigurationwithRecursionDesired(String value)Set the 'recursion-desired' attribute.DnsConfigurationwithRefreshPeriod(String value)Set the 'refresh-period' attribute.DnsConfigurationwithSecure(String value)Set the 'secure' attribute.
-
-
-
Method Detail
-
type
public String type()
- Specified by:
typein interfaceio.smallrye.stork.api.config.ConfigWithType- Returns:
- the type
-
parameters
public Map<String,String> parameters()
- Specified by:
parametersin interfaceio.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,
noneif 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,
SRVif 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,
5Mif 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,
trueif 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,
5sif 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,
falseif 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
-
-