Add type and styles to datadog timeboard graphs
Create the resources for title and styles and add them to the acceptance test. Styles currently only support "palette".
This commit is contained in:
parent
b53d7a7b49
commit
cae5d8bbb9
|
@ -26,6 +26,15 @@ func resourceDatadogTimeboard() *schema.Resource {
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Default: false,
|
Default: false,
|
||||||
},
|
},
|
||||||
|
"type": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Default: "line",
|
||||||
|
},
|
||||||
|
"style": &schema.Schema{
|
||||||
|
Type: schema.TypeMap,
|
||||||
|
Optional: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -121,10 +130,17 @@ func appendRequests(datadogGraph *datadog.Graph, terraformRequests *[]interface{
|
||||||
t := t_.(map[string]interface{})
|
t := t_.(map[string]interface{})
|
||||||
d := datadog.GraphDefinitionRequest{
|
d := datadog.GraphDefinitionRequest{
|
||||||
Query: t["q"].(string),
|
Query: t["q"].(string),
|
||||||
|
Type: t["type"].(string),
|
||||||
}
|
}
|
||||||
if stacked, ok := t["stacked"]; ok {
|
if stacked, ok := t["stacked"]; ok {
|
||||||
d.Stacked = stacked.(bool)
|
d.Stacked = stacked.(bool)
|
||||||
}
|
}
|
||||||
|
if style, ok := t["style"]; ok {
|
||||||
|
s, _ := style.(map[string]interface{})
|
||||||
|
if palette, ok := s["palette"]; ok {
|
||||||
|
d.Style.Palette = palette.(string)
|
||||||
|
}
|
||||||
|
}
|
||||||
datadogGraph.Definition.Requests = append(datadogGraph.Definition.Requests, d)
|
datadogGraph.Definition.Requests = append(datadogGraph.Definition.Requests, d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,13 @@ resource "datadog_timeboard" "acceptance_test" {
|
||||||
request {
|
request {
|
||||||
q = "avg:redis.mem.rss{$host}"
|
q = "avg:redis.mem.rss{$host}"
|
||||||
}
|
}
|
||||||
|
request {
|
||||||
|
q = "avg:redis.mem.rss{$host}"
|
||||||
|
type = "bars"
|
||||||
|
style {
|
||||||
|
palette = "warm"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
template_variable {
|
template_variable {
|
||||||
name = "host"
|
name = "host"
|
||||||
|
@ -86,6 +93,8 @@ func TestAccDatadogTimeboard_update(t *testing.T) {
|
||||||
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.1.request.1.q", "avg:redis.mem.rss{$host}"),
|
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.1.request.1.q", "avg:redis.mem.rss{$host}"),
|
||||||
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "template_variable.0.name", "host"),
|
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "template_variable.0.name", "host"),
|
||||||
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "template_variable.0.prefix", "host"),
|
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "template_variable.0.prefix", "host"),
|
||||||
|
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.1.request.2.type", "bars"),
|
||||||
|
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.1.request.2.style.palette", "warm"),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue