Skip to content

Commit

Permalink
Merge pull request DataDog#121 from gphat/cory-update-dd-api-add-yaxi…
Browse files Browse the repository at this point in the history
…s-bits

Bump datadog api to v2.18.0 and add support for include units and zero
  • Loading branch information
masci authored Nov 28, 2018
2 parents fbdddc5 + 3b69a47 commit 1cf79f6
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 39 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## 1.6.0 (Unreleased)

IMPROVEMENTS

* Pull changes from go-datadog-api v2.18.0 ([#121](https://github.com/terraform-providers/terraform-provider-datadog/pull/121))

## 1.5.0 (November 06, 2018)

IMPROVEMENTS:
Expand Down
4 changes: 2 additions & 2 deletions datadog/resource_datadog_screenboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,8 @@ func buildScreenboard(d *schema.ResourceData) (*datadog.Screenboard, error) {
return &datadog.Screenboard{
Id: datadog.Int(id),
Title: datadog.String(d.Get("title").(string)),
Height: datadog.String(d.Get("height").(string)),
Width: datadog.String(d.Get("width").(string)),
Height: datadog.Int(d.Get("height").(int)),
Width: datadog.Int(d.Get("width").(int)),
Shared: datadog.Bool(d.Get("shared").(bool)),
ReadOnly: datadog.Bool(d.Get("read_only").(bool)),
Widgets: buildWidgets(&terraformWidgets),
Expand Down
15 changes: 15 additions & 0 deletions datadog/resource_datadog_timeboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,13 @@ func buildGraphs(terraformGraphs *[]interface{}) *[]datadog.Graph {
if v, ok := yaxis["scale"]; ok {
d.Definition.Yaxis.SetScale(v.(string))
}
if v, ok := t["include_zero"]; ok {
d.Definition.Yaxis.SetIncludeZero(v.(bool))
}

if v, ok := t["include_units"]; ok {
d.Definition.Yaxis.SetIncludeUnits(v.(bool))
}
}

if v, ok := t["autoscale"]; ok {
Expand Down Expand Up @@ -680,6 +687,14 @@ func buildTerraformGraph(datadogGraph datadog.Graph) map[string]interface{} {
yaxis["scale"] = v
}

if v, ok := definition.Yaxis.GetIncludeZeroOk(); ok {
yaxis["include_zero"] = strconv.FormatBool(v)
}

if v, ok := definition.Yaxis.GetIncludeUnitsOk(); ok {
yaxis["include_unis"] = strconv.FormatBool(v)
}

graph["yaxis"] = yaxis

if v, ok := definition.GetAutoscaleOk(); ok {
Expand Down
4 changes: 4 additions & 0 deletions datadog/resource_datadog_timeboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ resource "datadog_timeboard" "acceptance_test" {
yaxis {
max = "50"
scale = "sqrt"
include_zero = true
include_units = true
}
}
graph {
Expand Down Expand Up @@ -184,6 +186,8 @@ func TestAccDatadogTimeboard_update(t *testing.T) {
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.0.marker.0.value", "y > 100"),
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.0.yaxis.max", "50"),
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.0.yaxis.scale", "sqrt"),
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.0.yaxis.include_units", "true"),
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.0.yaxis.include_zero", "true"),
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.1.title", "ELB Requests"),
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.1.viz", "query_value"),
resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.1.request.0.q", "sum:aws.elb.request_count{*}.as_count()"),
Expand Down
12 changes: 7 additions & 5 deletions vendor/github.com/zorkian/go-datadog-api/dashboards.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

175 changes: 165 additions & 10 deletions vendor/github.com/zorkian/go-datadog-api/datadog-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 19 additions & 13 deletions vendor/github.com/zorkian/go-datadog-api/monitors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/zorkian/go-datadog-api/screen_widgets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/zorkian/go-datadog-api/screenboards.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1cf79f6

Please sign in to comment.