Skip to content

Commit

Permalink
Make subscriptions optional for SqlAlertTask
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailKulikov-db committed Sep 2, 2024
1 parent a4b0225 commit 38815bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/resources/job.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ One of the `query`, `dashboard` or `alert` needs to be provided.
* `pause_subscriptions` - (Optional) flag that specifies if subscriptions are paused or not.
* `alert` - (Optional) block consisting of following fields:
* `alert_id` - (Required) (String) identifier of the Databricks SQL Alert.
* `subscriptions` - (Required) a list of subscription blocks consisting out of one of the required fields: `user_name` for user emails or `destination_id` - for Alert destination's identifier.
* `subscriptions` - (Optional) a list of subscription blocks consisting out of one of the required fields: `user_name` for user emails or `destination_id` - for Alert destination's identifier.
* `pause_subscriptions` - (Optional) flag that specifies if subscriptions are paused or not.
* `file` - (Optional) block consisting of single string fields:
* `source` - (Optional) The source of the project. Possible values are `WORKSPACE` and `GIT`.
Expand Down
5 changes: 1 addition & 4 deletions jobs/resource_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type SqlDashboardTask struct {

type SqlAlertTask struct {
AlertID string `json:"alert_id"`
Subscriptions []SqlSubscription `json:"subscriptions"`
Subscriptions []SqlSubscription `json:"subscriptions,omitempty"`
PauseSubscriptions bool `json:"pause_subscriptions,omitempty"`
}

Expand Down Expand Up @@ -624,9 +624,6 @@ func (JobSettingsResource) CustomizeSchema(s *common.CustomizableSchema) *common
s.SchemaPath("task", "python_wheel_task", "package_name").SetOptional()
s.SchemaPath("task", "for_each_task", "task", "python_wheel_task", "package_name").SetOptional()

s.SchemaPath("task", "sql_task", "alert", "subscriptions").SetRequired()
s.SchemaPath("task", "for_each_task", "task", "sql_task", "alert", "subscriptions").SetRequired()

s.SchemaPath("task", "new_cluster", "cluster_id").SetOptional()
s.SchemaPath("task", "for_each_task", "task", "new_cluster", "cluster_id").SetOptional()

Expand Down

0 comments on commit 38815bc

Please sign in to comment.