@@ -79,8 +79,8 @@ func resourceArgoCDApplicationCreate(ctx context.Context, d *schema.ResourceData
7979 return diags
8080 }
8181
82- server := meta .(* ServerInterface )
83- if err := server .initClients (ctx ); err != nil {
82+ si := meta .(* ServerInterface )
83+ if err := si .initClients (ctx ); err != nil {
8484 return []diag.Diagnostic {
8585 {
8686 Severity : diag .Error ,
@@ -90,9 +90,7 @@ func resourceArgoCDApplicationCreate(ctx context.Context, d *schema.ResourceData
9090 }
9191 }
9292
93- c := * server .ApplicationClient
94-
95- apps , err := c .List (ctx , & applicationClient.ApplicationQuery {
93+ apps , err := si .ApplicationClient .List (ctx , & applicationClient.ApplicationQuery {
9694 Name : & objectMeta .Name ,
9795 AppNamespace : & objectMeta .Namespace ,
9896 })
@@ -125,7 +123,7 @@ func resourceArgoCDApplicationCreate(ctx context.Context, d *schema.ResourceData
125123 }
126124 }
127125
128- featureApplicationLevelSyncOptionsSupported , err := server .isFeatureSupported (featureApplicationLevelSyncOptions )
126+ featureApplicationLevelSyncOptionsSupported , err := si .isFeatureSupported (featureApplicationLevelSyncOptions )
129127 if err != nil {
130128 return []diag.Diagnostic {
131129 {
@@ -150,7 +148,7 @@ func resourceArgoCDApplicationCreate(ctx context.Context, d *schema.ResourceData
150148 }
151149 }
152150
153- featureIgnoreDiffJQPathExpressionsSupported , err := server .isFeatureSupported (featureIgnoreDiffJQPathExpressions )
151+ featureIgnoreDiffJQPathExpressionsSupported , err := si .isFeatureSupported (featureIgnoreDiffJQPathExpressions )
154152 if err != nil {
155153 return []diag.Diagnostic {
156154 {
@@ -183,7 +181,7 @@ func resourceArgoCDApplicationCreate(ctx context.Context, d *schema.ResourceData
183181 }
184182 }
185183
186- featureApplicationHelmSkipCrdsSupported , err := server .isFeatureSupported (featureApplicationHelmSkipCrds )
184+ featureApplicationHelmSkipCrdsSupported , err := si .isFeatureSupported (featureApplicationHelmSkipCrds )
187185 if err != nil {
188186 return []diag.Diagnostic {
189187 {
@@ -208,7 +206,7 @@ func resourceArgoCDApplicationCreate(ctx context.Context, d *schema.ResourceData
208206 }
209207 }
210208
211- app , err := c .Create (ctx , & applicationClient.ApplicationCreateRequest {
209+ app , err := si . ApplicationClient .Create (ctx , & applicationClient.ApplicationCreateRequest {
212210 Application : & application.Application {
213211 ObjectMeta : objectMeta ,
214212 Spec : spec ,
@@ -240,7 +238,7 @@ func resourceArgoCDApplicationCreate(ctx context.Context, d *schema.ResourceData
240238 if wait , ok := d .GetOk ("wait" ); ok && wait .(bool ) {
241239 if err = resource .RetryContext (ctx , d .Timeout (schema .TimeoutCreate ), func () * resource.RetryError {
242240 var list * application.ApplicationList
243- if list , err = c .List (ctx , & applicationClient.ApplicationQuery {
241+ if list , err = si . ApplicationClient .List (ctx , & applicationClient.ApplicationQuery {
244242 Name : & app .Name ,
245243 AppNamespace : & app .Namespace ,
246244 }); err != nil {
@@ -275,8 +273,8 @@ func resourceArgoCDApplicationCreate(ctx context.Context, d *schema.ResourceData
275273}
276274
277275func resourceArgoCDApplicationRead (ctx context.Context , d * schema.ResourceData , meta interface {}) diag.Diagnostics {
278- server := meta .(* ServerInterface )
279- if err := server .initClients (ctx ); err != nil {
276+ si := meta .(* ServerInterface )
277+ if err := si .initClients (ctx ); err != nil {
280278 return []diag.Diagnostic {
281279 {
282280 Severity : diag .Error ,
@@ -286,13 +284,11 @@ func resourceArgoCDApplicationRead(ctx context.Context, d *schema.ResourceData,
286284 }
287285 }
288286
289- c := * server .ApplicationClient
290-
291287 ids := strings .Split (d .Id (), ":" )
292288 appName := ids [0 ]
293289 namespace := ids [1 ]
294290
295- apps , err := c .List (ctx , & applicationClient.ApplicationQuery {
291+ apps , err := si . ApplicationClient .List (ctx , & applicationClient.ApplicationQuery {
296292 Name : & appName ,
297293 AppNamespace : & namespace ,
298294 })
@@ -340,8 +336,8 @@ func resourceArgoCDApplicationUpdate(ctx context.Context, d *schema.ResourceData
340336 return resourceArgoCDApplicationRead (ctx , d , meta )
341337 }
342338
343- server := meta .(* ServerInterface )
344- if err := server .initClients (ctx ); err != nil {
339+ si := meta .(* ServerInterface )
340+ if err := si .initClients (ctx ); err != nil {
345341 return []diag.Diagnostic {
346342 {
347343 Severity : diag .Error ,
@@ -356,7 +352,7 @@ func resourceArgoCDApplicationUpdate(ctx context.Context, d *schema.ResourceData
356352 return diags
357353 }
358354
359- featureApplicationLevelSyncOptionsSupported , err := server .isFeatureSupported (featureApplicationLevelSyncOptions )
355+ featureApplicationLevelSyncOptionsSupported , err := si .isFeatureSupported (featureApplicationLevelSyncOptions )
360356 if err != nil {
361357 return []diag.Diagnostic {
362358 {
@@ -381,7 +377,7 @@ func resourceArgoCDApplicationUpdate(ctx context.Context, d *schema.ResourceData
381377 }
382378 }
383379
384- featureIgnoreDiffJQPathExpressionsSupported , err := server .isFeatureSupported (featureIgnoreDiffJQPathExpressions )
380+ featureIgnoreDiffJQPathExpressionsSupported , err := si .isFeatureSupported (featureIgnoreDiffJQPathExpressions )
385381 if err != nil {
386382 return []diag.Diagnostic {
387383 {
@@ -414,7 +410,7 @@ func resourceArgoCDApplicationUpdate(ctx context.Context, d *schema.ResourceData
414410 }
415411 }
416412
417- featureApplicationHelmSkipCrdsSupported , err := server .isFeatureSupported (featureApplicationHelmSkipCrds )
413+ featureApplicationHelmSkipCrdsSupported , err := si .isFeatureSupported (featureApplicationHelmSkipCrds )
418414 if err != nil {
419415 return []diag.Diagnostic {
420416 {
@@ -437,14 +433,13 @@ func resourceArgoCDApplicationUpdate(ctx context.Context, d *schema.ResourceData
437433 }
438434 }
439435
440- c := * server .ApplicationClient
441436 ids := strings .Split (d .Id (), ":" )
442437 appQuery := & applicationClient.ApplicationQuery {
443438 Name : & ids [0 ],
444439 AppNamespace : & ids [1 ],
445440 }
446441
447- apps , err := c .List (ctx , appQuery )
442+ apps , err := si . ApplicationClient .List (ctx , appQuery )
448443 if err != nil {
449444 return []diag.Diagnostic {
450445 {
@@ -471,7 +466,7 @@ func resourceArgoCDApplicationUpdate(ctx context.Context, d *schema.ResourceData
471466 }
472467 }
473468
474- if _ , err = c .Update (ctx , & applicationClient.ApplicationUpdateRequest {
469+ if _ , err = si . ApplicationClient .Update (ctx , & applicationClient.ApplicationUpdateRequest {
475470 Application : & application.Application {
476471 ObjectMeta : objectMeta ,
477472 Spec : spec ,
@@ -493,7 +488,7 @@ func resourceArgoCDApplicationUpdate(ctx context.Context, d *schema.ResourceData
493488 if wait , _ok := d .GetOk ("wait" ); _ok && wait .(bool ) {
494489 if err = resource .RetryContext (ctx , d .Timeout (schema .TimeoutUpdate ), func () * resource.RetryError {
495490 var list * application.ApplicationList
496- if list , err = c .List (ctx , appQuery ); err != nil {
491+ if list , err = si . ApplicationClient .List (ctx , appQuery ); err != nil {
497492 return resource .NonRetryableError (fmt .Errorf ("error while waiting for application %s to be synced and healthy: %s" , list .Items [0 ].Name , err ))
498493 }
499494
@@ -529,8 +524,8 @@ func resourceArgoCDApplicationUpdate(ctx context.Context, d *schema.ResourceData
529524}
530525
531526func resourceArgoCDApplicationDelete (ctx context.Context , d * schema.ResourceData , meta interface {}) diag.Diagnostics {
532- server := meta .(* ServerInterface )
533- if err := server .initClients (ctx ); err != nil {
527+ si := meta .(* ServerInterface )
528+ if err := si .initClients (ctx ); err != nil {
534529 return []diag.Diagnostic {
535530 {
536531 Severity : diag .Error ,
@@ -540,13 +535,12 @@ func resourceArgoCDApplicationDelete(ctx context.Context, d *schema.ResourceData
540535 }
541536 }
542537
543- c := * server .ApplicationClient
544538 ids := strings .Split (d .Id (), ":" )
545539 appName := ids [0 ]
546540 namespace := ids [1 ]
547541 cascade := d .Get ("cascade" ).(bool )
548542
549- if _ , err := c .Delete (ctx , & applicationClient.ApplicationDeleteRequest {
543+ if _ , err := si . ApplicationClient .Delete (ctx , & applicationClient.ApplicationDeleteRequest {
550544 Name : & appName ,
551545 Cascade : & cascade ,
552546 AppNamespace : & namespace ,
@@ -562,7 +556,7 @@ func resourceArgoCDApplicationDelete(ctx context.Context, d *schema.ResourceData
562556
563557 if wait , ok := d .GetOk ("wait" ); ok && wait .(bool ) {
564558 if err := resource .RetryContext (ctx , d .Timeout (schema .TimeoutDelete ), func () * resource.RetryError {
565- _ , err := c .List (ctx , & applicationClient.ApplicationQuery {
559+ _ , err := si . ApplicationClient .List (ctx , & applicationClient.ApplicationQuery {
566560 Name : & appName ,
567561 AppNamespace : & namespace ,
568562 })
0 commit comments