-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Quoting @tsandall from open-policy-agent/swift-opa#57:
swift-opa lacks support for the OPA management APIs which means that users currently have to DIY integration between swift-opa and their control plane. To reach parity with the Go-based implementation, we should extend swift-opa to minimally support library-based use cases where users construct an instance of the OPA engine based on an OPA configuration file. The OPA engine should support discovery, bundles, and decision logs. The Go-based implementation includes an SDK package that essentially exposes two functions (pseudocode below). We could model the swift SDK based on that.
Links:
- Go SDK: https://pkg.go.dev/github.com/open-policy-agent/opa/v1/sdk
- Management APIs: https://www.openpolicyagent.org/docs/management-introduction
- OPA configuration: https://www.openpolicyagent.org/docs/configuration
Proposed API (pseudocode):
New(Config) => OPA
OPA.Evaluate(Input) => Result
struct Input {
Path string
Value JSON
... other fields such as current time
}
struct Result {
Value JSON
... other fields such as metrics, debug output, etc.
}
For the MVP we can exclude support for:
- Status API support
- Direct read/write access to the in-memory store
- Signing
- Distributed tracing
- Server settings (not supported)
- Disk storage
To implement support for bundles, we will need #28