Documentation
¶
Index ¶
- type Alert
- type AlertCondition
- type AlertOperand
- type AlertOperandColumn
- type AlertOperandValue
- type AlertOperandValue_ThresholdValue_BoolValue
- type AlertOperandValue_ThresholdValue_DoubleValue
- type AlertOperandValue_ThresholdValue_StringValue
- type AlertOperand_Operand_Column
- type AlertOperand_Operand_Value
- type AlertOperator
- type AlertState
- type Client
- func (c *Client) CreateAlert(ctx context.Context, req CreateAlertRequest, opts ...call.Option) (*Alert, error)
- func (c *Client) GetAlert(ctx context.Context, req GetAlertRequest, opts ...call.Option) (*Alert, error)
- func (c *Client) ListAlerts(ctx context.Context, req ListAlertsRequest, opts ...call.Option) (*ListAlertsResponse, error)
- func (c *Client) ListAlertsIter(ctx context.Context, req ListAlertsRequest, opts ...call.Option) iter.Seq2[*ListAlertsResponseAlert, error]
- func (c *Client) TrashAlert(ctx context.Context, req TrashAlertRequest, opts ...call.Option) (*Empty, error)
- func (c *Client) UpdateAlert(ctx context.Context, req UpdateAlertRequest, opts ...call.Option) (*Alert, error)
- type CreateAlertRequest
- type CreateAlertRequestAlert
- type Empty
- type GetAlertRequest
- type LifecycleState
- type ListAlertsRequest
- type ListAlertsResponse
- type ListAlertsResponseAlert
- type TrashAlertRequest
- type UpdateAlertRequest
- type UpdateAlertRequestAlert
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
// UUID identifying the alert.
Id *string
// The display name of the alert.
DisplayName *string
// UUID of the query attached to the alert.
QueryId *string
// Current state of the alert's trigger status. This field is set to UNKNOWN if
// the alert has not yet been evaluated or ran into an error during the last
// evaluation.
State AlertState
// Number of seconds an alert must wait after being triggered to rearm itself.
// After rearming, it can be triggered again. If 0 or not specified, the alert
// will not be triggered again.
SecondsToRetrigger *int
// The workspace state of the alert. Used for tracking trashed status.
LifecycleState LifecycleState
// Timestamp when the alert was last triggered, if the alert has been triggered
// before.
TriggerTime *types.Time
// Custom body of alert notification, if it exists. See
// [here](/sql/user/alerts/index.html) for custom templating instructions.
CustomBody *string
// Custom subject of alert notification, if it exists. This can include email
// subject entries and Slack notification headers, for example. See
// [here](/sql/user/alerts/index.html) for custom templating instructions.
CustomSubject *string
// Trigger conditions of the alert.
Condition *AlertCondition
// The owner's username. This field is set to "Unavailable" if the user has been
// deleted.
OwnerUserName *string
// The workspace path of the folder containing the alert.
ParentPath *string
// The timestamp indicating when the alert was created.
CreateTime *types.Time
// The timestamp indicating when the alert was updated.
UpdateTime *types.Time
// Whether to notify alert subscribers when alert returns back to normal.
NotifyOnOk *bool
}
type AlertCondition ¶
type AlertCondition struct {
// Operator used for comparison in alert evaluation.
Op AlertOperator `fieldmask:"op"`
// Name of the column from the query result to use for comparison in alert
// evaluation.
Operand *AlertOperand `fieldmask:"operand"`
// Threshold value used for comparison in alert evaluation.
Threshold *AlertOperand `fieldmask:"threshold"`
// Alert state if result is empty.
EmptyResultState AlertState `fieldmask:"empty_result_state"`
}
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"`
}
type AlertOperandValue ¶
type AlertOperandValue struct {
// Only one of the following fields may be set, depending on the type of
// threshold value.
ThresholdValue isAlertOperandValue_ThresholdValue
// contains filtered or unexported fields
}
type AlertOperandValue_ThresholdValue_BoolValue ¶
type AlertOperandValue_ThresholdValue_BoolValue struct {
BoolValue bool `fieldmask:"bool_value"`
}
AlertOperandValue_ThresholdValue_BoolValue selects BoolValue for AlertOperandValue.ThresholdValue.
type AlertOperandValue_ThresholdValue_DoubleValue ¶
type AlertOperandValue_ThresholdValue_DoubleValue struct {
DoubleValue float64 `fieldmask:"double_value"`
}
AlertOperandValue_ThresholdValue_DoubleValue selects DoubleValue for AlertOperandValue.ThresholdValue.
type AlertOperandValue_ThresholdValue_StringValue ¶
type AlertOperandValue_ThresholdValue_StringValue struct {
StringValue string `fieldmask:"string_value"`
}
AlertOperandValue_ThresholdValue_StringValue selects StringValue for AlertOperandValue.ThresholdValue.
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 AlertOperator ¶
type AlertOperator string
const ( AlertOperator_Unspecified AlertOperator = "" AlertOperator_GreaterThan AlertOperator = "GREATER_THAN" AlertOperator_GreaterThanOrEqual AlertOperator = "GREATER_THAN_OR_EQUAL" AlertOperator_LessThan AlertOperator = "LESS_THAN" AlertOperator_LessThanOrEqual AlertOperator = "LESS_THAN_OR_EQUAL" AlertOperator_Equal AlertOperator = "EQUAL" AlertOperator_NotEqual AlertOperator = "NOT_EQUAL" AlertOperator_IsNull AlertOperator = "IS_NULL" )
type AlertState ¶
type AlertState string
const ( AlertState_Unspecified AlertState = "" AlertState_Unknown AlertState = "UNKNOWN" AlertState_Ok AlertState = "OK" AlertState_Triggered AlertState = "TRIGGERED" )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateAlert ¶
func (c *Client) CreateAlert(ctx context.Context, req CreateAlertRequest, opts ...call.Option) (*Alert, error)
Creates an 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. **Warning:** Calling this API concurrently 10 or more times could result in throttling, service degradation, or a temporary ban.
func (*Client) ListAlertsIter ¶
func (c *Client) ListAlertsIter(ctx context.Context, req ListAlertsRequest, opts ...call.Option) iter.Seq2[*ListAlertsResponseAlert, 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 searches and 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)
Updates an alert.
type CreateAlertRequest ¶
type CreateAlertRequest struct {
Alert *CreateAlertRequestAlert
// If true, automatically resolve alert display name conflicts. Otherwise, fail
// the request if the alert's display name conflicts with an existing alert's
// display name.
AutoResolveDisplayName *bool
}
type CreateAlertRequestAlert ¶
type CreateAlertRequestAlert struct {
// UUID identifying the alert.
Id *string
// The display name of the alert.
DisplayName *string
// UUID of the query attached to the alert.
QueryId *string
// Current state of the alert's trigger status. This field is set to UNKNOWN if
// the alert has not yet been evaluated or ran into an error during the last
// evaluation.
State AlertState
// Number of seconds an alert must wait after being triggered to rearm itself.
// After rearming, it can be triggered again. If 0 or not specified, the alert
// will not be triggered again.
SecondsToRetrigger *int
// The workspace state of the alert. Used for tracking trashed status.
LifecycleState LifecycleState
// Timestamp when the alert was last triggered, if the alert has been triggered
// before.
TriggerTime *types.Time
// Custom body of alert notification, if it exists. See
// [here](/sql/user/alerts/index.html) for custom templating instructions.
CustomBody *string
// Custom subject of alert notification, if it exists. This can include email
// subject entries and Slack notification headers, for example. See
// [here](/sql/user/alerts/index.html) for custom templating instructions.
CustomSubject *string
// Trigger conditions of the alert.
Condition *AlertCondition
// The owner's username. This field is set to "Unavailable" if the user has been
// deleted.
OwnerUserName *string
// The workspace path of the folder containing the alert.
ParentPath *string
// The timestamp indicating when the alert was created.
CreateTime *types.Time
// The timestamp indicating when the alert was updated.
UpdateTime *types.Time
// Whether to notify alert subscribers when alert returns back to normal.
NotifyOnOk *bool
}
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 LifecycleState ¶
type LifecycleState string
const ( LifecycleState_Unspecified LifecycleState = "" LifecycleState_Active LifecycleState = "ACTIVE" LifecycleState_Trashed LifecycleState = "TRASHED" )
type ListAlertsRequest ¶
type ListAlertsResponse ¶
type ListAlertsResponse struct {
Results []ListAlertsResponseAlert
NextPageToken *string
}
type ListAlertsResponseAlert ¶
type ListAlertsResponseAlert struct {
// UUID identifying the alert.
Id *string
// The display name of the alert.
DisplayName *string
// UUID of the query attached to the alert.
QueryId *string
// Current state of the alert's trigger status. This field is set to UNKNOWN if
// the alert has not yet been evaluated or ran into an error during the last
// evaluation.
State AlertState
// Number of seconds an alert must wait after being triggered to rearm itself.
// After rearming, it can be triggered again. If 0 or not specified, the alert
// will not be triggered again.
SecondsToRetrigger *int
// The workspace state of the alert. Used for tracking trashed status.
LifecycleState LifecycleState
// Timestamp when the alert was last triggered, if the alert has been triggered
// before.
TriggerTime *types.Time
// Custom body of alert notification, if it exists. See
// [here](/sql/user/alerts/index.html) for custom templating instructions.
CustomBody *string
// Custom subject of alert notification, if it exists. This can include email
// subject entries and Slack notification headers, for example. See
// [here](/sql/user/alerts/index.html) for custom templating instructions.
CustomSubject *string
// Trigger conditions of the alert.
Condition *AlertCondition
// The owner's username. This field is set to "Unavailable" if the user has been
// deleted.
OwnerUserName *string
// The workspace path of the folder containing the alert.
ParentPath *string
// The timestamp indicating when the alert was created.
CreateTime *types.Time
// The timestamp indicating when the alert was updated.
UpdateTime *types.Time
// Whether to notify alert subscribers when alert returns back to normal.
NotifyOnOk *bool
}
type TrashAlertRequest ¶
type TrashAlertRequest struct {
Id *string
}
type UpdateAlertRequest ¶
type UpdateAlertRequest struct {
Alert *UpdateAlertRequestAlert
UpdateMask *types.FieldMask[UpdateAlertRequestAlert]
Id *string
// If true, automatically resolve alert display name conflicts. Otherwise, fail
// the request if the alert's display name conflicts with an existing alert's
// display name.
AutoResolveDisplayName *bool
}
type UpdateAlertRequestAlert ¶
type UpdateAlertRequestAlert struct {
// UUID identifying the alert.
Id *string `fieldmask:"id"`
// The display name of the alert.
DisplayName *string `fieldmask:"display_name"`
// UUID of the query attached to the alert.
QueryId *string `fieldmask:"query_id"`
// Current state of the alert's trigger status. This field is set to UNKNOWN if
// the alert has not yet been evaluated or ran into an error during the last
// evaluation.
State AlertState `fieldmask:"state"`
// Number of seconds an alert must wait after being triggered to rearm itself.
// After rearming, it can be triggered again. If 0 or not specified, the alert
// will not be triggered again.
SecondsToRetrigger *int `fieldmask:"seconds_to_retrigger"`
// The workspace state of the alert. Used for tracking trashed status.
LifecycleState LifecycleState `fieldmask:"lifecycle_state"`
// Timestamp when the alert was last triggered, if the alert has been triggered
// before.
TriggerTime *types.Time `fieldmask:"trigger_time"`
// Custom body of alert notification, if it exists. See
// [here](/sql/user/alerts/index.html) for custom templating instructions.
CustomBody *string `fieldmask:"custom_body"`
// Custom subject of alert notification, if it exists. This can include email
// subject entries and Slack notification headers, for example. See
// [here](/sql/user/alerts/index.html) for custom templating instructions.
CustomSubject *string `fieldmask:"custom_subject"`
// Trigger conditions of the alert.
Condition *AlertCondition `fieldmask:"condition"`
// The owner's username. This field is set to "Unavailable" if the user has been
// deleted.
OwnerUserName *string `fieldmask:"owner_user_name"`
// The workspace path of the folder containing the alert.
ParentPath *string `fieldmask:"parent_path"`
// 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"`
// Whether to notify alert subscribers when alert returns back to normal.
NotifyOnOk *bool `fieldmask:"notify_on_ok"`
}