io.etcd.jetcd

## Class ClientBuilder

- java.lang.Object
- - io.etcd.jetcd.ClientBuilder

All Implemented Interfaces:
  Cloneable

    public final class ClientBuilder
    extends Object
    implements Cloneable

ClientBuilder knows how to create an Client instance.

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `authority()`
`ClientBuilder` `authority(String authority)` The authority used to authenticate connections to servers.
`Client` `build()` build a new Client.
`ClientBuilder` `copy()`
`Collection<URI>` `endpoints()` gets the endpoints for the builder.
`ClientBuilder` `endpoints(Collection<URI> endpoints)` configure etcd server endpoints.
`ClientBuilder` `endpoints(String... endpoints)`
`ClientBuilder` `endpoints(URI... endpoints)` configure etcd server endpoints.
`ExecutorService` `executorService()`
`ClientBuilder` `executorService(ExecutorService executorService)` config executor service.
`ClientBuilder` `header(String key, String value)` Sets an header to be added to http request headers.
`Map<io.grpc.Metadata.Key,Object>` `headers()`
`ClientBuilder` `headers(Map<io.grpc.Metadata.Key,Object> headers)` Sets headers to be added to http request headers.
`ClientBuilder` `interceptor(io.grpc.ClientInterceptor interceptor, io.grpc.ClientInterceptor... interceptors)` Add interceptors.
`List<io.grpc.ClientInterceptor>` `interceptors()`
`ClientBuilder` `interceptors(List<io.grpc.ClientInterceptor> interceptors)` Set the interceptors.
`boolean` `lazyInitialization()`
`ClientBuilder` `lazyInitialization(boolean lazyInitialization)` Define if the client has to initialize connectivity and authentication on client constructor or delay it to the first call to a client.
`String` `loadBalancerPolicy()` get the load balancer policy for etcd client.
`ClientBuilder` `loadBalancerPolicy(String loadBalancerPolicy)` config load balancer policy.
`Integer` `maxInboundMessageSize()`
`ClientBuilder` `maxInboundMessageSize(Integer maxInboundMessageSize)` Sets the maximum message size allowed for a single gRPC frame.
`ByteSequence` `namespace()`
`ClientBuilder` `namespace(ByteSequence namespace)` config the namespace of keys used in `KV`, `Txn`, `Lock` and `Watch`.
`ByteSequence` `password()`
`ClientBuilder` `password(ByteSequence password)` config etcd auth password.
`ChronoUnit` `retryChronoUnit()`
`ClientBuilder` `retryChronoUnit(ChronoUnit retryChronoUnit)` the retries period unit.
`long` `retryDelay()`
`ClientBuilder` `retryDelay(long retryDelay)` The delay between retries.
`long` `retryMaxDelay()`
`ClientBuilder` `retryMaxDelay(long retryMaxDelay)` The max backing off delay between retries.
`String` `retryMaxDuration()`
`ClientBuilder` `retryMaxDuration(String retryMaxDuration)` the retries max duration.
`io.netty.handler.ssl.SslContext` `sslContext()`
`ClientBuilder` `sslContext(io.netty.handler.ssl.SslContext sslContext)` SSL/TLS context to use instead of the system default.
`io.etcd.jetcd.resolver.URIResolverLoader` `uriResolverLoader()`
`ClientBuilder` `uriResolverLoader(io.etcd.jetcd.resolver.URIResolverLoader loader)`
`ByteSequence` `user()`
`ClientBuilder` `user(ByteSequence user)` config etcd auth user.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### endpoints

    public Collection<URI> endpoints()

gets the endpoints for the builder.

Returns:
  the list of endpoints configured for the builder

#### endpoints

    public ClientBuilder endpoints(Collection<URI> endpoints)

configure etcd server endpoints.

Parameters:
  `endpoints` - etcd server endpoints, at least one
Returns:
  this builder to train
Throws:
  `NullPointerException` - if endpoints is null or one of endpoint is null
  `IllegalArgumentException` - if some endpoint is invalid

#### endpoints

    public ClientBuilder endpoints(URI... endpoints)

configure etcd server endpoints.

Parameters:
  `endpoints` - etcd server endpoints, at least one
Returns:
  this builder to train
Throws:
  `NullPointerException` - if endpoints is null or one of endpoint is null
  `IllegalArgumentException` - if some endpoint is invalid

#### endpoints

    public ClientBuilder endpoints(String... endpoints)

#### user

    public ByteSequence user()

#### user

    public ClientBuilder user(ByteSequence user)

config etcd auth user.

Parameters:
  `user` - etcd auth user
Returns:
  this builder
Throws:
  `NullPointerException` - if user is `null`

#### password

    public ByteSequence password()

#### password

    public ClientBuilder password(ByteSequence password)

config etcd auth password.

Parameters:
  `password` - etcd auth password
Returns:
  this builder
Throws:
  `NullPointerException` - if password is `null`

#### namespace

    public ByteSequence namespace()

#### namespace

    public ClientBuilder namespace(ByteSequence namespace)

config the namespace of keys used in `KV`, `Txn`, `Lock` and `Watch`. "/" will be treated as no namespace.

Parameters:
  `namespace` - the namespace of each key used
Returns:
  this builder
Throws:
  `NullPointerException` - if namespace is `null`

#### executorService

    public ExecutorService executorService()

#### executorService

    public ClientBuilder executorService(ExecutorService executorService)

config executor service.

Parameters:
  `executorService` - executor service
Returns:
  this builder
Throws:
  `NullPointerException` - if executorService is `null`

#### loadBalancerPolicy

    public ClientBuilder loadBalancerPolicy(String loadBalancerPolicy)

config load balancer policy.

Parameters:
  `loadBalancerPolicy` - etcd load balancer policy
Returns:
  this builder
Throws:
  `NullPointerException` - if loadBalancerPolicy is `null`

#### loadBalancerPolicy

    public String loadBalancerPolicy()

get the load balancer policy for etcd client.

Returns:
  loadBalancerFactory

#### lazyInitialization

    public boolean lazyInitialization()

#### lazyInitialization

    public ClientBuilder lazyInitialization(boolean lazyInitialization)

Define if the client has to initialize connectivity and authentication on client constructor or delay it to the first call to a client. Default is false.

Parameters:
  `lazyInitialization` - true if the client has to lazily perform connectivity/authentication.
Returns:
  this builder

#### sslContext

    public io.netty.handler.ssl.SslContext sslContext()

#### sslContext

    public ClientBuilder sslContext(io.netty.handler.ssl.SslContext sslContext)

SSL/TLS context to use instead of the system default. It must have been configured with `GrpcSslContexts`, but options could have been overridden.

Parameters:
  `sslContext` - the ssl context
Returns:
  this builder

#### authority

    public String authority()

#### authority

    public ClientBuilder authority(String authority)

The authority used to authenticate connections to servers.

#### uriResolverLoader

    public io.etcd.jetcd.resolver.URIResolverLoader uriResolverLoader()

#### uriResolverLoader

    public ClientBuilder uriResolverLoader(io.etcd.jetcd.resolver.URIResolverLoader loader)

#### maxInboundMessageSize

    public Integer maxInboundMessageSize()

#### maxInboundMessageSize

    public ClientBuilder maxInboundMessageSize(Integer maxInboundMessageSize)

Sets the maximum message size allowed for a single gRPC frame.

#### headers

    public Map<io.grpc.Metadata.Key,Object> headers()

#### headers

    public ClientBuilder headers(Map<io.grpc.Metadata.Key,Object> headers)

Sets headers to be added to http request headers.

#### header

    public ClientBuilder header(String key,
                                String value)

Sets an header to be added to http request headers.

#### interceptors

    public List<io.grpc.ClientInterceptor> interceptors()

#### interceptors

    public ClientBuilder interceptors(List<io.grpc.ClientInterceptor> interceptors)

Set the interceptors.

#### interceptor

    public ClientBuilder interceptor(io.grpc.ClientInterceptor interceptor,
                                     io.grpc.ClientInterceptor... interceptors)

Add interceptors.

#### retryDelay

    public long retryDelay()

#### retryDelay

    public ClientBuilder retryDelay(long retryDelay)

The delay between retries.

#### retryMaxDelay

    public long retryMaxDelay()

#### retryMaxDelay

    public ClientBuilder retryMaxDelay(long retryMaxDelay)

The max backing off delay between retries.

#### retryChronoUnit

    public ChronoUnit retryChronoUnit()

#### retryChronoUnit

    public ClientBuilder retryChronoUnit(ChronoUnit retryChronoUnit)

the retries period unit.

#### retryMaxDuration

    public String retryMaxDuration()

#### retryMaxDuration

    public ClientBuilder retryMaxDuration(String retryMaxDuration)

the retries max duration.

#### build

    public Client build()

build a new Client.

Returns:
  Client instance.
Throws:
  `io.etcd.jetcd.common.exception.EtcdException` - if client experiences build error.

#### copy

    public ClientBuilder copy()