Documentation ¶
Index ¶
- type Config
- type Instance
- type MockInstance
- func (_m *MockInstance) AcknowledgeAlert(ctx context.Context, id string, user string) error
- func (_m *MockInstance) CheckPermissions(pluginName string, user *userauthcontext.User, action string) error
- func (_m *MockInstance) CloseAlert(ctx context.Context, id string, user string) error
- func (_m *MockInstance) CloseIncident(ctx context.Context, id string, user string) error
- func (_m *MockInstance) GetAlertDetails(ctx context.Context, id string) (*alert.GetAlertResult, error)
- func (_m *MockInstance) GetAlertLogs(ctx context.Context, id string) ([]alert.AlertLog, error)
- func (_m *MockInstance) GetAlertNotes(ctx context.Context, id string) ([]alert.AlertNote, error)
- func (_m *MockInstance) GetAlerts(ctx context.Context, query string) ([]alert.Alert, error)
- func (_m *MockInstance) GetIncidentLogs(ctx context.Context, id string) ([]incident.LogResult, error)
- func (_m *MockInstance) GetIncidentNotes(ctx context.Context, id string) ([]incident.NoteResult, error)
- func (_m *MockInstance) GetIncidentTimeline(ctx context.Context, id string) ([]instanceincident.Entry, error)
- func (_m *MockInstance) GetIncidents(ctx context.Context, query string) ([]incident.Incident, error)
- func (_m *MockInstance) GetName() string
- func (_m *MockInstance) ResolveIncident(ctx context.Context, id string, user string) error
- func (_m *MockInstance) SnoozeAlert(ctx context.Context, id string, user string, duration time.Duration) error
- type NewMockInstanceT
- type Permissions
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.
type MockInstance ¶
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 ¶
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 ¶
CloseAlert provides a mock function with given fields: ctx, id, user
func (*MockInstance) CloseIncident ¶
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 ¶
GetAlertLogs provides a mock function with given fields: ctx, id
func (*MockInstance) GetAlertNotes ¶
GetAlertNotes provides a mock function with given fields: ctx, id
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 ¶
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 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