Package com.influxdb.v3.client.config
Class ClientConfig
- java.lang.Object
-
- com.influxdb.v3.client.config.ClientConfig
-
public final class ClientConfig extends Object
TheClientConfig
holds the configurations for theInfluxDBClient
client.You can configure following properties:
host
- hostname or IP address of the InfluxDB servertoken
- authentication token for accessing the InfluxDB serverorganization
- organization to be used for operationsdatabase
- database to be used for InfluxDB operationswritePrecision
- precision to use when writing points to InfluxDBgzipThreshold
- threshold when gzip compression is used for writing points to InfluxDBresponseTimeout
- timeout when connecting to InfluxDBallowHttpRedirects
- allow redirects for InfluxDB connectionsdisableServerCertificateValidation
- disable server certificate validation for HTTPS connectionsproxy
- HTTP proxy selectorauthenticator
- HTTP proxy authenticatorheaders
- set of HTTP headers to be added to requests
If you want to create a client with custom configuration, you can use following code:
ClientConfig config = new Config.Builder() .host("https://us-east-1-1.aws.cloud2.influxdata.com") .token("my-token".toCharArray()) .database("my-database") .writePrecision(WritePrecision.S) .gzipThreshold(4096) .proxy(ProxySelector.of(new InetSocketAddress("http://proxy.local", 8888))) .build(); try (InfluxDBClient client = InfluxDBClient.getInstance(config)) { // // your code here // } catch (Exception e) { throw new RuntimeException(e); }
Immutable class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClientConfig.Builder
A builder forClientConfig
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Boolean
getAllowHttpRedirects()
Gets the automatically following HTTP 3xx redirects.Authenticator
getAuthenticator()
Gets the (proxy) authenticator.String
getDatabase()
Gets database to be used for InfluxDB operations.Boolean
getDisableServerCertificateValidation()
Gets the disable server SSL certificate validation.Integer
getGzipThreshold()
Gets the threshold for compressing request body using GZIP.Map<String,String>
getHeaders()
Gets custom HTTP headers.String
getHost()
Gets URL of the InfluxDB server.String
getOrganization()
Gets organization to be used for operations.ProxySelector
getProxy()
Gets the proxy.Duration
getTimeout()
Gets the default timeout to use for the API calls.char[]
getToken()
Gets authentication token for accessing the InfluxDB server.WritePrecision
getWritePrecision()
Gets the default precision to use for the timestamp of points.int
hashCode()
String
toString()
void
validate()
Validates the configuration properties.
-
-
-
Method Detail
-
getHost
@Nonnull public String getHost()
Gets URL of the InfluxDB server.- Returns:
- URL of the InfluxDB server
-
getToken
@Nullable public char[] getToken()
Gets authentication token for accessing the InfluxDB server.- Returns:
- authentication token for accessing the InfluxDB server, may be null
-
getOrganization
@Nullable public String getOrganization()
Gets organization to be used for operations.- Returns:
- organization to be used for operations, may be null
-
getDatabase
@Nullable public String getDatabase()
Gets database to be used for InfluxDB operations.- Returns:
- database to be used for InfluxDB operations, may be null
-
getWritePrecision
@Nullable public WritePrecision getWritePrecision()
Gets the default precision to use for the timestamp of points.- Returns:
- the default precision to use for the timestamp of points, may be null
-
getGzipThreshold
@Nonnull public Integer getGzipThreshold()
Gets the threshold for compressing request body using GZIP.- Returns:
- the threshold in bytes
-
getTimeout
@Nonnull public Duration getTimeout()
Gets the default timeout to use for the API calls. Default to '10 seconds'.- Returns:
- the default timeout to use for the API calls
-
getAllowHttpRedirects
@Nonnull public Boolean getAllowHttpRedirects()
Gets the automatically following HTTP 3xx redirects. Default to 'false'.- Returns:
- the automatically following HTTP 3xx redirects
-
getDisableServerCertificateValidation
@Nonnull public Boolean getDisableServerCertificateValidation()
Gets the disable server SSL certificate validation. Default to 'false'.- Returns:
- the disable server SSL certificate validation
-
getProxy
@Nullable public ProxySelector getProxy()
Gets the proxy.- Returns:
- the proxy, may be null
-
getAuthenticator
@Nullable public Authenticator getAuthenticator()
Gets the (proxy) authenticator.- Returns:
- the (proxy) authenticator
-
getHeaders
@Nullable public Map<String,String> getHeaders()
Gets custom HTTP headers.- Returns:
- the HTTP headers
-
validate
public void validate()
Validates the configuration properties.
-
-