Documentation
¶
Index ¶
- Constants
- Variables
- func SilenceComment(silence client.Object) string
- func SilenceEndsAt(silence client.Object) (time.Time, error)
- type Alertmanager
- func (am *Alertmanager) CreateSilence(s *Silence, tenant string) error
- func (am *Alertmanager) DeleteSilenceByComment(comment string, tenant string) error
- func (am *Alertmanager) DeleteSilenceByID(id string, tenant string) error
- func (am *Alertmanager) GetSilenceByComment(comment string, tenant string) (*Silence, error)
- func (am *Alertmanager) ListSilences(tenant string) ([]Silence, error)
- func (am *Alertmanager) NewRequest(method, url string, body io.Reader, tenant string) (*http.Request, error)
- func (am *Alertmanager) UpdateSilence(s *Silence, tenant string) error
- type Client
- 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 ¶ added in v0.17.0
type Alertmanager struct {
// contains filtered or unexported fields
}
func (*Alertmanager) CreateSilence ¶ added in v0.17.0
func (am *Alertmanager) CreateSilence(s *Silence, tenant string) error
func (*Alertmanager) DeleteSilenceByComment ¶ added in v0.17.0
func (am *Alertmanager) DeleteSilenceByComment(comment string, tenant string) error
func (*Alertmanager) DeleteSilenceByID ¶ added in v0.17.0
func (am *Alertmanager) DeleteSilenceByID(id string, tenant string) error
func (*Alertmanager) GetSilenceByComment ¶ added in v0.17.0
func (am *Alertmanager) GetSilenceByComment(comment string, tenant string) (*Silence, error)
func (*Alertmanager) ListSilences ¶ added in v0.17.0
func (am *Alertmanager) ListSilences(tenant string) ([]Silence, error)
func (*Alertmanager) NewRequest ¶ added in v0.17.0
func (am *Alertmanager) NewRequest(method, url string, body io.Reader, tenant string) (*http.Request, error)
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. The tenant parameter takes precedence over the instance tenantId.
func (*Alertmanager) UpdateSilence ¶ added in v0.17.0
func (am *Alertmanager) UpdateSilence(s *Silence, tenant string) error
type Client ¶ added in v0.17.0
type Client interface {
GetSilenceByComment(comment string, tenant string) (*Silence, error)
CreateSilence(s *Silence, tenant string) error
UpdateSilence(s *Silence, tenant string) error
DeleteSilenceByComment(comment string, tenant string) error
DeleteSilenceByID(id string, tenant string) error
ListSilences(tenant string) ([]Silence, error)
}
Client defines the contract for alertmanager operations
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.