diff --git a/datadog/resource_datadog_dashboard.go b/datadog/resource_datadog_dashboard.go index d43eb28d4a..78df3bfc57 100644 --- a/datadog/resource_datadog_dashboard.go +++ b/datadog/resource_datadog_dashboard.go @@ -5530,6 +5530,9 @@ func getToplistRequestSchema() map[string]*schema.Schema { "process_query": getProcessQuerySchema(), "rum_query": getApmLogNetworkRumSecurityQuerySchema(), "security_query": getApmLogNetworkRumSecurityQuerySchema(), + // "query" and "formula" go together + "query": getFormulaQuerySchema(), + "formula": getFormulaSchema(), // Settings specific to Toplist requests "conditional_formats": { Description: "Conditional formats allow you to set the color of your widget content or background, depending on a rule applied to your data. Multiple `conditional_formats` blocks are allowed with the structure below.", @@ -5573,6 +5576,28 @@ func buildDatadogToplistRequests(terraformRequests *[]interface{}) *[]datadogV1. } else if v, ok := terraformRequest["security_query"].([]interface{}); ok && len(v) > 0 { securityQuery := v[0].(map[string]interface{}) datadogToplistRequest.SecurityQuery = buildDatadogApmOrLogQuery(securityQuery) + } else if v, ok := terraformRequest["query"].([]interface{}); ok && len(v) > 0 { + queries := make([]datadogV1.FormulaAndFunctionQueryDefinition, len(v)) + for i, q := range v { + query := q.(map[string]interface{}) + if w, ok := query["event_query"].([]interface{}); ok && len(w) > 0 { + queries[i] = buildDatadogEventQuery(w[0].(map[string]interface{})) + } else if w, ok := query["metric_query"].([]interface{}); ok && len(w) > 0 { + queries[i] = buildDatadogMetricQuery(w[0].(map[string]interface{})) + } else if w, ok := query["process_query"].([]interface{}); ok && len(w) > 0 { + queries[i] = buildDatadogFormulaAndFunctionProcessQuery(w[0].(map[string]interface{})) + } + } + datadogToplistRequest.SetQueries(queries) + // Toplist requests for formulas and functions always has a response format of "scalar" + datadogToplistRequest.SetResponseFormat(datadogV1.FormulaAndFunctionResponseFormat("scalar")) + } + if v, ok := terraformRequest["formula"].([]interface{}); ok && len(v) > 0 { + formulas := make([]datadogV1.WidgetFormula, len(v)) + for i, formula := range v { + formulas[i] = buildDatadogFormula(formula.(map[string]interface{})) + } + datadogToplistRequest.SetFormulas(formulas) } if v, ok := terraformRequest["conditional_formats"].([]interface{}); ok && len(v) != 0 { datadogToplistRequest.ConditionalFormats = buildDatadogWidgetConditionalFormat(&v) @@ -5611,6 +5636,12 @@ func buildTerraformToplistRequests(datadogToplistRequests *[]datadogV1.ToplistWi terraformQuery := buildTerraformApmOrLogQuery(*v, k.Add(fmt.Sprintf("%d.security_query.0", i))) k.Remove(fmt.Sprintf("%d.security_query.0", i)) terraformRequest["security_query"] = []map[string]interface{}{terraformQuery} + } else if v, ok := datadogRequest.GetQueriesOk(); ok { + terraformRequest["query"] = buildTerraformQuery(*v) + } + + if v, ok := datadogRequest.GetFormulasOk(); ok { + terraformRequest["formula"] = buildTerraformFormula(*v) } if v, ok := datadogRequest.GetConditionalFormatsOk(); ok { diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardTopList.freeze b/datadog/tests/cassettes/TestAccDatadogDashboardTopList.freeze index 2b35f90308..6c427570fc 100644 --- a/datadog/tests/cassettes/TestAccDatadogDashboardTopList.freeze +++ b/datadog/tests/cassettes/TestAccDatadogDashboardTopList.freeze @@ -1 +1 @@ -2021-01-28T17:18:26.777229+01:00 \ No newline at end of file +2021-04-16T13:25:09.299432-04:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardTopList.yaml b/datadog/tests/cassettes/TestAccDatadogDashboardTopList.yaml index 38ea1950d3..918de0c6aa 100644 --- a/datadog/tests/cassettes/TestAccDatadogDashboardTopList.yaml +++ b/datadog/tests/cassettes/TestAccDatadogDashboardTopList.yaml @@ -3,7 +3,7 @@ version: 1 interactions: - request: body: | - {"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"ordered","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardTopList-local-1611850706","widgets":[{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"}],"requests":[{"conditional_formats":[{"comparator":"\u003e","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, 'sum', 'desc')"}],"time":{"live_span":"1w"},"title":"Avg of system.core.user over account:prod by service,app","title_align":"right","title_size":"16","type":"toplist"}},{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"}],"requests":[{"conditional_formats":[{"comparator":"\u003e","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, 'sum', 'desc')"}],"time":{"live_span":"1w"},"title":"Avg of system.core.user over account:prod by service,app","title_align":"right","title_size":"16","type":"toplist"}}]} + {"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"ordered","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardTopList-local-1618593909","widgets":[{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"}],"requests":[{"conditional_formats":[{"comparator":"\u003e","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, 'sum', 'desc')"}],"time":{"live_span":"1w"},"title":"Avg of system.core.user over account:prod by service,app","title_align":"right","title_size":"16","type":"toplist"}},{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"}],"requests":[{"conditional_formats":[{"comparator":"\u003e","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, 'sum', 'desc')"}],"time":{"live_span":"1w"},"title":"Avg of system.core.user over account:prod by service,app","title_align":"right","title_size":"16","type":"toplist"}}]} form: {} headers: Accept: @@ -13,25 +13,11 @@ interactions: Dd-Operation-Id: - CreateDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.14 (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "3474586937219869455" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "4717693447896101402" + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/dashboard method: POST response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"qtd-b8j-nh5","title":"tf-TestAccDatadogDashboardTopList-local-1611850706","url":"/dashboard/qtd-b8j-nh5/tf-testaccdatadogdashboardtoplist-local-1611850706","created_at":"2021-01-28T16:20:42.193402+00:00","modified_at":"2021-01-28T16:20:42.193402+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":459057425848414},{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4303997253498685}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"iki-r6j-i7m","title":"tf-TestAccDatadogDashboardTopList-local-1618593909","url":"/dashboard/iki-r6j-i7m/tf-testaccdatadogdashboardtoplist-local-1618593909","created_at":"2021-04-16T17:25:10.189326+00:00","modified_at":"2021-04-16T17:25:10.189326+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":1666692195672788},{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":2972998670623026}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -42,12 +28,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 28 Jan 2021 16:20:44 GMT + - Fri, 16 Apr 2021 17:25:14 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 04-Feb-2021 16:20:42 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -55,9 +38,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - twvpGlmuom5y6A0pjGtXzTf554cmwJgTcCZ71fK4H/RDi+v5ehBK0zQiRcTJQG5C + - l8RQo2maZqJf6GFThBbKNE6dvthz6njusVtau3dPXJWL2RLFoN81H+BLPB/1xgs1 X-Dd-Version: - - "35.3796727" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -72,25 +55,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.14 (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "8850023382435756522" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "4717693447896101402" - url: https://api.datadoghq.com/api/v1/dashboard/qtd-b8j-nh5 + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/iki-r6j-i7m method: GET response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"qtd-b8j-nh5","title":"tf-TestAccDatadogDashboardTopList-local-1611850706","url":"/dashboard/qtd-b8j-nh5/tf-testaccdatadogdashboardtoplist-local-1611850706","created_at":"2021-01-28T16:20:42.193402+00:00","modified_at":"2021-01-28T16:20:42.193402+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":459057425848414},{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4303997253498685}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"iki-r6j-i7m","title":"tf-TestAccDatadogDashboardTopList-local-1618593909","url":"/dashboard/iki-r6j-i7m/tf-testaccdatadogdashboardtoplist-local-1618593909","created_at":"2021-04-16T17:25:10.189326+00:00","modified_at":"2021-04-16T17:25:10.189326+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":1666692195672788},{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":2972998670623026}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -101,12 +70,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 28 Jan 2021 16:20:44 GMT + - Fri, 16 Apr 2021 17:25:14 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 04-Feb-2021 16:20:44 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -114,9 +80,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - fIO2C4qGDheGHy4YbS+r3a3CXbh4cbRo7roILOimQyiHGjQdOat0cIpWCkupM1uX + - l8RQo2maZqJf6GFThBbKNE6dvthz6njusVtau3dPXJWL2RLFoN81H+BLPB/1xgs1 X-Dd-Version: - - "35.3796727" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -131,25 +97,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.14 (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "7564972903877129999" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "4717693447896101402" - url: https://api.datadoghq.com/api/v1/dashboard/qtd-b8j-nh5 + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/iki-r6j-i7m method: GET response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"qtd-b8j-nh5","title":"tf-TestAccDatadogDashboardTopList-local-1611850706","url":"/dashboard/qtd-b8j-nh5/tf-testaccdatadogdashboardtoplist-local-1611850706","created_at":"2021-01-28T16:20:42.193402+00:00","modified_at":"2021-01-28T16:20:42.193402+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":459057425848414},{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4303997253498685}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"iki-r6j-i7m","title":"tf-TestAccDatadogDashboardTopList-local-1618593909","url":"/dashboard/iki-r6j-i7m/tf-testaccdatadogdashboardtoplist-local-1618593909","created_at":"2021-04-16T17:25:10.189326+00:00","modified_at":"2021-04-16T17:25:10.189326+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":1666692195672788},{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":2972998670623026}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -160,12 +112,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 28 Jan 2021 16:20:48 GMT + - Fri, 16 Apr 2021 17:25:14 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 04-Feb-2021 16:20:48 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -173,9 +122,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - dPySkcOzIZtKyMKDAAzuysY3gNGGj6RtYogGuSb76E8mPvoqzREyRp6lPYm91hQU + - Wjq53IVIwnB4SiR238oOYgHFMq/ZYP0LQ/Dv8C2fFLBwTje/dWJHu6pI6vIOK1zG X-Dd-Version: - - "35.3796727" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -190,25 +139,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.14 (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "1982613260266398395" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "4717693447896101402" - url: https://api.datadoghq.com/api/v1/dashboard/qtd-b8j-nh5 + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/iki-r6j-i7m method: GET response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"qtd-b8j-nh5","title":"tf-TestAccDatadogDashboardTopList-local-1611850706","url":"/dashboard/qtd-b8j-nh5/tf-testaccdatadogdashboardtoplist-local-1611850706","created_at":"2021-01-28T16:20:42.193402+00:00","modified_at":"2021-01-28T16:20:42.193402+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":459057425848414},{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4303997253498685}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"iki-r6j-i7m","title":"tf-TestAccDatadogDashboardTopList-local-1618593909","url":"/dashboard/iki-r6j-i7m/tf-testaccdatadogdashboardtoplist-local-1618593909","created_at":"2021-04-16T17:25:10.189326+00:00","modified_at":"2021-04-16T17:25:10.189326+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":1666692195672788},{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":2972998670623026}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -219,12 +154,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 28 Jan 2021 16:21:04 GMT + - Fri, 16 Apr 2021 17:25:14 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 04-Feb-2021 16:21:04 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -232,9 +164,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - 5gfwVh/5HZ+AnGd/Di93w3NEWC6KMHT9KzmHEiRJmNdOjBtAsbOcgVFyqEChw71h + - L3ULR3HwCWYmEqCWGz2Yob3chcH4pjowBacBXkncP7o+/uPqKt9yGEYf/g1AJPzQ X-Dd-Version: - - "35.3796727" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -249,25 +181,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.14 (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "2138953504399771057" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "4717693447896101402" - url: https://api.datadoghq.com/api/v1/dashboard/qtd-b8j-nh5 + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/iki-r6j-i7m method: GET response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"qtd-b8j-nh5","title":"tf-TestAccDatadogDashboardTopList-local-1611850706","url":"/dashboard/qtd-b8j-nh5/tf-testaccdatadogdashboardtoplist-local-1611850706","created_at":"2021-01-28T16:20:42.193402+00:00","modified_at":"2021-01-28T16:20:42.193402+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":459057425848414},{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4303997253498685}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"iki-r6j-i7m","title":"tf-TestAccDatadogDashboardTopList-local-1618593909","url":"/dashboard/iki-r6j-i7m/tf-testaccdatadogdashboardtoplist-local-1618593909","created_at":"2021-04-16T17:25:10.189326+00:00","modified_at":"2021-04-16T17:25:10.189326+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":1666692195672788},{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":2972998670623026}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -278,12 +196,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 28 Jan 2021 16:21:28 GMT + - Fri, 16 Apr 2021 17:25:15 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 04-Feb-2021 16:21:28 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -291,9 +206,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - B1nwy/pPNqX+q4pQT22cdp1QCexE35IF8qwSHy0Nf7IW0Y881qtn4tXN1lpmzaKc + - vdJ3/nHEY1ioXQ6pQrBVvsQK1s4yyc+wufBMPSoXql71qZVuP/xMdtNo6DafhOAk X-Dd-Version: - - "35.3796727" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -308,18 +223,11 @@ interactions: Dd-Operation-Id: - DeleteDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.14 (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "4599864365059026236" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "4717693447896101402" - url: https://api.datadoghq.com/api/v1/dashboard/qtd-b8j-nh5 + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/iki-r6j-i7m method: DELETE response: - body: '{"deleted_dashboard_id":"qtd-b8j-nh5"}' + body: '{"deleted_dashboard_id":"iki-r6j-i7m"}' headers: Cache-Control: - no-cache @@ -330,12 +238,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 28 Jan 2021 16:21:46 GMT + - Fri, 16 Apr 2021 17:25:15 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 04-Feb-2021 16:21:46 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -343,9 +248,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - dPySkcOzIZtKyMKDAAzuysY3gNGGj6RtYogGuSb76E8mPvoqzREyRp6lPYm91hQU + - fIO2C4qGDheGHy4YbS+r3a3CXbh4cbRo7roILOimQyiHGjQdOat0cIpWCkupM1uX X-Dd-Version: - - "35.3796727" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -360,18 +265,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.14 (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "3073644178623148728" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "4717693447896101402" - url: https://api.datadoghq.com/api/v1/dashboard/qtd-b8j-nh5 + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/iki-r6j-i7m method: GET response: - body: '{"errors": ["Dashboard with ID qtd-b8j-nh5 not found"]}' + body: '{"errors": ["Dashboard with ID iki-r6j-i7m not found"]}' headers: Cache-Control: - no-cache @@ -382,7 +280,7 @@ interactions: Content-Type: - application/json Date: - - Thu, 28 Jan 2021 16:21:48 GMT + - Fri, 16 Apr 2021 17:25:15 GMT Pragma: - no-cache Strict-Transport-Security: @@ -392,7 +290,7 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Version: - - "35.3796727" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 404 Not Found diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula.freeze b/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula.freeze new file mode 100644 index 0000000000..23137d6c7e --- /dev/null +++ b/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula.freeze @@ -0,0 +1 @@ +2021-04-16T13:25:09.298892-04:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula.yaml b/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula.yaml new file mode 100644 index 0000000000..3afb358c0c --- /dev/null +++ b/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula.yaml @@ -0,0 +1,298 @@ +--- +version: 1 +interactions: +- request: + body: | + {"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"ordered","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardTopListFormula-local-1618593909","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}],"response_format":"scalar"}],"type":"toplist"}},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"queries":[{"compute":{"aggregation":"count"},"data_source":"rum","indexes":["*"],"name":"query1","search":{"query":"abc"}}],"response_format":"scalar"}],"type":"toplist"}}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + Dd-Operation-Id: + - CreateDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard + method: POST + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"n2x-25q-def","title":"tf-TestAccDatadogDashboardTopListFormula-local-1618593909","url":"/dashboard/n2x-25q-def/tf-testaccdatadogdashboardtoplistformula-local-1618593909","created_at":"2021-04-16T17:25:10.178675+00:00","modified_at":"2021-04-16T17:25:10.178675+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":7631037175834849},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6558674061820933}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:14 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - Wjq53IVIwnB4SiR238oOYgHFMq/ZYP0LQ/Dv8C2fFLBwTje/dWJHu6pI6vIOK1zG + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/n2x-25q-def + method: GET + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"n2x-25q-def","title":"tf-TestAccDatadogDashboardTopListFormula-local-1618593909","url":"/dashboard/n2x-25q-def/tf-testaccdatadogdashboardtoplistformula-local-1618593909","created_at":"2021-04-16T17:25:10.178675+00:00","modified_at":"2021-04-16T17:25:10.178675+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":7631037175834849},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6558674061820933}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:14 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - 25u1gDlL724DHllbjFT4BhOLorBTilh+aah2uWAUEjFC/+rjczJdiyWrV/HwLwe/ + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/n2x-25q-def + method: GET + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"n2x-25q-def","title":"tf-TestAccDatadogDashboardTopListFormula-local-1618593909","url":"/dashboard/n2x-25q-def/tf-testaccdatadogdashboardtoplistformula-local-1618593909","created_at":"2021-04-16T17:25:10.178675+00:00","modified_at":"2021-04-16T17:25:10.178675+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":7631037175834849},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6558674061820933}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:14 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - twvpGlmuom5y6A0pjGtXzTf554cmwJgTcCZ71fK4H/RDi+v5ehBK0zQiRcTJQG5C + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/n2x-25q-def + method: GET + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"n2x-25q-def","title":"tf-TestAccDatadogDashboardTopListFormula-local-1618593909","url":"/dashboard/n2x-25q-def/tf-testaccdatadogdashboardtoplistformula-local-1618593909","created_at":"2021-04-16T17:25:10.178675+00:00","modified_at":"2021-04-16T17:25:10.178675+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":7631037175834849},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6558674061820933}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:14 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - B1nwy/pPNqX+q4pQT22cdp1QCexE35IF8qwSHy0Nf7IW0Y881qtn4tXN1lpmzaKc + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/n2x-25q-def + method: GET + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"n2x-25q-def","title":"tf-TestAccDatadogDashboardTopListFormula-local-1618593909","url":"/dashboard/n2x-25q-def/tf-testaccdatadogdashboardtoplistformula-local-1618593909","created_at":"2021-04-16T17:25:10.178675+00:00","modified_at":"2021-04-16T17:25:10.178675+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":7631037175834849},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6558674061820933}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:15 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - twvpGlmuom5y6A0pjGtXzTf554cmwJgTcCZ71fK4H/RDi+v5ehBK0zQiRcTJQG5C + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - DeleteDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/n2x-25q-def + method: DELETE + response: + body: '{"deleted_dashboard_id":"n2x-25q-def"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:15 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - HbtaOKlJ6OCrx9tMXO6ivMTrEM+g0c93HDp08trmOmgdHozC5J+vn10F0H4WPjCU + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/n2x-25q-def + method: GET + response: + body: '{"errors": ["Dashboard with ID n2x-25q-def not found"]}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:15 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 404 Not Found + code: 404 + duration: "" diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula_import.freeze b/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula_import.freeze new file mode 100644 index 0000000000..d0398dd293 --- /dev/null +++ b/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula_import.freeze @@ -0,0 +1 @@ +2021-04-16T13:25:09.298847-04:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula_import.yaml b/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula_import.yaml new file mode 100644 index 0000000000..04470f3749 --- /dev/null +++ b/datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula_import.yaml @@ -0,0 +1,340 @@ +--- +version: 1 +interactions: +- request: + body: | + {"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"ordered","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardTopListFormula_import-local-1618593909","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}],"response_format":"scalar"}],"type":"toplist"}},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"queries":[{"compute":{"aggregation":"count"},"data_source":"rum","indexes":["*"],"name":"query1","search":{"query":"abc"}}],"response_format":"scalar"}],"type":"toplist"}}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + Dd-Operation-Id: + - CreateDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard + method: POST + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"8m8-w4i-zck","title":"tf-TestAccDatadogDashboardTopListFormula_import-local-1618593909","url":"/dashboard/8m8-w4i-zck/tf-testaccdatadogdashboardtoplistformulaimport-local-1618593909","created_at":"2021-04-16T17:25:10.190731+00:00","modified_at":"2021-04-16T17:25:10.190731+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":3925289752360287},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6057887070427033}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:13 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - HbtaOKlJ6OCrx9tMXO6ivMTrEM+g0c93HDp08trmOmgdHozC5J+vn10F0H4WPjCU + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/8m8-w4i-zck + method: GET + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"8m8-w4i-zck","title":"tf-TestAccDatadogDashboardTopListFormula_import-local-1618593909","url":"/dashboard/8m8-w4i-zck/tf-testaccdatadogdashboardtoplistformulaimport-local-1618593909","created_at":"2021-04-16T17:25:10.190731+00:00","modified_at":"2021-04-16T17:25:10.190731+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":3925289752360287},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6057887070427033}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:13 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - LcgNasIYBRkNppmD6mCKE9J6iv0eEjosuuHR5V5zw2fWbR54i39C8dhdK8zDq/40 + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/8m8-w4i-zck + method: GET + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"8m8-w4i-zck","title":"tf-TestAccDatadogDashboardTopListFormula_import-local-1618593909","url":"/dashboard/8m8-w4i-zck/tf-testaccdatadogdashboardtoplistformulaimport-local-1618593909","created_at":"2021-04-16T17:25:10.190731+00:00","modified_at":"2021-04-16T17:25:10.190731+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":3925289752360287},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6057887070427033}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:14 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - mNzaoDhdDKO7t4QSrAe5X7pHd0bJND187D+vRbwoluXouE2m1UaQQX0RGCvRpLVE + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/8m8-w4i-zck + method: GET + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"8m8-w4i-zck","title":"tf-TestAccDatadogDashboardTopListFormula_import-local-1618593909","url":"/dashboard/8m8-w4i-zck/tf-testaccdatadogdashboardtoplistformulaimport-local-1618593909","created_at":"2021-04-16T17:25:10.190731+00:00","modified_at":"2021-04-16T17:25:10.190731+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":3925289752360287},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6057887070427033}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:14 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - bgHykj7A9bfZx0Y5ZO3swhhp5tGUSNJHqFWR868+qg087CYrDOd5hQslC+noiEtH + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/8m8-w4i-zck + method: GET + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"8m8-w4i-zck","title":"tf-TestAccDatadogDashboardTopListFormula_import-local-1618593909","url":"/dashboard/8m8-w4i-zck/tf-testaccdatadogdashboardtoplistformulaimport-local-1618593909","created_at":"2021-04-16T17:25:10.190731+00:00","modified_at":"2021-04-16T17:25:10.190731+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":3925289752360287},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6057887070427033}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:14 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - Um4CoU685QqAscnxhS5BD+goWu2yX1Jd4zCfGzSsEvPPIm1qURZaF8dlLl/OEY4I + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/8m8-w4i-zck + method: GET + response: + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"8m8-w4i-zck","title":"tf-TestAccDatadogDashboardTopListFormula_import-local-1618593909","url":"/dashboard/8m8-w4i-zck/tf-testaccdatadogdashboardtoplistformulaimport-local-1618593909","created_at":"2021-04-16T17:25:10.190731+00:00","modified_at":"2021-04-16T17:25:10.190731+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":3925289752360287},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":"abc"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":6057887070427033}],"layout_type":"ordered"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:15 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - gYZcaADwbKcv7Hm19HJx6WsLoKuOijDWAt2viPeCfWqUgyKY+9e1xZdmMJeXV3YV + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - DeleteDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/8m8-w4i-zck + method: DELETE + response: + body: '{"deleted_dashboard_id":"8m8-w4i-zck"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:15 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - B1nwy/pPNqX+q4pQT22cdp1QCexE35IF8qwSHy0Nf7IW0Y881qtn4tXN1lpmzaKc + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetDashboard + User-Agent: + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/8m8-w4i-zck + method: GET + response: + body: '{"errors": ["Dashboard with ID 8m8-w4i-zck not found"]}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 16 Apr 2021 17:25:15 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Version: + - "35.4330587" + X-Frame-Options: + - SAMEORIGIN + status: 404 Not Found + code: 404 + duration: "" diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardTopList_import.freeze b/datadog/tests/cassettes/TestAccDatadogDashboardTopList_import.freeze index 8c8db9e55f..29ac1946ad 100644 --- a/datadog/tests/cassettes/TestAccDatadogDashboardTopList_import.freeze +++ b/datadog/tests/cassettes/TestAccDatadogDashboardTopList_import.freeze @@ -1 +1 @@ -2020-12-31T15:42:08.776633+01:00 \ No newline at end of file +2021-04-16T13:25:09.298871-04:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardTopList_import.yaml b/datadog/tests/cassettes/TestAccDatadogDashboardTopList_import.yaml index 9ca3a1d7f6..6d3360e4a8 100644 --- a/datadog/tests/cassettes/TestAccDatadogDashboardTopList_import.yaml +++ b/datadog/tests/cassettes/TestAccDatadogDashboardTopList_import.yaml @@ -3,7 +3,7 @@ version: 1 interactions: - request: body: | - {"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"ordered","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardTopList_import-local-1609425728","widgets":[{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"}],"requests":[{"conditional_formats":[{"comparator":"\u003e","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, 'sum', 'desc')"}],"time":{"live_span":"1w"},"title":"Avg of system.core.user over account:prod by service,app","title_align":"right","title_size":"16","type":"toplist"}}]} + {"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"ordered","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardTopList_import-local-1618593909","widgets":[{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"}],"requests":[{"conditional_formats":[{"comparator":"\u003e","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, 'sum', 'desc')"}],"time":{"live_span":"1w"},"title":"Avg of system.core.user over account:prod by service,app","title_align":"right","title_size":"16","type":"toplist"}}]} form: {} headers: Accept: @@ -13,22 +13,11 @@ interactions: Dd-Operation-Id: - CreateDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.13+dev (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "7545230185637511274" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "182813003304786368" + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/dashboard method: POST response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"5wx-4ig-eca","title":"tf-TestAccDatadogDashboardTopList_import-local-1609425728","url":"/dashboard/5wx-4ig-eca/tf-testaccdatadogdashboardtoplistimport-local-1609425728","created_at":"2020-12-31T14:45:09.976167+00:00","modified_at":"2020-12-31T14:45:09.976167+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":8468340878882443}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"xwv-u3g-gen","title":"tf-TestAccDatadogDashboardTopList_import-local-1618593909","url":"/dashboard/xwv-u3g-gen/tf-testaccdatadogdashboardtoplistimport-local-1618593909","created_at":"2021-04-16T17:25:10.207371+00:00","modified_at":"2021-04-16T17:25:10.207371+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4612504202992112}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -39,12 +28,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 31 Dec 2020 14:45:13 GMT + - Fri, 16 Apr 2021 17:25:13 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-Jan-2021 14:45:09 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -52,9 +38,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - 35J49GdWRZ44BXWQv5M8k5DMOKDsnUL/+b8VnKl01OT828ngNdfZvXJ9jRXKLHFA + - L3ULR3HwCWYmEqCWGz2Yob3chcH4pjowBacBXkncP7o+/uPqKt9yGEYf/g1AJPzQ X-Dd-Version: - - "35.3622023" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -69,22 +55,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.13+dev (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "7515356924489355202" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "182813003304786368" - url: https://api.datadoghq.com/api/v1/dashboard/5wx-4ig-eca + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/xwv-u3g-gen method: GET response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"5wx-4ig-eca","title":"tf-TestAccDatadogDashboardTopList_import-local-1609425728","url":"/dashboard/5wx-4ig-eca/tf-testaccdatadogdashboardtoplistimport-local-1609425728","created_at":"2020-12-31T14:45:09.976167+00:00","modified_at":"2020-12-31T14:45:09.976167+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":8468340878882443}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"xwv-u3g-gen","title":"tf-TestAccDatadogDashboardTopList_import-local-1618593909","url":"/dashboard/xwv-u3g-gen/tf-testaccdatadogdashboardtoplistimport-local-1618593909","created_at":"2021-04-16T17:25:10.207371+00:00","modified_at":"2021-04-16T17:25:10.207371+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4612504202992112}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -95,12 +70,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 31 Dec 2020 14:45:13 GMT + - Fri, 16 Apr 2021 17:25:13 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-Jan-2021 14:45:13 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -108,9 +80,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - 0EJutvpOrBJC63ni/O57leUa99Oey4n8MQPI1nQqGf8zcU0cRqWsvs49QUsgOTGg + - fIO2C4qGDheGHy4YbS+r3a3CXbh4cbRo7roILOimQyiHGjQdOat0cIpWCkupM1uX X-Dd-Version: - - "35.3622023" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -125,22 +97,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.13+dev (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "4564305196736749930" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "182813003304786368" - url: https://api.datadoghq.com/api/v1/dashboard/5wx-4ig-eca + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/xwv-u3g-gen method: GET response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"5wx-4ig-eca","title":"tf-TestAccDatadogDashboardTopList_import-local-1609425728","url":"/dashboard/5wx-4ig-eca/tf-testaccdatadogdashboardtoplistimport-local-1609425728","created_at":"2020-12-31T14:45:09.976167+00:00","modified_at":"2020-12-31T14:45:09.976167+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":8468340878882443}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"xwv-u3g-gen","title":"tf-TestAccDatadogDashboardTopList_import-local-1618593909","url":"/dashboard/xwv-u3g-gen/tf-testaccdatadogdashboardtoplistimport-local-1618593909","created_at":"2021-04-16T17:25:10.207371+00:00","modified_at":"2021-04-16T17:25:10.207371+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4612504202992112}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -151,12 +112,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 31 Dec 2020 14:45:19 GMT + - Fri, 16 Apr 2021 17:25:14 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-Jan-2021 14:45:19 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -164,9 +122,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - a52+bkva5fMDFMmi2v17bUHPljQFhzXPnsLiGGP3HLm+LCaJfIpSjqgfWqa8LIOd + - dPySkcOzIZtKyMKDAAzuysY3gNGGj6RtYogGuSb76E8mPvoqzREyRp6lPYm91hQU X-Dd-Version: - - "35.3622023" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -181,22 +139,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.13+dev (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "6980661811731995283" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "182813003304786368" - url: https://api.datadoghq.com/api/v1/dashboard/5wx-4ig-eca + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/xwv-u3g-gen method: GET response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"5wx-4ig-eca","title":"tf-TestAccDatadogDashboardTopList_import-local-1609425728","url":"/dashboard/5wx-4ig-eca/tf-testaccdatadogdashboardtoplistimport-local-1609425728","created_at":"2020-12-31T14:45:09.976167+00:00","modified_at":"2020-12-31T14:45:09.976167+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":8468340878882443}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"xwv-u3g-gen","title":"tf-TestAccDatadogDashboardTopList_import-local-1618593909","url":"/dashboard/xwv-u3g-gen/tf-testaccdatadogdashboardtoplistimport-local-1618593909","created_at":"2021-04-16T17:25:10.207371+00:00","modified_at":"2021-04-16T17:25:10.207371+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4612504202992112}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -207,12 +154,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 31 Dec 2020 14:45:24 GMT + - Fri, 16 Apr 2021 17:25:14 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-Jan-2021 14:45:24 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -220,9 +164,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - XhN3sROXhRtxvw2F+uRtJTWMwUQRYhDKBCNr1DfCqtzQgh490ZXtNSOhIx1TzG8K + - tpRCH6w417YjBovRJ8VmtuXmNONVYiRp2c8d2AxjPdGBn8PCtgG4vAztrx3qUZAN X-Dd-Version: - - "35.3622023" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -237,22 +181,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.13+dev (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "3466901467604006553" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "182813003304786368" - url: https://api.datadoghq.com/api/v1/dashboard/5wx-4ig-eca + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/xwv-u3g-gen method: GET response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"5wx-4ig-eca","title":"tf-TestAccDatadogDashboardTopList_import-local-1609425728","url":"/dashboard/5wx-4ig-eca/tf-testaccdatadogdashboardtoplistimport-local-1609425728","created_at":"2020-12-31T14:45:09.976167+00:00","modified_at":"2020-12-31T14:45:09.976167+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":8468340878882443}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"xwv-u3g-gen","title":"tf-TestAccDatadogDashboardTopList_import-local-1618593909","url":"/dashboard/xwv-u3g-gen/tf-testaccdatadogdashboardtoplistimport-local-1618593909","created_at":"2021-04-16T17:25:10.207371+00:00","modified_at":"2021-04-16T17:25:10.207371+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4612504202992112}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -263,12 +196,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 31 Dec 2020 14:45:26 GMT + - Fri, 16 Apr 2021 17:25:14 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-Jan-2021 14:45:25 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -276,9 +206,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - 6YI14yy1UIYAi82dujc7/xgv6937EWLOlBHoHTAQSms4rn791eBn4DrROxMzXWWv + - Um4CoU685QqAscnxhS5BD+goWu2yX1Jd4zCfGzSsEvPPIm1qURZaF8dlLl/OEY4I X-Dd-Version: - - "35.3622023" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -293,22 +223,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.13+dev (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "5523340062381548543" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "182813003304786368" - url: https://api.datadoghq.com/api/v1/dashboard/5wx-4ig-eca + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/xwv-u3g-gen method: GET response: - body: '{"notify_list":[],"description":"Created using the Datadog provider in - Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"5wx-4ig-eca","title":"tf-TestAccDatadogDashboardTopList_import-local-1609425728","url":"/dashboard/5wx-4ig-eca/tf-testaccdatadogdashboardtoplistimport-local-1609425728","created_at":"2020-12-31T14:45:09.976167+00:00","modified_at":"2020-12-31T14:45:09.976167+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test - Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over - account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} - by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":8468340878882443}],"layout_type":"ordered"}' + body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"xwv-u3g-gen","title":"tf-TestAccDatadogDashboardTopList_import-local-1618593909","url":"/dashboard/xwv-u3g-gen/tf-testaccdatadogdashboardtoplistimport-local-1618593909","created_at":"2021-04-16T17:25:10.207371+00:00","modified_at":"2021-04-16T17:25:10.207371+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"custom_links":[{"link":"https://app.datadoghq.com/dashboard/lists","label":"Test Custom Link label"}],"title_size":"16","title":"Avg of system.core.user over account:prod by service,app","title_align":"right","time":{"live_span":"1w"},"requests":[{"q":"top(avg:system.core.user{account:prod} by {service,app}, 10, ''sum'', ''desc'')","conditional_formats":[{"palette":"white_on_red","hide_value":false,"value":15000,"comparator":">"}]}],"type":"toplist"},"id":4612504202992112}],"layout_type":"ordered"}' headers: Cache-Control: - no-cache @@ -319,12 +238,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 31 Dec 2020 14:45:28 GMT + - Fri, 16 Apr 2021 17:25:14 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-Jan-2021 14:45:28 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -332,9 +248,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - lqMB0JFM99VhRtxXIpWUr9JgjDFKxnlkUv1nxFsIcQfFO0NMuI7D2Hh8tiSgYzCo + - SY1h8ScsWq+kYmtbh63ltMLFAZsQjqfrgvdfAoRX+9TzT1sgMBRYaFRwfWWRRe9a X-Dd-Version: - - "35.3622023" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -349,18 +265,11 @@ interactions: Dd-Operation-Id: - DeleteDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.13+dev (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "3770605595910992309" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "182813003304786368" - url: https://api.datadoghq.com/api/v1/dashboard/5wx-4ig-eca + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/xwv-u3g-gen method: DELETE response: - body: '{"deleted_dashboard_id":"5wx-4ig-eca"}' + body: '{"deleted_dashboard_id":"xwv-u3g-gen"}' headers: Cache-Control: - no-cache @@ -371,12 +280,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 31 Dec 2020 14:45:33 GMT + - Fri, 16 Apr 2021 17:25:15 GMT Pragma: - no-cache - Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-Jan-2021 14:45:33 GMT; - secure; HttpOnly Strict-Transport-Security: - max-age=15724800; Vary: @@ -384,9 +290,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - iGG1BKNRTmPfZ6ji2H3Z/xn9c4eIM8cOugS+JJDlp5xOVDa6tvCgtO3MGJFoLiiG + - Um4CoU685QqAscnxhS5BD+goWu2yX1Jd4zCfGzSsEvPPIm1qURZaF8dlLl/OEY4I X-Dd-Version: - - "35.3622023" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -401,18 +307,11 @@ interactions: Dd-Operation-Id: - GetDashboard User-Agent: - - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) - datadog-api-client-go/1.0.0-beta.13+dev (go go1.15.4; os darwin; arch amd64) - X-Datadog-Parent-Id: - - "277457801201243499" - X-Datadog-Sampling-Priority: - - "1" - X-Datadog-Trace-Id: - - "182813003304786368" - url: https://api.datadoghq.com/api/v1/dashboard/5wx-4ig-eca + - terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.19+dev (go go1.15.6; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/dashboard/xwv-u3g-gen method: GET response: - body: '{"errors": ["Dashboard with ID 5wx-4ig-eca not found"]}' + body: '{"errors": ["Dashboard with ID xwv-u3g-gen not found"]}' headers: Cache-Control: - no-cache @@ -423,7 +322,7 @@ interactions: Content-Type: - application/json Date: - - Thu, 31 Dec 2020 14:45:34 GMT + - Fri, 16 Apr 2021 17:25:15 GMT Pragma: - no-cache Strict-Transport-Security: @@ -433,7 +332,7 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Version: - - "35.3622023" + - "35.4330587" X-Frame-Options: - SAMEORIGIN status: 404 Not Found diff --git a/datadog/tests/resource_datadog_dashboard_top_list_test.go b/datadog/tests/resource_datadog_dashboard_top_list_test.go index c6d7c1350b..db26826210 100644 --- a/datadog/tests/resource_datadog_dashboard_top_list_test.go +++ b/datadog/tests/resource_datadog_dashboard_top_list_test.go @@ -86,6 +86,71 @@ resource "datadog_dashboard" "top_list_dashboard" { } ` +const datadogDashboardTopListFormulaConfig = ` +resource "datadog_dashboard" "top_list_dashboard" { + title = "{{uniq}}" + description = "Created using the Datadog provider in Terraform" + layout_type = "ordered" + is_read_only = "true" + widget { + toplist_definition { + request { + formula { + formula_expression = "query1 + query2" + limit { + count = 10 + order = "asc" + } + } + query { + metric_query { + data_source = "metrics" + query = "avg:system.cpu.system{*} by {datacenter}" + name = "query1" + aggregator = "sum" + } + } + query { + metric_query { + data_source = "metrics" + query = "avg:system.load.1{*} by {datacenter}" + name = "query2" + aggregator = "sum" + } + } + } + } + } + widget { + toplist_definition { + request { + formula { + formula_expression = "query1" + limit { + count = 25 + order = "desc" + } + } + query { + event_query { + data_source = "rum" + indexes = ["*"] + name = "query1" + compute { + aggregation = "count" + } + search { + query = "abc" + } + } + } + } + } + } + +} +` + var datadogDashboardTopListAsserts = []string{ "description = Created using the Datadog provider in Terraform", "widget.0.toplist_definition.0.request.0.conditional_formats.0.timeframe =", @@ -128,6 +193,33 @@ var datadogDashboardTopListAsserts = []string{ "widget.1.toplist_definition.0.custom_link.0.link = https://app.datadoghq.com/dashboard/lists", } +var datadogDashboardTopListFormulaAsserts = []string{ + "title = {{uniq}}", + "is_read_only = true", + "layout_type = ordered", + "description = Created using the Datadog provider in Terraform", + "widget.0.toplist_definition.0.request.0.formula.0.formula_expression = query1 + query2", + "widget.0.toplist_definition.0.request.0.formula.0.limit.0.count = 10", + "widget.0.toplist_definition.0.request.0.formula.0.limit.0.order = asc", + "widget.0.toplist_definition.0.request.0.query.0.metric_query.0.data_source = metrics", + "widget.0.toplist_definition.0.request.0.query.0.metric_query.0.query = avg:system.cpu.system{*} by {datacenter}", + "widget.0.toplist_definition.0.request.0.query.0.metric_query.0.name = query1", + "widget.0.toplist_definition.0.request.0.query.0.metric_query.0.aggregator = sum", + "widget.0.toplist_definition.0.request.0.query.1.metric_query.0.data_source = metrics", + "widget.0.toplist_definition.0.request.0.query.1.metric_query.0.query = avg:system.load.1{*} by {datacenter}", + "widget.0.toplist_definition.0.request.0.query.1.metric_query.0.name = query2", + "widget.0.toplist_definition.0.request.0.query.1.metric_query.0.aggregator = sum", + "widget.1.toplist_definition.0.request.0.formula.0.formula_expression = query1", + "widget.1.toplist_definition.0.request.0.formula.0.limit.0.count = 25", + "widget.1.toplist_definition.0.request.0.formula.0.limit.0.order = desc", + "widget.1.toplist_definition.0.request.0.query.0.event_query.0.data_source = rum", + "widget.1.toplist_definition.0.request.0.query.0.event_query.0.indexes.# = 1", + "widget.1.toplist_definition.0.request.0.query.0.event_query.0.indexes.0 = *", + "widget.1.toplist_definition.0.request.0.query.0.event_query.0.name = query1", + "widget.1.toplist_definition.0.request.0.query.0.event_query.0.search.0.query = abc", + "widget.1.toplist_definition.0.request.0.query.0.event_query.0.compute.0.aggregation = count", +} + func TestAccDatadogDashboardTopList(t *testing.T) { testAccDatadogDashboardWidgetUtil(t, datadogDashboardTopListConfig, "datadog_dashboard.top_list_dashboard", datadogDashboardTopListAsserts) } @@ -135,3 +227,11 @@ func TestAccDatadogDashboardTopList(t *testing.T) { func TestAccDatadogDashboardTopList_import(t *testing.T) { testAccDatadogDashboardWidgetUtilImport(t, datadogDashboardTopListConfigImport, "datadog_dashboard.top_list_dashboard") } + +func TestAccDatadogDashboardTopListFormula(t *testing.T) { + testAccDatadogDashboardWidgetUtil(t, datadogDashboardTopListFormulaConfig, "datadog_dashboard.top_list_dashboard", datadogDashboardTopListFormulaAsserts) +} + +func TestAccDatadogDashboardTopListFormula_import(t *testing.T) { + testAccDatadogDashboardWidgetUtilImport(t, datadogDashboardTopListFormulaConfig, "datadog_dashboard.top_list_dashboard") +} diff --git a/docs/resources/dashboard.md b/docs/resources/dashboard.md index 15060c91da..d34964e5e9 100644 --- a/docs/resources/dashboard.md +++ b/docs/resources/dashboard.md @@ -5890,9 +5890,11 @@ Optional: - **apm_query** (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--apm_query)) - **conditional_formats** (Block List) Conditional formats allow you to set the color of your widget content or background, depending on a rule applied to your data. Multiple `conditional_formats` blocks are allowed with the structure below. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--conditional_formats)) +- **formula** (Block List) (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--formula)) - **log_query** (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--log_query)) - **process_query** (Block List, Max: 1) The process query to use in the widget. The structure of this block is described below. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--process_query)) - **q** (String) The metric query to use for this widget. +- **query** (Block List) (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--query)) - **rum_query** (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--rum_query)) - **security_query** (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--security_query)) - **style** (Block List, Max: 1) Define request widget style. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--style)) @@ -5983,6 +5985,28 @@ Optional: - **timeframe** (String) Defines the displayed timeframe. + +### Nested Schema for `widget.group_definition.widget.id.request.style` + +Required: + +- **formula_expression** (String) String expression built from queries, formulas and functions. + +Optional: + +- **alias** (String) Expression alias. +- **limit** (Block List, Max: 1) Options for limiting results returned. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--style--limit)) + + +### Nested Schema for `widget.group_definition.widget.id.request.style.limit` + +Optional: + +- **count** (Number) Number of results to return +- **order** (String) Direction of sort. + + + ### Nested Schema for `widget.group_definition.widget.id.request.style` @@ -6064,6 +6088,112 @@ Optional: - **search_by** (String) Your chosen search term. + +### Nested Schema for `widget.group_definition.widget.id.request.style` + +Optional: + +- **event_query** (Block List, Max: 1) A timeseries formula and functions events query. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--style--event_query)) +- **metric_query** (Block List, Max: 1) A timeseries formula and functions metrics query. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--style--metric_query)) +- **process_query** (Block List, Max: 1) Process query using formulas and functions. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--style--process_query)) + + +### Nested Schema for `widget.group_definition.widget.id.request.style.process_query` + +Required: + +- **compute** (Block List, Min: 1) Compute options. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--style--process_query--compute)) +- **data_source** (String) Data source for event platform-based queries. +- **name** (String) Name of query for use in formulas. + +Optional: + +- **group_by** (Block List) Group by options. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--style--process_query--group_by)) +- **indexes** (List of String) An array of index names to query in the stream. +- **search** (Block List, Max: 1) Search options. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--style--process_query--search)) + + +### Nested Schema for `widget.group_definition.widget.id.request.style.process_query.search` + +Required: + +- **aggregation** (String) Aggregation methods for event platform queries. + +Optional: + +- **interval** (Number) A time interval in milliseconds. +- **metric** (String) Measurable attribute to compute. + + + +### Nested Schema for `widget.group_definition.widget.id.request.style.process_query.search` + +Required: + +- **facet** (String) Event facet. + +Optional: + +- **limit** (Number) Number of groups to return. +- **sort** (Block List, Max: 1) Options for sorting group by results. (see [below for nested schema](#nestedblock--widget--group_definition--widget--id--request--style--process_query--search--sort)) + + +### Nested Schema for `widget.group_definition.widget.id.request.style.process_query.search.sort` + +Required: + +- **aggregation** (String) Aggregation methods for event platform queries. + +Optional: + +- **metric** (String) Metric used for sorting group by results. +- **order** (String) Direction of sort. + + + + +### Nested Schema for `widget.group_definition.widget.id.request.style.process_query.search` + +Required: + +- **query** (String) Events search string. + + + + +### Nested Schema for `widget.group_definition.widget.id.request.style.process_query` + +Required: + +- **name** (String) Name of the query for use in formulas. +- **query** (String) Metrics query definition. + +Optional: + +- **aggregator** (String) The aggregation methods available for metrics queries. +- **data_source** (String) Data source for metrics queries. + + + +### Nested Schema for `widget.group_definition.widget.id.request.style.process_query` + +Required: + +- **data_source** (String) Data source for process queries. +- **metric** (String) Process metric name. +- **name** (String) Name of query for use in formulas. + +Optional: + +- **aggregator** (String) The aggregation methods available for metrics queries. +- **is_normalized_cpu** (Boolean) Whether to normalize the CPU percentages. +- **limit** (Number) Number of hits to return. +- **sort** (String) Direction of sort. +- **tag_filters** (List of String) An array of tags to filter by. +- **text_filter** (String) Text to use as filter. + + + ### Nested Schema for `widget.group_definition.widget.id.request.style` @@ -9500,9 +9630,11 @@ Optional: - **apm_query** (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--apm_query)) - **conditional_formats** (Block List) Conditional formats allow you to set the color of your widget content or background, depending on a rule applied to your data. Multiple `conditional_formats` blocks are allowed with the structure below. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--conditional_formats)) +- **formula** (Block List) (see [below for nested schema](#nestedblock--widget--toplist_definition--request--formula)) - **log_query** (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--log_query)) - **process_query** (Block List, Max: 1) The process query to use in the widget. The structure of this block is described below. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--process_query)) - **q** (String) The metric query to use for this widget. +- **query** (Block List) (see [below for nested schema](#nestedblock--widget--toplist_definition--request--query)) - **rum_query** (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--rum_query)) - **security_query** (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--security_query)) - **style** (Block List, Max: 1) Define request widget style. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--style)) @@ -9593,6 +9725,28 @@ Optional: - **timeframe** (String) Defines the displayed timeframe. + +### Nested Schema for `widget.toplist_definition.request.style` + +Required: + +- **formula_expression** (String) String expression built from queries, formulas and functions. + +Optional: + +- **alias** (String) Expression alias. +- **limit** (Block List, Max: 1) Options for limiting results returned. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--style--limit)) + + +### Nested Schema for `widget.toplist_definition.request.style.limit` + +Optional: + +- **count** (Number) Number of results to return +- **order** (String) Direction of sort. + + + ### Nested Schema for `widget.toplist_definition.request.style` @@ -9674,6 +9828,112 @@ Optional: - **search_by** (String) Your chosen search term. + +### Nested Schema for `widget.toplist_definition.request.style` + +Optional: + +- **event_query** (Block List, Max: 1) A timeseries formula and functions events query. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--style--event_query)) +- **metric_query** (Block List, Max: 1) A timeseries formula and functions metrics query. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--style--metric_query)) +- **process_query** (Block List, Max: 1) Process query using formulas and functions. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--style--process_query)) + + +### Nested Schema for `widget.toplist_definition.request.style.event_query` + +Required: + +- **compute** (Block List, Min: 1) Compute options. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--style--event_query--compute)) +- **data_source** (String) Data source for event platform-based queries. +- **name** (String) Name of query for use in formulas. + +Optional: + +- **group_by** (Block List) Group by options. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--style--event_query--group_by)) +- **indexes** (List of String) An array of index names to query in the stream. +- **search** (Block List, Max: 1) Search options. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--style--event_query--search)) + + +### Nested Schema for `widget.toplist_definition.request.style.event_query.search` + +Required: + +- **aggregation** (String) Aggregation methods for event platform queries. + +Optional: + +- **interval** (Number) A time interval in milliseconds. +- **metric** (String) Measurable attribute to compute. + + + +### Nested Schema for `widget.toplist_definition.request.style.event_query.search` + +Required: + +- **facet** (String) Event facet. + +Optional: + +- **limit** (Number) Number of groups to return. +- **sort** (Block List, Max: 1) Options for sorting group by results. (see [below for nested schema](#nestedblock--widget--toplist_definition--request--style--event_query--search--sort)) + + +### Nested Schema for `widget.toplist_definition.request.style.event_query.search.sort` + +Required: + +- **aggregation** (String) Aggregation methods for event platform queries. + +Optional: + +- **metric** (String) Metric used for sorting group by results. +- **order** (String) Direction of sort. + + + + +### Nested Schema for `widget.toplist_definition.request.style.event_query.search` + +Required: + +- **query** (String) Events search string. + + + + +### Nested Schema for `widget.toplist_definition.request.style.metric_query` + +Required: + +- **name** (String) Name of the query for use in formulas. +- **query** (String) Metrics query definition. + +Optional: + +- **aggregator** (String) The aggregation methods available for metrics queries. +- **data_source** (String) Data source for metrics queries. + + + +### Nested Schema for `widget.toplist_definition.request.style.process_query` + +Required: + +- **data_source** (String) Data source for process queries. +- **metric** (String) Process metric name. +- **name** (String) Name of query for use in formulas. + +Optional: + +- **aggregator** (String) The aggregation methods available for metrics queries. +- **is_normalized_cpu** (Boolean) Whether to normalize the CPU percentages. +- **limit** (Number) Number of hits to return. +- **sort** (String) Direction of sort. +- **tag_filters** (List of String) An array of tags to filter by. +- **text_filter** (String) Text to use as filter. + + + ### Nested Schema for `widget.toplist_definition.request.style`