diff --git a/builtin/providers/datadog/resource_datadog_monitor.go b/builtin/providers/datadog/resource_datadog_monitor.go index 732b55f22..5d686ea09 100644 --- a/builtin/providers/datadog/resource_datadog_monitor.go +++ b/builtin/providers/datadog/resource_datadog_monitor.go @@ -159,7 +159,7 @@ func buildMonitorStruct(d *schema.ResourceData) *datadog.Monitor { o.NotifyNoData = attr.(bool) } if attr, ok := d.GetOk("no_data_timeframe"); ok { - o.NoDataTimeframe = attr.(int) + o.NoDataTimeframe = datadog.NoDataTimeframe(attr.(int)) } if attr, ok := d.GetOk("renotify_interval"); ok { o.RenotifyInterval = attr.(int) @@ -336,7 +336,7 @@ func resourceDatadogMonitorUpdate(d *schema.ResourceData, meta interface{}) erro o.NotifyNoData = attr.(bool) } if attr, ok := d.GetOk("no_data_timeframe"); ok { - o.NoDataTimeframe = attr.(int) + o.NoDataTimeframe = datadog.NoDataTimeframe(attr.(int)) } if attr, ok := d.GetOk("renotify_interval"); ok { o.RenotifyInterval = attr.(int) diff --git a/builtin/providers/datadog/resource_datadog_timeboard.go b/builtin/providers/datadog/resource_datadog_timeboard.go index 9bd195fde..d7e726745 100644 --- a/builtin/providers/datadog/resource_datadog_timeboard.go +++ b/builtin/providers/datadog/resource_datadog_timeboard.go @@ -120,8 +120,10 @@ func appendRequests(datadogGraph *datadog.Graph, terraformRequests *[]interface{ for _, t_ := range *terraformRequests { t := t_.(map[string]interface{}) d := struct { - Query string `json:"q"` - Stacked bool `json:"stacked"` + Query string `json:"q"` + Stacked bool `json:"stacked"` + Aggregator string + ConditionalFormats []datadog.DashboardConditionalFormat `json:"conditional_formats,omitempty"` }{Query: t["q"].(string)} if stacked, ok := t["stacked"]; ok { d.Stacked = stacked.(bool) diff --git a/vendor/github.com/zorkian/go-datadog-api/dashboards.go b/vendor/github.com/zorkian/go-datadog-api/dashboards.go index 9c4be48b0..25985ba20 100644 --- a/vendor/github.com/zorkian/go-datadog-api/dashboards.go +++ b/vendor/github.com/zorkian/go-datadog-api/dashboards.go @@ -19,8 +19,10 @@ type Graph struct { Definition struct { Viz string `json:"viz"` Requests []struct { - Query string `json:"q"` - Stacked bool `json:"stacked"` + Query string `json:"q"` + Stacked bool `json:"stacked"` + Aggregator string + ConditionalFormats []DashboardConditionalFormat `json:"conditional_formats,omitempty"` } `json:"requests"` } `json:"definition"` } @@ -64,6 +66,15 @@ type reqGetDashboard struct { Dashboard Dashboard `json:"dash"` } +type DashboardConditionalFormat struct { + Palette string `json:"palette,omitempty"` + Comparator string `json:"comparator,omitempty"` + CustomBgColor string `json:"custom_bg_color,omitempty"` + Value float64 `json:"value,omitempty"` + Inverted bool `json:"invert,omitempty"` + CustomFgColor string `json:"custom_fg_color,omitempty"` +} + // GetDashboard returns a single dashboard created on this account. func (self *Client) GetDashboard(id int) (*Dashboard, error) { var out reqGetDashboard diff --git a/vendor/github.com/zorkian/go-datadog-api/monitors.go b/vendor/github.com/zorkian/go-datadog-api/monitors.go index c92459e2b..b28cd5f7e 100644 --- a/vendor/github.com/zorkian/go-datadog-api/monitors.go +++ b/vendor/github.com/zorkian/go-datadog-api/monitors.go @@ -11,6 +11,7 @@ package datadog import ( "encoding/json" "fmt" + "strconv" ) type ThresholdCount struct { @@ -19,18 +20,34 @@ type ThresholdCount struct { Warning json.Number `json:"warning,omitempty"` } +type NoDataTimeframe int + +func (tf *NoDataTimeframe) UnmarshalJSON(data []byte) error { + s := string(data) + if s == "false" { + *tf = 0 + } else { + i, err := strconv.ParseInt(s, 10, 32) + if err != nil { + return err + } + *tf = NoDataTimeframe(i) + } + return nil +} + type Options struct { - NoDataTimeframe int `json:"no_data_timeframe,omitempty"` - NotifyAudit bool `json:"notify_audit,omitempty"` - NotifyNoData bool `json:"notify_no_data,omitempty"` - RenotifyInterval int `json:"renotify_interval,omitempty"` - Silenced map[string]int `json:"silenced,omitempty"` - TimeoutH int `json:"timeout_h,omitempty"` - EscalationMessage string `json:"escalation_message,omitempty"` - Thresholds ThresholdCount `json:"thresholds,omitempty"` - IncludeTags bool `json:"include_tags,omitempty"` - RequireFullWindow bool `json:"require_full_window,omitempty"` - Locked bool `json:"locked,omitempty"` + NoDataTimeframe NoDataTimeframe `json:"no_data_timeframe,omitempty"` + NotifyAudit bool `json:"notify_audit,omitempty"` + NotifyNoData bool `json:"notify_no_data,omitempty"` + RenotifyInterval int `json:"renotify_interval,omitempty"` + Silenced map[string]int `json:"silenced,omitempty"` + TimeoutH int `json:"timeout_h,omitempty"` + EscalationMessage string `json:"escalation_message,omitempty"` + Thresholds ThresholdCount `json:"thresholds,omitempty"` + IncludeTags bool `json:"include_tags,omitempty"` + RequireFullWindow bool `json:"require_full_window,omitempty"` + Locked bool `json:"locked,omitempty"` } // Monitor allows watching a metric or check that you care about, diff --git a/vendor/github.com/zorkian/go-datadog-api/screenboards.go b/vendor/github.com/zorkian/go-datadog-api/screenboards.go index 2317e392b..fcaeb58d0 100644 --- a/vendor/github.com/zorkian/go-datadog-api/screenboards.go +++ b/vendor/github.com/zorkian/go-datadog-api/screenboards.go @@ -23,6 +23,7 @@ type Screenboard struct { Templated bool `json:"templated,omitempty"` TemplateVariables []TemplateVariable `json:"template_variables,omitempty"` Widgets []Widget `json:"widgets,omitempty"` + ReadOnly bool `json:"read_only,omitempty"` } //type Widget struct {