incident

package module
v0.0.0-...-c21f107 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 14 Imported by: 4

README

Grafana Incident API - Go client library

The Grafana Incident Go client library allows you to access the Grafana Incident API from your Go code.

Get started

Import the package:

go get github.com/grafana/incident-go@latest

Make calls to the API

In this example, we will use the IncidentsService.CreateIncident() method to declare an Incident, and print its ID.

// create a client, and the services you need
serviceAccountToken := os.Getenv("SERVICE_ACCOUNT_TOKEN")
client := incident.NewClient("https://your-api-endpoint/api", serviceAccountToken)
incidentsService := incident.NewIncidentsService(client)

// declare an incident
createIncidentResp, err := incidentsService.CreateIncident(ctx, incident.CreateIncidentRequest{
	Title: "short description explaining what's going wrong",
	Severity: incident.Options.IncidentSeverity.Minor,
})
if err != nil {
	// if something goes wrong, the error will help you
	return fmt.Errorf("create incident: %w", err)
}
// success, get the details from the createIncidentResp object
fmt.Println("declared Incident", createIncidentResp.Incident.IncidentID)

Handle webhooks from Grafana Incident

You can use the Outgoing Webhook integration to get Grafana Incident to POST a request on specific events.

If you are consuming that event in Go, you can use the incident.ParseWebhook helper:

import (
	incident "github.com/grafana/incident-go"
)

// handleIncidentWebhook gets a handler that processes webhooks from
// Grafana Incident.
// The secret should be safely injected (avoid committing it to source control).
// Secrets can be created in the web interface when configuring the Outgoing Webhook integration.
func handleIncidentWebhook(secret string) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		// incident.ParseWebhook will verify the signature and decode
		// the body into the incident.OutgoingWebhookPayload type.
		payload, err := incident.ParseWebhook(r, secret)
		if err != nil {
			http.Error(w, err.Error(), http.StatusBadRequest)
			return
		}
		switch payload.Event {
		case "grafana.incident.created":
			fmt.Printf("Incident declared: %s\n", payload.Incident.Title)
		default:
			fmt.Printf("Unknown event: %s\n", payload.Event)
		}
	}))
}

Documentation

Overview

Package incident is a Go client library which makes it easy to interact with the Grafana Incident JSON/HTTP RPC API.

Index

Examples

Constants

This section is empty.

Variables

View Source
var Options struct {

	// ActivityItemActivityKind contains the acceptable values for the
	// ActivityItem.ActivityKind field.
	ActivityItemActivityKind struct {

		// IncidentUpdated == "incidentUpdated"
		IncidentUpdated string

		// IncidentTitleChanged == "incidentTitleChanged"
		IncidentTitleChanged string

		// IncidentStatusChanged == "incidentStatusChanged"
		IncidentStatusChanged string

		// IncidentSeverityChanged == "incidentSeverityChanged"
		IncidentSeverityChanged string

		// IncidentCreated == "incidentCreated"
		IncidentCreated string

		// IncidentDeleted == "incidentDeleted"
		IncidentDeleted string

		// IncidentClosed == "incidentClosed"
		IncidentClosed string

		// RoleAssigned == "roleAssigned"
		RoleAssigned string

		// RoleUnassigned == "roleUnassigned"
		RoleUnassigned string

		// ActionRun == "actionRun"
		ActionRun string

		// UserNote == "userNote"
		UserNote string

		// DataQuery == "dataQuery"
		DataQuery string

		// HookRunMetadata == "hookRunMetadata"
		HookRunMetadata string

		// TaskAdded == "taskAdded"
		TaskAdded string

		// TaskUpdated == "taskUpdated"
		TaskUpdated string

		// TaskCompleted == "taskCompleted"
		TaskCompleted string

		// TaskDeleted == "taskDeleted"
		TaskDeleted string

		// MessageReaction == "messageReaction"
		MessageReaction string

		// ContextAttached == "contextAttached"
		ContextAttached string

		// IncidentIsDrillChanged == "incidentIsDrillChanged"
		IncidentIsDrillChanged string

		// IncidentStart == "incidentStart"
		IncidentStart string

		// IncidentEnd == "incidentEnd"
		IncidentEnd string

		// IncidentSummary == "incidentSummary"
		IncidentSummary string

		// LabelAdded == "labelAdded"
		LabelAdded string

		// LabelRemoved == "labelRemoved"
		LabelRemoved string

		// SiftResult == "siftResult"
		SiftResult string
	}

	// ActivityItemRelevance contains the acceptable values for the
	// ActivityItem.Relevance field.
	ActivityItemRelevance struct {

		// Automatic == "automatic"
		Automatic string

		// Archive == "archive"
		Archive string

		// Low == "low"
		Low string

		// Normal == "normal"
		Normal string

		// High == "high"
		High string
	}

	// ActivityQueryOrderDirection contains the acceptable values for the
	// ActivityQuery.OrderDirection field.
	ActivityQueryOrderDirection struct {

		// ASC == "ASC"
		ASC string

		// DESC == "DESC"
		DESC string
	}

	// AddActivityRequestActivityKind contains the acceptable values for the
	// AddActivityRequest.ActivityKind field.
	AddActivityRequestActivityKind struct {

		// UserNote == "userNote"
		UserNote string
	}

	// AssignRoleRequestRole contains the acceptable values for the
	// AssignRoleRequest.Role field.
	AssignRoleRequestRole struct {

		// Commander == "commander"
		Commander string

		// Investigator == "investigator"
		Investigator string

		// Observer == "observer"
		Observer string
	}

	// AttachmentFileType contains the acceptable values for the
	// Attachment.FileType field.
	AttachmentFileType struct {

		// File == "file"
		File string

		// Video == "video"
		Video string

		// Image == "image"
		Image string

		// Audio == "audio"
		Audio string

		// Screenshare == "screenshare"
		Screenshare string
	}

	// AttachmentDisplayType contains the acceptable values for the
	// Attachment.DisplayType field.
	AttachmentDisplayType struct {

		// List == "list"
		List string

		// Embed == "embed"
		Embed string
	}

	// CreateIncidentRequestStatus contains the acceptable values for the
	// CreateIncidentRequest.Status field.
	CreateIncidentRequestStatus struct {

		// Active == "active"
		Active string

		// Resolved == "resolved"
		Resolved string
	}

	// CreateKeyUpdateRequestContentType contains the acceptable values for the
	// CreateKeyUpdateRequest.ContentType field.
	CreateKeyUpdateRequestContentType struct {

		// TextPlain == "text/plain"
		TextPlain string

		// ApplicationXLexicalEditor == "application/x-lexical-editor"
		ApplicationXLexicalEditor string

		// TextMarkdownSlack == "text/markdown+slack"
		TextMarkdownSlack string

		// TextMarkdownMsteams == "text/markdown+msteams"
		TextMarkdownMsteams string
	}

	// CreateKeyUpdateRequestScope contains the acceptable values for the
	// CreateKeyUpdateRequest.Scope field.
	CreateKeyUpdateRequestScope struct {

		// Internal == "internal"
		Internal string

		// Public == "public"
		Public string

		// Private == "private"
		Private string
	}

	// CreateOrgStatusRequestIncidentType contains the acceptable values for the
	// CreateOrgStatusRequest.IncidentType field.
	CreateOrgStatusRequestIncidentType struct {

		// Internal == "internal"
		Internal string

		// Private == "private"
		Private string
	}

	// CreateOrgStatusRequestCategory contains the acceptable values for the
	// CreateOrgStatusRequest.Category field.
	CreateOrgStatusRequestCategory struct {

		// Active == "active"
		Active string

		// Resolved == "resolved"
		Resolved string
	}

	// CreateOrgStatusRequestIcon contains the acceptable values for the
	// CreateOrgStatusRequest.Icon field.
	CreateOrgStatusRequestIcon struct {

		// Clock == "clock"
		Clock string

		// InfoCircle == "info-circle"
		InfoCircle string

		// ExclamationCircle == "exclamation-circle"
		ExclamationCircle string

		// QuestionCircle == "question-circle"
		QuestionCircle string

		// CheckCircle == "check-circle"
		CheckCircle string
	}

	// CustomMetadataFieldType contains the acceptable values for the
	// CustomMetadataField.Type field.
	CustomMetadataFieldType struct {

		// String == "string"
		String string

		// SingleSelect == "single-select"
		SingleSelect string

		// MultiSelect == "multi-select"
		MultiSelect string

		// Bool == "bool"
		Bool string

		// Number == "number"
		Number string

		// Date == "date"
		Date string
	}

	// CustomMetadataFieldDomainName contains the acceptable values for the
	// CustomMetadataField.DomainName field.
	CustomMetadataFieldDomainName struct {

		// Labels == "labels"
		Labels string

		// Incident == "incident"
		Incident string
	}

	// EnableHookRequestEventName contains the acceptable values for the
	// EnableHookRequest.EventName field.
	EnableHookRequestEventName struct {

		// IncidentCreated == "incidentCreated"
		IncidentCreated string

		// IncidentDeleted == "incidentDeleted"
		IncidentDeleted string

		// IncidentUpdated == "incidentUpdated"
		IncidentUpdated string

		// IncidentClosed == "incidentClosed"
		IncidentClosed string

		// ManuallyTriggered == "manuallyTriggered"
		ManuallyTriggered string

		// IncidentFilter == "incidentFilter"
		IncidentFilter string
	}

	// EnabledHookEventName contains the acceptable values for the
	// EnabledHook.EventName field.
	EnabledHookEventName struct {

		// IncidentCreated == "incidentCreated"
		IncidentCreated string

		// IncidentDeleted == "incidentDeleted"
		IncidentDeleted string

		// IncidentUpdated == "incidentUpdated"
		IncidentUpdated string

		// IncidentClosed == "incidentClosed"
		IncidentClosed string

		// ManuallyTriggered == "manuallyTriggered"
		ManuallyTriggered string

		// IncidentFilter == "incidentFilter"
		IncidentFilter string
	}

	// FieldType contains the acceptable values for the
	// Field.Type field.
	FieldType struct {

		// String == "string"
		String string

		// StringGrafanaAPIKeyViewer == "string[grafana.apiKey:viewer]"
		StringGrafanaAPIKeyViewer string

		// StringGrafanaAPIKeyAdmin == "string[grafana.apiKey:admin]"
		StringGrafanaAPIKeyAdmin string

		// Bool == "bool"
		Bool string
	}

	// GetFieldValuesRequestTargetKind contains the acceptable values for the
	// GetFieldValuesRequest.TargetKind field.
	GetFieldValuesRequestTargetKind struct {

		// Incident == "incident"
		Incident string
	}

	// GetInitialKeyUpdateRequestContentType contains the acceptable values for the
	// GetInitialKeyUpdateRequest.ContentType field.
	GetInitialKeyUpdateRequestContentType struct {

		// TextPlain == "text/plain"
		TextPlain string

		// ApplicationXLexicalEditor == "application/x-lexical-editor"
		ApplicationXLexicalEditor string

		// TextMarkdownSlack == "text/markdown+slack"
		TextMarkdownSlack string

		// TextMarkdownMsteams == "text/markdown+msteams"
		TextMarkdownMsteams string
	}

	// GetKeyUpdateRequestContentType contains the acceptable values for the
	// GetKeyUpdateRequest.ContentType field.
	GetKeyUpdateRequestContentType struct {

		// TextPlain == "text/plain"
		TextPlain string

		// ApplicationXLexicalEditor == "application/x-lexical-editor"
		ApplicationXLexicalEditor string

		// TextMarkdownSlack == "text/markdown+slack"
		TextMarkdownSlack string

		// TextMarkdownMsteams == "text/markdown+msteams"
		TextMarkdownMsteams string
	}

	// GetLastKeyUpdateRequestContentType contains the acceptable values for the
	// GetLastKeyUpdateRequest.ContentType field.
	GetLastKeyUpdateRequestContentType struct {

		// TextPlain == "text/plain"
		TextPlain string

		// ApplicationXLexicalEditor == "application/x-lexical-editor"
		ApplicationXLexicalEditor string

		// TextMarkdownSlack == "text/markdown+slack"
		TextMarkdownSlack string

		// TextMarkdownMsteams == "text/markdown+msteams"
		TextMarkdownMsteams string
	}

	// HookRunEventName contains the acceptable values for the
	// HookRun.EventName field.
	HookRunEventName struct {

		// IncidentCreated == "incidentCreated"
		IncidentCreated string

		// IncidentDeleted == "incidentDeleted"
		IncidentDeleted string

		// IncidentUpdated == "incidentUpdated"
		IncidentUpdated string

		// IncidentClosed == "incidentClosed"
		IncidentClosed string

		// ManuallyTriggered == "manuallyTriggered"
		ManuallyTriggered string

		// IncidentFilter == "incidentFilter"
		IncidentFilter string
	}

	// HookRunUpdateStatus contains the acceptable values for the
	// HookRun.UpdateStatus field.
	HookRunUpdateStatus struct {

		// Todo == "todo"
		Todo string

		// Success == "success"
		Success string

		// Failed == "failed"
		Failed string
	}

	// HookRunStatus contains the acceptable values for the
	// HookRun.Status field.
	HookRunStatus struct {

		// Todo == "todo"
		Todo string

		// Success == "success"
		Success string

		// Failed == "failed"
		Failed string
	}

	// IncidentIncidentType contains the acceptable values for the
	// Incident.IncidentType field.
	IncidentIncidentType struct {

		// Internal == "internal"
		Internal string

		// Private == "private"
		Private string
	}

	// IncidentStatus contains the acceptable values for the
	// Incident.Status field.
	IncidentStatus struct {

		// Active == "active"
		Active string

		// Resolved == "resolved"
		Resolved string
	}

	// IncidentPreviewIncidentType contains the acceptable values for the
	// IncidentPreview.IncidentType field.
	IncidentPreviewIncidentType struct {

		// Internal == "internal"
		Internal string

		// Private == "private"
		Private string
	}

	// IncidentPreviewStatus contains the acceptable values for the
	// IncidentPreview.Status field.
	IncidentPreviewStatus struct {

		// Active == "active"
		Active string

		// Resolved == "resolved"
		Resolved string
	}

	// IncidentPreviewsQueryOrderDirection contains the acceptable values for the
	// IncidentPreviewsQuery.OrderDirection field.
	IncidentPreviewsQueryOrderDirection struct {

		// ASC == "ASC"
		ASC string

		// DESC == "DESC"
		DESC string
	}

	// IncidentPreviewsQueryOrderField contains the acceptable values for the
	// IncidentPreviewsQuery.OrderField field.
	IncidentPreviewsQueryOrderField struct {

		// IncidentID == "incidentID"
		IncidentID string

		// CreatedTime == "createdTime"
		CreatedTime string

		// ModifiedTime == "modifiedTime"
		ModifiedTime string

		// Title == "title"
		Title string

		// Status == "status"
		Status string

		// Severity == "severity"
		Severity string

		// Prefix == "prefix"
		Prefix string

		// IsDrill == "isDrill"
		IsDrill string

		// IncidentStart == "incidentStart"
		IncidentStart string

		// IncidentEnd == "incidentEnd"
		IncidentEnd string

		// ClosedTime == "closedTime"
		ClosedTime string
	}

	// IncidentsQueryOrderDirection contains the acceptable values for the
	// IncidentsQuery.OrderDirection field.
	IncidentsQueryOrderDirection struct {

		// ASC == "ASC"
		ASC string

		// DESC == "DESC"
		DESC string
	}

	// KeyUpdateContentType contains the acceptable values for the
	// KeyUpdate.ContentType field.
	KeyUpdateContentType struct {

		// TextPlain == "text/plain"
		TextPlain string

		// ApplicationXLexicalEditor == "application/x-lexical-editor"
		ApplicationXLexicalEditor string

		// TextMarkdownSlack == "text/markdown+slack"
		TextMarkdownSlack string

		// TextMarkdownMsteams == "text/markdown+msteams"
		TextMarkdownMsteams string
	}

	// KeyUpdateScope contains the acceptable values for the
	// KeyUpdate.Scope field.
	KeyUpdateScope struct {

		// Internal == "internal"
		Internal string

		// Public == "public"
		Public string

		// Private == "private"
		Private string
	}

	// KeyUpdatesQueryOrderDirection contains the acceptable values for the
	// KeyUpdatesQuery.OrderDirection field.
	KeyUpdatesQueryOrderDirection struct {

		// ASC == "ASC"
		ASC string

		// DESC == "DESC"
		DESC string
	}

	// KeyUpdatesQueryOrderField contains the acceptable values for the
	// KeyUpdatesQuery.OrderField field.
	KeyUpdatesQueryOrderField struct {

		// CreatedTime == "createdTime"
		CreatedTime string

		// ModifiedTime == "modifiedTime"
		ModifiedTime string

		// Title == "title"
		Title string
	}

	// KeyUpdatesQueryScope contains the acceptable values for the
	// KeyUpdatesQuery.Scope field.
	KeyUpdatesQueryScope struct {

		// Internal == "internal"
		Internal string

		// Public == "public"
		Public string

		// Private == "private"
		Private string
	}

	// KeyUpdatesQueryContentType contains the acceptable values for the
	// KeyUpdatesQuery.ContentType field.
	KeyUpdatesQueryContentType struct {

		// TextPlain == "text/plain"
		TextPlain string

		// ApplicationXLexicalEditor == "application/x-lexical-editor"
		ApplicationXLexicalEditor string

		// TextMarkdownSlack == "text/markdown+slack"
		TextMarkdownSlack string

		// TextMarkdownMsteams == "text/markdown+msteams"
		TextMarkdownMsteams string
	}

	// QueryOrgStatusesRequestIncidentType contains the acceptable values for the
	// QueryOrgStatusesRequest.IncidentType field.
	QueryOrgStatusesRequestIncidentType struct {

		// Internal == "internal"
		Internal string

		// Private == "private"
		Private string
	}

	// RecordFieldValueRequestTargetKind contains the acceptable values for the
	// RecordFieldValueRequest.TargetKind field.
	RecordFieldValueRequestTargetKind struct {

		// Incident == "incident"
		Incident string
	}

	// StatusIncidentType contains the acceptable values for the
	// Status.IncidentType field.
	StatusIncidentType struct {

		// Internal == "internal"
		Internal string

		// Private == "private"
		Private string
	}

	// StatusCategory contains the acceptable values for the
	// Status.Category field.
	StatusCategory struct {

		// Active == "active"
		Active string

		// Resolved == "resolved"
		Resolved string
	}

	// StatusIcon contains the acceptable values for the
	// Status.Icon field.
	StatusIcon struct {

		// Clock == "clock"
		Clock string

		// InfoCircle == "info-circle"
		InfoCircle string

		// ExclamationCircle == "exclamation-circle"
		ExclamationCircle string

		// QuestionCircle == "question-circle"
		QuestionCircle string

		// CheckCircle == "check-circle"
		CheckCircle string
	}

	// StatusConfigurationIncidentType contains the acceptable values for the
	// StatusConfiguration.IncidentType field.
	StatusConfigurationIncidentType struct {

		// Internal == "internal"
		Internal string

		// Private == "private"
		Private string
	}

	// TaskStatus contains the acceptable values for the
	// Task.Status field.
	TaskStatus struct {

		// Todo == "todo"
		Todo string

		// Progress == "progress"
		Progress string

		// Done == "done"
		Done string
	}

	// UnassignRoleRequestRole contains the acceptable values for the
	// UnassignRoleRequest.Role field.
	UnassignRoleRequestRole struct {

		// Commander == "commander"
		Commander string

		// Investigator == "investigator"
		Investigator string

		// Observer == "observer"
		Observer string
	}

	// UpdateActivityRelevanceRequestRelevance contains the acceptable values for the
	// UpdateActivityRelevanceRequest.Relevance field.
	UpdateActivityRelevanceRequestRelevance struct {

		// Automatic == "automatic"
		Automatic string

		// Archive == "archive"
		Archive string

		// Low == "low"
		Low string

		// Normal == "normal"
		Normal string

		// High == "high"
		High string
	}

	// UpdateIncidentEventTimeRequestActivityItemKind contains the acceptable values for the
	// UpdateIncidentEventTimeRequest.ActivityItemKind field.
	UpdateIncidentEventTimeRequestActivityItemKind struct {

		// IncidentEnd == "incidentEnd"
		IncidentEnd string

		// IncidentStart == "incidentStart"
		IncidentStart string
	}

	// UpdateIncidentEventTimeRequestEventName contains the acceptable values for the
	// UpdateIncidentEventTimeRequest.EventName field.
	UpdateIncidentEventTimeRequestEventName struct {

		// IncidentEnd == "incidentEnd"
		IncidentEnd string

		// IncidentStart == "incidentStart"
		IncidentStart string
	}

	// UpdateKeyUpdateRequestContentType contains the acceptable values for the
	// UpdateKeyUpdateRequest.ContentType field.
	UpdateKeyUpdateRequestContentType struct {

		// TextPlain == "text/plain"
		TextPlain string

		// ApplicationXLexicalEditor == "application/x-lexical-editor"
		ApplicationXLexicalEditor string

		// TextMarkdownSlack == "text/markdown+slack"
		TextMarkdownSlack string

		// TextMarkdownMsteams == "text/markdown+msteams"
		TextMarkdownMsteams string
	}

	// UpdateKeyUpdateRequestScope contains the acceptable values for the
	// UpdateKeyUpdateRequest.Scope field.
	UpdateKeyUpdateRequestScope struct {

		// Internal == "internal"
		Internal string

		// Public == "public"
		Public string

		// Private == "private"
		Private string
	}

	// UpdateOrgStatusRequestIncidentType contains the acceptable values for the
	// UpdateOrgStatusRequest.IncidentType field.
	UpdateOrgStatusRequestIncidentType struct {

		// Internal == "internal"
		Internal string

		// Private == "private"
		Private string
	}

	// UpdateOrgStatusRequestCategory contains the acceptable values for the
	// UpdateOrgStatusRequest.Category field.
	UpdateOrgStatusRequestCategory struct {

		// Active == "active"
		Active string

		// Resolved == "resolved"
		Resolved string
	}

	// UpdateOrgStatusRequestIcon contains the acceptable values for the
	// UpdateOrgStatusRequest.Icon field.
	UpdateOrgStatusRequestIcon struct {

		// Clock == "clock"
		Clock string

		// InfoCircle == "info-circle"
		InfoCircle string

		// ExclamationCircle == "exclamation-circle"
		ExclamationCircle string

		// QuestionCircle == "question-circle"
		QuestionCircle string

		// CheckCircle == "check-circle"
		CheckCircle string
	}

	// UpdateStatusRequestStatus contains the acceptable values for the
	// UpdateStatusRequest.Status field.
	UpdateStatusRequestStatus struct {

		// Active == "active"
		Active string

		// Resolved == "resolved"
		Resolved string
	}

	// UpdateTaskStatusRequestStatus contains the acceptable values for the
	// UpdateTaskStatusRequest.Status field.
	UpdateTaskStatusRequestStatus struct {

		// Todo == "todo"
		Todo string

		// Progress == "progress"
		Progress string

		// Done == "done"
		Done string
	}
}

Options contains constants to use for various fields across the API. It follows Options.{ObjectName}{FieldName}.{Option} structure, for example Options.IncidentSeverity.Pending.

View Source
var UserAgent = "incident-go/v1.92.2"

UserAgent is the User-Agent string used when making HTTP requests.

Functions

func GenerateSignature

func GenerateSignature(data []byte, secret string) string

GenerateSignature creates SHA256 hash.

func Hash

func Hash(data []byte) string

Hash encodes SHA256 hash to Base64.

func VerifySignature

func VerifySignature(r *http.Request, signingSecret string) error

VerifySignature checks Gi-Signature header against the secret you got when enabling the integration in the tool.

Types

type ActivityItem

type ActivityItem struct {

	// The unique identifier of the ActivityItem.
	ActivityItemID string `json:"activityItemID"`

	// IncidentID is the unique identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// User is the person who caused the ActivityItem.
	User UserPreview `json:"user"`

	// SubjectUser is the person who was affected by the ActivityItem (not the person
	// who caused it).
	SubjectUser UserPreview `json:"subjectUser"`

	// CreatedTime is the time when the ActivityItem was created. The string value
	// format should follow RFC 3339.
	CreatedTime string `json:"createdTime"`

	// EventTime is the time when the event occurred. It is configurable by the user.
	// The string value format should follow RFC 3339.
	EventTime string `json:"eventTime"`

	// ActivityKind is the type of activity this item represents.
	ActivityKind string `json:"activityKind"`

	// Body is a human readable description of the ActivityItem.
	Body string `json:"body"`

	// URL is an url related with this activity
	URL string `json:"url"`

	// Tags contains a list of tags associated with this activity.
	Tags []string `json:"tags"`

	// Immutable indicates if the activity is immutable.
	Immutable bool `json:"immutable"`

	// FieldValues is an object of field values associated with the ActivityItem.
	// The structure is determined by the ActivityKind.
	FieldValues map[string]interface{} `json:"fieldValues"`

	// Attachments is a list of files attached to this item.
	Attachments []Attachment `json:"attachments"`

	// Relevance is the preferred relevance of the activity item. if set to 'automatic'
	// (the default), the relevance will be guessed automatically.
	Relevance string `json:"relevance"`
}

ActivityItem describes an event that occurred related to an Incident.

type ActivityQuery

type ActivityQuery struct {

	// IncidentID is the unique identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// Limit is the number of Incidents to return.
	Limit int `json:"limit"`

	// Tag is the tag to filter by.
	Tag string `json:"tag"`

	// OrderDirection is the direction to order the results.
	OrderDirection string `json:"orderDirection"`

	// ActivityKind filters by a list of allowed ActivityKind's.
	ActivityKind []string `json:"activityKind"`
}

ActivityQuery is the response from the QueryActivity method.

type ActivityService

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

ActivityService provides access to incident activity. You can post notes to the timeline, and query and update the individual timeline items. Get one by calling NewActivityService.

func NewActivityService

func NewActivityService(client *Client) *ActivityService

NewActivityService gets a new ActivityService.

func (*ActivityService) AddActivity

AddActivity posts an activity item to an Incident.

func (*ActivityService) QueryActivity

QueryActivity gets a selection of activity items.

func (*ActivityService) RemoveActivity

RemoveActivity removes an activity item.

func (*ActivityService) UpdateActivityBody

UpdateActivityBody updates the body of a specific activity item.

func (*ActivityService) UpdateActivityEventTime

UpdateActivityEventTime updates the event time of a specific activity item.

func (*ActivityService) UpdateActivityRelevance

UpdateActivityRelevance sets the relevance of an activity item.

type AddActivityRequest

type AddActivityRequest struct {

	// IncidentID is the unique identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// ActivityKind is the type of activity this item represents.
	ActivityKind string `json:"activityKind"`

	// Body is a human readable description of the ActivityItem. URLs mentioned will be
	// parsed and attached as context.
	Body string `json:"body"`

	// FieldValues is an object of field values associated with the ActivityItem.
	// The structure is determined by the ActivityKind.
	FieldValues map[string]interface{} `json:"fieldValues"`

	// EventTime is the time when the event occurred. If empty, the current time is
	// used. The string value format should follow RFC 3339.
	EventTime string `json:"eventTime"`
}

AddActivityRequest is the request for the AddActivity method.

type AddActivityResponse

type AddActivityResponse struct {

	// ActivityItem is the newly created ActivityItem.
	ActivityItem ActivityItem `json:"activityItem"`
}

AddActivityResponse is the response from the AddActivity method.

type AddFieldRequest

type AddFieldRequest struct {

	// Field is the field to add.
	Field CustomMetadataField `json:"field"`
}

AddFieldRequest is the request struct for api AddField method.

type AddFieldResponse

type AddFieldResponse struct {

	// Field is the field that was added.
	Field CustomMetadataField `json:"field"`
}

AddFieldResponse is the response from the AddField method.

type AddFieldSelectOptionRequest

type AddFieldSelectOptionRequest struct {

	// FieldUUID is the UUID of the field.
	FieldUUID string `json:"fieldUUID"`

	// FieldSelectOption is the new field select option.
	FieldSelectOption CustomMetadataFieldSelectOption `json:"fieldSelectOption"`
}

AddFieldSelectOptionRequest is the request struct for AddFieldSelectOption method.

type AddFieldSelectOptionResponse

type AddFieldSelectOptionResponse struct {

	// FieldSelectOptionUUID is the UUID of the field select option that was added.
	FieldSelectOptionUUID string `json:"fieldSelectOptionUUID"`
}

AddFieldSelectOptionResponse is the response from the AddFieldSelectOption method.

type AddLabelKeyRequest

type AddLabelKeyRequest struct {

	// Key is the label key.
	Key string `json:"key"`

	// Description is a short explanation of the label.
	Description string `json:"description"`

	// Color is the CSS hex color of the label. Labels show up in both light and dark
	// modes, and this should be taken into consideration when selecting a color.
	ColorHex string `json:"colorHex"`
}

AddLabelKeyRequest is the request for the AddLabelKey method.

type AddLabelKeyResponse

type AddLabelKeyResponse struct {

	// Field is the field that was added.
	Field CustomMetadataField `json:"field"`
}

AddLabelKeyResponse is the response for the AddLabelKey method.

type AddLabelRequest

type AddLabelRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// Label is the new label of the Incident.
	Label IncidentLabel `json:"label"`
}

AddLabelRequest is the request for the AddLabel method.

type AddLabelResponse

type AddLabelResponse struct {

	// Incident is the Incident that was just modified.
	Incident Incident `json:"incident"`
}

AddLabelResponse is the response for the AddLabel method.

type AddLabelValueRequest

type AddLabelValueRequest struct {

	// Key is the label key.
	Key string `json:"key"`

	// Value is the label value.
	Value string `json:"value"`

	// Description is a short explanation of the label value.
	Description string `json:"description"`

	// Color is the CSS hex color of the label value. Labels show up in both light and
	// dark modes, and this should be taken into consideration when selecting a color.
	ColorHex string `json:"colorHex"`
}

AddLabelValueRequest is the request for the AddLabelValue method.

type AddLabelValueResponse

type AddLabelValueResponse struct {

	// Field is the field that was updated.
	Field CustomMetadataField `json:"field"`
}

AddLabelValueResponse is the response for the AddLabelValue method.

type AddTaskRequest

type AddTaskRequest struct {

	// IncidentID is the ID of the Incident to add the Task to.
	IncidentID string `json:"incidentID"`

	// Text is the todo item.
	Text string `json:"text"`

	// AssignToUserId is the user the task will be assigned to
	AssignToUserId string `json:"assignToUserID"`
}

AddTaskRequest is the request for the AddTask method.

type AddTaskResponse

type AddTaskResponse struct {

	// IncidentID is the ID of the incident these tasks relate to.
	IncidentID string `json:"incidentID"`

	// Task is the newly added Task. It will also appear in Tasks.
	Task Task `json:"task"`

	// TaskList is the tasks list.
	TaskList TaskList `json:"taskList"`
}

AddTaskResponse is the response from the AddTask method.

type ArchiveFieldRequest

type ArchiveFieldRequest struct {

	// FieldUUID is the UUID of the field.
	FieldUUID string `json:"fieldUUID"`
}

ArchiveFieldRequest is the request struct for api ArchiveField method.

type ArchiveFieldResponse

type ArchiveFieldResponse struct {
}

ArchiveFieldResponse is the response from the ArchiveField method.

type ArchiveRoleRequest

type ArchiveRoleRequest struct {

	// Role to be archived to the organization
	RoleID int `json:"roleID"`
}

ArchiveRoleRequest is the request to archive a role.

type ArchiveRoleResponse

type ArchiveRoleResponse struct {
}

ArchiveRoleResponse is the response to archive a role.

type AssignLabelByUUIDRequest

type AssignLabelByUUIDRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// KeyUUID is the label key uuid.
	KeyUUID string `json:"keyUUID"`

	// ValueUUID is the UUID of the label value.
	ValueUUID string `json:"valueUUID"`
}

AssignLabelByUUIDRequest is the request for the AssignLabelByUUID method.

type AssignLabelByUUIDResponse

type AssignLabelByUUIDResponse struct {

	// Labels is a list of labels
	Labels []IncidentKeyValueLabel `json:"labels"`
}

AssignLabelByUUIDResponse is the response from the AssignLabelByUUID method.

type AssignLabelRequest

type AssignLabelRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// Key is the label key.
	Key string `json:"key"`

	// Value is the value of the label.
	Value string `json:"value"`
}

AssignLabelRequest is the request for the AssignLabel method.

type AssignLabelResponse

type AssignLabelResponse struct {

	// Labels is a list of labels
	Labels []IncidentKeyValueLabel `json:"labels"`
}

AssignLabelResponse is the response from the AssignLabel method.

type AssignRoleRequest

type AssignRoleRequest struct {

	// IncidentID is the identifier.
	IncidentID string `json:"incidentID"`

	// UserID is the identifier of the person to assign the role to.
	UserID string `json:"userID"`

	// Role is the role of this person.
	Role string `json:"role"`
}

AssignRoleRequest is the request for the AssignRole method.

type AssignRoleResponse

type AssignRoleResponse struct {

	// Incident is the Incident that was just updated.
	Incident Incident `json:"incident"`

	// DidChange indicates if the role was changed or not. If the role was already
	// assigned, this will be false.
	DidChange bool `json:"didChange"`
}

AssignRoleResponse is the response for the AssignRole method.

type Assignment

type Assignment struct {

	// User is the person who holds this role.
	User UserPreview `json:"user"`

	// Role is the role string.
	Role Role `json:"role"`

	// RoleID is the identifier of the role.
	RoleID int `json:"roleID"`
}

Relation between a User and a Role inside the incident

type AssignmentPreview

type AssignmentPreview struct {

	// User is the person who holds this role.
	User UserPreview `json:"user"`

	// RoleID is the identifier of the role.
	RoleID int `json:"roleID"`
}

AssignmentPreview describes a person assigned to an incident without the Role object.

type Attachment

type Attachment struct {

	// AttachmentID is the unique ID of this attachment.
	AttachmentID string `json:"attachmentID"`

	// AttachedByUserID is the ID of the user who attached this.
	AttachedByUserID string `json:"attachedByUserID"`

	// SourceURL is the URL of the file.
	SourceURL string `json:"sourceURL"`

	// UseSourceURL is true if the file should be downloaded from the source URL.
	UseSourceURL bool `json:"useSourceURL"`

	// Path is the full path of the file.
	Path string `json:"path"`

	// UploadTime is the time the file was uploaded.
	UploadTime string `json:"uploadTime"`

	// DeletedTime is the time the file was deleted. Empty string means the file hasn't
	// been deleted.
	DeletedTime string `json:"deletedTime"`

	// ContentType is the type of the file.
	ContentType string `json:"contentType"`

	// FileType is the type of file.
	FileType string `json:"fileType"`

	// Ext is the file extension.
	Ext string `json:"ext"`

	// ContentLength is the ContentLength of the file in bytes.
	ContentLength int64 `json:"contentLength"`

	// DisplayType is how the file will be displayed.
	DisplayType string `json:"displayType"`

	// DownloadURL for download
	DownloadURL string `json:"downloadURL"`

	// HasThumbnail is true if the file has a thumbnail.
	HasThumbnail bool `json:"hasThumbnail"`

	// ThumbnailURL for previews
	ThumbnailURL string `json:"thumbnailURL"`

	// SHA512 is the hash of the file contents.
	SHA512 string `json:"sHA512"`

	// AttachmentErr is a string describing an error that occurred while processing the
	// attachment.
	AttachmentErr string `json:"attachmentErr"`
}

Attachment is a file attached to something.

type Client

type Client struct {
	// RemoteHost is the URL of the remote server that this Client should
	// access.
	RemoteHost string
	// HTTPClient is the http.Client to use when making HTTP requests.
	HTTPClient *http.Client
	// BeforeRequest is an optional hook that gives you the opportunity
	// to inspect or modify the request before it is made.
	// Useful for adding auth headers, for example.
	// By default, it will add the Authorization header using the serviceAccountToken.
	BeforeRequest func(r *http.Request) error
	// Debug writes a line of debug log output.
	// No-op by default.
	Debug func(s string)
	// contains filtered or unexported fields
}

Client is used to access services.

func NewClient

func NewClient(remoteHost, serviceAccountToken string) *Client

NewClient makes a new Client. The remoteHost should be "https://your-stack.grafana.net/api/plugins/grafana-irm-app/resources/api/v1" with `your-stack.grafana.net` pointing to your instance. The serviceAccountToken can be obtained from the Configuration via the web app (For more information, see https://grafana.com/docs/grafana-cloud/incident/api/rpc/auth/).

func NewTestClient

func NewTestClient() *Client

NewTestClient makes a new test Client that always returns the same data.

type CreateIncidentRequest

type CreateIncidentRequest struct {

	// Title is the headline title of the Incident. Shorter the better, but should
	// contain enough information to be able to identify and refer to this issue.
	Title string `json:"title"`

	// Severity expresses how bad the Incident is.
	Severity string `json:"severity"`

	// Labels are the labels associated with the Incident. Only the Label string is
	// processed, the other fields are ignored.
	Labels []IncidentLabel `json:"labels"`

	// RoomPrefix is the prefix that will be used to create the Incident room.
	RoomPrefix string `json:"roomPrefix"`

	// IsDrill indicates if the Incident is a drill or not. Incidents that are drills
	// do not show up in the dashboards, and may behave subtly differently in other
	// ways too. For example, during drills, more help might be offered to users.
	IsDrill bool `json:"isDrill"`

	// Status is the starting status of the Incident. Use "resolved" to open a
	// retrospective incident.
	Status string `json:"status"`

	// AttachCaption is the title of associated URL.
	AttachCaption string `json:"attachCaption"`

	// AttachURLis the associated URL.
	AttachURL string `json:"attachURL"`

	// InitialStatusUpdate is the initial status update content that will be created
	// when the incident is created. This will be added directly as a key update for
	// the incident.
	InitialStatusUpdate string `json:"initialStatusUpdate"`

	// AlertGroupID is the identifier of the alert group associated with this incident.
	AlertGroupID *string `json:"alertGroupID"`
}

CreateIncidentRequest is the request for the CreateIncident method.

type CreateIncidentResponse

type CreateIncidentResponse struct {

	// Incident is the Incident that was created.
	Incident Incident `json:"incident"`
}

CreateIncidentResponse is the response for the CreateIncident method.

type CreateIncidentSlackChannelRequest

type CreateIncidentSlackChannelRequest struct {

	// IncidentID is the identifier of the Incident to create the channel for.
	IncidentID string `json:"incidentID"`

	// ChannelName is the desired Slack channel name. It will be sanitized (lowercased,
	// special characters removed) before being passed to Slack.
	ChannelName string `json:"channelName"`

	// PostUpdates controls whether incident activity updates are posted to the
	// resulting channel. Stored on the HookRun metadata.
	PostUpdates bool `json:"postUpdates"`

	// InviteUsers controls whether users with an active role on the incident are
	// invited to the channel when their role is assigned. Stored on the HookRun
	// metadata.
	InviteUsers bool `json:"inviteUsers"`
}

CreateIncidentSlackChannelRequest is the request for the CreateIncidentSlackChannel method.

type CreateIncidentSlackChannelResponse

type CreateIncidentSlackChannelResponse struct {

	// ChannelID is the Slack channel ID returned by Slack after channel creation.
	ChannelID string `json:"channelID"`

	// ChannelName is the actual channel name created in Slack. This may differ from
	// the requested name if a suffix was appended due to a name collision.
	ChannelName string `json:"channelName"`
}

CreateIncidentSlackChannelResponse is the response for the CreateIncidentSlackChannel method.

type CreateKeyUpdateRequest

type CreateKeyUpdateRequest struct {

	// IncidentID is the identifier of the incident.
	IncidentID string `json:"incidentID"`

	// Title is a short summary of the key update.
	Title *string `json:"title"`

	// Content provides detailed information about the key update.
	Content string `json:"content"`

	// ContentType specifies the format of the content.
	ContentType string `json:"contentType"`

	// StatusID references the incident status at the time of this update.
	StatusID string `json:"statusID"`

	// SeverityID references the incident severity at the time of this update.
	SeverityID string `json:"severityID"`

	// Scope specifies the audience or visibility of this key update.
	Scope string `json:"scope"`

	// Color is the color of the key update.
	Color *string `json:"color"`
}

CreateKeyUpdateRequest is the request for the CreateKeyUpdate method.

type CreateKeyUpdateResponse

type CreateKeyUpdateResponse struct {

	// KeyUpdate is the newly created key update.
	KeyUpdate KeyUpdate `json:"keyUpdate"`
}

CreateKeyUpdateResponse is the response for the CreateKeyUpdate method.

type CreateOrgStatusRequest

type CreateOrgStatusRequest struct {

	// IncidentType is the type of incident this status applies to.
	IncidentType string `json:"incidentType"`

	// Name is the display name of the status.
	Name string `json:"name"`

	// Description provides additional context about the status.
	Description string `json:"description"`

	// Category indicates whether status is active or resolved.
	Category string `json:"category"`

	// Color is the hex color for the status.
	Color string `json:"color"`

	// Icon is the icon name for the status.
	Icon string `json:"icon"`
}

CreateOrgStatusRequest is the request for CreateOrgStatus.

type CreateOrgStatusResponse

type CreateOrgStatusResponse struct {

	// Status is the newly created status.
	Status Status `json:"status"`
}

CreateOrgStatusResponse is the response from CreateOrgStatus.

type CreateRoleRequest

type CreateRoleRequest struct {

	// Role to be created to the organization
	Role Role `json:"role"`
}

CreateRoleRequest is the request to create a role.

type CreateRoleResponse

type CreateRoleResponse struct {

	// Role is the newly created role.
	Role Role `json:"role"`
}

CreateRoleResponse is the response to create a role.

type Cursor

type Cursor struct {

	// NextValue is the start position of the next set of results. The implementation
	// may change, so clients should not rely on this value.
	NextValue string `json:"nextValue"`

	// HasMore indicates whether there are more results or not. If HasMore is true,
	// you can make the same request again (except using this Cursor instead) to get
	// the next page of results.
	HasMore bool `json:"hasMore"`
}

Cursor describes the position in a result set. It is passed back into the same API to get the next page of results.

type CustomMetadataField

type CustomMetadataField struct {

	// UUID is the UUID of the field.
	UUID string `json:"uuid"`

	// Name is the name of the field.
	Name string `json:"name"`

	// Slug is the slug of the field. Used for searching and referencing the field as a
	// metric.
	Slug string `json:"slug"`

	// Color is the field color.
	Color string `json:"color"`

	// Icon is the field icon.
	Icon string `json:"icon"`

	// Description is the description of the field.
	Description string `json:"description"`

	// Type is the type of the field.
	Type string `json:"type"`

	// Required is whether this field is required.
	Required bool `json:"required"`

	// Immutable indicates if the field can by modified by the user.
	Immutable bool `json:"immutable"`

	// DomainName is scope for which the field is valid/used.
	DomainName string `json:"domainName"`

	// Selectoptions is the list of select options for the field. Only used for select
	// fields.
	Selectoptions []CustomMetadataFieldSelectOption `json:"selectoptions"`

	// Source indicates the origin of this field (eg. incident, gops-labels, github,
	// etc)
	Source string `json:"source"`

	// ExternalID, if defined, stores the ID of this field in a third-party service
	// (eg. gops-label id)
	ExternalID string `json:"externalID"`

	// Archived is whether this field is archived. Archived fields are not allowed to
	// be used in the new incidents. But the historical data is still kept.
	Archived bool `json:"archived"`

	// Version is the field version.
	Version int `json:"version"`
}

CustomMetadataField is a custom metadata field.

type CustomMetadataFieldSelectOption

type CustomMetadataFieldSelectOption struct {

	// UUID is the UUID of the option.
	UUID string `json:"uuid"`

	// Value is the value of the select option.
	Value string `json:"value"`

	// Label is the label of the select option.
	Label string `json:"label"`

	// Color is the color of the select option.
	Color string `json:"color"`

	// Icon is the icon of the select option.
	Icon string `json:"icon"`

	// Description is the textual description of the option.
	Description string `json:"description"`

	// Source indicates the origin of this option (eg. incident, gops-labels, github,
	// etc)
	Source string `json:"source"`

	// ExternalID, if defined, stores the ID of this option in a third-party service
	// (eg. gops-label id)
	ExternalID string `json:"externalID"`
}

CustomMetadataFieldSelectOption is a select option for a select field.

type CustomMetadataFieldValue

type CustomMetadataFieldValue struct {

	// FieldUUID is the UUID of the field.
	FieldUUID string `json:"fieldUUID"`

	// Value is the json encoded value of the field.
	Value string `json:"value"`
}

CustomMetadataFieldValue is a custom metadata field value.

type DeleteFieldRequest

type DeleteFieldRequest struct {

	// FieldUUID is the UUID of the field.
	FieldUUID string `json:"fieldUUID"`
}

DeleteFieldRequest is the request struct for api DeleteField method.

type DeleteFieldResponse

type DeleteFieldResponse struct {
}

DeleteFieldResponse is the response from the DeleteField method.

type DeleteFieldSelectOptionRequest

type DeleteFieldSelectOptionRequest struct {

	// FieldUUID is the UUID of the field.
	FieldUUID string `json:"fieldUUID"`

	// SelectOptionUUID is the UUID of the field select option to delete.
	SelectOptionUUID string `json:"selectOptionUUID"`
}

DeleteFieldSelectOptionRequest is the request struct for DeleteFieldSelectOption method.

type DeleteFieldSelectOptionResponse

type DeleteFieldSelectOptionResponse struct {
}

DeleteFieldSelectOptionResponse is the response from the DeleteFieldSelectOption method.

type DeleteKeyUpdateRequest

type DeleteKeyUpdateRequest struct {

	// ID is the identifier of the key update to delete.
	ID string `json:"id"`

	// IncidentID is the identifier of the incident.
	IncidentID string `json:"incidentID"`
}

DeleteKeyUpdateRequest is the request for the DeleteKeyUpdate method.

type DeleteKeyUpdateResponse

type DeleteKeyUpdateResponse struct {
}

DeleteKeyUpdateResponse is the response for the DeleteKeyUpdate method.

type DeleteRoleRequest

type DeleteRoleRequest struct {

	// Role to be deleted to the organization
	RoleID int `json:"roleID"`
}

DeleteRoleRequest is the request to delete a role.

type DeleteRoleResponse

type DeleteRoleResponse struct {
}

DeleteRoleResponse is the response to delete a role.

type DeleteTaskRequest

type DeleteTaskRequest struct {

	// IncidentID is the ID of the Incident.
	IncidentID string `json:"incidentID"`

	// TaskID is the ID of the task.
	TaskID string `json:"taskID"`
}

DeleteTaskRequest is the request for the DeleteTask method.

type DeleteTaskResponse

type DeleteTaskResponse struct {

	// IncidentID is the ID of the incident these tasks relate to.
	IncidentID string `json:"incidentID"`

	// TaskList is the tasks list.
	TaskList TaskList `json:"taskList"`
}

DeleteTaskResponse is the response from the DeleteTask method.

type DisableHookRequest

type DisableHookRequest struct {

	// IntegrationID is the identifier of the installed integration.
	IntegrationID string `json:"integrationID"`

	// EnabledHookID is the identifier of the hook to disable.
	EnabledHookID string `json:"enabledHookID"`
}

DisableHookRequest is the request for the DisableHook method.

type DisableHookResponse

type DisableHookResponse struct {
}

DisableHookResponse is the response for the DisableHook method.

type EnableHookRequest

type EnableHookRequest struct {

	// IntegrationID is the identifier of the installed integration.
	IntegrationID string `json:"integrationID"`

	// HookID is the identifier of the hook to enable.
	HookID string `json:"hookID"`

	// EventName is the name of event to wire the hook up to. The hook will be called
	// when this event is fired.
	EventName string `json:"eventName"`

	// HookConfig is the configuration values to use when enabling the hook.
	HookConfig HookConfig `json:"hookConfig"`

	// IncidentFilter is the filter that determines if a hook with the 'incidentFilter'
	// event will be triggered.
	IncidentFilter string `json:"incidentFilter"`

	// Sensitive is true if the hook run should be triggered when the incident is
	// private. Ensures that hooks are not triggered for private incidents by default.
	Sensitive bool `json:"sensitive"`
}

EnableHookRequest is the request for the EnableHook method.

type EnableHookResponse

type EnableHookResponse struct {

	// EnabledHookID is the identifier of the enabled hook. This is distinct from the
	// HookID.
	EnabledHookID string `json:"enabledHookID"`
}

EnableHookResponse is the response for the EnableHook method.

type EnabledHook

type EnabledHook struct {

	// IntegrationID is the identifier of the Integration that the Hook belongs to.
	IntegrationID string `json:"integrationID"`

	// EnabledHookID is the unique identifier of the enabled hook.
	EnabledHookID string `json:"enabledHookID"`

	// EventName is the name of the event that this hook is wired up to.
	EventName string `json:"eventName"`

	// Hook is the enabled Hook.
	Hook Hook `json:"hook"`

	// IncidentFilter is the filter that determines if a hook with the 'incidentFilter'
	// event will be triggered.
	IncidentFilter string `json:"incidentFilter"`

	// Sensitive is true if the hook run should be triggered when the incident is
	// private. Ensures that hooks are not triggered for private incidents by default.
	Sensitive bool `json:"sensitive"`
}

EnabledHook is a Hook that has been wired up to an event.

type Field

type Field struct {

	// Key is the name of the field.
	Key string `json:"key"`

	// Type describes acceptable data for Value.
	Type string `json:"type"`

	// Description is the description of the field.
	Description string `json:"description"`

	// Value is the value of the field when running an action.
	Value string `json:"value"`

	// Secret is a marker that the field contains secret data and should not be visible
	// to users.
	Secret bool `json:"secret"`

	// Checked is true if the bool field has been checked.
	Checked bool `json:"checked"`

	// Hidden indicates that a field should not be shown in the UI. It is not secret,
	// just noisy, so hidden and out of the way.
	Hidden bool `json:"hidden"`
}

Field represents a key/value pair, with additional metadata. Fields are used to represent dynamic data structures.

type FieldValue

type FieldValue struct {

	// Field is the field definition.
	Field CustomMetadataField `json:"field"`

	// Value is the json encoded value of the field to record. If empty, the field
	// value will be set unset.
	Value string `json:"value"`
}

FieldValue represents a record with a field and its value.

type FieldsService

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

FieldsService provides access to the Fields API, responsible for managing custom metadata fields. Get one by calling NewFieldsService.

func NewFieldsService

func NewFieldsService(client *Client) *FieldsService

NewFieldsService gets a new FieldsService.

func (*FieldsService) AddField

AddField adds a new field to the org.

func (*FieldsService) AddFieldSelectOption

AddFieldSelectOption adds a field select option.

func (*FieldsService) AddLabelKey

AddLabelKey creates a field with the label domain.

func (*FieldsService) AddLabelValue

AddLabelValue adds a label value to a given label key.

func (*FieldsService) ArchiveField

ArchiveField archives a field.

func (*FieldsService) DeleteField

DeleteField deletes a field.

func (*FieldsService) DeleteFieldSelectOption

DeleteFieldSelectOption deletes a field select option.

func (*FieldsService) GetField

GetField returns fields in the org.

func (*FieldsService) GetFieldValues

GetFieldValues gets the key->value linked to a target.

func (*FieldsService) GetFields

GetFields returns a list of all custom fields in the org.

func (*FieldsService) RecordFieldValue

RecordFieldValue records a field value.

func (*FieldsService) UnarchiveField

UnarchiveField unarchives a field.

func (*FieldsService) UpdateField

UpdateField updates a field.

func (*FieldsService) UpdateFieldSelectOption

UpdateFieldSelectOption updates a field select option.

type GetEnabledHooksRequest

type GetEnabledHooksRequest struct {

	// EventName is the name of the event that triggered the Hook to run. If provided,
	// only Hooks that are enabled for this event will be returned.
	EventName string `json:"eventName"`
}

GetEnabledHooksRequest is the request for the GetEnabledHooks method.

type GetEnabledHooksResponse

type GetEnabledHooksResponse struct {

	// EnabledHooks is the complete list of enabled hooks.
	EnabledHooks []EnabledHook `json:"enabledHooks"`
}

GetEnabledHooksResponse is the response for the GetEnabledHooks method.

type GetFieldRequest

type GetFieldRequest struct {

	// FieldUUID is the UUID of the field.
	FieldUUID string `json:"fieldUUID"`

	// IncludeArchived, if true, includes archived fields in the result.
	IncludeArchived bool `json:"includeArchived"`
}

GetFieldRequest is the request struct for api GetField method.

type GetFieldResponse

type GetFieldResponse struct {

	// Field is the requested field.
	Field CustomMetadataField `json:"field"`
}

GetFieldResponse is the response from the GetField method.

type GetFieldValuesRequest

type GetFieldValuesRequest struct {

	// TargetKind is the kind of the target to record the field value for.
	TargetKind string `json:"targetKind"`

	// TargetID is the ID of the target to record the field value for.
	TargetID string `json:"targetID"`

	// DomainName, if provided, will filter the results to the specified domain.
	DomainName string `json:"domainName"`
}

GetFieldValuesRequest is the request struct for the GetFieldValues method.

type GetFieldValuesResponse

type GetFieldValuesResponse struct {

	// FieldValues is a list of field->value pairs.
	FieldValues []FieldValue `json:"fieldValues"`
}

GetFieldValuesResponse is the response struct from the GetFieldValues method.

type GetFieldsRequest

type GetFieldsRequest struct {

	// DomainName, if provided, will filter the results to the specified domain.
	DomainName string `json:"domainName"`
}

GetFieldsRequest is the request struct for api GetFields method.

type GetFieldsResponse

type GetFieldsResponse struct {

	// Fields is the list of fields.
	Fields []CustomMetadataField `json:"fields"`
}

GetFieldsResponse is the response from the GetFields method.

type GetHomescreenVersionRequest

type GetHomescreenVersionRequest struct {
}

GetHomescreenVersionRequest is the request for the GetHomescreenVersion method.

type GetHomescreenVersionResponse

type GetHomescreenVersionResponse struct {

	// Version is the refresh value of the home screen. A higher value than last time
	// indicates that the home screen should be refreshed.
	Version int `json:"version"`
}

GetHomescreenVersionResponse is the response for the GetHomescreenVersion method.

type GetHookRunsRequest

type GetHookRunsRequest struct {

	// IncidentID is the identifier of the incident to get hook runs for.
	IncidentID string `json:"incidentID"`
}

GetHookRunsRequest is the request for the GetHookRuns method.

type GetHookRunsResponse

type GetHookRunsResponse struct {

	// HookRuns is a list of HookRuns for this Incident.
	HookRuns []HookRun `json:"hookRuns"`
}

GetHookRunsResponse is the response for the GetHookRuns method.

type GetIncidentChannelsRequest

type GetIncidentChannelsRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`
}

GetIncidentChannelsRequest is the request for the GetIncidentChannels method.

type GetIncidentChannelsResponse

type GetIncidentChannelsResponse struct {

	// IncidentChannels is the list of chat channels linked to the incident.
	IncidentChannels []IncidentChannel `json:"incidentChannels"`
}

GetIncidentChannelsResponse is the response for the GetIncidentChannels method.

type GetIncidentMembershipRequest

type GetIncidentMembershipRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`
}

GetIncidentMembershipRequest is the request for the GetIncidentMembership method.

type GetIncidentMembershipResponse

type GetIncidentMembershipResponse struct {

	// IncidentMembership is the list of people involved in an incident
	Assignments []Assignment `json:"assignments"`
}

GetIncidentMembershipResponse is the response for the GetIncidentMembership method.

type GetIncidentRequest

type GetIncidentRequest struct {

	// IncidentID is the identifier.
	IncidentID string `json:"incidentID"`
}

GetIncidentRequest is the request for the GetIncident method.

type GetIncidentResponse

type GetIncidentResponse struct {

	// Incident is the Incident.
	Incident Incident `json:"incident"`
}

GetIncidentResponse is the response for the GetIncident method.

type GetIncidentVersionRequest

type GetIncidentVersionRequest struct {

	// IncidentID is the identifier of the Incident. A higher value than last time
	// indicates that the dashboard should be refreshed.
	IncidentID string `json:"incidentID"`
}

GetIncidentVersionRequest is the request for the GetIncidentVersion method.

type GetIncidentVersionResponse

type GetIncidentVersionResponse struct {

	// Version is the refresh value of the Incident.
	Version int `json:"version"`
}

GetIncidentVersionResponse is the response for the GetIncidentVersion method.

type GetInitialKeyUpdateRequest

type GetInitialKeyUpdateRequest struct {

	// IncidentID is the identifier of the incident.
	IncidentID string `json:"incidentID"`

	// ContentType specifies the desired format for the content field in the response.
	ContentType string `json:"contentType"`
}

GetInitialKeyUpdateRequest is the request for the GetInitialKeyUpdate method.

type GetInitialKeyUpdateResponse

type GetInitialKeyUpdateResponse struct {

	// KeyUpdate is the initial key update for the incident.
	KeyUpdate *KeyUpdate `json:"keyUpdate"`
}

GetInitialKeyUpdateResponse is the response for the GetInitialKeyUpdate method.

type GetKeyUpdateRequest

type GetKeyUpdateRequest struct {

	// IncidentID is the identifier of the incident.
	IncidentID string `json:"incidentID"`

	// ID is the identifier of the key update to retrieve.
	ID string `json:"id"`

	// ContentType specifies the desired format for the content field in the response.
	ContentType string `json:"contentType"`
}

GetKeyUpdateRequest is the request for the GetKeyUpdate method.

type GetKeyUpdateResponse

type GetKeyUpdateResponse struct {

	// KeyUpdate is the requested key update.
	KeyUpdate KeyUpdate `json:"keyUpdate"`
}

GetKeyUpdateResponse is the response for the GetKeyUpdate method.

type GetLabelsRequest

type GetLabelsRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`
}

GetLabelsRequest is the request for the GetLabels method.

type GetLabelsResponse

type GetLabelsResponse struct {

	// Labels is a list of labels
	Labels []IncidentKeyValueLabel `json:"labels"`
}

GetLabelsResponse is the response from the GetLabels method.

type GetLastKeyUpdateRequest

type GetLastKeyUpdateRequest struct {

	// IncidentID is the identifier of the incident.
	IncidentID string `json:"incidentID"`

	// ContentType specifies the desired format for the content field in the response.
	ContentType string `json:"contentType"`
}

GetLastKeyUpdateRequest is the request for the GetLastKeyUpdate method.

type GetLastKeyUpdateResponse

type GetLastKeyUpdateResponse struct {

	// KeyUpdate is the last key update for the incident.
	KeyUpdate *KeyUpdate `json:"keyUpdate"`

	// Number of other key updates for this incident.
	KeyUpdateCount int `json:"keyUpdateCount"`
}

GetLastKeyUpdateResponse is the response for the GetLastKeyUpdate method.

type GetRolesRequest

type GetRolesRequest struct {
}

GetRolesRequest is the request to get all roles.

type GetRolesResponse

type GetRolesResponse struct {

	// Roles is the list of roles.
	Roles []Role `json:"roles"`
}

GetRolesResponse is the response to get all roles.

type GetStatusByIDRequest

type GetStatusByIDRequest struct {

	// StatusID is the unique identifier of the status.
	StatusID string `json:"statusID"`
}

GetStatusByIDRequest is the request for GetStatusByID.

type GetStatusByIDResponse

type GetStatusByIDResponse struct {

	// Status is the requested status.
	Status Status `json:"status"`
}

GetStatusByIDResponse is the response from GetStatusByID.

type GetUserRequest

type GetUserRequest struct {

	// UserID is the user ID to find the user for. All ids are in the format
	// "provider:user-id" which allows you to refer to users from different providers.
	// "grafana-incident:<id>" is preferred, but all are accepted.
	UserID string `json:"userID"`
}

GetUserRequest is the request for GetUser.

type GetUserResponse

type GetUserResponse struct {

	// User is the user
	User User `json:"user"`
}

GetUserResponse contains the information about a user.

type Hook

type Hook struct {

	// HookID is the identifier for this Hook.
	HookID string `json:"hookID"`

	// Name is the name of this Hook.
	Name string `json:"name"`

	// Description is a brief overview of what the hook does.
	Description string `json:"description"`
}

Hook describes an updatable method that may be wired up to events.

type HookConfig

type HookConfig struct {

	// Fields is a list of hook specific key/value pairs.
	Fields []Field `json:"fields"`
}

HookConfig holds configuration fields for a Hook.

type HookMetadata

type HookMetadata struct {

	// Title is a title that relates to this Hook's run.
	Title string `json:"title"`

	// Explanation is a brief description about what action was taken.
	Explanation string `json:"explanation"`

	// URL is an optional URL to a place users can go for more information.
	URL string `json:"url"`
}

HookMetadata contains metadata about the Run and Update of a Hook.

type HookRun

type HookRun struct {

	// IntegrationID is the ID of the installed Integration that the Hook belongs to.
	IntegrationID string `json:"integrationID"`

	// HookID is the ID of the Hook that was run.
	HookID string `json:"hookID"`

	// EnabledHookID is the ID of the enabled hook instance.
	EnabledHookID string `json:"enabledHookID"`

	// LastRun is the time the hook was last run.
	LastRun string `json:"lastRun"`

	// LastUpdate is the time the hook was last updated.
	LastUpdate string `json:"lastUpdate"`

	// Metadata holds Hook specific key/value pairs.
	Metadata HookMetadata `json:"metadata"`

	// EventName is the name of the event that triggered the Hook to run.
	EventName string `json:"eventName"`

	// EventKind gives more detail about the type of event.
	EventKind string `json:"eventKind"`

	// UpdateStatus is the status of the Hook update.
	UpdateStatus string `json:"updateStatus"`

	// UpdateError is an error string to show the end-user for when UpdateStatus is
	// "failed".
	UpdateError string `json:"updateError"`

	// Status is the status of the Hook run.
	Status string `json:"status"`
}

HookRun describes the result of executing a Hook.

type Incident

type Incident struct {

	// IncidentID is the identifier.
	IncidentID string `json:"incidentID"`

	// Refs represent associated IDs in third-party systems.
	Refs []IncidentRef `json:"refs"`

	// Severity expresses how bad the Incident is.
	Severity string `json:"severity"`

	// Labels is a list of strings associated with this Incident.
	Labels []IncidentLabel `json:"labels"`

	// IsDrill indicates if the Incident is a drill or not. Incidents that are drills
	// do not show up in the dashboards, and may behave subtly differently in other
	// ways too. For example, during drills, more help might be offered to users.
	IsDrill bool `json:"isDrill"`

	// IncidentType indicates the kind of incident to create.
	IncidentType string `json:"incidentType"`

	// CreatedTime is when the Incident was created. The string value format should
	// follow RFC 3339.
	CreatedTime string `json:"createdTime"`

	// ModifiedTime is when the Incident was last modified. The string value format
	// should follow RFC 3339.
	ModifiedTime string `json:"modifiedTime"`

	// CreatedByUser is the UserPreview that created the Incident.
	CreatedByUser UserPreview `json:"createdByUser"`

	// ClosedTime is when the Incident was closed. The string value format should
	// follow RFC 3339.
	ClosedTime string `json:"closedTime"`

	// DurationSeconds is the number of seconds this Incident was (or is) open for.
	DurationSeconds int `json:"durationSeconds"`

	// Status is the current status of the Incident.
	Status string `json:"status"`

	// Title is the high level description of the Incident.
	Title string `json:"title"`

	// OverviewURL is the URL to the overview page for the Incident.
	OverviewURL string `json:"overviewURL"`

	// Assignments describes the individuals involved in the Incident.
	IncidentMembership IncidentMembership `json:"incidentMembership"`

	// TaskList is the list of tasks associated with the Incident.
	TaskList TaskList `json:"taskList"`

	// Summary is as short recap of the Incident.
	Summary string `json:"summary"`

	// IncidentStart is when the Incident began. The string value format should follow
	// RFC 3339.
	IncidentStart string `json:"incidentStart"`

	// IncidentEnd is when the Incident ended. The string value format should follow
	// RFC 3339.
	IncidentEnd string `json:"incidentEnd"`

	// IncidentChannels is a list of chat channels linked to the Incident.
	IncidentChannels []IncidentChannel `json:"incidentChannels"`
}

Incident is a single incident.

type IncidentChannel

type IncidentChannel struct {

	// Provider is the chat provider type.
	Provider string `json:"provider"`

	// ChannelID is the channel or conversation identifier in the provider.
	ChannelID string `json:"channelID"`

	// TeamID is the workspace or tenant identifier in the provider.
	TeamID string `json:"teamID"`
}

IncidentChannel represents a chat channel (e.g. Slack, MS Teams) linked to an incident.

type IncidentKeyValueLabel

type IncidentKeyValueLabel struct {

	// Key is the label key.
	Key string `json:"key"`

	// KeyUUID is the UUID of the label key.
	KeyUUID string `json:"keyUUID"`

	// ValueUUID is the UUID of the label value.
	ValueUUID string `json:"valueUUID"`

	// Value is the value of the label.
	Value string `json:"value"`

	// Description is a short explanation of the label.
	Description string `json:"description"`

	// Color is the CSS hex color of the label. Labels show up in both light and dark
	// modes, and this should be taken into consideration when selecting a color.
	ColorHex string `json:"colorHex"`
}

IncidentKeyValueLabel is a key:value label associated with an Incident.

type IncidentLabel

type IncidentLabel struct {

	// Key is the label key. If not provided, we'll default to 'tags'.
	Key string `json:"key"`

	// Label is the text of the label.
	Label string `json:"label"`

	// Description is a short explanation of the label.
	Description string `json:"description"`

	// Color is the CSS hex color of the label. Labels show up in both light and dark
	// modes, and this should be taken into consideration when selecting a color.
	ColorHex string `json:"colorHex"`
}

IncidentLabel is a label associated with an Incident.

type IncidentMembership

type IncidentMembership struct {

	// List of all assignments done for that incident
	Assignments []Assignment `json:"assignments"`

	// Total of assignments including hidden roles in the incident
	TotalAssignments int `json:"totalAssignments"`

	// Total of participants in the incident excluding the assigned roles
	TotalParticipants int `json:"totalParticipants"`
}

IncidentMembership represents a list of people involved in an Incident.

type IncidentMembershipPreview

type IncidentMembershipPreview struct {

	// ImportantAssignments is a list of all assignments done for that incident that
	// are marked as important.
	ImportantAssignments []AssignmentPreview `json:"importantAssignments"`

	// Total of assignments including hidden roles in the incident
	TotalAssignments int `json:"totalAssignments"`

	// Total of hidden roles (like observers) related with that incident
	TotalParticipants int `json:"totalParticipants"`
}

IncidentMembershipPreview is a summary of the people involved in an Incident.

type IncidentPreview

type IncidentPreview struct {

	// IncidentID is the identifier.
	IncidentID string `json:"incidentID"`

	// Severity expresses how bad the incident is.
	SeverityID string `json:"severityID"`

	// SeverityLabel is the label of the severity.
	SeverityLabel string `json:"severityLabel"`

	// IncidentType indicates the kind of incident to create.
	IncidentType string `json:"incidentType"`

	// Labels is a list of strings associated with this Incident.
	Labels []IncidentLabel `json:"labels"`

	// IsDrill indicates if the incident is a drill or not. Incidents that are drills
	// do not show up in the dashboards, and may behave subtly differently in other
	// ways too. For example, during drills, more help might be offered to users.
	IsDrill bool `json:"isDrill"`

	// CreatedTime is when the Incident was created. The string value format should
	// follow RFC 3339.
	CreatedTime string `json:"createdTime"`

	// ModifiedTime is when the Incident was last modified. The string value format
	// should follow RFC 3339.
	ModifiedTime string `json:"modifiedTime"`

	// ClosedTime is when the Incident was closed. The string value format should
	// follow RFC 3339.
	ClosedTime string `json:"closedTime"`

	// CreatedByUser is the UserPreview that created the Incident.
	CreatedByUser UserPreview `json:"createdByUser"`

	// Title is the high level description of the Incident.
	Title string `json:"title"`

	// Description is a brief description of the Incident.
	Description string `json:"description"`

	// Summary is as short recap of the incident.
	Summary string `json:"summary"`

	// Status is the current status of the Incident.
	Status string `json:"status"`

	// Slug is a URL friendly path segment for the Incident.
	Slug string `json:"slug"`

	// IncidentStart is when the Incident began. The string value format should follow
	// RFC 3339.
	IncidentStart string `json:"incidentStart"`

	// IncidentEnd is when the Incident ended. The string value format should follow
	// RFC 3339.
	IncidentEnd string `json:"incidentEnd"`

	// FieldValues is the list of fields associated with the Incident and their values.
	FieldValues []CustomMetadataFieldValue `json:"fieldValues"`

	// IncidentMembershipPreview is a summary of the people involved in the Incident.
	IncidentMembershipPreview IncidentMembershipPreview `json:"incidentMembershipPreview"`

	// IncidentChannels is a list of chat channels linked to the Incident.
	IncidentChannels []IncidentChannel `json:"incidentChannels"`

	// Version is the times that the incident has been updated
	Version int `json:"version"`
}

IncidentPreview is a minimal preview of a full Incident (omitting structured children) meant for lightweight listings or getting basic metadata.

type IncidentPreviewsQuery

type IncidentPreviewsQuery struct {

	// Limit is the number of Incidents to return.
	Limit int `json:"limit"`

	// OrderDirection is the direction to order the results.
	OrderDirection string `json:"orderDirection"`

	// OrderField is the field on which to order the results. If empty, `createdTime`
	// will be used.
	OrderField string `json:"orderField"`

	// QueryString is the query string to search for. If provided, the query will be
	// filtered by the query string and the other query parameters will be ignored.
	QueryString string `json:"queryString"`
}

IncidentPreviewsQuery describes the query to make.

type IncidentRef

type IncidentRef struct {

	// Key is a globally unique identifier for the third-party in reverse domain name
	// notation.
	Key string `json:"key"`

	// Ref is the reference string.
	Ref string `json:"ref"`

	// URL is the browser address of the incident in the third-party system. Can be
	// empty.
	URL string `json:"url"`
}

IncidentRef represents a reference to a third-party system.

type IncidentsQuery

type IncidentsQuery struct {

	// Limit is the number of Incidents to return.
	Limit int `json:"limit"`

	// IncludeStatuses is a list of statuses to include. Only Incidents with the listed
	// statuses will be returned.
	IncludeStatuses []string `json:"includeStatuses"`

	// ExcludeStatuses is a list of statuses to exclude. All Incidents that do not
	// match any of these values will be returned.
	ExcludeStatuses []string `json:"excludeStatuses"`

	// IncidentLabels is a list of labels to include. An empty list will not filter by
	// labels.
	IncidentLabels []string `json:"incidentLabels"`

	// DateFrom if is not empty would filter by the Incidents created since that date
	// (time.RFC3339)
	DateFrom string `json:"dateFrom"`

	// DateTo if is not empty would filter by incidents created before that date
	// (time.RFC3339)
	DateTo string `json:"dateTo"`

	// OnlyDrills if is not empty filters by whether an incident is a drill or not.
	OnlyDrills bool `json:"onlyDrills"`

	// OrderDirection is the direction to order the results.
	OrderDirection string `json:"orderDirection"`

	// Severity is a list of statuses to include. Only Incidents with the listed
	// statuses will be returned.
	Severity string `json:"severity"`

	// QueryString is the query string to search for. If provided, the query will be
	// filtered by the query string and the other query parameters will be ignored.
	QueryString string `json:"queryString"`
}

IncidentsQuery is the query for the QueryIncidentsRequest.

type IncidentsService

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

IncidentsService provides the ability to query, get, declare (create), update, and manage Incidents programmatically. You can also assign roles and update labels. Get one by calling NewIncidentsService.

func NewIncidentsService

func NewIncidentsService(client *Client) *IncidentsService

NewIncidentsService gets a new IncidentsService.

func (*IncidentsService) AddLabel

AddLabel adds a label to the Incident.

func (*IncidentsService) AssignLabel

AssignLabel assigns a key:value label to the incident

func (*IncidentsService) AssignLabelByUUID

AssignLabelByUUID assigns a keyUUID:valueUUID label to the incident

func (*IncidentsService) AssignRole

AssignRole assigns a role to a user.

func (*IncidentsService) CreateIncident

CreateIncident creates a new Incident.

Example

ExampleIncidentsService_CreateIncident shows how to create an incident. It uses the incident.NewTestClient so all responses are stubbed, you should use incident.NewClient, specifying the API endpoint and the service account token to send with the requests.

package main

import (
	"context"
	"fmt"
	"log"

	incident "github.com/grafana/incident-go"
)

func main() {
	ctx := context.Background()
	client := incident.NewTestClient()
	incidentsService := incident.NewIncidentsService(client)
	createIncidentResp, err := incidentsService.CreateIncident(ctx, incident.CreateIncidentRequest{
		Title:    "high latency in web requests",
		Severity: "minor",
	})
	if err != nil {
		log.Fatalf("%s", err)
	}
	fmt.Printf("new incident: %s\n", createIncidentResp.Incident.Title)
}
Output:
new incident: high latency in web requests

func (*IncidentsService) GetIncident

GetIncident gets an existing Incident by ID.

func (*IncidentsService) GetIncidentChannels

GetIncidentChannels returns the chat channels linked to an incident.

func (*IncidentsService) GetIncidentMembership

GetIncidentMembership will return the full list of people involved in an incident

func (*IncidentsService) GetLabels

GetLabels get the labels from the incident.

func (*IncidentsService) QueryIncidentPreviews

QueryIncidentPreviews gets a list of Incident Previews.

func (*IncidentsService) QueryIncidents

QueryIncidents gets a list of Incidents. Deprecated: use QueryIncidentPreviews instead.

func (*IncidentsService) RemoveLabel

RemoveLabel removes a label from the Incident.

func (*IncidentsService) UnassignLabel

UnassignLabel unassigns a key:value label from the incident

func (*IncidentsService) UnassignLabelByUUID

UnassignLabelByUUID unassigns a keyUUID:valueUUID label from the incident

func (*IncidentsService) UnassignRole

UnassignRole removes a role assignment from a user.

func (*IncidentsService) UpdateIncidentEventTime

UpdateIncidentEventTime updates the start or end times of an Incident.

func (*IncidentsService) UpdateIncidentIsDrill

UpdateIncidentIsDrill changes whether an Incident is a drill or not.

func (*IncidentsService) UpdateSeverity

UpdateSeverity updates the severity of an Incident.

func (*IncidentsService) UpdateStatus

UpdateStatus updates the status of an Incident.

func (*IncidentsService) UpdateTitle

UpdateTitle updates the title of an Incident.

type IncomingWebhookResponse

type IncomingWebhookResponse struct {

	// Incident is the newly declared incident. Only included if the incoming webhook
	// has the include=incident URL parameter.
	Incident *Incident `json:"incident"`

	// ProcessingErrors is a list of errors that occurred while processing the webhook.
	// If there are items in this list it does not mean the incident wasn't created.
	// But you should check to make sure everything was successfully processed before
	// shipping to production.
	ProcessingErrors []string `json:"processingErrors"`
}

IncomingWebhookResponse is the response sent back to the webhook caller when an incoming webhook has been received.

type IntegrationService

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

IntegrationService is used to install Integrations, and wire up hooks. Get one by calling NewIntegrationService.

func NewIntegrationService

func NewIntegrationService(client *Client) *IntegrationService

NewIntegrationService gets a new IntegrationService.

func (*IntegrationService) CreateIncidentSlackChannel

CreateIncidentSlackChannel creates a Slack channel for an Incident by invoking the createChannel hook without requiring an EnabledHook. The postUpdates and inviteUsers flags are stored on the resulting HookRun metadata. Only one Slack channel may exist per incident. If the incident already has a channel (created via this endpoint or via an enabled hook), the call returns an error. A previous failed attempt may be retried.

func (*IntegrationService) DisableHook

DisableHook disables a Hook.

func (*IntegrationService) EnableHook

EnableHook wires up a Hook to an event.

func (*IntegrationService) GetEnabledHooks

GetEnabledHooks gets a list of all enabled Hooks.

func (*IntegrationService) GetHookRuns

GetHookRuns gets a list of HookRuns for a given Incident.

type KeyUpdate

type KeyUpdate struct {

	// ID is the unique identifier for this key update.
	ID string `json:"id"`

	// OrgID is the identifier of the organization this key update belongs to.
	OrgID string `json:"orgID"`

	// IncidentID is the identifier of the incident this update belongs to.
	IncidentID string `json:"incidentID"`

	// Title is a short summary of the key update.
	Title *string `json:"title"`

	// Content provides detailed information about the key update.
	Content string `json:"content"`

	// ContentType specifies the format of the content.
	ContentType string `json:"contentType"`

	// CreatedTime is when this key update was created. The string value format should
	// follow RFC 3339.
	CreatedTime string `json:"createdTime"`

	// ModifiedTime is when this key update was last modified. The string value format
	// should follow RFC 3339.
	ModifiedTime string `json:"modifiedTime"`

	// Author is the user who created this key update.
	CreatedBy UserPreview `json:"createdBy"`

	// LastEditor is the user who last modified this key update.
	LastModifiedBy UserPreview `json:"lastModifiedBy"`

	// StatusID references the incident status at the time of this update.
	StatusID string `json:"statusID"`

	// SeverityID references the incident severity at the time of this update.
	SeverityID string `json:"severityID"`

	// Scope specifies the audience or visibility of this key update.
	Scope string `json:"scope"`

	// Color is the color of the key update.
	Color *string `json:"color"`
}

KeyUpdate represents a significant update or milestone in an incident's lifecycle.

type KeyUpdatesQuery

type KeyUpdatesQuery struct {

	// IncidentID is the identifier of the incident.
	IncidentID string `json:"incidentID"`

	// Limit is the maximum number of key updates to return.
	Limit int `json:"limit"`

	// OrderDirection is the direction to order the results.
	OrderDirection string `json:"orderDirection"`

	// OrderField is the field to order the results by. If empty, defaults to
	// 'createdTime'.
	OrderField string `json:"orderField"`

	// Scope filters key updates by their scope.
	Scope string `json:"scope"`

	// ContentType specifies the desired format for the content field in the response.
	ContentType string `json:"contentType"`
}

KeyUpdatesQuery describes the query parameters for listing key updates.

type KeyUpdatesService

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

KeyUpdatesService provides functionality to manage key updates for incidents. Key updates represent significant milestones or critical updates during an incident's lifecycle. Get one by calling NewKeyUpdatesService.

func NewKeyUpdatesService

func NewKeyUpdatesService(client *Client) *KeyUpdatesService

NewKeyUpdatesService gets a new KeyUpdatesService.

func (*KeyUpdatesService) CreateKeyUpdate

CreateKeyUpdate creates a new key update for an incident.

func (*KeyUpdatesService) DeleteKeyUpdate

DeleteKeyUpdate removes a key update.

func (*KeyUpdatesService) GetInitialKeyUpdate

GetInitialKeyUpdate gets the initial key update for an incident.

func (*KeyUpdatesService) GetKeyUpdate

GetKeyUpdate retrieves a specific key update.

func (*KeyUpdatesService) GetLastKeyUpdate

GetLastKeyUpdate gets the last key update for an incident.

func (*KeyUpdatesService) QueryKeyUpdates

QueryKeyUpdates gets a list of key updates with pagination support.

func (*KeyUpdatesService) UpdateKeyUpdate

UpdateKeyUpdate modifies an existing key update.

type OutgoingWebhookPayload

type OutgoingWebhookPayload struct {

	// Version of this structure, following semantic versioning.
	Version string `json:"version"`

	// ID of event.
	ID string `json:"id"`

	// Source is a URI that identifies the context in which an event happened.
	Source string `json:"source"`

	// Time that event was generated (RFC 3339).
	Time string `json:"time"`

	// Event describes the (namespaced) event
	Event string `json:"event"`

	// Incident is the data payload, contains details about the data that was changed.
	Incident *Incident `json:"incident"`
}

OutgoingWebhookPayload represents the webhook HTTP POST body and contains metadata for the webhook.

func ParseWebhook

func ParseWebhook(r *http.Request, signingSecret string) (*OutgoingWebhookPayload, error)

ParseWebhook parses an Outgoing Webhook from Grafana Incident. Use this function when writing code to handle the event. The signature will be verified using the known secret.

type QueryActivityRequest

type QueryActivityRequest struct {

	// Query describes the query to make.
	Query ActivityQuery `json:"query"`

	// Cursor is used to page through results. Empty for the first page. For subsequent
	// pages, use previously returned Cursor values.
	Cursor Cursor `json:"cursor"`
}

QueryActivityRequest is the request for the QueryActivity method.

type QueryActivityResponse

type QueryActivityResponse struct {

	// ActivityItems is the list of items.
	ActivityItems []ActivityItem `json:"activityItems"`

	// Query is the query that was used to generate the response.
	Query ActivityQuery `json:"query"`

	// Cursor is used to page through results. Empty for the first page. For subsequent
	// pages, use previously returned Cursor values.
	Cursor Cursor `json:"cursor"`
}

QueryActivityResponse is the response from the QueryActivity method.

type QueryIncidentPreviewsRequest

type QueryIncidentPreviewsRequest struct {

	// Query describes the query to make.
	Query IncidentPreviewsQuery `json:"query"`

	// Cursor is used to page through results. Empty for the first page. For subsequent
	// pages, use previously returned Cursor values.
	Cursor Cursor `json:"cursor"`

	// IncludeCustomFieldValues if true will include custom field values in the
	// response.
	IncludeCustomFieldValues bool `json:"includeCustomFieldValues"`

	// IncludeMembershipPreview if true will include membership previews in the
	// response.
	IncludeMembershipPreview bool `json:"includeMembershipPreview"`

	// IncludeIncidentChannels if true will include incident channels (e.g. Slack,
	// MS Teams) in the response.
	IncludeIncidentChannels bool `json:"includeIncidentChannels"`
}

QueryIncidentPreviews is the request for the QueryIncidentPreviews method.

type QueryIncidentPreviewsResponse

type QueryIncidentPreviewsResponse struct {

	// IncidentPreviews is a list of Incident Previews.
	IncidentPreviews []IncidentPreview `json:"incidentPreviews"`

	// Query is the query that was used to generate this response.
	Query IncidentPreviewsQuery `json:"query"`

	// Cursor should be passed back to get the next page of results.
	Cursor Cursor `json:"cursor"`
}

QueryIncidentPreviewsResponse is the response for the QueryIncidentPreviews method.

type QueryIncidentsRequest

type QueryIncidentsRequest struct {

	// Query describes the query to make.
	Query IncidentsQuery `json:"query"`

	// Cursor is used to page through results. Empty for the first page. For subsequent
	// pages, use previously returned Cursor values.
	Cursor Cursor `json:"cursor"`
}

QueryIncidentsRequest is the request for the QueryIncidents method.

type QueryIncidentsResponse

type QueryIncidentsResponse struct {

	// Incidents is a list of Incidents.
	Incidents []Incident `json:"incidents"`

	// Query is the query that was used to generate this response.
	Query IncidentsQuery `json:"query"`

	// Cursor should be passed back to get the next page of results.
	Cursor Cursor `json:"cursor"`
}

QueryIncidentsResponse is the response for the QueryIncidents method.

type QueryKeyUpdatesRequest

type QueryKeyUpdatesRequest struct {

	// Query describes the query parameters.
	Query KeyUpdatesQuery `json:"query"`

	// Cursor is used for pagination. Empty for the first page. For subsequent pages,
	// use previously returned Cursor values.
	Cursor Cursor `json:"cursor"`
}

QueryKeyUpdatesRequest is the request for the QueryKeyUpdates method.

type QueryKeyUpdatesResponse

type QueryKeyUpdatesResponse struct {

	// KeyUpdates is the list of key updates matching the query.
	KeyUpdates []KeyUpdate `json:"keyUpdates"`

	// Query is the query that was used to generate this response.
	Query KeyUpdatesQuery `json:"query"`

	// Cursor should be passed back to get the next page of results.
	Cursor Cursor `json:"cursor"`
}

QueryKeyUpdatesResponse is the response for the QueryKeyUpdates method.

type QueryOrgStatusesRequest

type QueryOrgStatusesRequest struct {

	// IncidentType is the type of incident to query statuses for. If empty, returns
	// all statuses for all incident types.
	IncidentType string `json:"incidentType"`
}

QueryOrgStatusesRequest is the request for QueryOrgStatuses.

type QueryOrgStatusesResponse

type QueryOrgStatusesResponse struct {

	// Configurations is the list of status configurations.
	Configurations []StatusConfiguration `json:"configurations"`
}

QueryOrgStatusesResponse is the response from QueryOrgStatuses.

type QueryUsersRequest

type QueryUsersRequest struct {

	// Query describes the query to make
	Query UsersQuery `json:"query"`

	// Cursor is used to page through results. Empty for the first page. For subsequent
	// pages, use previously returned Cursor values.
	Cursor Cursor `json:"cursor"`
}

QueryUsersRequest is the request for getting a list of users.

type QueryUsersResponse

type QueryUsersResponse struct {

	// Users is a list of Users.
	Users []User `json:"users"`

	// Query is the query that was used to generate this response.
	Query UsersQuery `json:"query"`

	// Cursor should be passed back to get the next page of results.
	Cursor Cursor `json:"cursor"`
}

QueryUsersResponse is the response from QueryUsers.

type RecordFieldValueRequest

type RecordFieldValueRequest struct {

	// FieldUUID is the UUID of the field.
	FieldUUID string `json:"fieldUUID"`

	// Value is the json encoded value of the field to record. If empty, the field
	// value will be set unset.
	Value string `json:"value"`

	// TargetKind is the kind of the target to record the field value for.
	TargetKind string `json:"targetKind"`

	// TargetID is the ID of the target to record the field value for.
	TargetID string `json:"targetID"`
}

RecordFieldValueRequest is the request struct for api RecordFieldValue method.

type RecordFieldValueResponse

type RecordFieldValueResponse struct {
}

RecordFieldValueResponse is the response from the RecordFieldValue method.

type RemoveActivityRequest

type RemoveActivityRequest struct {

	// IncidentID is the identifier.
	IncidentID string `json:"incidentID"`

	// ActivityItemID is the unique identifier of the ActivityItem.
	ActivityItemID string `json:"activityItemID"`
}

RemoveActivityRequest is the request for the RemoveActivity method.

type RemoveActivityResponse

type RemoveActivityResponse struct {

	// ActivityItem is the updated ActivityItem.
	ActivityItem ActivityItem `json:"activityItem"`
}

RemoveActivityResponse is the response from the RemoveActivity method.

type RemoveLabelRequest

type RemoveLabelRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// Label is the label to remove from the Incident.
	Label string `json:"label"`
}

RemoveLabelRequest is the request for the RemoveLabel method.

type RemoveLabelResponse

type RemoveLabelResponse struct {

	// Incident is the Incident that was just modified.
	Incident Incident `json:"incident"`
}

RemoveLabelResponse is the response for the RemoveLabel method.

type Role

type Role struct {

	// RoleID is the unique ID of this role.
	RoleID int `json:"roleID"`

	// OrgID is the unique ID of the organization this role belongs to.
	OrgID string `json:"orgID"`

	// Name is the name of the role.
	Name string `json:"name"`

	// Description is the description of the role.
	Description string `json:"description"`

	// Important is whether this role is important.
	Important bool `json:"important"`

	// Mandatory is whether this role is mandatory.
	Mandatory bool `json:"mandatory"`

	// Archived is whether this role is archived. Archived roles are not allowed to be
	// assigned to people in the new incidents. But the historical data is still kept.
	Archived bool `json:"archived"`

	// CreatedAt is the time this role was created at.
	CreatedAt string `json:"createdAt"`

	// UpdatedAt is the time this role was updated at.
	UpdatedAt string `json:"updatedAt"`
}

Role represents a role that will be used to assign people in the incident.

type RolesService

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

RolesService defines the interface for interacting with roles, providing CRUD operations and more features related to roles. Get one by calling NewRolesService.

func NewRolesService

func NewRolesService(client *Client) *RolesService

NewRolesService gets a new RolesService.

func (*RolesService) ArchiveRole

ArchiveRole archives a role.

func (*RolesService) CreateRole

CreateRole creates a role.

func (*RolesService) DeleteRole

DeleteRole deletes a role.

func (*RolesService) GetRoles

GetRoles gets all roles.

func (*RolesService) UnarchiveRole

UnarchiveRole unarchives a role.

func (*RolesService) UpdateRole

UpdateRole updates a role.

type Status

type Status struct {

	// StatusID is the unique identifier of the status.
	StatusID string `json:"statusID"`

	// IncidentType indicates the kind of incident this status applies to.
	IncidentType string `json:"incidentType"`

	// Name is the display name of the status.
	Name string `json:"name"`

	// Description provides additional context about the status.
	Description string `json:"description"`

	// Category indicates whether status is active or resolved.
	Category string `json:"category"`

	// Kind is deprecated, use Category instead.
	Kind string `json:"kind"`

	// Color is the hex color for the status.
	Color string `json:"color"`

	// Icon is the icon name for the status.
	Icon string `json:"icon"`

	// Slug is the URL-friendly version of the name.
	Slug string `json:"slug"`

	// Position is the order in the status list.
	Position int `json:"position"`

	// ArchivedTime is the time the status was archived, or empty if not archived.
	ArchivedTime string `json:"archivedTime"`

	// Immutable indicates whether this status can be modified.
	Immutable bool `json:"immutable"`

	// CreatedTime is when the status was created.
	CreatedTime string `json:"createdTime"`

	// ModifiedTime is when the status was last modified.
	ModifiedTime string `json:"modifiedTime"`
}

Status represents an incident status definition.

type StatusConfiguration

type StatusConfiguration struct {

	// Statuses is the list of statuses for this configuration.
	Statuses []Status `json:"statuses"`

	// IncidentType determines the type of incident the configuration is valid for.
	IncidentType string `json:"incidentType"`

	// Default indicates whether this configuration is the default for the given
	// incident type.
	Default bool `json:"default"`
}

StatusConfiguration groups statuses by incident type.

type StatusService

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

StatusService provides methods for managing incident status configurations. Get one by calling NewStatusService.

func NewStatusService

func NewStatusService(client *Client) *StatusService

NewStatusService gets a new StatusService.

func (*StatusService) CreateOrgStatus

CreateOrgStatus creates a new custom status.

func (*StatusService) GetStatusByID

GetStatusByID gets a specific status by ID.

func (*StatusService) QueryOrgStatuses

QueryOrgStatuses returns a set of statuses for a given incident type.

func (*StatusService) UpdateOrgStatus

UpdateOrgStatus updates an existing status.

type Task

type Task struct {

	// TaskID is the ID of the task.
	TaskID string `json:"taskID"`

	// Immutable is true if the task cannot be changed. Used for tasks created and
	// maintained by the system (like role assignment tasks).
	Immutable bool `json:"immutable"`

	// CreatedTime is the time the task was created.
	CreatedTime string `json:"createdTime"`

	// ModifiedTime is the time
	ModifiedTime string `json:"modifiedTime"`

	// Text is the string that describes the Task.
	Text string `json:"text"`

	// Status os the status of this task.
	Status string `json:"status"`

	// AuthorUser is the person who created this task.
	AuthorUser *UserPreview `json:"authorUser"`

	// AssignedUser is the person this task is assigned to.
	AssignedUser *UserPreview `json:"assignedUser"`
}

Task is an individual task that somebody will do to resolve an Incident.

type TaskList

type TaskList struct {

	// Tasks is a list of tasks.
	Tasks []Task `json:"tasks"`

	// TodoCount is the number of items in the list that are not yet done.
	TodoCount int `json:"todoCount"`

	// DoneCount is the number of items in the list that are done.
	DoneCount int `json:"doneCount"`
}

TaskList is a list of tasks.

type TasksService

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

TasksService provides methods for managing tasks relating to Incidents. Get one by calling NewTasksService.

func NewTasksService

func NewTasksService(client *Client) *TasksService

NewTasksService gets a new TasksService.

func (*TasksService) AddTask

AddTask adds a task to an Incident.

func (*TasksService) DeleteTask

DeleteTask deletes a task.

func (*TasksService) UpdateTaskStatus

UpdateTaskStatus updates the task's Status.

func (*TasksService) UpdateTaskText

UpdateTaskText updates the task's text.

func (*TasksService) UpdateTaskUser

UpdateTaskUser updates the task's assigned user. Passing an empty user ID will clear the assigned user.

type UnarchiveFieldRequest

type UnarchiveFieldRequest struct {

	// FieldUUID is the UUID of the field.
	FieldUUID string `json:"fieldUUID"`
}

UnarchiveFieldRequest is the request struct for api UnarchiveField method.

type UnarchiveFieldResponse

type UnarchiveFieldResponse struct {
}

UnarchiveFieldResponse is the response from the UnarchiveField method.

type UnarchiveRoleRequest

type UnarchiveRoleRequest struct {

	// Role to be unarchived to the organization
	RoleID int `json:"roleID"`
}

UnarchiveRoleRequest is the request to unarchive a role.

type UnarchiveRoleResponse

type UnarchiveRoleResponse struct {
}

UnarchiveRoleResponse is the response to unarchive a role.

type UnassignLabelByUUIDRequest

type UnassignLabelByUUIDRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// KeyUUID is the label key uuid.
	KeyUUID string `json:"keyUUID"`

	// ValueUUID is the UUID of the label value.
	ValueUUID string `json:"valueUUID"`
}

UnassignLabelByUUIDRequest is the request for the UnassignLabelByUUID method.

type UnassignLabelByUUIDResponse

type UnassignLabelByUUIDResponse struct {

	// Labels is a list of labels
	Labels []IncidentKeyValueLabel `json:"labels"`
}

UnassignLabelByUUIDResponse is the response from the UnassignLabelByUUID method.

type UnassignLabelRequest

type UnassignLabelRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// Key is the label key.
	Key string `json:"key"`

	// Value is the value of the label.
	Value string `json:"value"`
}

UnassignLabelRequest is the request for the UnassignLabel method.

type UnassignLabelResponse

type UnassignLabelResponse struct {

	// Labels is a list of labels
	Labels []IncidentKeyValueLabel `json:"labels"`
}

UnassignLabelResponse is the response from the UnassignLabel method.

type UnassignRoleRequest

type UnassignRoleRequest struct {

	// IncidentID is the identifier.
	IncidentID string `json:"incidentID"`

	// UserID is the identifier of the person to assign the role to.
	UserID string `json:"userID"`

	// Role is the role of this person.
	Role string `json:"role"`
}

UnassignRoleRequest is the request for the UnassignRole method.

type UnassignRoleResponse

type UnassignRoleResponse struct {

	// Incident is the Incident that was just updated.
	Incident Incident `json:"incident"`

	// DidChange indicates if the role was changed or not. If the role was not
	// assigned, this will be false.
	DidChange bool `json:"didChange"`
}

UnassignRoleResponse is the response for the UnassignRole method.

type UpdateActivityBodyRequest

type UpdateActivityBodyRequest struct {

	// IncidentID is the identifier.
	IncidentID string `json:"incidentID"`

	// ActivityItemID is the unique identifier of the ActivityItem.
	ActivityItemID string `json:"activityItemID"`

	// Body is the new body to use for the given activity item
	Body string `json:"body"`
}

UpdateActivityBodyRequest is the request for the UpdateActivityBody method.

type UpdateActivityBodyResponse

type UpdateActivityBodyResponse struct {

	// ActivityItem is the updated ActivityItem.
	ActivityItem ActivityItem `json:"activityItem"`
}

UpdateActivityBodyResponse is the response from the UpdateActivityBody method.

type UpdateActivityEventTimeRequest

type UpdateActivityEventTimeRequest struct {

	// IncidentID is the identifier.
	IncidentID string `json:"incidentID"`

	// ActivityItemID is the unique identifier of the ActivityItem.
	ActivityItemID string `json:"activityItemID"`

	// EventTime is the time when the event occurred. If empty, the created time of the
	// activity item is used. The string value format should follow RFC 3339.
	EventTime string `json:"eventTime"`
}

UpdateActivityEventTimeRequest is the request for the UpdateActivityEventTime method.

type UpdateActivityEventTimeResponse

type UpdateActivityEventTimeResponse struct {

	// ActivityItem is the updated ActivityItem.
	ActivityItem ActivityItem `json:"activityItem"`
}

UpdateActivityEventTimeResponse is the response from the UpdateActivityEventTime method.

type UpdateActivityRelevanceRequest

type UpdateActivityRelevanceRequest struct {

	// IncidentID is the identifier.
	IncidentID string `json:"incidentID"`

	// ActivityItemID is the unique identifier of the ActivityItem.
	ActivityItemID string `json:"activityItemID"`

	// Relevance is the preferred relevance of the activity item. if set to 'automatic'
	// (the default), the relevance will be guessed automatically.
	Relevance string `json:"relevance"`
}

UpdateActivityRelevanceRequest is the request for the UpdateActivityRelevance method.

type UpdateActivityRelevanceResponse

type UpdateActivityRelevanceResponse struct {

	// ActivityItem is the updated ActivityItem.
	ActivityItem ActivityItem `json:"activityItem"`
}

UpdateActivityRelevanceResponse is the response from the UpdateActivityRelevance method.

type UpdateFieldRequest

type UpdateFieldRequest struct {

	// FieldUUID is the UUID of the field.
	FieldUUID string `json:"fieldUUID"`

	// Name is the name of the field.
	Name string `json:"name"`

	// Slug is the slug of the field. Used for searching and referencing the field as a
	// metric.
	Slug string `json:"slug"`

	// Color is the field color.
	Color string `json:"color"`

	// Icon is the field icon.
	Icon string `json:"icon"`

	// Description is the description of the field.
	Description string `json:"description"`

	// Required is whether this field is required.
	Required bool `json:"required"`

	// DomainName is single-select for which a field is valid/used.
	DomainName string `json:"domainName"`

	// Immutable indicates if the field can by modified by the user.
	Immutable bool `json:"immutable"`

	// Selectoptions is the list of select options for the field. Only used for select
	// fields.
	Selectoptions []CustomMetadataFieldSelectOption `json:"selectoptions"`

	// Version is the field version.
	Version int `json:"version"`
}

UpdateFieldRequest is the request struct for api UpdateField method.

type UpdateFieldResponse

type UpdateFieldResponse struct {

	// Field is the field that was updated.
	Field CustomMetadataField `json:"field"`
}

UpdateFieldResponse is the response from the UpdateField method.

type UpdateFieldSelectOptionRequest

type UpdateFieldSelectOptionRequest struct {

	// FieldUUID is the UUID of the field.
	FieldUUID string `json:"fieldUUID"`

	// SelectOptionUUID is the UUID of the field select option to delete.
	SelectOptionUUID string `json:"selectOptionUUID"`

	// Value is the value of the select option.
	Value string `json:"value"`

	// Label is the label of the select option.
	Label string `json:"label"`

	// Color is the color of the select option.
	Color string `json:"color"`

	// Icon is the icon of the select option.
	Icon string `json:"icon"`

	// Description is the textual description of the option.
	Description string `json:"description"`
}

UpdateFieldSelectOptionRequest is the request struct for UpdateFieldSelectOption method.

type UpdateFieldSelectOptionResponse

type UpdateFieldSelectOptionResponse struct {
}

UpdateFieldSelectOptionResponse is the response from the UpdateFieldSelectOption method.

type UpdateIncidentEventTimeRequest

type UpdateIncidentEventTimeRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// EventTime is the new time for the start or end of the incident. The string value
	// format should follow RFC 3339.
	EventTime string `json:"eventTime"`

	// ActivityItemKind is either the incidentEnd or incidentStart time. deprecated.
	// use EventName instead, ActivityItemKind will be removed soon.
	ActivityItemKind string `json:"activityItemKind"`

	// EventName is either the incidentEnd or incidentStart time.
	EventName string `json:"eventName"`
}

UpdateIncidentEventTimeRequest is the request for the UpdateIncidentEventTime method.

type UpdateIncidentEventTimeResponse

type UpdateIncidentEventTimeResponse struct {
}

UpdateIncidentEventTimeResponse is the response for the UpdateIncidentEventTime method.

type UpdateIncidentIsDrillRequest

type UpdateIncidentIsDrillRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// IsDrill indicates whether the Incident is a drill or not.
	IsDrill bool `json:"isDrill"`
}

UpdateIncidentIsDrillRequest is the request for the UpdateIncidentIsDrill method.

type UpdateIncidentIsDrillResponse

type UpdateIncidentIsDrillResponse struct {

	// Incident is the Incident that was just modified.
	Incident Incident `json:"incident"`
}

UpdateIncidentIsDrillResponse is the response for the UpdateIncidentIsDrill method.

type UpdateKeyUpdateRequest

type UpdateKeyUpdateRequest struct {

	// IncidentID is the identifier of the incident.
	IncidentID string `json:"incidentID"`

	// ID is the identifier of the key update to modify.
	ID string `json:"id"`

	// Title is the new title for the key update.
	Title *string `json:"title"`

	// Content is the new content for the key update.
	Content string `json:"content"`

	// ContentType specifies the format of the content.
	ContentType string `json:"contentType"`

	// StatusID references the incident status at the time of this update.
	StatusID string `json:"statusID"`

	// SeverityID references the incident severity at the time of this update.
	SeverityID string `json:"severityID"`

	// Scope specifies the audience or visibility of this key update.
	Scope string `json:"scope"`

	// Color is the color of the key update.
	Color *string `json:"color"`
}

UpdateKeyUpdateRequest is the request for the UpdateKeyUpdate method.

type UpdateKeyUpdateResponse

type UpdateKeyUpdateResponse struct {

	// KeyUpdate is the modified key update.
	KeyUpdate KeyUpdate `json:"keyUpdate"`
}

UpdateKeyUpdateResponse is the response for the UpdateKeyUpdate method.

type UpdateOrgStatusRequest

type UpdateOrgStatusRequest struct {

	// StatusID is the unique identifier of the status to update.
	StatusID string `json:"statusID"`

	// IncidentType is the type of incident this status applies to.
	IncidentType string `json:"incidentType"`

	// Name is the display name of the status.
	Name string `json:"name"`

	// Description provides additional context about the status.
	Description string `json:"description"`

	// Category indicates whether status is active or resolved.
	Category string `json:"category"`

	// Color is the hex color for the status.
	Color string `json:"color"`

	// Icon is the icon name for the status.
	Icon string `json:"icon"`
}

UpdateOrgStatusRequest is the request for UpdateOrgStatus.

type UpdateOrgStatusResponse

type UpdateOrgStatusResponse struct {

	// Status is the updated status.
	Status Status `json:"status"`
}

UpdateOrgStatusResponse is the response from UpdateOrgStatus.

type UpdateRoleRequest

type UpdateRoleRequest struct {

	// Role to be updated to the organization
	Role Role `json:"role"`
}

UpdateRoleRequest is the request to update a role.

type UpdateRoleResponse

type UpdateRoleResponse struct {

	// Role is the newly updated role.
	Role Role `json:"role"`
}

UpdateRoleResponse is the response to update a role.

type UpdateSeverityRequest

type UpdateSeverityRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// Severity expresses how bad the Incident is.
	Severity string `json:"severity"`
}

UpdateSeverityRequest is the request for the UpdateSeverity method.

type UpdateSeverityResponse

type UpdateSeverityResponse struct {

	// Incident is the Incident that was just modified.
	Incident Incident `json:"incident"`
}

UpdateSeverityResponse is the response for the UpdateSeverity method.

type UpdateStatusRequest

type UpdateStatusRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// Status is the new status of the Incident.
	Status string `json:"status"`
}

UpdateStatusRequest is the request for the UpdateStatus method.

type UpdateStatusResponse

type UpdateStatusResponse struct {

	// Incident is the Incident that was just modified.
	Incident Incident `json:"incident"`
}

UpdateStatusResponse is the response for the UpdateStatus method.

type UpdateTaskStatusRequest

type UpdateTaskStatusRequest struct {

	// IncidentID is the ID of the Incident to add the Task to.
	IncidentID string `json:"incidentID"`

	// TaskID is the ID of the Task to update.
	TaskID string `json:"taskID"`

	// Status is the new status of this task.
	Status string `json:"status"`
}

UpdateTaskStatusRequest is the request for the UpdateTaskStatus method.

type UpdateTaskStatusResponse

type UpdateTaskStatusResponse struct {

	// IncidentID is the ID of the incident these tasks relate to.
	IncidentID string `json:"incidentID"`

	// Task is the newly added Task. It will also appear in Tasks.
	Task Task `json:"task"`

	// TaskList is the tasks list.
	TaskList TaskList `json:"taskList"`
}

UpdateTaskStatusResponse is the response from the UpdateTaskStatus method.

type UpdateTaskTextRequest

type UpdateTaskTextRequest struct {

	// IncidentID is the ID of the Incident to add the Task to.
	IncidentID string `json:"incidentID"`

	// TaskID is the ID of the task.
	TaskID string `json:"taskID"`

	// Text is the string that describes the Task.
	Text string `json:"text"`
}

UpdateTaskTextRequest is the request for the UpdateTaskText method.

type UpdateTaskTextResponse

type UpdateTaskTextResponse struct {

	// IncidentID is the ID of the incident these tasks relate to.
	IncidentID string `json:"incidentID"`

	// Task is the newly added Task. It will also appear in Tasks.
	Task Task `json:"task"`

	// TaskList is the tasks list.
	TaskList TaskList `json:"taskList"`
}

UpdateTaskTextResponse is the response from the UpdateTaskText method.

type UpdateTaskUserRequest

type UpdateTaskUserRequest struct {

	// IncidentID is the ID of the Incident to add the Task to.
	IncidentID string `json:"incidentID"`

	// TaskID is the ID of the Task to update.
	TaskID string `json:"taskID"`

	// UserID is the ID of the User to assign to the Task.
	UserID string `json:"userID"`
}

UpdateTaskUserRequest is the request for the UpdateTaskUser method.

type UpdateTaskUserResponse

type UpdateTaskUserResponse struct {

	// IncidentID is the ID of the incident these tasks relate to.
	IncidentID string `json:"incidentID"`

	// Task is the newly added Task. It will also appear in Tasks.
	Task Task `json:"task"`

	// TaskList is the tasks list.
	TaskList TaskList `json:"taskList"`
}

UpdateTaskUserResponse is the response from the UpdateTaskUser method.

type UpdateTitleRequest

type UpdateTitleRequest struct {

	// IncidentID is the identifier of the Incident.
	IncidentID string `json:"incidentID"`

	// Title is the new title of the Incident.
	Title string `json:"title"`
}

UpdateTitleRequest is the request for the UpdateTitle method.

type UpdateTitleResponse

type UpdateTitleResponse struct {

	// Incident is the Incident that was just modified.
	Incident Incident `json:"incident"`
}

UpdateTitleResponse is the response for the UpdateTitle method.

type User

type User struct {

	// UserID is the identifier. It is in the format "provider:user-id" which
	// allows you to refer to users from different providers. Sometimes, the same
	// user is represented by multiple identifiers. You may always use this field
	// whenever you need to refer to a user, the server will resolve them for you.
	// "grafana-incident:{id}" is preferred.
	UserID string `json:"userID"`

	// InternalUserID is the internal user ID as stored in the database.
	InternalUserID string `json:"internalUserID"`

	// Email is the user's email address.
	Email string `json:"email"`

	// ModifiedTime is when this user was last modified. The string value format should
	// follow RFC 3339.
	ModifiedTime string `json:"modifiedTime"`

	// Name is the user full name.
	Name string `json:"name"`

	// PhotoURL is the user's photo URL.
	PhotoURL string `json:"photoURL"`

	// GrafanaUserID is the Grafana user ID.
	GrafanaUserID string `json:"grafanaUserID"`

	// GrafanaLogin is the Grafana login.
	GrafanaLogin string `json:"grafanaLogin"`

	// SlackUserID is the Slack user ID.
	SlackUserID string `json:"slackUserID"`

	// SlackTeamID is the Slack organization ID.
	SlackTeamID string `json:"slackTeamID"`

	// MsTeamsUserID is the MS Teams organization ID.
	MsTeamsUserID string `json:"msTeamsUserID"`
}

User contains the details of a person.

type UserPreview

type UserPreview struct {

	// UserID is the identifier for the user.
	UserID string `json:"userID"`

	// Name is a human readable string that represents the user.
	Name string `json:"name"`

	// PhotoURL is the URL to the profile picture of the user.
	PhotoURL string `json:"photoURL"`
}

UserPreview is a user involved in an Incident.

type UsersQuery

type UsersQuery struct {

	// Limit is the max number of users to return.
	Limit int `json:"limit"`
}

UsersQuery is the request for getting a list of users.

type UsersService

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

UsersService provides services related to people in the system. Get one by calling NewUsersService.

func NewUsersService

func NewUsersService(client *Client) *UsersService

NewUsersService gets a new UsersService.

func (*UsersService) GetUser

GetUser returns the information about a specific user.

func (*UsersService) QueryUsers

QueryUsers gets a list of users.

Directories

Path Synopsis
examples
consume-webhook command

Jump to

Keyboard shortcuts

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