webhook

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 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" hcl:"login"`
	// Password for basic auth
	Password string `json:"password" yaml:"password" hcl:"password"`
}

AuthBasicConfig is basic auth config

type AuthBearerConfig

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

AuthBearerConfig is bearer auth config

type AuthConfig

type AuthConfig struct {
	AuthBasicConfig
	AuthBearerConfig
	AuthCustomConfig

	// Type of the auth
	Type string `json:"type" yaml:"type" hcl:"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" hcl:"headers,optional"`
	// QueryParams is query params
	QueryParams map[string]string `json:"queryParams" yaml:"queryParams" hcl:"queryParams,optional"`
}

AuthCustomConfig is custom auth config

type PayloadConfig

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

PayloadConfig for POST requests

type Settings

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

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" hcl:"name,label"`
	Settings Settings `json:"settings" yaml:"settings" hcl:"settings,block"`
	Ignore   bool     `json:"ignore" yaml:"ignore" hcl:"ignore,optional"`
}

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