From b53d7a7b493033cf5c8bee0f4d86892c56719ce2 Mon Sep 17 00:00:00 2001 From: Colin Saliceti Date: Mon, 3 Oct 2016 12:15:01 +0100 Subject: [PATCH] Use new Datadog GraphDefinitionRequest struct This new struct avoids requiring to repeat the struct definition in this code here. It avoids duplication and makes it more flexible so more options can be added to the struct without breaking the code here. --- builtin/providers/datadog/resource_datadog_timeboard.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/builtin/providers/datadog/resource_datadog_timeboard.go b/builtin/providers/datadog/resource_datadog_timeboard.go index d7e726745b..e39c918f01 100644 --- a/builtin/providers/datadog/resource_datadog_timeboard.go +++ b/builtin/providers/datadog/resource_datadog_timeboard.go @@ -119,12 +119,9 @@ func buildTemplateVariables(terraformTemplateVariables *[]interface{}) *[]datado 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"` - Aggregator string - ConditionalFormats []datadog.DashboardConditionalFormat `json:"conditional_formats,omitempty"` - }{Query: t["q"].(string)} + d := datadog.GraphDefinitionRequest{ + Query: t["q"].(string), + } if stacked, ok := t["stacked"]; ok { d.Stacked = stacked.(bool) }