Skip to content

Commit 161e0cf

Browse files
authored
fix: Update GDP resources to handle UnifiedClient type (#55)
Signed-off-by: Reza Roveicy <roveicy@ibm.com> Signed-off-by: Reza Rasolroveicy <roveicy@ibm.com>
1 parent e2e8721 commit 161e0cf

7 files changed

Lines changed: 23 additions & 22 deletions

internal/provider/authentication_data_source.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,17 @@ func (d *AuthenticationDataSource) Configure(ctx context.Context, req datasource
8888
return
8989
}
9090

91-
client, ok := req.ProviderData.(*gdp.Client)
91+
unifiedClient, ok := req.ProviderData.(*UnifiedClient)
9292
if !ok {
9393
resp.Diagnostics.AddError(
9494
"Unexpected Data Source Configure Type",
95-
fmt.Sprintf("Expected *gdp.Client, got: %T.", req.ProviderData),
95+
fmt.Sprintf("Expected *UnifiedClient, got: %T.", req.ProviderData),
9696
)
9797

9898
return
9999
}
100100

101-
d.client = client
101+
d.client = unifiedClient.GDPClient
102102
}
103103

104104
type AuthenticationResponse struct {

internal/provider/aws_secrets_manager_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ func (r *AWSSecretsManagerResource) Configure(ctx context.Context, req resource.
101101
return
102102
}
103103

104-
client, ok := req.ProviderData.(*gdp.Client)
104+
unifiedClient, ok := req.ProviderData.(*UnifiedClient)
105105
if !ok {
106-
resp.Diagnostics.AddError("Unexpected Resource Configure Type", fmt.Sprintf("Expected *gdp.Client, got: %T", req.ProviderData))
106+
resp.Diagnostics.AddError("Unexpected Resource Configure Type", fmt.Sprintf("Expected *UnifiedClient, got: %T", req.ProviderData))
107107
return
108108
}
109109

110-
r.client = client
110+
r.client = unifiedClient.GDPClient
111111
}
112112

113113
// Create creates the resource and sets the initial Terraform state

internal/provider/configure_va_datasource_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@ func (r *configureVADatasourceResource) Configure(ctx context.Context, req resou
109109
return
110110
}
111111

112-
client, ok := req.ProviderData.(*gdp.Client)
112+
unifiedClient, ok := req.ProviderData.(*UnifiedClient)
113113
if !ok {
114114
resp.Diagnostics.AddError(
115115
"Unexpected Resource Configure Type",
116-
fmt.Sprintf("Expected *gdp.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
116+
fmt.Sprintf("Expected *UnifiedClient, got: %T. Please report this issue to the provider developers.", req.ProviderData),
117117
)
118118
return
119119
}
120120

121-
r.client = client
121+
r.client = unifiedClient.GDPClient
122122
}
123123

124124
func (r *configureVADatasourceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {

internal/provider/configure_va_notifications_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ func (r *configureVANotificationsResource) Configure(ctx context.Context, req re
112112
return
113113
}
114114

115-
client, ok := req.ProviderData.(*gdp.Client)
115+
unifiedClient, ok := req.ProviderData.(*UnifiedClient)
116116
if !ok {
117117
resp.Diagnostics.AddError(
118118
"Unexpected Resource Configure Type",
119-
fmt.Sprintf("Expected *gdp.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
119+
fmt.Sprintf("Expected *UnifiedClient, got: %T. Please report this issue to the provider developers.", req.ProviderData),
120120
)
121121
return
122122
}
123123

124-
r.client = client
124+
r.client = unifiedClient.GDPClient
125125
}
126126

127127
func (r *configureVANotificationsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {

internal/provider/import_profiles_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ func (r *ImportProfilesResource) Configure(ctx context.Context, req resource.Con
7777
return
7878
}
7979

80-
client, ok := req.ProviderData.(*gdp.Client)
80+
unifiedClient, ok := req.ProviderData.(*UnifiedClient)
8181
if !ok {
82-
resp.Diagnostics.AddError("Unexpected Resource Configure Type", fmt.Sprintf("Expected *gdp.Client, got: %T", req.ProviderData))
82+
resp.Diagnostics.AddError("Unexpected Resource Configure Type", fmt.Sprintf("Expected *UnifiedClient, got: %T", req.ProviderData))
8383
return
8484
}
8585

86-
r.client = client
86+
r.client = unifiedClient.GDPClient
8787
}
8888

8989
// Create creates the resource and sets the initial Terraform state

internal/provider/install_connector_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ func (r *InstallConnectorResource) Configure(ctx context.Context, req resource.C
7272
return
7373
}
7474

75-
client, ok := req.ProviderData.(*gdp.Client)
75+
unifiedClient, ok := req.ProviderData.(*UnifiedClient)
7676
if !ok {
7777
resp.Diagnostics.AddError(
7878
"Unexpected Resource Configure Type",
79-
fmt.Sprintf("Expected *gdp.Client, got: %T", req.ProviderData),
79+
fmt.Sprintf("Expected *UnifiedClient, got: %T", req.ProviderData),
8080
)
8181
return
8282
}
8383

84-
r.client = client
84+
r.client = unifiedClient.GDPClient
8585
}
8686

8787
// Create creates the resource and sets the initial Terraform state

internal/provider/register_va_datasource_resource.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import (
77
"context"
88
"crypto/sha256"
99
"fmt"
10-
"github.com/hashicorp/terraform-plugin-log/tflog"
1110
"strconv"
1211
"time"
1312

13+
"github.com/hashicorp/terraform-plugin-log/tflog"
14+
1415
"github.com/hashicorp/terraform-plugin-framework/path"
1516
"github.com/hashicorp/terraform-plugin-framework/resource"
1617
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
@@ -92,16 +93,16 @@ func (r *registerVADatasourceResource) Configure(ctx context.Context, req resour
9293
return
9394
}
9495

95-
client, ok := req.ProviderData.(*gdp.Client)
96+
unifiedClient, ok := req.ProviderData.(*UnifiedClient)
9697
if !ok {
9798
resp.Diagnostics.AddError(
9899
"Unexpected Resource Configure Type",
99-
fmt.Sprintf("Expected *gdp.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
100+
fmt.Sprintf("Expected *UnifiedClient, got: %T. Please report this issue to the provider developers.", req.ProviderData),
100101
)
101102
return
102103
}
103104

104-
r.client = client
105+
r.client = unifiedClient.GDPClient
105106
}
106107

107108
func (r *registerVADatasourceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {

0 commit comments

Comments
 (0)