client

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TemplateFilePostfix = ".tmpl"

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertmanagerClient

type AlertmanagerClient interface {
	CreateReceiver(tenantID string, rec config.Receiver) error
	GetReceivers(tenantID string) ([]config.Receiver, error)
	UpdateReceiver(tenantID, receiverName string, newRec *config.Receiver) error
	DeleteReceiver(tenantID, receiverName string) error

	// ModifyNetworkRoute updates an existing routing tree for the given
	// tenant, or creates one if it already exists. Ensures that the base
	// route matches all alerts with label "tenantID" = <tenantID>.
	ModifyTenantRoute(tenantID string, route *config.Route) error

	// GetRoute returns the routing tree for the given tenantID
	GetRoute(tenantID string) (*config.Route, error)

	// GetTenants returns a list of tenants configured in the system
	GetTenants() ([]string, error)

	GetGlobalConfig() (*config.GlobalConfig, error)
	SetGlobalConfig(globalConfig config.GlobalConfig) error

	GetTemplateFileList() ([]string, error)
	AddTemplateFile(path string) error
	RemoveTemplateFile(path string) error

	// ReloadAlertmanager triggers the alertmanager process to reload the
	// configuration file(s)
	ReloadAlertmanager() error

	Tenancy() *alert.TenancyConfig
}

func NewClient

func NewClient(conf ClientConfig) AlertmanagerClient

type ClientConfig added in v1.0.4

type ClientConfig struct {
	ConfigPath      string
	AlertmanagerURL string
	FsClient        fsclient.FSClient
	Tenancy         *alert.TenancyConfig
	DeleteRoutes    bool
}

type TemplateClient

type TemplateClient interface {
	GetTemplateFile(filename string) (string, error)
	CreateTemplateFile(filename, fileText string) error
	EditTemplateFile(filename, fileText string) error
	DeleteTemplateFile(filename string) error

	GetTemplates(filename string) (map[string]string, error)

	GetTemplate(filename, tmplName string) (string, error)
	AddTemplate(filename, tmplName, tmplText string) error
	EditTemplate(filename, tmplName, tmplText string) error
	DeleteTemplate(filename, tmplName string) error

	Root() string
}

TemplateClient interface provides methods for modifying template files and individual templates within them

func NewTemplateClient

func NewTemplateClient(fsClient fsclient.FSClient, fileLocks *alert.FileLocker) TemplateClient

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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