Package com.influxdb.v3.client.config
Class ClientConfig
java.lang.Object
com.influxdb.v3.client.config.ClientConfig
The
ClientConfig
holds the configurations for the
InfluxDBClient
client.
You can configure following properties:
host
- hostname or IP address of the InfluxDB servertoken
- authentication token for accessing the InfluxDB serverauthScheme
- authentication schemeorganization
- organization to be used for operationsdatabase
- database to be used for InfluxDB operationswritePrecision
- precision to use when writing points to InfluxDBdefaultTags
- defaultTags added 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
- headers to be added to requests
If you want to create a client with custom configuration, you can use following code:
ClientConfig config = new ClientConfig.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("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 ClassesModifier and TypeClassDescriptionstatic final class
A builder forClientConfig
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the automatically following HTTP 3xx redirects.Gets the (proxy) authenticator.Gets authentication scheme.Gets database to be used for InfluxDB operations.Gets default tags used when writing points.Gets the disable server SSL certificate validation.Gets the threshold for compressing request body using GZIP.Gets custom headers for requests.getHost()
Gets URL of the InfluxDB server.Gets organization to be used for operations.getProxy()
Gets the proxy.Gets the default timeout to use for the API calls.char[]
getToken()
Gets authentication token for accessing the InfluxDB server.Gets the default precision to use for the timestamp of points.int
hashCode()
toString()
void
validate()
Validates the configuration properties.
-
Method Details
-
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
-
getAuthScheme
Gets authentication scheme.- Returns:
- authentication scheme, may be null
-
getOrganization
Gets organization to be used for operations.- Returns:
- organization to be used for operations, may be null
-
getDatabase
Gets database to be used for InfluxDB operations.- Returns:
- database to be used for InfluxDB operations, may be null
-
getWritePrecision
Gets the default precision to use for the timestamp of points. If no precision is specified then 'ns' is used.- Returns:
- the default precision to use for the timestamp of points, may be null
-
getGzipThreshold
Gets the threshold for compressing request body using GZIP.- Returns:
- the threshold in bytes
-
getDefaultTags
Gets default tags used when writing points.- Returns:
- default tags
-
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
Gets the automatically following HTTP 3xx redirects. Default to 'false'.- Returns:
- the automatically following HTTP 3xx redirects
-
getDisableServerCertificateValidation
Gets the disable server SSL certificate validation. Default to 'false'.- Returns:
- the disable server SSL certificate validation
-
getProxy
Gets the proxy.- Returns:
- the proxy, may be null
-
getAuthenticator
Gets the (proxy) authenticator.- Returns:
- the (proxy) authenticator
-
getHeaders
Gets custom headers for requests.- Returns:
- the headers
-
validate
public void validate()Validates the configuration properties. -
equals
-
hashCode
public int hashCode() -
toString
-