webhook

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: Apache-2.0 Imports: 8 Imported by: 6 modules, 14 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	EventBuild = "build"
	EventRepo  = "repo"
	EventUser  = "user"
)

Webhook event types.

View Source
const (
	ActionCreated  = "created"
	ActionUpdated  = "updated"
	ActionDeleted  = "deleted"
	ActionEnabled  = "enabled"
	ActionDisabled = "disabled"
)

Webhook action types.

View Source
const V1 = "application/vnd.drone.webhook.v1+json"

V1 is version 1 of the admission API

Variables

This section is empty.

Functions

func Handler

func Handler(plugin Plugin, secret string, logs logger.Logger) http.Handler

Handler returns a http.Handler that accepts JSON-encoded HTTP requests for a webhook, invokes the underlying webhook plugin, and writes the JSON-encoded data to the HTTP response.

The handler verifies the authenticity of the HTTP request using the http-signature, and returns a 400 Bad Request if the signature is missing or invalid.

The handler can optionally encrypt the response body using aesgcm if the HTTP request includes the Accept-Encoding header set to aesgcm.

Types

type Plugin

type Plugin interface {
	Deliver(context.Context, *Request) error
}

Plugin responds to a webhook request.

func Client

func Client(endpoint, secret string, skipverify bool) Plugin

Client returns a new plugin client.

type Request

type Request struct {
	Event  string        `json:"event"`
	Action string        `json:"action"`
	User   *drone.User   `json:"user,omitempty"`
	Repo   *drone.Repo   `json:"repo,omitempty"`
	Build  *drone.Build  `json:"build,omitempty"`
	System *drone.System `json:"system,omitempty"`
}

Request defines a webhook request.

Jump to

Keyboard shortcuts

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