incident

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventIncidentCreatedV2 = "public_incident.incident_created_v2"
	EventIncidentUpdatedV2 = "public_incident.incident_updated_v2"
)

Event type names from incident.io webhook API (v2 public incident).

View Source
const BaseURL = "https://api.incident.io"

Variables

This section is empty.

Functions

func VerifySvixSignature

func VerifySvixSignature(webhookID, webhookTimestamp, webhookSignature string, body []byte, secret []byte) error

VerifySvixSignature verifies the incident.io (Svix) webhook signature. Headers: webhook-id, webhook-timestamp, webhook-signature (incident.io uses webhook- prefix). Signed content: id + "." + timestamp + "." + raw_body Secret: if it has "whsec_" prefix, the key is the base64-decoded part after it; otherwise raw bytes.

Types

type Client

type Client struct {
	Token   string
	BaseURL string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(http core.HTTPContext, ctx core.IntegrationContext) (*Client, error)

func (*Client) CreateIncident

func (c *Client) CreateIncident(name, idempotencyKey, severityID, visibility, summary string) (*IncidentV2, error)

CreateIncident creates a new incident via POST /v2/incidents.

func (*Client) ListSeverities

func (c *Client) ListSeverities() ([]Severity, error)

ListSeverities returns severities for the organization (used for Create Incident severity picker).

type Configuration

type Configuration struct {
	APIKey string `json:"apiKey"`
}

type CreateIncident

type CreateIncident struct{}

func (*CreateIncident) Actions

func (c *CreateIncident) Actions() []core.Action

func (*CreateIncident) Cancel

func (c *CreateIncident) Cancel(ctx core.ExecutionContext) error

func (*CreateIncident) Cleanup

func (c *CreateIncident) Cleanup(ctx core.SetupContext) error

func (*CreateIncident) Color

func (c *CreateIncident) Color() string

func (*CreateIncident) Configuration

func (c *CreateIncident) Configuration() []configuration.Field

func (*CreateIncident) Description

func (c *CreateIncident) Description() string

func (*CreateIncident) Documentation

func (c *CreateIncident) Documentation() string

func (*CreateIncident) ExampleOutput

func (c *CreateIncident) ExampleOutput() map[string]any

func (*CreateIncident) Execute

func (c *CreateIncident) Execute(ctx core.ExecutionContext) error

func (*CreateIncident) HandleAction

func (c *CreateIncident) HandleAction(ctx core.ActionContext) error

func (*CreateIncident) HandleWebhook

func (*CreateIncident) Icon

func (c *CreateIncident) Icon() string

func (*CreateIncident) Label

func (c *CreateIncident) Label() string

func (*CreateIncident) Name

func (c *CreateIncident) Name() string

func (*CreateIncident) OutputChannels

func (c *CreateIncident) OutputChannels(configuration any) []core.OutputChannel

func (*CreateIncident) ProcessQueueItem

func (c *CreateIncident) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*CreateIncident) Setup

func (c *CreateIncident) Setup(ctx core.SetupContext) error

type CreateIncidentRequest

type CreateIncidentRequest struct {
	Name           string `json:"name"`
	IdempotencyKey string `json:"idempotency_key"`
	SeverityID     string `json:"severity_id,omitempty"`
	Visibility     string `json:"visibility,omitempty"` // "public" or "private"
	Summary        string `json:"summary,omitempty"`
}

CreateIncidentRequest is the request body for POST /v2/incidents.

type CreateIncidentResponse

type CreateIncidentResponse struct {
	Incident IncidentV2 `json:"incident"`
}

CreateIncidentResponse is the response from POST /v2/incidents.

type CreateIncidentSpec

type CreateIncidentSpec struct {
	Name       string `json:"name"`
	Summary    string `json:"summary"`
	SeverityID string `json:"severityId"`
	Visibility string `json:"visibility"`
}

type IncidentIO

type IncidentIO struct{}

func (*IncidentIO) Actions

func (i *IncidentIO) Actions() []core.Action

func (*IncidentIO) Cleanup

func (*IncidentIO) Components

func (i *IncidentIO) Components() []core.Component

func (*IncidentIO) Configuration

func (i *IncidentIO) Configuration() []configuration.Field

func (*IncidentIO) Description

func (i *IncidentIO) Description() string

func (*IncidentIO) HandleAction

func (i *IncidentIO) HandleAction(ctx core.IntegrationActionContext) error

func (*IncidentIO) HandleRequest

func (i *IncidentIO) HandleRequest(ctx core.HTTPRequestContext)

func (*IncidentIO) Icon

func (i *IncidentIO) Icon() string

func (*IncidentIO) Instructions

func (i *IncidentIO) Instructions() string

func (*IncidentIO) Label

func (i *IncidentIO) Label() string

func (*IncidentIO) ListResources

func (i *IncidentIO) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*IncidentIO) Name

func (i *IncidentIO) Name() string

func (*IncidentIO) Sync

func (i *IncidentIO) Sync(ctx core.SyncContext) error

func (*IncidentIO) Triggers

func (i *IncidentIO) Triggers() []core.Trigger

type IncidentIOWebhookHandler

type IncidentIOWebhookHandler struct{}

func (*IncidentIOWebhookHandler) Cleanup

func (*IncidentIOWebhookHandler) CompareConfig

func (h *IncidentIOWebhookHandler) CompareConfig(a, b any) (bool, error)

func (*IncidentIOWebhookHandler) Merge

func (h *IncidentIOWebhookHandler) Merge(current, requested any) (any, bool, error)

func (*IncidentIOWebhookHandler) Setup

Setup does not call incident.io (no API to create webhook endpoints). The user adds the webhook URL in incident.io Settings > Webhooks and pastes the signing secret into the trigger.

type IncidentStatusRef

type IncidentStatusRef struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

IncidentStatusRef is an incident status reference.

type IncidentV2

type IncidentV2 struct {
	ID             string             `json:"id"`
	Name           string             `json:"name"`
	Summary        string             `json:"summary"`
	Reference      string             `json:"reference"`
	Permalink      string             `json:"permalink"`
	Visibility     string             `json:"visibility"`
	CreatedAt      string             `json:"created_at"`
	UpdatedAt      string             `json:"updated_at"`
	Severity       *SeverityRef       `json:"severity,omitempty"`
	IncidentStatus *IncidentStatusRef `json:"incident_status,omitempty"`
}

IncidentV2 represents an incident from incident.io API v2.

type OnIncident

type OnIncident struct{}

func (*OnIncident) Actions

func (t *OnIncident) Actions() []core.Action

func (*OnIncident) Cleanup

func (t *OnIncident) Cleanup(ctx core.TriggerContext) error

func (*OnIncident) Color

func (t *OnIncident) Color() string

func (*OnIncident) Configuration

func (t *OnIncident) Configuration() []configuration.Field

func (*OnIncident) Description

func (t *OnIncident) Description() string

func (*OnIncident) Documentation

func (t *OnIncident) Documentation() string

func (*OnIncident) ExampleData

func (t *OnIncident) ExampleData() map[string]any

func (*OnIncident) HandleAction

func (t *OnIncident) HandleAction(ctx core.TriggerActionContext) (map[string]any, error)

func (*OnIncident) HandleWebhook

func (*OnIncident) Icon

func (t *OnIncident) Icon() string

func (*OnIncident) Label

func (t *OnIncident) Label() string

func (*OnIncident) Name

func (t *OnIncident) Name() string

func (*OnIncident) Setup

func (t *OnIncident) Setup(ctx core.TriggerContext) error

type OnIncidentConfiguration

type OnIncidentConfiguration struct {
	Events                  []string `json:"events" mapstructure:"events"`
	SigningSecretConfigured bool     `json:"signingSecretConfigured" mapstructure:"signingSecretConfigured"` // Set by UI after setSecret; not used for verification
}

type OnIncidentMetadata

type OnIncidentMetadata struct {
	WebhookURL              string `json:"webhookUrl" mapstructure:"webhookUrl"`
	SigningSecretConfigured bool   `json:"signingSecretConfigured" mapstructure:"signingSecretConfigured"`
}

OnIncidentMetadata is stored after Setup and includes the webhook URL and signing-secret status for the UI.

type Severity

type Severity struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Rank        int    `json:"rank"`
}

Severity represents an incident.io severity level.

type SeverityListResponse

type SeverityListResponse struct {
	Severities []Severity `json:"severities"`
}

SeverityListResponse is the API response for listing severities.

type SeverityRef

type SeverityRef struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

SeverityRef is a severity reference in incident payloads.

type WebhookConfiguration

type WebhookConfiguration struct {
	Events []string `json:"events"`
}

WebhookConfiguration is the config stored with the webhook (events only). The signing secret is stored in the encrypted webhook.Secret via the setSecret action.

type WebhookMetadata

type WebhookMetadata struct{}

WebhookMetadata is stored after Setup. We do not create an endpoint via API, so metadata can be empty.

Jump to

Keyboard shortcuts

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