Skip to content

Add support for OPA management APIs #2

@philipaconrad

Description

@philipaconrad

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions