package rest

import "github.com/open-policy-agent/opa/plugins/rest"

Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the github.com/open-policy-agent/opa/v1 package instead. See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.

Package rest implements a REST client for communicating with remote services.

Index

Functions

func AuthPluginLookup

func AuthPluginLookup(l AuthPluginLookupFunc) func(*Client)

AuthPluginLookup assigns a function to lookup an HTTPAuthPlugin to a new Client. It's intended to be used when creating a Client using New(). Usually this is passed the plugins.AuthPlugin func, which retrieves a registered HTTPAuthPlugin from the plugin manager.

func DefaultRoundTripperClient

func DefaultRoundTripperClient(t *tls.Config, timeout int64) *http.Client

DefaultRoundTripperClient is a reasonable set of defaults for HTTP auth plugins

func DefaultTLSConfig

func DefaultTLSConfig(c Config) (*tls.Config, error)

DefaultTLSConfig defines standard TLS configurations based on the Config

func DistributedTracingOpts

func DistributedTracingOpts(tr tracing.Options) func(*Client)

DistributedTracingOpts sets the options to be used by distributed tracing.

func Logger

func Logger(l logging.Logger) func(*Client)

Logger assigns a logger to the client

func Name

func Name(s string) func(*Client)

Name returns an option that overrides the service name on the client.

Types

type AccessToken

type AccessToken = v1.AccessToken

AccessToken holds a GCP access token.

type AuthPluginLookupFunc

type AuthPluginLookupFunc = v1.AuthPluginLookupFunc

An AuthPluginLookupFunc can lookup auth plugins by their name.

type Client

type Client = v1.Client

Client implements an HTTP/REST client for communicating with remote services.

func New

func New(config []byte, keys map[string]*keys.Config, opts ...func(*Client)) (Client, error)

New returns a new Client for config.

type Config

type Config = v1.Config

Config represents configuration for a REST client.

type HTTPAuthPlugin

type HTTPAuthPlugin = v1.HTTPAuthPlugin

An HTTPAuthPlugin represents a mechanism to construct and configure HTTP authentication for a REST service

Source Files

auth.go doc.go gcp.go rest.go

Version
v1.4.2 (latest)
Published
May 2, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
4 hours ago

Tools for package owners.