Skip to content

Commit 34d393c

Browse files
authored
Bump github.com/databricks/databricks-sdk-go from 0.17.0 to 0.19.1 (#2660)
* Bump github.com/databricks/databricks-sdk-go from 0.17.0 to 0.19.1 * fix DeleteMetastore tests * fix CatalogDelete test
1 parent b4e119e commit 34d393c

File tree

6 files changed

+71
-108
lines changed

6 files changed

+71
-108
lines changed

catalog/data_metastores.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ func DataSourceMetastores() *schema.Resource {
1414
Ids map[string]string `json:"ids,omitempty" tf:"computed"`
1515
}
1616
return common.AccountData(func(ctx context.Context, data *metastoresData, acc *databricks.AccountClient) error {
17-
metastores, err := acc.Metastores.List(ctx)
17+
metastores, err := acc.Metastores.ListAll(ctx)
1818
if err != nil {
1919
return err
2020
}
2121
data.Ids = map[string]string{}
22-
for _, v := range metastores.Metastores {
22+
for _, v := range metastores {
2323
name := v.Name
2424
_, duplicateName := data.Ids[name]
2525
if duplicateName {

catalog/resource_catalog_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func TestForceDeleteCatalog(t *testing.T) {
324324
},
325325
{
326326
Method: "DELETE",
327-
Resource: "/api/2.1/unity-catalog/catalogs/b",
327+
Resource: "/api/2.1/unity-catalog/catalogs/b?force=true",
328328
},
329329
},
330330
Resource: ResourceCatalog(),

catalog/resource_metastore_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func TestDeleteMetastore(t *testing.T) {
144144
Fixtures: []qa.HTTPFixture{
145145
{
146146
Method: "DELETE",
147-
Resource: "/api/2.1/unity-catalog/metastores/abc",
147+
Resource: "/api/2.1/unity-catalog/metastores/abc?",
148148
},
149149
},
150150
Resource: ResourceMetastore(),
@@ -161,9 +161,8 @@ func TestForceDeleteMetastore(t *testing.T) {
161161
qa.ResourceFixture{
162162
Fixtures: []qa.HTTPFixture{
163163
{
164-
Method: "DELETE",
165-
Resource: "/api/2.1/unity-catalog/metastores/abc",
166-
ExpectedRequest: map[string]interface{}{"-": "abc", "force": true},
164+
Method: "DELETE",
165+
Resource: "/api/2.1/unity-catalog/metastores/abc?force=true",
167166
},
168167
},
169168
Resource: ResourceMetastore(),

common/client.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,27 +99,27 @@ func (c *DatabricksClient) AccountOrWorkspaceRequest(accCallback func(*databrick
9999

100100
// Get on path
101101
func (c *DatabricksClient) Get(ctx context.Context, path string, request any, response any) error {
102-
return c.Do(ctx, http.MethodGet, path, request, response, c.addApiPrefix)
102+
return c.Do(ctx, http.MethodGet, path, nil, request, response, c.addApiPrefix)
103103
}
104104

105105
// Post on path
106106
func (c *DatabricksClient) Post(ctx context.Context, path string, request any, response any) error {
107-
return c.Do(ctx, http.MethodPost, path, request, response, c.addApiPrefix)
107+
return c.Do(ctx, http.MethodPost, path, nil, request, response, c.addApiPrefix)
108108
}
109109

110110
// Delete on path
111111
func (c *DatabricksClient) Delete(ctx context.Context, path string, request any) error {
112-
return c.Do(ctx, http.MethodDelete, path, request, nil, c.addApiPrefix)
112+
return c.Do(ctx, http.MethodDelete, path, nil, request, nil, c.addApiPrefix)
113113
}
114114

115115
// Patch on path
116116
func (c *DatabricksClient) Patch(ctx context.Context, path string, request any) error {
117-
return c.Do(ctx, http.MethodPatch, path, request, nil, c.addApiPrefix)
117+
return c.Do(ctx, http.MethodPatch, path, nil, request, nil, c.addApiPrefix)
118118
}
119119

120120
// Put on path
121121
func (c *DatabricksClient) Put(ctx context.Context, path string, request any) error {
122-
return c.Do(ctx, http.MethodPut, path, request, nil, c.addApiPrefix)
122+
return c.Do(ctx, http.MethodPut, path, nil, request, nil, c.addApiPrefix)
123123
}
124124

125125
type ApiVersion string
@@ -145,7 +145,6 @@ func (c *DatabricksClient) addApiPrefix(r *http.Request) error {
145145

146146
// scimVisitor is a separate method for the sake of unit tests
147147
func (c *DatabricksClient) scimVisitor(r *http.Request) error {
148-
r.Header.Set("Content-Type", "application/scim+json; charset=utf-8")
149148
if c.Config.IsAccountClient() && c.Config.AccountID != "" {
150149
// until `/preview` is there for workspace scim,
151150
// `/api/2.0` is added by completeUrl visitor
@@ -157,7 +156,9 @@ func (c *DatabricksClient) scimVisitor(r *http.Request) error {
157156

158157
// Scim sets SCIM headers
159158
func (c *DatabricksClient) Scim(ctx context.Context, method, path string, request any, response any) error {
160-
return c.Do(ctx, method, path, request, response, c.addApiPrefix, c.scimVisitor)
159+
return c.Do(ctx, method, path, map[string]string{
160+
"Content-Type": "application/scim+json; charset=utf-8",
161+
}, request, response, c.addApiPrefix, c.scimVisitor)
161162
}
162163

163164
// IsAzure returns true if client is configured for Azure Databricks - either by using AAD auth or with host+token combination

go.mod

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ module github.com/databricks/terraform-provider-databricks
33
go 1.19
44

55
require (
6-
github.com/databricks/databricks-sdk-go v0.17.0
6+
github.com/databricks/databricks-sdk-go v0.19.1
77
github.com/golang-jwt/jwt/v4 v4.5.0
88
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
99
github.com/hashicorp/hcl v1.0.0
1010
github.com/hashicorp/hcl/v2 v2.18.0
11-
github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0
11+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0
1212
github.com/stretchr/testify v1.8.4
13-
github.com/zclconf/go-cty v1.13.3
14-
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
13+
github.com/zclconf/go-cty v1.14.0
14+
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
1515
golang.org/x/mod v0.12.0
1616
)
1717

@@ -20,7 +20,6 @@ require (
2020
cloud.google.com/go/compute/metadata v0.2.3 // indirect
2121
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
2222
github.com/agext/levenshtein v1.2.3 // indirect
23-
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
2423
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
2524
github.com/cloudflare/circl v1.3.3 // indirect
2625
github.com/davecgh/go-spew v1.1.1 // indirect
@@ -29,21 +28,21 @@ require (
2928
github.com/golang/protobuf v1.5.3 // indirect
3029
github.com/google/go-cmp v0.5.9 // indirect
3130
github.com/google/go-querystring v1.1.0 // indirect
32-
github.com/google/s2a-go v0.1.5 // indirect
31+
github.com/google/s2a-go v0.1.7 // indirect
3332
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
3433
github.com/hashicorp/errwrap v1.1.0 // indirect
3534
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
3635
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
3736
github.com/hashicorp/go-hclog v1.5.0 // indirect
3837
github.com/hashicorp/go-multierror v1.1.1 // indirect
39-
github.com/hashicorp/go-plugin v1.4.10 // indirect
38+
github.com/hashicorp/go-plugin v1.5.1 // indirect
4039
github.com/hashicorp/go-uuid v1.0.3 // indirect
4140
github.com/hashicorp/go-version v1.6.0 // indirect
42-
github.com/hashicorp/hc-install v0.5.2 // indirect
41+
github.com/hashicorp/hc-install v0.6.0 // indirect
4342
github.com/hashicorp/logutils v1.0.0 // indirect
44-
github.com/hashicorp/terraform-exec v0.18.1 // indirect
43+
github.com/hashicorp/terraform-exec v0.19.0 // indirect
4544
github.com/hashicorp/terraform-json v0.17.1 // indirect
46-
github.com/hashicorp/terraform-plugin-go v0.18.0 // indirect
45+
github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect
4746
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
4847
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
4948
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
@@ -61,16 +60,16 @@ require (
6160
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
6261
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
6362
go.opencensus.io v0.24.0 // indirect
64-
golang.org/x/crypto v0.12.0 // indirect
65-
golang.org/x/net v0.14.0 // indirect
66-
golang.org/x/oauth2 v0.11.0 // indirect
67-
golang.org/x/sys v0.11.0 // indirect
68-
golang.org/x/text v0.12.0 // indirect
63+
golang.org/x/crypto v0.13.0 // indirect
64+
golang.org/x/net v0.15.0 // indirect
65+
golang.org/x/oauth2 v0.12.0 // indirect
66+
golang.org/x/sys v0.12.0 // indirect
67+
golang.org/x/text v0.13.0 // indirect
6968
golang.org/x/time v0.3.0 // indirect
7069
google.golang.org/api v0.138.0 // indirect
71-
google.golang.org/appengine v1.6.7 // indirect
70+
google.golang.org/appengine v1.6.8 // indirect
7271
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
73-
google.golang.org/grpc v1.57.0 // indirect
72+
google.golang.org/grpc v1.58.0 // indirect
7473
google.golang.org/protobuf v1.31.0 // indirect
7574
gopkg.in/ini.v1 v1.67.0 // indirect
7675
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)