api

package
v0.0.0-...-c0ac931 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackendsHandler

func BackendsHandler(w rest.ResponseWriter, r *rest.Request)

func CapacityHandler

func CapacityHandler(w rest.ResponseWriter, r *rest.Request)

func GrafanaHandler

func GrafanaHandler(w rest.ResponseWriter, r *rest.Request)

func HomeHandler

func HomeHandler(w rest.ResponseWriter, r *rest.Request)

func PingHandler

func PingHandler(w rest.ResponseWriter, r *rest.Request)

func RestartHandler

func RestartHandler(w rest.ResponseWriter, r *rest.Request)

func ScaleHandler

func ScaleHandler(w rest.ResponseWriter, r *rest.Request)

Types

type BackendResponse

type BackendResponse struct {
	Name string `json:"name"`
	Kind string `json:"kind"`
}

type Client

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

Client provides a client to the Libra API

func NewClient

func NewClient(config *Config) (*Client, error)

NewClient returns a new client

func (*Client) NewRequest

func (c *Client) NewRequest(path, method string, body interface{}) (*http.Response, error)

NewRequest sends a request with the desired parameters to the server

type Config

type Config struct {
	// Address is the address of the Libra agent
	Address string

	// Region to use. If not provided, the default agent region is used.
	Region string

	// HTTPClient is the client to use. Default will be
	// used if not provided.
	HTTPClient *http.Client

	// HTTPAuth is the auth info to use for http access.
	HTTPAuth *HTTPBasicAuth

	// WaitTime limits how long a Watch will block. If not provided,
	// the agent default values will be used.
	WaitTime time.Duration

	// TLSConfig provides the various TLS related configurations for the http
	// client
	TLSConfig *TLSConfig
}

Config is used to configure the creation of a client

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration for the client

func (*Config) ConfigureTLS

func (c *Config) ConfigureTLS() error

ConfigureTLS applies a set of TLS configurations to the the HTTP client.

type GrafanaEvalMatches

type GrafanaEvalMatches struct {
	Metric string  `json:"metric"`
	Value  float64 `json:"value"`
}

type GrafanaMessageBody

type GrafanaMessageBody struct {
	Job            string  `json:"job"`
	Group          string  `json:"group"`
	MinCount       int     `json:"min_count"`
	MaxCount       int     `json:"max_count"`
	MaxThreshold   float64 `json:"max_threshold"`
	MinThreshold   float64 `json:"min_threshold"`
	MaxAction      string  `json:"max_action"`
	MinAction      string  `json:"min_action"`
	MaxActionCount int     `json:"max_action_count"`
	MinActionCount int     `json:"min_action_count"`
}

type GrafanaRequest

type GrafanaRequest struct {
	Title       string               `json:"title"`
	State       string               `json:"state"`
	Count       int                  `json:"count"`
	Message     string               `json:"message"`
	EvalMatches []GrafanaEvalMatches `json:"evalMatches"`
}

type HTTPBasicAuth

type HTTPBasicAuth struct {
	// Username to use for HTTP Basic Authentication
	Username string

	// Password to use for HTTP Basic Authentication
	Password string
}

HTTPBasicAuth is used to authenticate http client with HTTP Basic Authentication

type QueryOptions

type QueryOptions struct {
	// WaitIndex is used to enable a blocking query. Waits
	// until the timeout or the next index is reached
	WaitIndex uint64

	// WaitTime is used to bound the duration of a wait.
	// Defaults to that of the Config, but can be overridden.
	WaitTime time.Duration

	// Set HTTP parameters on the query.
	Params map[string]string
}

QueryOptions are used to parameterize a query

type RestartRequest

type RestartRequest struct {
	Job   string `json:"job"`
	Group string `json:"group"`
	Task  string `json:"task"`
	Image string `json:"image"`
}

func NewRestartRequest

func NewRestartRequest(job, group, task, image string) *RestartRequest

type RestartResponse

type RestartResponse struct {
	Eval string `json:"eval"`
}

type ScaleRequest

type ScaleRequest struct {
	Job   string `json:"job"`
	Group string `json:"group"`
	Count int    `json:"count"`
}

func NewScaleRequest

func NewScaleRequest(job, group string, count int) *ScaleRequest

type ScaleResponse

type ScaleResponse struct {
	Eval     string `json:"eval"`
	NewCount int    `json:"new_count"`
}

type TLSConfig

type TLSConfig struct {
	// CACert is the path to a PEM-encoded CA cert file to use to verify the
	// Libra server SSL certificate.
	CACert string

	// CAPath is the path to a directory of PEM-encoded CA cert files to verify
	// the Libra server SSL certificate.
	CAPath string

	// ClientCert is the path to the certificate for Libra communication
	ClientCert string

	// ClientKey is the path to the private key for Libra communication
	ClientKey string

	// TLSServerName, if set, is used to set the SNI host when connecting via
	// TLS.
	TLSServerName string

	// Insecure enables or disables SSL verification
	Insecure bool
}

TLSConfig contains the parameters needed to configure TLS on the HTTP client used to communicate with Libra.

type WriteOptions

type WriteOptions struct {
	// Providing a datacenter overwrites the region provided
	// by the Config
	Region string
}

WriteOptions are used to parameterize a write

Jump to

Keyboard shortcuts

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