Table of Contents

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

Version

Methods

EvaluateOrDefault<TInput, TOutput>(TInput, string?)

Evaluates named policy with specified input.

PolicyEvaluationResult<TOutput?> EvaluateOrDefault<TInput, TOutput>(TInput input, string? entrypoint = null)

Parameters

input TInput

Policy input document.

entrypoint string

Policy decision to ask for.

Returns

PolicyEvaluationResult<TOutput>

Policy evaluation result

Type Parameters

TInput

Type of the input.

TOutput

Type 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

input TInput

Policy input document.

entrypoint string

Policy decision to ask for.

Returns

PolicyEvaluationResult<bool>

Policy evaluation result.

Type Parameters

TInput

Type of the input.

EvaluateRaw(ReadOnlySpan<char>, string?)

Evaluates named policy with specified raw JSON input.

string EvaluateRaw(ReadOnlySpan<char> inputJson, string? entrypoint = null)

Parameters

inputJson ReadOnlySpan<char>

Policy input document as JSON string.

entrypoint string

Policy 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

input TInput

Policy input document.

entrypoint string

Policy decision to ask for.

Returns

PolicyEvaluationResult<TOutput>

Policy evaluation result

Type Parameters

TInput

Type of the input.

TOutput

Type 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

dataJson ReadOnlySpan<char>

External data JSON as raw string.

SetDataFromStream(Stream?)

Sets external data.

void SetDataFromStream(Stream? utf8Json)

Parameters

utf8Json Stream

External data JSON as UTF-8 encoded stream.

SetData<T>(T?)

Sets external data.

void SetData<T>(T? data) where T : class

Parameters

data T

External data.

Type Parameters

T

Type of the data.

TryGetFeature<TFeature>(out TFeature)

Gets ABI version specific extensions.

bool TryGetFeature<TFeature>(out TFeature feature) where TFeature : class, IOpaEvaluatorFeature

Parameters

feature TFeature

ABI extension implementation.

Returns

bool

true if extension is supported; otherwise false.

Type Parameters

TFeature