threescale

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: Apache-2.0 Imports: 23 Imported by: 3

Documentation

Overview

nolint: lll

Index

Constants

View Source
const (
	// DefaultCacheTTL - Default time to wait before purging expired items from the cache
	DefaultCacheTTL = time.Duration(time.Minute * 5)

	// DefaultCacheRefreshBuffer - Default time difference to refresh the cache element before expiry time
	DefaultCacheRefreshBuffer = time.Duration(time.Minute * 3)

	// DefaultCacheLimit - Default max number of items that can be stored in the cache at any time
	DefaultCacheLimit = 1000

	// DefaultCacheUpdateRetries - Default number of additional attempts made to update cached entries for unreachable hosts
	DefaultCacheUpdateRetries = 1
)
View Source
const (

	// consts reflect key values in instance config
	AppIDAttributeKey  = "app_id"
	AppKeyAttributeKey = "app_key"
	OIDCAttributeKey   = "client_id"
)

Variables

This section is empty.

Functions

func GetFromRemote added in v0.7.0

func GetFromRemote(cfg *config.Params, c *sysC.ThreeScaleClient, report reportMetrics) (sysC.ProxyConfigElement, error)

GetFromRemote is used to fetch the proxy config from 3scale using the client

Types

type AdapterConfig

type AdapterConfig struct {
	// contains filtered or unexported fields
}

AdapterConfig wraps optional configuration for the 3scale adapter

func NewAdapterConfig

func NewAdapterConfig(cache *ProxyConfigCache, metrics *prometheus.Reporter, grpcKeepalive time.Duration) *AdapterConfig

NewAdapterConfig - Creates configuration for Threescale adapter

type ProxyConfigCache

type ProxyConfigCache struct {
	// contains filtered or unexported fields
}

ProxyConfigCache provides a mechanism to enable caching of calls to 3scale system

func NewProxyConfigCache

func NewProxyConfigCache(cacheTTL time.Duration, refreshBuffer time.Duration, refreshRetries int, limit int) *ProxyConfigCache

NewProxyConfigCache returns a ProxyConfigCache The accepted parameters are cacheTTL - the time between when an entry is added to the cache and when it should expire, and limit - the total number of entries that can be stored in the cache at any given time.

func (*ProxyConfigCache) FlushCache

func (pc *ProxyConfigCache) FlushCache()

FlushCache iterates over the items in the cache and purges any expired items

func (*ProxyConfigCache) Get added in v0.7.0

Get returns a proxyConfig for a given ThreescaleClient, either from the local Cache or fetching it remotely

func (*ProxyConfigCache) StartFlushWorker

func (pc *ProxyConfigCache) StartFlushWorker() error

StartFlushWorker starts a background process that periodically carries out the functionality provided by FlushCache

func (*ProxyConfigCache) StartRefreshWorker

func (pc *ProxyConfigCache) StartRefreshWorker() error

StartRefreshWorker starts a background process that periodically carries out the functionality provided by refreshCache

func (*ProxyConfigCache) StopFlushWorker

func (pc *ProxyConfigCache) StopFlushWorker() error

StopFlushWorker stops a background process started by StartFlushWorker if it has been started Returns an error if the background task is not running

func (*ProxyConfigCache) StopRefreshWorker

func (pc *ProxyConfigCache) StopRefreshWorker() error

StopRefreshWorker stops a background process started by StartRefreshWorker if it has been started Returns an error if the background task is not running

type Server

type Server interface {
	Addr() string
	Close() error
	Run(shutdown chan error)
}

Server interface - specifies the interface for gRPC server/adapter

func NewThreescale

func NewThreescale(addr string, client *http.Client, conf *AdapterConfig) (Server, error)

NewThreescale returns a Server interface

type Threescale

type Threescale struct {
	// contains filtered or unexported fields
}

Threescale contains the Listener and the server

func (*Threescale) Addr

func (s *Threescale) Addr() string

Addr returns the Threescale addrs as a string

func (*Threescale) Close

func (s *Threescale) Close() error

Close stops the Threescale grpc Server

func (*Threescale) HandleAuthorization

HandleAuthorization takes care of the authorization request from mixer

func (*Threescale) Run

func (s *Threescale) Run(shutdown chan error)

Run starts the Threescale grpc Server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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