-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6579a3f
commit 7b3551d
Showing
5 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2023-10-25T11:37:17.305655-04:00 |
106 changes: 106 additions & 0 deletions
106
datadog/tests/cassettes/TestAccDatadogPowerpackChange.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
--- | ||
version: 1 | ||
interactions: | ||
- request: | ||
body: | | ||
{"data":{"attributes":{"description":"Created using the Datadog provider in Terraform","group_widget":{"definition":{"layout_type":"ordered","title":"tf-TestAccDatadogPowerpackChange-local-1698248237","type":"group","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"week_before","increase_good":true,"order_by":"name","order_dir":"desc","q":"avg:system.load.1{env:staging} by {account}","show_present":false}],"title":"Widget Title","type":"change"}}]}},"name":"tf-TestAccDatadogPowerpackChange-local-1698248237","tags":["tag:foo1"],"template_variables":[{"defaults":["defaults"],"name":"datacenter"}]},"type":"powerpack"}} | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v2/powerpacks | ||
method: POST | ||
response: | ||
body: | | ||
{"data":{"type":"powerpack","id":"61eaaa9a-734c-11ee-a4c1-da7ad0900002","attributes":{"name":"tf-TestAccDatadogPowerpackChange-local-1698248237","description":"Created using the Datadog provider in Terraform","group_widget":{"definition":{"layout_type":"ordered","title":"tf-TestAccDatadogPowerpackChange-local-1698248237","type":"group","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"week_before","increase_good":true,"order_by":"name","order_dir":"desc","q":"avg:system.load.1{env:staging} by {account}","show_present":false}],"title":"Widget Title","type":"change"},"id":1146273042797575}]}},"template_variables":[{"defaults":["defaults"],"name":"datacenter"}],"tags":["tag:foo1"]},"relationships":{"author":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"email":"[email protected]"}}]} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: "" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v2/powerpacks/61eaaa9a-734c-11ee-a4c1-da7ad0900002 | ||
method: GET | ||
response: | ||
body: | | ||
{"data":{"type":"powerpack","id":"61eaaa9a-734c-11ee-a4c1-da7ad0900002","attributes":{"name":"tf-TestAccDatadogPowerpackChange-local-1698248237","description":"Created using the Datadog provider in Terraform","group_widget":{"definition":{"layout_type":"ordered","title":"tf-TestAccDatadogPowerpackChange-local-1698248237","type":"group","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"week_before","increase_good":true,"order_by":"name","order_dir":"desc","q":"avg:system.load.1{env:staging} by {account}","show_present":false}],"title":"Widget Title","type":"change"},"id":1146273042797575}]}},"template_variables":[{"defaults":["defaults"],"name":"datacenter"}],"tags":["tag:foo1"]},"relationships":{"author":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"email":"[email protected]"}}]} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: "" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v2/powerpacks/61eaaa9a-734c-11ee-a4c1-da7ad0900002 | ||
method: GET | ||
response: | ||
body: | | ||
{"data":{"type":"powerpack","id":"61eaaa9a-734c-11ee-a4c1-da7ad0900002","attributes":{"name":"tf-TestAccDatadogPowerpackChange-local-1698248237","description":"Created using the Datadog provider in Terraform","group_widget":{"definition":{"layout_type":"ordered","title":"tf-TestAccDatadogPowerpackChange-local-1698248237","type":"group","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"week_before","increase_good":true,"order_by":"name","order_dir":"desc","q":"avg:system.load.1{env:staging} by {account}","show_present":false}],"title":"Widget Title","type":"change"},"id":1146273042797575}]}},"template_variables":[{"defaults":["defaults"],"name":"datacenter"}],"tags":["tag:foo1"]},"relationships":{"author":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"email":"[email protected]"}}]} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: "" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v2/powerpacks/61eaaa9a-734c-11ee-a4c1-da7ad0900002 | ||
method: GET | ||
response: | ||
body: | | ||
{"data":{"type":"powerpack","id":"61eaaa9a-734c-11ee-a4c1-da7ad0900002","attributes":{"name":"tf-TestAccDatadogPowerpackChange-local-1698248237","description":"Created using the Datadog provider in Terraform","group_widget":{"definition":{"layout_type":"ordered","title":"tf-TestAccDatadogPowerpackChange-local-1698248237","type":"group","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"week_before","increase_good":true,"order_by":"name","order_dir":"desc","q":"avg:system.load.1{env:staging} by {account}","show_present":false}],"title":"Widget Title","type":"change"},"id":1146273042797575}]}},"template_variables":[{"defaults":["defaults"],"name":"datacenter"}],"tags":["tag:foo1"]},"relationships":{"author":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"email":"[email protected]"}}]} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: "" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- '*/*' | ||
url: https://api.datadoghq.com/api/v2/powerpacks/61eaaa9a-734c-11ee-a4c1-da7ad0900002 | ||
method: DELETE | ||
response: | ||
body: "" | ||
headers: | ||
Content-Type: | ||
- text/html; charset=utf-8 | ||
status: 204 No Content | ||
code: 204 | ||
duration: "" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v2/powerpacks/61eaaa9a-734c-11ee-a4c1-da7ad0900002 | ||
method: GET | ||
response: | ||
body: '{"errors":["Powerpack with ID 61eaaa9a-734c-11ee-a4c1-da7ad0900002 not found"]}' | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 404 Not Found | ||
code: 404 | ||
duration: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package test | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
const datadogPowerpackChangeTest = ` | ||
resource "datadog_powerpack" "change_powerpack" { | ||
name = "{{uniq}}" | ||
tags = ["tag:foo1"] | ||
description = "Created using the Datadog provider in Terraform" | ||
template_variables { | ||
defaults = ["defaults"] | ||
name = "datacenter" | ||
} | ||
widget { | ||
change_definition { | ||
request { | ||
q = "avg:system.load.1{env:staging} by {account}" | ||
change_type = "absolute" | ||
compare_to = "week_before" | ||
increase_good = true | ||
order_by = "name" | ||
order_dir = "desc" | ||
show_present = false | ||
} | ||
title = "Widget Title" | ||
} | ||
} | ||
} | ||
` | ||
|
||
var datadogPowerpackChangeTestAsserts = []string{ | ||
// Powerpack metadata | ||
"description = Created using the Datadog provider in Terraform", | ||
"widget.# = 1", | ||
"tags.# = 1", | ||
"tags.0 = tag:foo1", | ||
// Change widget | ||
"widget.0.change_definition.0.request.0.q = avg:system.load.1{env:staging} by {account}", | ||
"widget.0.change_definition.0.request.0.change_type = absolute", | ||
"widget.0.change_definition.0.request.0.compare_to = week_before", | ||
"widget.0.change_definition.0.request.0.increase_good = true", | ||
"widget.0.change_definition.0.request.0.order_by = name", | ||
"widget.0.change_definition.0.request.0.order_dir = desc", | ||
"widget.0.change_definition.0.request.0.show_present = false", | ||
"widget.0.change_definition.0.title = Widget Title", | ||
// Template Variables | ||
"template_variables.# = 1", | ||
"template_variables.0.name = datacenter", | ||
"template_variables.0.defaults.# = 1", | ||
"template_variables.0.defaults.0 = defaults", | ||
} | ||
|
||
func TestAccDatadogPowerpackChange(t *testing.T) { | ||
testAccDatadogPowerpackWidgetUtil(t, datadogPowerpackChangeTest, "datadog_powerpack.change_powerpack", datadogPowerpackChangeTestAsserts) | ||
} |