zorkian / go-datadog-api

A Go implementation of the Datadog API.
BSD 3-Clause "New" or "Revised" License
183 stars 156 forks source link

Add support for Template Variable Presets for Boards #296

Closed jackellenberger closed 4 years ago

jackellenberger commented 4 years ago

What

<img width="625" alt="image" src="https://user-images.githubusercontent.com/6370918/71746068-9073ba00-2e31-11ea-83c5-8498d3a14cb8.png">

"Template Variable Presets" aka "Saved Views" are a quick shortcut that can be added by hand or via json to dashboards in datadog, and appear in the top left corner.

They allow you to string together common combinations of template variable values, so if for example you want a "production us-east-2" view of your dashboard, you could have a "production us-east-2" preset that sets your template variables to environment = production and region = us-east-2.

This PR adds support for template variable presets to Boards (aka dashboards, not to be confused with screenboards or timeboards, which are not supported by the API). This will be a necessary step towards adding template variable preset support to the datadog terraform provider.

Cheers!

jackellenberger commented 4 years ago

Of note: this functionality is sort of wonky on DD's side. As an update, template_variable_presets works everywhere. As a create, template_variable_presets is valid for both screenboards and timeboards, but only actually does something for timeboards (layout_type: ordered). I don't think that's the desired behavior, so I have a message in to DD to verify.

jackellenberger commented 4 years ago

Datadog has fixed this strange behavior so this should be good to go.