Package com.faunadb.client
Class FaunaClient.Builder
- java.lang.Object
-
- com.faunadb.client.FaunaClient.Builder
-
- Enclosing class:
- FaunaClient
public static final class FaunaClient.Builder extends Object
A builder for creating an instance ofFaunaClient
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FaunaClientbuild()Returns a newly constructedFaunaClientwith configuration based on the settings of thisFaunaClient.Builder.FaunaClient.BuilderwithCheckNewVersion(boolean checkNewVersion)Sets the checkNewVersion variable for checking latets driver versionFaunaClient.BuilderwithCustomHeaders(Map<String,String> headers)Sets user defined headers that will be sent with each http request to fauna db serverFaunaClient.BuilderwithEndpoint(String endpoint)Sets the FaunaDB endpoint url for theFaunaClientinstance.FaunaClient.BuilderwithMetrics(MetricRegistry registry)Sets aMetricRegistrythat theFaunaClientwill use to register and track Connection-level statistics.FaunaClient.BuilderwithQueryTimeout(Duration timeout)Sets a global timeout for all the Queries issued by this client.FaunaClient.BuilderwithSecret(String secret)Sets the secret to be passed to FaunaDB as a authentication tokenFaunaClient.BuilderwithUserAgent(String userAgent)Sets the User-Agent header for all the Queries issued by this client.
-
-
-
Method Detail
-
withSecret
public FaunaClient.Builder withSecret(String secret)
Sets the secret to be passed to FaunaDB as a authentication token- Parameters:
secret- the auth token secret- Returns:
- this
FaunaClient.Builderobject
-
withEndpoint
public FaunaClient.Builder withEndpoint(String endpoint) throws MalformedURLException
Sets the FaunaDB endpoint url for theFaunaClientinstance.- Parameters:
endpoint- the root endpoint URL- Returns:
- this
FaunaClient.Builderobject - Throws:
MalformedURLException- if the endpoint is invalid
-
withMetrics
public FaunaClient.Builder withMetrics(MetricRegistry registry)
Sets aMetricRegistrythat theFaunaClientwill use to register and track Connection-level statistics.- Parameters:
registry- theMetricRegistryinstance.- Returns:
- this
FaunaClient.Builderobject
-
withQueryTimeout
public FaunaClient.Builder withQueryTimeout(Duration timeout)
Sets a global timeout for all the Queries issued by this client.- Parameters:
timeout- the query timeout value. The timeout value has milliseconds precision.- Returns:
- this
FaunaClient.Builderobject
-
withUserAgent
public FaunaClient.Builder withUserAgent(String userAgent)
Sets the User-Agent header for all the Queries issued by this client.- Parameters:
userAgent- the userAgent value- Returns:
- this
FaunaClient.Builderobject
-
withCheckNewVersion
public FaunaClient.Builder withCheckNewVersion(boolean checkNewVersion)
Sets the checkNewVersion variable for checking latets driver version- Parameters:
checkNewVersion-- Returns:
- this
Connection.Builderobject
-
withCustomHeaders
public FaunaClient.Builder withCustomHeaders(Map<String,String> headers)
Sets user defined headers that will be sent with each http request to fauna db server- Parameters:
headers- a map of key-value pairs- Returns:
- this
Connection.Builderobject
-
build
public FaunaClient build()
Returns a newly constructedFaunaClientwith configuration based on the settings of thisFaunaClient.Builder.- Returns:
FaunaClient
-
-