Skip to content

Commit

Permalink
set user agent in resource context
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchy committed Oct 29, 2024
1 parent 3cc7c62 commit 52c62e3
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 52c62e3

Please sign in to comment.