rest

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 6 Imported by: 24

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthPluginLookup added in v0.26.0

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 added in v0.26.0

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

DefaultRoundTripperClient is a reasonable set of defaults for HTTP auth plugins

func DefaultTLSConfig added in v0.26.0

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

DefaultTLSConfig defines standard TLS configurations based on the Config

func DistributedTracingOpts added in v0.54.0

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

DistributedTracingOpts sets the options to be used by distributed tracing.

func Logger added in v0.27.0

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

Logger assigns a logger to the client

func Name added in v0.10.1

func Name(s string) func(*Client)

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

Types

type AccessToken added in v0.25.0

type AccessToken = v1.AccessToken

AccessToken holds a GCP access token.

type AuthPluginLookupFunc added in v0.52.0

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 added in v0.12.0

type HTTPAuthPlugin = v1.HTTPAuthPlugin

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

Jump to

Keyboard shortcuts

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