Table of Contents

Class RegoCompilerExtensions

Namespace
OpaDotNet.Compilation.Abstractions
Assembly
OpaDotNet.Compilation.Abstractions.dll

Compilation extensions.

public static class RegoCompilerExtensions
Inheritance
RegoCompilerExtensions
Inherited Members

Methods

CompileBundle(IRegoCompiler, string, IEnumerable<string>?, string?, CancellationToken)

Compiles OPA bundle from bundle directory.

[Obsolete("Use IRegoCompiler.CompileBundleAsync instead")]
public static Task<Stream> CompileBundle(this IRegoCompiler compiler, string bundlePath, IEnumerable<string>? entrypoints = null, string? capabilitiesFilePath = null, CancellationToken cancellationToken = default)

Parameters

compiler IRegoCompiler

Compiler instance.

bundlePath string

Bundle directory or bundle archive path.

entrypoints IEnumerable<string>

Which documents (entrypoints) will be queried when asking for policy decisions.

capabilitiesFilePath string

Capabilities file that defines the built-in functions and other language features that policies may depend on.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Stream>

Compiled OPA bundle stream.

CompileBundleAsync(IRegoCompiler, Stream, CompilationParameters)

Compiles OPA bundle from rego bundle stream.

public static Task<Stream> CompileBundleAsync(this IRegoCompiler compiler, Stream bundle, CompilationParameters parameters)

Parameters

compiler IRegoCompiler

Compiler instance.

bundle Stream

Rego bundle stream.

parameters CompilationParameters

Compiler parameters.

Returns

Task<Stream>

Compiled OPA bundle stream.

Remarks

This method always compiles contents as bundle.

CompileBundleAsync(IRegoCompiler, Stream, CompilationParameters, CancellationToken)

Compiles OPA bundle from rego bundle stream.

public static Task<Stream> CompileBundleAsync(this IRegoCompiler compiler, Stream bundle, CompilationParameters parameters, CancellationToken cancellationToken)

Parameters

compiler IRegoCompiler

Compiler instance.

bundle Stream

Rego bundle stream.

parameters CompilationParameters

Compiler parameters.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Stream>

Compiled OPA bundle stream.

Remarks

This method always compiles contents as bundle.

CompileBundleAsync(IRegoCompiler, string, CompilationParameters)

Compiles OPA bundle from path.

public static Task<Stream> CompileBundleAsync(this IRegoCompiler compiler, string path, CompilationParameters parameters)

Parameters

compiler IRegoCompiler

Compiler instance.

path string

Bundle directory or bundle archive path.

parameters CompilationParameters

Compiler parameters.

Returns

Task<Stream>

Compiled OPA bundle stream.

Remarks

This method always compiles contents as bundle.

CompileBundleAsync(IRegoCompiler, string, CompilationParameters, CancellationToken)

Compiles OPA bundle from rego bundle stream.

public static Task<Stream> CompileBundleAsync(this IRegoCompiler compiler, string path, CompilationParameters parameters, CancellationToken cancellationToken)

Parameters

compiler IRegoCompiler

Compiler instance.

path string

Bundle directory or bundle archive path.

parameters CompilationParameters

Compiler parameters.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Stream>

Compiled OPA bundle stream.

Remarks

This method always compiles contents as bundle.

CompileFile(IRegoCompiler, string, IEnumerable<string>?, CancellationToken)

Compiles OPA bundle from rego policy source file.

[Obsolete("Use IRegoCompiler.CompileFileAsync instead")]
public static Task<Stream> CompileFile(this IRegoCompiler compiler, string sourceFilePath, IEnumerable<string>? entrypoints = null, CancellationToken cancellationToken = default)

Parameters

compiler IRegoCompiler

Compiler instance.

sourceFilePath string

Source file path.

entrypoints IEnumerable<string>

Which documents (entrypoints) will be queried when asking for policy decisions.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Stream>

Compiled OPA bundle stream.

CompileFileAsync(IRegoCompiler, string, CompilationParameters)

Compiles OPA bundle from rego bundle stream.

public static Task<Stream> CompileFileAsync(this IRegoCompiler compiler, string sourceFilePath, CompilationParameters parameters)

Parameters

compiler IRegoCompiler

Compiler instance.

sourceFilePath string

Source file path.

parameters CompilationParameters

Compiler parameters.

Returns

Task<Stream>

Compiled OPA bundle stream.

CompileFileAsync(IRegoCompiler, string, CompilationParameters, CancellationToken)

Compiles OPA bundle from rego bundle stream.

public static Task<Stream> CompileFileAsync(this IRegoCompiler compiler, string sourceFilePath, CompilationParameters parameters, CancellationToken cancellationToken)

Parameters

compiler IRegoCompiler

Compiler instance.

sourceFilePath string

Source file path.

parameters CompilationParameters

Compiler parameters.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Stream>

Compiled OPA bundle stream.

CompileSource(IRegoCompiler, string, IEnumerable<string>?, CancellationToken)

Compiles OPA bundle from rego policy source code.

[Obsolete("Use IRegoCompiler.CompileSourceAsync instead")]
public static Task<Stream> CompileSource(this IRegoCompiler compiler, string source, IEnumerable<string>? entrypoints = null, CancellationToken cancellationToken = default)

Parameters

compiler IRegoCompiler

Compiler instance.

source string

Source file path.

entrypoints IEnumerable<string>

Which documents (entrypoints) will be queried when asking for policy decisions.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Stream>

Compiled OPA bundle stream.

CompileSourceAsync(IRegoCompiler, string, CompilationParameters)

Compiles OPA bundle from rego policy source code.

public static Task<Stream> CompileSourceAsync(this IRegoCompiler compiler, string source, CompilationParameters parameters)

Parameters

compiler IRegoCompiler

Compiler instance.

source string

Policy source code.

parameters CompilationParameters

Compiler parameters.

Returns

Task<Stream>

Compiled OPA bundle stream.

Remarks

This method always compiles contents as bundle.

CompileSourceAsync(IRegoCompiler, string, CompilationParameters, CancellationToken)

Compiles OPA bundle from rego policy source code.

public static Task<Stream> CompileSourceAsync(this IRegoCompiler compiler, string source, CompilationParameters parameters, CancellationToken cancellationToken)

Parameters

compiler IRegoCompiler

Compiler instance.

source string

Policy source code.

parameters CompilationParameters

Compiler parameters.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Stream>

Compiled OPA bundle stream.

Remarks

This method always compiles contents as bundle.

CompileStream(IRegoCompiler, Stream, IEnumerable<string>?, Stream?, CancellationToken)

Compiles OPA bundle from rego bundle stream.

[Obsolete("Use IRegoCompiler.CompileBundleAsync instead")]
public static Task<Stream> CompileStream(this IRegoCompiler compiler, Stream bundle, IEnumerable<string>? entrypoints = null, Stream? capabilitiesJson = null, CancellationToken cancellationToken = default)

Parameters

compiler IRegoCompiler

Compiler instance.

bundle Stream

Rego bundle stream.

entrypoints IEnumerable<string>

Which documents (entrypoints) will be queried when asking for policy decisions.

capabilitiesJson Stream

Capabilities json that defines the built-in functions and other language features that policies may depend on.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Stream>

Compiled OPA bundle stream.