Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions newrelic/resource_newrelic_one_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,96 @@ func dashboardWidgetBillboardSchemaElem() *schema.Resource {
Optional: true,
Description: "The warning threshold value.",
}
s["billboard_settings"] = &schema.Schema{
Type: schema.TypeList,
Optional: true,
MinItems: 1,
Elem: dashboardBillBoardWidgetSchema(),
}

return &schema.Resource{
Schema: s,
}
}

func dashboardBillBoardWidgetSchema() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"visual_style": {
Type: schema.TypeList,
Required: true,
Description: "Visual style settings for the billboard widget.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"display": {
Type: schema.TypeString,
Required: true,
Description: "Display mode for the visual style.",
ValidateFunc: validation.StringInSlice([]string{"auto", "all", "value", "label", "none"}, false),
},
"alignment": {
Type: schema.TypeString,
Required: true,
Description: "Alignment for the visual style.",
ValidateFunc: validation.StringInSlice([]string{"stacked", "inline"}, false),
},
},
},
},
"grid_options": {
Type: schema.TypeList,
Required: true,
Description: "Grid options for the billboard widget.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"value": {
Type: schema.TypeInt,
Required: true,
Description: "Value size for the grid options.",
ValidateFunc: validation.IntBetween(8, 240),
},
"label": {
Type: schema.TypeInt,
Required: true,
Description: "Label size for the grid options.",
ValidateFunc: validation.IntBetween(8, 240),
},
"columns": {
Type: schema.TypeInt,
Required: true,
Description: "Number of columns for the grid options.",
},
},
},
},
"link": {
Type: schema.TypeList,
Optional: true,
Description: "Link settings for the billboard widget.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"title": {
Type: schema.TypeString,
Required: true,
Description: "Title for the link.",
},
"url": {
Type: schema.TypeString,
Required: true,
Description: "URL for the link.",
},
"new_tab": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether the link should open in a new tab.",
},
},
},
},
},
}
}

func dashboardWidgetBulletSchemaElem() *schema.Resource {
s := dashboardWidgetSchemaBase()

Expand Down
39 changes: 38 additions & 1 deletion newrelic/structures_newrelic_one_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@
// Set data formatting
rawConfiguration.DataFormat = expandDashboardTableWidgetConfigDataFormatInput(v.(map[string]interface{}))

// BillBoard setting
rawConfiguration.BillboardSettings = expandDashboardBillBoardWidgetSettingsInput(v.(map[string]interface{}))

Check failure on line 250 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (ubuntu-latest)

rawConfiguration.BillboardSettings undefined (type *dashboards.RawConfiguration has no field or method BillboardSettings)

Check failure on line 250 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (macos-latest)

rawConfiguration.BillboardSettings undefined (type *dashboards.RawConfiguration has no field or method BillboardSettings)

Check failure on line 250 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

rawConfiguration.BillboardSettings undefined (type *dashboards.RawConfiguration has no field or method BillboardSettings)

Check failure on line 250 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

rawConfiguration.BillboardSettings undefined (type *dashboards.RawConfiguration has no field or method BillboardSettings)

Check failure on line 250 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

rawConfiguration.BillboardSettings undefined (type *dashboards.RawConfiguration has no field or method BillboardSettings)

Check failure on line 250 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

rawConfiguration.BillboardSettings undefined (type *dashboards.RawConfiguration has no field or method BillboardSettings)

Check failure on line 250 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

rawConfiguration.BillboardSettings undefined (type *dashboards.RawConfiguration has no field or method BillboardSettings)

Check failure on line 250 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

rawConfiguration.BillboardSettings undefined (type *dashboards.RawConfiguration has no field or method BillboardSettings)

Check failure on line 250 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

rawConfiguration.BillboardSettings undefined (type *dashboards.RawConfiguration has no field or method BillboardSettings)

Check failure on line 250 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

rawConfiguration.BillboardSettings undefined (type *dashboards.RawConfiguration has no field or method BillboardSettings)

widget.RawConfiguration, err = json.Marshal(rawConfiguration)
if err != nil {
return nil, err
Expand Down Expand Up @@ -608,6 +611,41 @@
return nil
}

func expandDashboardBillBoardWidgetSettingsInput(input map[string]interface{}) *dashboards.DashboardWidgetBillboardSettings {

Check failure on line 614 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (ubuntu-latest)

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 614 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (macos-latest)

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 614 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 614 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 614 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 614 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 614 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 614 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 614 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

undefined: dashboards.DashboardWidgetBillboardSettings
if input == nil {
return nil
}

settings := &dashboards.DashboardWidgetBillboardSettings{}

Check failure on line 619 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (ubuntu-latest)

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 619 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (macos-latest)

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 619 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 619 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 619 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardSettings

Check failure on line 619 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

undefined: dashboards.DashboardWidgetBillboardSettings

// Expand visual_style settings
if visualStyle, ok := input["visual_style"].(map[string]interface{}); ok {
settings.Visual = &dashboards.DashboardWidgetBillboardVisual{

Check failure on line 623 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (ubuntu-latest)

undefined: dashboards.DashboardWidgetBillboardVisual

Check failure on line 623 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (macos-latest)

undefined: dashboards.DashboardWidgetBillboardVisual

Check failure on line 623 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardVisual

Check failure on line 623 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: dashboards.DashboardWidgetBillboardVisual

Check failure on line 623 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardVisual

Check failure on line 623 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

undefined: dashboards.DashboardWidgetBillboardVisual
Display: dashboards.BillboardVisualDisplay(visualStyle["display"].(string)),

Check failure on line 624 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (ubuntu-latest)

undefined: dashboards.BillboardVisualDisplay

Check failure on line 624 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (macos-latest)

undefined: dashboards.BillboardVisualDisplay

Check failure on line 624 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.BillboardVisualDisplay

Check failure on line 624 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: dashboards.BillboardVisualDisplay

Check failure on line 624 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.BillboardVisualDisplay

Check failure on line 624 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

undefined: dashboards.BillboardVisualDisplay
Alignment: dashboards.BillboardVisualAlignment(visualStyle["alignment"].(string)),

Check failure on line 625 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (ubuntu-latest)

undefined: dashboards.BillboardVisualAlignment

Check failure on line 625 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (macos-latest)

undefined: dashboards.BillboardVisualAlignment

Check failure on line 625 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.BillboardVisualAlignment

Check failure on line 625 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: dashboards.BillboardVisualAlignment

Check failure on line 625 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.BillboardVisualAlignment

Check failure on line 625 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

undefined: dashboards.BillboardVisualAlignment
}
}

// Expand grid_options settings
if gridOptions, ok := input["grid_options"].(map[string]interface{}); ok {
settings.GridOptions = &dashboards.DashboardWidgetBillboardGridOptions{

Check failure on line 631 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (ubuntu-latest)

undefined: dashboards.DashboardWidgetBillboardGridOptions

Check failure on line 631 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (macos-latest)

undefined: dashboards.DashboardWidgetBillboardGridOptions

Check failure on line 631 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardGridOptions

Check failure on line 631 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: dashboards.DashboardWidgetBillboardGridOptions

Check failure on line 631 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardGridOptions

Check failure on line 631 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

undefined: dashboards.DashboardWidgetBillboardGridOptions
Columns: gridOptions["columns"].(int),
Label: gridOptions["label"].(int),
Value: gridOptions["value"].(int),
}
}

// Expand link settings
if link, ok := input["link"].(map[string]interface{}); ok {
settings.Link = &dashboards.DashboardWidgetBillboardLink{

Check failure on line 640 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (ubuntu-latest)

undefined: dashboards.DashboardWidgetBillboardLink

Check failure on line 640 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (macos-latest)

undefined: dashboards.DashboardWidgetBillboardLink

Check failure on line 640 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardLink

Check failure on line 640 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: dashboards.DashboardWidgetBillboardLink

Check failure on line 640 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

undefined: dashboards.DashboardWidgetBillboardLink

Check failure on line 640 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

undefined: dashboards.DashboardWidgetBillboardLink) (typecheck)
Title: link["title"].(string),
URL: link["url"].(string),
NewTab: link["new_tab"].(bool),
}
}

return settings
}
func expandDashboardTableWidgetConfigurationThresholdInput(d *schema.ResourceData, pageIndex int, widgetIndex int) []dashboards.DashboardTableWidgetThresholdInput {
// initialize an object of []DashboardTableWidgetThresholdInput, which would include a list of tableWidgetThresholdsToBeAdded as specified
// in the Terraform configuration, with the attribute "threshold" in table widgets
Expand Down Expand Up @@ -683,7 +721,6 @@
if i, ok := w["title"]; ok {
widget.Title = i.(string)
}

if i, ok := w["linked_entity_guids"]; ok {
widget.LinkedEntityGUIDs = expandLinkedEntityGUIDs(i.([]interface{}))
}
Expand Down
Loading