instance

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	APIKey             string `json:"apiKey"`
	APIUrl             string `json:"apiUrl"`
	PermissionsEnabled bool   `json:"permissionsEnabled"`
}

Config is the structure of the configuration for a single Opsgenie instance. The user can set some general information like the name and descriptions of the Opsgenie instance. The user must also set the api key and api url to authenticate against the Opsgenie api. The url field can be used to set the public url of the Opsgenie instance, so that users can go from the kobs ui to the Opsgenie ui.

type Instance

type Instance interface {
	GetName() string
	GetAlerts(ctx context.Context, query string) ([]alert.Alert, error)
	GetAlertDetails(ctx context.Context, id string) (*alert.GetAlertResult, error)
	GetAlertLogs(ctx context.Context, id string) ([]alert.AlertLog, error)
	GetAlertNotes(ctx context.Context, id string) ([]alert.AlertNote, error)
	GetIncidents(ctx context.Context, query string) ([]incident.Incident, error)
	GetIncidentLogs(ctx context.Context, id string) ([]incident.LogResult, error)
	GetIncidentNotes(ctx context.Context, id string) ([]incident.NoteResult, error)
	GetIncidentTimeline(ctx context.Context, id string) ([]extendedIncident.Entry, error)
	AcknowledgeAlert(ctx context.Context, id, user string) error
	SnoozeAlert(ctx context.Context, id, user string, duration time.Duration) error
	CloseAlert(ctx context.Context, id, user string) error
	ResolveIncident(ctx context.Context, id, user string) error
	CloseIncident(ctx context.Context, id, user string) error
	CheckPermissions(pluginName string, user *authContext.User, action string) error
}

Instance is the interface, which must be implemented by an Opsgenie instance. It contains all the functions to interact with the Opsgenie API.

func New

func New(name string, options map[string]any) (Instance, error)

New returns a new Elasticsearch instance for the given configuration.

type MockInstance

type MockInstance struct {
	mock.Mock
}

MockInstance is an autogenerated mock type for the Instance type

func NewMockInstance

func NewMockInstance(t NewMockInstanceT) *MockInstance

NewMockInstance creates a new instance of MockInstance. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInstance) AcknowledgeAlert

func (_m *MockInstance) AcknowledgeAlert(ctx context.Context, id string, user string) error

AcknowledgeAlert provides a mock function with given fields: ctx, id, user

func (*MockInstance) CheckPermissions

func (_m *MockInstance) CheckPermissions(pluginName string, user *userauthcontext.User, action string) error

CheckPermissions provides a mock function with given fields: pluginName, user, action

func (*MockInstance) CloseAlert

func (_m *MockInstance) CloseAlert(ctx context.Context, id string, user string) error

CloseAlert provides a mock function with given fields: ctx, id, user

func (*MockInstance) CloseIncident

func (_m *MockInstance) CloseIncident(ctx context.Context, id string, user string) error

CloseIncident provides a mock function with given fields: ctx, id, user

func (*MockInstance) GetAlertDetails

func (_m *MockInstance) GetAlertDetails(ctx context.Context, id string) (*alert.GetAlertResult, error)

GetAlertDetails provides a mock function with given fields: ctx, id

func (*MockInstance) GetAlertLogs

func (_m *MockInstance) GetAlertLogs(ctx context.Context, id string) ([]alert.AlertLog, error)

GetAlertLogs provides a mock function with given fields: ctx, id

func (*MockInstance) GetAlertNotes

func (_m *MockInstance) GetAlertNotes(ctx context.Context, id string) ([]alert.AlertNote, error)

GetAlertNotes provides a mock function with given fields: ctx, id

func (*MockInstance) GetAlerts

func (_m *MockInstance) GetAlerts(ctx context.Context, query string) ([]alert.Alert, error)

GetAlerts provides a mock function with given fields: ctx, query

func (*MockInstance) GetIncidentLogs

func (_m *MockInstance) GetIncidentLogs(ctx context.Context, id string) ([]incident.LogResult, error)

GetIncidentLogs provides a mock function with given fields: ctx, id

func (*MockInstance) GetIncidentNotes

func (_m *MockInstance) GetIncidentNotes(ctx context.Context, id string) ([]incident.NoteResult, error)

GetIncidentNotes provides a mock function with given fields: ctx, id

func (*MockInstance) GetIncidentTimeline

func (_m *MockInstance) GetIncidentTimeline(ctx context.Context, id string) ([]instanceincident.Entry, error)

GetIncidentTimeline provides a mock function with given fields: ctx, id

func (*MockInstance) GetIncidents

func (_m *MockInstance) GetIncidents(ctx context.Context, query string) ([]incident.Incident, error)

GetIncidents provides a mock function with given fields: ctx, query

func (*MockInstance) GetName

func (_m *MockInstance) GetName() string

GetName provides a mock function with given fields:

func (*MockInstance) ResolveIncident

func (_m *MockInstance) ResolveIncident(ctx context.Context, id string, user string) error

ResolveIncident provides a mock function with given fields: ctx, id, user

func (*MockInstance) SnoozeAlert

func (_m *MockInstance) SnoozeAlert(ctx context.Context, id string, user string, duration time.Duration) error

SnoozeAlert provides a mock function with given fields: ctx, id, user, duration

type NewMockInstanceT

type NewMockInstanceT interface {
	mock.TestingT
	Cleanup(func())
}

type Permissions

type Permissions []string

Permissions is the structure of the custom permissions field for the Opsgenie instance. The permissions are defined via an array of strings, where the following values are allowed:

  • acknowledgeAlert
  • snoozeAlert
  • closeAlert
  • resolveIncident
  • closeIncident

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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