Documentation
¶
Index ¶
- Constants
- Variables
- func SilenceComment(silence *v1alpha1.Silence) string
- func SilenceEndsAt(silence *v1alpha1.Silence) (time.Time, error)
- type AlertManager
- func (am *AlertManager) CreateSilence(s *Silence) error
- func (am *AlertManager) DeleteSilenceByComment(comment string) error
- func (am *AlertManager) DeleteSilenceByID(id string) error
- func (am *AlertManager) GetSilenceByComment(comment string) (*Silence, error)
- func (am *AlertManager) ListSilences() ([]Silence, error)
- func (am *AlertManager) NewRequest(method, url string, body io.Reader) (*http.Request, error)
- func (am *AlertManager) UpdateSilence(s *Silence) error
- type Config
- type Matcher
- type Silence
- type Status
Constants ¶
View Source
const ( CreatedBy = "silence-operator" ValidUntilAnnotationName = "valid-until" DateOnlyLayout = "2006-01-02" // Define state constant SilenceStateExpired = "expired" )
Variables ¶
View Source
var (
ErrSilenceNotFound = errors.New("silence not found")
)
Functions ¶
func SilenceComment ¶ added in v0.15.0
func SilenceEndsAt ¶ added in v0.15.0
SilenceEndsAt gets the expiry date for a given silence. The expiry date is retrieved from the annotation name configured by ValidUntilAnnotationName. The expected format is defined by DateOnlyLayout. It returns an invalidExpirationDateError in case the date format is invalid.
Types ¶
type AlertManager ¶
type AlertManager struct {
// contains filtered or unexported fields
}
func New ¶
func New(config Config) (*AlertManager, error)
func (*AlertManager) CreateSilence ¶
func (am *AlertManager) CreateSilence(s *Silence) error
func (*AlertManager) DeleteSilenceByComment ¶
func (am *AlertManager) DeleteSilenceByComment(comment string) error
func (*AlertManager) DeleteSilenceByID ¶ added in v0.9.0
func (am *AlertManager) DeleteSilenceByID(id string) error
func (*AlertManager) GetSilenceByComment ¶
func (am *AlertManager) GetSilenceByComment(comment string) (*Silence, error)
func (*AlertManager) ListSilences ¶
func (am *AlertManager) ListSilences() ([]Silence, error)
func (*AlertManager) NewRequest ¶ added in v0.13.0
NewRequest creates a new http.Request with the given method, url and body. It adds the tenantId as X-Scope-OrgID header to the request if it is set.
func (*AlertManager) UpdateSilence ¶ added in v0.8.0
func (am *AlertManager) UpdateSilence(s *Silence) error
type Silence ¶
type Silence struct {
Comment string `json:"comment"`
CreatedBy string `json:"createdBy"`
EndsAt time.Time `json:"endsAt"`
ID string `json:"id"`
Matchers []Matcher `json:"matchers"`
StartsAt time.Time `json:"startsAt"`
Status *Status `json:"status"`
}
TODO Can we use open API Types here instead of defining our own types?
Click to show internal directories.
Click to hide internal directories.