escalation

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveStep

type ActiveStep struct {
	StepID          string
	PolicyID        string
	AlertID         int
	LastEscalation  time.Time
	LoopCount       int
	ForceEscalation bool
	StepNumber      int
}

type Config

type Config struct {
	NCStore         *notificationchannel.Store
	Registry        *nfydest.Registry
	LogStore        *alertlog.Store
	SlackLookupFunc func(ctx context.Context, channelID string) (*slack.Channel, error)
}

type Policy

type Policy struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Repeat      int    `json:"repeat"`
	// contains filtered or unexported fields
}

func (Policy) IsUserFavorite added in v0.28.0

func (p Policy) IsUserFavorite() bool

IsUserFavorite returns true if this policy is a favorite of the current user.

func (Policy) Normalize

func (p Policy) Normalize() (*Policy, error)

type SearchCursor

type SearchCursor struct {
	Name       string `json:"n,omitempty"`
	IsFavorite bool   `json:"f,omitempty"`
}

SearchCursor is used to indicate a position in a paginated list.

type SearchOptions

type SearchOptions struct {
	Search string       `json:"s,omitempty"`
	After  SearchCursor `json:"a,omitempty"`

	// FavoritesUserID specifies the UserID whose favorite escalation policies want to be displayed.
	FavoritesUserID string `json:"u,omitempty"`

	// FavoritesOnly controls filtering the results to those marked as favorites by FavoritesUserID.
	FavoritesOnly bool `json:"g,omitempty"`

	// FavoritesFirst indicates that escalation policy marked as favorite (by FavoritesUserID) should be returned first (before any non-favorites).
	FavoritesFirst bool `json:"f,omitempty"`

	// Omit specifies a list of policy IDs to exclude from the results.
	Omit []string `json:"o,omitempty"`

	Limit int `json:"-"`
}

SearchOptions allow filtering and paginating the list of escalation policies.

type Step

type Step struct {
	ID           uuid.UUID `json:"id"`
	PolicyID     string    `json:"escalation_policy_id"`
	DelayMinutes int       `json:"delay_minutes"`
	StepNumber   int       `json:"step_number"`

	// MultiAck indicates notifications started by this step should continue
	// after the alert is acknowledged, so that everyone on the step is notified
	// and can acknowledge.
	MultiAck bool `json:"multi_ack"`
}

func (Step) Delay

func (s Step) Delay() time.Duration

func (Step) Normalize

func (s Step) Normalize() (*Step, error)

type Store

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

func NewStore added in v0.30.0

func NewStore(ctx context.Context, db *sql.DB, cfg Config) (*Store, error)

func (*Store) AddStepActionTx added in v0.33.0

func (s *Store) AddStepActionTx(ctx context.Context, tx *sql.Tx, stepID uuid.UUID, dest gadb.DestV1) error

func (*Store) CreatePolicyTx added in v0.30.0

func (s *Store) CreatePolicyTx(ctx context.Context, tx *sql.Tx, p *Policy) (*Policy, error)

CreatePolicyTx creates a new escalation policy in the database.

func (*Store) CreateStepTx added in v0.30.0

func (s *Store) CreateStepTx(ctx context.Context, tx *sql.Tx, st *Step) (*Step, error)

CreateStepTx adds a step to an escalation policy.

func (*Store) DeleteManyPoliciesTx added in v0.30.0

func (s *Store) DeleteManyPoliciesTx(ctx context.Context, tx *sql.Tx, ids []string) error

DeleteManyPoliciesTx deletes multiple policies in a single transaction.

func (*Store) DeleteStepActionTx added in v0.33.0

func (s *Store) DeleteStepActionTx(ctx context.Context, tx *sql.Tx, stepID uuid.UUID, dest gadb.DestV1) error

func (*Store) DeleteStepTx added in v0.30.0

func (s *Store) DeleteStepTx(ctx context.Context, tx *sql.Tx, id uuid.UUID) (string, error)

DeleteStepTx deletes a step from an escalation policy.

func (*Store) FindAllOnCallStepsForUserTx added in v0.30.0

func (s *Store) FindAllOnCallStepsForUserTx(ctx context.Context, tx *sql.Tx, userID string) ([]Step, error)

FindAllOnCallStepsForUserTx returns all steps a user is currently on-call for.

func (*Store) FindAllPoliciesBySchedule added in v0.30.0

func (s *Store) FindAllPoliciesBySchedule(ctx context.Context, scheduleID string) ([]Policy, error)

FindAllPoliciesBySchedule will return all policies that have the given schedule assigned to them.

func (*Store) FindAllStepActionsTx added in v0.33.0

func (s *Store) FindAllStepActionsTx(ctx context.Context, tx gadb.DBTX, stepID uuid.UUID) ([]gadb.DestV1, error)

func (*Store) FindAllSteps added in v0.30.0

func (s *Store) FindAllSteps(ctx context.Context, policyID string) ([]Step, error)

func (*Store) FindAllStepsTx added in v0.30.0

func (s *Store) FindAllStepsTx(ctx context.Context, tx *sql.Tx, policyID string) ([]Step, error)

FindAllStepsTx returns all steps for a policy.

func (*Store) FindManyPolicies added in v0.30.0

func (s *Store) FindManyPolicies(ctx context.Context, ids []string) ([]Policy, error)

FindManyPolicies returns escalation policies for the given IDs.

func (*Store) FindOnePolicyForUpdateTx added in v0.30.0

func (s *Store) FindOnePolicyForUpdateTx(ctx context.Context, tx *sql.Tx, id string) (*Policy, error)

FindOnePolicyForUpdateTx returns a single policy locked to the tx for updating.

func (*Store) FindOnePolicyTx added in v0.30.0

func (s *Store) FindOnePolicyTx(ctx context.Context, tx *sql.Tx, id string) (*Policy, error)

FindOnePolicyTx returns a policy by ID.

func (*Store) FindOneStepForUpdateTx added in v0.30.0

func (s *Store) FindOneStepForUpdateTx(ctx context.Context, tx *sql.Tx, id string) (*Step, error)

FindOneStepForUpdateTx returns a step locked within the tx for update.

func (*Store) Search added in v0.30.0

func (s *Store) Search(ctx context.Context, opts *SearchOptions) ([]Policy, error)

func (*Store) UpdatePolicyTx added in v0.30.0

func (s *Store) UpdatePolicyTx(ctx context.Context, tx *sql.Tx, p *Policy) error

UpdatePolicyTx will update a single escalation policy.

func (*Store) UpdateStepDelayTx added in v0.30.0

func (s *Store) UpdateStepDelayTx(ctx context.Context, tx *sql.Tx, stepID uuid.UUID, stepDelay int) error

UpdateStepDelayTx updates the delay for a step.

func (*Store) UpdateStepMultiAckTx added in v0.35.0

func (s *Store) UpdateStepMultiAckTx(ctx context.Context, tx *sql.Tx, stepID uuid.UUID, multiAck bool) error

UpdateStepMultiAckTx updates the multi-ack setting for a step.

func (*Store) UpdateStepNumberTx added in v0.30.0

func (s *Store) UpdateStepNumberTx(ctx context.Context, tx *sql.Tx, stepID uuid.UUID, stepNumber int) error

UpdateStepNumberTx updates the step number for a step.

Jump to

Keyboard shortcuts

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