From de35b6d8aa022230177b8669f341a47b0afb4e5f Mon Sep 17 00:00:00 2001 From: Hyung Lee Date: Wed, 18 Sep 2024 09:06:52 -0400 Subject: [PATCH] query table widget - add text formats to request --- datadog/resource_datadog_dashboard.go | 192 ++++++++++++++++++ ...gDashboardQueryTableWithTextFormats.freeze | 1 + ...dogDashboardQueryTableWithTextFormats.yaml | 3 + ...ardQueryTableWithTextFormats_import.freeze | 1 + ...boardQueryTableWithTextFormats_import.yaml | 3 + ...urce_datadog_dashboard_query_table_test.go | 170 ++++++++++++++++ docs/resources/dashboard.md | 146 +++++++++++++ docs/resources/powerpack.md | 38 +++- go.mod | 2 +- go.sum | 2 + 10 files changed, 556 insertions(+), 2 deletions(-) create mode 100644 datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.freeze create mode 100644 datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.yaml create mode 100644 datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.freeze create mode 100644 datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.yaml diff --git a/datadog/resource_datadog_dashboard.go b/datadog/resource_datadog_dashboard.go index 5cea958ba1..da58ee3e15 100644 --- a/datadog/resource_datadog_dashboard.go +++ b/datadog/resource_datadog_dashboard.go @@ -4491,6 +4491,51 @@ func getQueryTableRequestSchema() map[string]*schema.Schema { ValidateDiagFunc: validators.ValidateEnumValue(datadogV1.NewTableWidgetCellDisplayModeFromValue), }, }, + "text_formats": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeList, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "match": { + Type: schema.TypeMap, + 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), + Optional: true, + }, + "replace": { + Type: schema.TypeMap, + 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, + }, + }, + }, + }, + }, } } func buildDatadogQueryTableRequests(terraformRequests *[]interface{}) *[]datadogV1.TableWidgetRequest { @@ -4581,6 +4626,9 @@ func buildDatadogQueryTableRequests(terraformRequests *[]interface{}) *[]datadog } datadogQueryTableRequest.CellDisplayMode = datadogCellDisplayMode } + if v, ok := terraformRequest["text_formats"].([][]interface{}); ok && len(v) != 0 { + datadogQueryTableRequest.TextFormats = *buildDatadogQueryTableTextFormat(&v) + } datadogRequests[i] = *datadogQueryTableRequest } return &datadogRequests @@ -4641,11 +4689,155 @@ func buildTerraformQueryTableRequests(datadogQueryTableRequests *[]datadogV1.Tab } terraformRequest["cell_display_mode"] = terraformCellDisplayMode } + if v, ok := datadogRequest.GetTextFormatsOk(); ok { + terraformTextFormats := buildTerraformQueryTableTextFormat(v) + terraformRequest["text_formats"] = terraformTextFormats + } terraformRequests[i] = terraformRequest } 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: + } + } + 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 + } + datadogQueryTableTextFormat[i] = terraformTextFormatArray + } + 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 + } + if v, ok := datadogQueryTableTextFormatRule.GetCustomFgColorOk(); ok { + terraformQueryTableTextFormatRule["custom_fg_color"] = v + } + 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, + }, + } +} +func getTableWidgetTextFormatMatchSchema() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "type": { + Description: "Match or compare option.", + Type: schema.TypeString, + ValidateDiagFunc: validators.ValidateEnumValue(datadogV1.NewTableWidgetTextFormatMatchTypeFromValue), + Optional: true, + }, + "value": { + Description: "Table Widget Match String.", + Type: schema.TypeString, + Optional: true, + }, + } +} +func getTableWidgetTextFormatReplaceSchema() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "type": { + Description: "Table widget text format replace all type.", + Type: schema.TypeString, + Optional: true, + }, + "with": { + Description: "Table Widget Match String.", + Type: schema.TypeString, + Optional: true, + }, + "substring": { + Description: "Text that will be replaced.", + Type: schema.TypeString, + Optional: true, + }, + } +} + // // Scatterplot Widget Definition helpers // diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.freeze b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.freeze new file mode 100644 index 0000000000..04be590ab3 --- /dev/null +++ b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.freeze @@ -0,0 +1 @@ +2024-09-19T06:26:53.475609-04:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.yaml b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.yaml new file mode 100644 index 0000000000..2797c38e00 --- /dev/null +++ b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats.yaml @@ -0,0 +1,3 @@ +--- +version: 2 +interactions: [] diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.freeze b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.freeze new file mode 100644 index 0000000000..0cb4c52f49 --- /dev/null +++ b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.freeze @@ -0,0 +1 @@ +2024-09-19T06:27:09.039894-04:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.yaml b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.yaml new file mode 100644 index 0000000000..2797c38e00 --- /dev/null +++ b/datadog/tests/cassettes/TestAccDatadogDashboardQueryTableWithTextFormats_import.yaml @@ -0,0 +1,3 @@ +--- +version: 2 +interactions: [] diff --git a/datadog/tests/resource_datadog_dashboard_query_table_test.go b/datadog/tests/resource_datadog_dashboard_query_table_test.go index d19fdb3580..4b4c1c6d67 100644 --- a/datadog/tests/resource_datadog_dashboard_query_table_test.go +++ b/datadog/tests/resource_datadog_dashboard_query_table_test.go @@ -219,6 +219,108 @@ resource "datadog_dashboard" "query_table_dashboard" { } ` +const datadogDashboardQueryTableConfigWithTextFormats = ` +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_align = "right" + live_span = "1d" + request { + aggregator = "max" + conditional_formats { + palette = "white_on_green" + value = 90 + comparator = "<" + } + conditional_formats { + palette = "white_on_red" + value = 90 + comparator = ">=" + } + q = "avg:system.cpu.user{account:prod} by {service, team}" + alias = "cpu user" + limit = 25 + order = "desc" + cell_display_mode = ["number"] + text_formats = [ + [{ + match = { + type = "is" + value = "test" + } + palette = "custom_bg" + }, + { + match = { + type = "is" + value = "test" + } + palette = "custom_bg" + }], + [{ + match = { + type = "is" + value = "test" + } + palette = "custom_bg" + }, + { + match = { + type = "is" + value = "test" + } + palette = "custom_bg" + }] + ] + } + request { + q = "avg:system.load.1{*} by {service, team}" + aggregator = "last" + conditional_formats { + palette = "custom_bg" + value = 50 + comparator = ">" + } + alias = "system load" + cell_display_mode = ["number"] + } + custom_link { + link = "https://app.datadoghq.com/dashboard/lists" + label = "Test Custom Link label" + } + custom_link { + link = "https://app.datadoghq.com/dashboard/lists" + is_hidden = true + override_label = "logs" + } + has_search_bar = "auto" + } + } + + widget { + query_table_definition { + request { + apm_stats_query { + service = "service" + env = "env" + primary_tag = "tag:*" + name = "name" + row_type = "resource" + } + } + has_search_bar = "never" + } + } +} +` + var datadogDashboardQueryTableAsserts = []string{ "widget.0.query_table_definition.0.live_span = 1d", "widget.0.query_table_definition.0.request.1.order =", @@ -315,6 +417,66 @@ var datadogDashboardQueryTableFormulaAsserts = []string{ "widget.2.query_table_definition.0.request.0.query.0.apm_resource_stats_query.0.primary_tag_value = abc", } +var datadogDashboardQueryTableAssertsWithTextFormats = []string{ + "widget.0.query_table_definition.0.live_span = 1d", + "widget.0.query_table_definition.0.request.1.order =", + "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}", + "widget.0.query_table_definition.0.request.0.conditional_formats.0.custom_fg_color =", + "widget.0.query_table_definition.0.request.1.conditional_formats.0.comparator = >", + "widget.0.query_table_definition.0.title_size = 16", + "widget.0.query_table_definition.0.request.0.conditional_formats.0.comparator = <", + "widget.0.query_table_definition.0.request.0.conditional_formats.0.value = 90", + "widget.0.query_table_definition.0.request.0.conditional_formats.1.image_url =", + "widget.0.query_table_definition.0.request.0.conditional_formats.1.hide_value = false", + "widget.0.query_table_definition.0.request.1.conditional_formats.0.timeframe =", + "description = Created using the Datadog provider in Terraform", + "widget.0.query_table_definition.0.request.0.conditional_formats.0.palette = white_on_green", + "widget.0.query_table_definition.0.request.0.conditional_formats.0.custom_bg_color =", + "widget.0.query_table_definition.0.request.1.q = avg:system.load.1{*} by {service, team}", + "title = {{uniq}}", + "widget.0.query_table_definition.0.request.0.conditional_formats.1.value = 90", + "widget.0.query_table_definition.0.request.0.conditional_formats.1.custom_bg_color =", + "widget.0.query_table_definition.0.request.1.aggregator = last", + "widget.0.query_table_definition.0.request.1.conditional_formats.0.custom_fg_color =", + "widget.0.query_table_definition.0.request.1.limit = 0", + "widget.0.query_table_definition.0.request.0.conditional_formats.0.hide_value = false", + "widget.0.query_table_definition.0.request.0.aggregator = max", + "widget.0.query_table_definition.0.request.1.conditional_formats.0.palette = custom_bg", + "widget.0.query_table_definition.0.request.1.alias = system load", + "widget.0.query_table_definition.0.request.0.order = desc", + "widget.0.query_table_definition.0.request.0.conditional_formats.0.image_url =", + "widget.0.query_table_definition.0.request.0.conditional_formats.1.comparator = >=", + "widget.0.query_table_definition.0.request.0.alias = cpu user", + "widget.0.query_table_definition.0.request.0.conditional_formats.1.palette = white_on_red", + "widget.0.query_table_definition.0.request.1.conditional_formats.0.value = 50", + "widget.0.query_table_definition.0.request.1.conditional_formats.0.custom_bg_color =", + "widget.0.query_table_definition.0.request.1.conditional_formats.0.image_url =", + "widget.0.query_table_definition.0.request.1.conditional_formats.0.hide_value = false", + "is_read_only = true", + "widget.0.query_table_definition.0.request.0.limit = 25", + "widget.0.query_table_definition.0.request.0.conditional_formats.1.timeframe =", + "widget.0.query_table_definition.0.request.0.conditional_formats.1.custom_fg_color =", + "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.custom_link.# = 2", + "widget.0.query_table_definition.0.custom_link.0.label = Test Custom Link label", + "widget.0.query_table_definition.0.custom_link.0.link = https://app.datadoghq.com/dashboard/lists", + "widget.0.query_table_definition.0.custom_link.1.override_label = logs", + "widget.0.query_table_definition.0.custom_link.1.link = https://app.datadoghq.com/dashboard/lists", + "widget.0.query_table_definition.0.custom_link.1.is_hidden = true", + "widget.0.query_table_definition.0.request.0.cell_display_mode.0 = number", + "widget.0.query_table_definition.0.request.1.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", +} + func TestAccDatadogDashboardQueryTable(t *testing.T) { testAccDatadogDashboardWidgetUtil(t, datadogDashboardQueryTableConfig, "datadog_dashboard.query_table_dashboard", datadogDashboardQueryTableAsserts) } @@ -330,3 +492,11 @@ func TestAccDatadogDashboardQueryTableFormula(t *testing.T) { func TestAccDatadogDashboardQueryTableFormula_import(t *testing.T) { testAccDatadogDashboardWidgetUtilImport(t, datadogDashboardQueryTableFormulaConfig, "datadog_dashboard.query_table_dashboard") } + +func TestAccDatadogDashboardQueryTableWithTextFormats(t *testing.T) { + testAccDatadogDashboardWidgetUtil(t, datadogDashboardQueryTableConfigWithTextFormats, "datadog_dashboard.query_table_dashboard", datadogDashboardQueryTableAssertsWithTextFormats) +} + +func TestAccDatadogDashboardQueryTableWithTextFormats_import(t *testing.T) { + testAccDatadogDashboardWidgetUtilImport(t, datadogDashboardQueryTableConfigWithTextFormats, "datadog_dashboard.query_table_dashboard") +} diff --git a/docs/resources/dashboard.md b/docs/resources/dashboard.md index f5dff4e999..657210905a 100644 --- a/docs/resources/dashboard.md +++ b/docs/resources/dashboard.md @@ -5182,6 +5182,7 @@ 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` @@ -5745,6 +5746,41 @@ 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. + @@ -8441,6 +8477,7 @@ 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` @@ -9004,6 +9041,41 @@ 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. + @@ -16912,6 +16984,7 @@ 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` @@ -17475,6 +17548,42 @@ 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. + + @@ -20171,6 +20280,7 @@ 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` @@ -20734,6 +20844,42 @@ 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. + + diff --git a/docs/resources/powerpack.md b/docs/resources/powerpack.md index 8b27cda084..72fea2bc11 100644 --- a/docs/resources/powerpack.md +++ b/docs/resources/powerpack.md @@ -2934,7 +2934,8 @@ 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)) @@ -2944,6 +2945,7 @@ 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` @@ -3507,6 +3509,40 @@ 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. diff --git a/go.mod b/go.mod index b37d49a6d0..c18c137a59 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/terraform-providers/terraform-provider-datadog require ( - github.com/DataDog/datadog-api-client-go/v2 v2.30.1-0.20240911195025-92128b15dc8c + github.com/DataDog/datadog-api-client-go/v2 v2.30.1-0.20240916145824-c2a898361150 github.com/DataDog/dd-sdk-go-testing v0.0.0-20211116174033-1cd082e322ad github.com/Masterminds/semver/v3 v3.1.1 github.com/google/go-cmp v0.5.9 diff --git a/go.sum b/go.sum index c455a02604..485269c958 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-api-client-go/v2 v2.30.1-0.20240911195025-92128b15dc8c h1:+yokfxyjea3W7KpyCTeTIKqPFNeGEAubmI0RCO7sBdE= github.com/DataDog/datadog-api-client-go/v2 v2.30.1-0.20240911195025-92128b15dc8c/go.mod h1:QKOu6vscsh87fMY1lHfLEmNSunyXImj8BUaUWJXOehc= +github.com/DataDog/datadog-api-client-go/v2 v2.30.1-0.20240916145824-c2a898361150 h1:1IPm1MIWv7r1OIF3NfiWHaANjGZzsegk17Mp2o72oiY= +github.com/DataDog/datadog-api-client-go/v2 v2.30.1-0.20240916145824-c2a898361150/go.mod h1:QKOu6vscsh87fMY1lHfLEmNSunyXImj8BUaUWJXOehc= github.com/DataDog/datadog-go v4.4.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=