Class TransportConfig.Builder
java.lang.Object
codes.grow.packages.betterstack.core.TransportConfig.Builder
- Enclosing class:
TransportConfig
Builder for
TransportConfig.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the configuration.Sets the clock (tests).Sets the connect timeout.errorMapper(ErrorMapper errorMapper) Sets the service error mapper (seeErrorMapper).Adds headers sent with every request.Sets the hooks.knownSecrets(Supplier<Collection<String>> knownSecrets) Sets the supplier of secret values to redact from errors, hooks and logs.Sets the logger.Sets an explicit HTTP proxy URL, e.g.Sets the per-attempt timeout.retry(RetryPolicy retry) Sets the retry policy.retryAfterHeaders(String... names) Adds vendor headers read as a retry hint when a 429 or 503 response has noRetry-After(for exampleX-RateLimit-Reset).tls(TlsOptions tls) Sets the TLS options.Sets the total budget per call.userAgentSuffix(String suffix) Sets the text appended to the standard user agent.
-
Method Details
-
connectTimeout
Sets the connect timeout.- Parameters:
d- positive duration- Returns:
- this builder
-
requestTimeout
Sets the per-attempt timeout.- Parameters:
d- positive duration- Returns:
- this builder
-
totalTimeout
Sets the total budget per call.- Parameters:
d- positive duration- Returns:
- this builder
-
retry
Sets the retry policy.- Parameters:
retry- policy- Returns:
- this builder
-
tls
Sets the TLS options.- Parameters:
tls- options- Returns:
- this builder
-
proxy
Sets an explicit HTTP proxy URL, e.g.http://user:pass@proxy:3128.- Parameters:
proxy- proxy URL, or null for a direct connection- Returns:
- this builder
-
headers
Adds headers sent with every request.- Parameters:
headers- header map- Returns:
- this builder
-
userAgentSuffix
Sets the text appended to the standard user agent.- Parameters:
suffix- suffix, or null- Returns:
- this builder
-
hooks
Sets the hooks.- Parameters:
hooks- hooks, null for none- Returns:
- this builder
-
logger
Sets the logger.- Parameters:
logger- logger, null for silent- Returns:
- this builder
-
knownSecrets
Sets the supplier of secret values to redact from errors, hooks and logs.- Parameters:
knownSecrets- supplier evaluated when an error message is built- Returns:
- this builder
-
clock
Sets the clock (tests).- Parameters:
clock- clock- Returns:
- this builder
-
retryAfterHeaders
Adds vendor headers read as a retry hint when a 429 or 503 response has noRetry-After(for exampleX-RateLimit-Reset). Values are delay seconds, Unix epoch seconds or an HTTP-date (RetryPolicy.parseRateLimitReset(java.lang.String, java.time.Instant)).- Parameters:
names- header names (case-insensitive), in lookup order- Returns:
- this builder
-
errorMapper
Sets the service error mapper (seeErrorMapper).- Parameters:
errorMapper- the mapper, ornullfor none- Returns:
- this builder
-
build
Builds the configuration.- Returns:
- the configuration
-