alerting

package
v0.0.0-...-30bcf85 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContactPointConverter

func ContactPointConverter(input ContactPoint) string

ContactPointConverter accepts a `ContactPoint` object and generates the Go code to build this object using builders.

func MatcherConverter

func MatcherConverter(input Matcher) string

MatcherConverter accepts a `Matcher` object and generates the Go code to build this object using builders.

func MuteTimingConverter

func MuteTimingConverter(input MuteTiming) string

MuteTimingConverter accepts a `MuteTiming` object and generates the Go code to build this object using builders.

func NotificationPolicyConverter

func NotificationPolicyConverter(input NotificationPolicy) string

NotificationPolicyConverter accepts a `NotificationPolicy` object and generates the Go code to build this object using builders.

func NotificationSettingsConverter

func NotificationSettingsConverter(input NotificationSettings) string

NotificationSettingsConverter accepts a `NotificationSettings` object and generates the Go code to build this object using builders.

func NotificationTemplateConverter

func NotificationTemplateConverter(input NotificationTemplate) string

NotificationTemplateConverter accepts a `NotificationTemplate` object and generates the Go code to build this object using builders.

func QueryConverter

func QueryConverter(input Query) string

QueryConverter accepts a `Query` object and generates the Go code to build this object using builders.

func RuleConverter

func RuleConverter(input Rule) string

RuleConverter accepts a `Rule` object and generates the Go code to build this object using builders.

func RuleGroupConverter

func RuleGroupConverter(input RuleGroup) string

RuleGroupConverter accepts a `RuleGroup` object and generates the Go code to build this object using builders.

func TimeIntervalConverter

func TimeIntervalConverter(input TimeInterval) string

TimeIntervalConverter accepts a `TimeInterval` object and generates the Go code to build this object using builders.

func TimeIntervalItemConverter

func TimeIntervalItemConverter(input TimeIntervalItem) string

TimeIntervalItemConverter accepts a `TimeIntervalItem` object and generates the Go code to build this object using builders.

func TimeIntervalTimeRangeConverter

func TimeIntervalTimeRangeConverter(input TimeIntervalTimeRange) string

TimeIntervalTimeRangeConverter accepts a `TimeIntervalTimeRange` object and generates the Go code to build this object using builders.

Types

type ContactPoint

type ContactPoint struct {
	DisableResolveMessage *bool `json:"disableResolveMessage,omitempty"`
	// Name is used as grouping key in the UI. Contact points with the
	// same name will be grouped in the UI.
	Name       *string          `json:"name,omitempty"`
	Provenance *string          `json:"provenance,omitempty"`
	Settings   Json             `json:"settings"`
	Type       ContactPointType `json:"type"`
	// UID is the unique identifier of the contact point. The UID can be
	// set by the user.
	Uid *string `json:"uid,omitempty"`
}

EmbeddedContactPoint is the contact point type that is used by grafanas embedded alertmanager implementation.

func NewContactPoint

func NewContactPoint() *ContactPoint

NewContactPoint creates a new ContactPoint object.

func (ContactPoint) Equals

func (resource ContactPoint) Equals(other ContactPoint) bool

Equals tests the equality of two `ContactPoint` objects.

func (*ContactPoint) UnmarshalJSONStrict

func (resource *ContactPoint) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `ContactPoint` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (ContactPoint) Validate

func (resource ContactPoint) Validate() error

Validate checks all the validation constraints that may be defined on `ContactPoint` fields for violations and returns them.

type ContactPointBuilder

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

EmbeddedContactPoint is the contact point type that is used by grafanas embedded alertmanager implementation.

func NewContactPointBuilder

func NewContactPointBuilder() *ContactPointBuilder

func (*ContactPointBuilder) Build

func (builder *ContactPointBuilder) Build() (ContactPoint, error)

func (*ContactPointBuilder) DisableResolveMessage

func (builder *ContactPointBuilder) DisableResolveMessage(disableResolveMessage bool) *ContactPointBuilder

func (*ContactPointBuilder) Name

func (builder *ContactPointBuilder) Name(name string) *ContactPointBuilder

Name is used as grouping key in the UI. Contact points with the same name will be grouped in the UI.

func (*ContactPointBuilder) Provenance

func (builder *ContactPointBuilder) Provenance(provenance string) *ContactPointBuilder

func (*ContactPointBuilder) Settings

func (builder *ContactPointBuilder) Settings(settings Json) *ContactPointBuilder

func (*ContactPointBuilder) Type

func (*ContactPointBuilder) Uid

func (builder *ContactPointBuilder) Uid(uid string) *ContactPointBuilder

UID is the unique identifier of the contact point. The UID can be set by the user.

type ContactPointType

type ContactPointType string
const (
	ContactPointTypeAlertmanager ContactPointType = "alertmanager"
	ContactPointTypeDingding     ContactPointType = " dingding"
	ContactPointTypeDiscord      ContactPointType = " discord"
	ContactPointTypeEmail        ContactPointType = " email"
	ContactPointTypeGooglechat   ContactPointType = " googlechat"
	ContactPointTypeKafka        ContactPointType = " kafka"
	ContactPointTypeLine         ContactPointType = " line"
	ContactPointTypeOpsgenie     ContactPointType = " opsgenie"
	ContactPointTypePagerduty    ContactPointType = " pagerduty"
	ContactPointTypePushover     ContactPointType = " pushover"
	ContactPointTypeSensugo      ContactPointType = " sensugo"
	ContactPointTypeSlack        ContactPointType = " slack"
	ContactPointTypeTeams        ContactPointType = " teams"
	ContactPointTypeTelegram     ContactPointType = " telegram"
	ContactPointTypeThreema      ContactPointType = " threema"
	ContactPointTypeVictorops    ContactPointType = " victorops"
	ContactPointTypeWebhook      ContactPointType = " webhook"
	ContactPointTypeWecom        ContactPointType = " wecom"
)

type Duration

type Duration int64

Duration in seconds.

type Json

type Json any

type MatchRegexps

type MatchRegexps map[string]string

type MatchType

type MatchType string
const (
	MatchTypeEqual         MatchType = "="
	MatchTypeNotEqual      MatchType = "!="
	MatchTypeEqualRegex    MatchType = "=~"
	MatchTypeNotEqualRegex MatchType = "!~"
)

type Matcher

type Matcher struct {
	Name  *string    `json:"Name,omitempty"`
	Type  *MatchType `json:"Type,omitempty"`
	Value *string    `json:"Value,omitempty"`
}

func NewMatcher

func NewMatcher() *Matcher

NewMatcher creates a new Matcher object.

func (Matcher) Equals

func (resource Matcher) Equals(other Matcher) bool

Equals tests the equality of two `Matcher` objects.

func (*Matcher) UnmarshalJSONStrict

func (resource *Matcher) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `Matcher` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (Matcher) Validate

func (resource Matcher) Validate() error

Validate checks all the validation constraints that may be defined on `Matcher` fields for violations and returns them.

type MatcherBuilder

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

func NewMatcherBuilder

func NewMatcherBuilder() *MatcherBuilder

func (*MatcherBuilder) Build

func (builder *MatcherBuilder) Build() (Matcher, error)

func (*MatcherBuilder) Name

func (builder *MatcherBuilder) Name(name string) *MatcherBuilder

func (*MatcherBuilder) Type

func (builder *MatcherBuilder) Type(typeArg MatchType) *MatcherBuilder

func (*MatcherBuilder) Value

func (builder *MatcherBuilder) Value(value string) *MatcherBuilder

type Matchers

type Matchers []Matcher

Matchers is a slice of Matchers that is sortable, implements Stringer, and provides a Matches method to match a LabelSet against all Matchers in the slice. Note that some users of Matchers might require it to be sorted.

type MuteTiming

type MuteTiming struct {
	Name          *string        `json:"name,omitempty"`
	TimeIntervals []TimeInterval `json:"time_intervals,omitempty"`
}

func NewMuteTiming

func NewMuteTiming() *MuteTiming

NewMuteTiming creates a new MuteTiming object.

func (MuteTiming) Equals

func (resource MuteTiming) Equals(other MuteTiming) bool

Equals tests the equality of two `MuteTiming` objects.

func (*MuteTiming) UnmarshalJSONStrict

func (resource *MuteTiming) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `MuteTiming` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (MuteTiming) Validate

func (resource MuteTiming) Validate() error

Validate checks all the validation constraints that may be defined on `MuteTiming` fields for violations and returns them.

type MuteTimingBuilder

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

func NewMuteTimingBuilder

func NewMuteTimingBuilder() *MuteTimingBuilder

func (*MuteTimingBuilder) Build

func (builder *MuteTimingBuilder) Build() (MuteTiming, error)

func (*MuteTimingBuilder) Name

func (builder *MuteTimingBuilder) Name(name string) *MuteTimingBuilder

func (*MuteTimingBuilder) TimeIntervals

func (builder *MuteTimingBuilder) TimeIntervals(timeIntervals []cog.Builder[TimeInterval]) *MuteTimingBuilder

type NotificationPolicy

type NotificationPolicy struct {
	Continue      *bool    `json:"continue,omitempty"`
	GroupBy       []string `json:"group_by,omitempty"`
	GroupInterval *string  `json:"group_interval,omitempty"`
	GroupWait     *string  `json:"group_wait,omitempty"`
	// Deprecated. Remove before v1.0 release.
	Match   map[string]string `json:"match,omitempty"`
	MatchRe *MatchRegexps     `json:"match_re,omitempty"`
	// Matchers is a slice of Matchers that is sortable, implements Stringer, and
	// provides a Matches method to match a LabelSet against all Matchers in the
	// slice. Note that some users of Matchers might require it to be sorted.
	Matchers          *Matchers            `json:"matchers,omitempty"`
	MuteTimeIntervals []string             `json:"mute_time_intervals,omitempty"`
	ObjectMatchers    *ObjectMatchers      `json:"object_matchers,omitempty"`
	Provenance        *Provenance          `json:"provenance,omitempty"`
	Receiver          *string              `json:"receiver,omitempty"`
	RepeatInterval    *string              `json:"repeat_interval,omitempty"`
	Routes            []NotificationPolicy `json:"routes,omitempty"`
}

A Route is a node that contains definitions of how to handle alerts. This is modified from the upstream alertmanager in that it adds the ObjectMatchers property.

func NewNotificationPolicy

func NewNotificationPolicy() *NotificationPolicy

NewNotificationPolicy creates a new NotificationPolicy object.

func (NotificationPolicy) Equals

func (resource NotificationPolicy) Equals(other NotificationPolicy) bool

Equals tests the equality of two `NotificationPolicy` objects.

func (*NotificationPolicy) UnmarshalJSONStrict

func (resource *NotificationPolicy) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `NotificationPolicy` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (NotificationPolicy) Validate

func (resource NotificationPolicy) Validate() error

Validate checks all the validation constraints that may be defined on `NotificationPolicy` fields for violations and returns them.

type NotificationPolicyBuilder

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

A Route is a node that contains definitions of how to handle alerts. This is modified from the upstream alertmanager in that it adds the ObjectMatchers property.

func NewNotificationPolicyBuilder

func NewNotificationPolicyBuilder() *NotificationPolicyBuilder

func (*NotificationPolicyBuilder) Build

func (*NotificationPolicyBuilder) Continue

func (builder *NotificationPolicyBuilder) Continue(continueArg bool) *NotificationPolicyBuilder

func (*NotificationPolicyBuilder) GroupBy

func (builder *NotificationPolicyBuilder) GroupBy(groupBy []string) *NotificationPolicyBuilder

func (*NotificationPolicyBuilder) GroupInterval

func (builder *NotificationPolicyBuilder) GroupInterval(groupInterval string) *NotificationPolicyBuilder

func (*NotificationPolicyBuilder) GroupWait

func (builder *NotificationPolicyBuilder) GroupWait(groupWait string) *NotificationPolicyBuilder

func (*NotificationPolicyBuilder) Match

Deprecated. Remove before v1.0 release.

func (*NotificationPolicyBuilder) MatchRe

func (*NotificationPolicyBuilder) Matchers

func (builder *NotificationPolicyBuilder) Matchers(matchers Matchers) *NotificationPolicyBuilder

Matchers is a slice of Matchers that is sortable, implements Stringer, and provides a Matches method to match a LabelSet against all Matchers in the slice. Note that some users of Matchers might require it to be sorted.

func (*NotificationPolicyBuilder) MuteTimeIntervals

func (builder *NotificationPolicyBuilder) MuteTimeIntervals(muteTimeIntervals []string) *NotificationPolicyBuilder

func (*NotificationPolicyBuilder) ObjectMatchers

func (builder *NotificationPolicyBuilder) ObjectMatchers(objectMatchers ObjectMatchers) *NotificationPolicyBuilder

func (*NotificationPolicyBuilder) Provenance

func (builder *NotificationPolicyBuilder) Provenance(provenance Provenance) *NotificationPolicyBuilder

func (*NotificationPolicyBuilder) Receiver

func (builder *NotificationPolicyBuilder) Receiver(receiver string) *NotificationPolicyBuilder

func (*NotificationPolicyBuilder) RepeatInterval

func (builder *NotificationPolicyBuilder) RepeatInterval(repeatInterval string) *NotificationPolicyBuilder

func (*NotificationPolicyBuilder) Routes

type NotificationSettings

type NotificationSettings struct {
	// Override the labels by which incoming alerts are grouped together. For example, multiple alerts coming in for
	// cluster=A and alertname=LatencyHigh would be batched into a single group. To aggregate by all possible labels
	// use the special value '...' as the sole label name.
	// This effectively disables aggregation entirely, passing through all alerts as-is. This is unlikely to be what
	// you want, unless you have a very low alert volume or your upstream notification system performs its own grouping.
	// Must include 'alertname' and 'grafana_folder' if not using '...'.
	GroupBy []string `json:"group_by,omitempty"`
	// Override how long to wait before sending a notification about new alerts that are added to a group of alerts for
	// which an initial notification has already been sent. (Usually ~5m or more.)
	GroupInterval *string `json:"group_interval,omitempty"`
	// Override how long to initially wait to send a notification for a group of alerts. Allows to wait for an
	// inhibiting alert to arrive or collect more initial alerts for the same group. (Usually ~0s to few minutes.)
	GroupWait *string `json:"group_wait,omitempty"`
	// Override the times when notifications should be muted. These must match the name of a mute time interval defined
	// in the alertmanager configuration mute_time_intervals section. When muted it will not send any notifications, but
	// otherwise acts normally.
	MuteTimeIntervals []string `json:"mute_time_intervals,omitempty"`
	// Name of the receiver to send notifications to.
	Receiver string `json:"receiver"`
	// Override how long to wait before sending a notification again if it has already been sent successfully for an
	// alert. (Usually ~3h or more).
	// Note that this parameter is implicitly bound by Alertmanager's `--data.retention` configuration flag.
	// Notifications will be resent after either repeat_interval or the data retention period have passed, whichever
	// occurs first. `repeat_interval` should not be less than `group_interval`.
	RepeatInterval *string `json:"repeat_interval,omitempty"`
}

func NewNotificationSettings

func NewNotificationSettings() *NotificationSettings

NewNotificationSettings creates a new NotificationSettings object.

func (NotificationSettings) Equals

func (resource NotificationSettings) Equals(other NotificationSettings) bool

Equals tests the equality of two `NotificationSettings` objects.

func (*NotificationSettings) UnmarshalJSONStrict

func (resource *NotificationSettings) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `NotificationSettings` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (NotificationSettings) Validate

func (resource NotificationSettings) Validate() error

Validate checks all the validation constraints that may be defined on `NotificationSettings` fields for violations and returns them.

type NotificationSettingsBuilder

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

func NewNotificationSettingsBuilder

func NewNotificationSettingsBuilder() *NotificationSettingsBuilder

func (*NotificationSettingsBuilder) Build

func (*NotificationSettingsBuilder) GroupBy

func (builder *NotificationSettingsBuilder) GroupBy(groupBy []string) *NotificationSettingsBuilder

Override the labels by which incoming alerts are grouped together. For example, multiple alerts coming in for cluster=A and alertname=LatencyHigh would be batched into a single group. To aggregate by all possible labels use the special value '...' as the sole label name. This effectively disables aggregation entirely, passing through all alerts as-is. This is unlikely to be what you want, unless you have a very low alert volume or your upstream notification system performs its own grouping. Must include 'alertname' and 'grafana_folder' if not using '...'.

func (*NotificationSettingsBuilder) GroupInterval

func (builder *NotificationSettingsBuilder) GroupInterval(groupInterval string) *NotificationSettingsBuilder

Override how long to wait before sending a notification about new alerts that are added to a group of alerts for which an initial notification has already been sent. (Usually ~5m or more.)

func (*NotificationSettingsBuilder) GroupWait

func (builder *NotificationSettingsBuilder) GroupWait(groupWait string) *NotificationSettingsBuilder

Override how long to initially wait to send a notification for a group of alerts. Allows to wait for an inhibiting alert to arrive or collect more initial alerts for the same group. (Usually ~0s to few minutes.)

func (*NotificationSettingsBuilder) MuteTimeIntervals

func (builder *NotificationSettingsBuilder) MuteTimeIntervals(muteTimeIntervals []string) *NotificationSettingsBuilder

Override the times when notifications should be muted. These must match the name of a mute time interval defined in the alertmanager configuration mute_time_intervals section. When muted it will not send any notifications, but otherwise acts normally.

func (*NotificationSettingsBuilder) Receiver

func (builder *NotificationSettingsBuilder) Receiver(receiver string) *NotificationSettingsBuilder

Name of the receiver to send notifications to.

func (*NotificationSettingsBuilder) RepeatInterval

func (builder *NotificationSettingsBuilder) RepeatInterval(repeatInterval string) *NotificationSettingsBuilder

Override how long to wait before sending a notification again if it has already been sent successfully for an alert. (Usually ~3h or more). Note that this parameter is implicitly bound by Alertmanager's `--data.retention` configuration flag. Notifications will be resent after either repeat_interval or the data retention period have passed, whichever occurs first. `repeat_interval` should not be less than `group_interval`.

type NotificationTemplate

type NotificationTemplate struct {
	Name       *string     `json:"name,omitempty"`
	Provenance *Provenance `json:"provenance,omitempty"`
	Template   *string     `json:"template,omitempty"`
}

func NewNotificationTemplate

func NewNotificationTemplate() *NotificationTemplate

NewNotificationTemplate creates a new NotificationTemplate object.

func (NotificationTemplate) Equals

func (resource NotificationTemplate) Equals(other NotificationTemplate) bool

Equals tests the equality of two `NotificationTemplate` objects.

func (*NotificationTemplate) UnmarshalJSONStrict

func (resource *NotificationTemplate) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `NotificationTemplate` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (NotificationTemplate) Validate

func (resource NotificationTemplate) Validate() error

Validate checks all the validation constraints that may be defined on `NotificationTemplate` fields for violations and returns them.

type NotificationTemplateBuilder

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

func NewNotificationTemplateBuilder

func NewNotificationTemplateBuilder() *NotificationTemplateBuilder

func (*NotificationTemplateBuilder) Build

func (*NotificationTemplateBuilder) Name

func (*NotificationTemplateBuilder) Provenance

func (builder *NotificationTemplateBuilder) Provenance(provenance Provenance) *NotificationTemplateBuilder

func (*NotificationTemplateBuilder) Template

func (builder *NotificationTemplateBuilder) Template(template string) *NotificationTemplateBuilder

type ObjectMatcher

type ObjectMatcher []string

type ObjectMatchers

type ObjectMatchers []ObjectMatcher

type Provenance

type Provenance string

type Query

type Query struct {
	// Grafana data source unique identifier; it should be '__expr__' for a Server Side Expression operation.
	DatasourceUid *string `json:"datasourceUid,omitempty"`
	// JSON is the raw JSON query and includes the above properties as well as custom properties.
	Model variants.Dataquery `json:"model,omitempty"`
	// QueryType is an optional identifier for the type of query.
	// It can be used to distinguish different types of queries.
	QueryType *string `json:"queryType,omitempty"`
	// RefID is the unique identifier of the query, set by the frontend call.
	RefId *string `json:"refId,omitempty"`
	// RelativeTimeRange is the per query start and end time
	// for requests.
	RelativeTimeRange *RelativeTimeRange `json:"relativeTimeRange,omitempty"`
}

func NewQuery

func NewQuery() *Query

NewQuery creates a new Query object.

func (Query) Equals

func (resource Query) Equals(other Query) bool

Equals tests the equality of two `Query` objects.

func (*Query) UnmarshalJSON

func (resource *Query) UnmarshalJSON(raw []byte) error

UnmarshalJSON implements a custom JSON unmarshalling logic to decode Query from JSON.

func (*Query) UnmarshalJSONStrict

func (resource *Query) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `Query` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (Query) Validate

func (resource Query) Validate() error

Validate checks all the validation constraints that may be defined on `Query` fields for violations and returns them.

type QueryBuilder

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

func NewQueryBuilder

func NewQueryBuilder(refId string) *QueryBuilder

func (*QueryBuilder) Build

func (builder *QueryBuilder) Build() (Query, error)

func (*QueryBuilder) DatasourceUid

func (builder *QueryBuilder) DatasourceUid(datasourceUid string) *QueryBuilder

Grafana data source unique identifier; it should be '__expr__' for a Server Side Expression operation.

func (*QueryBuilder) Model

func (builder *QueryBuilder) Model(model cog.Builder[variants.Dataquery]) *QueryBuilder

JSON is the raw JSON query and includes the above properties as well as custom properties.

func (*QueryBuilder) QueryType

func (builder *QueryBuilder) QueryType(queryType string) *QueryBuilder

QueryType is an optional identifier for the type of query. It can be used to distinguish different types of queries.

func (*QueryBuilder) RefId

func (builder *QueryBuilder) RefId(refId string) *QueryBuilder

RefID is the unique identifier of the query, set by the frontend call.

func (*QueryBuilder) RelativeTimeRange

func (builder *QueryBuilder) RelativeTimeRange(from Duration, to Duration) *QueryBuilder

RelativeTimeRange is the per query start and end time for requests.

type RelativeTimeRange

type RelativeTimeRange struct {
	// A Duration represents the elapsed time between two instants
	// as an int64 nanosecond count. The representation limits the
	// largest representable duration to approximately 290 years.
	From *Duration `json:"from,omitempty"`
	// A Duration represents the elapsed time between two instants
	// as an int64 nanosecond count. The representation limits the
	// largest representable duration to approximately 290 years.
	To *Duration `json:"to,omitempty"`
}

RelativeTimeRange is the per query start and end time for requests.

func NewRelativeTimeRange

func NewRelativeTimeRange() *RelativeTimeRange

NewRelativeTimeRange creates a new RelativeTimeRange object.

func (RelativeTimeRange) Equals

func (resource RelativeTimeRange) Equals(other RelativeTimeRange) bool

Equals tests the equality of two `RelativeTimeRange` objects.

func (*RelativeTimeRange) UnmarshalJSONStrict

func (resource *RelativeTimeRange) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `RelativeTimeRange` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (RelativeTimeRange) Validate

func (resource RelativeTimeRange) Validate() error

Validate checks all the validation constraints that may be defined on `RelativeTimeRange` fields for violations and returns them.

type Rule

type Rule struct {
	Annotations  map[string]string `json:"annotations,omitempty"`
	Condition    string            `json:"condition"`
	Data         []Query           `json:"data"`
	ExecErrState RuleExecErrState  `json:"execErrState"`
	FolderUID    string            `json:"folderUID"`
	// The amount of time, in seconds, for which the rule must be breached for the rule to be considered to be Firing.
	// Before this time has elapsed, the rule is only considered to be Pending.
	For                  string                `json:"for"`
	Id                   *int64                `json:"id,omitempty"`
	IsPaused             *bool                 `json:"isPaused,omitempty"`
	Labels               map[string]string     `json:"labels,omitempty"`
	NoDataState          RuleNoDataState       `json:"noDataState"`
	NotificationSettings *NotificationSettings `json:"notification_settings,omitempty"`
	OrgID                int64                 `json:"orgID"`
	Provenance           *Provenance           `json:"provenance,omitempty"`
	RuleGroup            string                `json:"ruleGroup"`
	Title                string                `json:"title"`
	Uid                  *string               `json:"uid,omitempty"`
	Updated              *time.Time            `json:"updated,omitempty"`
}

func NewRule

func NewRule() *Rule

NewRule creates a new Rule object.

func (Rule) Equals

func (resource Rule) Equals(other Rule) bool

Equals tests the equality of two `Rule` objects.

func (*Rule) UnmarshalJSONStrict

func (resource *Rule) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `Rule` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (Rule) Validate

func (resource Rule) Validate() error

Validate checks all the validation constraints that may be defined on `Rule` fields for violations and returns them.

type RuleBuilder

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

func NewRuleBuilder

func NewRuleBuilder(title string) *RuleBuilder

func (*RuleBuilder) Annotations

func (builder *RuleBuilder) Annotations(annotations map[string]string) *RuleBuilder

func (*RuleBuilder) Build

func (builder *RuleBuilder) Build() (Rule, error)

func (*RuleBuilder) Condition

func (builder *RuleBuilder) Condition(condition string) *RuleBuilder

func (*RuleBuilder) ExecErrState

func (builder *RuleBuilder) ExecErrState(execErrState RuleExecErrState) *RuleBuilder

func (*RuleBuilder) FolderUID

func (builder *RuleBuilder) FolderUID(folderUID string) *RuleBuilder

func (*RuleBuilder) For

func (builder *RuleBuilder) For(forArg string) *RuleBuilder

The amount of time, in seconds, for which the rule must be breached for the rule to be considered to be Firing. Before this time has elapsed, the rule is only considered to be Pending.

func (*RuleBuilder) Id

func (builder *RuleBuilder) Id(id int64) *RuleBuilder

func (*RuleBuilder) IsPaused

func (builder *RuleBuilder) IsPaused(isPaused bool) *RuleBuilder

func (*RuleBuilder) Labels

func (builder *RuleBuilder) Labels(labels map[string]string) *RuleBuilder

func (*RuleBuilder) NoDataState

func (builder *RuleBuilder) NoDataState(noDataState RuleNoDataState) *RuleBuilder

func (*RuleBuilder) NotificationSettings

func (builder *RuleBuilder) NotificationSettings(notificationSettings cog.Builder[NotificationSettings]) *RuleBuilder

func (*RuleBuilder) OrgID

func (builder *RuleBuilder) OrgID(orgID int64) *RuleBuilder

func (*RuleBuilder) Provenance

func (builder *RuleBuilder) Provenance(provenance Provenance) *RuleBuilder

func (*RuleBuilder) Queries

func (builder *RuleBuilder) Queries(data []cog.Builder[Query]) *RuleBuilder

func (*RuleBuilder) RuleGroup

func (builder *RuleBuilder) RuleGroup(ruleGroup string) *RuleBuilder

func (*RuleBuilder) Title

func (builder *RuleBuilder) Title(title string) *RuleBuilder

func (*RuleBuilder) Uid

func (builder *RuleBuilder) Uid(uid string) *RuleBuilder

func (*RuleBuilder) Updated

func (builder *RuleBuilder) Updated(updated time.Time) *RuleBuilder

func (*RuleBuilder) WithQuery

func (builder *RuleBuilder) WithQuery(data cog.Builder[Query]) *RuleBuilder

type RuleExecErrState

type RuleExecErrState string
const (
	RuleExecErrStateOK       RuleExecErrState = "OK"
	RuleExecErrStateAlerting RuleExecErrState = "Alerting"
	RuleExecErrStateError    RuleExecErrState = "Error"
)

type RuleGroup

type RuleGroup struct {
	FolderUid *string `json:"folderUid,omitempty"`
	// The interval, in seconds, at which all rules in the group are evaluated.
	// If a group contains many rules, the rules are evaluated sequentially.
	Interval *Duration `json:"interval,omitempty"`
	Rules    []Rule    `json:"rules,omitempty"`
	Title    *string   `json:"title,omitempty"`
}

func NewRuleGroup

func NewRuleGroup() *RuleGroup

NewRuleGroup creates a new RuleGroup object.

func (RuleGroup) Equals

func (resource RuleGroup) Equals(other RuleGroup) bool

Equals tests the equality of two `RuleGroup` objects.

func (*RuleGroup) UnmarshalJSONStrict

func (resource *RuleGroup) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `RuleGroup` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (RuleGroup) Validate

func (resource RuleGroup) Validate() error

Validate checks all the validation constraints that may be defined on `RuleGroup` fields for violations and returns them.

type RuleGroupBuilder

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

func NewRuleGroupBuilder

func NewRuleGroupBuilder(title string) *RuleGroupBuilder

func (*RuleGroupBuilder) Build

func (builder *RuleGroupBuilder) Build() (RuleGroup, error)

func (*RuleGroupBuilder) FolderUid

func (builder *RuleGroupBuilder) FolderUid(folderUid string) *RuleGroupBuilder

func (*RuleGroupBuilder) Interval

func (builder *RuleGroupBuilder) Interval(interval Duration) *RuleGroupBuilder

The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.

func (*RuleGroupBuilder) Rules

func (builder *RuleGroupBuilder) Rules(rules []cog.Builder[Rule]) *RuleGroupBuilder

func (*RuleGroupBuilder) Title

func (builder *RuleGroupBuilder) Title(title string) *RuleGroupBuilder

func (*RuleGroupBuilder) WithRule

func (builder *RuleGroupBuilder) WithRule(rule cog.Builder[Rule]) *RuleGroupBuilder

type RuleNoDataState

type RuleNoDataState string
const (
	RuleNoDataStateAlerting RuleNoDataState = "Alerting"
	RuleNoDataStateNoData   RuleNoDataState = "NoData"
	RuleNoDataStateOK       RuleNoDataState = "OK"
)

type TimeInterval

type TimeInterval struct {
	Name          *string            `json:"name,omitempty"`
	TimeIntervals []TimeIntervalItem `json:"time_intervals,omitempty"`
}

func NewTimeInterval

func NewTimeInterval() *TimeInterval

NewTimeInterval creates a new TimeInterval object.

func (TimeInterval) Equals

func (resource TimeInterval) Equals(other TimeInterval) bool

Equals tests the equality of two `TimeInterval` objects.

func (*TimeInterval) UnmarshalJSONStrict

func (resource *TimeInterval) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `TimeInterval` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (TimeInterval) Validate

func (resource TimeInterval) Validate() error

Validate checks all the validation constraints that may be defined on `TimeInterval` fields for violations and returns them.

type TimeIntervalBuilder

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

func NewTimeIntervalBuilder

func NewTimeIntervalBuilder() *TimeIntervalBuilder

func (*TimeIntervalBuilder) Build

func (builder *TimeIntervalBuilder) Build() (TimeInterval, error)

func (*TimeIntervalBuilder) Name

func (builder *TimeIntervalBuilder) Name(name string) *TimeIntervalBuilder

func (*TimeIntervalBuilder) TimeIntervals

func (builder *TimeIntervalBuilder) TimeIntervals(timeIntervals []cog.Builder[TimeIntervalItem]) *TimeIntervalBuilder

type TimeIntervalItem

type TimeIntervalItem struct {
	DaysOfMonth []string                `json:"days_of_month,omitempty"`
	Location    *string                 `json:"location,omitempty"`
	Months      []string                `json:"months,omitempty"`
	Times       []TimeIntervalTimeRange `json:"times,omitempty"`
	Weekdays    []string                `json:"weekdays,omitempty"`
	Years       []string                `json:"years,omitempty"`
}

func NewTimeIntervalItem

func NewTimeIntervalItem() *TimeIntervalItem

NewTimeIntervalItem creates a new TimeIntervalItem object.

func (TimeIntervalItem) Equals

func (resource TimeIntervalItem) Equals(other TimeIntervalItem) bool

Equals tests the equality of two `TimeIntervalItem` objects.

func (*TimeIntervalItem) UnmarshalJSONStrict

func (resource *TimeIntervalItem) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `TimeIntervalItem` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (TimeIntervalItem) Validate

func (resource TimeIntervalItem) Validate() error

Validate checks all the validation constraints that may be defined on `TimeIntervalItem` fields for violations and returns them.

type TimeIntervalItemBuilder

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

func NewTimeIntervalItemBuilder

func NewTimeIntervalItemBuilder() *TimeIntervalItemBuilder

func (*TimeIntervalItemBuilder) Build

func (builder *TimeIntervalItemBuilder) Build() (TimeIntervalItem, error)

func (*TimeIntervalItemBuilder) DaysOfMonth

func (builder *TimeIntervalItemBuilder) DaysOfMonth(daysOfMonth []string) *TimeIntervalItemBuilder

func (*TimeIntervalItemBuilder) Location

func (builder *TimeIntervalItemBuilder) Location(location string) *TimeIntervalItemBuilder

func (*TimeIntervalItemBuilder) Months

func (builder *TimeIntervalItemBuilder) Months(months []string) *TimeIntervalItemBuilder

func (*TimeIntervalItemBuilder) Times

func (*TimeIntervalItemBuilder) Weekdays

func (builder *TimeIntervalItemBuilder) Weekdays(weekdays []string) *TimeIntervalItemBuilder

func (*TimeIntervalItemBuilder) Years

func (builder *TimeIntervalItemBuilder) Years(years []string) *TimeIntervalItemBuilder

type TimeIntervalTimeRange

type TimeIntervalTimeRange struct {
	EndTime   *string `json:"end_time,omitempty"`
	StartTime *string `json:"start_time,omitempty"`
}

func NewTimeIntervalTimeRange

func NewTimeIntervalTimeRange() *TimeIntervalTimeRange

NewTimeIntervalTimeRange creates a new TimeIntervalTimeRange object.

func (TimeIntervalTimeRange) Equals

func (resource TimeIntervalTimeRange) Equals(other TimeIntervalTimeRange) bool

Equals tests the equality of two `TimeIntervalTimeRange` objects.

func (*TimeIntervalTimeRange) UnmarshalJSONStrict

func (resource *TimeIntervalTimeRange) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `TimeIntervalTimeRange` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (TimeIntervalTimeRange) Validate

func (resource TimeIntervalTimeRange) Validate() error

Validate checks all the validation constraints that may be defined on `TimeIntervalTimeRange` fields for violations and returns them.

type TimeIntervalTimeRangeBuilder

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

func NewTimeIntervalTimeRangeBuilder

func NewTimeIntervalTimeRangeBuilder() *TimeIntervalTimeRangeBuilder

func (*TimeIntervalTimeRangeBuilder) Build

func (*TimeIntervalTimeRangeBuilder) EndTime

func (*TimeIntervalTimeRangeBuilder) StartTime

func (builder *TimeIntervalTimeRangeBuilder) StartTime(startTime string) *TimeIntervalTimeRangeBuilder

Jump to

Keyboard shortcuts

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