Version: v0.59.0 Latest Latest

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

Go to latest
Published: Jun 19, 2020 License: Apache-2.0 Imports: 9 Imported by: 0



Package iqwebhooks provides structs for all of the Nexus IQ webhook events as well as an http.HandlerFunc which will take the http.Request and put any IQ webhook it finds on a channel.

For more information on Nexus IQ webhooks, see here:




This section is empty.


This section is empty.


func ApplicationEvaluationEvents

func ApplicationEvaluationEvents() (<-chan WebhookApplicationEvaluation, func())

ApplicationEvaluationEvents returns a channel (and closer) where new Application Evaluation events are sent

func LicenseOverrideEvents

func LicenseOverrideEvents() (<-chan WebhookLicenseOverride, func())

LicenseOverrideEvents returns a channel (and closer) where new Violation Alert events are sent

func Listen

func Listen(w http.ResponseWriter, r *http.Request)

Listen will handle any HTTP requests which are genuine Nexus IQ Webhooks

appEvalEvents, _ := ApplicationEvaluationEvents()
violationAlertEvents, _ := ViolationAlertEvents()
policyMgmtEvents, _ := PolicyManagementEvents()
licenseOverride, _ := LicenseOverrideEvents()
securityOverride, _ := SecurityOverrideEvents()

go func() {
	for {
		select {
		case <-appEvalEvents:
			log.Println("Received Application Evaluation event")
		case <-violationAlertEvents:
			log.Println("Received Violation Alert event")
		case <-policyMgmtEvents:
			log.Println("Received Policy Management event")
		case <-licenseOverride:
			log.Println("Received License Overridden event")
		case <-securityOverride:
			log.Println("Received Security Vulnerability Overridden event")

http.HandleFunc("/ingest", Listen)

log.Fatal(http.ListenAndServe(":9876", nil))

func PolicyManagementEvents

func PolicyManagementEvents() (<-chan WebhookPolicyManagement, func())

PolicyManagementEvents returns a channel (and closer) where new Violation Alert events are sent

func SecurityOverrideEvents

func SecurityOverrideEvents() (<-chan WebhookSecurityOverride, func())

SecurityOverrideEvents returns a channel (and closer) where new Violation Alert events are sent

func ViolationAlertEvents

func ViolationAlertEvents() (<-chan WebhookViolationAlert, func())

ViolationAlertEvents returns a channel (and closer) where new Violation Alert events are sent


type WebhookApplicationEvaluation

type WebhookApplicationEvaluation struct {
	Timestamp             string         `json:"timestamp"`
	Initiator             string         `json:"initiator"`
	ID                    string         `json:"id"`
	ApplicationEvaluation webhookAppEval `json:"applicationEvaluation"`

WebhookApplicationEvaluation is the payload for an Application Evaluation webhook event

type WebhookEvent

type WebhookEvent interface{}

WebhookEvent identifies a webhook event

type WebhookEventType

type WebhookEventType string

WebhookEventType identifies a webhook event typu

const (
	WebhookEventApplicationEvaluation WebhookEventType = "iq:applicationEvaluation"
	WebhookEventViolationAlert        WebhookEventType = "iq:policyAlert"
	WebhookEventPolicyManagement      WebhookEventType = "iq:policyManagement"
	WebhookEventLicenseOverride       WebhookEventType = "iq:licenseOverrideManagement"
	WebhookEventSecurityOverride      WebhookEventType = "iq:securityVulnerabilityOverrideManagement"

Enumeration of every Webhook event type

func IsWebhookEvent

func IsWebhookEvent(r *http.Request) (ok bool, whtype WebhookEventType)

IsWebhookEvent determines if HTTP request is an IQ Webhook payload and identifies the type

type WebhookLicenseOverride

type WebhookLicenseOverride struct {
	LicenseOverride licenseOverride `json:"licenseOverride"`

WebhookLicenseOverride is the payload for a License Override webhook event

type WebhookPolicyManagement

type WebhookPolicyManagement struct {
	Owner policyOwner `json:"owner"`

WebhookPolicyManagement is the payload for a Policy Management webhook event

type WebhookSecurityOverride

type WebhookSecurityOverride struct {
	SecurityVulnerabilityOverride securityVulnerabilityOverride `json:"securityVulnerabilityOverride"`

WebhookSecurityOverride is the payload for a Security Vulnerability Override webhook event

type WebhookViolationAlert

type WebhookViolationAlert struct {
	Initiator             string              `json:"initiator"`
	ApplicationEvaluation webhookAppEval      `json:"applicationEvaluation"`
	Application           nexusiq.Application `json:"application"`
	PolicyAlerts          []policyAlert       `json:"policyAlerts"`

WebhookViolationAlert is the payload for a Violation Alert webhook event

Jump to

Keyboard shortcuts

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