Class ClientSettings.Builder<SettingsT,B> (2.55.0)

public abstract static class ClientSettings.Builder<SettingsT,B>

Inheritance

java.lang.Object > ClientSettings.Builder<SettingsT,B>

Type Parameters

Name Description
SettingsT
B

Static Methods

applyToAllUnaryMethods(Iterable<UnaryCallSettings.Builder<?,?>> methodSettingsBuilders, ApiFunction<UnaryCallSettings.Builder<?,?>,Void> settingsUpdater)

protected static void applyToAllUnaryMethods(Iterable<UnaryCallSettings.Builder<?,?>> methodSettingsBuilders, ApiFunction<UnaryCallSettings.Builder<?,?>,Void> settingsUpdater)

Applies the given settings updater function to the given method settings builders.

Parameters
Name Description
methodSettingsBuilders Iterable<Builder<?,?>>
settingsUpdater ApiFunction<Builder<?,?>,Void>

Constructors

Builder()

protected Builder()

Builder(ClientSettings settings)

protected Builder(ClientSettings settings)

Create a builder from a ClientSettings object.

Parameter
Name Description
settings ClientSettings

Builder(StubSettings.Builder stubSettings)

protected Builder(StubSettings.Builder stubSettings)

Create a builder from a StubSettings object.

Parameter
Name Description
stubSettings Builder

Methods

build()

public abstract SettingsT build()
Returns
Type Description
SettingsT
Exceptions
Type Description
IOException

getApiKey()

public String getApiKey()

Gets the API Key that was previously set on this Builder.

Returns
Type Description
String

getBackgroundExecutorProvider()

public ExecutorProvider getBackgroundExecutorProvider()

Gets the ExecutorProvider that was previously set on this Builder. This ExecutorProvider is to use for running asynchronous API call logic (such as retries and long-running operations). This ExecutorProvider is not used to set the executor in TransportChannelProvider.

Returns
Type Description
ExecutorProvider

getClock()

public ApiClock getClock()

Gets the ApiClock that was previously set on this Builder.

Returns
Type Description
ApiClock

getCredentialsProvider()

public CredentialsProvider getCredentialsProvider()

Gets the CredentialsProvider that was previously set on this Builder.

Returns
Type Description
CredentialsProvider

getEndpoint()

public String getEndpoint()
Returns
Type Description
String

getExecutorProvider() (deprecated)

public ExecutorProvider getExecutorProvider()

Deprecated. Please use #getBackgroundExecutorProvider() for getting the executor provider that's used for running scheduled API call logic.

Gets the ExecutorProvider that was previously set on this Builder. This ExecutorProvider is to use for running asynchronous API call logic (such as retries and long-running operations), and also to pass to the transport settings if an executor is needed for the transport and it doesn't have its own executor provider.

Returns
Type Description
ExecutorProvider

getGdchApiAudience()

public String getGdchApiAudience()

Gets the GDCH API audience that was previously set in this Builder

Returns
Type Description
String

getHeaderProvider()

public HeaderProvider getHeaderProvider()

Gets the custom HeaderProvider that was previously set on this Builder.

Returns
Type Description
HeaderProvider

getInternalHeaderProvider()

protected HeaderProvider getInternalHeaderProvider()

Gets the internal HeaderProvider that was previously set on this Builder.

Returns
Type Description
HeaderProvider

getQuotaProjectId()

public String getQuotaProjectId()

Gets the QuotaProjectId that was previously set on this Builder.

Returns
Type Description
String

getStubSettings()

protected StubSettings.Builder getStubSettings()
Returns
Type Description
Builder

getTransportChannelProvider()

public TransportChannelProvider getTransportChannelProvider()

Gets the TransportProvider that was previously set on this Builder.

Returns
Type Description
TransportChannelProvider

getWatchdogCheckInterval()

public Duration getWatchdogCheckInterval()

This method is obsolete. Use #getWatchdogCheckIntervalDuration() instead

Returns
Type Description
org.threeten.bp.Duration

getWatchdogCheckIntervalDuration()

public Duration getWatchdogCheckIntervalDuration()
Returns
Type Description
Duration

getWatchdogProvider()

public WatchdogProvider getWatchdogProvider()
Returns
Type Description
WatchdogProvider

self()

protected B self()
Returns
Type Description
B

setApiKey(String apiKey)

public B setApiKey(String apiKey)

Sets the API key. The API key will get translated to an com.google.auth.ApiKeyCredentials and stored in ClientContext.

API Key authorization is not supported for every product. Please check the documentation for each product to confirm if it is supported.

Note: If you set an API key and CredentialsProvider in the same ClientSettings the API key will override any credentials provided.

Parameter
Name Description
apiKey String
Returns
Type Description
B

setBackgroundExecutorProvider(ExecutorProvider executorProvider)

public B setBackgroundExecutorProvider(ExecutorProvider executorProvider)

Sets the ExecutorProvider to use for getting the executor to use for running scheduled API call logic (such as retries and long-running operations). This will not set the executor in TransportChannelProvider. To set executor for TransportChannelProvider, please use TransportChannelProvider#withExecutor(Executor).

Parameter
Name Description
executorProvider ExecutorProvider
Returns
Type Description
B

setClock(ApiClock clock)

public B setClock(ApiClock clock)

Sets the clock to use for retry logic.

This will default to a system clock if it is not set.

Parameter
Name Description
clock ApiClock
Returns
Type Description
B

setCredentialsProvider(CredentialsProvider credentialsProvider)

public B setCredentialsProvider(CredentialsProvider credentialsProvider)

Sets the CredentialsProvider to use for getting the credentials to make calls with.

Parameter
Name Description
credentialsProvider CredentialsProvider
Returns
Type Description
B

setEndpoint(String endpoint)

public B setEndpoint(String endpoint)
Parameter
Name Description
endpoint String
Returns
Type Description
B

setExecutorProvider(ExecutorProvider executorProvider) (deprecated)

public B setExecutorProvider(ExecutorProvider executorProvider)

Deprecated. Please use #setBackgroundExecutorProvider(ExecutorProvider) for setting executor to use for running scheduled API call logic. To set executor for TransportChannelProvider, please use TransportChannelProvider#withExecutor(Executor) instead.

Sets the ExecutorProvider to use for getting the executor to use for running asynchronous API call logic (such as retries and long-running operations), and also to pass to the transport settings if an executor is needed for the transport and it doesn't have its own executor provider.

Parameter
Name Description
executorProvider ExecutorProvider
Returns
Type Description
B

setGdchApiAudience(String gdchApiAudience)

public B setGdchApiAudience(String gdchApiAudience)

Sets the GDC-H api audience. This is intended only to be used with com.google.auth.oauth2.GdchCredentials If this field is set and other type of com.google.auth.Credentials is used then an IllegalArgumentException will be thrown. If the provided credentials already have an api audience, then it will be overriden by this audience

Parameter
Name Description
gdchApiAudience String
Returns
Type Description
B

setHeaderProvider(HeaderProvider headerProvider)

public B setHeaderProvider(HeaderProvider headerProvider)

Sets the HeaderProvider for getting custom static headers for http requests. The header provider will be called during client construction only once. The headers returned by the provider will be cached and supplied as is for each request issued by the constructed client. Some reserved headers can be overridden (e.g. Content-Type) or merged with the default value (e.g. User-Agent) by the underlying transport layer.

Parameter
Name Description
headerProvider HeaderProvider
Returns
Type Description
B

setInternalHeaderProvider(HeaderProvider internalHeaderProvider)

protected B setInternalHeaderProvider(HeaderProvider internalHeaderProvider)

Sets the HeaderProvider for getting internal (library-defined) static headers for http requests. The header provider will be called during client construction only once. The headers returned by the provider will be cached and supplied as is for each request issued by the constructed client. Some reserved headers can be overridden (e.g. Content-Type) or merged with the default value (e.g. User-Agent) by the underlying transport layer.

Parameter
Name Description
internalHeaderProvider HeaderProvider
Returns
Type Description
B

setQuotaProjectId(String quotaProjectId)

public B setQuotaProjectId(String quotaProjectId)
Parameter
Name Description
quotaProjectId String
Returns
Type Description
B

setTransportChannelProvider(TransportChannelProvider transportChannelProvider)

public B setTransportChannelProvider(TransportChannelProvider transportChannelProvider)

Sets the TransportProvider to use for getting the transport-specific context to make calls with.

Parameter
Name Description
transportChannelProvider TransportChannelProvider
Returns
Type Description
B

setUniverseDomain(String universeDomain)

public B setUniverseDomain(String universeDomain)

Sets the Universe Domain to configure the resolved endpoint

Parameter
Name Description
universeDomain String
Returns
Type Description
B

setWatchdogCheckInterval(Duration checkInterval)

public B setWatchdogCheckInterval(Duration checkInterval)

This method is obsolete. Use #setWatchdogCheckIntervalDuration(java.time.Duration) instead.

Parameter
Name Description
checkInterval org.threeten.bp.Duration
Returns
Type Description
B

setWatchdogCheckIntervalDuration(Duration checkInterval)

public B setWatchdogCheckIntervalDuration(Duration checkInterval)
Parameter
Name Description
checkInterval Duration
Returns
Type Description
B

setWatchdogProvider(WatchdogProvider watchdogProvider)

public B setWatchdogProvider(WatchdogProvider watchdogProvider)
Parameter
Name Description
watchdogProvider WatchdogProvider
Returns
Type Description
B

toString()

public String toString()
Returns
Type Description
String
Overrides