webhook

package
v0.7.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// AuthTypeNone use for disable auth
	AuthTypeNone = "none"
	// AuthTypeBasic use for basic auth
	AuthTypeBasic = "basic"
	// AuthTypeBearer use for bearer token auth
	AuthTypeBearer = "bearer"
	// AuthTypeCustom use for custom auth
	AuthTypeCustom = "custom"
)

consts

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthBasicConfig

type AuthBasicConfig struct {
	// Login for basic auth
	Login string `json:"login" yaml:"login"`
	// Password for basic auth
	Password string `json:"password" yaml:"password"`
}

AuthBasicConfig is basic auth config

type AuthBearerConfig

type AuthBearerConfig struct {
	// Token for bearer auth
	Token string `json:"token" yaml:"token"`
}

AuthBearerConfig is bearer auth config

type AuthConfig

type AuthConfig struct {
	AuthBasicConfig
	AuthBearerConfig
	AuthCustomConfig

	// Type of the auth
	Type string `json:"type" yaml:"type"`
}

AuthConfig for requests with auth

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 is request headers
	Headers map[string]string `json:"headers" yaml:"headers"`
	// QueryParams is query params
	QueryParams map[string]string `json:"queryParams" yaml:"queryParams"`
}

AuthCustomConfig is custom auth config

type PayloadConfig

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

PayloadConfig for POST requests

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"`
}

Settings for webhook config

func (Settings) Validate

func (cfg Settings) Validate() error

Validate settings config

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