webhook

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTypeNone   = "none"
	AuthTypeBasic  = "basic"
	AuthTypeBearer = "bearer"
	AuthTypeCustom = "custom"
)

consts

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthBasicConfig

type AuthBasicConfig struct {
	Login    string `json:"login" yaml:"login"`
	Password string `json:"password" yaml:"password"`
}

type AuthBearerConfig

type AuthBearerConfig struct {
	Token string `json:"token" yaml:"token"`
}

type AuthConfig

type AuthConfig struct {
	AuthBasicConfig
	AuthBearerConfig
	AuthCustomConfig

	Type string `json:"type" yaml:"type"`
}

func (AuthConfig) Validate

func (cfg AuthConfig) Validate() error

Validate checks the authorization configuration.

type AuthCustomConfig

type AuthCustomConfig struct {
	// TODO (negasus): remove Headers in favor of cfg.Headers option
	Headers     map[string]string `json:"headers" yaml:"headers"`
	QueryParams map[string]string `json:"queryParams" yaml:"queryParams"`
}

type PayloadConfig

type PayloadConfig struct {
	QueryParams map[string]string `json:"queryParams" yaml:"queryParams"`
	Body        string            `json:"body" yaml:"body"`
}

func (PayloadConfig) Validate

func (cfg PayloadConfig) Validate(method string) error

Validate checks the payload configuration.

type Settings

type Settings struct {
	URL     string            `json:"url" yaml:"url"`
	Method  string            `json:"method" yaml:"method"`
	Auth    AuthConfig        `json:"auth" yaml:"auth"`
	Payload PayloadConfig     `json:"payload" yaml:"payload"`
	Timeout int               `json:"timeout" yaml:"timeout"`
	Headers map[string]string `json:"headers" yaml:"headers"`
}

func (Settings) Validate

func (cfg Settings) Validate() error

type Webhook

type Webhook struct {
	Name     string   `json:"name" yaml:"name"`
	Settings Settings `json:"settings" yaml:"settings"`
}

Webhook configures notifications via webhook.

func (Webhook) Validate

func (cfg Webhook) Validate() error

Validate checks the webhook configuration.

Jump to

Keyboard shortcuts

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