provider/datadog: Govendor update dependencies (#8428)

* Includes bugfixes in zorkian/go-datadog-api
* Struct changes upstream required small changes to provider code
This commit is contained in:
Kurt Scherer 2016-08-29 15:30:31 -05:00 committed by Paul Stack
parent dea2860735
commit a4fd7ce23b
5 changed files with 48 additions and 17 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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,

View File

@ -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 {