func If(operator Operator, opts ...ConditionOption) Option {
	return func(alert *Alert) {
		cond := newCondition(opts...)
		cond.builder.Operator = sdk.AlertOperator{Type: string(operator)}
		alert.Builder.Conditions = append(alert.Builder.Conditions, *cond.builder)
	}
}
If adds a condition that could trigger the alert.
See https://grafana.com/docs/grafana/latest/alerting/rules/#conditions
package alert
import (
	"github.com/grafana-tools/sdk"
)
type ErrorMode string
const Alerting ErrorMode = "alerting"
const LastState ErrorMode = "keep_state"
type NoDataMode string
const NoData NoDataMode = "no_data"
const Error NoDataMode = "alerting"
const KeepLastState NoDataMode = "keep_state"
const OK NoDataMode = "ok"
type Option func(alert *Alert)
type Channel struct {
	ID   uint   `json:"id"`
	UID  string `json:"uid"`
	Name string `json:"Name"`
	Type string `json:"type"`
}
type Alert struct {
	Builder *sdk.Alert
}
func New(name string, options ...Option) *Alert {
	alert := &Alert{Builder: &sdk.Alert{
		Name:                name,
		Handler:             1,  
		ExecutionErrorState: string(LastState),
		NoDataState:         string(KeepLastState),
	}}
	for _, opt := range options {
		opt(alert)
	}
	return alert
}
func Notify(channel *Channel) Option {
	return func(alert *Alert) {
		alert.Builder.Notifications = append(alert.Builder.Notifications, sdk.AlertNotification{
			UID: channel.UID,
		})
	}
}
func NotifyChannels(channels ...*Channel) Option {
	return func(alert *Alert) {
		for _, channel := range channels {
			alert.Builder.Notifications = append(alert.Builder.Notifications, sdk.AlertNotification{
				UID: channel.UID,
			})
		}
	}
}
func NotifyChannel(channelUID string) Option {
	return func(alert *Alert) {
		alert.Builder.Notifications = append(alert.Builder.Notifications, sdk.AlertNotification{
			UID: channelUID,
		})
	}
}
func Message(content string) Option {
	return func(alert *Alert) {
		alert.Builder.Message = content
	}
}
func For(duration string) Option {
	return func(alert *Alert) {
		alert.Builder.For = duration
	}
}
func EvaluateEvery(interval string) Option {
	return func(alert *Alert) {
		alert.Builder.Frequency = interval
	}
}
func OnExecutionError(mode ErrorMode) Option {
	return func(alert *Alert) {
		alert.Builder.ExecutionErrorState = string(mode)
	}
}
func OnNoData(mode NoDataMode) Option {
	return func(alert *Alert) {
		alert.Builder.NoDataState = string(mode)
	}
}