notifier

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

README

Notifications

Notifications are a way for Clair to inform an endpoint that changes to tracked vulnerabilities have occurred. Because notification data can require pagination, Clair should only send the name of a notification. It is expected that the receiving endpoint calls the Clair API for reading notifications and marking them as read after being notified. If the notification is never marked as read, Clair will continue attempting to send the same notification to the endpoint indefinitely.

Webhook

Webhook is an out-of-the-box notifier that sends the following JSON object via an HTTP POST:

{
  "Notification": {
    "Name": "6e4ad270-4957-4242-b5ad-dad851379573"
  }
}

Custom Notifiers

Clair can also be compiled with custom notifiers by importing them in main.go. Custom notifiers are any Go package that implements the Notifier interface and registers themselves with the notifier package. Notifiers are registered in init() similar to drivers for Go's standard database/sql package.

Documentation

Overview

Package notifier fetches notifications from the database and informs the specified remote handler about their existences, inviting the third party to actively query the API about it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterNotifier added in v1.0.0

func RegisterNotifier(name string, n Notifier)

RegisterNotifier makes a Fetcher available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

func Run added in v1.0.0

func Run(config *config.NotifierConfig, datastore database.Datastore, stopper *utils.Stopper)

Run starts the Notifier service.

Types

type Notifier

type Notifier interface {
	// Configure attempts to initialize the notifier with the provided configuration.
	// It returns whether the notifier is enabled or not.
	Configure(*config.NotifierConfig) (bool, error)
	// Send informs the existence of the specified notification.
	Send(notification database.VulnerabilityNotification) error
}

Notifier represents anything that can transmit notifications.

Directories

Path Synopsis
Package notifiers implements several kinds of notifier.Notifier
Package notifiers implements several kinds of notifier.Notifier

Jump to

Keyboard shortcuts

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