@@ -6,9 +6,9 @@ package provider
66import (
77 "context"
88 "fmt"
9- "net/http"
109
1110 "github.com/aep-dev/aep-lib-go/pkg/api"
11+ "github.com/aep-dev/aep-lib-go/pkg/client"
1212 "github.com/hashicorp/terraform-plugin-framework/path"
1313 "github.com/hashicorp/terraform-plugin-framework/resource"
1414 "github.com/hashicorp/terraform-plugin-framework/resource/schema"
@@ -41,7 +41,7 @@ type ExampleResource struct {
4141 name string
4242
4343 // Client will be configured at plan/apply time in the Configure() function.
44- client * http .Client
44+ client * client .Client
4545}
4646
4747func (r * ExampleResource ) Metadata (ctx context.Context , req resource.MetadataRequest , resp * resource.MetadataResponse ) {
@@ -68,7 +68,7 @@ func (r *ExampleResource) Configure(ctx context.Context, req resource.ConfigureR
6868 return
6969 }
7070
71- client , ok := req .ProviderData .(* http .Client )
71+ client , ok := req .ProviderData .(* client .Client )
7272
7373 if ! ok {
7474 resp .Diagnostics .AddError (
@@ -104,7 +104,7 @@ func (r *ExampleResource) Create(ctx context.Context, req resource.CreateRequest
104104 return
105105 }
106106
107- a , err := Create (ctx , r .resource , r . client , r .api .ServerURL , body , parameters )
107+ a , err := r . client . Create (ctx , r .resource , r .api .ServerURL , body , parameters )
108108
109109 if err != nil {
110110 resp .Diagnostics .AddError ("Client Error" , fmt .Sprintf ("Unable to create example, got error: %s" , err ))
@@ -148,7 +148,7 @@ func (r *ExampleResource) Read(ctx context.Context, req resource.ReadRequest, re
148148 return
149149 }
150150
151- a , err := Read ( ctx , r .client , r .api .ServerURL , path )
151+ a , err := r .client . Get ( ctx , r .api .ServerURL , path )
152152 if err != nil {
153153 resp .Diagnostics .AddError ("Client Error" , fmt .Sprintf ("Unable to read example, got error: %s" , err ))
154154 return
@@ -194,14 +194,14 @@ func (r *ExampleResource) Update(ctx context.Context, req resource.UpdateRequest
194194
195195 }
196196
197- err = Update ( ctx , r .client , r .api .ServerURL , * s .String , body )
197+ err = r .client . Update ( ctx , r .api .ServerURL , * s .String , body )
198198
199199 if err != nil {
200200 resp .Diagnostics .AddError ("Client Error" , fmt .Sprintf ("Unable to update example, got error: %s" , err ))
201201 return
202202 }
203203
204- a , err := Read ( ctx , r .client , r .api .ServerURL , * s .String )
204+ a , err := r .client . Get ( ctx , r .api .ServerURL , * s .String )
205205 if err != nil {
206206 resp .Diagnostics .AddError ("Client Error" , fmt .Sprintf ("Unable to read example, got error: %s" , err ))
207207 return
@@ -240,7 +240,7 @@ func (r *ExampleResource) Delete(ctx context.Context, req resource.DeleteRequest
240240
241241 }
242242
243- err := Delete ( ctx , r .client , r .api .ServerURL , * s .String )
243+ err := r .client . Delete ( ctx , r .api .ServerURL , * s .String )
244244 if err != nil {
245245 resp .Diagnostics .AddError ("Client Error" , fmt .Sprintf ("Unable to delete example, got error: %s" , err ))
246246 return
0 commit comments