httppost

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuth

type BasicAuth struct {
	Username string `toml:"username" json:"username"`
	Password string `toml:"password" json:"password"`
}

type Config

type Config struct {
	Endpoint  string            `toml:"endpoint" override:"endpoint"`
	URL       string            `toml:"url" override:"url"`
	Headers   map[string]string `toml:"headers" override:"headers"`
	BasicAuth BasicAuth         `toml:"basic-auth" override:"basic-auth,redact"`
}

Config is the configuration for a single [httppost] section of the kapacitor configuration file.

func (Config) Validate

func (c Config) Validate() error

Validate ensures that all configurations options are valid. The Endpoint, and URL parameters must be set to be considered valid.

type Configs

type Configs []Config

Configs is the configuration for all [[alertpost]] sections of the kapacitor configuration file.

func (Configs) Validate

func (cs Configs) Validate() error

Validate calls config.Validate for each element in Configs

type Endpoint

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

Only one of name and url should be non-empty

func NewEndpoint

func NewEndpoint(url string, headers map[string]string, auth BasicAuth) *Endpoint

func (*Endpoint) Close

func (e *Endpoint) Close()

func (*Endpoint) NewHTTPRequest

func (e *Endpoint) NewHTTPRequest(body io.Reader) (req *http.Request, err error)

func (*Endpoint) Update

func (e *Endpoint) Update(c Config)

type HandlerConfig

type HandlerConfig struct {
	URL      string            `mapstructure:"url"`
	Endpoint string            `mapstructure:"endpoint"`
	Headers  map[string]string `mapstructure:"headers"`
}

type Service

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

func NewService

func NewService(c Configs, l *log.Logger) *Service

func (*Service) Close

func (s *Service) Close() error

func (*Service) Endpoint

func (s *Service) Endpoint(name string) (*Endpoint, bool)

func (*Service) Handler

func (s *Service) Handler(c HandlerConfig, l *log.Logger) alert.Handler

func (*Service) Open

func (s *Service) Open() error

func (*Service) Test

func (s *Service) Test(options interface{}) error

func (*Service) TestOptions

func (s *Service) TestOptions() interface{}

func (*Service) Update

func (s *Service) Update(newConfigs []interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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