client

package
v0.0.0-...-8c24509 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: BSD-3-Clause Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIRest

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

APIRest have common data to be shared through embedded struct in those type who implement the client.Client interface

func (APIRest) DataPath

func (cl APIRest) DataPath() string

DataPath is the endpoint in the case of http clients

func (APIRest) GetData

func (cl APIRest) GetData(metricsCollector chan<- prometheus.Metric) (data []byte, err error)

GetData can retrieve data from a rest API with a retry pollicy for token expiration.

type APIRestCreator

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

APIRestCreator have info to create api rest an client

func (APIRestCreator) CreateClient

func (ac APIRestCreator) CreateClient() (cl CacheableClient, err error)

CreateClient create an api rest client

type CacheableClient

type CacheableClient interface {
	Client
	DataPath() string
}

CacheableClient should return a key(DataPath) for catching resource values

type CacheableFactory

type CacheableFactory interface {
	CreateClient() (cl CacheableClient, err error)
}

CacheableFactory can create different kind of cacheable clients

func CreateAPIRestCreator

func CreateAPIRestCreator(resConf config.RextResourceDef, srvConf config.RextServiceDef, dataSourceResponseDurationDesc *prometheus.Desc) (cf CacheableFactory, err error)

CreateAPIRestCreator create an APIRestCreator

type Catcher

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

Catcher have a client and a cache to save time loading data

func (Catcher) GetData

func (cl Catcher) GetData(metricsCollector chan<- prometheus.Metric) (body []byte, err error)

GetData return the data, can be from local cache or making the original request

type CatcherCreator

type CatcherCreator struct {
	Cache         cache.Cache
	ClientFactory CacheableFactory
}

CatcherCreator have info to create catcher client

func (CatcherCreator) CreateClient

func (cc CatcherCreator) CreateClient() (cl Client, err error)

CreateClient create a catcher client

type Client

type Client interface {
	// GetData will get tha date based on a URL(but can be a cached value for example).
	GetData(metricsCollector chan<- prometheus.Metric) (body []byte, err error)
}

Client to get remote data.

type Factory

type Factory interface {
	CreateClient() (cl Client, err error)
}

Factory can create different kind of clients

type FordwaderClient

type FordwaderClient interface {
	GetData() (body []byte, err error)
}

FordwaderClient a client to get metrics from a metrics endpoint

type FordwaderFactory

type FordwaderFactory interface {
	CreateClient() (cl FordwaderClient, err error)
}

FordwaderFactory create fordwader client

type ProxyMetricClient

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

ProxyMetricClient implements the getRemoteInfo method from `client.Client` interface by using some `.toml` config parameters like for example: where is the host. It get the exposed metrics from a service as is.

func (ProxyMetricClient) GetData

func (client ProxyMetricClient) GetData() (data []byte, err error)

GetData can get raw metrics from a endpoint

type ProxyMetricClientCreator

type ProxyMetricClientCreator struct {
	JobName      string
	InstanceName string
	// contains filtered or unexported fields
}

ProxyMetricClientCreator create a metrics fordwader client

func CreateProxyMetricClientCreator

func CreateProxyMetricClientCreator(resConf config.RextResourceDef, srvConf config.RextServiceDef, fDefMetrics *metrics.DefaultFordwaderMetrics) (cf ProxyMetricClientCreator, err error)

CreateProxyMetricClientCreator create a ProxyMetricClientCreator with required info to create a metrics fordwader client

func (ProxyMetricClientCreator) CreateClient

func (pmc ProxyMetricClientCreator) CreateClient() (cl FordwaderClient, err error)

CreateClient create a metrics forwader client

type TokenClient

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

TokenClient implements the getRemoteInfo method from `client.Client` interface by using some .toml config parameters like for example: where is the host? it should be a GET, a POST or some other ... It works like an http wrapper to to get a token from the server. sa newTokenClient method.

func (TokenClient) GetData

func (client TokenClient) GetData(metricsCollector chan<- prometheus.Metric) (data []byte, err error)

GetData can get a token value from a remote server

type TokenCreator

type TokenCreator baseFactory

TokenCreator create token clients

func (TokenCreator) CreateClient

func (tc TokenCreator) CreateClient() (cl Client, err error)

CreateClient create a token client

Jump to

Keyboard shortcuts

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