From e3500130d778a2ab249725db672ba2df770a7c9e Mon Sep 17 00:00:00 2001 From: Omer Lachish Date: Thu, 24 Oct 2024 17:24:42 +0200 Subject: [PATCH] set user agent in resource context --- .../pluginfw/resources/sharing/resource_share.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/providers/pluginfw/resources/sharing/resource_share.go b/internal/providers/pluginfw/resources/sharing/resource_share.go index ce6b6d88b..b96cd0e97 100644 --- a/internal/providers/pluginfw/resources/sharing/resource_share.go +++ b/internal/providers/pluginfw/resources/sharing/resource_share.go @@ -9,6 +9,7 @@ import ( "github.com/databricks/databricks-sdk-go/service/sharing" "github.com/databricks/terraform-provider-databricks/common" pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + pluginfwcontext "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/context" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/converters" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" "github.com/databricks/terraform-provider-databricks/internal/service/sharing_tf" @@ -162,6 +163,8 @@ func (d *ShareResource) Configure(ctx context.Context, req resource.ConfigureReq } func (r *ShareResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + ctx = pluginfwcontext.SetUserAgentInResourceContext(ctx, resourceName) + w, diags := r.Client.GetWorkspaceClient() resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { @@ -223,6 +226,8 @@ func (r *ShareResource) Create(ctx context.Context, req resource.CreateRequest, } func (r *ShareResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + ctx = pluginfwcontext.SetUserAgentInResourceContext(ctx, resourceName) + var existingState ShareInfoExtended resp.Diagnostics.Append(req.State.Get(ctx, &existingState)...) if resp.Diagnostics.HasError() { @@ -276,6 +281,8 @@ func (r *ShareResource) Read(ctx context.Context, req resource.ReadRequest, resp } func (r *ShareResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + ctx = pluginfwcontext.SetUserAgentInResourceContext(ctx, resourceName) + var state ShareInfoExtended resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { @@ -373,6 +380,8 @@ func (r *ShareResource) Update(ctx context.Context, req resource.UpdateRequest, } func (r *ShareResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + ctx = pluginfwcontext.SetUserAgentInResourceContext(ctx, resourceName) + w, diags := r.Client.GetWorkspaceClient() resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() {