DOPA.Cli 0.63.0.1

dotnet add package DOPA.Cli --version 0.63.0.1
NuGet\Install-Package DOPA.Cli -Version 0.63.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DOPA.Cli" Version="0.63.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DOPA.Cli --version 0.63.0.1
#r "nuget: DOPA.Cli, 0.63.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DOPA.Cli as a Cake Addin
#addin nuget:?package=DOPA.Cli&version=0.63.0.1

// Install DOPA.Cli as a Cake Tool
#tool nuget:?package=DOPA.Cli&version=0.63.0.1

DOPA.Cli

Build status Latest version

A dotnet wrapper on the OPA binaries designed primarily for DOPA to create WebAssembly bundles on the fly.

Usage

opa commands are made available off the static Opa class. Args are added with a fluent syntax, and then run with Execute() or ExecuteAsync().

This document refers to the test files found in test/DOPA.Cli.Tests/policies.

Implemented commands

DOPA.Cli is not a complete replacement for running opa, but it can help simplfy some automation. If you have a need for another arg, or command, PRs are welcome. Priority will be given to features needed by DOPA.

Currently, the following commands are implemented with a subset of the possible args.

Build

The build command is supported with optional capabilities, and the ability to build a WebAssembly module.

The Build command returns a disposable Bundle. A Bundle contains the path to the generated opa bundle, and can extract contents from the bundle. The underlying file will be deleted when the Bundle is disposed.

// Default
using Bundle bundle = Opa.Build.Files("policies/example.rego").Execute();
using Stream dataJson = bundle.ExtractData();

// WebAssembly
using Bundle bundle = await Opa.Build
            .WebAssembly()
            .Files("policies/builtins.rego")
            .Entrypoints("builtins/firstValue")
            .Capabilities("policies/builtins.capabilities.json")
            .ExecuteAsync();
using Stream wasm = bundle.ExtractWebAssemblyModule();
Test

The test command is supported with files. OpaTestsFailedException is thrown if any tests fail. The exception message contains the details about which test failed.

var results = Opa.Test.Files("policies/api.rego").Execute();
results.Trim().Should().BeEquivalentTo("PASS: 4/4");

Versioning

DOPA.Cli uses a Major.Minor.Patch.Revision versioning scheme, where Major.Minor.Patch match the corresponding Major.Minor.Patch of the opa binary used to run commands. e.g. DOPA.Cli@0.43.0.12 equates to revision 12 of opa@0.43.0.

Contributing

Pull requests and issues are appreciated and encouraged.

License

DOPA is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.63.0.1 794 4/6/2024
0.63.0 432 3/29/2024
0.62.1 376 3/8/2024
0.62.0 274 3/1/2024
0.58.0 1,316 10/30/2023
0.57.1 431 10/30/2023
0.57.0 2,371 10/3/2023
0.55.0 1,907 7/28/2023
0.54.0 1,085 6/30/2023
0.53.1 549 6/10/2023
0.53.0.1 391 6/3/2023
0.53.0 296 5/27/2023
0.52.0 409 5/2/2023
0.51.0 534 4/1/2023
0.50.0 483 3/12/2023
0.49.2 631 2/26/2023
0.49.1 589 2/22/2023
0.49.0 554 2/10/2023
0.48.0 2,730 1/12/2023
0.47.4 716 12/21/2022
0.47.3 657 12/13/2022
0.47.2 592 12/10/2022
0.47.1 583 12/8/2022
0.47.0 638 12/6/2022
0.46.1 763 11/4/2022
0.45.0 789 10/8/2022
0.44.0.1 682 10/6/2022
0.44.0 903 9/8/2022
0.43.1 758 9/7/2022
0.43.0.1 1,391 8/21/2022
0.43.0 929 8/19/2022

Target NET 8.