alerts

package
v0.0.1-dev.8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregation

type Aggregation string
const (
	Aggregation_Unspecified   Aggregation = ""
	Aggregation_Sum           Aggregation = "SUM"
	Aggregation_Count         Aggregation = "COUNT"
	Aggregation_CountDistinct Aggregation = "COUNT_DISTINCT"
	Aggregation_Avg           Aggregation = "AVG"
	Aggregation_Median        Aggregation = "MEDIAN"
	Aggregation_Min           Aggregation = "MIN"
	Aggregation_Max           Aggregation = "MAX"
	Aggregation_Stddev        Aggregation = "STDDEV"
)

type Alert

type Alert struct {
	// The canonical identifier of the alert to retrieve information about.
	Id *string `fieldmask:"id"`
	// The display name of the alert.
	DisplayName *string `fieldmask:"display_name"`
	// The owner's username. This field is set to "Unavailable" if the user has been
	// deleted.
	OwnerUserName *string `fieldmask:"owner_user_name"`
	// The timestamp indicating when the alert was created.
	CreateTime *types.Time `fieldmask:"create_time"`
	// The timestamp indicating when the alert was updated.
	UpdateTime *types.Time `fieldmask:"update_time"`
	// The workspace path of the folder containing the alert. Can only be set on
	// create, and cannot be updated.
	ParentPath *string `fieldmask:"parent_path"`
	// Text of the query to be run.
	QueryText *string `fieldmask:"query_text"`
	// ID of the SQL warehouse attached to the alert.
	WarehouseId *string `fieldmask:"warehouse_id"`
	// The run as username or application ID of service principal. On Create and
	// Update, this field can be set to application ID of an active service
	// principal. Setting this field requires the servicePrincipal/user role.
	// Deprecated: Use `run_as` field instead. This field will be removed in a
	// future release.
	RunAsUserName *string          `fieldmask:"run_as_user_name"`
	Evaluation    *AlertEvaluation `fieldmask:"evaluation"`
	Schedule      *CronSchedule    `fieldmask:"schedule"`
	// Indicates whether the query is trashed.
	LifecycleState AlertLifecycleState `fieldmask:"lifecycle_state"`
	// Custom summary for the alert. support mustache template.
	CustomSummary *string `fieldmask:"custom_summary"`
	// Custom description for the alert. support mustache template.
	CustomDescription *string `fieldmask:"custom_description"`
	// Specifies the identity that will be used to run the alert. This field allows
	// you to configure alerts to run as a specific user or service principal. - For
	// user identity: Set `user_name` to the email of an active workspace user.
	// Users can only set this to their own email. - For service principal: Set
	// `service_principal_name` to the application ID. Requires the
	// `servicePrincipal/user` role. If not specified, the alert will run as the
	// request user.
	RunAs *AlertRunAs `fieldmask:"run_as"`
	// The actual identity that will be used to execute the alert. This is an
	// output-only field that shows the resolved run-as identity after applying
	// permissions and defaults.
	EffectiveRunAs *AlertRunAs `fieldmask:"effective_run_as"`
	// A list of parameters to pass into the alert SQL query statement containing
	// parameter markers. Static values only.
	//
	// Reference a parameter in the query text as `:name`. Each parameter must have
	// a unique, non-empty name. Each parameter consists of a name, a value, and
	// optionally a type. To represent a NULL value, the `value` field may be
	// omitted or set to `null` explicitly. If the `type` field is omitted, the
	// value is interpreted as a string.
	//
	// If the type is given, parameters will be checked for type correctness
	// according to the given type. A value is correct if the provided string can be
	// converted to the requested type using the `cast` function. The exact
	// semantics are described in the section [`cast` function] of the SQL language
	// reference.
	//
	// [`cast` function]: https://docs.databricks.com/sql/language-manual/functions/cast.html
	Parameters []AlertStatementParameter `fieldmask:"parameters"`
}

type AlertEvaluation

type AlertEvaluation struct {
	// Source column from result to use to evaluate alert
	Source *AlertOperandColumn `fieldmask:"source"`
	// Operator used for comparison in alert evaluation.
	ComparisonOperator ComparisonOperator `fieldmask:"comparison_operator"`
	// Threshold to user for alert evaluation, can be a column or a value.
	Threshold *AlertOperand `fieldmask:"threshold"`
	// User or Notification Destination to notify when alert is triggered.
	Notification *AlertNotification `fieldmask:"notification"`
	// Latest state of alert evaluation.
	State AlertEvaluationState `fieldmask:"state"`
	// Timestamp of the last evaluation.
	LastEvaluatedAt *types.Time `fieldmask:"last_evaluated_at"`
	// Alert state if result is empty. Please avoid setting this field to be
	// `UNKNOWN` because `UNKNOWN` state is planned to be deprecated.
	EmptyResultState AlertEvaluationState `fieldmask:"empty_result_state"`
}

type AlertEvaluationState

type AlertEvaluationState string

UNSPECIFIED - default unspecify value for proto enum, do not use it in the code UNKNOWN - alert not yet evaluated TRIGGERED - alert is triggered OK - alert is not triggered ERROR - alert evaluation failed

const (
	AlertEvaluationState_Unspecified AlertEvaluationState = ""
	// Deprecated. Please avoid using `UNKNOWN` as empty_result_state.
	AlertEvaluationState_Unknown   AlertEvaluationState = "UNKNOWN"
	AlertEvaluationState_Triggered AlertEvaluationState = "TRIGGERED"
	AlertEvaluationState_Ok        AlertEvaluationState = "OK"
	AlertEvaluationState_Error     AlertEvaluationState = "ERROR"
)

type AlertLifecycleState

type AlertLifecycleState string
const (
	AlertLifecycleState_Unspecified AlertLifecycleState = ""
	AlertLifecycleState_Active      AlertLifecycleState = "ACTIVE"
	AlertLifecycleState_Deleted     AlertLifecycleState = "DELETED"
)

type AlertNotification

type AlertNotification struct {
	Subscriptions []AlertSubscription `fieldmask:"subscriptions"`
	// Number of seconds an alert waits after being triggered before it is allowed
	// to send another notification. If set to 0 or omitted, the alert will not send
	// any further notifications after the first trigger Setting this value to 1
	// allows the alert to send a notification on every evaluation where the
	// condition is met, effectively making it always retrigger for notification
	// purposes.
	RetriggerSeconds *int `fieldmask:"retrigger_seconds"`
	// Whether to notify alert subscribers when alert returns back to normal.
	NotifyOnOk *bool `fieldmask:"notify_on_ok"`
}

type AlertOperand

type AlertOperand struct {
	// Only one of the following fields may be set, depending on the type of
	// operand/threshold.
	Operand isAlertOperand_Operand
	// contains filtered or unexported fields
}

type AlertOperandColumn

type AlertOperandColumn struct {
	Name    *string `fieldmask:"name"`
	Display *string `fieldmask:"display"`
	// If not set, the behavior is equivalent to using `First row` in the UI.
	Aggregation Aggregation `fieldmask:"aggregation"`
}

type AlertOperandValue

type AlertOperandValue struct {
	// Only one of the following fields may be set, depending on the type of
	// threshold value.
	Value isAlertOperandValue_Value
	// contains filtered or unexported fields
}

type AlertOperandValue_Value_BoolValue

type AlertOperandValue_Value_BoolValue struct {
	BoolValue bool `fieldmask:"bool_value"`
}

AlertOperandValue_Value_BoolValue selects BoolValue for AlertOperandValue.Value.

type AlertOperandValue_Value_DoubleValue

type AlertOperandValue_Value_DoubleValue struct {
	DoubleValue float64 `fieldmask:"double_value"`
}

AlertOperandValue_Value_DoubleValue selects DoubleValue for AlertOperandValue.Value.

type AlertOperandValue_Value_StringValue

type AlertOperandValue_Value_StringValue struct {
	StringValue string `fieldmask:"string_value"`
}

AlertOperandValue_Value_StringValue selects StringValue for AlertOperandValue.Value.

type AlertOperand_Operand_Column

type AlertOperand_Operand_Column struct {
	Column AlertOperandColumn `fieldmask:"column"`
}

AlertOperand_Operand_Column selects Column for AlertOperand.Operand.

type AlertOperand_Operand_Value

type AlertOperand_Operand_Value struct {
	Value AlertOperandValue `fieldmask:"value"`
}

AlertOperand_Operand_Value selects Value for AlertOperand.Operand.

type AlertRunAs

type AlertRunAs struct {
	Identity isAlertRunAs_Identity
	// contains filtered or unexported fields
}

type AlertRunAs_Identity_ServicePrincipalName

type AlertRunAs_Identity_ServicePrincipalName struct {
	ServicePrincipalName string `fieldmask:"service_principal_name"`
}

AlertRunAs_Identity_ServicePrincipalName selects ServicePrincipalName for AlertRunAs.Identity. Application ID of an active service principal. Setting this field requires the `servicePrincipal/user` role.

type AlertRunAs_Identity_UserName

type AlertRunAs_Identity_UserName struct {
	UserName string `fieldmask:"user_name"`
}

AlertRunAs_Identity_UserName selects UserName for AlertRunAs.Identity. The email of an active workspace user. Can only set this field to their own email.

type AlertStatementParameter

type AlertStatementParameter struct {
	// The name of the parameter. Reference it in the query text as `:name`.
	// Required, must be non-empty, and must be unique across the alert's
	// parameters.
	Name *string
	// The value bound to the parameter, represented as a string. If omitted, the
	// value is interpreted as NULL.
	Value *string
	// The SQL data type of the parameter, for example `STRING`, `INT`, or
	// `DECIMAL(10, 2)`. If no type is given the type is assumed to be `STRING`.
	// Complex types such as `ARRAY`, `MAP`, and `STRUCT` are not supported.
	Type *string
}

A named parameter bound to the alert query. Only flat, named scalar parameters are supported; complex types such as ARRAY, MAP, and STRUCT are not..

type AlertSubscription

type AlertSubscription struct {
	SubscriptionType isAlertSubscription_SubscriptionType
}

type AlertSubscription_SubscriptionType_DestinationId

type AlertSubscription_SubscriptionType_DestinationId struct {
	DestinationId string
}

AlertSubscription_SubscriptionType_DestinationId selects DestinationId for AlertSubscription.SubscriptionType.

type AlertSubscription_SubscriptionType_UserEmail

type AlertSubscription_SubscriptionType_UserEmail struct {
	UserEmail string
}

AlertSubscription_SubscriptionType_UserEmail selects UserEmail for AlertSubscription.SubscriptionType.

type Client

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

func NewClient

func NewClient(ctx context.Context, opts ...client.Option) (*Client, error)

func (*Client) CreateAlert

func (c *Client) CreateAlert(ctx context.Context, req CreateAlertRequest, opts ...call.Option) (*Alert, error)

Create Alert

func (*Client) GetAlert

func (c *Client) GetAlert(ctx context.Context, req GetAlertRequest, opts ...call.Option) (*Alert, error)

Gets an alert.

func (*Client) ListAlerts

func (c *Client) ListAlerts(ctx context.Context, req ListAlertsRequest, opts ...call.Option) (*ListAlertsResponse, error)

Gets a list of alerts accessible to the user, ordered by creation time.

func (*Client) ListAlertsIter

func (c *Client) ListAlertsIter(ctx context.Context, req ListAlertsRequest, opts ...call.Option) iter.Seq2[*Alert, error]

ListAlertsIter returns an iterator that iterates over the results of ListAlerts.

For example:

for item, err := range c.ListAlertsIter(ctx, ListAlertsRequest{}) {
  if err != nil {
    return err
  }
  fmt.Println(item)
}

Options opts are passed to each ListAlerts call made by the iterator under the hood.

Callers who need custom pagination logic should use ListAlerts directly.

func (*Client) TrashAlert

func (c *Client) TrashAlert(ctx context.Context, req TrashAlertRequest, opts ...call.Option) (*Empty, error)

Moves an alert to the trash. Trashed alerts immediately disappear from list views, and can no longer trigger. You can restore a trashed alert through the UI. A trashed alert is permanently deleted after 30 days.

func (*Client) UpdateAlert

func (c *Client) UpdateAlert(ctx context.Context, req UpdateAlertRequest, opts ...call.Option) (*Alert, error)

Update alert

type ComparisonOperator

type ComparisonOperator string
const (
	ComparisonOperator_Unspecified        ComparisonOperator = ""
	ComparisonOperator_LessThan           ComparisonOperator = "LESS_THAN"
	ComparisonOperator_GreaterThan        ComparisonOperator = "GREATER_THAN"
	ComparisonOperator_Equal              ComparisonOperator = "EQUAL"
	ComparisonOperator_NotEqual           ComparisonOperator = "NOT_EQUAL"
	ComparisonOperator_GreaterThanOrEqual ComparisonOperator = "GREATER_THAN_OR_EQUAL"
	ComparisonOperator_LessThanOrEqual    ComparisonOperator = "LESS_THAN_OR_EQUAL"
	ComparisonOperator_IsNull             ComparisonOperator = "IS_NULL"
	ComparisonOperator_IsNotNull          ComparisonOperator = "IS_NOT_NULL"
)

type CreateAlertRequest

type CreateAlertRequest struct {
	Alert *Alert
}

type CronSchedule

type CronSchedule struct {
	// A cron expression using quartz syntax that specifies the schedule for this
	// pipeline. Should use the quartz format described here:
	// http://www.quartz-scheduler.org/documentation/quartz-2.1.7/tutorials/tutorial-lesson-06.html
	QuartzCronSchedule *string `fieldmask:"quartz_cron_schedule"`
	// A Java timezone id. The schedule will be resolved using this timezone. This
	// will be combined with the quartz_cron_schedule to determine the schedule. See
	// https://docs.databricks.com/sql/language-manual/sql-ref-syntax-aux-conf-mgmt-set-timezone.html
	// for details.
	TimezoneId *string `fieldmask:"timezone_id"`
	// Indicate whether this schedule is paused or not.
	PauseStatus SchedulePauseStatus `fieldmask:"pause_status"`
}

type Empty

type Empty struct {
}

Represents an empty message, similar to google.protobuf.Empty, which is not available in the firm right now..

type GetAlertRequest

type GetAlertRequest struct {
	Id *string
}

type ListAlertsRequest

type ListAlertsRequest struct {
	PageToken *string
	PageSize  *int
}

type ListAlertsResponse

type ListAlertsResponse struct {
	Alerts        []Alert
	NextPageToken *string
}

type SchedulePauseStatus

type SchedulePauseStatus string
const (
	SchedulePauseStatus_Unspecified SchedulePauseStatus = ""
	SchedulePauseStatus_Unpaused    SchedulePauseStatus = "UNPAUSED"
	SchedulePauseStatus_Paused      SchedulePauseStatus = "PAUSED"
)

type TrashAlertRequest

type TrashAlertRequest struct {
	Id *string
	// Whether to permanently delete the alert. If not set, the alert will only be
	// soft deleted.
	Purge *bool
}

type UpdateAlertRequest

type UpdateAlertRequest struct {
	Alert      *Alert
	UpdateMask *types.FieldMask[Alert]
}

Jump to

Keyboard shortcuts

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