webhook

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package githubhook implements handling and verification of github webhooks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExecutionFailed

func IsExecutionFailed(err error) bool

IsExecutionFailed asserts executionFailedError.

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsUserNotFound

func IsUserNotFound(err error) bool

IsUserNotFound asserts userNotFoundError.

Types

type Author

type Author struct {
	Login string `json:"login"`
}

type Commit

type Commit struct {
	Author Author `json:"author"`
}

type Config

type Config struct {
	HttpClient *http.Client
	Logger     micrologger.Logger

	GithubToken   string
	Opsgenie      *opsgenie.OpsGenie
	Users         map[string]string
	WebhookSecret string
}

type Creator

type Creator struct {
	Login string `json:"login"`
}

type Deployment

type Deployment struct {
	Creator     Creator
	Environment string `json:"environment"`
	Ref         string `json:"ref"`
}

type DeploymentEvent

type DeploymentEvent struct {
	Deployment Deployment
	Repository Repository `json:"repository"`
}

type Hook

type Hook struct {
	// ID specifies the ID of a github webhook request.
	ID string
	// Event contains unmarshaled webhook.
	DeploymentEvent DeploymentEvent
	// Signature specifies the signature of a github webhook request.
	Signature string
	// Payload contains the raw contents of the webhook request.
	Payload []byte
}

Hook is an inbound github webhook.

type Repository

type Repository struct {
	FullName string `json:"full_name"`
	Name     string `json:"name"`
}

type Service

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

func New

func New(c Config) (*Service, error)

func (*Service) NewHook

func (s *Service) NewHook(req *http.Request) (hook Hook, err error)

NewHook returns a Hook from an incoming HTTP Request.

func (*Service) Process

func (s *Service) Process(h Hook)

Process performs processing of the webhook.

Jump to

Keyboard shortcuts

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