Class Configuration
- java.lang.Object
-
- dev.openfga.sdk.api.configuration.Configuration
-
- All Implemented Interfaces:
BaseConfiguration
- Direct Known Subclasses:
ClientConfiguration
public class Configuration extends java.lang.Object implements BaseConfiguration
Configurations for an api client.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringVERSION
-
Constructor Summary
Constructors Constructor Description Configuration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationapiUrl(java.lang.String apiUrl)Set the API URL for the http client.voidassertValid()Assert that the configuration is valid.ConfigurationconnectTimeout(java.time.Duration connectTimeout)Sets the connect timeout (in milliseconds) for the http client.Configurationcredentials(Credentials credentials)Set the credentials.ConfigurationdefaultHeaders(java.util.Map<java.lang.String,java.lang.String> defaultHeaders)java.lang.StringgetApiUrl()Get the API URL that was set.java.time.DurationgetConnectTimeout()Get connection timeout (in milliseconds).CredentialsgetCredentials()Get the credentials.java.util.Map<java.lang.String,java.lang.String>getDefaultHeaders()java.lang.IntegergetMaxRetries()java.time.DurationgetMinimumRetryDelay()java.time.DurationgetReadTimeout()Get the read timeout that was set.java.lang.StringgetUserAgent()Get the user agent.ConfigurationmaxRetries(int maxRetries)ConfigurationminimumRetryDelay(java.time.Duration minimumRetryDelay)Configurationoverride(ConfigurationOverride configurationOverride)Construct a newConfigurationwith any non-null values of aConfigurationOverrideand remaining values from thisConfiguration.ConfigurationreadTimeout(java.time.Duration readTimeout)Set the read timeout for the http client.ConfigurationuserAgent(java.lang.String userAgent)Set the user agent.
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
assertValid
public void assertValid() throws FgaInvalidParameterExceptionAssert that the configuration is valid.- Throws:
FgaInvalidParameterException
-
override
public Configuration override(ConfigurationOverride configurationOverride)
Construct a newConfigurationwith any non-null values of aConfigurationOverrideand remaining values from thisConfiguration.- Parameters:
configurationOverride- The values to override- Returns:
- A new
Configurationwith values of this Configuration mixed with non-null values of configurationOverride
-
apiUrl
public Configuration apiUrl(java.lang.String apiUrl)
Set the API URL for the http client.- Parameters:
apiUrl- The URL.- Returns:
- This object.
-
getApiUrl
public java.lang.String getApiUrl()
Get the API URL that was set.- Specified by:
getApiUrlin interfaceBaseConfiguration- Returns:
- The url.
-
userAgent
public Configuration userAgent(java.lang.String userAgent)
Set the user agent.Within the context of a single request, a "User-Agent" header from either
defaultHeaders(Map)orConfigurationOverride.additionalHeaders(Map)will take precedence over this value.- Parameters:
userAgent- The user agent.- Returns:
- This object.
-
getUserAgent
public java.lang.String getUserAgent()
Get the user agent.- Specified by:
getUserAgentin interfaceBaseConfiguration- Returns:
- The user agent.
-
credentials
public Configuration credentials(Credentials credentials)
Set the credentials.- Parameters:
credentials- The credentials.- Returns:
- This object.
-
getCredentials
public Credentials getCredentials()
Get the credentials.- Returns:
- The credentials.
-
readTimeout
public Configuration readTimeout(java.time.Duration readTimeout)
Set the read timeout for the http client.This is the value used by default for each request, though it can be overridden on a per-request basis with a request interceptor.
- Parameters:
readTimeout- The read timeout used by default by the http client. Setting this value to null resets the timeout to an effectively infinite value.- Returns:
- This object.
-
getReadTimeout
public java.time.Duration getReadTimeout()
Get the read timeout that was set.- Specified by:
getReadTimeoutin interfaceBaseConfiguration- Returns:
- The read timeout, or null if no timeout was set. Null represents an infinite wait time.
-
connectTimeout
public Configuration connectTimeout(java.time.Duration connectTimeout)
Sets the connect timeout (in milliseconds) for the http client.In the case where a new connection needs to be established, if the connection cannot be established within the given
duration, thenHttpClient::sendthrows anHttpConnectTimeoutException, orHttpClient::sendAsynccompletes exceptionally with anHttpConnectTimeoutException. If a new connection does not need to be established, for example if a connection can be reused from a previous request, then this timeout duration has no effect.- Parameters:
connectTimeout- connection timeout in milliseconds- Returns:
- This object.
-
getConnectTimeout
public java.time.Duration getConnectTimeout()
Get connection timeout (in milliseconds).- Specified by:
getConnectTimeoutin interfaceBaseConfiguration- Returns:
- Timeout in milliseconds
-
maxRetries
public Configuration maxRetries(int maxRetries)
-
getMaxRetries
public java.lang.Integer getMaxRetries()
- Specified by:
getMaxRetriesin interfaceBaseConfiguration
-
minimumRetryDelay
public Configuration minimumRetryDelay(java.time.Duration minimumRetryDelay)
-
getMinimumRetryDelay
public java.time.Duration getMinimumRetryDelay()
- Specified by:
getMinimumRetryDelayin interfaceBaseConfiguration
-
defaultHeaders
public Configuration defaultHeaders(java.util.Map<java.lang.String,java.lang.String> defaultHeaders)
-
getDefaultHeaders
public java.util.Map<java.lang.String,java.lang.String> getDefaultHeaders()
-
-