DOPA.Cli 0.67.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DOPA.Cli --version 0.67.1                
NuGet\Install-Package DOPA.Cli -Version 0.67.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.67.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DOPA.Cli --version 0.67.1                
#r "nuget: DOPA.Cli, 0.67.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.67.1

// Install DOPA.Cli as a Cake Tool
#tool nuget:?package=DOPA.Cli&version=0.67.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.68.0 3,159 8/30/2024
0.67.1 1,071 8/12/2024
0.67.0 305 7/26/2024
0.66.0 1,064 6/28/2024
0.65.0 1,012 6/1/2024
0.64.1 1,239 5/1/2024
0.63.0.1 1,030 4/6/2024
0.63.0 688 3/29/2024
0.62.1 562 3/8/2024
0.62.0 561 3/1/2024
0.58.0 1,487 10/30/2023
0.57.1 567 10/30/2023
0.57.0 2,513 10/3/2023
0.55.0 1,994 7/28/2023
0.54.0 1,216 6/30/2023
0.53.1 674 6/10/2023
0.53.0.1 546 6/3/2023
0.53.0 405 5/27/2023
0.52.0 529 5/2/2023
0.51.0 667 4/1/2023
0.50.0 598 3/12/2023
0.49.2 725 2/26/2023
0.49.1 643 2/22/2023
0.49.0 673 2/10/2023
0.48.0 2,863 1/12/2023
0.47.4 860 12/21/2022
0.47.3 793 12/13/2022
0.47.2 662 12/10/2022
0.47.1 721 12/8/2022
0.47.0 740 12/6/2022
0.46.1 828 11/4/2022
0.45.0 902 10/8/2022
0.44.0.1 796 10/6/2022
0.44.0 1,010 9/8/2022
0.43.1 876 9/7/2022
0.43.0.1 1,524 8/21/2022
0.43.0 1,023 8/19/2022

Bump OPA to v0.67.1.