opa

package
v0.0.0-...-a3cb64f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOpa

func NewOpa(ctx context.Context, filename string) (*sdk.OPA, error)

func ServePolicy

func ServePolicy(ctx context.Context, addr string, token string, bundleName string, bundleFile string) (*http.Server, error)

ServePolicy serves a policy file with the given name

Types

type Bundle

type Bundle struct {
	BundleSource *BundleSource `json:"authz,omitempty"`
}

Bundle defines a bundle bundles:

authz:
  service: acmecorp
  resource: somedir/bundle.tar.gz
  persist: true
  polling:
    min_delay_seconds: 10
    max_delay_seconds: 20
  signing:
    keyid: my_global_key
    scope: read

type BundleSource

type BundleSource struct {
	Service  string   `json:"service,omitempty"`
	Resource string   `json:"resource,omitempty"`
	Persist  bool     `json:"persist,omitempty"`
	Polling  *Polling `json:"polling,omitempty"`
	Signing  *Signing `json:"signing,omitempty"`
}

type DecisionLogs

type DecisionLogs struct {
	Console bool `json:"console,omitempty"`
}

type OpaConfig

type OpaConfig struct {
	Services     []Service         `json:"services,omitempty"`
	Bundles      map[string]Bundle `json:"bundles,omitempty"`
	DecisionLogs DecisionLogs      `json:"decision_logs,omitempty"`
}

OpaConfig defines the top level OPA config to go to json

type Polling

type Polling struct {
	MinDelaySeconds int `json:"min_delay_seconds,omitempty"`
	MaxDelaySeconds int `json:"max_delay_seconds,omitempty"`
}

type Service

type Service struct {
	Name        string                 `json:"name,omitempty"`
	URL         string                 `json:"url,omitempty"`
	Credentials map[string]interface{} `json:"credentials,omitempty"`
}

Service defines a service services:

type Signing

type Signing struct {
	Keyid string `json:"keyid,omitempty"`
	Scope string `json:"scope,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL