instance

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 10 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 {
	Name               string `json:"name"`
	DisplayName        string `json:"displayName"`
	Description        string `json:"description"`
	Home               bool   `json:"home"`
	APIKey             string `json:"apiKey"`
	APIUrl             string `json:"apiUrl"`
	URL                string `json:"url"`
	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(config Config) (Instance, error)

New returns a new Elasticsearch instance for the given configuration.

type MockInstance added in v0.8.0

type MockInstance struct {
	mock.Mock
}

MockInstance is an autogenerated mock type for the Instance type

func (*MockInstance) AcknowledgeAlert added in v0.8.0

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 added in v0.8.0

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

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

func (*MockInstance) CloseAlert added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

func (_m *MockInstance) GetName() string

GetName provides a mock function with given fields:

func (*MockInstance) ResolveIncident added in v0.8.0

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 added in v0.8.0

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 Permissions added in v0.8.0

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