httppost

package
v1.4.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2017 License: MIT Imports: 16 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"`
	AlertTemplate     string            `toml:"alert-template" override:"alert-template"`
	AlertTemplateFile string            `toml:"alert-template-file" override:"alert-template-file"`
	RowTemplate       string            `toml:"row-template" override:"row-template"`
	RowTemplateFile   string            `toml:"row-template-file" override:"row-template-file"`
}

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 Diagnostic added in v1.4.0

type Diagnostic interface {
	WithContext(ctx ...keyvalue.T) Diagnostic
	Error(msg string, err error, ctx ...keyvalue.T)
}

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, at, rt *template.Template) *Endpoint

func (*Endpoint) AlertTemplate added in v1.4.0

func (e *Endpoint) AlertTemplate() *template.Template

func (*Endpoint) Close

func (e *Endpoint) Close()

func (*Endpoint) NewHTTPRequest

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

func (*Endpoint) RowTemplate added in v1.4.0

func (e *Endpoint) RowTemplate() *template.Template

func (*Endpoint) Update

func (e *Endpoint) Update(c Config) error

type HandlerConfig

type HandlerConfig struct {
	URL             string            `mapstructure:"url"`
	Endpoint        string            `mapstructure:"endpoint"`
	Headers         map[string]string `mapstructure:"headers"`
	CaptureResponse bool              `mapstructure:"capture-response"`
	Timeout         time.Duration     `mapstructure:"timeout"`
}

type Service

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

func NewService

func NewService(c Configs, d Diagnostic) (*Service, error)

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, ctx ...keyvalue.T) 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