@@ -149,23 +149,25 @@ func ReadAlertNotification(ctx context.Context, d *schema.ResourceData, meta int
149149 settings := map [string ]interface {}{}
150150 for k , v := range alertNotification .Settings .(map [string ]interface {}) {
151151 boolVal , ok := v .(bool )
152- if ok && boolVal {
152+ switch {
153+ case ok && boolVal :
153154 settings [k ] = "true"
154- } else if ok && ! boolVal {
155+ case ok && ! boolVal :
155156 settings [k ] = "false"
156- } else {
157+ default :
157158 settings [k ] = v
158159 }
159160 }
160161 secureSettings := map [string ]interface {}{}
161162
162163 for k , v := range alertNotification .SecureFields .(map [string ]interface {}) {
163164 boolVal , ok := v .(bool )
164- if ok && boolVal {
165+ switch {
166+ case ok && boolVal :
165167 secureSettings [k ] = "true"
166- } else if ok && ! boolVal {
168+ case ok && ! boolVal :
167169 secureSettings [k ] = "false"
168- } else {
170+ default :
169171 secureSettings [k ] = v
170172 }
171173 }
@@ -199,7 +201,7 @@ func DeleteAlertNotification(ctx context.Context, d *schema.ResourceData, meta i
199201 return diag.Diagnostics {}
200202}
201203
202- func makeAlertNotification (ctx context.Context , d * schema.ResourceData ) (* gapi.AlertNotification , error ) {
204+ func makeAlertNotification (_ context.Context , d * schema.ResourceData ) (* gapi.AlertNotification , error ) {
203205 idStr := d .Id ()
204206 var id int64
205207 var err error
@@ -210,22 +212,24 @@ func makeAlertNotification(ctx context.Context, d *schema.ResourceData) (*gapi.A
210212 settings := map [string ]interface {}{}
211213 for k , v := range d .Get ("settings" ).(map [string ]interface {}) {
212214 strVal , ok := v .(string )
213- if ok && strVal == "true" {
215+ switch {
216+ case ok && strVal == "true" :
214217 settings [k ] = true
215- } else if ok && strVal == "false" {
218+ case ok && strVal == "false" :
216219 settings [k ] = false
217- } else {
220+ default :
218221 settings [k ] = v
219222 }
220223 }
221224 secureSettings := map [string ]interface {}{}
222225 for k , v := range d .Get ("secure_settings" ).(map [string ]interface {}) {
223226 strVal , ok := v .(string )
224- if ok && strVal == "true" {
227+ switch {
228+ case ok && strVal == "true" :
225229 secureSettings [k ] = true
226- } else if ok && strVal == "false" {
230+ case ok && strVal == "false" :
227231 secureSettings [k ] = false
228- } else {
232+ default :
229233 secureSettings [k ] = v
230234 }
231235 }
0 commit comments