@@ -7,6 +7,11 @@ import (
77 "strconv"
88)
99
10+ const Resolved string = "Resolved"
11+ const FalsePositive string = "FalsePositive"
12+ const NoAction string = "NoAction"
13+ const Duplicate string = "Duplicate"
14+
1015func resourceSumologicCSEInsightsResolution () * schema.Resource {
1116 return & schema.Resource {
1217 Create : resourceSumologicCSEInsightsResolutionCreate ,
@@ -32,7 +37,7 @@ func resourceSumologicCSEInsightsResolution() *schema.Resource {
3237 Type : schema .TypeString ,
3338 Optional : true ,
3439 ForceNew : false ,
35- ValidateFunc : validation .StringInSlice ([]string {" Resolved" , "False Positive" , "No Action" , " Duplicate" }, false ),
40+ ValidateFunc : validation .StringInSlice ([]string {Resolved , FalsePositive , NoAction , Duplicate }, false ),
3641 },
3742 },
3843 }
@@ -42,11 +47,11 @@ func resourceSumologicCSEInsightsResolutionRead(d *schema.ResourceData, meta int
4247 c := meta .(* Client )
4348
4449 var CSEInsightsResolutionGet * CSEInsightsResolutionGet
45- id , _ := strconv . Atoi ( d .Id () )
50+ id := d .Id ()
4651
4752 CSEInsightsResolutionGet , err := c .GetCSEInsightsResolution (id )
4853 if err != nil {
49- log .Printf ("[WARN] CSE Insights Resolution not found when looking by id: %d , err: %v" , id , err )
54+ log .Printf ("[WARN] CSE Insights Resolution not found when looking by id: %s , err: %v" , id , err )
5055
5156 }
5257
@@ -69,13 +74,13 @@ func parentIdToParentName(parentId int) string {
6974
7075 if parentId > 0 {
7176 if parentId == 1 {
72- parentName = " Resolved"
77+ parentName = Resolved
7378 } else if parentId == 2 {
74- parentName = "False Positive"
79+ parentName = FalsePositive
7580 } else if parentId == 3 {
76- parentName = "No Action"
81+ parentName = NoAction
7782 } else if parentId == 4 {
78- parentName = " Duplicate"
83+ parentName = Duplicate
7984 }
8085 }
8186 return parentName
@@ -85,24 +90,23 @@ func parentNameToParentId(parentName string) int {
8590
8691 parentId := - 1
8792
88- if parentName != "" {
89- if parentName == "Resolved" {
90- parentId = 1
91- } else if parentName == "False Positive" {
92- parentId = 2
93- } else if parentName == "No Action" {
94- parentId = 3
95- } else if parentName == "Duplicate" {
96- parentId = 4
97- }
93+ if parentName == Resolved {
94+ parentId = 1
95+ } else if parentName == FalsePositive {
96+ parentId = 2
97+ } else if parentName == NoAction {
98+ parentId = 3
99+ } else if parentName == Duplicate {
100+ parentId = 4
98101 }
102+
99103 return parentId
100104}
101105
102106func resourceSumologicCSEInsightsResolutionDelete (d * schema.ResourceData , meta interface {}) error {
103107 c := meta .(* Client )
104108
105- id , _ := strconv . Atoi ( d .Id () )
109+ id := d .Id ()
106110 return c .DeleteCSEInsightsResolution (id )
107111
108112}
0 commit comments