Skip to content

Commit 53bf65e

Browse files
committed
Fix linter errors and address review comments
1 parent 2d5de7a commit 53bf65e

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

sumologic/resource_sumologic_dashboard.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func resourceSumologicDashboard() *schema.Resource {
119119
"theme": {
120120
Type: schema.TypeString,
121121
Optional: true,
122-
ValidateFunc: validation.StringInSlice([]string{"Light", "Dark"}, false),
122+
ValidateFunc: validation.StringInSlice([]string{"Light", "Dark"}, true),
123123
Default: "Light",
124124
},
125125
// TODO Do we need this field in terraform?
@@ -151,7 +151,6 @@ func getPanelSchema() map[string]*schema.Schema {
151151

152152
func getPanelBaseSchema() map[string]*schema.Schema {
153153
return map[string]*schema.Schema{
154-
// TODO what is use of "id" field in panel?
155154
"id": {
156155
Type: schema.TypeString,
157156
Optional: true,
@@ -347,8 +346,7 @@ func getMetricsQueryDataSchema() map[string]*schema.Schema {
347346
Elem: &schema.Resource{
348347
Schema: map[string]*schema.Schema{
349348
"key": {
350-
Type: schema.TypeString,
351-
// TODO why is key not a required param but value is?
349+
Type: schema.TypeString,
352350
Required: true,
353351
},
354352
"value": {
@@ -429,7 +427,6 @@ func getGridLayoutSchema() map[string]*schema.Schema {
429427

430428
func getVariablesSchema() map[string]*schema.Schema {
431429
return map[string]*schema.Schema{
432-
// TODO should we remove this field?
433430
"id": {
434431
Type: schema.TypeString,
435432
Computed: true,
@@ -1218,7 +1215,6 @@ func setDashboard(d *schema.ResourceData, dashboard *Dashboard) error {
12181215
return err
12191216
}
12201217

1221-
// TODO: Set rest of the fields
12221218
log.Println("=====================================================================")
12231219
log.Printf("title: %+v\n", d.Get("title"))
12241220
log.Printf("description: %+v\n", d.Get("description"))
@@ -1240,8 +1236,9 @@ func makeTerraformObject() TerraformObject {
12401236
return terraformObject
12411237
}
12421238

1243-
func getTerraformTimeRange(timeRange map[string]interface{}) TerraformObject {
1244-
tfTimeRange := makeTerraformObject()
1239+
func getTerraformTimeRange(timeRange map[string]interface{}) []map[string]interface{} {
1240+
tfTimeRange := []map[string]interface{}{}
1241+
tfTimeRange = append(tfTimeRange, make(map[string]interface{}))
12451242

12461243
if timeRange["type"] == "BeginBoundedTimeRange" {
12471244
boundedTimeRange := makeTerraformObject()
@@ -1267,8 +1264,7 @@ func getTerraformTimeRange(timeRange map[string]interface{}) TerraformObject {
12671264
return tfTimeRange
12681265
}
12691266

1270-
func getTerraformTimeRangeBoundary(
1271-
timeRangeBoundary map[string]interface{}) TerraformObject {
1267+
func getTerraformTimeRangeBoundary(timeRangeBoundary map[string]interface{}) TerraformObject {
12721268
tfTimeRangeBoundary := makeTerraformObject()
12731269

12741270
if timeRangeBoundary["type"] == "RelativeTimeRangeBoundary" {
@@ -1430,8 +1426,9 @@ func getTerraformLinkedDashboards(dashboards []interface{}) []map[string]interfa
14301426
return tfLinkedDashboards
14311427
}
14321428

1433-
func getTerraformLayout(layout map[string]interface{}) TerraformObject {
1434-
tfLayout := makeTerraformObject()
1429+
func getTerraformLayout(layout map[string]interface{}) []map[string]interface{} {
1430+
tfLayout := []map[string]interface{}{}
1431+
tfLayout = append(tfLayout, make(map[string]interface{}))
14351432

14361433
if layout["layoutType"] == "Grid" {
14371434
gridLayout := makeTerraformObject()

sumologic/resource_sumologic_dashboard_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,6 @@ func testAccCheckDashboardDestroy(dashboard Dashboard) resource.TestCheckFunc {
282282
if err == nil {
283283
return fmt.Errorf("Dashboard (id=%s) still exists", dashboard.ID)
284284
}
285-
// for _, r := range s.RootModule().Resources {
286-
// id := r.Primary.ID
287-
// u, err := client.GetDashboard(id)
288-
// if err != nil {
289-
// return fmt.Errorf("Encountered an error: " + err.Error())
290-
// }
291-
// if u != nil {
292-
// return fmt.Errorf("Dashboard %s still exists", id)
293-
// }
294-
// }
295285
return nil
296286
}
297287
}

0 commit comments

Comments
 (0)