Skip to content

Commit

Permalink
docs: Use v1 imports in integration docs
Browse files Browse the repository at this point in the history
Trying to make these changes as small changes to aid review.

Signed-off-by: Charlie Egan <charlie@styra.com>
  • Loading branch information
charlieegan3 committed Dec 17, 2024
1 parent e26a7ad commit 6ef8852
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions docs/content/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,19 @@ This page focuses predominantly on different ways to integrate with OPA's policy
- See the [Health API](../rest-api#health-api) for checking agent deployment readiness and health.
- See the [Prometheus API endpoint](../monitoring/#prometheus) to obtain insight into performance and errors.


## Evaluating Policies

OPA supports different ways to evaluate policies.

* The [REST API](../rest-api) returns decisions as JSON over HTTP.
* Also see the [Language SDKs](/ecosystem/#languages) for working with the REST API in different languages.
* The [Go API (GoDoc)](https://pkg.go.dev/github.com/open-policy-agent/opa/rego) returns
* The [Go API (GoDoc)](https://pkg.go.dev/github.com/open-policy-agent/opa/v1/rego) returns
decisions as simple Go types (`bool`, `string`, `map[string]interface{}`,
etc.)
* [WebAssembly](../wasm) compiles Rego policies into Wasm instructions so they can be embedded and evaluated by any WebAssembly runtime
* Custom compilers and evaluators may be written to parse evaluation plans in the low-level
[Intermediate Representation](../ir) format, which can be emitted by the `opa build` command
* The [SDK](https://pkg.go.dev/github.com/open-policy-agent/opa/sdk) provides high-level APIs for obtaining the output
* The [SDK](https://pkg.go.dev/github.com/open-policy-agent/opa/v1/sdk) provides high-level APIs for obtaining the output
of query evaluation as simple Go types (`bool`, `string`, `map[string]interface{}`, etc.)

### Integrating with the REST API
Expand Down Expand Up @@ -205,8 +204,8 @@ import (
"context"
"fmt"

"github.com/open-policy-agent/opa/sdk"
sdktest "github.com/open-policy-agent/opa/sdk/test"
"github.com/open-policy-agent/opa/v1/sdk"
sdktest "github.com/open-policy-agent/opa/v1/sdk/test"
)

func main() {
Expand Down Expand Up @@ -277,15 +276,15 @@ be created each time the SDK is initialized, such as when the process is restart
### Integrating with the Go API

Use the low-level
[github.com/open-policy-agent/opa/rego](https://pkg.go.dev/github.com/open-policy-agent/opa/rego)
[github.com/open-policy-agent/opa/v1/rego](https://pkg.go.dev/github.com/open-policy-agent/opa/v1/rego)
package to embed OPA as a library inside services written in Go, when only policy **evaluation** — and
no other capabilities of OPA, like the management features — are desired. If you're unsure which one to
use, the SDK is probably the better option.

To get started import the `rego` package:

```go
import "github.com/open-policy-agent/opa/rego"
import "github.com/open-policy-agent/opa/v1/rego"
```

The `rego` package exposes different options for customizing how policies are
Expand Down Expand Up @@ -385,7 +384,7 @@ if !results.Allowed() {
```

For more examples of embedding OPA as a library see the
[`rego`](https://pkg.go.dev/github.com/open-policy-agent/opa/rego#pkg-examples)
[`rego`](https://pkg.go.dev/github.com/open-policy-agent/opa/v1/rego#pkg-examples)
package in the Go documentation.

#### Ecosystem Projects
Expand Down

0 comments on commit 6ef8852

Please sign in to comment.