silence

package
v0.0.0-...-1ef52fc Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: BSD-3-Clause Imports: 11 Imported by: 4

Documentation

Index

Constants

View Source
const (
	SILENCE_PARENT_KEY = "-silence-"

	NUM_RECENTLY_ARCHIVED = 500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Silence

type Silence struct {
	Key            string              `json:"key" datastore:"-"`
	Active         bool                `json:"active" datastore:"active"`
	User           string              `json:"user" datastore:"user"`
	ParamSet       paramtools.ParamSet `json:"param_set" datastore:"-"`
	ParamSetSerial string              `json:"-" datastore:"param_set_serial,noindex"`
	Created        int64               `json:"created" datastore:"created"`
	Updated        int64               `json:"updated" datastore:"updated"`
	Duration       string              `json:"duration" datastore:"duration"`
	Notes          []note.Note         `json:"notes" datastore:"notes,flatten"`
}

Silence is a filter that matches Incidents and is used to silence them.

func New

func New(user string) *Silence

New creates a new Silence.

user - Email address of the person that created the silence.

func (*Silence) Load

func (silence *Silence) Load(ps []datastore.Property) error

Load converts the JSON paramset back into a paramset.

func (*Silence) Save

func (silence *Silence) Save() ([]datastore.Property, error)

Save serializes the paramset as JSON for storing in the Datastore.

func (*Silence) ValidateRegexes

func (silence *Silence) ValidateRegexes() error

ValidateRegexes returns an error if the silence is not valid.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store saves and updates silences in Cloud Datastore.

func NewStore

func NewStore(ds *datastore.Client) *Store

NewStore creates a new Store from the given Datastore client.

func (*Store) AddNote

func (s *Store) AddNote(encodedKey string, note note.Note) (*Silence, error)

func (*Store) Archive

func (s *Store) Archive(encodedKey string) (*Silence, error)

func (*Store) Delete

func (s *Store) Delete(encodedKey string) error

func (*Store) DeleteNote

func (s *Store) DeleteNote(encodedKey string, index int) (*Silence, error)

func (*Store) GetAll

func (s *Store) GetAll() ([]Silence, error)

GetAll returns a list of all active Silences.

func (*Store) GetRecentlyArchived

func (s *Store) GetRecentlyArchived(updatedWithin time.Duration) ([]Silence, error)

GetRecentlyArchived returns N most recently archived Silences that were updated within the specified duration. updatedWithin can be 0 if we want all recently archived silences.

func (*Store) Put

func (s *Store) Put(silence *Silence) (*Silence, error)

func (*Store) Reactivate

func (s *Store) Reactivate(encodedKey, duration, user string) (*Silence, error)

Jump to

Keyboard shortcuts

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