Skip to content

Commit

Permalink
[Internal] use Go SDK for Read operation
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchy committed Aug 20, 2024
1 parent 81be591 commit e7967c4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sharing/resource_share.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,20 @@ func ResourceShare() common.Resource {
return nil
},
Read: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
si, err := NewSharesAPI(ctx, c).get(d.Id())
client, err := c.WorkspaceClient()
if err != nil {
return err
}
return common.StructToData(si, shareSchema, d)

shareInfo, err := client.Shares.Get(ctx, sharing.GetShareRequest{
Name: d.Id(),
IncludeSharedData: true,
})
if err != nil {
return err
}

return common.StructToData(shareInfo, shareSchema, d)
},
Update: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
beforeSi, err := NewSharesAPI(ctx, c).get(d.Id())
Expand Down

0 comments on commit e7967c4

Please sign in to comment.