Package com.styra.opa.openapi
Class OpaApiClient
- java.lang.Object
-
- com.styra.opa.openapi.OpaApiClient
-
- All Implemented Interfaces:
SDKMethodInterfaces.MethodCallExecuteBatchPolicyWithInput
,SDKMethodInterfaces.MethodCallExecuteDefaultPolicyWithInput
,SDKMethodInterfaces.MethodCallExecutePolicy
,SDKMethodInterfaces.MethodCallExecutePolicyWithInput
,SDKMethodInterfaces.MethodCallHealth
public class OpaApiClient extends java.lang.Object implements SDKMethodInterfaces.MethodCallExecuteDefaultPolicyWithInput, SDKMethodInterfaces.MethodCallExecutePolicy, SDKMethodInterfaces.MethodCallExecutePolicyWithInput, SDKMethodInterfaces.MethodCallExecuteBatchPolicyWithInput, SDKMethodInterfaces.MethodCallHealth
https://docs.styra.com/enterprise-opa - Enterprise OPA documentation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OpaApiClient.Builder
The Builder class allows the configuration of a new instance of the SDK.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]
SERVERS
SERVERS contains the list of server urls available to the SDK.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OpaApiClient.Builder
builder()
Get a new instance of the SDK builder to configure a new instance of the SDK.ExecuteBatchPolicyWithInputRequestBuilder
executeBatchPolicyWithInput()
Execute a policy given a batch of inputsExecuteBatchPolicyWithInputResponse
executeBatchPolicyWithInput(ExecuteBatchPolicyWithInputRequest request)
Execute a policy given a batch of inputsExecuteDefaultPolicyWithInputRequestBuilder
executeDefaultPolicyWithInput()
Execute the default decision given an inputExecuteDefaultPolicyWithInputResponse
executeDefaultPolicyWithInput(Input input)
Execute the default decision given an inputExecuteDefaultPolicyWithInputResponse
executeDefaultPolicyWithInput(java.util.Optional<java.lang.Boolean> pretty, java.util.Optional<? extends GzipAcceptEncoding> acceptEncoding, Input input)
Execute the default decision given an inputExecutePolicyRequestBuilder
executePolicy()
Execute a policyExecutePolicyResponse
executePolicy(ExecutePolicyRequest request)
Execute a policyExecutePolicyWithInputRequestBuilder
executePolicyWithInput()
Execute a policy given an inputExecutePolicyWithInputResponse
executePolicyWithInput(ExecutePolicyWithInputRequest request)
Execute a policy given an inputHealthRequestBuilder
health()
Verify the server is operational The health API endpoint executes a simple built-in policy query to verify that the server is operational.HealthResponse
health(java.util.Optional<java.lang.Boolean> bundles, java.util.Optional<java.lang.Boolean> plugins, java.util.Optional<? extends java.util.List<java.lang.String>> excludePlugin)
Verify the server is operational The health API endpoint executes a simple built-in policy query to verify that the server is operational.HealthResponse
healthDirect()
Verify the server is operational The health API endpoint executes a simple built-in policy query to verify that the server is operational.
-
-
-
Method Detail
-
builder
public static OpaApiClient.Builder builder()
Get a new instance of the SDK builder to configure a new instance of the SDK.- Returns:
- The SDK builder instance.
-
executeDefaultPolicyWithInput
public ExecuteDefaultPolicyWithInputRequestBuilder executeDefaultPolicyWithInput()
Execute the default decision given an input- Returns:
- The call builder
-
executeDefaultPolicyWithInput
public ExecuteDefaultPolicyWithInputResponse executeDefaultPolicyWithInput(Input input) throws java.lang.Exception
Execute the default decision given an input- Parameters:
input
- Arbitrary JSON used within your policies by accessing `input`- Returns:
- The response from the API call
- Throws:
java.lang.Exception
- if the API call fails
-
executeDefaultPolicyWithInput
public ExecuteDefaultPolicyWithInputResponse executeDefaultPolicyWithInput(java.util.Optional<java.lang.Boolean> pretty, java.util.Optional<? extends GzipAcceptEncoding> acceptEncoding, Input input) throws java.lang.Exception
Execute the default decision given an input- Specified by:
executeDefaultPolicyWithInput
in interfaceSDKMethodInterfaces.MethodCallExecuteDefaultPolicyWithInput
- Parameters:
pretty
- If parameter is `true`, response will formatted for humans.acceptEncoding
-input
- Arbitrary JSON used within your policies by accessing `input`- Returns:
- The response from the API call
- Throws:
java.lang.Exception
- if the API call fails
-
executePolicy
public ExecutePolicyRequestBuilder executePolicy()
Execute a policy- Returns:
- The call builder
-
executePolicy
public ExecutePolicyResponse executePolicy(ExecutePolicyRequest request) throws java.lang.Exception
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:
java.lang.Exception
- if the API call fails
-
executePolicyWithInput
public ExecutePolicyWithInputRequestBuilder executePolicyWithInput()
Execute a policy given an input- Returns:
- The call builder
-
executePolicyWithInput
public ExecutePolicyWithInputResponse executePolicyWithInput(ExecutePolicyWithInputRequest request) throws java.lang.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:
java.lang.Exception
- if the API call fails
-
executeBatchPolicyWithInput
public ExecuteBatchPolicyWithInputRequestBuilder executeBatchPolicyWithInput()
Execute a policy given a batch of inputs- Returns:
- The call builder
-
executeBatchPolicyWithInput
public ExecuteBatchPolicyWithInputResponse executeBatchPolicyWithInput(ExecuteBatchPolicyWithInputRequest request) throws java.lang.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:
java.lang.Exception
- if the API call fails
-
health
public HealthRequestBuilder health()
Verify the server is operational The 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
public HealthResponse healthDirect() throws java.lang.Exception
Verify the server is operational The 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:
java.lang.Exception
- if the API call fails
-
health
public HealthResponse health(java.util.Optional<java.lang.Boolean> bundles, java.util.Optional<java.lang.Boolean> plugins, java.util.Optional<? extends java.util.List<java.lang.String>> excludePlugin) throws java.lang.Exception
Verify the server is operational The 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:
java.lang.Exception
- if the API call fails
-
-