Skip to content

Commit

Permalink
[Fix] Update Go SDK (#3826)
Browse files Browse the repository at this point in the history
## Changes
Fixed some errors in TF provider which came due to use of latest GO SDK
version

## Tests
<!-- 
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->

- [ ] `make test` run locally
- [ ] relevant change in `docs/` folder
- [ ] covered with integration tests in `internal/acceptance`
- [ ] relevant acceptance tests are passing
- [ ] using Go SDK
  • Loading branch information
Divyansh-db authored Jul 26, 2024
1 parent 06c761a commit c1ad31c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion catalog/permissions/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ func NewUnityCatalogPermissionsAPI(ctx context.Context, m any) UnityCatalogPermi

func (a UnityCatalogPermissionsAPI) GetPermissions(securable catalog.SecurableType, name string) (list *catalog.PermissionsList, err error) {
if securable.String() == "share" {
list, err = a.client.Shares.SharePermissions(a.context, sharing.SharePermissionsRequest{name})
list, err = a.client.Shares.SharePermissions(a.context, sharing.SharePermissionsRequest{
Name: name,
})
return
}
list, err = a.client.Grants.GetBySecurableTypeAndFullName(a.context, securable, name)
Expand Down
2 changes: 1 addition & 1 deletion exporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ var emptyRepos = qa.HTTPFixture{
var emptyShares = qa.HTTPFixture{
Method: "GET",
ReuseRequest: true,
Resource: "/api/2.1/unity-catalog/shares",
Resource: "/api/2.1/unity-catalog/shares?",
Response: sharing.ListSharesResponse{},
}

Expand Down
2 changes: 1 addition & 1 deletion exporter/importables.go
Original file line number Diff line number Diff line change
Expand Up @@ -2770,7 +2770,7 @@ var resourcesMap map[string]importable = map[string]importable{
WorkspaceLevel: true,
Service: "uc-shares",
List: func(ic *importContext) error {
shares, err := ic.workspaceClient.Shares.ListAll(ic.Context)
shares, err := ic.workspaceClient.Shares.ListAll(ic.Context, sharing.ListSharesRequest{})
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/importables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,7 @@ func TestListShares(t *testing.T) {
{
ReuseRequest: true,
Method: "GET",
Resource: "/api/2.1/unity-catalog/shares",
Resource: "/api/2.1/unity-catalog/shares?",
Response: sharing.ListSharesResponse{
Shares: []sharing.ShareInfo{
{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/databricks/terraform-provider-databricks
go 1.22

require (
github.com/databricks/databricks-sdk-go v0.43.3-0.20240722114738-7650ccc7998a
github.com/databricks/databricks-sdk-go v0.43.3-0.20240725113401-33ef9dbf3727
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/hcl v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBS
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/databricks/databricks-sdk-go v0.43.3-0.20240722114738-7650ccc7998a h1:ZeQihrvQqGf3CWs8gTZhAMmwCnh+RQThp/joeHJssWQ=
github.com/databricks/databricks-sdk-go v0.43.3-0.20240722114738-7650ccc7998a/go.mod h1:ds+zbv5mlQG7nFEU5ojLtgN/u0/9YzZmKQES/CfedzU=
github.com/databricks/databricks-sdk-go v0.43.3-0.20240725113401-33ef9dbf3727 h1:EwEUcWBPFBsosUGpyiiMXYbOfn+i5PM5hatP6gsDyXQ=
github.com/databricks/databricks-sdk-go v0.43.3-0.20240725113401-33ef9dbf3727/go.mod h1:ds+zbv5mlQG7nFEU5ojLtgN/u0/9YzZmKQES/CfedzU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
3 changes: 2 additions & 1 deletion sharing/data_shares.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/databricks/databricks-sdk-go"
"github.com/databricks/databricks-sdk-go/service/sharing"
"github.com/databricks/terraform-provider-databricks/common"
)

Expand All @@ -12,7 +13,7 @@ func DataSourceShares() common.Resource {
Shares []string `json:"shares,omitempty" tf:"computed,slice_set"`
}, w *databricks.WorkspaceClient) error {

shares, err := w.Shares.ListAll(ctx)
shares, err := w.Shares.ListAll(ctx, sharing.ListSharesRequest{})
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion sharing/data_shares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func TestSharesData(t *testing.T) {
Fixtures: []qa.HTTPFixture{
{
Method: "GET",
Resource: "/api/2.1/unity-catalog/shares",
Resource: "/api/2.1/unity-catalog/shares?",
Response: Shares{
Shares: []ShareInfo{
{
Expand Down

0 comments on commit c1ad31c

Please sign in to comment.