Interface IOpaEvaluator
- Namespace
- OpaDotNet.Wasm
- Assembly
- OpaDotNet.Wasm.dll
OPA policy evaluator.
public interface IOpaEvaluator : IDisposable
- Inherited Members
Properties
AbiVersion
ABI version used for evaluation.
Version AbiVersion { get; }
Property Value
Methods
EvaluateOrDefault<TInput, TOutput>(TInput, string?)
Evaluates named policy with specified input.
PolicyEvaluationResult<TOutput?> EvaluateOrDefault<TInput, TOutput>(TInput input, string? entrypoint = null)
Parameters
inputTInputPolicy input document.
entrypointstringPolicy decision to ask for.
Returns
- PolicyEvaluationResult<TOutput>
Policy evaluation result
Type Parameters
TInputType of the input.
TOutputType of the output.
EvaluatePredicate<TInput>(TInput, string?)
Evaluates named policy with specified input. Result interpreted as simple true/false response.
PolicyEvaluationResult<bool> EvaluatePredicate<TInput>(TInput input, string? entrypoint = null)
Parameters
inputTInputPolicy input document.
entrypointstringPolicy decision to ask for.
Returns
- PolicyEvaluationResult<bool>
Policy evaluation result.
Type Parameters
TInputType of the input.
EvaluateRaw(ReadOnlySpan<char>, string?)
Evaluates named policy with specified raw JSON input.
string EvaluateRaw(ReadOnlySpan<char> inputJson, string? entrypoint = null)
Parameters
inputJsonReadOnlySpan<char>Policy input document as JSON string.
entrypointstringPolicy decision to ask for.
Returns
- string
Policy evaluation result as JSON string.
Evaluate<TInput, TOutput>(TInput, string?)
Evaluates named policy with specified input.
PolicyEvaluationResult<TOutput> Evaluate<TInput, TOutput>(TInput input, string? entrypoint = null) where TOutput : notnull
Parameters
inputTInputPolicy input document.
entrypointstringPolicy decision to ask for.
Returns
- PolicyEvaluationResult<TOutput>
Policy evaluation result
Type Parameters
TInputType of the input.
TOutputType of the output.
Reset()
Resets evaluator to initial state. External data is removed.
void Reset()
SetDataFromRawJson(ReadOnlySpan<char>)
Sets external data.
void SetDataFromRawJson(ReadOnlySpan<char> dataJson)
Parameters
dataJsonReadOnlySpan<char>External data JSON as raw string.
SetDataFromStream(Stream?)
Sets external data.
void SetDataFromStream(Stream? utf8Json)
Parameters
utf8JsonStreamExternal data JSON as UTF-8 encoded stream.
SetData<T>(T?)
Sets external data.
void SetData<T>(T? data) where T : class
Parameters
dataTExternal data.
Type Parameters
TType of the data.
TryGetFeature<TFeature>(out TFeature)
Gets ABI version specific extensions.
bool TryGetFeature<TFeature>(out TFeature feature) where TFeature : class, IOpaEvaluatorFeature
Parameters
featureTFeatureABI extension implementation.
Returns
- bool
trueif extension is supported; otherwisefalse.
Type Parameters
TFeature