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.
This commit is contained in:
parent
982a065863
commit
b53d7a7b49
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue