Documentation ¶
Index ¶
- type BackendAuth
- type BackendConfig
- type BackendParams
- type BackendRequest
- type BackendResponse
- type BackendTransaction
- type Cache
- type CacheHitHook
- type ClientBuilder
- type Manager
- type MetricsReporter
- type MetricsRoundTripper
- type ResponseHook
- type SystemCache
- type SystemCacheConfig
- type SystemClient
- type SystemRequest
- type TelemetryReport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendAuth ¶
BackendAuth contains client authorization credentials for apisonator
type BackendConfig ¶
type BackendParams ¶
BackendParams contains the ebd user auth for the various supported authentication patterns
type BackendRequest ¶
type BackendRequest struct { Auth BackendAuth Service string Transactions []BackendTransaction }
BackendRequest contains the data required to make an Auth/AuthRep request to apisonator
func (BackendRequest) ToAPIRequest ¶
func (request BackendRequest) ToAPIRequest() (*threescale.Request, error)
ToAPIRequest transforms the BackendRequest into a request that is acceptable for the 3scale Client interface
type BackendResponse ¶
type BackendResponse struct { Authorized bool ErrorCode string // RejectedReason should* be set in cases where Authorized is false RejectedReason string RawResponse interface{} }
BackendResponse contains the result of an Auth/AuthRep request
type BackendTransaction ¶
type BackendTransaction struct { Metrics map[string]int Params BackendParams }
BackendTransaction contains the metrics and end user auth required to make an Auth/AuthRep request to apisonator
type CacheHitHook ¶
type CacheHitHook func(cache Cache)
CacheHitHook is called when a hit is successful on system or backend cache
type ClientBuilder ¶
type ClientBuilder struct {
// contains filtered or unexported fields
}
ClientBuilder builds the 3scale clients, injecting the underlying HTTP client
func NewClientBuilder ¶
func NewClientBuilder(httpClient *http.Client) *ClientBuilder
NewClientBuilder returns a pointer to ClientBuilder
func (ClientBuilder) BuildBackendClient ¶
func (cb ClientBuilder) BuildBackendClient(backendURL string) (threescale.Client, error)
BuildBackendClient builds a 3scale apisonator http client The provided 'backendURL' must be prepended with a valid scheme
func (ClientBuilder) BuildSystemClient ¶
func (cb ClientBuilder) BuildSystemClient(systemURL, accessToken string) (SystemClient, error)
BuildSystemClient builds a 3scale porta client from the provided URL(raw string) The provided 'systemURL' must be prepended with a valid scheme
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages connections and interactions between the adapter and 3scale (system and backend) Supports managing interactions between multiple hosts and can optionally leverage available caching implementations Capable of Authorizing a request to 3scale and providing the required functionality to pull from the sources to do so
func NewManager ¶
func NewManager( client *http.Client, systemCache *SystemCache, backendConfig BackendConfig, reporter *MetricsReporter, ) *Manager
NewManager returns an instance of Manager Starts refreshing background process for underlying system cache if provided
func (Manager) AuthRep ¶
func (m Manager) AuthRep(backendURL string, request BackendRequest) (*BackendResponse, error)
AuthRep does a Authorize and Report request into 3scale apisonator
func (Manager) GetSystemConfiguration ¶
func (m Manager) GetSystemConfiguration(systemURL string, request SystemRequest) (client.ProxyConfig, error)
GetSystemConfiguration returns the configuration from 3scale system which can be used to fulfill and Auth request
type MetricsReporter ¶
type MetricsReporter struct { ReportMetrics bool ResponseCB ResponseHook CacheHitCB CacheHitHook }
MetricsReporter holds config for reporting metrics
type MetricsRoundTripper ¶
type MetricsRoundTripper struct {
// contains filtered or unexported fields
}
type ResponseHook ¶
type ResponseHook func(report TelemetryReport)
ResponseHook is a callback function which allows running a function after each HTTP response from 3scale
type SystemCache ¶
type SystemCache struct { cache.ConfigurationCache SystemCacheConfig // contains filtered or unexported fields }
SystemCache wraps the caching implementation and its configuration for 3scale system
func NewSystemCache ¶
func NewSystemCache(config SystemCacheConfig, stopRefreshing chan struct{}) *SystemCache
NewSystemCache returns a system cache configured with an in-memory caching implementation and sets some sensible defaults if zero values have been provided for the config
type SystemCacheConfig ¶
type SystemCacheConfig struct { MaxSize int NumRetryFailedRefresh int RefreshInterval time.Duration TTL time.Duration }
SystemCacheConfig holds the configuration for the cache
type SystemClient ¶
type SystemClient interface {
GetLatestProxyConfig(serviceID, environment string) (system.ProxyConfigElement, error)
}
SystemClient provides a minimalist interface for the adapters requirements from 3scale system
type SystemRequest ¶
SystemRequest provides the required input to request the latest configuration from 3scale system