Package com.styra.opa.openapi
Class OpaApiClient.Builder
- java.lang.Object
-
- com.styra.opa.openapi.OpaApiClient.Builder
-
- Enclosing class:
- OpaApiClient
public static class OpaApiClient.Builder extends java.lang.Object
The Builder class allows the configuration of a new instance of the SDK.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OpaApiClient
build()
Builds a new instance of the SDK.OpaApiClient.Builder
client(HTTPClient client)
Allows the default HTTP client to be overridden with a custom implementation.OpaApiClient.Builder
retryConfig(RetryConfig retryConfig)
Overrides the default configuration for retriesOpaApiClient.Builder
security(Security security)
Configures the SDK to use the provided security details.OpaApiClient.Builder
securitySource(SecuritySource securitySource)
Configures the SDK to use a custom security source.OpaApiClient.Builder
serverIndex(int serverIdx)
Overrides the default server by index.OpaApiClient.Builder
serverURL(java.lang.String serverUrl)
Overrides the default server URL.OpaApiClient.Builder
serverURL(java.lang.String serverUrl, java.util.Map<java.lang.String,java.lang.String> params)
Overrides the default server URL with a templated URL populated with the provided parameters.
-
-
-
Method Detail
-
client
public OpaApiClient.Builder client(HTTPClient client)
Allows the default HTTP client to be overridden with a custom implementation.- Parameters:
client
- The HTTP client to use for all requests.- Returns:
- The builder instance.
-
security
public OpaApiClient.Builder security(Security security)
Configures the SDK to use the provided security details.- Parameters:
security
- The security details to use for all requests.- Returns:
- The builder instance.
-
securitySource
public OpaApiClient.Builder securitySource(SecuritySource securitySource)
Configures the SDK to use a custom security source.- Parameters:
securitySource
- The security source to use for all requests.- Returns:
- The builder instance.
-
serverURL
public OpaApiClient.Builder serverURL(java.lang.String serverUrl)
Overrides the default server URL.- Parameters:
serverUrl
- The server URL to use for all requests.- Returns:
- The builder instance.
-
serverURL
public OpaApiClient.Builder serverURL(java.lang.String serverUrl, java.util.Map<java.lang.String,java.lang.String> params)
Overrides the default server URL with a templated URL populated with the provided parameters.- Parameters:
serverUrl
- The server URL to use for all requests.params
- The parameters to use when templating the URL.- Returns:
- The builder instance.
-
serverIndex
public OpaApiClient.Builder serverIndex(int serverIdx)
Overrides the default server by index.- Parameters:
serverIdx
- The server to use for all requests.- Returns:
- The builder instance.
-
retryConfig
public OpaApiClient.Builder retryConfig(RetryConfig retryConfig)
Overrides the default configuration for retries- Parameters:
retryConfig
- The retry configuration to use for all requests.- Returns:
- The builder instance.
-
build
public OpaApiClient build()
Builds a new instance of the SDK.- Returns:
- The SDK instance.
-
-