DOPA.Cli
0.68.0
dotnet add package DOPA.Cli --version 0.68.0
NuGet\Install-Package DOPA.Cli -Version 0.68.0
<PackageReference Include="DOPA.Cli" Version="0.68.0" />
<PackageVersion Include="DOPA.Cli" Version="0.68.0" />
<PackageReference Include="DOPA.Cli" />
paket add DOPA.Cli --version 0.68.0
#r "nuget: DOPA.Cli, 0.68.0"
#:package DOPA.Cli@0.68.0
#addin nuget:?package=DOPA.Cli&version=0.68.0
#tool nuget:?package=DOPA.Cli&version=0.68.0
DOPA.Cli
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 | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- SharpZipLib (>= 1.4.2)
-
net7.0
- SharpZipLib (>= 1.4.2)
-
net8.0
- SharpZipLib (>= 1.4.2)
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 | 7,174 | 8/30/2024 |
| 0.67.1 | 1,463 | 8/12/2024 |
| 0.67.0 | 677 | 7/26/2024 |
| 0.66.0 | 1,475 | 6/28/2024 |
| 0.65.0 | 1,382 | 6/1/2024 |
| 0.64.1 | 1,597 | 5/1/2024 |
| 0.63.0.1 | 1,337 | 4/6/2024 |
| 0.63.0 | 1,034 | 3/29/2024 |
| 0.62.1 | 908 | 3/8/2024 |
| 0.62.0 | 897 | 3/1/2024 |
| 0.58.0 | 1,769 | 10/30/2023 |
| 0.57.1 | 851 | 10/30/2023 |
| 0.57.0 | 2,797 | 10/3/2023 |
| 0.55.0 | 2,285 | 7/28/2023 |
| 0.54.0 | 1,519 | 6/30/2023 |
| 0.53.1 | 1,004 | 6/10/2023 |
| 0.53.0.1 | 856 | 6/3/2023 |
| 0.53.0 | 723 | 5/27/2023 |
| 0.52.0 | 873 | 5/2/2023 |
| 0.51.0 | 1,000 | 4/1/2023 |
Bump OPA to v0.68.0.