Package com.styra.opa.openapi
Class OpaApiClient
java.lang.Object
com.styra.opa.openapi.OpaApiClient
- All Implemented Interfaces:
SDKMethodInterfaces.MethodCallCompileQueryWithPartialEvaluation
,SDKMethodInterfaces.MethodCallExecuteBatchPolicyWithInput
,SDKMethodInterfaces.MethodCallExecuteDefaultPolicyWithInput
,SDKMethodInterfaces.MethodCallExecutePolicy
,SDKMethodInterfaces.MethodCallExecutePolicyWithInput
,SDKMethodInterfaces.MethodCallHealth
public class OpaApiClient
extends Object
implements SDKMethodInterfaces.MethodCallExecuteDefaultPolicyWithInput, SDKMethodInterfaces.MethodCallExecutePolicy, SDKMethodInterfaces.MethodCallExecutePolicyWithInput, SDKMethodInterfaces.MethodCallExecuteBatchPolicyWithInput, SDKMethodInterfaces.MethodCallCompileQueryWithPartialEvaluation, SDKMethodInterfaces.MethodCallHealth
https://docs.styra.com/enterprise-opa - Enterprise OPA documentation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The Builder class allows the configuration of a new instance of the SDK. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic OpaApiClient.Builder
builder()
Get a new instance of the SDK builder to configure a new instance of the SDK.Partially evaluate a queryPartially evaluate a queryExecute a policy given a batch of inputsExecute a policy given a batch of inputsExecute the default decision given an inputExecute the default decision given an inputexecuteDefaultPolicyWithInput
(Optional<Boolean> pretty, Optional<? extends GzipAcceptEncoding> acceptEncoding, Input input) Execute the default decision given an inputExecute a policyexecutePolicy
(ExecutePolicyRequest request) Execute a policyExecute a policy given an inputExecute a policy given an inputhealth()
Verify the server is operationalhealth
(Optional<Boolean> bundles, Optional<Boolean> plugins, Optional<? extends List<String>> excludePlugin) Verify the server is operationalVerify the server is operational
-
Field Details
-
SERVERS
SERVERS contains the list of server urls available to the SDK.
-
-
Method Details
-
builder
Get a new instance of the SDK builder to configure a new instance of the SDK.- Returns:
- The SDK builder instance.
-
executeDefaultPolicyWithInput
Execute the default decision given an input- Returns:
- The call builder
-
executePolicy
Execute a policy- Returns:
- The call builder
-
executePolicy
Execute a policy- Specified by:
executePolicy
in interfaceSDKMethodInterfaces.MethodCallExecutePolicy
- Parameters:
request
- The request object containing all of the parameters for the API call.- Returns:
- The response from the API call
- Throws:
Exception
- if the API call fails
-
executePolicyWithInput
Execute a policy given an input- Returns:
- The call builder
-
executePolicyWithInput
public ExecutePolicyWithInputResponse executePolicyWithInput(ExecutePolicyWithInputRequest request) throws Exception Execute a policy given an input- Specified by:
executePolicyWithInput
in interfaceSDKMethodInterfaces.MethodCallExecutePolicyWithInput
- Parameters:
request
- The request object containing all of the parameters for the API call.- Returns:
- The response from the API call
- Throws:
Exception
- if the API call fails
-
executeBatchPolicyWithInput
Execute a policy given a batch of inputs- Returns:
- The call builder
-
executeBatchPolicyWithInput
public ExecuteBatchPolicyWithInputResponse executeBatchPolicyWithInput(ExecuteBatchPolicyWithInputRequest request) throws Exception Execute a policy given a batch of inputs- Specified by:
executeBatchPolicyWithInput
in interfaceSDKMethodInterfaces.MethodCallExecuteBatchPolicyWithInput
- Parameters:
request
- The request object containing all of the parameters for the API call.- Returns:
- The response from the API call
- Throws:
Exception
- if the API call fails
-
compileQueryWithPartialEvaluation
Partially evaluate a query- Returns:
- The call builder
-
compileQueryWithPartialEvaluation
public CompileQueryWithPartialEvaluationResponse compileQueryWithPartialEvaluation(CompileQueryWithPartialEvaluationRequest request) throws Exception Partially evaluate a query- Specified by:
compileQueryWithPartialEvaluation
in interfaceSDKMethodInterfaces.MethodCallCompileQueryWithPartialEvaluation
- Parameters:
request
- The request object containing all of the parameters for the API call.- Returns:
- The response from the API call
- Throws:
Exception
- if the API call fails
-
health
Verify the server is operationalThe health API endpoint executes a simple built-in policy query to verify that the server is operational. Optionally it can account for bundle activation as well (useful for “ready” checks at startup).
- Returns:
- The call builder
-
healthDirect
Verify the server is operationalThe health API endpoint executes a simple built-in policy query to verify that the server is operational. Optionally it can account for bundle activation as well (useful for “ready” checks at startup).
- Returns:
- The response from the API call
- Throws:
Exception
- if the API call fails
-
health
public HealthResponse health(Optional<Boolean> bundles, Optional<Boolean> plugins, Optional<? extends List<String>> excludePlugin) throws Exception Verify the server is operationalThe health API endpoint executes a simple built-in policy query to verify that the server is operational. Optionally it can account for bundle activation as well (useful for “ready” checks at startup).
- Specified by:
health
in interfaceSDKMethodInterfaces.MethodCallHealth
- Parameters:
bundles
- Boolean parameter to account for bundle activation status in response. This includes any discovery bundles or bundles defined in the loaded discovery configuration.plugins
- Boolean parameter to account for plugin status in response.excludePlugin
- String parameter to exclude a plugin from status checks. Can be added multiple times. Does nothing if plugins is not true. This parameter is useful for special use cases where a plugin depends on the server being fully initialized before it can fully initialize itself.- Returns:
- The response from the API call
- Throws:
Exception
- if the API call fails
-