Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump github.com/databricks/databricks-sdk-go from 0.40.1 to 0.41.0 #3604

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions catalog/resource_lakehouse_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const lakehouseMonitorDefaultProvisionTimeout = 15 * time.Minute

func WaitForMonitor(w *databricks.WorkspaceClient, ctx context.Context, monitorName string) error {
return retry.RetryContext(ctx, lakehouseMonitorDefaultProvisionTimeout, func() *retry.RetryError {
endpoint, err := w.LakehouseMonitors.GetByTableName(ctx, monitorName)
endpoint, err := w.QualityMonitors.GetByTableName(ctx, monitorName)
if err != nil {
return retry.NonRetryableError(err)
}
Expand Down Expand Up @@ -68,7 +68,7 @@ func ResourceLakehouseMonitor() common.Resource {
common.DataToStructPointer(d, monitorSchema, &create)
create.TableName = d.Get("table_name").(string)

endpoint, err := w.LakehouseMonitors.Create(ctx, create)
endpoint, err := w.QualityMonitors.Create(ctx, create)
if err != nil {
return err
}
Expand All @@ -84,7 +84,7 @@ func ResourceLakehouseMonitor() common.Resource {
if err != nil {
return err
}
endpoint, err := w.LakehouseMonitors.GetByTableName(ctx, d.Id())
endpoint, err := w.QualityMonitors.GetByTableName(ctx, d.Id())
if err != nil {
return err

Expand All @@ -99,7 +99,7 @@ func ResourceLakehouseMonitor() common.Resource {
var update catalog.UpdateMonitor
common.DataToStructPointer(d, monitorSchema, &update)
update.TableName = d.Get("table_name").(string)
_, err = w.LakehouseMonitors.Update(ctx, update)
_, err = w.QualityMonitors.Update(ctx, update)
if err != nil {
return err
}
Expand All @@ -110,7 +110,7 @@ func ResourceLakehouseMonitor() common.Resource {
if err != nil {
return err
}
return w.LakehouseMonitors.DeleteByTableName(ctx, d.Id())
return w.QualityMonitors.DeleteByTableName(ctx, d.Id())
},
Schema: monitorSchema,
Timeouts: &schema.ResourceTimeout{
Expand Down
12 changes: 6 additions & 6 deletions catalog/resource_lakehouse_monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestLakehouseMonitorCornerCases(t *testing.T) {
func TestLakehouseMonitorCreateTimeseries(t *testing.T) {
qa.ResourceFixture{
MockWorkspaceClientFunc: func(w *mocks.MockWorkspaceClient) {
e := w.GetMockLakehouseMonitorsAPI().EXPECT()
e := w.GetMockQualityMonitorsAPI().EXPECT()
e.Create(mock.Anything, catalog.CreateMonitor{
TableName: "test_table",
OutputSchemaName: "output.schema",
Expand Down Expand Up @@ -57,7 +57,7 @@ func TestLakehouseMonitorCreateTimeseries(t *testing.T) {
func TestLakehouseMonitorCreateInference(t *testing.T) {
qa.ResourceFixture{
MockWorkspaceClientFunc: func(w *mocks.MockWorkspaceClient) {
e := w.GetMockLakehouseMonitorsAPI().EXPECT()
e := w.GetMockQualityMonitorsAPI().EXPECT()
e.Create(mock.Anything, catalog.CreateMonitor{
TableName: "test_table",
OutputSchemaName: "output.schema",
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestLakehouseMonitorCreateInference(t *testing.T) {
func TestLakehouseMonitorCreateSnapshot(t *testing.T) {
qa.ResourceFixture{
MockWorkspaceClientFunc: func(w *mocks.MockWorkspaceClient) {
e := w.GetMockLakehouseMonitorsAPI().EXPECT()
e := w.GetMockQualityMonitorsAPI().EXPECT()
e.Create(mock.Anything, catalog.CreateMonitor{
TableName: "test_table",
OutputSchemaName: "output.schema",
Expand Down Expand Up @@ -143,7 +143,7 @@ func TestLakehouseMonitorCreateSnapshot(t *testing.T) {
func TestLakehouseMonitorGet(t *testing.T) {
qa.ResourceFixture{
MockWorkspaceClientFunc: func(w *mocks.MockWorkspaceClient) {
e := w.GetMockLakehouseMonitorsAPI().EXPECT()
e := w.GetMockQualityMonitorsAPI().EXPECT()
e.GetByTableName(mock.Anything, "test_table").Return(&catalog.MonitorInfo{
TableName: "test_table",
Status: catalog.MonitorInfoStatusMonitorStatusActive,
Expand All @@ -166,7 +166,7 @@ func TestLakehouseMonitorGet(t *testing.T) {
func TestLakehouseMonitorUpdate(t *testing.T) {
qa.ResourceFixture{
MockWorkspaceClientFunc: func(w *mocks.MockWorkspaceClient) {
e := w.GetMockLakehouseMonitorsAPI().EXPECT()
e := w.GetMockQualityMonitorsAPI().EXPECT()
e.Update(mock.Anything, catalog.UpdateMonitor{
TableName: "test_table",
OutputSchemaName: "output.schema",
Expand Down Expand Up @@ -228,7 +228,7 @@ func TestLakehouseMonitorUpdate(t *testing.T) {
func TestLakehouseMonitorDelete(t *testing.T) {
qa.ResourceFixture{
MockWorkspaceClientFunc: func(w *mocks.MockWorkspaceClient) {
e := w.GetMockLakehouseMonitorsAPI().EXPECT()
e := w.GetMockQualityMonitorsAPI().EXPECT()
e.DeleteByTableName(mock.Anything, "test_table").Return(nil)
},
Resource: ResourceLakehouseMonitor(),
Expand Down
6 changes: 3 additions & 3 deletions catalog/resource_system_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func ResourceSystemSchema() common.Resource {
//enable new schema
err = w.SystemSchemas.Enable(ctx, catalog.EnableRequest{
MetastoreId: metastoreSummary.MetastoreId,
SchemaName: catalog.EnableSchemaName(new),
SchemaName: new,
})
//ignore "schema <schema-name> already exists" error
if err != nil && !strings.Contains(err.Error(), "already exists") {
Expand All @@ -53,7 +53,7 @@ func ResourceSystemSchema() common.Resource {
if old != "" {
err = w.SystemSchemas.Disable(ctx, catalog.DisableRequest{
MetastoreId: metastoreSummary.MetastoreId,
SchemaName: catalog.DisableSchemaName(old),
SchemaName: old,
})
if err != nil {
return err
Expand Down Expand Up @@ -106,7 +106,7 @@ func ResourceSystemSchema() common.Resource {
}
return w.SystemSchemas.Disable(ctx, catalog.DisableRequest{
MetastoreId: metastoreSummary.MetastoreId,
SchemaName: catalog.DisableSchemaName(schemaName),
SchemaName: schemaName,
})
},
}
Expand Down
1 change: 0 additions & 1 deletion clusters/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ func (ClusterSpec) CustomizeSchemaResourceSpecific(s *common.CustomizableSchema)
}

func (ClusterSpec) CustomizeSchema(s *common.CustomizableSchema) *common.CustomizableSchema {
s.SchemaPath("cluster_source").SetReadOnly()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field has been removed from the Go SDK

s.SchemaPath("enable_elastic_disk").SetComputed()
s.SchemaPath("enable_local_disk_encryption").SetComputed()
s.SchemaPath("node_type_id").SetComputed().SetConflictsWith([]string{"driver_instance_pool_id", "instance_pool_id"})
Expand Down
2 changes: 1 addition & 1 deletion exporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ var emptyStorageCrdentials = qa.HTTPFixture{

var emptyConnections = qa.HTTPFixture{
Method: "GET",
Resource: "/api/2.1/unity-catalog/connections",
Resource: "/api/2.1/unity-catalog/connections?",
Response: catalog.ListConnectionsResponse{},
}

Expand Down
2 changes: 1 addition & 1 deletion exporter/importables.go
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,7 @@ var resourcesMap map[string]importable = map[string]importable{
return connectionType + "_" + connectionName
},
List: func(ic *importContext) error {
connections, err := ic.workspaceClient.Connections.ListAll(ic.Context)
connections, err := ic.workspaceClient.Connections.ListAll(ic.Context, catalog.ListConnectionsRequest{})
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 @@ -1843,7 +1843,7 @@ func TestConnections(t *testing.T) {
{
ReuseRequest: true,
Method: "GET",
Resource: "/api/2.1/unity-catalog/connections",
Resource: "/api/2.1/unity-catalog/connections?",
Response: catalog.ListConnectionsResponse{
Connections: []catalog.ConnectionInfo{
{
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.21

require (
github.com/databricks/databricks-sdk-go v0.40.1
github.com/databricks/databricks-sdk-go v0.41.0
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
16 changes: 4 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,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.40.0 h1:H9KAyRbM5lwnY8t9nY/xAYHVTBsLqFuIRwVaRGqYJe0=
github.com/databricks/databricks-sdk-go v0.40.0/go.mod h1:Yjy1gREDLK65g4axpVbVNKYAHYE2Sqzj0AB9QWHCBVM=
github.com/databricks/databricks-sdk-go v0.40.1 h1:rE5yP9gIW2oap+6CnumixnZSDIsXwVojAuDBuKUl5GU=
github.com/databricks/databricks-sdk-go v0.40.1/go.mod h1:rLIhh7DvifVLmf2QxMr/vMRGqdrTZazn8VYo4LilfCo=
github.com/databricks/databricks-sdk-go v0.41.0 h1:OyhYY+Q6+gqkWeXmpGEiacoU2RStTeWPF0x4vmqbQdc=
github.com/databricks/databricks-sdk-go v0.41.0/go.mod h1:rLIhh7DvifVLmf2QxMr/vMRGqdrTZazn8VYo4LilfCo=
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 Expand Up @@ -223,8 +221,6 @@ go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand All @@ -245,8 +241,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand All @@ -273,14 +267,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand Down
1 change: 0 additions & 1 deletion jobs/resource_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ func (JobSettingsResource) CustomizeSchema(s *common.CustomizableSchema) *common
s.SchemaPath("task", "for_each_task", "task", "run_if").SetSuppressDiffWithDefault(jobs.RunIfAllSuccess)

s.SchemaPath("task", "for_each_task", "task", "new_cluster", "cluster_id").Schema.Computed = false
s.SchemaPath("task", "for_each_task", "task", "new_cluster").RemoveField("cluster_source")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field has been removed from the Go SDK


// ======= To keep consistency with the manually maintained schema, should be reverted once full migration is done. ======
s.SchemaPath("task", "task_key").SetOptional()
Expand Down
2 changes: 1 addition & 1 deletion libraries/libraries_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewLibraryFromInstanceState(i any) (lib compute.Library) {
}

// Diff returns install/uninstall lists given a cluster lib status
func GetLibrariesToInstallAndUninstall(cll []compute.Library, cls *compute.ClusterStatusResponse) ([]compute.Library, []compute.Library) {
func GetLibrariesToInstallAndUninstall(cll []compute.Library, cls *compute.ClusterLibraryStatuses) ([]compute.Library, []compute.Library) {
inConfig := map[string]compute.Library{}
for _, lib := range cll {
inConfig[lib.String()] = lib
Expand Down
2 changes: 1 addition & 1 deletion libraries/libraries_api_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

// Given a compute.Wait struct, returns library statuses based on the input parameter.
// If wait.IsRunning is set to true, this function will wait until all of the libraries are installed to return. Otherwise, it will directly return the list of libraries.
func WaitForLibrariesInstalledSdk(ctx context.Context, w *databricks.WorkspaceClient, wait compute.Wait, timeout time.Duration) (result *compute.ClusterStatusResponse, err error) {
func WaitForLibrariesInstalledSdk(ctx context.Context, w *databricks.WorkspaceClient, wait compute.Wait, timeout time.Duration) (result *compute.ClusterLibraryStatuses, err error) {
err = resource.RetryContext(ctx, timeout, func() *resource.RetryError {
libsClusterStatus, err := w.Libraries.ClusterStatusByClusterId(ctx, wait.ClusterID)
if err != nil {
Expand Down
8 changes: 5 additions & 3 deletions qa/test_credentials_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"

"github.com/databricks/databricks-sdk-go/config"
"github.com/databricks/databricks-sdk-go/credentials"
)

type testCredentialsProvider struct {
Expand All @@ -16,9 +17,10 @@ func (testCredentialsProvider) Name() string {
return "test"
}

func (t testCredentialsProvider) Configure(ctx context.Context, cfg *config.Config) (func(*http.Request) error, error) {
return func(r *http.Request) error {
func (t testCredentialsProvider) Configure(ctx context.Context, cfg *config.Config) (credentials.CredentialsProvider, error) {
fun := func(r *http.Request) error {
r.Header.Set("Authorization", fmt.Sprintf("Bearer %s", t.token))
return nil
}, nil
}
return credentials.NewCredentialsProvider(fun), nil
}
15 changes: 8 additions & 7 deletions qa/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/databricks-sdk-go/client"
"github.com/databricks/databricks-sdk-go/common/environment"
"github.com/databricks/databricks-sdk-go/config"
"github.com/databricks/databricks-sdk-go/experimental/mocks"
"github.com/databricks/terraform-provider-databricks/common"
Expand Down Expand Up @@ -181,20 +182,20 @@ func (f ResourceFixture) prepareExecution(r *schema.Resource) (resourceCRUD, err

func (f ResourceFixture) setDatabricksEnvironmentForTest(client *common.DatabricksClient, host string) {
if f.Azure || f.AzureSPN {
client.Config.DatabricksEnvironment = &config.DatabricksEnvironment{
Cloud: config.CloudAzure,
client.Config.DatabricksEnvironment = &environment.DatabricksEnvironment{
Cloud: environment.CloudAzure,
DnsZone: host,
AzureApplicationID: "azure-login-application-id",
AzureEnvironment: &config.AzurePublicCloud,
AzureEnvironment: &environment.AzurePublicCloud,
}
} else if f.Gcp {
client.Config.DatabricksEnvironment = &config.DatabricksEnvironment{
Cloud: config.CloudGCP,
client.Config.DatabricksEnvironment = &environment.DatabricksEnvironment{
Cloud: environment.CloudGCP,
DnsZone: host,
}
} else {
client.Config.DatabricksEnvironment = &config.DatabricksEnvironment{
Cloud: config.CloudAWS,
client.Config.DatabricksEnvironment = &environment.DatabricksEnvironment{
Cloud: environment.CloudAWS,
DnsZone: host,
}
}
Expand Down
Loading