From 5eef67bfb23e49659fc6479337b015776a3ba5b9 Mon Sep 17 00:00:00 2001 From: Hyung Lee Date: Thu, 19 Sep 2024 16:30:01 -0400 Subject: [PATCH] refactor and bug fix --- datadog/resource_datadog_dashboard.go | 178 +++++++-------- ...gDashboardQueryTableWithTextFormats.freeze | 2 +- ...dogDashboardQueryTableWithTextFormats.yaml | 214 +++++++++++++++++- ...ardQueryTableWithTextFormats_import.freeze | 2 +- ...boardQueryTableWithTextFormats_import.yaml | 214 +++++++++++++++++- ...urce_datadog_dashboard_query_table_test.go | 58 +++-- docs/resources/dashboard.md | 148 +----------- docs/resources/powerpack.md | 40 +--- 8 files changed, 545 insertions(+), 311 deletions(-) diff --git a/datadog/resource_datadog_dashboard.go b/datadog/resource_datadog_dashboard.go index 53c5d37489..2f3b27bc4d 100644 --- a/datadog/resource_datadog_dashboard.go +++ b/datadog/resource_datadog_dashboard.go @@ -4626,8 +4626,13 @@ func buildDatadogQueryTableRequests(terraformRequests *[]interface{}) *[]datadog } datadogQueryTableRequest.CellDisplayMode = datadogCellDisplayMode } - if v, ok := terraformRequest["text_formats"].([][]interface{}); ok && len(v) != 0 { - datadogQueryTableRequest.TextFormats = *buildDatadogQueryTableTextFormat(&v) + if v, ok := terraformRequest["text_formats"].([]interface{}); ok && len(v) != 0 { + datadogQueryTableRequest.TextFormats = make([][]datadogV1.TableWidgetTextFormatRule, len(v)) + for i, textFormat := range v { + if w, ok := textFormat.([]interface{}); ok { + datadogQueryTableRequest.TextFormats[i] = *buildDatadogQueryTableTextFormat(&w) + } + } } datadogRequests[i] = *datadogQueryTableRequest } @@ -4690,7 +4695,11 @@ func buildTerraformQueryTableRequests(datadogQueryTableRequests *[]datadogV1.Tab terraformRequest["cell_display_mode"] = terraformCellDisplayMode } if v, ok := datadogRequest.GetTextFormatsOk(); ok { - terraformTextFormats := buildTerraformQueryTableTextFormat(v) + terraformTextFormats := make([][]map[string]interface{}, len(*v)) + for i, textFormat := range *v { + test := buildTerraformQueryTableTextFormat(&textFormat) + terraformTextFormats[i] = *test + } terraformRequest["text_formats"] = terraformTextFormats } terraformRequests[i] = terraformRequest @@ -4698,110 +4707,85 @@ func buildTerraformQueryTableRequests(datadogQueryTableRequests *[]datadogV1.Tab return &terraformRequests } -// Widget Text Format helpers -func buildDatadogQueryTableTextFormat(terraformQueryTableTextFormat *[][]interface{}) *[][]datadogV1.TableWidgetTextFormatRule { - datadogQueryTableTextFormat := make([][]datadogV1.TableWidgetTextFormatRule, len(*terraformQueryTableTextFormat)) - for i, textFormatArray := range *terraformQueryTableTextFormat { - terraformTextFormatArray := make([]datadogV1.TableWidgetTextFormatRule, len(textFormatArray)) - for j, textFormatRule := range textFormatArray { - terraformTextFormatRule := textFormatRule.(map[string]interface{}) - terraformTextFormatMatch := terraformTextFormatRule["match"].(map[string]interface{}) - datadogMatch := datadogV1.NewTableWidgetTextFormatMatch(datadogV1.TableWidgetTextFormatMatchType(terraformTextFormatMatch["type"].(string)), terraformTextFormatMatch["value"].(string)) - datadogTextFormatRule := datadogV1.NewTableWidgetTextFormatRule(*datadogMatch) - // Optional - if v, ok := terraformTextFormatRule["replace"].(interface{}); ok { - switch v.(type) { - case datadogV1.TableWidgetTextFormatReplaceAll: - datadogReplace := v.(datadogV1.TableWidgetTextFormatReplaceAll) - datadogTextFormatRule.SetReplace(datadogV1.TableWidgetTextFormatReplaceAllAsTableWidgetTextFormatReplace(&datadogReplace)) - case datadogV1.TableWidgetTextFormatReplaceSubstring: - datadogReplace := v.(datadogV1.TableWidgetTextFormatReplaceSubstring) - datadogTextFormatRule.SetReplace(datadogV1.TableWidgetTextFormatReplaceSubstringAsTableWidgetTextFormatReplace(&datadogReplace)) - default: +// Query Table Widget Text Format Helpers +func buildDatadogQueryTableTextFormat(terraformQueryTableTextFormat *[]interface{}) *[]datadogV1.TableWidgetTextFormatRule { + datadogQueryTableTextFormat := make([]datadogV1.TableWidgetTextFormatRule, len(*terraformQueryTableTextFormat)) + for j, textFormatRule := range *terraformQueryTableTextFormat { + terraformTextFormatRule := textFormatRule.(map[string]interface{}) + terraformTextFormatMatch := terraformTextFormatRule["match"].(map[string]interface{}) + datadogMatch := datadogV1.NewTableWidgetTextFormatMatch(datadogV1.TableWidgetTextFormatMatchType(terraformTextFormatMatch["type"].(string)), terraformTextFormatMatch["value"].(string)) + datadogTextFormatRule := datadogV1.NewTableWidgetTextFormatRule(*datadogMatch) + // Optional + if v, ok := terraformTextFormatRule["replace"].(map[string]interface{}); ok { + if w, ok := v["type"].(string); ok && len(w) != 0 { + switch w { + case "all": + datadogReplace := datadogV1.NewTableWidgetTextFormatReplaceAll(datadogV1.TABLEWIDGETTEXTFORMATREPLACEALLTYPE_ALL, v["with"].(string)) + datadogTextFormatRule.SetReplace(datadogV1.TableWidgetTextFormatReplaceAllAsTableWidgetTextFormatReplace(datadogReplace)) + case "substring": + datadogReplace := datadogV1.NewTableWidgetTextFormatReplaceSubstring(v["substring"].(string), datadogV1.TABLEWIDGETTEXTFORMATREPLACESUBSTRINGTYPE_SUBSTRING, v["with"].(string)) + datadogTextFormatRule.SetReplace(datadogV1.TableWidgetTextFormatReplaceSubstringAsTableWidgetTextFormatReplace(datadogReplace)) } } - if v, ok := terraformTextFormatRule["palette"].(string); ok && len(v) != 0 { - datadogTextFormatRule.SetPalette(datadogV1.TableWidgetTextFormatPalette(v)) - } - if v, ok := terraformTextFormatRule["custom_bg_color"].(string); ok && len(v) != 0 { - datadogTextFormatRule.SetCustomBgColor(v) - } - if v, ok := terraformTextFormatRule["custom_fg_color"].(string); ok && len(v) != 0 { - datadogTextFormatRule.SetCustomFgColor(v) - } - terraformTextFormatArray[j] = *datadogTextFormatRule + } else { + datadogTextFormatRule.Replace = nil + } + if v, ok := terraformTextFormatRule["palette"].(string); ok && len(v) != 0 { + datadogTextFormatRule.SetPalette(datadogV1.TableWidgetTextFormatPalette(v)) + } else { + datadogTextFormatRule.Palette = nil + } + if v, ok := terraformTextFormatRule["custom_bg_color"].(string); ok && len(v) != 0 { + datadogTextFormatRule.SetCustomBgColor(v) + } else { + datadogTextFormatRule.CustomBgColor = nil + } + if v, ok := terraformTextFormatRule["custom_fg_color"].(string); ok && len(v) != 0 { + datadogTextFormatRule.SetCustomFgColor(v) + } else { + datadogTextFormatRule.CustomFgColor = nil } - datadogQueryTableTextFormat[i] = terraformTextFormatArray + datadogQueryTableTextFormat[j] = *datadogTextFormatRule } return &datadogQueryTableTextFormat } -func buildTerraformQueryTableTextFormat(datadogQueryTableTextFormats *[][]datadogV1.TableWidgetTextFormatRule) *[][]map[string]interface{} { - terraformQueryTableTextFormats := make([][]map[string]interface{}, len(*datadogQueryTableTextFormats)) - for i, datadogQueryTableTextFormatRuleArray := range *datadogQueryTableTextFormats { - terraformQueryTableTextFormatRuleArray := make([]map[string]interface{}, len(datadogQueryTableTextFormatRuleArray)) - for j, datadogQueryTableTextFormatRule := range datadogQueryTableTextFormatRuleArray { - terraformQueryTableTextFormatRule := map[string]interface{}{} - // Required params - terraformQueryTableTextFormatRule["match"] = datadogQueryTableTextFormatRule.GetMatch() - // Optional params - if v, ok := datadogQueryTableTextFormatRule.GetReplaceOk(); ok { - terraformQueryTableTextFormatRule["replace"] = v - } - if v, ok := datadogQueryTableTextFormatRule.GetPaletteOk(); ok { - terraformQueryTableTextFormatRule["palette"] = v - } - if v, ok := datadogQueryTableTextFormatRule.GetCustomBgColorOk(); ok { - terraformQueryTableTextFormatRule["custom_bg_color"] = v +func buildTerraformQueryTableTextFormat(datadogQueryTableTextFormat *[]datadogV1.TableWidgetTextFormatRule) *[]map[string]interface{} { + terraformQueryTableTextFormat := make([]map[string]interface{}, len(*datadogQueryTableTextFormat)) + for i, datadogQueryTableTextFormatRule := range *datadogQueryTableTextFormat { + terraformQueryTableTextFormatRule := map[string]interface{}{} + // Required params + match := make(map[string]interface{}) + match["type"] = datadogQueryTableTextFormatRule.GetMatch().Type + match["value"] = datadogQueryTableTextFormatRule.GetMatch().Value + terraformQueryTableTextFormatRule["match"] = match + // Optional params + if v, ok := datadogQueryTableTextFormatRule.GetReplaceOk(); ok { + if v.TableWidgetTextFormatReplaceAll != nil { + replace := make(map[string]interface{}) + replace["type"] = v.TableWidgetTextFormatReplaceAll.Type + replace["with"] = v.TableWidgetTextFormatReplaceAll.With + terraformQueryTableTextFormatRule["replace"] = replace } - if v, ok := datadogQueryTableTextFormatRule.GetCustomFgColorOk(); ok { - terraformQueryTableTextFormatRule["custom_fg_color"] = v + if v.TableWidgetTextFormatReplaceSubstring != nil { + replace := make(map[string]interface{}) + replace["type"] = v.TableWidgetTextFormatReplaceSubstring.Type + replace["with"] = v.TableWidgetTextFormatReplaceSubstring.With + replace["substring"] = v.TableWidgetTextFormatReplaceSubstring.Substring + terraformQueryTableTextFormatRule["replace"] = replace } - terraformQueryTableTextFormatRuleArray[j] = terraformQueryTableTextFormatRule } - terraformQueryTableTextFormats[i] = terraformQueryTableTextFormatRuleArray - } - return &terraformQueryTableTextFormats -} - -// Table Widget Text Format helpers - -func getQueryTableFormatRuleSchema() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "match": { - Type: schema.TypeList, - MaxItems: 1, - Optional: true, - Description: "Match rule for the table widget text format.", - Elem: &schema.Resource{ - Schema: getTableWidgetTextFormatMatchSchema(), - }, - }, - "palette": { - Description: "The color palette to apply.", - Type: schema.TypeString, - ValidateDiagFunc: validators.ValidateEnumValue(datadogV1.NewTableWidgetTextFormatPaletteFromValue), - Required: true, - }, - "replace": { - Type: schema.TypeList, - MaxItems: 1, - Optional: true, - Description: "Match rule for the table widget text format.", - Elem: &schema.Resource{ - Schema: getTableWidgetTextFormatReplaceSchema(), - }, - }, - "custom_bg_color": { - Description: "The custom color palette to apply to the background.", - Type: schema.TypeString, - Optional: true, - }, - "custom_fg_color": { - Description: "The custom color palette to apply to the foreground text.", - Type: schema.TypeString, - Optional: true, - }, + if v, ok := datadogQueryTableTextFormatRule.GetPaletteOk(); ok { + terraformQueryTableTextFormatRule["palette"] = v + } + if v, ok := datadogQueryTableTextFormatRule.GetCustomBgColorOk(); ok { + terraformQueryTableTextFormatRule["custom_bg_color"] = v + } + if v, ok := datadogQueryTableTextFormatRule.GetCustomFgColorOk(); ok { + terraformQueryTableTextFormatRule["custom_fg_color"] = v + } + terraformQueryTableTextFormat[i] = terraformQueryTableTextFormatRule } + return &terraformQueryTableTextFormat } func getTableWidgetTextFormatMatchSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.freeze b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.freeze index 04be590ab3..5cafae7534 100644 --- a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.freeze +++ b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.freeze @@ -1 +1 @@ -2024-09-19T06:26:53.475609-04:00 \ No newline at end of file +2024-09-23T01:01:18.742561-04:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.yaml b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.yaml index 2797c38e00..19bbfb4d90 100644 --- a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.yaml +++ b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.yaml @@ -1,3 +1,215 @@ --- version: 2 -interactions: [] +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 766 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: | + {"description":"Created using the Datadog provider in Terraform","id":"","layout_type":"ordered","notify_list":[],"tags":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardQueryTableWithTextFormats-local-1727067678","widgets":[{"definition":{"has_search_bar":"auto","requests":[{"aggregator":"max","alias":"cpu user","cell_display_mode":["number"],"limit":25,"order":"desc","q":"avg:system.cpu.user{account:prod} by {service, team}","text_formats":[[{"match":{"type":"is","value":"test"},"palette":"black_on_light_yellow","replace":{"type":"all","with":"test"}}],[{"match":{"type":"is","value":"versus"}}]]}],"time":{"live_span":"1d"},"title":"this is hyung","title_align":"right","title_size":"16","type":"query_table"}}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard + method: POST + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"id":"9as-za4-vay","title":"tf-TestAccDatadogDashboardQueryTableWithTextFormats-local-1727067678","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/9as-za4-vay/tf-testaccdatadogdashboardquerytablewithtextformats-local-1727067678","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"has_search_bar":"auto","requests":[{"aggregator":"max","alias":"cpu user","cell_display_mode":["number"],"limit":25,"order":"desc","q":"avg:system.cpu.user{account:prod} by {service, team}","text_formats":[[{"match":{"type":"is","value":"test"},"palette":"black_on_light_yellow","replace":{"type":"all","with":"test"}}],[{"match":{"type":"is","value":"versus"}}]]}],"time":{"live_span":"1d"},"title":"this is hyung","title_align":"right","title_size":"16","type":"query_table"},"id":860260183903148}],"notify_list":[],"created_at":"2024-09-23T05:01:24.188766+00:00","modified_at":"2024-09-23T05:01:24.188766+00:00","template_variable_presets":[],"tags":[]} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 281.945083ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard/9as-za4-vay + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"id":"9as-za4-vay","title":"tf-TestAccDatadogDashboardQueryTableWithTextFormats-local-1727067678","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/9as-za4-vay/tf-testaccdatadogdashboardquerytablewithtextformats-local-1727067678","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"has_search_bar":"auto","requests":[{"aggregator":"max","alias":"cpu user","cell_display_mode":["number"],"limit":25,"order":"desc","q":"avg:system.cpu.user{account:prod} by {service, team}","text_formats":[[{"match":{"type":"is","value":"test"},"palette":"black_on_light_yellow","replace":{"type":"all","with":"test"}}],[{"match":{"type":"is","value":"versus"}}]]}],"time":{"live_span":"1d"},"title":"this is hyung","title_align":"right","title_size":"16","type":"query_table"},"id":860260183903148}],"notify_list":[],"created_at":"2024-09-23T05:01:24.188766+00:00","modified_at":"2024-09-23T05:01:24.188766+00:00","template_variable_presets":[],"tags":[]} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 93.575834ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard/9as-za4-vay + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"id":"9as-za4-vay","title":"tf-TestAccDatadogDashboardQueryTableWithTextFormats-local-1727067678","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/9as-za4-vay/tf-testaccdatadogdashboardquerytablewithtextformats-local-1727067678","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"has_search_bar":"auto","requests":[{"aggregator":"max","alias":"cpu user","cell_display_mode":["number"],"limit":25,"order":"desc","q":"avg:system.cpu.user{account:prod} by {service, team}","text_formats":[[{"match":{"type":"is","value":"test"},"palette":"black_on_light_yellow","replace":{"type":"all","with":"test"}}],[{"match":{"type":"is","value":"versus"}}]]}],"time":{"live_span":"1d"},"title":"this is hyung","title_align":"right","title_size":"16","type":"query_table"},"id":860260183903148}],"notify_list":[],"created_at":"2024-09-23T05:01:24.188766+00:00","modified_at":"2024-09-23T05:01:24.188766+00:00","template_variable_presets":[],"tags":[]} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 102.8375ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard/9as-za4-vay + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"id":"9as-za4-vay","title":"tf-TestAccDatadogDashboardQueryTableWithTextFormats-local-1727067678","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/9as-za4-vay/tf-testaccdatadogdashboardquerytablewithtextformats-local-1727067678","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"has_search_bar":"auto","requests":[{"aggregator":"max","alias":"cpu user","cell_display_mode":["number"],"limit":25,"order":"desc","q":"avg:system.cpu.user{account:prod} by {service, team}","text_formats":[[{"match":{"type":"is","value":"test"},"palette":"black_on_light_yellow","replace":{"type":"all","with":"test"}}],[{"match":{"type":"is","value":"versus"}}]]}],"time":{"live_span":"1d"},"title":"this is hyung","title_align":"right","title_size":"16","type":"query_table"},"id":860260183903148}],"notify_list":[],"created_at":"2024-09-23T05:01:24.188766+00:00","modified_at":"2024-09-23T05:01:24.188766+00:00","template_variable_presets":[],"tags":[]} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 96.384ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard/9as-za4-vay + method: DELETE + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"deleted_dashboard_id":"9as-za4-vay"} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 171.830916ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard/9as-za4-vay + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: '{"errors":["Dashboard with ID 9as-za4-vay not found"]}' + headers: + Content-Type: + - application/json + status: 404 Not Found + code: 404 + duration: 85.002292ms diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.freeze b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.freeze index 0cb4c52f49..6ae407c260 100644 --- a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.freeze +++ b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.freeze @@ -1 +1 @@ -2024-09-19T06:27:09.039894-04:00 \ No newline at end of file +2024-09-23T01:01:18.742504-04:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.yaml b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.yaml index 2797c38e00..5e02c81789 100644 --- a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.yaml +++ b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.yaml @@ -1,3 +1,215 @@ --- version: 2 -interactions: [] +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 773 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: | + {"description":"Created using the Datadog provider in Terraform","id":"","layout_type":"ordered","notify_list":[],"tags":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardQueryTableWithTextFormats_import-local-1727067678","widgets":[{"definition":{"has_search_bar":"auto","requests":[{"aggregator":"max","alias":"cpu user","cell_display_mode":["number"],"limit":25,"order":"desc","q":"avg:system.cpu.user{account:prod} by {service, team}","text_formats":[[{"match":{"type":"is","value":"test"},"palette":"black_on_light_yellow","replace":{"type":"all","with":"test"}}],[{"match":{"type":"is","value":"versus"}}]]}],"time":{"live_span":"1d"},"title":"this is hyung","title_align":"right","title_size":"16","type":"query_table"}}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard + method: POST + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"id":"gew-xb3-x68","title":"tf-TestAccDatadogDashboardQueryTableWithTextFormats_import-local-1727067678","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/gew-xb3-x68/tf-testaccdatadogdashboardquerytablewithtextformatsimport-local-1727067678","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"has_search_bar":"auto","requests":[{"aggregator":"max","alias":"cpu user","cell_display_mode":["number"],"limit":25,"order":"desc","q":"avg:system.cpu.user{account:prod} by {service, team}","text_formats":[[{"match":{"type":"is","value":"test"},"palette":"black_on_light_yellow","replace":{"type":"all","with":"test"}}],[{"match":{"type":"is","value":"versus"}}]]}],"time":{"live_span":"1d"},"title":"this is hyung","title_align":"right","title_size":"16","type":"query_table"},"id":3333511283603654}],"notify_list":[],"created_at":"2024-09-23T05:01:24.236878+00:00","modified_at":"2024-09-23T05:01:24.236878+00:00","template_variable_presets":[],"tags":[]} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 280.881083ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard/gew-xb3-x68 + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"id":"gew-xb3-x68","title":"tf-TestAccDatadogDashboardQueryTableWithTextFormats_import-local-1727067678","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/gew-xb3-x68/tf-testaccdatadogdashboardquerytablewithtextformatsimport-local-1727067678","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"has_search_bar":"auto","requests":[{"aggregator":"max","alias":"cpu user","cell_display_mode":["number"],"limit":25,"order":"desc","q":"avg:system.cpu.user{account:prod} by {service, team}","text_formats":[[{"match":{"type":"is","value":"test"},"palette":"black_on_light_yellow","replace":{"type":"all","with":"test"}}],[{"match":{"type":"is","value":"versus"}}]]}],"time":{"live_span":"1d"},"title":"this is hyung","title_align":"right","title_size":"16","type":"query_table"},"id":3333511283603654}],"notify_list":[],"created_at":"2024-09-23T05:01:24.236878+00:00","modified_at":"2024-09-23T05:01:24.236878+00:00","template_variable_presets":[],"tags":[]} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 86.779459ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard/gew-xb3-x68 + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"id":"gew-xb3-x68","title":"tf-TestAccDatadogDashboardQueryTableWithTextFormats_import-local-1727067678","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/gew-xb3-x68/tf-testaccdatadogdashboardquerytablewithtextformatsimport-local-1727067678","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"has_search_bar":"auto","requests":[{"aggregator":"max","alias":"cpu user","cell_display_mode":["number"],"limit":25,"order":"desc","q":"avg:system.cpu.user{account:prod} by {service, team}","text_formats":[[{"match":{"type":"is","value":"test"},"palette":"black_on_light_yellow","replace":{"type":"all","with":"test"}}],[{"match":{"type":"is","value":"versus"}}]]}],"time":{"live_span":"1d"},"title":"this is hyung","title_align":"right","title_size":"16","type":"query_table"},"id":3333511283603654}],"notify_list":[],"created_at":"2024-09-23T05:01:24.236878+00:00","modified_at":"2024-09-23T05:01:24.236878+00:00","template_variable_presets":[],"tags":[]} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 99.190625ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard/gew-xb3-x68 + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"id":"gew-xb3-x68","title":"tf-TestAccDatadogDashboardQueryTableWithTextFormats_import-local-1727067678","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/gew-xb3-x68/tf-testaccdatadogdashboardquerytablewithtextformatsimport-local-1727067678","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"has_search_bar":"auto","requests":[{"aggregator":"max","alias":"cpu user","cell_display_mode":["number"],"limit":25,"order":"desc","q":"avg:system.cpu.user{account:prod} by {service, team}","text_formats":[[{"match":{"type":"is","value":"test"},"palette":"black_on_light_yellow","replace":{"type":"all","with":"test"}}],[{"match":{"type":"is","value":"versus"}}]]}],"time":{"live_span":"1d"},"title":"this is hyung","title_align":"right","title_size":"16","type":"query_table"},"id":3333511283603654}],"notify_list":[],"created_at":"2024-09-23T05:01:24.236878+00:00","modified_at":"2024-09-23T05:01:24.236878+00:00","template_variable_presets":[],"tags":[]} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 93.784542ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard/gew-xb3-x68 + method: DELETE + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"deleted_dashboard_id":"gew-xb3-x68"} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 178.421666ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v1/dashboard/gew-xb3-x68 + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: '{"errors":["Dashboard with ID gew-xb3-x68 not found"]}' + headers: + Content-Type: + - application/json + status: 404 Not Found + code: 404 + duration: 79.450375ms diff --git a/datadog/tests/resource_datadog_dashboard_query_table_test.go b/datadog/tests/resource_datadog_dashboard_query_table_test.go index d38c8c80a0..4a20382cc5 100644 --- a/datadog/tests/resource_datadog_dashboard_query_table_test.go +++ b/datadog/tests/resource_datadog_dashboard_query_table_test.go @@ -224,12 +224,11 @@ resource "datadog_dashboard" "query_table_dashboard" { title = "{{uniq}}" description = "Created using the Datadog provider in Terraform" layout_type = "ordered" - is_read_only = "true" widget { query_table_definition { title_size = "16" - title = "system.cpu.user, system.load.1" + title = "this is hyung" title_align = "right" live_span = "1d" request { @@ -245,19 +244,23 @@ resource "datadog_dashboard" "query_table_dashboard" { type = "is" value = "test" } - palette = "custom_bg" - }, - { - match = { - type = "is" - value = "test" - } + palette = "black_on_light_yellow" + replace = { + type = "all" + with = "test" + }, + custom_bg_color = null + custom_fg_color = null }], [{ match = { type = "is" - value = "test" + value = "versus" } + palette = null + replace = null + custom_bg_color = null + custom_fg_color = null }] ] } @@ -364,26 +367,31 @@ var datadogDashboardQueryTableFormulaAsserts = []string{ } var datadogDashboardQueryTableWithTextFormatsAsserts = []string{ - "widget.0.query_table_definition.0.live_span = 1d", - "widget.0.query_table_definition.0.request.0.conditional_formats.0.timeframe =", - "widget.0.query_table_definition.0.request.0.q = avg:system.cpu.user{account:prod} by {service, team}", "title = {{uniq}}", + "description = Created using the Datadog provider in Terraform", + "layout_type = ordered", + "widget.0.query_table_definition.0.title_size = 16", + "widget.0.query_table_definition.0.title = this is hyung", + "widget.0.query_table_definition.0.title_align = right", + "widget.0.query_table_definition.0.live_span = 1d", "widget.0.query_table_definition.0.request.0.aggregator = max", - "widget.0.query_table_definition.0.request.0.order = desc", + "widget.0.query_table_definition.0.request.0.q = avg:system.cpu.user{account:prod} by {service, team}", "widget.0.query_table_definition.0.request.0.alias = cpu user", - "is_read_only = true", "widget.0.query_table_definition.0.request.0.limit = 25", - "layout_type = ordered", - "widget.0.query_table_definition.0.title = system.cpu.user, system.load.1", - "widget.0.query_table_definition.0.title_align = right", - "widget.1.query_table_definition.0.request.0.apm_stats_query.0.service = service", - "widget.1.query_table_definition.0.request.0.apm_stats_query.0.env = env", - "widget.1.query_table_definition.0.request.0.apm_stats_query.0.primary_tag = tag:*", - "widget.1.query_table_definition.0.request.0.apm_stats_query.0.name = name", - "widget.1.query_table_definition.0.request.0.apm_stats_query.0.row_type = resource", + "widget.0.query_table_definition.0.request.0.order = desc", "widget.0.query_table_definition.0.request.0.cell_display_mode.0 = number", - "widget.0.query_table_definition.0.has_search_bar = auto", - "widget.1.query_table_definition.0.has_search_bar = never", + "widget.0.query_table_definition.0.request.0.text_formats.0.0.match.type = is", + "widget.0.query_table_definition.0.request.0.text_formats.0.0.match.value = test", + "widget.0.query_table_definition.0.request.0.text_formats.0.0.palette = black_on_light_yellow", + "widget.0.query_table_definition.0.request.0.text_formats.0.0.replace.type = all", + "widget.0.query_table_definition.0.request.0.text_formats.0.0.replace.with = test", + "widget.0.query_table_definition.0.request.0.text_formats.0.0.custom_bg_color = ", + "widget.0.query_table_definition.0.request.0.text_formats.0.0.custom_fg_color = ", + "widget.0.query_table_definition.0.request.0.text_formats.1.0.match.type = is", + "widget.0.query_table_definition.0.request.0.text_formats.1.0.match.value = versus", + "widget.0.query_table_definition.0.request.0.text_formats.1.0.palette = ", + "widget.0.query_table_definition.0.request.0.text_formats.1.0.custom_bg_color = ", + "widget.0.query_table_definition.0.request.0.text_formats.1.0.custom_fg_color = ", } func TestAccDatadogDashboardQueryTable(t *testing.T) { diff --git a/docs/resources/dashboard.md b/docs/resources/dashboard.md index 657210905a..ee8ed2e5aa 100644 --- a/docs/resources/dashboard.md +++ b/docs/resources/dashboard.md @@ -5182,7 +5182,6 @@ Optional: - `query` (Block List) (see [below for nested schema](#nestedblock--widget--group_definition--widget--query_table_definition--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--query_table_definition--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--query_table_definition--request--security_query)) -- `text_formats` (List of Block List) Text formats allow you to set the color of your text content, depending on the rule applied to your data. Multiple `text_formats` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--group_definition--widget--query_table_definition--request--text_formats)) ### Nested Schema for `widget.group_definition.widget.query_table_definition.request.apm_query` @@ -5746,41 +5745,6 @@ Optional: - -### Nested Schema for `widget.group_definition.widget.query_table_definition.request.text_formats. - -Required: - -- `match` (Block List, Max: 1) Match rule for the table widget text format. (see [below for nested schema](#nestedblock--widget--group_definition--widget--query_table_definition--request--text_formats--match)) - -Optional: - -- `replace` (Block List, Max: 1) Replace rule for the table widget text format. -- `palette` (String) Color-on-color palette to highlight replaced text. -- `custom_bg_color` (String) Hex representation of the custom background color. Used with custom background palette option. -- `custom_fg_color` (String) Hex representation of the custom text color. Used with custom text palette option. - - - - -### Nested Schema for `widget.group_definition.widget.query_table_definition.request.text_formats.match. - -Required: - -- `type` (String) Match or compare option. -- `value` (String) Table Widget Match String. - - - - -### Nested Schema for `widget.group_definition.widget.query_table_definition.request.text_formats.replace. - -Required: - -- `type` (String) Match or compare option. -- `with` (String) Text that will replace original sub-string. -- `substring` (String) Text that will be replaced. - @@ -8477,7 +8441,6 @@ Optional: - `query` (Block List) (see [below for nested schema](#nestedblock--widget--group_definition--widget--split_graph_definition--source_widget_definition--query_table_definition--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--split_graph_definition--source_widget_definition--query_table_definition--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--split_graph_definition--source_widget_definition--query_table_definition--request--security_query)) -- `text_formats` (List of Block List) Text formats allow you to set the color of your text content, depending on the rule applied to your data. Multiple `text_formats` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--group_definition--widget--split_graph_definition--source_widget_definition--query_table_definition--request--text_formats)) ### Nested Schema for `widget.group_definition.widget.split_graph_definition.source_widget_definition.query_table_definition.request.apm_query` @@ -9041,41 +9004,6 @@ Optional: - -### Nested Schema for `widget.group_definition.widget.split_graph_definition.source_widget_definition.query_table_definition.request.text_formats. - -Required: - -- `match` (Block List, Max: 1) Match rule for the table widget text format. (see [below for nested schema](#nestedblock--widget--group_definition--widget--split_graph_definition--source_widget_definition--query_table_definition--request--text_formats--match)) - -Optional: - -- `replace` (Block List, Max: 1) Replace rule for the table widget text format. -- `palette` (String) Color-on-color palette to highlight replaced text. -- `custom_bg_color` (String) Hex representation of the custom background color. Used with custom background palette option. -- `custom_fg_color` (String) Hex representation of the custom text color. Used with custom text palette option. - - - - -### Nested Schema for `widget.group_definition.widget.split_graph_definition.source_widget_definition.query_table_definition.request.text_formats.match. - -Required: - -- `type` (String) Match or compare option. -- `value` (String) Table Widget Match String. - - - - -### Nested Schema for `widget.group_definition.widget.split_graph_definition.source_widget_definition.query_table_definition.request.text_formats.replace. - -Required: - -- `type` (String) Match or compare option. -- `with` (String) Text that will replace original sub-string. -- `substring` (String) Text that will be replaced. - @@ -16984,7 +16912,6 @@ Optional: - `query` (Block List) (see [below for nested schema](#nestedblock--widget--query_table_definition--request--query)) - `rum_query` (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--rum_query)) - `security_query` (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--security_query)) -- `text_formats` (List of Block List) Text formats allow you to set the color of your text content, depending on the rule applied to your data. Multiple `text_formats` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--text_formats)) ### Nested Schema for `widget.query_table_definition.request.apm_query` @@ -17548,42 +17475,6 @@ Optional: - -### Nested Schema for `widget.query_table_definition.request.text_formats. - -Required: - -- `match` (Block List, Max: 1) Match rule for the table widget text format. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--text_formats--match)) - -Optional: - -- `replace` (Block List, Max: 1) Replace rule for the table widget text format. -- `palette` (String) Color-on-color palette to highlight replaced text. -- `custom_bg_color` (String) Hex representation of the custom background color. Used with custom background palette option. -- `custom_fg_color` (String) Hex representation of the custom text color. Used with custom text palette option. - - - - -### Nested Schema for `widget.query_table_definition.request.text_formats.match. - -Required: - -- `type` (String) Match or compare option. -- `value` (String) Table Widget Match String. - - - - -### Nested Schema for `widget.query_table_definition.request.text_formats.replace. - -Required: - -- `type` (String) Match or compare option. -- `with` (String) Text that will replace original sub-string. -- `substring` (String) Text that will be replaced. - - @@ -20280,7 +20171,6 @@ Optional: - `query` (Block List) (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--query_table_definition--request--query)) - `rum_query` (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--query_table_definition--request--rum_query)) - `security_query` (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--query_table_definition--request--security_query)) -- `text_formats` (List of Block List) Text formats allow you to set the color of your text content, depending on the rule applied to your data. Multiple `text_formats` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--query_table_definition--request--text_formats)) ### Nested Schema for `widget.split_graph_definition.source_widget_definition.query_table_definition.request.apm_query` @@ -20844,42 +20734,6 @@ Optional: - -### Nested Schema for `widget.split_graph_definition.source_widget_definition.query_table_definition.request.text_formats. - -Required: - -- `match` (Block List, Max: 1) Match rule for the table widget text format. (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--query_table_definition--request--text_formats--match)) - -Optional: - -- `replace` (Block List, Max: 1) Replace rule for the table widget text format. -- `palette` (String) Color-on-color palette to highlight replaced text. -- `custom_bg_color` (String) Hex representation of the custom background color. Used with custom background palette option. -- `custom_fg_color` (String) Hex representation of the custom text color. Used with custom text palette option. - - - - -### Nested Schema for `widget.split_graph_definition.source_widget_definition.query_table_definition.request.text_formats.match. - -Required: - -- `type` (String) Match or compare option. -- `value` (String) Table Widget Match String. - - - - -### Nested Schema for `widget.split_graph_definition.source_widget_definition.query_table_definition.request.text_formats.replace. - -Required: - -- `type` (String) Match or compare option. -- `with` (String) Text that will replace original sub-string. -- `substring` (String) Text that will be replaced. - - @@ -27342,4 +27196,4 @@ Import is supported using the following syntax: ```shell terraform import datadog_dashboard.my_service_dashboard sv7-gyh-kas -``` +``` \ No newline at end of file diff --git a/docs/resources/powerpack.md b/docs/resources/powerpack.md index 72fea2bc11..3b4e9ac309 100644 --- a/docs/resources/powerpack.md +++ b/docs/resources/powerpack.md @@ -2934,8 +2934,7 @@ Optional: - `apm_query` (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--apm_query)) - `apm_stats_query` (Block List, Max: 1) (see [below for nested schema](#nestedblock--widget--query_table_definition--request--apm_stats_query)) - `cell_display_mode` (List of String) A list of display modes for each table cell. List items one of `number`, `bar`. Valid values are `number`, `bar`. -- `conditional_formats` (Block List) Conditional formats allow you to set the color of your widget content or background, depending on the rule applied to your data. Multiple `conditional_formats` blocks are allowed using the structure below. (see [below for nested schema]( -- #nestedblock--widget--query_table_definition--request--conditional_formats)) +- `conditional_formats` (Block List) Conditional formats allow you to set the color of your widget content or background, depending on the rule applied to your data. Multiple `conditional_formats` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--conditional_formats)) - `formula` (Block List) (see [below for nested schema](#nestedblock--widget--query_table_definition--request--formula)) - `limit` (Number) The number of lines to show in the table. - `log_query` (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--log_query)) @@ -2945,7 +2944,6 @@ Optional: - `query` (Block List) (see [below for nested schema](#nestedblock--widget--query_table_definition--request--query)) - `rum_query` (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--rum_query)) - `security_query` (Block List, Max: 1) The query to use for this widget. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--security_query)) -- `text_formats` (List of Block List) Text formats allow you to set the color of your text content, depending on the rule applied to your data. Multiple `text_formats` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--text_formats)) ### Nested Schema for `widget.query_table_definition.request.apm_query` @@ -3509,40 +3507,6 @@ Optional: - -### Nested Schema for `widget.query_table_definition.request.text_formats. - -Required: - -- `match` (Block List, Max: 1) Match rule for the table widget text format. (see [below for nested schema](#nestedblock--widget--query_table_definition--request--text_formats--match)) - -Optional: - -- `replace` (Block List, Max: 1) Replace rule for the table widget text format. -- `palette` (String) Color-on-color palette to highlight replaced text. -- `custom_bg_color` (String) Hex representation of the custom background color. Used with custom background palette option. -- `custom_fg_color` (String) Hex representation of the custom text color. Used with custom text palette option. - - - - -### Nested Schema for `widget.query_table_definition.request.text_formats.match. - -Required: - -- `type` (String) Match or compare option. -- `value` (String) Table Widget Match String. - - - - -### Nested Schema for `widget.query_table_definition.request.text_formats.replace. - -Required: - -- `type` (String) Match or compare option. -- `with` (String) Text that will replace original sub-string. -- `substring` (String) Text that will be replaced. @@ -7668,4 +7632,4 @@ Import is supported using the following syntax: ```shell terraform import datadog_powerpack.foo 11111111-2222-3333-4444-555555555555 -``` +``` \ No newline at end of file