Skip to content

Commit

Permalink
Fixed issue with client usage
Browse files Browse the repository at this point in the history
  • Loading branch information
PCloughster committed Aug 16, 2024
1 parent 3448a58 commit 1798dd7
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions internal/provider/resource_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package provider
import (
"context"
"fmt"
"net/http"

accountservice "github.com/ans-group/sdk-go/pkg/service/account"
"github.com/hashicorp/terraform-plugin-framework/path"
Expand All @@ -26,7 +25,7 @@ func NewAccountsApplication() resource.Resource {

// AccountsApplication defines the resource implementation.
type AccountsApplication struct {
client *http.Client
client accountservice.AccountService
}

// AccountsApplicationModel describes the resource data model.
Expand Down Expand Up @@ -97,8 +96,7 @@ func (r *AccountsApplication) Schema(_ context.Context, _ resource.SchemaRequest

func (r *AccountsApplication) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var d AccountsApplicationModel
var meta interface{}
service := meta.(accountservice.AccountService)
service := r.client

resp.Diagnostics.Append(req.Plan.Get(ctx, &d)...)

Expand Down Expand Up @@ -158,8 +156,7 @@ func (r *AccountsApplication) Create(ctx context.Context, req resource.CreateReq

func (r *AccountsApplication) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
var d AccountsApplicationModel
var meta interface{}
service := meta.(accountservice.AccountService)
service := r.client
resp.Diagnostics.Append(req.State.Get(ctx, &d)...)

if resp.Diagnostics.HasError() {
Expand Down Expand Up @@ -212,8 +209,7 @@ func (r *AccountsApplication) Read(ctx context.Context, req resource.ReadRequest

func (r *AccountsApplication) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
var plan, d AccountsApplicationModel
var meta interface{}
service := meta.(accountservice.AccountService)
service := r.client

if !plan.Name.Equal(d.Name) || !plan.Description.Equal(d.Description) {
tflog.Info(ctx, "Updating Application Key Details", map[string]interface{}{
Expand Down Expand Up @@ -273,8 +269,7 @@ func (r *AccountsApplication) Update(ctx context.Context, req resource.UpdateReq

func (r *AccountsApplication) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
var d AccountsApplicationModel
var meta interface{}
service := meta.(accountservice.AccountService)
service := r.client

resp.Diagnostics.Append(req.State.Get(ctx, &d)...)

Expand Down

0 comments on commit 1798dd7

Please sign in to comment.