Skip to content

Commit

Permalink
feat: add filters to notification silences
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Nov 7, 2024
1 parent 798c786 commit f0e4a87
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 12 deletions.
23 changes: 12 additions & 11 deletions models/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,18 @@ func (t NotificationSilenceResource) Empty() bool {
type NotificationSilence struct {
NotificationSilenceResource `json:",inline" yaml:",inline"`

ID uuid.UUID `json:"id" gorm:"default:generate_ulid()"`
Namespace string `json:"namespace,omitempty"`
From time.Time `json:"from"`
Until time.Time `json:"until"`
Source string `json:"source"`
Recursive bool `json:"recursive"`
Description string `json:"description,omitempty"`
CreatedBy *uuid.UUID `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at" time_format:"postgres_timestamp" gorm:"<-:false"`
UpdatedAt time.Time `json:"updated_at" time_format:"postgres_timestamp" gorm:"<-:false"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
ID uuid.UUID `json:"id" gorm:"default:generate_ulid()"`
Namespace string `json:"namespace,omitempty"`
Filter types.CelExpression `json:"filter,omitempty"`
From time.Time `json:"from"`
Until time.Time `json:"until"`
Source string `json:"source"`
Recursive bool `json:"recursive"`
Description string `json:"description,omitempty"`
CreatedBy *uuid.UUID `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at" time_format:"postgres_timestamp" gorm:"<-:false"`
UpdatedAt time.Time `json:"updated_at" time_format:"postgres_timestamp" gorm:"<-:false"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}

func (n NotificationSilence) AsMap(removeFields ...string) map[string]any {
Expand Down
6 changes: 5 additions & 1 deletion schema/notifications.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ table "notification_silences" {
null = true
type = text
}
column "filter" {
null = true
type = text
}
column "from" {
null = false
type = timestamptz
Expand Down Expand Up @@ -299,4 +303,4 @@ table "notification_silences" {
on_update = NO_ACTION
on_delete = NO_ACTION
}
}
}
1 change: 1 addition & 0 deletions types/resource_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type ComponentConfigTraversalArgs struct {
Direction string `yaml:"direction,omitempty" json:"direction,omitempty"`
}

// +kubebuilder:object:generate=true
type Functions struct {
// It uses the config_id linked to the componentID to lookup up all the config relations and returns
// a list of componentIDs that are linked to the found configIDs
Expand Down
21 changes: 21 additions & 0 deletions types/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f0e4a87

Please sign in to comment.