From 4af1638e2e46a05fe438326052d3348dde640392 Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Thu, 16 Nov 2023 13:14:07 +0100 Subject: [PATCH] fix client type --- internal/datasource/cluster.go | 9 +++++---- internal/datasource/gitrepository.go | 2 +- internal/resource/cluster.go | 9 +++++---- internal/resource/gitrepository.go | 2 +- internal/resource/service.go | 2 +- main.go | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/internal/datasource/cluster.go b/internal/datasource/cluster.go index b4148d2..8d4fa41 100644 --- a/internal/datasource/cluster.go +++ b/internal/datasource/cluster.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "terraform-provider-plural/internal/client" "terraform-provider-plural/internal/model" "github.com/hashicorp/terraform-plugin-framework/datasource" @@ -17,7 +18,7 @@ func NewClusterDataSource() datasource.DataSource { } type clusterDataSource struct { - client *console.Client + client *client.Client } func (d *clusterDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { @@ -68,16 +69,16 @@ func (d *clusterDataSource) Configure(_ context.Context, req datasource.Configur return } - client, ok := req.ProviderData.(*console.Client) + c, ok := req.ProviderData.(*client.Client) if !ok { resp.Diagnostics.AddError( "Unexpected Cluster Resource Configure Type", - fmt.Sprintf("Expected *console.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - d.client = client + d.client = c } func (d *clusterDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { diff --git a/internal/datasource/gitrepository.go b/internal/datasource/gitrepository.go index 9d327a1..86628c1 100644 --- a/internal/datasource/gitrepository.go +++ b/internal/datasource/gitrepository.go @@ -95,7 +95,7 @@ func (r *GitRepositoryDataSource) Configure(_ context.Context, req datasource.Co if !ok { resp.Diagnostics.AddError( "Unexpected GitRepository Resource Configure Type", - fmt.Sprintf("Expected *console.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return diff --git a/internal/resource/cluster.go b/internal/resource/cluster.go index 65c5f1b..c82c67d 100644 --- a/internal/resource/cluster.go +++ b/internal/resource/cluster.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "terraform-provider-plural/internal/client" "terraform-provider-plural/internal/model" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" @@ -27,7 +28,7 @@ func NewClusterResource() resource.Resource { // ClusterResource defines the cluster resource implementation. type clusterResource struct { - client *console.Client + client *client.Client } func (r *clusterResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { @@ -81,16 +82,16 @@ func (r *clusterResource) Configure(_ context.Context, req resource.ConfigureReq return } - client, ok := req.ProviderData.(*console.Client) + c, ok := req.ProviderData.(*client.Client) if !ok { resp.Diagnostics.AddError( "Unexpected Cluster Resource Configure Type", - fmt.Sprintf("Expected *console.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = c } func (r *clusterResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { diff --git a/internal/resource/gitrepository.go b/internal/resource/gitrepository.go index b3cc8b5..cc36bda 100644 --- a/internal/resource/gitrepository.go +++ b/internal/resource/gitrepository.go @@ -104,7 +104,7 @@ func (r *GitRepositoryResource) Configure(_ context.Context, req resource.Config if !ok { resp.Diagnostics.AddError( "Unexpected GitRepository Resource Configure Type", - fmt.Sprintf("Expected *console.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return diff --git a/internal/resource/service.go b/internal/resource/service.go index 738506c..6438058 100644 --- a/internal/resource/service.go +++ b/internal/resource/service.go @@ -139,7 +139,7 @@ func (r *ServiceDeploymentResource) Configure(_ context.Context, req resource.Co if !ok { resp.Diagnostics.AddError( "Unexpected ServiceDeployment Resource Configure Type", - fmt.Sprintf("Expected *console.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return diff --git a/main.go b/main.go index 1bac99d..87afa13 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,7 @@ func main() { flag.Parse() opts := providerserver.ServeOpts{ - Address: "registry.terraform.io/hashicorp/plural", + Address: "registry.terraform.io/pluralsh/plural", Debug: debug, }