diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index f07cf44e5..7b612f095 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -9bb7950fa3390afb97abaa552934bc0a2e069de5 \ No newline at end of file +universe:/Users/miles/universe \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 2e10f5ec1..9c869d613 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16,10 +16,10 @@ experimental/mocks/service/catalog/mock_connections_interface.go linguist-genera experimental/mocks/service/catalog/mock_external_locations_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_functions_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_grants_interface.go linguist-generated=true -experimental/mocks/service/catalog/mock_lakehouse_monitors_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_metastores_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_model_versions_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_online_tables_interface.go linguist-generated=true +experimental/mocks/service/catalog/mock_quality_monitors_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_registered_models_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_schemas_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_storage_credentials_interface.go linguist-generated=true diff --git a/experimental/mocks/mock_workspace_client.go b/experimental/mocks/mock_workspace_client.go index 4f654ff10..79f03eccf 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -73,7 +73,6 @@ func NewMockWorkspaceClient(t interface { InstanceProfiles: compute.NewMockInstanceProfilesInterface(t), IpAccessLists: settings.NewMockIpAccessListsInterface(t), Jobs: jobs.NewMockJobsInterface(t), - LakehouseMonitors: catalog.NewMockLakehouseMonitorsInterface(t), Lakeview: dashboards.NewMockLakeviewInterface(t), Libraries: compute.NewMockLibrariesInterface(t), Metastores: catalog.NewMockMetastoresInterface(t), @@ -92,6 +91,7 @@ func NewMockWorkspaceClient(t interface { ProviderProviderAnalyticsDashboards: marketplace.NewMockProviderProviderAnalyticsDashboardsInterface(t), ProviderProviders: marketplace.NewMockProviderProvidersInterface(t), Providers: sharing.NewMockProvidersInterface(t), + QualityMonitors: catalog.NewMockQualityMonitorsInterface(t), Queries: sql.NewMockQueriesInterface(t), QueryHistory: sql.NewMockQueryHistoryInterface(t), QueryVisualizations: sql.NewMockQueryVisualizationsInterface(t), @@ -455,14 +455,6 @@ func (m *MockWorkspaceClient) GetMockJobsAPI() *jobs.MockJobsInterface { return api } -func (m *MockWorkspaceClient) GetMockLakehouseMonitorsAPI() *catalog.MockLakehouseMonitorsInterface { - api, ok := m.WorkspaceClient.LakehouseMonitors.(*catalog.MockLakehouseMonitorsInterface) - if !ok { - panic(fmt.Sprintf("expected LakehouseMonitors to be *catalog.MockLakehouseMonitorsInterface, actual was %T", m.WorkspaceClient.LakehouseMonitors)) - } - return api -} - func (m *MockWorkspaceClient) GetMockLakeviewAPI() *dashboards.MockLakeviewInterface { api, ok := m.WorkspaceClient.Lakeview.(*dashboards.MockLakeviewInterface) if !ok { @@ -607,6 +599,14 @@ func (m *MockWorkspaceClient) GetMockProvidersAPI() *sharing.MockProvidersInterf return api } +func (m *MockWorkspaceClient) GetMockQualityMonitorsAPI() *catalog.MockQualityMonitorsInterface { + api, ok := m.WorkspaceClient.QualityMonitors.(*catalog.MockQualityMonitorsInterface) + if !ok { + panic(fmt.Sprintf("expected QualityMonitors to be *catalog.MockQualityMonitorsInterface, actual was %T", m.WorkspaceClient.QualityMonitors)) + } + return api +} + func (m *MockWorkspaceClient) GetMockQueriesAPI() *sql.MockQueriesInterface { api, ok := m.WorkspaceClient.Queries.(*sql.MockQueriesInterface) if !ok { diff --git a/experimental/mocks/service/catalog/mock_connections_interface.go b/experimental/mocks/service/catalog/mock_connections_interface.go index ee1fc1c0e..804a23ec1 100644 --- a/experimental/mocks/service/catalog/mock_connections_interface.go +++ b/experimental/mocks/service/catalog/mock_connections_interface.go @@ -25,9 +25,9 @@ func (_m *MockConnectionsInterface) EXPECT() *MockConnectionsInterface_Expecter return &MockConnectionsInterface_Expecter{mock: &_m.Mock} } -// ConnectionInfoNameToFullNameMap provides a mock function with given fields: ctx -func (_m *MockConnectionsInterface) ConnectionInfoNameToFullNameMap(ctx context.Context) (map[string]string, error) { - ret := _m.Called(ctx) +// ConnectionInfoNameToFullNameMap provides a mock function with given fields: ctx, request +func (_m *MockConnectionsInterface) ConnectionInfoNameToFullNameMap(ctx context.Context, request catalog.ListConnectionsRequest) (map[string]string, error) { + ret := _m.Called(ctx, request) if len(ret) == 0 { panic("no return value specified for ConnectionInfoNameToFullNameMap") @@ -35,19 +35,19 @@ func (_m *MockConnectionsInterface) ConnectionInfoNameToFullNameMap(ctx context. var r0 map[string]string var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (map[string]string, error)); ok { - return rf(ctx) + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListConnectionsRequest) (map[string]string, error)); ok { + return rf(ctx, request) } - if rf, ok := ret.Get(0).(func(context.Context) map[string]string); ok { - r0 = rf(ctx) + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListConnectionsRequest) map[string]string); ok { + r0 = rf(ctx, request) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(map[string]string) } } - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) + if rf, ok := ret.Get(1).(func(context.Context, catalog.ListConnectionsRequest) error); ok { + r1 = rf(ctx, request) } else { r1 = ret.Error(1) } @@ -62,13 +62,14 @@ type MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call struct { // ConnectionInfoNameToFullNameMap is a helper method to define mock.On call // - ctx context.Context -func (_e *MockConnectionsInterface_Expecter) ConnectionInfoNameToFullNameMap(ctx interface{}) *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call { - return &MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call{Call: _e.mock.On("ConnectionInfoNameToFullNameMap", ctx)} +// - request catalog.ListConnectionsRequest +func (_e *MockConnectionsInterface_Expecter) ConnectionInfoNameToFullNameMap(ctx interface{}, request interface{}) *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call { + return &MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call{Call: _e.mock.On("ConnectionInfoNameToFullNameMap", ctx, request)} } -func (_c *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call) Run(run func(ctx context.Context)) *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call { +func (_c *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call) Run(run func(ctx context.Context, request catalog.ListConnectionsRequest)) *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) + run(args[0].(context.Context), args[1].(catalog.ListConnectionsRequest)) }) return _c } @@ -78,7 +79,7 @@ func (_c *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call) Return( return _c } -func (_c *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call) RunAndReturn(run func(context.Context) (map[string]string, error)) *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call { +func (_c *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call) RunAndReturn(run func(context.Context, catalog.ListConnectionsRequest) (map[string]string, error)) *MockConnectionsInterface_ConnectionInfoNameToFullNameMap_Call { _c.Call.Return(run) return _c } @@ -401,17 +402,17 @@ func (_c *MockConnectionsInterface_Impl_Call) RunAndReturn(run func() catalog.Co return _c } -// List provides a mock function with given fields: ctx -func (_m *MockConnectionsInterface) List(ctx context.Context) listing.Iterator[catalog.ConnectionInfo] { - ret := _m.Called(ctx) +// List provides a mock function with given fields: ctx, request +func (_m *MockConnectionsInterface) List(ctx context.Context, request catalog.ListConnectionsRequest) listing.Iterator[catalog.ConnectionInfo] { + ret := _m.Called(ctx, request) if len(ret) == 0 { panic("no return value specified for List") } var r0 listing.Iterator[catalog.ConnectionInfo] - if rf, ok := ret.Get(0).(func(context.Context) listing.Iterator[catalog.ConnectionInfo]); ok { - r0 = rf(ctx) + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListConnectionsRequest) listing.Iterator[catalog.ConnectionInfo]); ok { + r0 = rf(ctx, request) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(listing.Iterator[catalog.ConnectionInfo]) @@ -428,13 +429,14 @@ type MockConnectionsInterface_List_Call struct { // List is a helper method to define mock.On call // - ctx context.Context -func (_e *MockConnectionsInterface_Expecter) List(ctx interface{}) *MockConnectionsInterface_List_Call { - return &MockConnectionsInterface_List_Call{Call: _e.mock.On("List", ctx)} +// - request catalog.ListConnectionsRequest +func (_e *MockConnectionsInterface_Expecter) List(ctx interface{}, request interface{}) *MockConnectionsInterface_List_Call { + return &MockConnectionsInterface_List_Call{Call: _e.mock.On("List", ctx, request)} } -func (_c *MockConnectionsInterface_List_Call) Run(run func(ctx context.Context)) *MockConnectionsInterface_List_Call { +func (_c *MockConnectionsInterface_List_Call) Run(run func(ctx context.Context, request catalog.ListConnectionsRequest)) *MockConnectionsInterface_List_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) + run(args[0].(context.Context), args[1].(catalog.ListConnectionsRequest)) }) return _c } @@ -444,14 +446,14 @@ func (_c *MockConnectionsInterface_List_Call) Return(_a0 listing.Iterator[catalo return _c } -func (_c *MockConnectionsInterface_List_Call) RunAndReturn(run func(context.Context) listing.Iterator[catalog.ConnectionInfo]) *MockConnectionsInterface_List_Call { +func (_c *MockConnectionsInterface_List_Call) RunAndReturn(run func(context.Context, catalog.ListConnectionsRequest) listing.Iterator[catalog.ConnectionInfo]) *MockConnectionsInterface_List_Call { _c.Call.Return(run) return _c } -// ListAll provides a mock function with given fields: ctx -func (_m *MockConnectionsInterface) ListAll(ctx context.Context) ([]catalog.ConnectionInfo, error) { - ret := _m.Called(ctx) +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockConnectionsInterface) ListAll(ctx context.Context, request catalog.ListConnectionsRequest) ([]catalog.ConnectionInfo, error) { + ret := _m.Called(ctx, request) if len(ret) == 0 { panic("no return value specified for ListAll") @@ -459,19 +461,19 @@ func (_m *MockConnectionsInterface) ListAll(ctx context.Context) ([]catalog.Conn var r0 []catalog.ConnectionInfo var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]catalog.ConnectionInfo, error)); ok { - return rf(ctx) + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListConnectionsRequest) ([]catalog.ConnectionInfo, error)); ok { + return rf(ctx, request) } - if rf, ok := ret.Get(0).(func(context.Context) []catalog.ConnectionInfo); ok { - r0 = rf(ctx) + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListConnectionsRequest) []catalog.ConnectionInfo); ok { + r0 = rf(ctx, request) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]catalog.ConnectionInfo) } } - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) + if rf, ok := ret.Get(1).(func(context.Context, catalog.ListConnectionsRequest) error); ok { + r1 = rf(ctx, request) } else { r1 = ret.Error(1) } @@ -486,13 +488,14 @@ type MockConnectionsInterface_ListAll_Call struct { // ListAll is a helper method to define mock.On call // - ctx context.Context -func (_e *MockConnectionsInterface_Expecter) ListAll(ctx interface{}) *MockConnectionsInterface_ListAll_Call { - return &MockConnectionsInterface_ListAll_Call{Call: _e.mock.On("ListAll", ctx)} +// - request catalog.ListConnectionsRequest +func (_e *MockConnectionsInterface_Expecter) ListAll(ctx interface{}, request interface{}) *MockConnectionsInterface_ListAll_Call { + return &MockConnectionsInterface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} } -func (_c *MockConnectionsInterface_ListAll_Call) Run(run func(ctx context.Context)) *MockConnectionsInterface_ListAll_Call { +func (_c *MockConnectionsInterface_ListAll_Call) Run(run func(ctx context.Context, request catalog.ListConnectionsRequest)) *MockConnectionsInterface_ListAll_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) + run(args[0].(context.Context), args[1].(catalog.ListConnectionsRequest)) }) return _c } @@ -502,7 +505,7 @@ func (_c *MockConnectionsInterface_ListAll_Call) Return(_a0 []catalog.Connection return _c } -func (_c *MockConnectionsInterface_ListAll_Call) RunAndReturn(run func(context.Context) ([]catalog.ConnectionInfo, error)) *MockConnectionsInterface_ListAll_Call { +func (_c *MockConnectionsInterface_ListAll_Call) RunAndReturn(run func(context.Context, catalog.ListConnectionsRequest) ([]catalog.ConnectionInfo, error)) *MockConnectionsInterface_ListAll_Call { _c.Call.Return(run) return _c } diff --git a/experimental/mocks/service/catalog/mock_lakehouse_monitors_interface.go b/experimental/mocks/service/catalog/mock_lakehouse_monitors_interface.go deleted file mode 100644 index cfb7ba7c2..000000000 --- a/experimental/mocks/service/catalog/mock_lakehouse_monitors_interface.go +++ /dev/null @@ -1,806 +0,0 @@ -// Code generated by mockery v2.43.0. DO NOT EDIT. - -package catalog - -import ( - context "context" - - catalog "github.com/databricks/databricks-sdk-go/service/catalog" - - mock "github.com/stretchr/testify/mock" -) - -// MockLakehouseMonitorsInterface is an autogenerated mock type for the LakehouseMonitorsInterface type -type MockLakehouseMonitorsInterface struct { - mock.Mock -} - -type MockLakehouseMonitorsInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockLakehouseMonitorsInterface) EXPECT() *MockLakehouseMonitorsInterface_Expecter { - return &MockLakehouseMonitorsInterface_Expecter{mock: &_m.Mock} -} - -// CancelRefresh provides a mock function with given fields: ctx, request -func (_m *MockLakehouseMonitorsInterface) CancelRefresh(ctx context.Context, request catalog.CancelRefreshRequest) error { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for CancelRefresh") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.CancelRefreshRequest) error); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockLakehouseMonitorsInterface_CancelRefresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CancelRefresh' -type MockLakehouseMonitorsInterface_CancelRefresh_Call struct { - *mock.Call -} - -// CancelRefresh is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.CancelRefreshRequest -func (_e *MockLakehouseMonitorsInterface_Expecter) CancelRefresh(ctx interface{}, request interface{}) *MockLakehouseMonitorsInterface_CancelRefresh_Call { - return &MockLakehouseMonitorsInterface_CancelRefresh_Call{Call: _e.mock.On("CancelRefresh", ctx, request)} -} - -func (_c *MockLakehouseMonitorsInterface_CancelRefresh_Call) Run(run func(ctx context.Context, request catalog.CancelRefreshRequest)) *MockLakehouseMonitorsInterface_CancelRefresh_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.CancelRefreshRequest)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_CancelRefresh_Call) Return(_a0 error) *MockLakehouseMonitorsInterface_CancelRefresh_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_CancelRefresh_Call) RunAndReturn(run func(context.Context, catalog.CancelRefreshRequest) error) *MockLakehouseMonitorsInterface_CancelRefresh_Call { - _c.Call.Return(run) - return _c -} - -// Create provides a mock function with given fields: ctx, request -func (_m *MockLakehouseMonitorsInterface) Create(ctx context.Context, request catalog.CreateMonitor) (*catalog.MonitorInfo, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for Create") - } - - var r0 *catalog.MonitorInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateMonitor) (*catalog.MonitorInfo, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateMonitor) *catalog.MonitorInfo); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.MonitorInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, catalog.CreateMonitor) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockLakehouseMonitorsInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' -type MockLakehouseMonitorsInterface_Create_Call struct { - *mock.Call -} - -// Create is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.CreateMonitor -func (_e *MockLakehouseMonitorsInterface_Expecter) Create(ctx interface{}, request interface{}) *MockLakehouseMonitorsInterface_Create_Call { - return &MockLakehouseMonitorsInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} -} - -func (_c *MockLakehouseMonitorsInterface_Create_Call) Run(run func(ctx context.Context, request catalog.CreateMonitor)) *MockLakehouseMonitorsInterface_Create_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.CreateMonitor)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_Create_Call) Return(_a0 *catalog.MonitorInfo, _a1 error) *MockLakehouseMonitorsInterface_Create_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_Create_Call) RunAndReturn(run func(context.Context, catalog.CreateMonitor) (*catalog.MonitorInfo, error)) *MockLakehouseMonitorsInterface_Create_Call { - _c.Call.Return(run) - return _c -} - -// Delete provides a mock function with given fields: ctx, request -func (_m *MockLakehouseMonitorsInterface) Delete(ctx context.Context, request catalog.DeleteLakehouseMonitorRequest) error { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for Delete") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.DeleteLakehouseMonitorRequest) error); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockLakehouseMonitorsInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' -type MockLakehouseMonitorsInterface_Delete_Call struct { - *mock.Call -} - -// Delete is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.DeleteLakehouseMonitorRequest -func (_e *MockLakehouseMonitorsInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockLakehouseMonitorsInterface_Delete_Call { - return &MockLakehouseMonitorsInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} -} - -func (_c *MockLakehouseMonitorsInterface_Delete_Call) Run(run func(ctx context.Context, request catalog.DeleteLakehouseMonitorRequest)) *MockLakehouseMonitorsInterface_Delete_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.DeleteLakehouseMonitorRequest)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_Delete_Call) Return(_a0 error) *MockLakehouseMonitorsInterface_Delete_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_Delete_Call) RunAndReturn(run func(context.Context, catalog.DeleteLakehouseMonitorRequest) error) *MockLakehouseMonitorsInterface_Delete_Call { - _c.Call.Return(run) - return _c -} - -// DeleteByTableName provides a mock function with given fields: ctx, tableName -func (_m *MockLakehouseMonitorsInterface) DeleteByTableName(ctx context.Context, tableName string) error { - ret := _m.Called(ctx, tableName) - - if len(ret) == 0 { - panic("no return value specified for DeleteByTableName") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { - r0 = rf(ctx, tableName) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockLakehouseMonitorsInterface_DeleteByTableName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByTableName' -type MockLakehouseMonitorsInterface_DeleteByTableName_Call struct { - *mock.Call -} - -// DeleteByTableName is a helper method to define mock.On call -// - ctx context.Context -// - tableName string -func (_e *MockLakehouseMonitorsInterface_Expecter) DeleteByTableName(ctx interface{}, tableName interface{}) *MockLakehouseMonitorsInterface_DeleteByTableName_Call { - return &MockLakehouseMonitorsInterface_DeleteByTableName_Call{Call: _e.mock.On("DeleteByTableName", ctx, tableName)} -} - -func (_c *MockLakehouseMonitorsInterface_DeleteByTableName_Call) Run(run func(ctx context.Context, tableName string)) *MockLakehouseMonitorsInterface_DeleteByTableName_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_DeleteByTableName_Call) Return(_a0 error) *MockLakehouseMonitorsInterface_DeleteByTableName_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_DeleteByTableName_Call) RunAndReturn(run func(context.Context, string) error) *MockLakehouseMonitorsInterface_DeleteByTableName_Call { - _c.Call.Return(run) - return _c -} - -// Get provides a mock function with given fields: ctx, request -func (_m *MockLakehouseMonitorsInterface) Get(ctx context.Context, request catalog.GetLakehouseMonitorRequest) (*catalog.MonitorInfo, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for Get") - } - - var r0 *catalog.MonitorInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.GetLakehouseMonitorRequest) (*catalog.MonitorInfo, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, catalog.GetLakehouseMonitorRequest) *catalog.MonitorInfo); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.MonitorInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, catalog.GetLakehouseMonitorRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockLakehouseMonitorsInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' -type MockLakehouseMonitorsInterface_Get_Call struct { - *mock.Call -} - -// Get is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.GetLakehouseMonitorRequest -func (_e *MockLakehouseMonitorsInterface_Expecter) Get(ctx interface{}, request interface{}) *MockLakehouseMonitorsInterface_Get_Call { - return &MockLakehouseMonitorsInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} -} - -func (_c *MockLakehouseMonitorsInterface_Get_Call) Run(run func(ctx context.Context, request catalog.GetLakehouseMonitorRequest)) *MockLakehouseMonitorsInterface_Get_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.GetLakehouseMonitorRequest)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_Get_Call) Return(_a0 *catalog.MonitorInfo, _a1 error) *MockLakehouseMonitorsInterface_Get_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_Get_Call) RunAndReturn(run func(context.Context, catalog.GetLakehouseMonitorRequest) (*catalog.MonitorInfo, error)) *MockLakehouseMonitorsInterface_Get_Call { - _c.Call.Return(run) - return _c -} - -// GetByTableName provides a mock function with given fields: ctx, tableName -func (_m *MockLakehouseMonitorsInterface) GetByTableName(ctx context.Context, tableName string) (*catalog.MonitorInfo, error) { - ret := _m.Called(ctx, tableName) - - if len(ret) == 0 { - panic("no return value specified for GetByTableName") - } - - var r0 *catalog.MonitorInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*catalog.MonitorInfo, error)); ok { - return rf(ctx, tableName) - } - if rf, ok := ret.Get(0).(func(context.Context, string) *catalog.MonitorInfo); ok { - r0 = rf(ctx, tableName) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.MonitorInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, tableName) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockLakehouseMonitorsInterface_GetByTableName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByTableName' -type MockLakehouseMonitorsInterface_GetByTableName_Call struct { - *mock.Call -} - -// GetByTableName is a helper method to define mock.On call -// - ctx context.Context -// - tableName string -func (_e *MockLakehouseMonitorsInterface_Expecter) GetByTableName(ctx interface{}, tableName interface{}) *MockLakehouseMonitorsInterface_GetByTableName_Call { - return &MockLakehouseMonitorsInterface_GetByTableName_Call{Call: _e.mock.On("GetByTableName", ctx, tableName)} -} - -func (_c *MockLakehouseMonitorsInterface_GetByTableName_Call) Run(run func(ctx context.Context, tableName string)) *MockLakehouseMonitorsInterface_GetByTableName_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_GetByTableName_Call) Return(_a0 *catalog.MonitorInfo, _a1 error) *MockLakehouseMonitorsInterface_GetByTableName_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_GetByTableName_Call) RunAndReturn(run func(context.Context, string) (*catalog.MonitorInfo, error)) *MockLakehouseMonitorsInterface_GetByTableName_Call { - _c.Call.Return(run) - return _c -} - -// GetRefresh provides a mock function with given fields: ctx, request -func (_m *MockLakehouseMonitorsInterface) GetRefresh(ctx context.Context, request catalog.GetRefreshRequest) (*catalog.MonitorRefreshInfo, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for GetRefresh") - } - - var r0 *catalog.MonitorRefreshInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.GetRefreshRequest) (*catalog.MonitorRefreshInfo, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, catalog.GetRefreshRequest) *catalog.MonitorRefreshInfo); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.MonitorRefreshInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, catalog.GetRefreshRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockLakehouseMonitorsInterface_GetRefresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRefresh' -type MockLakehouseMonitorsInterface_GetRefresh_Call struct { - *mock.Call -} - -// GetRefresh is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.GetRefreshRequest -func (_e *MockLakehouseMonitorsInterface_Expecter) GetRefresh(ctx interface{}, request interface{}) *MockLakehouseMonitorsInterface_GetRefresh_Call { - return &MockLakehouseMonitorsInterface_GetRefresh_Call{Call: _e.mock.On("GetRefresh", ctx, request)} -} - -func (_c *MockLakehouseMonitorsInterface_GetRefresh_Call) Run(run func(ctx context.Context, request catalog.GetRefreshRequest)) *MockLakehouseMonitorsInterface_GetRefresh_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.GetRefreshRequest)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_GetRefresh_Call) Return(_a0 *catalog.MonitorRefreshInfo, _a1 error) *MockLakehouseMonitorsInterface_GetRefresh_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_GetRefresh_Call) RunAndReturn(run func(context.Context, catalog.GetRefreshRequest) (*catalog.MonitorRefreshInfo, error)) *MockLakehouseMonitorsInterface_GetRefresh_Call { - _c.Call.Return(run) - return _c -} - -// GetRefreshByTableNameAndRefreshId provides a mock function with given fields: ctx, tableName, refreshId -func (_m *MockLakehouseMonitorsInterface) GetRefreshByTableNameAndRefreshId(ctx context.Context, tableName string, refreshId string) (*catalog.MonitorRefreshInfo, error) { - ret := _m.Called(ctx, tableName, refreshId) - - if len(ret) == 0 { - panic("no return value specified for GetRefreshByTableNameAndRefreshId") - } - - var r0 *catalog.MonitorRefreshInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (*catalog.MonitorRefreshInfo, error)); ok { - return rf(ctx, tableName, refreshId) - } - if rf, ok := ret.Get(0).(func(context.Context, string, string) *catalog.MonitorRefreshInfo); ok { - r0 = rf(ctx, tableName, refreshId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.MonitorRefreshInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, tableName, refreshId) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockLakehouseMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRefreshByTableNameAndRefreshId' -type MockLakehouseMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call struct { - *mock.Call -} - -// GetRefreshByTableNameAndRefreshId is a helper method to define mock.On call -// - ctx context.Context -// - tableName string -// - refreshId string -func (_e *MockLakehouseMonitorsInterface_Expecter) GetRefreshByTableNameAndRefreshId(ctx interface{}, tableName interface{}, refreshId interface{}) *MockLakehouseMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call { - return &MockLakehouseMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call{Call: _e.mock.On("GetRefreshByTableNameAndRefreshId", ctx, tableName, refreshId)} -} - -func (_c *MockLakehouseMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call) Run(run func(ctx context.Context, tableName string, refreshId string)) *MockLakehouseMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string), args[2].(string)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call) Return(_a0 *catalog.MonitorRefreshInfo, _a1 error) *MockLakehouseMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call) RunAndReturn(run func(context.Context, string, string) (*catalog.MonitorRefreshInfo, error)) *MockLakehouseMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call { - _c.Call.Return(run) - return _c -} - -// Impl provides a mock function with given fields: -func (_m *MockLakehouseMonitorsInterface) Impl() catalog.LakehouseMonitorsService { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Impl") - } - - var r0 catalog.LakehouseMonitorsService - if rf, ok := ret.Get(0).(func() catalog.LakehouseMonitorsService); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(catalog.LakehouseMonitorsService) - } - } - - return r0 -} - -// MockLakehouseMonitorsInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' -type MockLakehouseMonitorsInterface_Impl_Call struct { - *mock.Call -} - -// Impl is a helper method to define mock.On call -func (_e *MockLakehouseMonitorsInterface_Expecter) Impl() *MockLakehouseMonitorsInterface_Impl_Call { - return &MockLakehouseMonitorsInterface_Impl_Call{Call: _e.mock.On("Impl")} -} - -func (_c *MockLakehouseMonitorsInterface_Impl_Call) Run(run func()) *MockLakehouseMonitorsInterface_Impl_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_Impl_Call) Return(_a0 catalog.LakehouseMonitorsService) *MockLakehouseMonitorsInterface_Impl_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_Impl_Call) RunAndReturn(run func() catalog.LakehouseMonitorsService) *MockLakehouseMonitorsInterface_Impl_Call { - _c.Call.Return(run) - return _c -} - -// ListRefreshes provides a mock function with given fields: ctx, request -func (_m *MockLakehouseMonitorsInterface) ListRefreshes(ctx context.Context, request catalog.ListRefreshesRequest) ([]catalog.MonitorRefreshInfo, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for ListRefreshes") - } - - var r0 []catalog.MonitorRefreshInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.ListRefreshesRequest) ([]catalog.MonitorRefreshInfo, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, catalog.ListRefreshesRequest) []catalog.MonitorRefreshInfo); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]catalog.MonitorRefreshInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, catalog.ListRefreshesRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockLakehouseMonitorsInterface_ListRefreshes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRefreshes' -type MockLakehouseMonitorsInterface_ListRefreshes_Call struct { - *mock.Call -} - -// ListRefreshes is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.ListRefreshesRequest -func (_e *MockLakehouseMonitorsInterface_Expecter) ListRefreshes(ctx interface{}, request interface{}) *MockLakehouseMonitorsInterface_ListRefreshes_Call { - return &MockLakehouseMonitorsInterface_ListRefreshes_Call{Call: _e.mock.On("ListRefreshes", ctx, request)} -} - -func (_c *MockLakehouseMonitorsInterface_ListRefreshes_Call) Run(run func(ctx context.Context, request catalog.ListRefreshesRequest)) *MockLakehouseMonitorsInterface_ListRefreshes_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.ListRefreshesRequest)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_ListRefreshes_Call) Return(_a0 []catalog.MonitorRefreshInfo, _a1 error) *MockLakehouseMonitorsInterface_ListRefreshes_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_ListRefreshes_Call) RunAndReturn(run func(context.Context, catalog.ListRefreshesRequest) ([]catalog.MonitorRefreshInfo, error)) *MockLakehouseMonitorsInterface_ListRefreshes_Call { - _c.Call.Return(run) - return _c -} - -// ListRefreshesByTableName provides a mock function with given fields: ctx, tableName -func (_m *MockLakehouseMonitorsInterface) ListRefreshesByTableName(ctx context.Context, tableName string) ([]catalog.MonitorRefreshInfo, error) { - ret := _m.Called(ctx, tableName) - - if len(ret) == 0 { - panic("no return value specified for ListRefreshesByTableName") - } - - var r0 []catalog.MonitorRefreshInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) ([]catalog.MonitorRefreshInfo, error)); ok { - return rf(ctx, tableName) - } - if rf, ok := ret.Get(0).(func(context.Context, string) []catalog.MonitorRefreshInfo); ok { - r0 = rf(ctx, tableName) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]catalog.MonitorRefreshInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, tableName) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockLakehouseMonitorsInterface_ListRefreshesByTableName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRefreshesByTableName' -type MockLakehouseMonitorsInterface_ListRefreshesByTableName_Call struct { - *mock.Call -} - -// ListRefreshesByTableName is a helper method to define mock.On call -// - ctx context.Context -// - tableName string -func (_e *MockLakehouseMonitorsInterface_Expecter) ListRefreshesByTableName(ctx interface{}, tableName interface{}) *MockLakehouseMonitorsInterface_ListRefreshesByTableName_Call { - return &MockLakehouseMonitorsInterface_ListRefreshesByTableName_Call{Call: _e.mock.On("ListRefreshesByTableName", ctx, tableName)} -} - -func (_c *MockLakehouseMonitorsInterface_ListRefreshesByTableName_Call) Run(run func(ctx context.Context, tableName string)) *MockLakehouseMonitorsInterface_ListRefreshesByTableName_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_ListRefreshesByTableName_Call) Return(_a0 []catalog.MonitorRefreshInfo, _a1 error) *MockLakehouseMonitorsInterface_ListRefreshesByTableName_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_ListRefreshesByTableName_Call) RunAndReturn(run func(context.Context, string) ([]catalog.MonitorRefreshInfo, error)) *MockLakehouseMonitorsInterface_ListRefreshesByTableName_Call { - _c.Call.Return(run) - return _c -} - -// RunRefresh provides a mock function with given fields: ctx, request -func (_m *MockLakehouseMonitorsInterface) RunRefresh(ctx context.Context, request catalog.RunRefreshRequest) (*catalog.MonitorRefreshInfo, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for RunRefresh") - } - - var r0 *catalog.MonitorRefreshInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.RunRefreshRequest) (*catalog.MonitorRefreshInfo, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, catalog.RunRefreshRequest) *catalog.MonitorRefreshInfo); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.MonitorRefreshInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, catalog.RunRefreshRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockLakehouseMonitorsInterface_RunRefresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RunRefresh' -type MockLakehouseMonitorsInterface_RunRefresh_Call struct { - *mock.Call -} - -// RunRefresh is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.RunRefreshRequest -func (_e *MockLakehouseMonitorsInterface_Expecter) RunRefresh(ctx interface{}, request interface{}) *MockLakehouseMonitorsInterface_RunRefresh_Call { - return &MockLakehouseMonitorsInterface_RunRefresh_Call{Call: _e.mock.On("RunRefresh", ctx, request)} -} - -func (_c *MockLakehouseMonitorsInterface_RunRefresh_Call) Run(run func(ctx context.Context, request catalog.RunRefreshRequest)) *MockLakehouseMonitorsInterface_RunRefresh_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.RunRefreshRequest)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_RunRefresh_Call) Return(_a0 *catalog.MonitorRefreshInfo, _a1 error) *MockLakehouseMonitorsInterface_RunRefresh_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_RunRefresh_Call) RunAndReturn(run func(context.Context, catalog.RunRefreshRequest) (*catalog.MonitorRefreshInfo, error)) *MockLakehouseMonitorsInterface_RunRefresh_Call { - _c.Call.Return(run) - return _c -} - -// Update provides a mock function with given fields: ctx, request -func (_m *MockLakehouseMonitorsInterface) Update(ctx context.Context, request catalog.UpdateMonitor) (*catalog.MonitorInfo, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for Update") - } - - var r0 *catalog.MonitorInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateMonitor) (*catalog.MonitorInfo, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateMonitor) *catalog.MonitorInfo); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.MonitorInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, catalog.UpdateMonitor) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockLakehouseMonitorsInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' -type MockLakehouseMonitorsInterface_Update_Call struct { - *mock.Call -} - -// Update is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.UpdateMonitor -func (_e *MockLakehouseMonitorsInterface_Expecter) Update(ctx interface{}, request interface{}) *MockLakehouseMonitorsInterface_Update_Call { - return &MockLakehouseMonitorsInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} -} - -func (_c *MockLakehouseMonitorsInterface_Update_Call) Run(run func(ctx context.Context, request catalog.UpdateMonitor)) *MockLakehouseMonitorsInterface_Update_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.UpdateMonitor)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_Update_Call) Return(_a0 *catalog.MonitorInfo, _a1 error) *MockLakehouseMonitorsInterface_Update_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_Update_Call) RunAndReturn(run func(context.Context, catalog.UpdateMonitor) (*catalog.MonitorInfo, error)) *MockLakehouseMonitorsInterface_Update_Call { - _c.Call.Return(run) - return _c -} - -// WithImpl provides a mock function with given fields: impl -func (_m *MockLakehouseMonitorsInterface) WithImpl(impl catalog.LakehouseMonitorsService) catalog.LakehouseMonitorsInterface { - ret := _m.Called(impl) - - if len(ret) == 0 { - panic("no return value specified for WithImpl") - } - - var r0 catalog.LakehouseMonitorsInterface - if rf, ok := ret.Get(0).(func(catalog.LakehouseMonitorsService) catalog.LakehouseMonitorsInterface); ok { - r0 = rf(impl) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(catalog.LakehouseMonitorsInterface) - } - } - - return r0 -} - -// MockLakehouseMonitorsInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' -type MockLakehouseMonitorsInterface_WithImpl_Call struct { - *mock.Call -} - -// WithImpl is a helper method to define mock.On call -// - impl catalog.LakehouseMonitorsService -func (_e *MockLakehouseMonitorsInterface_Expecter) WithImpl(impl interface{}) *MockLakehouseMonitorsInterface_WithImpl_Call { - return &MockLakehouseMonitorsInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} -} - -func (_c *MockLakehouseMonitorsInterface_WithImpl_Call) Run(run func(impl catalog.LakehouseMonitorsService)) *MockLakehouseMonitorsInterface_WithImpl_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(catalog.LakehouseMonitorsService)) - }) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_WithImpl_Call) Return(_a0 catalog.LakehouseMonitorsInterface) *MockLakehouseMonitorsInterface_WithImpl_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockLakehouseMonitorsInterface_WithImpl_Call) RunAndReturn(run func(catalog.LakehouseMonitorsService) catalog.LakehouseMonitorsInterface) *MockLakehouseMonitorsInterface_WithImpl_Call { - _c.Call.Return(run) - return _c -} - -// NewMockLakehouseMonitorsInterface creates a new instance of MockLakehouseMonitorsInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewMockLakehouseMonitorsInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MockLakehouseMonitorsInterface { - mock := &MockLakehouseMonitorsInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/experimental/mocks/service/catalog/mock_quality_monitors_interface.go b/experimental/mocks/service/catalog/mock_quality_monitors_interface.go new file mode 100644 index 000000000..3ae8cf9e4 --- /dev/null +++ b/experimental/mocks/service/catalog/mock_quality_monitors_interface.go @@ -0,0 +1,806 @@ +// Code generated by mockery v2.43.0. DO NOT EDIT. + +package catalog + +import ( + context "context" + + catalog "github.com/databricks/databricks-sdk-go/service/catalog" + + mock "github.com/stretchr/testify/mock" +) + +// MockQualityMonitorsInterface is an autogenerated mock type for the QualityMonitorsInterface type +type MockQualityMonitorsInterface struct { + mock.Mock +} + +type MockQualityMonitorsInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockQualityMonitorsInterface) EXPECT() *MockQualityMonitorsInterface_Expecter { + return &MockQualityMonitorsInterface_Expecter{mock: &_m.Mock} +} + +// CancelRefresh provides a mock function with given fields: ctx, request +func (_m *MockQualityMonitorsInterface) CancelRefresh(ctx context.Context, request catalog.CancelRefreshRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CancelRefresh") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.CancelRefreshRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockQualityMonitorsInterface_CancelRefresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CancelRefresh' +type MockQualityMonitorsInterface_CancelRefresh_Call struct { + *mock.Call +} + +// CancelRefresh is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.CancelRefreshRequest +func (_e *MockQualityMonitorsInterface_Expecter) CancelRefresh(ctx interface{}, request interface{}) *MockQualityMonitorsInterface_CancelRefresh_Call { + return &MockQualityMonitorsInterface_CancelRefresh_Call{Call: _e.mock.On("CancelRefresh", ctx, request)} +} + +func (_c *MockQualityMonitorsInterface_CancelRefresh_Call) Run(run func(ctx context.Context, request catalog.CancelRefreshRequest)) *MockQualityMonitorsInterface_CancelRefresh_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.CancelRefreshRequest)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_CancelRefresh_Call) Return(_a0 error) *MockQualityMonitorsInterface_CancelRefresh_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockQualityMonitorsInterface_CancelRefresh_Call) RunAndReturn(run func(context.Context, catalog.CancelRefreshRequest) error) *MockQualityMonitorsInterface_CancelRefresh_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockQualityMonitorsInterface) Create(ctx context.Context, request catalog.CreateMonitor) (*catalog.MonitorInfo, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *catalog.MonitorInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateMonitor) (*catalog.MonitorInfo, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateMonitor) *catalog.MonitorInfo); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.MonitorInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.CreateMonitor) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQualityMonitorsInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockQualityMonitorsInterface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.CreateMonitor +func (_e *MockQualityMonitorsInterface_Expecter) Create(ctx interface{}, request interface{}) *MockQualityMonitorsInterface_Create_Call { + return &MockQualityMonitorsInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockQualityMonitorsInterface_Create_Call) Run(run func(ctx context.Context, request catalog.CreateMonitor)) *MockQualityMonitorsInterface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.CreateMonitor)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_Create_Call) Return(_a0 *catalog.MonitorInfo, _a1 error) *MockQualityMonitorsInterface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQualityMonitorsInterface_Create_Call) RunAndReturn(run func(context.Context, catalog.CreateMonitor) (*catalog.MonitorInfo, error)) *MockQualityMonitorsInterface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockQualityMonitorsInterface) Delete(ctx context.Context, request catalog.DeleteQualityMonitorRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.DeleteQualityMonitorRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockQualityMonitorsInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockQualityMonitorsInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.DeleteQualityMonitorRequest +func (_e *MockQualityMonitorsInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockQualityMonitorsInterface_Delete_Call { + return &MockQualityMonitorsInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockQualityMonitorsInterface_Delete_Call) Run(run func(ctx context.Context, request catalog.DeleteQualityMonitorRequest)) *MockQualityMonitorsInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.DeleteQualityMonitorRequest)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_Delete_Call) Return(_a0 error) *MockQualityMonitorsInterface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockQualityMonitorsInterface_Delete_Call) RunAndReturn(run func(context.Context, catalog.DeleteQualityMonitorRequest) error) *MockQualityMonitorsInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// DeleteByTableName provides a mock function with given fields: ctx, tableName +func (_m *MockQualityMonitorsInterface) DeleteByTableName(ctx context.Context, tableName string) error { + ret := _m.Called(ctx, tableName) + + if len(ret) == 0 { + panic("no return value specified for DeleteByTableName") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, tableName) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockQualityMonitorsInterface_DeleteByTableName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByTableName' +type MockQualityMonitorsInterface_DeleteByTableName_Call struct { + *mock.Call +} + +// DeleteByTableName is a helper method to define mock.On call +// - ctx context.Context +// - tableName string +func (_e *MockQualityMonitorsInterface_Expecter) DeleteByTableName(ctx interface{}, tableName interface{}) *MockQualityMonitorsInterface_DeleteByTableName_Call { + return &MockQualityMonitorsInterface_DeleteByTableName_Call{Call: _e.mock.On("DeleteByTableName", ctx, tableName)} +} + +func (_c *MockQualityMonitorsInterface_DeleteByTableName_Call) Run(run func(ctx context.Context, tableName string)) *MockQualityMonitorsInterface_DeleteByTableName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_DeleteByTableName_Call) Return(_a0 error) *MockQualityMonitorsInterface_DeleteByTableName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockQualityMonitorsInterface_DeleteByTableName_Call) RunAndReturn(run func(context.Context, string) error) *MockQualityMonitorsInterface_DeleteByTableName_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockQualityMonitorsInterface) Get(ctx context.Context, request catalog.GetQualityMonitorRequest) (*catalog.MonitorInfo, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *catalog.MonitorInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetQualityMonitorRequest) (*catalog.MonitorInfo, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetQualityMonitorRequest) *catalog.MonitorInfo); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.MonitorInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.GetQualityMonitorRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQualityMonitorsInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockQualityMonitorsInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.GetQualityMonitorRequest +func (_e *MockQualityMonitorsInterface_Expecter) Get(ctx interface{}, request interface{}) *MockQualityMonitorsInterface_Get_Call { + return &MockQualityMonitorsInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockQualityMonitorsInterface_Get_Call) Run(run func(ctx context.Context, request catalog.GetQualityMonitorRequest)) *MockQualityMonitorsInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.GetQualityMonitorRequest)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_Get_Call) Return(_a0 *catalog.MonitorInfo, _a1 error) *MockQualityMonitorsInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQualityMonitorsInterface_Get_Call) RunAndReturn(run func(context.Context, catalog.GetQualityMonitorRequest) (*catalog.MonitorInfo, error)) *MockQualityMonitorsInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetByTableName provides a mock function with given fields: ctx, tableName +func (_m *MockQualityMonitorsInterface) GetByTableName(ctx context.Context, tableName string) (*catalog.MonitorInfo, error) { + ret := _m.Called(ctx, tableName) + + if len(ret) == 0 { + panic("no return value specified for GetByTableName") + } + + var r0 *catalog.MonitorInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*catalog.MonitorInfo, error)); ok { + return rf(ctx, tableName) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *catalog.MonitorInfo); ok { + r0 = rf(ctx, tableName) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.MonitorInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, tableName) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQualityMonitorsInterface_GetByTableName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByTableName' +type MockQualityMonitorsInterface_GetByTableName_Call struct { + *mock.Call +} + +// GetByTableName is a helper method to define mock.On call +// - ctx context.Context +// - tableName string +func (_e *MockQualityMonitorsInterface_Expecter) GetByTableName(ctx interface{}, tableName interface{}) *MockQualityMonitorsInterface_GetByTableName_Call { + return &MockQualityMonitorsInterface_GetByTableName_Call{Call: _e.mock.On("GetByTableName", ctx, tableName)} +} + +func (_c *MockQualityMonitorsInterface_GetByTableName_Call) Run(run func(ctx context.Context, tableName string)) *MockQualityMonitorsInterface_GetByTableName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_GetByTableName_Call) Return(_a0 *catalog.MonitorInfo, _a1 error) *MockQualityMonitorsInterface_GetByTableName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQualityMonitorsInterface_GetByTableName_Call) RunAndReturn(run func(context.Context, string) (*catalog.MonitorInfo, error)) *MockQualityMonitorsInterface_GetByTableName_Call { + _c.Call.Return(run) + return _c +} + +// GetRefresh provides a mock function with given fields: ctx, request +func (_m *MockQualityMonitorsInterface) GetRefresh(ctx context.Context, request catalog.GetRefreshRequest) (*catalog.MonitorRefreshInfo, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetRefresh") + } + + var r0 *catalog.MonitorRefreshInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetRefreshRequest) (*catalog.MonitorRefreshInfo, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetRefreshRequest) *catalog.MonitorRefreshInfo); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.MonitorRefreshInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.GetRefreshRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQualityMonitorsInterface_GetRefresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRefresh' +type MockQualityMonitorsInterface_GetRefresh_Call struct { + *mock.Call +} + +// GetRefresh is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.GetRefreshRequest +func (_e *MockQualityMonitorsInterface_Expecter) GetRefresh(ctx interface{}, request interface{}) *MockQualityMonitorsInterface_GetRefresh_Call { + return &MockQualityMonitorsInterface_GetRefresh_Call{Call: _e.mock.On("GetRefresh", ctx, request)} +} + +func (_c *MockQualityMonitorsInterface_GetRefresh_Call) Run(run func(ctx context.Context, request catalog.GetRefreshRequest)) *MockQualityMonitorsInterface_GetRefresh_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.GetRefreshRequest)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_GetRefresh_Call) Return(_a0 *catalog.MonitorRefreshInfo, _a1 error) *MockQualityMonitorsInterface_GetRefresh_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQualityMonitorsInterface_GetRefresh_Call) RunAndReturn(run func(context.Context, catalog.GetRefreshRequest) (*catalog.MonitorRefreshInfo, error)) *MockQualityMonitorsInterface_GetRefresh_Call { + _c.Call.Return(run) + return _c +} + +// GetRefreshByTableNameAndRefreshId provides a mock function with given fields: ctx, tableName, refreshId +func (_m *MockQualityMonitorsInterface) GetRefreshByTableNameAndRefreshId(ctx context.Context, tableName string, refreshId string) (*catalog.MonitorRefreshInfo, error) { + ret := _m.Called(ctx, tableName, refreshId) + + if len(ret) == 0 { + panic("no return value specified for GetRefreshByTableNameAndRefreshId") + } + + var r0 *catalog.MonitorRefreshInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*catalog.MonitorRefreshInfo, error)); ok { + return rf(ctx, tableName, refreshId) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) *catalog.MonitorRefreshInfo); ok { + r0 = rf(ctx, tableName, refreshId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.MonitorRefreshInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, tableName, refreshId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQualityMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRefreshByTableNameAndRefreshId' +type MockQualityMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call struct { + *mock.Call +} + +// GetRefreshByTableNameAndRefreshId is a helper method to define mock.On call +// - ctx context.Context +// - tableName string +// - refreshId string +func (_e *MockQualityMonitorsInterface_Expecter) GetRefreshByTableNameAndRefreshId(ctx interface{}, tableName interface{}, refreshId interface{}) *MockQualityMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call { + return &MockQualityMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call{Call: _e.mock.On("GetRefreshByTableNameAndRefreshId", ctx, tableName, refreshId)} +} + +func (_c *MockQualityMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call) Run(run func(ctx context.Context, tableName string, refreshId string)) *MockQualityMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call) Return(_a0 *catalog.MonitorRefreshInfo, _a1 error) *MockQualityMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQualityMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call) RunAndReturn(run func(context.Context, string, string) (*catalog.MonitorRefreshInfo, error)) *MockQualityMonitorsInterface_GetRefreshByTableNameAndRefreshId_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockQualityMonitorsInterface) Impl() catalog.QualityMonitorsService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 catalog.QualityMonitorsService + if rf, ok := ret.Get(0).(func() catalog.QualityMonitorsService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(catalog.QualityMonitorsService) + } + } + + return r0 +} + +// MockQualityMonitorsInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockQualityMonitorsInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockQualityMonitorsInterface_Expecter) Impl() *MockQualityMonitorsInterface_Impl_Call { + return &MockQualityMonitorsInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockQualityMonitorsInterface_Impl_Call) Run(run func()) *MockQualityMonitorsInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_Impl_Call) Return(_a0 catalog.QualityMonitorsService) *MockQualityMonitorsInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockQualityMonitorsInterface_Impl_Call) RunAndReturn(run func() catalog.QualityMonitorsService) *MockQualityMonitorsInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// ListRefreshes provides a mock function with given fields: ctx, request +func (_m *MockQualityMonitorsInterface) ListRefreshes(ctx context.Context, request catalog.ListRefreshesRequest) ([]catalog.MonitorRefreshInfo, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListRefreshes") + } + + var r0 []catalog.MonitorRefreshInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListRefreshesRequest) ([]catalog.MonitorRefreshInfo, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListRefreshesRequest) []catalog.MonitorRefreshInfo); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]catalog.MonitorRefreshInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.ListRefreshesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQualityMonitorsInterface_ListRefreshes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRefreshes' +type MockQualityMonitorsInterface_ListRefreshes_Call struct { + *mock.Call +} + +// ListRefreshes is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.ListRefreshesRequest +func (_e *MockQualityMonitorsInterface_Expecter) ListRefreshes(ctx interface{}, request interface{}) *MockQualityMonitorsInterface_ListRefreshes_Call { + return &MockQualityMonitorsInterface_ListRefreshes_Call{Call: _e.mock.On("ListRefreshes", ctx, request)} +} + +func (_c *MockQualityMonitorsInterface_ListRefreshes_Call) Run(run func(ctx context.Context, request catalog.ListRefreshesRequest)) *MockQualityMonitorsInterface_ListRefreshes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.ListRefreshesRequest)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_ListRefreshes_Call) Return(_a0 []catalog.MonitorRefreshInfo, _a1 error) *MockQualityMonitorsInterface_ListRefreshes_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQualityMonitorsInterface_ListRefreshes_Call) RunAndReturn(run func(context.Context, catalog.ListRefreshesRequest) ([]catalog.MonitorRefreshInfo, error)) *MockQualityMonitorsInterface_ListRefreshes_Call { + _c.Call.Return(run) + return _c +} + +// ListRefreshesByTableName provides a mock function with given fields: ctx, tableName +func (_m *MockQualityMonitorsInterface) ListRefreshesByTableName(ctx context.Context, tableName string) ([]catalog.MonitorRefreshInfo, error) { + ret := _m.Called(ctx, tableName) + + if len(ret) == 0 { + panic("no return value specified for ListRefreshesByTableName") + } + + var r0 []catalog.MonitorRefreshInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) ([]catalog.MonitorRefreshInfo, error)); ok { + return rf(ctx, tableName) + } + if rf, ok := ret.Get(0).(func(context.Context, string) []catalog.MonitorRefreshInfo); ok { + r0 = rf(ctx, tableName) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]catalog.MonitorRefreshInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, tableName) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQualityMonitorsInterface_ListRefreshesByTableName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRefreshesByTableName' +type MockQualityMonitorsInterface_ListRefreshesByTableName_Call struct { + *mock.Call +} + +// ListRefreshesByTableName is a helper method to define mock.On call +// - ctx context.Context +// - tableName string +func (_e *MockQualityMonitorsInterface_Expecter) ListRefreshesByTableName(ctx interface{}, tableName interface{}) *MockQualityMonitorsInterface_ListRefreshesByTableName_Call { + return &MockQualityMonitorsInterface_ListRefreshesByTableName_Call{Call: _e.mock.On("ListRefreshesByTableName", ctx, tableName)} +} + +func (_c *MockQualityMonitorsInterface_ListRefreshesByTableName_Call) Run(run func(ctx context.Context, tableName string)) *MockQualityMonitorsInterface_ListRefreshesByTableName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_ListRefreshesByTableName_Call) Return(_a0 []catalog.MonitorRefreshInfo, _a1 error) *MockQualityMonitorsInterface_ListRefreshesByTableName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQualityMonitorsInterface_ListRefreshesByTableName_Call) RunAndReturn(run func(context.Context, string) ([]catalog.MonitorRefreshInfo, error)) *MockQualityMonitorsInterface_ListRefreshesByTableName_Call { + _c.Call.Return(run) + return _c +} + +// RunRefresh provides a mock function with given fields: ctx, request +func (_m *MockQualityMonitorsInterface) RunRefresh(ctx context.Context, request catalog.RunRefreshRequest) (*catalog.MonitorRefreshInfo, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for RunRefresh") + } + + var r0 *catalog.MonitorRefreshInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.RunRefreshRequest) (*catalog.MonitorRefreshInfo, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.RunRefreshRequest) *catalog.MonitorRefreshInfo); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.MonitorRefreshInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.RunRefreshRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQualityMonitorsInterface_RunRefresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RunRefresh' +type MockQualityMonitorsInterface_RunRefresh_Call struct { + *mock.Call +} + +// RunRefresh is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.RunRefreshRequest +func (_e *MockQualityMonitorsInterface_Expecter) RunRefresh(ctx interface{}, request interface{}) *MockQualityMonitorsInterface_RunRefresh_Call { + return &MockQualityMonitorsInterface_RunRefresh_Call{Call: _e.mock.On("RunRefresh", ctx, request)} +} + +func (_c *MockQualityMonitorsInterface_RunRefresh_Call) Run(run func(ctx context.Context, request catalog.RunRefreshRequest)) *MockQualityMonitorsInterface_RunRefresh_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.RunRefreshRequest)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_RunRefresh_Call) Return(_a0 *catalog.MonitorRefreshInfo, _a1 error) *MockQualityMonitorsInterface_RunRefresh_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQualityMonitorsInterface_RunRefresh_Call) RunAndReturn(run func(context.Context, catalog.RunRefreshRequest) (*catalog.MonitorRefreshInfo, error)) *MockQualityMonitorsInterface_RunRefresh_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockQualityMonitorsInterface) Update(ctx context.Context, request catalog.UpdateMonitor) (*catalog.MonitorInfo, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *catalog.MonitorInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateMonitor) (*catalog.MonitorInfo, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateMonitor) *catalog.MonitorInfo); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.MonitorInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.UpdateMonitor) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQualityMonitorsInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockQualityMonitorsInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.UpdateMonitor +func (_e *MockQualityMonitorsInterface_Expecter) Update(ctx interface{}, request interface{}) *MockQualityMonitorsInterface_Update_Call { + return &MockQualityMonitorsInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockQualityMonitorsInterface_Update_Call) Run(run func(ctx context.Context, request catalog.UpdateMonitor)) *MockQualityMonitorsInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.UpdateMonitor)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_Update_Call) Return(_a0 *catalog.MonitorInfo, _a1 error) *MockQualityMonitorsInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQualityMonitorsInterface_Update_Call) RunAndReturn(run func(context.Context, catalog.UpdateMonitor) (*catalog.MonitorInfo, error)) *MockQualityMonitorsInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockQualityMonitorsInterface) WithImpl(impl catalog.QualityMonitorsService) catalog.QualityMonitorsInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 catalog.QualityMonitorsInterface + if rf, ok := ret.Get(0).(func(catalog.QualityMonitorsService) catalog.QualityMonitorsInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(catalog.QualityMonitorsInterface) + } + } + + return r0 +} + +// MockQualityMonitorsInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockQualityMonitorsInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl catalog.QualityMonitorsService +func (_e *MockQualityMonitorsInterface_Expecter) WithImpl(impl interface{}) *MockQualityMonitorsInterface_WithImpl_Call { + return &MockQualityMonitorsInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockQualityMonitorsInterface_WithImpl_Call) Run(run func(impl catalog.QualityMonitorsService)) *MockQualityMonitorsInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(catalog.QualityMonitorsService)) + }) + return _c +} + +func (_c *MockQualityMonitorsInterface_WithImpl_Call) Return(_a0 catalog.QualityMonitorsInterface) *MockQualityMonitorsInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockQualityMonitorsInterface_WithImpl_Call) RunAndReturn(run func(catalog.QualityMonitorsService) catalog.QualityMonitorsInterface) *MockQualityMonitorsInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockQualityMonitorsInterface creates a new instance of MockQualityMonitorsInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockQualityMonitorsInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockQualityMonitorsInterface { + mock := &MockQualityMonitorsInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/compute/mock_libraries_interface.go b/experimental/mocks/service/compute/mock_libraries_interface.go index a5add6789..9e6e91215 100644 --- a/experimental/mocks/service/compute/mock_libraries_interface.go +++ b/experimental/mocks/service/compute/mock_libraries_interface.go @@ -28,23 +28,71 @@ func (_m *MockLibrariesInterface) EXPECT() *MockLibrariesInterface_Expecter { } // AllClusterStatuses provides a mock function with given fields: ctx -func (_m *MockLibrariesInterface) AllClusterStatuses(ctx context.Context) (*compute.ListAllClusterLibraryStatusesResponse, error) { +func (_m *MockLibrariesInterface) AllClusterStatuses(ctx context.Context) listing.Iterator[compute.ClusterLibraryStatuses] { ret := _m.Called(ctx) if len(ret) == 0 { panic("no return value specified for AllClusterStatuses") } - var r0 *compute.ListAllClusterLibraryStatusesResponse + var r0 listing.Iterator[compute.ClusterLibraryStatuses] + if rf, ok := ret.Get(0).(func(context.Context) listing.Iterator[compute.ClusterLibraryStatuses]); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[compute.ClusterLibraryStatuses]) + } + } + + return r0 +} + +// MockLibrariesInterface_AllClusterStatuses_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AllClusterStatuses' +type MockLibrariesInterface_AllClusterStatuses_Call struct { + *mock.Call +} + +// AllClusterStatuses is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockLibrariesInterface_Expecter) AllClusterStatuses(ctx interface{}) *MockLibrariesInterface_AllClusterStatuses_Call { + return &MockLibrariesInterface_AllClusterStatuses_Call{Call: _e.mock.On("AllClusterStatuses", ctx)} +} + +func (_c *MockLibrariesInterface_AllClusterStatuses_Call) Run(run func(ctx context.Context)) *MockLibrariesInterface_AllClusterStatuses_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockLibrariesInterface_AllClusterStatuses_Call) Return(_a0 listing.Iterator[compute.ClusterLibraryStatuses]) *MockLibrariesInterface_AllClusterStatuses_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_AllClusterStatuses_Call) RunAndReturn(run func(context.Context) listing.Iterator[compute.ClusterLibraryStatuses]) *MockLibrariesInterface_AllClusterStatuses_Call { + _c.Call.Return(run) + return _c +} + +// AllClusterStatusesAll provides a mock function with given fields: ctx +func (_m *MockLibrariesInterface) AllClusterStatusesAll(ctx context.Context) ([]compute.ClusterLibraryStatuses, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for AllClusterStatusesAll") + } + + var r0 []compute.ClusterLibraryStatuses var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*compute.ListAllClusterLibraryStatusesResponse, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) ([]compute.ClusterLibraryStatuses, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) *compute.ListAllClusterLibraryStatusesResponse); ok { + if rf, ok := ret.Get(0).(func(context.Context) []compute.ClusterLibraryStatuses); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*compute.ListAllClusterLibraryStatusesResponse) + r0 = ret.Get(0).([]compute.ClusterLibraryStatuses) } } @@ -57,30 +105,30 @@ func (_m *MockLibrariesInterface) AllClusterStatuses(ctx context.Context) (*comp return r0, r1 } -// MockLibrariesInterface_AllClusterStatuses_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AllClusterStatuses' -type MockLibrariesInterface_AllClusterStatuses_Call struct { +// MockLibrariesInterface_AllClusterStatusesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AllClusterStatusesAll' +type MockLibrariesInterface_AllClusterStatusesAll_Call struct { *mock.Call } -// AllClusterStatuses is a helper method to define mock.On call +// AllClusterStatusesAll is a helper method to define mock.On call // - ctx context.Context -func (_e *MockLibrariesInterface_Expecter) AllClusterStatuses(ctx interface{}) *MockLibrariesInterface_AllClusterStatuses_Call { - return &MockLibrariesInterface_AllClusterStatuses_Call{Call: _e.mock.On("AllClusterStatuses", ctx)} +func (_e *MockLibrariesInterface_Expecter) AllClusterStatusesAll(ctx interface{}) *MockLibrariesInterface_AllClusterStatusesAll_Call { + return &MockLibrariesInterface_AllClusterStatusesAll_Call{Call: _e.mock.On("AllClusterStatusesAll", ctx)} } -func (_c *MockLibrariesInterface_AllClusterStatuses_Call) Run(run func(ctx context.Context)) *MockLibrariesInterface_AllClusterStatuses_Call { +func (_c *MockLibrariesInterface_AllClusterStatusesAll_Call) Run(run func(ctx context.Context)) *MockLibrariesInterface_AllClusterStatusesAll_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context)) }) return _c } -func (_c *MockLibrariesInterface_AllClusterStatuses_Call) Return(_a0 *compute.ListAllClusterLibraryStatusesResponse, _a1 error) *MockLibrariesInterface_AllClusterStatuses_Call { +func (_c *MockLibrariesInterface_AllClusterStatusesAll_Call) Return(_a0 []compute.ClusterLibraryStatuses, _a1 error) *MockLibrariesInterface_AllClusterStatusesAll_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockLibrariesInterface_AllClusterStatuses_Call) RunAndReturn(run func(context.Context) (*compute.ListAllClusterLibraryStatusesResponse, error)) *MockLibrariesInterface_AllClusterStatuses_Call { +func (_c *MockLibrariesInterface_AllClusterStatusesAll_Call) RunAndReturn(run func(context.Context) ([]compute.ClusterLibraryStatuses, error)) *MockLibrariesInterface_AllClusterStatusesAll_Call { _c.Call.Return(run) return _c } @@ -194,23 +242,23 @@ func (_c *MockLibrariesInterface_ClusterStatusAll_Call) RunAndReturn(run func(co } // ClusterStatusByClusterId provides a mock function with given fields: ctx, clusterId -func (_m *MockLibrariesInterface) ClusterStatusByClusterId(ctx context.Context, clusterId string) (*compute.ClusterStatusResponse, error) { +func (_m *MockLibrariesInterface) ClusterStatusByClusterId(ctx context.Context, clusterId string) (*compute.ClusterLibraryStatuses, error) { ret := _m.Called(ctx, clusterId) if len(ret) == 0 { panic("no return value specified for ClusterStatusByClusterId") } - var r0 *compute.ClusterStatusResponse + var r0 *compute.ClusterLibraryStatuses var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*compute.ClusterStatusResponse, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, string) (*compute.ClusterLibraryStatuses, error)); ok { return rf(ctx, clusterId) } - if rf, ok := ret.Get(0).(func(context.Context, string) *compute.ClusterStatusResponse); ok { + if rf, ok := ret.Get(0).(func(context.Context, string) *compute.ClusterLibraryStatuses); ok { r0 = rf(ctx, clusterId) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*compute.ClusterStatusResponse) + r0 = ret.Get(0).(*compute.ClusterLibraryStatuses) } } @@ -242,12 +290,12 @@ func (_c *MockLibrariesInterface_ClusterStatusByClusterId_Call) Run(run func(ctx return _c } -func (_c *MockLibrariesInterface_ClusterStatusByClusterId_Call) Return(_a0 *compute.ClusterStatusResponse, _a1 error) *MockLibrariesInterface_ClusterStatusByClusterId_Call { +func (_c *MockLibrariesInterface_ClusterStatusByClusterId_Call) Return(_a0 *compute.ClusterLibraryStatuses, _a1 error) *MockLibrariesInterface_ClusterStatusByClusterId_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockLibrariesInterface_ClusterStatusByClusterId_Call) RunAndReturn(run func(context.Context, string) (*compute.ClusterStatusResponse, error)) *MockLibrariesInterface_ClusterStatusByClusterId_Call { +func (_c *MockLibrariesInterface_ClusterStatusByClusterId_Call) RunAndReturn(run func(context.Context, string) (*compute.ClusterLibraryStatuses, error)) *MockLibrariesInterface_ClusterStatusByClusterId_Call { _c.Call.Return(run) return _c } @@ -394,7 +442,7 @@ func (_c *MockLibrariesInterface_Uninstall_Call) RunAndReturn(run func(context.C } // UpdateAndWait provides a mock function with given fields: ctx, update, options -func (_m *MockLibrariesInterface) UpdateAndWait(ctx context.Context, update compute.Update, options ...retries.Option[compute.ClusterStatusResponse]) error { +func (_m *MockLibrariesInterface) UpdateAndWait(ctx context.Context, update compute.Update, options ...retries.Option[compute.ClusterLibraryStatuses]) error { _va := make([]interface{}, len(options)) for _i := range options { _va[_i] = options[_i] @@ -409,7 +457,7 @@ func (_m *MockLibrariesInterface) UpdateAndWait(ctx context.Context, update comp } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, compute.Update, ...retries.Option[compute.ClusterStatusResponse]) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, compute.Update, ...retries.Option[compute.ClusterLibraryStatuses]) error); ok { r0 = rf(ctx, update, options...) } else { r0 = ret.Error(0) @@ -426,18 +474,18 @@ type MockLibrariesInterface_UpdateAndWait_Call struct { // UpdateAndWait is a helper method to define mock.On call // - ctx context.Context // - update compute.Update -// - options ...retries.Option[compute.ClusterStatusResponse] +// - options ...retries.Option[compute.ClusterLibraryStatuses] func (_e *MockLibrariesInterface_Expecter) UpdateAndWait(ctx interface{}, update interface{}, options ...interface{}) *MockLibrariesInterface_UpdateAndWait_Call { return &MockLibrariesInterface_UpdateAndWait_Call{Call: _e.mock.On("UpdateAndWait", append([]interface{}{ctx, update}, options...)...)} } -func (_c *MockLibrariesInterface_UpdateAndWait_Call) Run(run func(ctx context.Context, update compute.Update, options ...retries.Option[compute.ClusterStatusResponse])) *MockLibrariesInterface_UpdateAndWait_Call { +func (_c *MockLibrariesInterface_UpdateAndWait_Call) Run(run func(ctx context.Context, update compute.Update, options ...retries.Option[compute.ClusterLibraryStatuses])) *MockLibrariesInterface_UpdateAndWait_Call { _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]retries.Option[compute.ClusterStatusResponse], len(args)-2) + variadicArgs := make([]retries.Option[compute.ClusterLibraryStatuses], len(args)-2) for i, a := range args[2:] { if a != nil { - variadicArgs[i] = a.(retries.Option[compute.ClusterStatusResponse]) + variadicArgs[i] = a.(retries.Option[compute.ClusterLibraryStatuses]) } } run(args[0].(context.Context), args[1].(compute.Update), variadicArgs...) @@ -450,7 +498,7 @@ func (_c *MockLibrariesInterface_UpdateAndWait_Call) Return(_a0 error) *MockLibr return _c } -func (_c *MockLibrariesInterface_UpdateAndWait_Call) RunAndReturn(run func(context.Context, compute.Update, ...retries.Option[compute.ClusterStatusResponse]) error) *MockLibrariesInterface_UpdateAndWait_Call { +func (_c *MockLibrariesInterface_UpdateAndWait_Call) RunAndReturn(run func(context.Context, compute.Update, ...retries.Option[compute.ClusterLibraryStatuses]) error) *MockLibrariesInterface_UpdateAndWait_Call { _c.Call.Return(run) return _c } diff --git a/experimental/mocks/service/serving/mock_serving_endpoints_interface.go b/experimental/mocks/service/serving/mock_serving_endpoints_interface.go index 62c0ee1f3..496304aec 100644 --- a/experimental/mocks/service/serving/mock_serving_endpoints_interface.go +++ b/experimental/mocks/service/serving/mock_serving_endpoints_interface.go @@ -375,21 +375,33 @@ func (_c *MockServingEndpointsInterface_DeleteByName_Call) RunAndReturn(run func } // ExportMetrics provides a mock function with given fields: ctx, request -func (_m *MockServingEndpointsInterface) ExportMetrics(ctx context.Context, request serving.ExportMetricsRequest) error { +func (_m *MockServingEndpointsInterface) ExportMetrics(ctx context.Context, request serving.ExportMetricsRequest) (*serving.ExportMetricsResponse, error) { ret := _m.Called(ctx, request) if len(ret) == 0 { panic("no return value specified for ExportMetrics") } - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, serving.ExportMetricsRequest) error); ok { + var r0 *serving.ExportMetricsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, serving.ExportMetricsRequest) (*serving.ExportMetricsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, serving.ExportMetricsRequest) *serving.ExportMetricsResponse); ok { r0 = rf(ctx, request) } else { - r0 = ret.Error(0) + if ret.Get(0) != nil { + r0 = ret.Get(0).(*serving.ExportMetricsResponse) + } } - return r0 + if rf, ok := ret.Get(1).(func(context.Context, serving.ExportMetricsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 } // MockServingEndpointsInterface_ExportMetrics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExportMetrics' @@ -411,32 +423,44 @@ func (_c *MockServingEndpointsInterface_ExportMetrics_Call) Run(run func(ctx con return _c } -func (_c *MockServingEndpointsInterface_ExportMetrics_Call) Return(_a0 error) *MockServingEndpointsInterface_ExportMetrics_Call { - _c.Call.Return(_a0) +func (_c *MockServingEndpointsInterface_ExportMetrics_Call) Return(_a0 *serving.ExportMetricsResponse, _a1 error) *MockServingEndpointsInterface_ExportMetrics_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MockServingEndpointsInterface_ExportMetrics_Call) RunAndReturn(run func(context.Context, serving.ExportMetricsRequest) error) *MockServingEndpointsInterface_ExportMetrics_Call { +func (_c *MockServingEndpointsInterface_ExportMetrics_Call) RunAndReturn(run func(context.Context, serving.ExportMetricsRequest) (*serving.ExportMetricsResponse, error)) *MockServingEndpointsInterface_ExportMetrics_Call { _c.Call.Return(run) return _c } // ExportMetricsByName provides a mock function with given fields: ctx, name -func (_m *MockServingEndpointsInterface) ExportMetricsByName(ctx context.Context, name string) error { +func (_m *MockServingEndpointsInterface) ExportMetricsByName(ctx context.Context, name string) (*serving.ExportMetricsResponse, error) { ret := _m.Called(ctx, name) if len(ret) == 0 { panic("no return value specified for ExportMetricsByName") } - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + var r0 *serving.ExportMetricsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*serving.ExportMetricsResponse, error)); ok { + return rf(ctx, name) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *serving.ExportMetricsResponse); ok { r0 = rf(ctx, name) } else { - r0 = ret.Error(0) + if ret.Get(0) != nil { + r0 = ret.Get(0).(*serving.ExportMetricsResponse) + } } - return r0 + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 } // MockServingEndpointsInterface_ExportMetricsByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExportMetricsByName' @@ -458,12 +482,12 @@ func (_c *MockServingEndpointsInterface_ExportMetricsByName_Call) Run(run func(c return _c } -func (_c *MockServingEndpointsInterface_ExportMetricsByName_Call) Return(_a0 error) *MockServingEndpointsInterface_ExportMetricsByName_Call { - _c.Call.Return(_a0) +func (_c *MockServingEndpointsInterface_ExportMetricsByName_Call) Return(_a0 *serving.ExportMetricsResponse, _a1 error) *MockServingEndpointsInterface_ExportMetricsByName_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MockServingEndpointsInterface_ExportMetricsByName_Call) RunAndReturn(run func(context.Context, string) error) *MockServingEndpointsInterface_ExportMetricsByName_Call { +func (_c *MockServingEndpointsInterface_ExportMetricsByName_Call) RunAndReturn(run func(context.Context, string) (*serving.ExportMetricsResponse, error)) *MockServingEndpointsInterface_ExportMetricsByName_Call { _c.Call.Return(run) return _c } diff --git a/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go b/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go index 77efe5283..7b609f982 100644 --- a/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go +++ b/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go @@ -568,6 +568,65 @@ func (_c *MockVectorSearchIndexesInterface_QueryIndex_Call) RunAndReturn(run fun return _c } +// ScanIndex provides a mock function with given fields: ctx, request +func (_m *MockVectorSearchIndexesInterface) ScanIndex(ctx context.Context, request vectorsearch.ScanVectorIndexRequest) (*vectorsearch.ScanVectorIndexResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ScanIndex") + } + + var r0 *vectorsearch.ScanVectorIndexResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, vectorsearch.ScanVectorIndexRequest) (*vectorsearch.ScanVectorIndexResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, vectorsearch.ScanVectorIndexRequest) *vectorsearch.ScanVectorIndexResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vectorsearch.ScanVectorIndexResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, vectorsearch.ScanVectorIndexRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockVectorSearchIndexesInterface_ScanIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ScanIndex' +type MockVectorSearchIndexesInterface_ScanIndex_Call struct { + *mock.Call +} + +// ScanIndex is a helper method to define mock.On call +// - ctx context.Context +// - request vectorsearch.ScanVectorIndexRequest +func (_e *MockVectorSearchIndexesInterface_Expecter) ScanIndex(ctx interface{}, request interface{}) *MockVectorSearchIndexesInterface_ScanIndex_Call { + return &MockVectorSearchIndexesInterface_ScanIndex_Call{Call: _e.mock.On("ScanIndex", ctx, request)} +} + +func (_c *MockVectorSearchIndexesInterface_ScanIndex_Call) Run(run func(ctx context.Context, request vectorsearch.ScanVectorIndexRequest)) *MockVectorSearchIndexesInterface_ScanIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(vectorsearch.ScanVectorIndexRequest)) + }) + return _c +} + +func (_c *MockVectorSearchIndexesInterface_ScanIndex_Call) Return(_a0 *vectorsearch.ScanVectorIndexResponse, _a1 error) *MockVectorSearchIndexesInterface_ScanIndex_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockVectorSearchIndexesInterface_ScanIndex_Call) RunAndReturn(run func(context.Context, vectorsearch.ScanVectorIndexRequest) (*vectorsearch.ScanVectorIndexResponse, error)) *MockVectorSearchIndexesInterface_ScanIndex_Call { + _c.Call.Return(run) + return _c +} + // SyncIndex provides a mock function with given fields: ctx, request func (_m *MockVectorSearchIndexesInterface) SyncIndex(ctx context.Context, request vectorsearch.SyncIndexRequest) error { ret := _m.Called(ctx, request) diff --git a/internal/connections_test.go b/internal/connections_test.go index f88252c05..101f13a4a 100644 --- a/internal/connections_test.go +++ b/internal/connections_test.go @@ -43,7 +43,7 @@ func TestAccConnections(t *testing.T) { require.NoError(t, err) assert.Equal(t, conn.Options, connUpdate.Options) - connList, err := w.Connections.ListAll(ctx) + connList, err := w.Connections.ListAll(ctx, catalog.ListConnectionsRequest{}) require.NoError(t, err) assert.True(t, len(connList) >= 1) } diff --git a/service/catalog/api.go b/service/catalog/api.go index 775cbc71b..0912fc1be 100755 --- a/service/catalog/api.go +++ b/service/catalog/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Account Metastore Assignments, Account Metastores, Account Storage Credentials, Artifact Allowlists, Catalogs, Connections, External Locations, Functions, Grants, Lakehouse Monitors, Metastores, Model Versions, Online Tables, Registered Models, Schemas, Storage Credentials, System Schemas, Table Constraints, Tables, Volumes, Workspace Bindings, etc. +// These APIs allow you to manage Account Metastore Assignments, Account Metastores, Account Storage Credentials, Artifact Allowlists, Catalogs, Connections, External Locations, Functions, Grants, Metastores, Model Versions, Online Tables, Quality Monitors, Registered Models, Schemas, Storage Credentials, System Schemas, Table Constraints, Tables, Volumes, Workspace Bindings, etc. package catalog import ( @@ -964,14 +964,14 @@ type ConnectionsInterface interface { // List all connections. // // This method is generated by Databricks SDK Code Generator. - List(ctx context.Context) listing.Iterator[ConnectionInfo] + List(ctx context.Context, request ListConnectionsRequest) listing.Iterator[ConnectionInfo] // List connections. // // List all connections. // // This method is generated by Databricks SDK Code Generator. - ListAll(ctx context.Context) ([]ConnectionInfo, error) + ListAll(ctx context.Context, request ListConnectionsRequest) ([]ConnectionInfo, error) // ConnectionInfoNameToFullNameMap calls [ConnectionsAPI.ListAll] and creates a map of results with [ConnectionInfo].Name as key and [ConnectionInfo].FullName as value. // @@ -980,7 +980,7 @@ type ConnectionsInterface interface { // Note: All [ConnectionInfo] instances are loaded into memory before creating a map. // // This method is generated by Databricks SDK Code Generator. - ConnectionInfoNameToFullNameMap(ctx context.Context) (map[string]string, error) + ConnectionInfoNameToFullNameMap(ctx context.Context, request ListConnectionsRequest) (map[string]string, error) // Update a connection. // @@ -1075,22 +1075,27 @@ func (a *ConnectionsAPI) GetByName(ctx context.Context, name string) (*Connectio // List all connections. // // This method is generated by Databricks SDK Code Generator. -func (a *ConnectionsAPI) List(ctx context.Context) listing.Iterator[ConnectionInfo] { - request := struct{}{} +func (a *ConnectionsAPI) List(ctx context.Context, request ListConnectionsRequest) listing.Iterator[ConnectionInfo] { - getNextPage := func(ctx context.Context, req struct{}) (*ListConnectionsResponse, error) { + getNextPage := func(ctx context.Context, req ListConnectionsRequest) (*ListConnectionsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") - return a.impl.List(ctx) + return a.impl.List(ctx, req) } getItems := func(resp *ListConnectionsResponse) []ConnectionInfo { return resp.Connections } - + getNextReq := func(resp *ListConnectionsResponse) *ListConnectionsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } iterator := listing.NewIterator( &request, getNextPage, getItems, - nil) + getNextReq) return iterator } @@ -1099,9 +1104,10 @@ func (a *ConnectionsAPI) List(ctx context.Context) listing.Iterator[ConnectionIn // List all connections. // // This method is generated by Databricks SDK Code Generator. -func (a *ConnectionsAPI) ListAll(ctx context.Context) ([]ConnectionInfo, error) { - iterator := a.List(ctx) - return listing.ToSlice[ConnectionInfo](ctx, iterator) +func (a *ConnectionsAPI) ListAll(ctx context.Context, request ListConnectionsRequest) ([]ConnectionInfo, error) { + iterator := a.List(ctx, request) + return listing.ToSliceN[ConnectionInfo, int](ctx, iterator, request.MaxResults) + } // ConnectionInfoNameToFullNameMap calls [ConnectionsAPI.ListAll] and creates a map of results with [ConnectionInfo].Name as key and [ConnectionInfo].FullName as value. @@ -1111,10 +1117,10 @@ func (a *ConnectionsAPI) ListAll(ctx context.Context) ([]ConnectionInfo, error) // Note: All [ConnectionInfo] instances are loaded into memory before creating a map. // // This method is generated by Databricks SDK Code Generator. -func (a *ConnectionsAPI) ConnectionInfoNameToFullNameMap(ctx context.Context) (map[string]string, error) { +func (a *ConnectionsAPI) ConnectionInfoNameToFullNameMap(ctx context.Context, request ListConnectionsRequest) (map[string]string, error) { ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") mapping := map[string]string{} - result, err := a.ListAll(ctx) + result, err := a.ListAll(ctx, request) if err != nil { return nil, err } @@ -1773,1286 +1779,1286 @@ func (a *GrantsAPI) Update(ctx context.Context, request UpdatePermissions) (*Per return a.impl.Update(ctx, request) } -type LakehouseMonitorsInterface interface { +type MetastoresInterface interface { // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. - // Deprecated: use MockLakehouseMonitorsInterface instead. - WithImpl(impl LakehouseMonitorsService) LakehouseMonitorsInterface + // Deprecated: use MockMetastoresInterface instead. + WithImpl(impl MetastoresService) MetastoresInterface - // Impl returns low-level LakehouseMonitors API implementation - // Deprecated: use MockLakehouseMonitorsInterface instead. - Impl() LakehouseMonitorsService + // Impl returns low-level Metastores API implementation + // Deprecated: use MockMetastoresInterface instead. + Impl() MetastoresService - // Cancel refresh. - // - // Cancel an active monitor refresh for the given refresh ID. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an - // owner of the table + // Create an assignment. // - // Additionally, the call must be made from the workspace where the monitor was - // created. - CancelRefresh(ctx context.Context, request CancelRefreshRequest) error + // Creates a new metastore assignment. If an assignment for the same + // __workspace_id__ exists, it will be overwritten by the new __metastore_id__ + // and __default_catalog_name__. The caller must be an account admin. + Assign(ctx context.Context, request CreateMetastoreAssignment) error - // Create a table monitor. - // - // Creates a new monitor for the specified table. - // - // The caller must either: 1. be an owner of the table's parent catalog, have - // **USE_SCHEMA** on the table's parent schema, and have **SELECT** access on - // the table 2. have **USE_CATALOG** on the table's parent catalog, be an owner - // of the table's parent schema, and have **SELECT** access on the table. 3. - // have the following permissions: - **USE_CATALOG** on the table's parent - // catalog - **USE_SCHEMA** on the table's parent schema - be an owner of the - // table. + // Create a metastore. // - // Workspace assets, such as the dashboard, will be created in the workspace - // where this call was made. - Create(ctx context.Context, request CreateMonitor) (*MonitorInfo, error) + // Creates a new metastore based on a provided name and optional storage root + // path. By default (if the __owner__ field is not set), the owner of the new + // metastore is the user calling the __createMetastore__ API. If the __owner__ + // field is set to the empty string (**""**), the ownership is assigned to the + // System User instead. + Create(ctx context.Context, request CreateMetastore) (*MetastoreInfo, error) - // Delete a table monitor. - // - // Deletes a monitor for the specified table. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an - // owner of the table. - // - // Additionally, the call must be made from the workspace where the monitor was - // created. + // Get metastore assignment for workspace. // - // Note that the metric tables and dashboard will not be deleted as part of this - // call; those assets must be manually cleaned up (if desired). - Delete(ctx context.Context, request DeleteLakehouseMonitorRequest) error + // Gets the metastore assignment for the workspace being accessed. + Current(ctx context.Context) (*MetastoreAssignment, error) - // Delete a table monitor. - // - // Deletes a monitor for the specified table. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an - // owner of the table. - // - // Additionally, the call must be made from the workspace where the monitor was - // created. + // Delete a metastore. // - // Note that the metric tables and dashboard will not be deleted as part of this - // call; those assets must be manually cleaned up (if desired). - DeleteByTableName(ctx context.Context, tableName string) error + // Deletes a metastore. The caller must be a metastore admin. + Delete(ctx context.Context, request DeleteMetastoreRequest) error - // Get a table monitor. - // - // Gets a monitor for the specified table. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema. 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - - // **SELECT** privilege on the table. + // Delete a metastore. // - // The returned information includes configuration values, as well as - // information on assets created by the monitor. Some information (e.g., - // dashboard) may be filtered out if the caller is in a different workspace than - // where the monitor was created. - Get(ctx context.Context, request GetLakehouseMonitorRequest) (*MonitorInfo, error) + // Deletes a metastore. The caller must be a metastore admin. + DeleteById(ctx context.Context, id string) error - // Get a table monitor. - // - // Gets a monitor for the specified table. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema. 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - - // **SELECT** privilege on the table. + // Get a metastore. // - // The returned information includes configuration values, as well as - // information on assets created by the monitor. Some information (e.g., - // dashboard) may be filtered out if the caller is in a different workspace than - // where the monitor was created. - GetByTableName(ctx context.Context, tableName string) (*MonitorInfo, error) + // Gets a metastore that matches the supplied ID. The caller must be a metastore + // admin to retrieve this info. + Get(ctx context.Context, request GetMetastoreRequest) (*MetastoreInfo, error) - // Get refresh. + // Get a metastore. // - // Gets info about a specific monitor refresh using the given refresh ID. + // Gets a metastore that matches the supplied ID. The caller must be a metastore + // admin to retrieve this info. + GetById(ctx context.Context, id string) (*MetastoreInfo, error) + + // List metastores. // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - - // **SELECT** privilege on the table. + // Gets an array of the available metastores (as __MetastoreInfo__ objects). The + // caller must be an admin to retrieve this info. There is no guarantee of a + // specific ordering of the elements in the array. // - // Additionally, the call must be made from the workspace where the monitor was - // created. - GetRefresh(ctx context.Context, request GetRefreshRequest) (*MonitorRefreshInfo, error) + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context) listing.Iterator[MetastoreInfo] - // Get refresh. - // - // Gets info about a specific monitor refresh using the given refresh ID. + // List metastores. // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - - // **SELECT** privilege on the table. + // Gets an array of the available metastores (as __MetastoreInfo__ objects). The + // caller must be an admin to retrieve this info. There is no guarantee of a + // specific ordering of the elements in the array. // - // Additionally, the call must be made from the workspace where the monitor was - // created. - GetRefreshByTableNameAndRefreshId(ctx context.Context, tableName string, refreshId string) (*MonitorRefreshInfo, error) + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context) ([]MetastoreInfo, error) - // List refreshes. + // MetastoreInfoNameToMetastoreIdMap calls [MetastoresAPI.ListAll] and creates a map of results with [MetastoreInfo].Name as key and [MetastoreInfo].MetastoreId as value. // - // Gets an array containing the history of the most recent refreshes (up to 25) - // for this table. + // Returns an error if there's more than one [MetastoreInfo] with the same .Name. // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - - // **SELECT** privilege on the table. + // Note: All [MetastoreInfo] instances are loaded into memory before creating a map. // - // Additionally, the call must be made from the workspace where the monitor was - // created. - ListRefreshes(ctx context.Context, request ListRefreshesRequest) ([]MonitorRefreshInfo, error) + // This method is generated by Databricks SDK Code Generator. + MetastoreInfoNameToMetastoreIdMap(ctx context.Context) (map[string]string, error) - // List refreshes. + // GetByName calls [MetastoresAPI.MetastoreInfoNameToMetastoreIdMap] and returns a single [MetastoreInfo]. // - // Gets an array containing the history of the most recent refreshes (up to 25) - // for this table. + // Returns an error if there's more than one [MetastoreInfo] with the same .Name. // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - - // **SELECT** privilege on the table. + // Note: All [MetastoreInfo] instances are loaded into memory before returning matching by name. // - // Additionally, the call must be made from the workspace where the monitor was - // created. - ListRefreshesByTableName(ctx context.Context, tableName string) ([]MonitorRefreshInfo, error) + // This method is generated by Databricks SDK Code Generator. + GetByName(ctx context.Context, name string) (*MetastoreInfo, error) - // Queue a metric refresh for a monitor. - // - // Queues a metric refresh on the monitor for the specified table. The refresh - // will execute in the background. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an - // owner of the table + // Get a metastore summary. // - // Additionally, the call must be made from the workspace where the monitor was - // created. - RunRefresh(ctx context.Context, request RunRefreshRequest) (*MonitorRefreshInfo, error) + // Gets information about a metastore. This summary includes the storage + // credential, the cloud vendor, the cloud region, and the global metastore ID. + Summary(ctx context.Context) (*GetMetastoreSummaryResponse, error) - // Update a table monitor. + // Delete an assignment. // - // Updates a monitor for the specified table. + // Deletes a metastore assignment. The caller must be an account administrator. + Unassign(ctx context.Context, request UnassignRequest) error + + // Delete an assignment. // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an - // owner of the table. + // Deletes a metastore assignment. The caller must be an account administrator. + UnassignByWorkspaceId(ctx context.Context, workspaceId int64) error + + // Update a metastore. // - // Additionally, the call must be made from the workspace where the monitor was - // created, and the caller must be the original creator of the monitor. + // Updates information for a specific metastore. The caller must be a metastore + // admin. If the __owner__ field is set to the empty string (**""**), the + // ownership is updated to the System User. + Update(ctx context.Context, request UpdateMetastore) (*MetastoreInfo, error) + + // Update an assignment. // - // Certain configuration fields, such as output asset identifiers, cannot be - // updated. - Update(ctx context.Context, request UpdateMonitor) (*MonitorInfo, error) + // Updates a metastore assignment. This operation can be used to update + // __metastore_id__ or __default_catalog_name__ for a specified Workspace, if + // the Workspace is already assigned a metastore. The caller must be an account + // admin to update __metastore_id__; otherwise, the caller can be a Workspace + // admin. + UpdateAssignment(ctx context.Context, request UpdateMetastoreAssignment) error } -func NewLakehouseMonitors(client *client.DatabricksClient) *LakehouseMonitorsAPI { - return &LakehouseMonitorsAPI{ - impl: &lakehouseMonitorsImpl{ +func NewMetastores(client *client.DatabricksClient) *MetastoresAPI { + return &MetastoresAPI{ + impl: &metastoresImpl{ client: client, }, } } -// A monitor computes and monitors data or model quality metrics for a table -// over time. It generates metrics tables and a dashboard that you can use to -// monitor table health and set alerts. +// A metastore is the top-level container of objects in Unity Catalog. It stores +// data assets (tables and views) and the permissions that govern access to +// them. Databricks account admins can create metastores and assign them to +// Databricks workspaces to control which workloads use each metastore. For a +// workspace to use Unity Catalog, it must have a Unity Catalog metastore +// attached. // -// Most write operations require the user to be the owner of the table (or its -// parent schema or parent catalog). Viewing the dashboard, computed metrics, or -// monitor configuration only requires the user to have **SELECT** privileges on -// the table (along with **USE_SCHEMA** and **USE_CATALOG**). -type LakehouseMonitorsAPI struct { +// Each metastore is configured with a root storage location in a cloud storage +// account. This storage location is used for metadata and managed tables data. +// +// NOTE: This metastore is distinct from the metastore included in Databricks +// workspaces created before Unity Catalog was released. If your workspace +// includes a legacy Hive metastore, the data in that metastore is available in +// a catalog named hive_metastore. +type MetastoresAPI struct { // impl contains low-level REST API interface, that could be overridden - // through WithImpl(LakehouseMonitorsService) - impl LakehouseMonitorsService + // through WithImpl(MetastoresService) + impl MetastoresService } // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. -// Deprecated: use MockLakehouseMonitorsInterface instead. -func (a *LakehouseMonitorsAPI) WithImpl(impl LakehouseMonitorsService) LakehouseMonitorsInterface { +// Deprecated: use MockMetastoresInterface instead. +func (a *MetastoresAPI) WithImpl(impl MetastoresService) MetastoresInterface { a.impl = impl return a } -// Impl returns low-level LakehouseMonitors API implementation -// Deprecated: use MockLakehouseMonitorsInterface instead. -func (a *LakehouseMonitorsAPI) Impl() LakehouseMonitorsService { +// Impl returns low-level Metastores API implementation +// Deprecated: use MockMetastoresInterface instead. +func (a *MetastoresAPI) Impl() MetastoresService { return a.impl } -// Cancel refresh. -// -// Cancel an active monitor refresh for the given refresh ID. -// -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an -// owner of the table +// Create an assignment. // -// Additionally, the call must be made from the workspace where the monitor was -// created. -func (a *LakehouseMonitorsAPI) CancelRefresh(ctx context.Context, request CancelRefreshRequest) error { - return a.impl.CancelRefresh(ctx, request) +// Creates a new metastore assignment. If an assignment for the same +// __workspace_id__ exists, it will be overwritten by the new __metastore_id__ +// and __default_catalog_name__. The caller must be an account admin. +func (a *MetastoresAPI) Assign(ctx context.Context, request CreateMetastoreAssignment) error { + return a.impl.Assign(ctx, request) } -// Create a table monitor. -// -// Creates a new monitor for the specified table. -// -// The caller must either: 1. be an owner of the table's parent catalog, have -// **USE_SCHEMA** on the table's parent schema, and have **SELECT** access on -// the table 2. have **USE_CATALOG** on the table's parent catalog, be an owner -// of the table's parent schema, and have **SELECT** access on the table. 3. -// have the following permissions: - **USE_CATALOG** on the table's parent -// catalog - **USE_SCHEMA** on the table's parent schema - be an owner of the -// table. +// Create a metastore. // -// Workspace assets, such as the dashboard, will be created in the workspace -// where this call was made. -func (a *LakehouseMonitorsAPI) Create(ctx context.Context, request CreateMonitor) (*MonitorInfo, error) { +// Creates a new metastore based on a provided name and optional storage root +// path. By default (if the __owner__ field is not set), the owner of the new +// metastore is the user calling the __createMetastore__ API. If the __owner__ +// field is set to the empty string (**""**), the ownership is assigned to the +// System User instead. +func (a *MetastoresAPI) Create(ctx context.Context, request CreateMetastore) (*MetastoreInfo, error) { return a.impl.Create(ctx, request) } -// Delete a table monitor. -// -// Deletes a monitor for the specified table. -// -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an -// owner of the table. +// Get metastore assignment for workspace. // -// Additionally, the call must be made from the workspace where the monitor was -// created. +// Gets the metastore assignment for the workspace being accessed. +func (a *MetastoresAPI) Current(ctx context.Context) (*MetastoreAssignment, error) { + return a.impl.Current(ctx) +} + +// Delete a metastore. // -// Note that the metric tables and dashboard will not be deleted as part of this -// call; those assets must be manually cleaned up (if desired). -func (a *LakehouseMonitorsAPI) Delete(ctx context.Context, request DeleteLakehouseMonitorRequest) error { +// Deletes a metastore. The caller must be a metastore admin. +func (a *MetastoresAPI) Delete(ctx context.Context, request DeleteMetastoreRequest) error { return a.impl.Delete(ctx, request) } -// Delete a table monitor. -// -// Deletes a monitor for the specified table. -// -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an -// owner of the table. -// -// Additionally, the call must be made from the workspace where the monitor was -// created. +// Delete a metastore. // -// Note that the metric tables and dashboard will not be deleted as part of this -// call; those assets must be manually cleaned up (if desired). -func (a *LakehouseMonitorsAPI) DeleteByTableName(ctx context.Context, tableName string) error { - return a.impl.Delete(ctx, DeleteLakehouseMonitorRequest{ - TableName: tableName, +// Deletes a metastore. The caller must be a metastore admin. +func (a *MetastoresAPI) DeleteById(ctx context.Context, id string) error { + return a.impl.Delete(ctx, DeleteMetastoreRequest{ + Id: id, }) } -// Get a table monitor. -// -// Gets a monitor for the specified table. -// -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema. 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - -// **SELECT** privilege on the table. +// Get a metastore. // -// The returned information includes configuration values, as well as -// information on assets created by the monitor. Some information (e.g., -// dashboard) may be filtered out if the caller is in a different workspace than -// where the monitor was created. -func (a *LakehouseMonitorsAPI) Get(ctx context.Context, request GetLakehouseMonitorRequest) (*MonitorInfo, error) { +// Gets a metastore that matches the supplied ID. The caller must be a metastore +// admin to retrieve this info. +func (a *MetastoresAPI) Get(ctx context.Context, request GetMetastoreRequest) (*MetastoreInfo, error) { return a.impl.Get(ctx, request) } -// Get a table monitor. -// -// Gets a monitor for the specified table. -// -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema. 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - -// **SELECT** privilege on the table. +// Get a metastore. // -// The returned information includes configuration values, as well as -// information on assets created by the monitor. Some information (e.g., -// dashboard) may be filtered out if the caller is in a different workspace than -// where the monitor was created. -func (a *LakehouseMonitorsAPI) GetByTableName(ctx context.Context, tableName string) (*MonitorInfo, error) { - return a.impl.Get(ctx, GetLakehouseMonitorRequest{ - TableName: tableName, +// Gets a metastore that matches the supplied ID. The caller must be a metastore +// admin to retrieve this info. +func (a *MetastoresAPI) GetById(ctx context.Context, id string) (*MetastoreInfo, error) { + return a.impl.Get(ctx, GetMetastoreRequest{ + Id: id, }) } -// Get refresh. -// -// Gets info about a specific monitor refresh using the given refresh ID. +// List metastores. // -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - -// **SELECT** privilege on the table. +// Gets an array of the available metastores (as __MetastoreInfo__ objects). The +// caller must be an admin to retrieve this info. There is no guarantee of a +// specific ordering of the elements in the array. // -// Additionally, the call must be made from the workspace where the monitor was -// created. -func (a *LakehouseMonitorsAPI) GetRefresh(ctx context.Context, request GetRefreshRequest) (*MonitorRefreshInfo, error) { - return a.impl.GetRefresh(ctx, request) -} +// This method is generated by Databricks SDK Code Generator. +func (a *MetastoresAPI) List(ctx context.Context) listing.Iterator[MetastoreInfo] { + request := struct{}{} -// Get refresh. -// -// Gets info about a specific monitor refresh using the given refresh ID. -// -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - -// **SELECT** privilege on the table. -// -// Additionally, the call must be made from the workspace where the monitor was -// created. -func (a *LakehouseMonitorsAPI) GetRefreshByTableNameAndRefreshId(ctx context.Context, tableName string, refreshId string) (*MonitorRefreshInfo, error) { - return a.impl.GetRefresh(ctx, GetRefreshRequest{ - TableName: tableName, - RefreshId: refreshId, - }) + getNextPage := func(ctx context.Context, req struct{}) (*ListMetastoresResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.impl.List(ctx) + } + getItems := func(resp *ListMetastoresResponse) []MetastoreInfo { + return resp.Metastores + } + + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + nil) + return iterator } -// List refreshes. -// -// Gets an array containing the history of the most recent refreshes (up to 25) -// for this table. +// List metastores. // -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - -// **SELECT** privilege on the table. +// Gets an array of the available metastores (as __MetastoreInfo__ objects). The +// caller must be an admin to retrieve this info. There is no guarantee of a +// specific ordering of the elements in the array. // -// Additionally, the call must be made from the workspace where the monitor was -// created. -func (a *LakehouseMonitorsAPI) ListRefreshes(ctx context.Context, request ListRefreshesRequest) ([]MonitorRefreshInfo, error) { - return a.impl.ListRefreshes(ctx, request) +// This method is generated by Databricks SDK Code Generator. +func (a *MetastoresAPI) ListAll(ctx context.Context) ([]MetastoreInfo, error) { + iterator := a.List(ctx) + return listing.ToSlice[MetastoreInfo](ctx, iterator) } -// List refreshes. +// MetastoreInfoNameToMetastoreIdMap calls [MetastoresAPI.ListAll] and creates a map of results with [MetastoreInfo].Name as key and [MetastoreInfo].MetastoreId as value. // -// Gets an array containing the history of the most recent refreshes (up to 25) -// for this table. +// Returns an error if there's more than one [MetastoreInfo] with the same .Name. // -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - -// **SELECT** privilege on the table. +// Note: All [MetastoreInfo] instances are loaded into memory before creating a map. // -// Additionally, the call must be made from the workspace where the monitor was -// created. -func (a *LakehouseMonitorsAPI) ListRefreshesByTableName(ctx context.Context, tableName string) ([]MonitorRefreshInfo, error) { - return a.impl.ListRefreshes(ctx, ListRefreshesRequest{ - TableName: tableName, - }) +// This method is generated by Databricks SDK Code Generator. +func (a *MetastoresAPI) MetastoreInfoNameToMetastoreIdMap(ctx context.Context) (map[string]string, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") + mapping := map[string]string{} + result, err := a.ListAll(ctx) + if err != nil { + return nil, err + } + for _, v := range result { + key := v.Name + _, duplicate := mapping[key] + if duplicate { + return nil, fmt.Errorf("duplicate .Name: %s", key) + } + mapping[key] = v.MetastoreId + } + return mapping, nil } -// Queue a metric refresh for a monitor. +// GetByName calls [MetastoresAPI.MetastoreInfoNameToMetastoreIdMap] and returns a single [MetastoreInfo]. // -// Queues a metric refresh on the monitor for the specified table. The refresh -// will execute in the background. +// Returns an error if there's more than one [MetastoreInfo] with the same .Name. // -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an -// owner of the table +// Note: All [MetastoreInfo] instances are loaded into memory before returning matching by name. // -// Additionally, the call must be made from the workspace where the monitor was -// created. -func (a *LakehouseMonitorsAPI) RunRefresh(ctx context.Context, request RunRefreshRequest) (*MonitorRefreshInfo, error) { - return a.impl.RunRefresh(ctx, request) +// This method is generated by Databricks SDK Code Generator. +func (a *MetastoresAPI) GetByName(ctx context.Context, name string) (*MetastoreInfo, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") + result, err := a.ListAll(ctx) + if err != nil { + return nil, err + } + tmp := map[string][]MetastoreInfo{} + for _, v := range result { + key := v.Name + tmp[key] = append(tmp[key], v) + } + alternatives, ok := tmp[name] + if !ok || len(alternatives) == 0 { + return nil, fmt.Errorf("MetastoreInfo named '%s' does not exist", name) + } + if len(alternatives) > 1 { + return nil, fmt.Errorf("there are %d instances of MetastoreInfo named '%s'", len(alternatives), name) + } + return &alternatives[0], nil } -// Update a table monitor. +// Get a metastore summary. // -// Updates a monitor for the specified table. +// Gets information about a metastore. This summary includes the storage +// credential, the cloud vendor, the cloud region, and the global metastore ID. +func (a *MetastoresAPI) Summary(ctx context.Context) (*GetMetastoreSummaryResponse, error) { + return a.impl.Summary(ctx) +} + +// Delete an assignment. // -// The caller must either: 1. be an owner of the table's parent catalog 2. have -// **USE_CATALOG** on the table's parent catalog and be an owner of the table's -// parent schema 3. have the following permissions: - **USE_CATALOG** on the -// table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an -// owner of the table. +// Deletes a metastore assignment. The caller must be an account administrator. +func (a *MetastoresAPI) Unassign(ctx context.Context, request UnassignRequest) error { + return a.impl.Unassign(ctx, request) +} + +// Delete an assignment. // -// Additionally, the call must be made from the workspace where the monitor was -// created, and the caller must be the original creator of the monitor. +// Deletes a metastore assignment. The caller must be an account administrator. +func (a *MetastoresAPI) UnassignByWorkspaceId(ctx context.Context, workspaceId int64) error { + return a.impl.Unassign(ctx, UnassignRequest{ + WorkspaceId: workspaceId, + }) +} + +// Update a metastore. // -// Certain configuration fields, such as output asset identifiers, cannot be -// updated. -func (a *LakehouseMonitorsAPI) Update(ctx context.Context, request UpdateMonitor) (*MonitorInfo, error) { +// Updates information for a specific metastore. The caller must be a metastore +// admin. If the __owner__ field is set to the empty string (**""**), the +// ownership is updated to the System User. +func (a *MetastoresAPI) Update(ctx context.Context, request UpdateMetastore) (*MetastoreInfo, error) { return a.impl.Update(ctx, request) } -type MetastoresInterface interface { +// Update an assignment. +// +// Updates a metastore assignment. This operation can be used to update +// __metastore_id__ or __default_catalog_name__ for a specified Workspace, if +// the Workspace is already assigned a metastore. The caller must be an account +// admin to update __metastore_id__; otherwise, the caller can be a Workspace +// admin. +func (a *MetastoresAPI) UpdateAssignment(ctx context.Context, request UpdateMetastoreAssignment) error { + return a.impl.UpdateAssignment(ctx, request) +} + +type ModelVersionsInterface interface { // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. - // Deprecated: use MockMetastoresInterface instead. - WithImpl(impl MetastoresService) MetastoresInterface + // Deprecated: use MockModelVersionsInterface instead. + WithImpl(impl ModelVersionsService) ModelVersionsInterface - // Impl returns low-level Metastores API implementation - // Deprecated: use MockMetastoresInterface instead. - Impl() MetastoresService + // Impl returns low-level ModelVersions API implementation + // Deprecated: use MockModelVersionsInterface instead. + Impl() ModelVersionsService - // Create an assignment. + // Delete a Model Version. // - // Creates a new metastore assignment. If an assignment for the same - // __workspace_id__ exists, it will be overwritten by the new __metastore_id__ - // and __default_catalog_name__. The caller must be an account admin. - Assign(ctx context.Context, request CreateMetastoreAssignment) error - - // Create a metastore. + // Deletes a model version from the specified registered model. Any aliases + // assigned to the model version will also be deleted. // - // Creates a new metastore based on a provided name and optional storage root - // path. By default (if the __owner__ field is not set), the owner of the new - // metastore is the user calling the __createMetastore__ API. If the __owner__ - // field is set to the empty string (**""**), the ownership is assigned to the - // System User instead. - Create(ctx context.Context, request CreateMetastore) (*MetastoreInfo, error) + // The caller must be a metastore admin or an owner of the parent registered + // model. For the latter case, the caller must also be the owner or have the + // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** + // privilege on the parent schema. + Delete(ctx context.Context, request DeleteModelVersionRequest) error - // Get metastore assignment for workspace. + // Delete a Model Version. // - // Gets the metastore assignment for the workspace being accessed. - Current(ctx context.Context) (*MetastoreAssignment, error) - - // Delete a metastore. + // Deletes a model version from the specified registered model. Any aliases + // assigned to the model version will also be deleted. // - // Deletes a metastore. The caller must be a metastore admin. - Delete(ctx context.Context, request DeleteMetastoreRequest) error + // The caller must be a metastore admin or an owner of the parent registered + // model. For the latter case, the caller must also be the owner or have the + // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** + // privilege on the parent schema. + DeleteByFullNameAndVersion(ctx context.Context, fullName string, version int) error - // Delete a metastore. + // Get a Model Version. // - // Deletes a metastore. The caller must be a metastore admin. - DeleteById(ctx context.Context, id string) error - - // Get a metastore. + // Get a model version. // - // Gets a metastore that matches the supplied ID. The caller must be a metastore - // admin to retrieve this info. - Get(ctx context.Context, request GetMetastoreRequest) (*MetastoreInfo, error) + // The caller must be a metastore admin or an owner of (or have the **EXECUTE** + // privilege on) the parent registered model. For the latter case, the caller + // must also be the owner or have the **USE_CATALOG** privilege on the parent + // catalog and the **USE_SCHEMA** privilege on the parent schema. + Get(ctx context.Context, request GetModelVersionRequest) (*RegisteredModelInfo, error) - // Get a metastore. + // Get a Model Version. // - // Gets a metastore that matches the supplied ID. The caller must be a metastore - // admin to retrieve this info. - GetById(ctx context.Context, id string) (*MetastoreInfo, error) + // Get a model version. + // + // The caller must be a metastore admin or an owner of (or have the **EXECUTE** + // privilege on) the parent registered model. For the latter case, the caller + // must also be the owner or have the **USE_CATALOG** privilege on the parent + // catalog and the **USE_SCHEMA** privilege on the parent schema. + GetByFullNameAndVersion(ctx context.Context, fullName string, version int) (*RegisteredModelInfo, error) - // List metastores. + // Get Model Version By Alias. // - // Gets an array of the available metastores (as __MetastoreInfo__ objects). The - // caller must be an admin to retrieve this info. There is no guarantee of a - // specific ordering of the elements in the array. + // Get a model version by alias. // - // This method is generated by Databricks SDK Code Generator. - List(ctx context.Context) listing.Iterator[MetastoreInfo] + // The caller must be a metastore admin or an owner of (or have the **EXECUTE** + // privilege on) the registered model. For the latter case, the caller must also + // be the owner or have the **USE_CATALOG** privilege on the parent catalog and + // the **USE_SCHEMA** privilege on the parent schema. + GetByAlias(ctx context.Context, request GetByAliasRequest) (*ModelVersionInfo, error) - // List metastores. + // Get Model Version By Alias. // - // Gets an array of the available metastores (as __MetastoreInfo__ objects). The - // caller must be an admin to retrieve this info. There is no guarantee of a - // specific ordering of the elements in the array. + // Get a model version by alias. // - // This method is generated by Databricks SDK Code Generator. - ListAll(ctx context.Context) ([]MetastoreInfo, error) + // The caller must be a metastore admin or an owner of (or have the **EXECUTE** + // privilege on) the registered model. For the latter case, the caller must also + // be the owner or have the **USE_CATALOG** privilege on the parent catalog and + // the **USE_SCHEMA** privilege on the parent schema. + GetByAliasByFullNameAndAlias(ctx context.Context, fullName string, alias string) (*ModelVersionInfo, error) - // MetastoreInfoNameToMetastoreIdMap calls [MetastoresAPI.ListAll] and creates a map of results with [MetastoreInfo].Name as key and [MetastoreInfo].MetastoreId as value. + // List Model Versions. // - // Returns an error if there's more than one [MetastoreInfo] with the same .Name. + // List model versions. You can list model versions under a particular schema, + // or list all model versions in the current metastore. // - // Note: All [MetastoreInfo] instances are loaded into memory before creating a map. + // The returned models are filtered based on the privileges of the calling user. + // For example, the metastore admin is able to list all the model versions. A + // regular user needs to be the owner or have the **EXECUTE** privilege on the + // parent registered model to recieve the model versions in the response. For + // the latter case, the caller must also be the owner or have the + // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** + // privilege on the parent schema. + // + // There is no guarantee of a specific ordering of the elements in the response. + // The elements in the response will not contain any aliases or tags. // // This method is generated by Databricks SDK Code Generator. - MetastoreInfoNameToMetastoreIdMap(ctx context.Context) (map[string]string, error) + List(ctx context.Context, request ListModelVersionsRequest) listing.Iterator[ModelVersionInfo] - // GetByName calls [MetastoresAPI.MetastoreInfoNameToMetastoreIdMap] and returns a single [MetastoreInfo]. + // List Model Versions. // - // Returns an error if there's more than one [MetastoreInfo] with the same .Name. + // List model versions. You can list model versions under a particular schema, + // or list all model versions in the current metastore. // - // Note: All [MetastoreInfo] instances are loaded into memory before returning matching by name. + // The returned models are filtered based on the privileges of the calling user. + // For example, the metastore admin is able to list all the model versions. A + // regular user needs to be the owner or have the **EXECUTE** privilege on the + // parent registered model to recieve the model versions in the response. For + // the latter case, the caller must also be the owner or have the + // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** + // privilege on the parent schema. + // + // There is no guarantee of a specific ordering of the elements in the response. + // The elements in the response will not contain any aliases or tags. // // This method is generated by Databricks SDK Code Generator. - GetByName(ctx context.Context, name string) (*MetastoreInfo, error) + ListAll(ctx context.Context, request ListModelVersionsRequest) ([]ModelVersionInfo, error) - // Get a metastore summary. + // List Model Versions. // - // Gets information about a metastore. This summary includes the storage - // credential, the cloud vendor, the cloud region, and the global metastore ID. - Summary(ctx context.Context) (*GetMetastoreSummaryResponse, error) - - // Delete an assignment. + // List model versions. You can list model versions under a particular schema, + // or list all model versions in the current metastore. // - // Deletes a metastore assignment. The caller must be an account administrator. - Unassign(ctx context.Context, request UnassignRequest) error - - // Delete an assignment. + // The returned models are filtered based on the privileges of the calling user. + // For example, the metastore admin is able to list all the model versions. A + // regular user needs to be the owner or have the **EXECUTE** privilege on the + // parent registered model to recieve the model versions in the response. For + // the latter case, the caller must also be the owner or have the + // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** + // privilege on the parent schema. // - // Deletes a metastore assignment. The caller must be an account administrator. - UnassignByWorkspaceId(ctx context.Context, workspaceId int64) error + // There is no guarantee of a specific ordering of the elements in the response. + // The elements in the response will not contain any aliases or tags. + ListByFullName(ctx context.Context, fullName string) (*ListModelVersionsResponse, error) - // Update a metastore. + // Update a Model Version. // - // Updates information for a specific metastore. The caller must be a metastore - // admin. If the __owner__ field is set to the empty string (**""**), the - // ownership is updated to the System User. - Update(ctx context.Context, request UpdateMetastore) (*MetastoreInfo, error) - - // Update an assignment. + // Updates the specified model version. // - // Updates a metastore assignment. This operation can be used to update - // __metastore_id__ or __default_catalog_name__ for a specified Workspace, if - // the Workspace is already assigned a metastore. The caller must be an account - // admin to update __metastore_id__; otherwise, the caller can be a Workspace - // admin. - UpdateAssignment(ctx context.Context, request UpdateMetastoreAssignment) error + // The caller must be a metastore admin or an owner of the parent registered + // model. For the latter case, the caller must also be the owner or have the + // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** + // privilege on the parent schema. + // + // Currently only the comment of the model version can be updated. + Update(ctx context.Context, request UpdateModelVersionRequest) (*ModelVersionInfo, error) } -func NewMetastores(client *client.DatabricksClient) *MetastoresAPI { - return &MetastoresAPI{ - impl: &metastoresImpl{ +func NewModelVersions(client *client.DatabricksClient) *ModelVersionsAPI { + return &ModelVersionsAPI{ + impl: &modelVersionsImpl{ client: client, }, } } -// A metastore is the top-level container of objects in Unity Catalog. It stores -// data assets (tables and views) and the permissions that govern access to -// them. Databricks account admins can create metastores and assign them to -// Databricks workspaces to control which workloads use each metastore. For a -// workspace to use Unity Catalog, it must have a Unity Catalog metastore -// attached. -// -// Each metastore is configured with a root storage location in a cloud storage -// account. This storage location is used for metadata and managed tables data. +// Databricks provides a hosted version of MLflow Model Registry in Unity +// Catalog. Models in Unity Catalog provide centralized access control, +// auditing, lineage, and discovery of ML models across Databricks workspaces. // -// NOTE: This metastore is distinct from the metastore included in Databricks -// workspaces created before Unity Catalog was released. If your workspace -// includes a legacy Hive metastore, the data in that metastore is available in -// a catalog named hive_metastore. -type MetastoresAPI struct { +// This API reference documents the REST endpoints for managing model versions +// in Unity Catalog. For more details, see the [registered models API +// docs](/api/workspace/registeredmodels). +type ModelVersionsAPI struct { // impl contains low-level REST API interface, that could be overridden - // through WithImpl(MetastoresService) - impl MetastoresService + // through WithImpl(ModelVersionsService) + impl ModelVersionsService } // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. -// Deprecated: use MockMetastoresInterface instead. -func (a *MetastoresAPI) WithImpl(impl MetastoresService) MetastoresInterface { +// Deprecated: use MockModelVersionsInterface instead. +func (a *ModelVersionsAPI) WithImpl(impl ModelVersionsService) ModelVersionsInterface { a.impl = impl return a } -// Impl returns low-level Metastores API implementation -// Deprecated: use MockMetastoresInterface instead. -func (a *MetastoresAPI) Impl() MetastoresService { +// Impl returns low-level ModelVersions API implementation +// Deprecated: use MockModelVersionsInterface instead. +func (a *ModelVersionsAPI) Impl() ModelVersionsService { return a.impl } -// Create an assignment. +// Delete a Model Version. // -// Creates a new metastore assignment. If an assignment for the same -// __workspace_id__ exists, it will be overwritten by the new __metastore_id__ -// and __default_catalog_name__. The caller must be an account admin. -func (a *MetastoresAPI) Assign(ctx context.Context, request CreateMetastoreAssignment) error { - return a.impl.Assign(ctx, request) -} - -// Create a metastore. +// Deletes a model version from the specified registered model. Any aliases +// assigned to the model version will also be deleted. // -// Creates a new metastore based on a provided name and optional storage root -// path. By default (if the __owner__ field is not set), the owner of the new -// metastore is the user calling the __createMetastore__ API. If the __owner__ -// field is set to the empty string (**""**), the ownership is assigned to the -// System User instead. -func (a *MetastoresAPI) Create(ctx context.Context, request CreateMetastore) (*MetastoreInfo, error) { - return a.impl.Create(ctx, request) +// The caller must be a metastore admin or an owner of the parent registered +// model. For the latter case, the caller must also be the owner or have the +// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** +// privilege on the parent schema. +func (a *ModelVersionsAPI) Delete(ctx context.Context, request DeleteModelVersionRequest) error { + return a.impl.Delete(ctx, request) } -// Get metastore assignment for workspace. +// Delete a Model Version. // -// Gets the metastore assignment for the workspace being accessed. -func (a *MetastoresAPI) Current(ctx context.Context) (*MetastoreAssignment, error) { - return a.impl.Current(ctx) +// Deletes a model version from the specified registered model. Any aliases +// assigned to the model version will also be deleted. +// +// The caller must be a metastore admin or an owner of the parent registered +// model. For the latter case, the caller must also be the owner or have the +// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** +// privilege on the parent schema. +func (a *ModelVersionsAPI) DeleteByFullNameAndVersion(ctx context.Context, fullName string, version int) error { + return a.impl.Delete(ctx, DeleteModelVersionRequest{ + FullName: fullName, + Version: version, + }) } -// Delete a metastore. +// Get a Model Version. // -// Deletes a metastore. The caller must be a metastore admin. -func (a *MetastoresAPI) Delete(ctx context.Context, request DeleteMetastoreRequest) error { - return a.impl.Delete(ctx, request) +// Get a model version. +// +// The caller must be a metastore admin or an owner of (or have the **EXECUTE** +// privilege on) the parent registered model. For the latter case, the caller +// must also be the owner or have the **USE_CATALOG** privilege on the parent +// catalog and the **USE_SCHEMA** privilege on the parent schema. +func (a *ModelVersionsAPI) Get(ctx context.Context, request GetModelVersionRequest) (*RegisteredModelInfo, error) { + return a.impl.Get(ctx, request) } -// Delete a metastore. +// Get a Model Version. // -// Deletes a metastore. The caller must be a metastore admin. -func (a *MetastoresAPI) DeleteById(ctx context.Context, id string) error { - return a.impl.Delete(ctx, DeleteMetastoreRequest{ - Id: id, +// Get a model version. +// +// The caller must be a metastore admin or an owner of (or have the **EXECUTE** +// privilege on) the parent registered model. For the latter case, the caller +// must also be the owner or have the **USE_CATALOG** privilege on the parent +// catalog and the **USE_SCHEMA** privilege on the parent schema. +func (a *ModelVersionsAPI) GetByFullNameAndVersion(ctx context.Context, fullName string, version int) (*RegisteredModelInfo, error) { + return a.impl.Get(ctx, GetModelVersionRequest{ + FullName: fullName, + Version: version, }) } -// Get a metastore. +// Get Model Version By Alias. // -// Gets a metastore that matches the supplied ID. The caller must be a metastore -// admin to retrieve this info. -func (a *MetastoresAPI) Get(ctx context.Context, request GetMetastoreRequest) (*MetastoreInfo, error) { - return a.impl.Get(ctx, request) +// Get a model version by alias. +// +// The caller must be a metastore admin or an owner of (or have the **EXECUTE** +// privilege on) the registered model. For the latter case, the caller must also +// be the owner or have the **USE_CATALOG** privilege on the parent catalog and +// the **USE_SCHEMA** privilege on the parent schema. +func (a *ModelVersionsAPI) GetByAlias(ctx context.Context, request GetByAliasRequest) (*ModelVersionInfo, error) { + return a.impl.GetByAlias(ctx, request) } -// Get a metastore. +// Get Model Version By Alias. // -// Gets a metastore that matches the supplied ID. The caller must be a metastore -// admin to retrieve this info. -func (a *MetastoresAPI) GetById(ctx context.Context, id string) (*MetastoreInfo, error) { - return a.impl.Get(ctx, GetMetastoreRequest{ - Id: id, +// Get a model version by alias. +// +// The caller must be a metastore admin or an owner of (or have the **EXECUTE** +// privilege on) the registered model. For the latter case, the caller must also +// be the owner or have the **USE_CATALOG** privilege on the parent catalog and +// the **USE_SCHEMA** privilege on the parent schema. +func (a *ModelVersionsAPI) GetByAliasByFullNameAndAlias(ctx context.Context, fullName string, alias string) (*ModelVersionInfo, error) { + return a.impl.GetByAlias(ctx, GetByAliasRequest{ + FullName: fullName, + Alias: alias, }) } -// List metastores. +// List Model Versions. // -// Gets an array of the available metastores (as __MetastoreInfo__ objects). The -// caller must be an admin to retrieve this info. There is no guarantee of a -// specific ordering of the elements in the array. +// List model versions. You can list model versions under a particular schema, +// or list all model versions in the current metastore. +// +// The returned models are filtered based on the privileges of the calling user. +// For example, the metastore admin is able to list all the model versions. A +// regular user needs to be the owner or have the **EXECUTE** privilege on the +// parent registered model to recieve the model versions in the response. For +// the latter case, the caller must also be the owner or have the +// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** +// privilege on the parent schema. +// +// There is no guarantee of a specific ordering of the elements in the response. +// The elements in the response will not contain any aliases or tags. // // This method is generated by Databricks SDK Code Generator. -func (a *MetastoresAPI) List(ctx context.Context) listing.Iterator[MetastoreInfo] { - request := struct{}{} +func (a *ModelVersionsAPI) List(ctx context.Context, request ListModelVersionsRequest) listing.Iterator[ModelVersionInfo] { - getNextPage := func(ctx context.Context, req struct{}) (*ListMetastoresResponse, error) { + getNextPage := func(ctx context.Context, req ListModelVersionsRequest) (*ListModelVersionsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") - return a.impl.List(ctx) + return a.impl.List(ctx, req) } - getItems := func(resp *ListMetastoresResponse) []MetastoreInfo { - return resp.Metastores + getItems := func(resp *ListModelVersionsResponse) []ModelVersionInfo { + return resp.ModelVersions + } + getNextReq := func(resp *ListModelVersionsResponse) *ListModelVersionsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request } - iterator := listing.NewIterator( &request, getNextPage, getItems, - nil) + getNextReq) return iterator } -// List metastores. +// List Model Versions. // -// Gets an array of the available metastores (as __MetastoreInfo__ objects). The -// caller must be an admin to retrieve this info. There is no guarantee of a -// specific ordering of the elements in the array. +// List model versions. You can list model versions under a particular schema, +// or list all model versions in the current metastore. +// +// The returned models are filtered based on the privileges of the calling user. +// For example, the metastore admin is able to list all the model versions. A +// regular user needs to be the owner or have the **EXECUTE** privilege on the +// parent registered model to recieve the model versions in the response. For +// the latter case, the caller must also be the owner or have the +// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** +// privilege on the parent schema. +// +// There is no guarantee of a specific ordering of the elements in the response. +// The elements in the response will not contain any aliases or tags. // // This method is generated by Databricks SDK Code Generator. -func (a *MetastoresAPI) ListAll(ctx context.Context) ([]MetastoreInfo, error) { - iterator := a.List(ctx) - return listing.ToSlice[MetastoreInfo](ctx, iterator) +func (a *ModelVersionsAPI) ListAll(ctx context.Context, request ListModelVersionsRequest) ([]ModelVersionInfo, error) { + iterator := a.List(ctx, request) + return listing.ToSliceN[ModelVersionInfo, int](ctx, iterator, request.MaxResults) + } -// MetastoreInfoNameToMetastoreIdMap calls [MetastoresAPI.ListAll] and creates a map of results with [MetastoreInfo].Name as key and [MetastoreInfo].MetastoreId as value. +// List Model Versions. // -// Returns an error if there's more than one [MetastoreInfo] with the same .Name. +// List model versions. You can list model versions under a particular schema, +// or list all model versions in the current metastore. // -// Note: All [MetastoreInfo] instances are loaded into memory before creating a map. +// The returned models are filtered based on the privileges of the calling user. +// For example, the metastore admin is able to list all the model versions. A +// regular user needs to be the owner or have the **EXECUTE** privilege on the +// parent registered model to recieve the model versions in the response. For +// the latter case, the caller must also be the owner or have the +// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** +// privilege on the parent schema. // -// This method is generated by Databricks SDK Code Generator. -func (a *MetastoresAPI) MetastoreInfoNameToMetastoreIdMap(ctx context.Context) (map[string]string, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "name-to-id") - mapping := map[string]string{} - result, err := a.ListAll(ctx) - if err != nil { - return nil, err - } - for _, v := range result { - key := v.Name - _, duplicate := mapping[key] - if duplicate { - return nil, fmt.Errorf("duplicate .Name: %s", key) - } - mapping[key] = v.MetastoreId - } - return mapping, nil +// There is no guarantee of a specific ordering of the elements in the response. +// The elements in the response will not contain any aliases or tags. +func (a *ModelVersionsAPI) ListByFullName(ctx context.Context, fullName string) (*ListModelVersionsResponse, error) { + return a.impl.List(ctx, ListModelVersionsRequest{ + FullName: fullName, + }) } -// GetByName calls [MetastoresAPI.MetastoreInfoNameToMetastoreIdMap] and returns a single [MetastoreInfo]. +// Update a Model Version. // -// Returns an error if there's more than one [MetastoreInfo] with the same .Name. +// Updates the specified model version. // -// Note: All [MetastoreInfo] instances are loaded into memory before returning matching by name. +// The caller must be a metastore admin or an owner of the parent registered +// model. For the latter case, the caller must also be the owner or have the +// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** +// privilege on the parent schema. // -// This method is generated by Databricks SDK Code Generator. -func (a *MetastoresAPI) GetByName(ctx context.Context, name string) (*MetastoreInfo, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "get-by-name") - result, err := a.ListAll(ctx) - if err != nil { - return nil, err - } - tmp := map[string][]MetastoreInfo{} - for _, v := range result { - key := v.Name - tmp[key] = append(tmp[key], v) - } - alternatives, ok := tmp[name] - if !ok || len(alternatives) == 0 { - return nil, fmt.Errorf("MetastoreInfo named '%s' does not exist", name) - } - if len(alternatives) > 1 { - return nil, fmt.Errorf("there are %d instances of MetastoreInfo named '%s'", len(alternatives), name) +// Currently only the comment of the model version can be updated. +func (a *ModelVersionsAPI) Update(ctx context.Context, request UpdateModelVersionRequest) (*ModelVersionInfo, error) { + return a.impl.Update(ctx, request) +} + +type OnlineTablesInterface interface { + // WithImpl could be used to override low-level API implementations for unit + // testing purposes with [github.com/golang/mock] or other mocking frameworks. + // Deprecated: use MockOnlineTablesInterface instead. + WithImpl(impl OnlineTablesService) OnlineTablesInterface + + // Impl returns low-level OnlineTables API implementation + // Deprecated: use MockOnlineTablesInterface instead. + Impl() OnlineTablesService + + // Create an Online Table. + // + // Create a new Online Table. + Create(ctx context.Context, request CreateOnlineTableRequest) (*OnlineTable, error) + + // Delete an Online Table. + // + // Delete an online table. Warning: This will delete all the data in the online + // table. If the source Delta table was deleted or modified since this Online + // Table was created, this will lose the data forever! + Delete(ctx context.Context, request DeleteOnlineTableRequest) error + + // Delete an Online Table. + // + // Delete an online table. Warning: This will delete all the data in the online + // table. If the source Delta table was deleted or modified since this Online + // Table was created, this will lose the data forever! + DeleteByName(ctx context.Context, name string) error + + // Get an Online Table. + // + // Get information about an existing online table and its status. + Get(ctx context.Context, request GetOnlineTableRequest) (*OnlineTable, error) + + // Get an Online Table. + // + // Get information about an existing online table and its status. + GetByName(ctx context.Context, name string) (*OnlineTable, error) +} + +func NewOnlineTables(client *client.DatabricksClient) *OnlineTablesAPI { + return &OnlineTablesAPI{ + impl: &onlineTablesImpl{ + client: client, + }, } - return &alternatives[0], nil } -// Get a metastore summary. +// Online tables provide lower latency and higher QPS access to data from Delta +// tables. +type OnlineTablesAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(OnlineTablesService) + impl OnlineTablesService +} + +// WithImpl could be used to override low-level API implementations for unit +// testing purposes with [github.com/golang/mock] or other mocking frameworks. +// Deprecated: use MockOnlineTablesInterface instead. +func (a *OnlineTablesAPI) WithImpl(impl OnlineTablesService) OnlineTablesInterface { + a.impl = impl + return a +} + +// Impl returns low-level OnlineTables API implementation +// Deprecated: use MockOnlineTablesInterface instead. +func (a *OnlineTablesAPI) Impl() OnlineTablesService { + return a.impl +} + +// Create an Online Table. // -// Gets information about a metastore. This summary includes the storage -// credential, the cloud vendor, the cloud region, and the global metastore ID. -func (a *MetastoresAPI) Summary(ctx context.Context) (*GetMetastoreSummaryResponse, error) { - return a.impl.Summary(ctx) +// Create a new Online Table. +func (a *OnlineTablesAPI) Create(ctx context.Context, request CreateOnlineTableRequest) (*OnlineTable, error) { + return a.impl.Create(ctx, request) } -// Delete an assignment. +// Delete an Online Table. // -// Deletes a metastore assignment. The caller must be an account administrator. -func (a *MetastoresAPI) Unassign(ctx context.Context, request UnassignRequest) error { - return a.impl.Unassign(ctx, request) +// Delete an online table. Warning: This will delete all the data in the online +// table. If the source Delta table was deleted or modified since this Online +// Table was created, this will lose the data forever! +func (a *OnlineTablesAPI) Delete(ctx context.Context, request DeleteOnlineTableRequest) error { + return a.impl.Delete(ctx, request) } -// Delete an assignment. +// Delete an Online Table. // -// Deletes a metastore assignment. The caller must be an account administrator. -func (a *MetastoresAPI) UnassignByWorkspaceId(ctx context.Context, workspaceId int64) error { - return a.impl.Unassign(ctx, UnassignRequest{ - WorkspaceId: workspaceId, +// Delete an online table. Warning: This will delete all the data in the online +// table. If the source Delta table was deleted or modified since this Online +// Table was created, this will lose the data forever! +func (a *OnlineTablesAPI) DeleteByName(ctx context.Context, name string) error { + return a.impl.Delete(ctx, DeleteOnlineTableRequest{ + Name: name, }) } -// Update a metastore. +// Get an Online Table. // -// Updates information for a specific metastore. The caller must be a metastore -// admin. If the __owner__ field is set to the empty string (**""**), the -// ownership is updated to the System User. -func (a *MetastoresAPI) Update(ctx context.Context, request UpdateMetastore) (*MetastoreInfo, error) { - return a.impl.Update(ctx, request) +// Get information about an existing online table and its status. +func (a *OnlineTablesAPI) Get(ctx context.Context, request GetOnlineTableRequest) (*OnlineTable, error) { + return a.impl.Get(ctx, request) } -// Update an assignment. +// Get an Online Table. // -// Updates a metastore assignment. This operation can be used to update -// __metastore_id__ or __default_catalog_name__ for a specified Workspace, if -// the Workspace is already assigned a metastore. The caller must be an account -// admin to update __metastore_id__; otherwise, the caller can be a Workspace -// admin. -func (a *MetastoresAPI) UpdateAssignment(ctx context.Context, request UpdateMetastoreAssignment) error { - return a.impl.UpdateAssignment(ctx, request) +// Get information about an existing online table and its status. +func (a *OnlineTablesAPI) GetByName(ctx context.Context, name string) (*OnlineTable, error) { + return a.impl.Get(ctx, GetOnlineTableRequest{ + Name: name, + }) } -type ModelVersionsInterface interface { +type QualityMonitorsInterface interface { // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. - // Deprecated: use MockModelVersionsInterface instead. - WithImpl(impl ModelVersionsService) ModelVersionsInterface + // Deprecated: use MockQualityMonitorsInterface instead. + WithImpl(impl QualityMonitorsService) QualityMonitorsInterface - // Impl returns low-level ModelVersions API implementation - // Deprecated: use MockModelVersionsInterface instead. - Impl() ModelVersionsService + // Impl returns low-level QualityMonitors API implementation + // Deprecated: use MockQualityMonitorsInterface instead. + Impl() QualityMonitorsService - // Delete a Model Version. - // - // Deletes a model version from the specified registered model. Any aliases - // assigned to the model version will also be deleted. + // Cancel refresh. // - // The caller must be a metastore admin or an owner of the parent registered - // model. For the latter case, the caller must also be the owner or have the - // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** - // privilege on the parent schema. - Delete(ctx context.Context, request DeleteModelVersionRequest) error - - // Delete a Model Version. + // Cancel an active monitor refresh for the given refresh ID. // - // Deletes a model version from the specified registered model. Any aliases - // assigned to the model version will also be deleted. + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an + // owner of the table // - // The caller must be a metastore admin or an owner of the parent registered - // model. For the latter case, the caller must also be the owner or have the - // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** - // privilege on the parent schema. - DeleteByFullNameAndVersion(ctx context.Context, fullName string, version int) error + // Additionally, the call must be made from the workspace where the monitor was + // created. + CancelRefresh(ctx context.Context, request CancelRefreshRequest) error - // Get a Model Version. - // - // Get a model version. + // Create a table monitor. // - // The caller must be a metastore admin or an owner of (or have the **EXECUTE** - // privilege on) the parent registered model. For the latter case, the caller - // must also be the owner or have the **USE_CATALOG** privilege on the parent - // catalog and the **USE_SCHEMA** privilege on the parent schema. - Get(ctx context.Context, request GetModelVersionRequest) (*RegisteredModelInfo, error) - - // Get a Model Version. + // Creates a new monitor for the specified table. // - // Get a model version. + // The caller must either: 1. be an owner of the table's parent catalog, have + // **USE_SCHEMA** on the table's parent schema, and have **SELECT** access on + // the table 2. have **USE_CATALOG** on the table's parent catalog, be an owner + // of the table's parent schema, and have **SELECT** access on the table. 3. + // have the following permissions: - **USE_CATALOG** on the table's parent + // catalog - **USE_SCHEMA** on the table's parent schema - be an owner of the + // table. // - // The caller must be a metastore admin or an owner of (or have the **EXECUTE** - // privilege on) the parent registered model. For the latter case, the caller - // must also be the owner or have the **USE_CATALOG** privilege on the parent - // catalog and the **USE_SCHEMA** privilege on the parent schema. - GetByFullNameAndVersion(ctx context.Context, fullName string, version int) (*RegisteredModelInfo, error) + // Workspace assets, such as the dashboard, will be created in the workspace + // where this call was made. + Create(ctx context.Context, request CreateMonitor) (*MonitorInfo, error) - // Get Model Version By Alias. + // Delete a table monitor. // - // Get a model version by alias. + // Deletes a monitor for the specified table. // - // The caller must be a metastore admin or an owner of (or have the **EXECUTE** - // privilege on) the registered model. For the latter case, the caller must also - // be the owner or have the **USE_CATALOG** privilege on the parent catalog and - // the **USE_SCHEMA** privilege on the parent schema. - GetByAlias(ctx context.Context, request GetByAliasRequest) (*ModelVersionInfo, error) - - // Get Model Version By Alias. + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an + // owner of the table. // - // Get a model version by alias. + // Additionally, the call must be made from the workspace where the monitor was + // created. // - // The caller must be a metastore admin or an owner of (or have the **EXECUTE** - // privilege on) the registered model. For the latter case, the caller must also - // be the owner or have the **USE_CATALOG** privilege on the parent catalog and - // the **USE_SCHEMA** privilege on the parent schema. - GetByAliasByFullNameAndAlias(ctx context.Context, fullName string, alias string) (*ModelVersionInfo, error) + // Note that the metric tables and dashboard will not be deleted as part of this + // call; those assets must be manually cleaned up (if desired). + Delete(ctx context.Context, request DeleteQualityMonitorRequest) error - // List Model Versions. + // Delete a table monitor. // - // List model versions. You can list model versions under a particular schema, - // or list all model versions in the current metastore. + // Deletes a monitor for the specified table. // - // The returned models are filtered based on the privileges of the calling user. - // For example, the metastore admin is able to list all the model versions. A - // regular user needs to be the owner or have the **EXECUTE** privilege on the - // parent registered model to recieve the model versions in the response. For - // the latter case, the caller must also be the owner or have the - // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** - // privilege on the parent schema. + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an + // owner of the table. // - // There is no guarantee of a specific ordering of the elements in the response. - // The elements in the response will not contain any aliases or tags. + // Additionally, the call must be made from the workspace where the monitor was + // created. // - // This method is generated by Databricks SDK Code Generator. - List(ctx context.Context, request ListModelVersionsRequest) listing.Iterator[ModelVersionInfo] + // Note that the metric tables and dashboard will not be deleted as part of this + // call; those assets must be manually cleaned up (if desired). + DeleteByTableName(ctx context.Context, tableName string) error - // List Model Versions. + // Get a table monitor. // - // List model versions. You can list model versions under a particular schema, - // or list all model versions in the current metastore. + // Gets a monitor for the specified table. // - // The returned models are filtered based on the privileges of the calling user. - // For example, the metastore admin is able to list all the model versions. A - // regular user needs to be the owner or have the **EXECUTE** privilege on the - // parent registered model to recieve the model versions in the response. For - // the latter case, the caller must also be the owner or have the - // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** - // privilege on the parent schema. + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema. 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - + // **SELECT** privilege on the table. // - // There is no guarantee of a specific ordering of the elements in the response. - // The elements in the response will not contain any aliases or tags. + // The returned information includes configuration values, as well as + // information on assets created by the monitor. Some information (e.g., + // dashboard) may be filtered out if the caller is in a different workspace than + // where the monitor was created. + Get(ctx context.Context, request GetQualityMonitorRequest) (*MonitorInfo, error) + + // Get a table monitor. // - // This method is generated by Databricks SDK Code Generator. - ListAll(ctx context.Context, request ListModelVersionsRequest) ([]ModelVersionInfo, error) + // Gets a monitor for the specified table. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema. 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - + // **SELECT** privilege on the table. + // + // The returned information includes configuration values, as well as + // information on assets created by the monitor. Some information (e.g., + // dashboard) may be filtered out if the caller is in a different workspace than + // where the monitor was created. + GetByTableName(ctx context.Context, tableName string) (*MonitorInfo, error) - // List Model Versions. + // Get refresh. // - // List model versions. You can list model versions under a particular schema, - // or list all model versions in the current metastore. + // Gets info about a specific monitor refresh using the given refresh ID. // - // The returned models are filtered based on the privileges of the calling user. - // For example, the metastore admin is able to list all the model versions. A - // regular user needs to be the owner or have the **EXECUTE** privilege on the - // parent registered model to recieve the model versions in the response. For - // the latter case, the caller must also be the owner or have the - // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** - // privilege on the parent schema. + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - + // **SELECT** privilege on the table. // - // There is no guarantee of a specific ordering of the elements in the response. - // The elements in the response will not contain any aliases or tags. - ListByFullName(ctx context.Context, fullName string) (*ListModelVersionsResponse, error) + // Additionally, the call must be made from the workspace where the monitor was + // created. + GetRefresh(ctx context.Context, request GetRefreshRequest) (*MonitorRefreshInfo, error) - // Update a Model Version. + // Get refresh. // - // Updates the specified model version. + // Gets info about a specific monitor refresh using the given refresh ID. // - // The caller must be a metastore admin or an owner of the parent registered - // model. For the latter case, the caller must also be the owner or have the - // **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** - // privilege on the parent schema. + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - + // **SELECT** privilege on the table. // - // Currently only the comment of the model version can be updated. - Update(ctx context.Context, request UpdateModelVersionRequest) (*ModelVersionInfo, error) + // Additionally, the call must be made from the workspace where the monitor was + // created. + GetRefreshByTableNameAndRefreshId(ctx context.Context, tableName string, refreshId string) (*MonitorRefreshInfo, error) + + // List refreshes. + // + // Gets an array containing the history of the most recent refreshes (up to 25) + // for this table. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - + // **SELECT** privilege on the table. + // + // Additionally, the call must be made from the workspace where the monitor was + // created. + ListRefreshes(ctx context.Context, request ListRefreshesRequest) ([]MonitorRefreshInfo, error) + + // List refreshes. + // + // Gets an array containing the history of the most recent refreshes (up to 25) + // for this table. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - + // **SELECT** privilege on the table. + // + // Additionally, the call must be made from the workspace where the monitor was + // created. + ListRefreshesByTableName(ctx context.Context, tableName string) ([]MonitorRefreshInfo, error) + + // Queue a metric refresh for a monitor. + // + // Queues a metric refresh on the monitor for the specified table. The refresh + // will execute in the background. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an + // owner of the table + // + // Additionally, the call must be made from the workspace where the monitor was + // created. + RunRefresh(ctx context.Context, request RunRefreshRequest) (*MonitorRefreshInfo, error) + + // Update a table monitor. + // + // Updates a monitor for the specified table. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. have + // **USE_CATALOG** on the table's parent catalog and be an owner of the table's + // parent schema 3. have the following permissions: - **USE_CATALOG** on the + // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an + // owner of the table. + // + // Additionally, the call must be made from the workspace where the monitor was + // created, and the caller must be the original creator of the monitor. + // + // Certain configuration fields, such as output asset identifiers, cannot be + // updated. + Update(ctx context.Context, request UpdateMonitor) (*MonitorInfo, error) } -func NewModelVersions(client *client.DatabricksClient) *ModelVersionsAPI { - return &ModelVersionsAPI{ - impl: &modelVersionsImpl{ +func NewQualityMonitors(client *client.DatabricksClient) *QualityMonitorsAPI { + return &QualityMonitorsAPI{ + impl: &qualityMonitorsImpl{ client: client, }, } } -// Databricks provides a hosted version of MLflow Model Registry in Unity -// Catalog. Models in Unity Catalog provide centralized access control, -// auditing, lineage, and discovery of ML models across Databricks workspaces. +// A monitor computes and monitors data or model quality metrics for a table +// over time. It generates metrics tables and a dashboard that you can use to +// monitor table health and set alerts. // -// This API reference documents the REST endpoints for managing model versions -// in Unity Catalog. For more details, see the [registered models API -// docs](/api/workspace/registeredmodels). -type ModelVersionsAPI struct { +// Most write operations require the user to be the owner of the table (or its +// parent schema or parent catalog). Viewing the dashboard, computed metrics, or +// monitor configuration only requires the user to have **SELECT** privileges on +// the table (along with **USE_SCHEMA** and **USE_CATALOG**). +type QualityMonitorsAPI struct { // impl contains low-level REST API interface, that could be overridden - // through WithImpl(ModelVersionsService) - impl ModelVersionsService + // through WithImpl(QualityMonitorsService) + impl QualityMonitorsService } // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. -// Deprecated: use MockModelVersionsInterface instead. -func (a *ModelVersionsAPI) WithImpl(impl ModelVersionsService) ModelVersionsInterface { +// Deprecated: use MockQualityMonitorsInterface instead. +func (a *QualityMonitorsAPI) WithImpl(impl QualityMonitorsService) QualityMonitorsInterface { a.impl = impl return a } -// Impl returns low-level ModelVersions API implementation -// Deprecated: use MockModelVersionsInterface instead. -func (a *ModelVersionsAPI) Impl() ModelVersionsService { +// Impl returns low-level QualityMonitors API implementation +// Deprecated: use MockQualityMonitorsInterface instead. +func (a *QualityMonitorsAPI) Impl() QualityMonitorsService { return a.impl } -// Delete a Model Version. +// Cancel refresh. // -// Deletes a model version from the specified registered model. Any aliases -// assigned to the model version will also be deleted. +// Cancel an active monitor refresh for the given refresh ID. // -// The caller must be a metastore admin or an owner of the parent registered -// model. For the latter case, the caller must also be the owner or have the -// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** -// privilege on the parent schema. -func (a *ModelVersionsAPI) Delete(ctx context.Context, request DeleteModelVersionRequest) error { - return a.impl.Delete(ctx, request) +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an +// owner of the table +// +// Additionally, the call must be made from the workspace where the monitor was +// created. +func (a *QualityMonitorsAPI) CancelRefresh(ctx context.Context, request CancelRefreshRequest) error { + return a.impl.CancelRefresh(ctx, request) } -// Delete a Model Version. +// Create a table monitor. // -// Deletes a model version from the specified registered model. Any aliases -// assigned to the model version will also be deleted. +// Creates a new monitor for the specified table. // -// The caller must be a metastore admin or an owner of the parent registered -// model. For the latter case, the caller must also be the owner or have the -// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** -// privilege on the parent schema. -func (a *ModelVersionsAPI) DeleteByFullNameAndVersion(ctx context.Context, fullName string, version int) error { - return a.impl.Delete(ctx, DeleteModelVersionRequest{ - FullName: fullName, - Version: version, - }) +// The caller must either: 1. be an owner of the table's parent catalog, have +// **USE_SCHEMA** on the table's parent schema, and have **SELECT** access on +// the table 2. have **USE_CATALOG** on the table's parent catalog, be an owner +// of the table's parent schema, and have **SELECT** access on the table. 3. +// have the following permissions: - **USE_CATALOG** on the table's parent +// catalog - **USE_SCHEMA** on the table's parent schema - be an owner of the +// table. +// +// Workspace assets, such as the dashboard, will be created in the workspace +// where this call was made. +func (a *QualityMonitorsAPI) Create(ctx context.Context, request CreateMonitor) (*MonitorInfo, error) { + return a.impl.Create(ctx, request) } -// Get a Model Version. +// Delete a table monitor. // -// Get a model version. +// Deletes a monitor for the specified table. // -// The caller must be a metastore admin or an owner of (or have the **EXECUTE** -// privilege on) the parent registered model. For the latter case, the caller -// must also be the owner or have the **USE_CATALOG** privilege on the parent -// catalog and the **USE_SCHEMA** privilege on the parent schema. -func (a *ModelVersionsAPI) Get(ctx context.Context, request GetModelVersionRequest) (*RegisteredModelInfo, error) { - return a.impl.Get(ctx, request) +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an +// owner of the table. +// +// Additionally, the call must be made from the workspace where the monitor was +// created. +// +// Note that the metric tables and dashboard will not be deleted as part of this +// call; those assets must be manually cleaned up (if desired). +func (a *QualityMonitorsAPI) Delete(ctx context.Context, request DeleteQualityMonitorRequest) error { + return a.impl.Delete(ctx, request) } -// Get a Model Version. +// Delete a table monitor. // -// Get a model version. +// Deletes a monitor for the specified table. // -// The caller must be a metastore admin or an owner of (or have the **EXECUTE** -// privilege on) the parent registered model. For the latter case, the caller -// must also be the owner or have the **USE_CATALOG** privilege on the parent -// catalog and the **USE_SCHEMA** privilege on the parent schema. -func (a *ModelVersionsAPI) GetByFullNameAndVersion(ctx context.Context, fullName string, version int) (*RegisteredModelInfo, error) { - return a.impl.Get(ctx, GetModelVersionRequest{ - FullName: fullName, - Version: version, +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an +// owner of the table. +// +// Additionally, the call must be made from the workspace where the monitor was +// created. +// +// Note that the metric tables and dashboard will not be deleted as part of this +// call; those assets must be manually cleaned up (if desired). +func (a *QualityMonitorsAPI) DeleteByTableName(ctx context.Context, tableName string) error { + return a.impl.Delete(ctx, DeleteQualityMonitorRequest{ + TableName: tableName, }) } -// Get Model Version By Alias. -// -// Get a model version by alias. +// Get a table monitor. // -// The caller must be a metastore admin or an owner of (or have the **EXECUTE** -// privilege on) the registered model. For the latter case, the caller must also -// be the owner or have the **USE_CATALOG** privilege on the parent catalog and -// the **USE_SCHEMA** privilege on the parent schema. -func (a *ModelVersionsAPI) GetByAlias(ctx context.Context, request GetByAliasRequest) (*ModelVersionInfo, error) { - return a.impl.GetByAlias(ctx, request) -} - -// Get Model Version By Alias. +// Gets a monitor for the specified table. // -// Get a model version by alias. +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema. 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - +// **SELECT** privilege on the table. // -// The caller must be a metastore admin or an owner of (or have the **EXECUTE** -// privilege on) the registered model. For the latter case, the caller must also -// be the owner or have the **USE_CATALOG** privilege on the parent catalog and -// the **USE_SCHEMA** privilege on the parent schema. -func (a *ModelVersionsAPI) GetByAliasByFullNameAndAlias(ctx context.Context, fullName string, alias string) (*ModelVersionInfo, error) { - return a.impl.GetByAlias(ctx, GetByAliasRequest{ - FullName: fullName, - Alias: alias, - }) +// The returned information includes configuration values, as well as +// information on assets created by the monitor. Some information (e.g., +// dashboard) may be filtered out if the caller is in a different workspace than +// where the monitor was created. +func (a *QualityMonitorsAPI) Get(ctx context.Context, request GetQualityMonitorRequest) (*MonitorInfo, error) { + return a.impl.Get(ctx, request) } -// List Model Versions. -// -// List model versions. You can list model versions under a particular schema, -// or list all model versions in the current metastore. +// Get a table monitor. // -// The returned models are filtered based on the privileges of the calling user. -// For example, the metastore admin is able to list all the model versions. A -// regular user needs to be the owner or have the **EXECUTE** privilege on the -// parent registered model to recieve the model versions in the response. For -// the latter case, the caller must also be the owner or have the -// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** -// privilege on the parent schema. +// Gets a monitor for the specified table. // -// There is no guarantee of a specific ordering of the elements in the response. -// The elements in the response will not contain any aliases or tags. +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema. 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - +// **SELECT** privilege on the table. // -// This method is generated by Databricks SDK Code Generator. -func (a *ModelVersionsAPI) List(ctx context.Context, request ListModelVersionsRequest) listing.Iterator[ModelVersionInfo] { - - getNextPage := func(ctx context.Context, req ListModelVersionsRequest) (*ListModelVersionsResponse, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "pagination") - return a.impl.List(ctx, req) - } - getItems := func(resp *ListModelVersionsResponse) []ModelVersionInfo { - return resp.ModelVersions - } - getNextReq := func(resp *ListModelVersionsResponse) *ListModelVersionsRequest { - if resp.NextPageToken == "" { - return nil - } - request.PageToken = resp.NextPageToken - return &request - } - iterator := listing.NewIterator( - &request, - getNextPage, - getItems, - getNextReq) - return iterator +// The returned information includes configuration values, as well as +// information on assets created by the monitor. Some information (e.g., +// dashboard) may be filtered out if the caller is in a different workspace than +// where the monitor was created. +func (a *QualityMonitorsAPI) GetByTableName(ctx context.Context, tableName string) (*MonitorInfo, error) { + return a.impl.Get(ctx, GetQualityMonitorRequest{ + TableName: tableName, + }) } -// List Model Versions. -// -// List model versions. You can list model versions under a particular schema, -// or list all model versions in the current metastore. +// Get refresh. // -// The returned models are filtered based on the privileges of the calling user. -// For example, the metastore admin is able to list all the model versions. A -// regular user needs to be the owner or have the **EXECUTE** privilege on the -// parent registered model to recieve the model versions in the response. For -// the latter case, the caller must also be the owner or have the -// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** -// privilege on the parent schema. +// Gets info about a specific monitor refresh using the given refresh ID. // -// There is no guarantee of a specific ordering of the elements in the response. -// The elements in the response will not contain any aliases or tags. +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - +// **SELECT** privilege on the table. // -// This method is generated by Databricks SDK Code Generator. -func (a *ModelVersionsAPI) ListAll(ctx context.Context, request ListModelVersionsRequest) ([]ModelVersionInfo, error) { - iterator := a.List(ctx, request) - return listing.ToSliceN[ModelVersionInfo, int](ctx, iterator, request.MaxResults) - +// Additionally, the call must be made from the workspace where the monitor was +// created. +func (a *QualityMonitorsAPI) GetRefresh(ctx context.Context, request GetRefreshRequest) (*MonitorRefreshInfo, error) { + return a.impl.GetRefresh(ctx, request) } -// List Model Versions. +// Get refresh. // -// List model versions. You can list model versions under a particular schema, -// or list all model versions in the current metastore. +// Gets info about a specific monitor refresh using the given refresh ID. // -// The returned models are filtered based on the privileges of the calling user. -// For example, the metastore admin is able to list all the model versions. A -// regular user needs to be the owner or have the **EXECUTE** privilege on the -// parent registered model to recieve the model versions in the response. For -// the latter case, the caller must also be the owner or have the -// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** -// privilege on the parent schema. +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - +// **SELECT** privilege on the table. // -// There is no guarantee of a specific ordering of the elements in the response. -// The elements in the response will not contain any aliases or tags. -func (a *ModelVersionsAPI) ListByFullName(ctx context.Context, fullName string) (*ListModelVersionsResponse, error) { - return a.impl.List(ctx, ListModelVersionsRequest{ - FullName: fullName, +// Additionally, the call must be made from the workspace where the monitor was +// created. +func (a *QualityMonitorsAPI) GetRefreshByTableNameAndRefreshId(ctx context.Context, tableName string, refreshId string) (*MonitorRefreshInfo, error) { + return a.impl.GetRefresh(ctx, GetRefreshRequest{ + TableName: tableName, + RefreshId: refreshId, }) } -// Update a Model Version. +// List refreshes. // -// Updates the specified model version. +// Gets an array containing the history of the most recent refreshes (up to 25) +// for this table. // -// The caller must be a metastore admin or an owner of the parent registered -// model. For the latter case, the caller must also be the owner or have the -// **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** -// privilege on the parent schema. +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - +// **SELECT** privilege on the table. // -// Currently only the comment of the model version can be updated. -func (a *ModelVersionsAPI) Update(ctx context.Context, request UpdateModelVersionRequest) (*ModelVersionInfo, error) { - return a.impl.Update(ctx, request) -} - -type OnlineTablesInterface interface { - // WithImpl could be used to override low-level API implementations for unit - // testing purposes with [github.com/golang/mock] or other mocking frameworks. - // Deprecated: use MockOnlineTablesInterface instead. - WithImpl(impl OnlineTablesService) OnlineTablesInterface - - // Impl returns low-level OnlineTables API implementation - // Deprecated: use MockOnlineTablesInterface instead. - Impl() OnlineTablesService - - // Create an Online Table. - // - // Create a new Online Table. - Create(ctx context.Context, request CreateOnlineTableRequest) (*OnlineTable, error) - - // Delete an Online Table. - // - // Delete an online table. Warning: This will delete all the data in the online - // table. If the source Delta table was deleted or modified since this Online - // Table was created, this will lose the data forever! - Delete(ctx context.Context, request DeleteOnlineTableRequest) error - - // Delete an Online Table. - // - // Delete an online table. Warning: This will delete all the data in the online - // table. If the source Delta table was deleted or modified since this Online - // Table was created, this will lose the data forever! - DeleteByName(ctx context.Context, name string) error - - // Get an Online Table. - // - // Get information about an existing online table and its status. - Get(ctx context.Context, request GetOnlineTableRequest) (*OnlineTable, error) - - // Get an Online Table. - // - // Get information about an existing online table and its status. - GetByName(ctx context.Context, name string) (*OnlineTable, error) -} - -func NewOnlineTables(client *client.DatabricksClient) *OnlineTablesAPI { - return &OnlineTablesAPI{ - impl: &onlineTablesImpl{ - client: client, - }, - } -} - -// Online tables provide lower latency and higher QPS access to data from Delta -// tables. -type OnlineTablesAPI struct { - // impl contains low-level REST API interface, that could be overridden - // through WithImpl(OnlineTablesService) - impl OnlineTablesService -} - -// WithImpl could be used to override low-level API implementations for unit -// testing purposes with [github.com/golang/mock] or other mocking frameworks. -// Deprecated: use MockOnlineTablesInterface instead. -func (a *OnlineTablesAPI) WithImpl(impl OnlineTablesService) OnlineTablesInterface { - a.impl = impl - return a -} - -// Impl returns low-level OnlineTables API implementation -// Deprecated: use MockOnlineTablesInterface instead. -func (a *OnlineTablesAPI) Impl() OnlineTablesService { - return a.impl +// Additionally, the call must be made from the workspace where the monitor was +// created. +func (a *QualityMonitorsAPI) ListRefreshes(ctx context.Context, request ListRefreshesRequest) ([]MonitorRefreshInfo, error) { + return a.impl.ListRefreshes(ctx, request) } -// Create an Online Table. +// List refreshes. // -// Create a new Online Table. -func (a *OnlineTablesAPI) Create(ctx context.Context, request CreateOnlineTableRequest) (*OnlineTable, error) { - return a.impl.Create(ctx, request) -} - -// Delete an Online Table. +// Gets an array containing the history of the most recent refreshes (up to 25) +// for this table. // -// Delete an online table. Warning: This will delete all the data in the online -// table. If the source Delta table was deleted or modified since this Online -// Table was created, this will lose the data forever! -func (a *OnlineTablesAPI) Delete(ctx context.Context, request DeleteOnlineTableRequest) error { - return a.impl.Delete(ctx, request) -} - -// Delete an Online Table. +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - +// **SELECT** privilege on the table. // -// Delete an online table. Warning: This will delete all the data in the online -// table. If the source Delta table was deleted or modified since this Online -// Table was created, this will lose the data forever! -func (a *OnlineTablesAPI) DeleteByName(ctx context.Context, name string) error { - return a.impl.Delete(ctx, DeleteOnlineTableRequest{ - Name: name, +// Additionally, the call must be made from the workspace where the monitor was +// created. +func (a *QualityMonitorsAPI) ListRefreshesByTableName(ctx context.Context, tableName string) ([]MonitorRefreshInfo, error) { + return a.impl.ListRefreshes(ctx, ListRefreshesRequest{ + TableName: tableName, }) } -// Get an Online Table. +// Queue a metric refresh for a monitor. // -// Get information about an existing online table and its status. -func (a *OnlineTablesAPI) Get(ctx context.Context, request GetOnlineTableRequest) (*OnlineTable, error) { - return a.impl.Get(ctx, request) +// Queues a metric refresh on the monitor for the specified table. The refresh +// will execute in the background. +// +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an +// owner of the table +// +// Additionally, the call must be made from the workspace where the monitor was +// created. +func (a *QualityMonitorsAPI) RunRefresh(ctx context.Context, request RunRefreshRequest) (*MonitorRefreshInfo, error) { + return a.impl.RunRefresh(ctx, request) } -// Get an Online Table. +// Update a table monitor. // -// Get information about an existing online table and its status. -func (a *OnlineTablesAPI) GetByName(ctx context.Context, name string) (*OnlineTable, error) { - return a.impl.Get(ctx, GetOnlineTableRequest{ - Name: name, - }) +// Updates a monitor for the specified table. +// +// The caller must either: 1. be an owner of the table's parent catalog 2. have +// **USE_CATALOG** on the table's parent catalog and be an owner of the table's +// parent schema 3. have the following permissions: - **USE_CATALOG** on the +// table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an +// owner of the table. +// +// Additionally, the call must be made from the workspace where the monitor was +// created, and the caller must be the original creator of the monitor. +// +// Certain configuration fields, such as output asset identifiers, cannot be +// updated. +func (a *QualityMonitorsAPI) Update(ctx context.Context, request UpdateMonitor) (*MonitorInfo, error) { + return a.impl.Update(ctx, request) } type RegisteredModelsInterface interface { diff --git a/service/catalog/connections_usage_test.go b/service/catalog/connections_usage_test.go index 4385bbc79..0dbe892ff 100755 --- a/service/catalog/connections_usage_test.go +++ b/service/catalog/connections_usage_test.go @@ -95,7 +95,7 @@ func ExampleConnectionsAPI_ListAll_connections() { panic(err) } - connList, err := w.Connections.ListAll(ctx) + connList, err := w.Connections.ListAll(ctx, catalog.ListConnectionsRequest{}) if err != nil { panic(err) } diff --git a/service/catalog/impl.go b/service/catalog/impl.go index d53166712..b2d9f178a 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -275,12 +275,12 @@ func (a *connectionsImpl) Get(ctx context.Context, request GetConnectionRequest) return &connectionInfo, err } -func (a *connectionsImpl) List(ctx context.Context) (*ListConnectionsResponse, error) { +func (a *connectionsImpl) List(ctx context.Context, request ListConnectionsRequest) (*ListConnectionsResponse, error) { var listConnectionsResponse ListConnectionsResponse path := "/api/2.1/unity-catalog/connections" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, nil, &listConnectionsResponse) + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &listConnectionsResponse) return &listConnectionsResponse, err } @@ -431,83 +431,6 @@ func (a *grantsImpl) Update(ctx context.Context, request UpdatePermissions) (*Pe return &permissionsList, err } -// unexported type that holds implementations of just LakehouseMonitors API methods -type lakehouseMonitorsImpl struct { - client *client.DatabricksClient -} - -func (a *lakehouseMonitorsImpl) CancelRefresh(ctx context.Context, request CancelRefreshRequest) error { - var cancelRefreshResponse CancelRefreshResponse - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes/%v/cancel", request.TableName, request.RefreshId) - headers := make(map[string]string) - err := a.client.Do(ctx, http.MethodPost, path, headers, nil, &cancelRefreshResponse) - return err -} - -func (a *lakehouseMonitorsImpl) Create(ctx context.Context, request CreateMonitor) (*MonitorInfo, error) { - var monitorInfo MonitorInfo - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) - headers := make(map[string]string) - headers["Accept"] = "application/json" - headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPost, path, headers, request, &monitorInfo) - return &monitorInfo, err -} - -func (a *lakehouseMonitorsImpl) Delete(ctx context.Context, request DeleteLakehouseMonitorRequest) error { - var deleteResponse DeleteResponse - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) - headers := make(map[string]string) - err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deleteResponse) - return err -} - -func (a *lakehouseMonitorsImpl) Get(ctx context.Context, request GetLakehouseMonitorRequest) (*MonitorInfo, error) { - var monitorInfo MonitorInfo - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) - headers := make(map[string]string) - headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &monitorInfo) - return &monitorInfo, err -} - -func (a *lakehouseMonitorsImpl) GetRefresh(ctx context.Context, request GetRefreshRequest) (*MonitorRefreshInfo, error) { - var monitorRefreshInfo MonitorRefreshInfo - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes/%v", request.TableName, request.RefreshId) - headers := make(map[string]string) - headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &monitorRefreshInfo) - return &monitorRefreshInfo, err -} - -func (a *lakehouseMonitorsImpl) ListRefreshes(ctx context.Context, request ListRefreshesRequest) ([]MonitorRefreshInfo, error) { - var monitorRefreshInfoList []MonitorRefreshInfo - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes", request.TableName) - headers := make(map[string]string) - headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &monitorRefreshInfoList) - return monitorRefreshInfoList, err -} - -func (a *lakehouseMonitorsImpl) RunRefresh(ctx context.Context, request RunRefreshRequest) (*MonitorRefreshInfo, error) { - var monitorRefreshInfo MonitorRefreshInfo - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes", request.TableName) - headers := make(map[string]string) - headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodPost, path, headers, nil, &monitorRefreshInfo) - return &monitorRefreshInfo, err -} - -func (a *lakehouseMonitorsImpl) Update(ctx context.Context, request UpdateMonitor) (*MonitorInfo, error) { - var monitorInfo MonitorInfo - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) - headers := make(map[string]string) - headers["Accept"] = "application/json" - headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPut, path, headers, request, &monitorInfo) - return &monitorInfo, err -} - // unexported type that holds implementations of just Metastores API methods type metastoresImpl struct { client *client.DatabricksClient @@ -690,6 +613,83 @@ func (a *onlineTablesImpl) Get(ctx context.Context, request GetOnlineTableReques return &onlineTable, err } +// unexported type that holds implementations of just QualityMonitors API methods +type qualityMonitorsImpl struct { + client *client.DatabricksClient +} + +func (a *qualityMonitorsImpl) CancelRefresh(ctx context.Context, request CancelRefreshRequest) error { + var cancelRefreshResponse CancelRefreshResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes/%v/cancel", request.TableName, request.RefreshId) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodPost, path, headers, nil, &cancelRefreshResponse) + return err +} + +func (a *qualityMonitorsImpl) Create(ctx context.Context, request CreateMonitor) (*MonitorInfo, error) { + var monitorInfo MonitorInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, request, &monitorInfo) + return &monitorInfo, err +} + +func (a *qualityMonitorsImpl) Delete(ctx context.Context, request DeleteQualityMonitorRequest) error { + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deleteResponse) + return err +} + +func (a *qualityMonitorsImpl) Get(ctx context.Context, request GetQualityMonitorRequest) (*MonitorInfo, error) { + var monitorInfo MonitorInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &monitorInfo) + return &monitorInfo, err +} + +func (a *qualityMonitorsImpl) GetRefresh(ctx context.Context, request GetRefreshRequest) (*MonitorRefreshInfo, error) { + var monitorRefreshInfo MonitorRefreshInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes/%v", request.TableName, request.RefreshId) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &monitorRefreshInfo) + return &monitorRefreshInfo, err +} + +func (a *qualityMonitorsImpl) ListRefreshes(ctx context.Context, request ListRefreshesRequest) ([]MonitorRefreshInfo, error) { + var monitorRefreshInfoList []MonitorRefreshInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes", request.TableName) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &monitorRefreshInfoList) + return monitorRefreshInfoList, err +} + +func (a *qualityMonitorsImpl) RunRefresh(ctx context.Context, request RunRefreshRequest) (*MonitorRefreshInfo, error) { + var monitorRefreshInfo MonitorRefreshInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes", request.TableName) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, nil, &monitorRefreshInfo) + return &monitorRefreshInfo, err +} + +func (a *qualityMonitorsImpl) Update(ctx context.Context, request UpdateMonitor) (*MonitorInfo, error) { + var monitorInfo MonitorInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, request, &monitorInfo) + return &monitorInfo, err +} + // unexported type that holds implementations of just RegisteredModels API methods type registeredModelsImpl struct { client *client.DatabricksClient diff --git a/service/catalog/interface.go b/service/catalog/interface.go index c4d06f1fe..b3339afc2 100755 --- a/service/catalog/interface.go +++ b/service/catalog/interface.go @@ -223,8 +223,8 @@ type ConnectionsService interface { // // List all connections. // - // Use ListAll() to get all ConnectionInfo instances - List(ctx context.Context) (*ListConnectionsResponse, error) + // Use ListAll() to get all ConnectionInfo instances, which will iterate over every result page. + List(ctx context.Context, request ListConnectionsRequest) (*ListConnectionsResponse, error) // Update a connection. // @@ -380,141 +380,6 @@ type GrantsService interface { Update(ctx context.Context, request UpdatePermissions) (*PermissionsList, error) } -// A monitor computes and monitors data or model quality metrics for a table -// over time. It generates metrics tables and a dashboard that you can use to -// monitor table health and set alerts. -// -// Most write operations require the user to be the owner of the table (or its -// parent schema or parent catalog). Viewing the dashboard, computed metrics, or -// monitor configuration only requires the user to have **SELECT** privileges on -// the table (along with **USE_SCHEMA** and **USE_CATALOG**). -type LakehouseMonitorsService interface { - - // Cancel refresh. - // - // Cancel an active monitor refresh for the given refresh ID. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. - // have **USE_CATALOG** on the table's parent catalog and be an owner of the - // table's parent schema 3. have the following permissions: - - // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the - // table's parent schema - be an owner of the table - // - // Additionally, the call must be made from the workspace where the monitor - // was created. - CancelRefresh(ctx context.Context, request CancelRefreshRequest) error - - // Create a table monitor. - // - // Creates a new monitor for the specified table. - // - // The caller must either: 1. be an owner of the table's parent catalog, - // have **USE_SCHEMA** on the table's parent schema, and have **SELECT** - // access on the table 2. have **USE_CATALOG** on the table's parent - // catalog, be an owner of the table's parent schema, and have **SELECT** - // access on the table. 3. have the following permissions: - **USE_CATALOG** - // on the table's parent catalog - **USE_SCHEMA** on the table's parent - // schema - be an owner of the table. - // - // Workspace assets, such as the dashboard, will be created in the workspace - // where this call was made. - Create(ctx context.Context, request CreateMonitor) (*MonitorInfo, error) - - // Delete a table monitor. - // - // Deletes a monitor for the specified table. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. - // have **USE_CATALOG** on the table's parent catalog and be an owner of the - // table's parent schema 3. have the following permissions: - - // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the - // table's parent schema - be an owner of the table. - // - // Additionally, the call must be made from the workspace where the monitor - // was created. - // - // Note that the metric tables and dashboard will not be deleted as part of - // this call; those assets must be manually cleaned up (if desired). - Delete(ctx context.Context, request DeleteLakehouseMonitorRequest) error - - // Get a table monitor. - // - // Gets a monitor for the specified table. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. - // have **USE_CATALOG** on the table's parent catalog and be an owner of the - // table's parent schema. 3. have the following permissions: - - // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the - // table's parent schema - **SELECT** privilege on the table. - // - // The returned information includes configuration values, as well as - // information on assets created by the monitor. Some information (e.g., - // dashboard) may be filtered out if the caller is in a different workspace - // than where the monitor was created. - Get(ctx context.Context, request GetLakehouseMonitorRequest) (*MonitorInfo, error) - - // Get refresh. - // - // Gets info about a specific monitor refresh using the given refresh ID. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. - // have **USE_CATALOG** on the table's parent catalog and be an owner of the - // table's parent schema 3. have the following permissions: - - // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the - // table's parent schema - **SELECT** privilege on the table. - // - // Additionally, the call must be made from the workspace where the monitor - // was created. - GetRefresh(ctx context.Context, request GetRefreshRequest) (*MonitorRefreshInfo, error) - - // List refreshes. - // - // Gets an array containing the history of the most recent refreshes (up to - // 25) for this table. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. - // have **USE_CATALOG** on the table's parent catalog and be an owner of the - // table's parent schema 3. have the following permissions: - - // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the - // table's parent schema - **SELECT** privilege on the table. - // - // Additionally, the call must be made from the workspace where the monitor - // was created. - ListRefreshes(ctx context.Context, request ListRefreshesRequest) ([]MonitorRefreshInfo, error) - - // Queue a metric refresh for a monitor. - // - // Queues a metric refresh on the monitor for the specified table. The - // refresh will execute in the background. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. - // have **USE_CATALOG** on the table's parent catalog and be an owner of the - // table's parent schema 3. have the following permissions: - - // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the - // table's parent schema - be an owner of the table - // - // Additionally, the call must be made from the workspace where the monitor - // was created. - RunRefresh(ctx context.Context, request RunRefreshRequest) (*MonitorRefreshInfo, error) - - // Update a table monitor. - // - // Updates a monitor for the specified table. - // - // The caller must either: 1. be an owner of the table's parent catalog 2. - // have **USE_CATALOG** on the table's parent catalog and be an owner of the - // table's parent schema 3. have the following permissions: - - // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the - // table's parent schema - be an owner of the table. - // - // Additionally, the call must be made from the workspace where the monitor - // was created, and the caller must be the original creator of the monitor. - // - // Certain configuration fields, such as output asset identifiers, cannot be - // updated. - Update(ctx context.Context, request UpdateMonitor) (*MonitorInfo, error) -} - // A metastore is the top-level container of objects in Unity Catalog. It stores // data assets (tables and views) and the permissions that govern access to // them. Databricks account admins can create metastores and assign them to @@ -699,6 +564,141 @@ type OnlineTablesService interface { Get(ctx context.Context, request GetOnlineTableRequest) (*OnlineTable, error) } +// A monitor computes and monitors data or model quality metrics for a table +// over time. It generates metrics tables and a dashboard that you can use to +// monitor table health and set alerts. +// +// Most write operations require the user to be the owner of the table (or its +// parent schema or parent catalog). Viewing the dashboard, computed metrics, or +// monitor configuration only requires the user to have **SELECT** privileges on +// the table (along with **USE_SCHEMA** and **USE_CATALOG**). +type QualityMonitorsService interface { + + // Cancel refresh. + // + // Cancel an active monitor refresh for the given refresh ID. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. + // have **USE_CATALOG** on the table's parent catalog and be an owner of the + // table's parent schema 3. have the following permissions: - + // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the + // table's parent schema - be an owner of the table + // + // Additionally, the call must be made from the workspace where the monitor + // was created. + CancelRefresh(ctx context.Context, request CancelRefreshRequest) error + + // Create a table monitor. + // + // Creates a new monitor for the specified table. + // + // The caller must either: 1. be an owner of the table's parent catalog, + // have **USE_SCHEMA** on the table's parent schema, and have **SELECT** + // access on the table 2. have **USE_CATALOG** on the table's parent + // catalog, be an owner of the table's parent schema, and have **SELECT** + // access on the table. 3. have the following permissions: - **USE_CATALOG** + // on the table's parent catalog - **USE_SCHEMA** on the table's parent + // schema - be an owner of the table. + // + // Workspace assets, such as the dashboard, will be created in the workspace + // where this call was made. + Create(ctx context.Context, request CreateMonitor) (*MonitorInfo, error) + + // Delete a table monitor. + // + // Deletes a monitor for the specified table. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. + // have **USE_CATALOG** on the table's parent catalog and be an owner of the + // table's parent schema 3. have the following permissions: - + // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the + // table's parent schema - be an owner of the table. + // + // Additionally, the call must be made from the workspace where the monitor + // was created. + // + // Note that the metric tables and dashboard will not be deleted as part of + // this call; those assets must be manually cleaned up (if desired). + Delete(ctx context.Context, request DeleteQualityMonitorRequest) error + + // Get a table monitor. + // + // Gets a monitor for the specified table. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. + // have **USE_CATALOG** on the table's parent catalog and be an owner of the + // table's parent schema. 3. have the following permissions: - + // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the + // table's parent schema - **SELECT** privilege on the table. + // + // The returned information includes configuration values, as well as + // information on assets created by the monitor. Some information (e.g., + // dashboard) may be filtered out if the caller is in a different workspace + // than where the monitor was created. + Get(ctx context.Context, request GetQualityMonitorRequest) (*MonitorInfo, error) + + // Get refresh. + // + // Gets info about a specific monitor refresh using the given refresh ID. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. + // have **USE_CATALOG** on the table's parent catalog and be an owner of the + // table's parent schema 3. have the following permissions: - + // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the + // table's parent schema - **SELECT** privilege on the table. + // + // Additionally, the call must be made from the workspace where the monitor + // was created. + GetRefresh(ctx context.Context, request GetRefreshRequest) (*MonitorRefreshInfo, error) + + // List refreshes. + // + // Gets an array containing the history of the most recent refreshes (up to + // 25) for this table. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. + // have **USE_CATALOG** on the table's parent catalog and be an owner of the + // table's parent schema 3. have the following permissions: - + // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the + // table's parent schema - **SELECT** privilege on the table. + // + // Additionally, the call must be made from the workspace where the monitor + // was created. + ListRefreshes(ctx context.Context, request ListRefreshesRequest) ([]MonitorRefreshInfo, error) + + // Queue a metric refresh for a monitor. + // + // Queues a metric refresh on the monitor for the specified table. The + // refresh will execute in the background. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. + // have **USE_CATALOG** on the table's parent catalog and be an owner of the + // table's parent schema 3. have the following permissions: - + // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the + // table's parent schema - be an owner of the table + // + // Additionally, the call must be made from the workspace where the monitor + // was created. + RunRefresh(ctx context.Context, request RunRefreshRequest) (*MonitorRefreshInfo, error) + + // Update a table monitor. + // + // Updates a monitor for the specified table. + // + // The caller must either: 1. be an owner of the table's parent catalog 2. + // have **USE_CATALOG** on the table's parent catalog and be an owner of the + // table's parent schema 3. have the following permissions: - + // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the + // table's parent schema - be an owner of the table. + // + // Additionally, the call must be made from the workspace where the monitor + // was created, and the caller must be the original creator of the monitor. + // + // Certain configuration fields, such as output asset identifiers, cannot be + // updated. + Update(ctx context.Context, request UpdateMonitor) (*MonitorInfo, error) +} + // Databricks provides a hosted version of MLflow Model Registry in Unity // Catalog. Models in Unity Catalog provide centralized access control, // auditing, lineage, and discovery of ML models across Databricks workspaces. diff --git a/service/catalog/model.go b/service/catalog/model.go index a9347203d..ee88e8014 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -1356,12 +1356,6 @@ func (s DeleteFunctionRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Delete a table monitor -type DeleteLakehouseMonitorRequest struct { - // Full name of the table. - TableName string `json:"-" url:"-"` -} - // Delete a metastore type DeleteMetastoreRequest struct { // Force deletion even if the metastore is not empty. Default is false. @@ -1394,6 +1388,12 @@ type DeleteOnlineTableRequest struct { Name string `json:"-" url:"-"` } +// Delete a table monitor +type DeleteQualityMonitorRequest struct { + // Full name of the table. + TableName string `json:"-" url:"-"` +} + // Delete a Registered Model type DeleteRegisteredModelRequest struct { // The three-level (fully qualified) name of the registered model @@ -2226,12 +2226,6 @@ func (s GetGrantRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Get a table monitor -type GetLakehouseMonitorRequest struct { - // Full name of the table. - TableName string `json:"-" url:"-"` -} - // Get a metastore type GetMetastoreRequest struct { // Unique ID of the metastore. @@ -2345,6 +2339,12 @@ type GetOnlineTableRequest struct { Name string `json:"-" url:"-"` } +// Get a table monitor +type GetQualityMonitorRequest struct { + // Full name of the table. + TableName string `json:"-" url:"-"` +} + // Get refresh type GetRefreshRequest struct { // ID of the refresh. @@ -2492,9 +2492,46 @@ type ListCatalogsResponse struct { Catalogs []CatalogInfo `json:"catalogs,omitempty"` } +// List connections +type ListConnectionsRequest struct { + // Maximum number of connections to return. - If not set, all connections + // are returned (not recommended). - when set to a value greater than 0, the + // page length is the minimum of this value and a server configured value; - + // when set to 0, the page length is set to a server configured value + // (recommended); - when set to a value less than 0, an invalid parameter + // error is returned; + MaxResults int `json:"-" url:"max_results,omitempty"` + // Opaque pagination token to go to next page based on previous query. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ListConnectionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListConnectionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListConnectionsResponse struct { // An array of connection information objects. Connections []ConnectionInfo `json:"connections,omitempty"` + // Opaque token to retrieve the next page of results. Absent if there are no + // more pages. __page_token__ should be set to this value for the next + // request (for the next page of results). + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ListConnectionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListConnectionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List external locations @@ -4770,6 +4807,9 @@ type UpdateMonitor struct { // metrics, derived metrics (from already computed aggregate metrics), or // drift metrics (comparing metrics across time windows). CustomMetrics []MonitorMetric `json:"custom_metrics,omitempty"` + // Id of dashboard that visualizes the computed metrics. This can be empty + // if the monitor is in PENDING state. + DashboardId string `json:"dashboard_id,omitempty"` // The data classification config for the monitor. DataClassificationConfig *MonitorDataClassificationConfig `json:"data_classification_config,omitempty"` // Configuration for monitoring inference logs. diff --git a/service/compute/api.go b/service/compute/api.go index 4712770a9..4e2ac9571 100755 --- a/service/compute/api.go +++ b/service/compute/api.go @@ -2829,7 +2829,17 @@ type LibrariesInterface interface { // // Get the status of all libraries on all clusters. A status is returned for all // libraries installed on this cluster via the API or the libraries UI. - AllClusterStatuses(ctx context.Context) (*ListAllClusterLibraryStatusesResponse, error) + // + // This method is generated by Databricks SDK Code Generator. + AllClusterStatuses(ctx context.Context) listing.Iterator[ClusterLibraryStatuses] + + // Get all statuses. + // + // Get the status of all libraries on all clusters. A status is returned for all + // libraries installed on this cluster via the API or the libraries UI. + // + // This method is generated by Databricks SDK Code Generator. + AllClusterStatusesAll(ctx context.Context) ([]ClusterLibraryStatuses, error) // Get status. // @@ -2866,7 +2876,7 @@ type LibrariesInterface interface { // are returned first. 2. Libraries that were previously requested to be // installed on this cluster or, but are now marked for removal, in no // particular order, are returned last. - ClusterStatusByClusterId(ctx context.Context, clusterId string) (*ClusterStatusResponse, error) + ClusterStatusByClusterId(ctx context.Context, clusterId string) (*ClusterLibraryStatuses, error) // Add a library. // @@ -2930,8 +2940,36 @@ func (a *LibrariesAPI) Impl() LibrariesService { // // Get the status of all libraries on all clusters. A status is returned for all // libraries installed on this cluster via the API or the libraries UI. -func (a *LibrariesAPI) AllClusterStatuses(ctx context.Context) (*ListAllClusterLibraryStatusesResponse, error) { - return a.impl.AllClusterStatuses(ctx) +// +// This method is generated by Databricks SDK Code Generator. +func (a *LibrariesAPI) AllClusterStatuses(ctx context.Context) listing.Iterator[ClusterLibraryStatuses] { + request := struct{}{} + + getNextPage := func(ctx context.Context, req struct{}) (*ListAllClusterLibraryStatusesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.impl.AllClusterStatuses(ctx) + } + getItems := func(resp *ListAllClusterLibraryStatusesResponse) []ClusterLibraryStatuses { + return resp.Statuses + } + + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + nil) + return iterator +} + +// Get all statuses. +// +// Get the status of all libraries on all clusters. A status is returned for all +// libraries installed on this cluster via the API or the libraries UI. +// +// This method is generated by Databricks SDK Code Generator. +func (a *LibrariesAPI) AllClusterStatusesAll(ctx context.Context) ([]ClusterLibraryStatuses, error) { + iterator := a.AllClusterStatuses(ctx) + return listing.ToSlice[ClusterLibraryStatuses](ctx, iterator) } // Get status. @@ -2947,11 +2985,11 @@ func (a *LibrariesAPI) AllClusterStatuses(ctx context.Context) (*ListAllClusterL // This method is generated by Databricks SDK Code Generator. func (a *LibrariesAPI) ClusterStatus(ctx context.Context, request ClusterStatus) listing.Iterator[LibraryFullStatus] { - getNextPage := func(ctx context.Context, req ClusterStatus) (*ClusterStatusResponse, error) { + getNextPage := func(ctx context.Context, req ClusterStatus) (*ClusterLibraryStatuses, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.impl.ClusterStatus(ctx, req) } - getItems := func(resp *ClusterStatusResponse) []LibraryFullStatus { + getItems := func(resp *ClusterLibraryStatuses) []LibraryFullStatus { return resp.LibraryStatuses } @@ -2988,7 +3026,7 @@ func (a *LibrariesAPI) ClusterStatusAll(ctx context.Context, request ClusterStat // are returned first. 2. Libraries that were previously requested to be // installed on this cluster or, but are now marked for removal, in no // particular order, are returned last. -func (a *LibrariesAPI) ClusterStatusByClusterId(ctx context.Context, clusterId string) (*ClusterStatusResponse, error) { +func (a *LibrariesAPI) ClusterStatusByClusterId(ctx context.Context, clusterId string) (*ClusterLibraryStatuses, error) { return a.impl.ClusterStatus(ctx, ClusterStatus{ ClusterId: clusterId, }) diff --git a/service/compute/impl.go b/service/compute/impl.go index bf78f6260..9123a72b4 100755 --- a/service/compute/impl.go +++ b/service/compute/impl.go @@ -561,13 +561,13 @@ func (a *librariesImpl) AllClusterStatuses(ctx context.Context) (*ListAllCluster return &listAllClusterLibraryStatusesResponse, err } -func (a *librariesImpl) ClusterStatus(ctx context.Context, request ClusterStatus) (*ClusterStatusResponse, error) { - var clusterStatusResponse ClusterStatusResponse +func (a *librariesImpl) ClusterStatus(ctx context.Context, request ClusterStatus) (*ClusterLibraryStatuses, error) { + var clusterLibraryStatuses ClusterLibraryStatuses path := "/api/2.0/libraries/cluster-status" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &clusterStatusResponse) - return &clusterStatusResponse, err + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &clusterLibraryStatuses) + return &clusterLibraryStatuses, err } func (a *librariesImpl) Install(ctx context.Context, request InstallLibraries) error { diff --git a/service/compute/interface.go b/service/compute/interface.go index 70c263b49..100f63d4b 100755 --- a/service/compute/interface.go +++ b/service/compute/interface.go @@ -517,6 +517,8 @@ type LibrariesService interface { // // Get the status of all libraries on all clusters. A status is returned for // all libraries installed on this cluster via the API or the libraries UI. + // + // Use AllClusterStatusesAll() to get all ClusterLibraryStatuses instances AllClusterStatuses(ctx context.Context) (*ListAllClusterLibraryStatusesResponse, error) // Get status. @@ -530,7 +532,7 @@ type LibrariesService interface { // removal, in no particular order, are returned last. // // Use ClusterStatusAll() to get all LibraryFullStatus instances - ClusterStatus(ctx context.Context, request ClusterStatus) (*ClusterStatusResponse, error) + ClusterStatus(ctx context.Context, request ClusterStatus) (*ClusterLibraryStatuses, error) // Add a library. // diff --git a/service/compute/library_utilities.go b/service/compute/library_utilities.go index c4ef084f2..a7856532a 100644 --- a/service/compute/library_utilities.go +++ b/service/compute/library_utilities.go @@ -61,15 +61,6 @@ func (cls ClusterLibraryStatuses) ToLibraryList() InstallLibraries { } // ToLibraryList convert to envity for convenient comparison -func (cls ClusterStatusResponse) ToLibraryList() InstallLibraries { - cll := InstallLibraries{ClusterId: cls.ClusterId} - for _, lib := range cls.LibraryStatuses { - cll.Libraries = append(cll.Libraries, *lib.Library) - } - cll.Sort() - return cll -} - func (w *Wait) IsNotInScope(lib *Library) bool { // if we don't know concrete libraries if len(w.Libraries) == 0 { @@ -87,7 +78,7 @@ func (w *Wait) IsNotInScope(lib *Library) bool { // IsRetryNeeded returns first bool if there needs to be retry. // If there needs to be retry, error message will explain why. // If retry does not need to happen and error is not nil - it failed. -func (cls ClusterStatusResponse) IsRetryNeeded(w Wait) (bool, error) { +func (cls ClusterLibraryStatuses) IsRetryNeeded(w Wait) (bool, error) { pending := 0 ready := 0 errors := []string{} @@ -146,11 +137,11 @@ type Update struct { } type librariesAPIUtilities interface { - UpdateAndWait(ctx context.Context, update Update, options ...retries.Option[ClusterStatusResponse]) error + UpdateAndWait(ctx context.Context, update Update, options ...retries.Option[ClusterLibraryStatuses]) error } func (a *LibrariesAPI) UpdateAndWait(ctx context.Context, update Update, - options ...retries.Option[ClusterStatusResponse]) error { + options ...retries.Option[ClusterLibraryStatuses]) error { ctx = useragent.InContext(ctx, "sdk-feature", "update-libraries") if len(update.Uninstall) > 0 { err := a.Uninstall(ctx, UninstallLibraries{ @@ -186,20 +177,20 @@ func (a *LibrariesAPI) UpdateAndWait(ctx context.Context, update Update, // clusterID string, timeout time.Duration, isActive bool, refresh bool func (a *LibrariesAPI) Wait(ctx context.Context, wait Wait, - options ...retries.Option[ClusterStatusResponse]) (*ClusterStatusResponse, error) { + options ...retries.Option[ClusterLibraryStatuses]) (*ClusterLibraryStatuses, error) { ctx = useragent.InContext(ctx, "sdk-feature", "wait-for-libraries") - i := retries.Info[ClusterStatusResponse]{Timeout: 30 * time.Minute} + i := retries.Info[ClusterLibraryStatuses]{Timeout: 30 * time.Minute} for _, o := range options { o(&i) } - result, err := retries.Poll(ctx, i.Timeout, func() (*ClusterStatusResponse, *retries.Err) { + result, err := retries.Poll(ctx, i.Timeout, func() (*ClusterLibraryStatuses, *retries.Err) { status, err := a.ClusterStatusByClusterId(ctx, wait.ClusterID) if apierr.IsMissing(err) { // eventual consistency error return nil, retries.Continue(err) } for _, o := range options { - o(&retries.Info[ClusterStatusResponse]{ + o(&retries.Info[ClusterLibraryStatuses]{ Timeout: i.Timeout, Info: status, }) diff --git a/service/compute/model.go b/service/compute/model.go index 10c64aee0..8d6f55d3d 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -450,8 +450,12 @@ type ClusterAttributes struct { // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. // Cluster users are fully isolated so that they cannot see each other's // data and credentials. Most data governance features are supported in this - // mode. But programming languages and cluster features might be limited. * - // `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table + // mode. But programming languages and cluster features might be limited. + // + // The following modes are deprecated starting with Databricks Runtime 15.0 + // and will be removed for future Databricks Runtime versions: + // + // * `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table // ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating // from legacy Passthrough on high concurrency clusters. * // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy @@ -604,8 +608,12 @@ type ClusterDetails struct { // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. // Cluster users are fully isolated so that they cannot see each other's // data and credentials. Most data governance features are supported in this - // mode. But programming languages and cluster features might be limited. * - // `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table + // mode. But programming languages and cluster features might be limited. + // + // The following modes are deprecated starting with Databricks Runtime 15.0 + // and will be removed for future Databricks Runtime versions: + // + // * `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table // ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating // from legacy Passthrough on high concurrency clusters. * // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy @@ -1147,8 +1155,12 @@ type ClusterSpec struct { // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. // Cluster users are fully isolated so that they cannot see each other's // data and credentials. Most data governance features are supported in this - // mode. But programming languages and cluster features might be limited. * - // `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table + // mode. But programming languages and cluster features might be limited. + // + // The following modes are deprecated starting with Databricks Runtime 15.0 + // and will be removed for future Databricks Runtime versions: + // + // * `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table // ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating // from legacy Passthrough on high concurrency clusters. * // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy @@ -1253,23 +1265,6 @@ type ClusterStatus struct { ClusterId string `json:"-" url:"cluster_id"` } -type ClusterStatusResponse struct { - // Unique identifier for the cluster. - ClusterId string `json:"cluster_id,omitempty"` - // Status of all libraries on the cluster. - LibraryStatuses []LibraryFullStatus `json:"library_statuses,omitempty"` - - ForceSendFields []string `json:"-"` -} - -func (s *ClusterStatusResponse) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, s) -} - -func (s ClusterStatusResponse) MarshalJSON() ([]byte, error) { - return marshal.Marshal(s) -} - type Command struct { // Running cluster id ClusterId string `json:"clusterId,omitempty"` @@ -1460,8 +1455,12 @@ type CreateCluster struct { // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. // Cluster users are fully isolated so that they cannot see each other's // data and credentials. Most data governance features are supported in this - // mode. But programming languages and cluster features might be limited. * - // `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table + // mode. But programming languages and cluster features might be limited. + // + // The following modes are deprecated starting with Databricks Runtime 15.0 + // and will be removed for future Databricks Runtime versions: + // + // * `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table // ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating // from legacy Passthrough on high concurrency clusters. * // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy @@ -1823,11 +1822,15 @@ func (f *DataPlaneEventDetailsEventType) Type() string { // cluster that can be shared by multiple users. Cluster users are fully // isolated so that they cannot see each other's data and credentials. Most data // governance features are supported in this mode. But programming languages and -// cluster features might be limited. * `LEGACY_TABLE_ACL`: This mode is for -// users migrating from legacy Table ACL clusters. * `LEGACY_PASSTHROUGH`: This -// mode is for users migrating from legacy Passthrough on high concurrency -// clusters. * `LEGACY_SINGLE_USER`: This mode is for users migrating from -// legacy Passthrough on standard clusters. +// cluster features might be limited. +// +// The following modes are deprecated starting with Databricks Runtime 15.0 and +// will be removed for future Databricks Runtime versions: +// +// * `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table ACL +// clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating from +// legacy Passthrough on high concurrency clusters. * `LEGACY_SINGLE_USER`: This +// mode is for users migrating from legacy Passthrough on standard clusters. type DataSecurityMode string // This mode is for users migrating from legacy Passthrough on high concurrency @@ -2147,8 +2150,12 @@ type EditCluster struct { // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. // Cluster users are fully isolated so that they cannot see each other's // data and credentials. Most data governance features are supported in this - // mode. But programming languages and cluster features might be limited. * - // `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table + // mode. But programming languages and cluster features might be limited. + // + // The following modes are deprecated starting with Databricks Runtime 15.0 + // and will be removed for future Databricks Runtime versions: + // + // * `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table // ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating // from legacy Passthrough on high concurrency clusters. * // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy diff --git a/service/iam/model.go b/service/iam/model.go index c0e595616..55e4ccf6b 100755 --- a/service/iam/model.go +++ b/service/iam/model.go @@ -329,7 +329,7 @@ type Group struct { Groups []ComplexValue `json:"groups,omitempty"` // Databricks group ID - Id string `json:"id,omitempty" url:"-"` + Id string `json:"id,omitempty"` Members []ComplexValue `json:"members,omitempty"` // Container for the group identifier. Workspace local versus account. @@ -1231,7 +1231,7 @@ type ServicePrincipal struct { Groups []ComplexValue `json:"groups,omitempty"` // Databricks service principal ID. - Id string `json:"id,omitempty" url:"-"` + Id string `json:"id,omitempty"` // Corresponds to AWS instance profile/arn role. Roles []ComplexValue `json:"roles,omitempty"` // The schema of the List response. diff --git a/service/jobs/model.go b/service/jobs/model.go index 4c8764c1e..5fc900323 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -1857,9 +1857,7 @@ type RepairRun struct { NotebookParams map[string]string `json:"notebook_params,omitempty"` PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - // A map from keys to values for jobs with Python wheel task, for example - // `"python_named_params": {"name": "task", "data": - // "dbfs:/path/to/data.json"}`. + PythonNamedParams map[string]string `json:"python_named_params,omitempty"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to @@ -2321,9 +2319,7 @@ type RunJobTask struct { NotebookParams map[string]string `json:"notebook_params,omitempty"` PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - // A map from keys to values for jobs with Python wheel task, for example - // `"python_named_params": {"name": "task", "data": - // "dbfs:/path/to/data.json"}`. + PythonNamedParams map[string]string `json:"python_named_params,omitempty"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to @@ -2497,9 +2493,7 @@ type RunNow struct { NotebookParams map[string]string `json:"notebook_params,omitempty"` PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - // A map from keys to values for jobs with Python wheel task, for example - // `"python_named_params": {"name": "task", "data": - // "dbfs:/path/to/data.json"}`. + PythonNamedParams map[string]string `json:"python_named_params,omitempty"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to @@ -2663,9 +2657,7 @@ type RunParameters struct { NotebookParams map[string]string `json:"notebook_params,omitempty"` PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - // A map from keys to values for jobs with Python wheel task, for example - // `"python_named_params": {"name": "task", "data": - // "dbfs:/path/to/data.json"}`. + PythonNamedParams map[string]string `json:"python_named_params,omitempty"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to diff --git a/service/marketplace/model.go b/service/marketplace/model.go index 68b605d95..5c1045d5d 100755 --- a/service/marketplace/model.go +++ b/service/marketplace/model.go @@ -1256,6 +1256,8 @@ type ListListingsRequest struct { Assets []AssetType `json:"-" url:"assets,omitempty"` // Matches any of the following categories Categories []Category `json:"-" url:"categories,omitempty"` + + IsAscending bool `json:"-" url:"is_ascending,omitempty"` // Filters each listing based on if it is free. IsFree bool `json:"-" url:"is_free,omitempty"` // Filters each listing based on if it is a private exchange. @@ -1269,7 +1271,7 @@ type ListListingsRequest struct { // Matches any of the following provider ids ProviderIds []string `json:"-" url:"provider_ids,omitempty"` // Criteria for sorting the resulting set of listings. - SortBySpec *SortBySpec `json:"-" url:"sort_by_spec,omitempty"` + SortBy SortBy `json:"-" url:"sort_by,omitempty"` // Matches any of the following tags Tags []ListingTag `json:"-" url:"tags,omitempty"` @@ -1821,6 +1823,8 @@ type SearchListingsRequest struct { // Matches any of the following categories Categories []Category `json:"-" url:"categories,omitempty"` + IsAscending bool `json:"-" url:"is_ascending,omitempty"` + IsFree bool `json:"-" url:"is_free,omitempty"` IsPrivateExchange bool `json:"-" url:"is_private_exchange,omitempty"` @@ -1917,42 +1921,6 @@ func (f *SortBy) Type() string { return "SortBy" } -type SortBySpec struct { - // The field on which to sort the listing. - SortBy SortBy `json:"sort_by" url:"sort_by"` - // The order in which to sort the listing. - SortOrder SortOrder `json:"sort_order" url:"sort_order"` -} - -type SortOrder string - -const SortOrderSortOrderAscending SortOrder = `SORT_ORDER_ASCENDING` - -const SortOrderSortOrderDescending SortOrder = `SORT_ORDER_DESCENDING` - -const SortOrderSortOrderUnspecified SortOrder = `SORT_ORDER_UNSPECIFIED` - -// String representation for [fmt.Print] -func (f *SortOrder) String() string { - return string(*f) -} - -// Set raw string value and validate it against allowed values -func (f *SortOrder) Set(v string) error { - switch v { - case `SORT_ORDER_ASCENDING`, `SORT_ORDER_DESCENDING`, `SORT_ORDER_UNSPECIFIED`: - *f = SortOrder(v) - return nil - default: - return fmt.Errorf(`value "%s" is not one of "SORT_ORDER_ASCENDING", "SORT_ORDER_DESCENDING", "SORT_ORDER_UNSPECIFIED"`, v) - } -} - -// Type always returns SortOrder to satisfy [pflag.Value] interface -func (f *SortOrder) Type() string { - return "SortOrder" -} - type TokenDetail struct { BearerToken string `json:"bearerToken,omitempty"` diff --git a/service/pipelines/model.go b/service/pipelines/model.go index 14e089034..97d104003 100755 --- a/service/pipelines/model.go +++ b/service/pipelines/model.go @@ -37,6 +37,8 @@ type CreatePipeline struct { Edition string `json:"edition,omitempty"` // Filters on which Pipeline packages to include in the deployed graph. Filters *Filters `json:"filters,omitempty"` + // The definition of a gateway pipeline to support CDC. + GatewayDefinition *IngestionGatewayPipelineDefinition `json:"gateway_definition,omitempty"` // Unique identifier for this pipeline. Id string `json:"id,omitempty"` // The configuration for a managed ingestion pipeline. These settings cannot @@ -188,6 +190,8 @@ type EditPipeline struct { ExpectedLastModified int64 `json:"expected_last_modified,omitempty"` // Filters on which Pipeline packages to include in the deployed graph. Filters *Filters `json:"filters,omitempty"` + // The definition of a gateway pipeline to support CDC. + GatewayDefinition *IngestionGatewayPipelineDefinition `json:"gateway_definition,omitempty"` // Unique identifier for this pipeline. Id string `json:"id,omitempty"` // The configuration for a managed ingestion pipeline. These settings cannot @@ -406,6 +410,33 @@ type IngestionConfig struct { Table *TableSpec `json:"table,omitempty"` } +type IngestionGatewayPipelineDefinition struct { + // Immutable. The Unity Catalog connection this gateway pipeline uses to + // communicate with the source. + ConnectionId string `json:"connection_id,omitempty"` + // Required, Immutable. The name of the catalog for the gateway pipeline's + // storage location. + GatewayStorageCatalog string `json:"gateway_storage_catalog,omitempty"` + // Required. The Unity Catalog-compatible naming for the gateway storage + // location. This is the destination to use for the data that is extracted + // by the gateway. Delta Live Tables system will automatically create the + // storage location under the catalog and schema. + GatewayStorageName string `json:"gateway_storage_name,omitempty"` + // Required, Immutable. The name of the schema for the gateway pipelines's + // storage location. + GatewayStorageSchema string `json:"gateway_storage_schema,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *IngestionGatewayPipelineDefinition) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s IngestionGatewayPipelineDefinition) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // List pipeline events type ListPipelineEventsRequest struct { // Criteria to select a subset of results, expressed using a SQL-like @@ -569,6 +600,9 @@ type ManagedIngestionPipelineDefinition struct { // Required. Settings specifying tables to replicate and the destination for // the replicated tables. Objects []IngestionConfig `json:"objects,omitempty"` + // Configuration settings to control the ingestion of tables. These settings + // are applied to all tables in the pipeline. + TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` ForceSendFields []string `json:"-"` } @@ -1071,6 +1105,8 @@ type PipelineSpec struct { Edition string `json:"edition,omitempty"` // Filters on which Pipeline packages to include in the deployed graph. Filters *Filters `json:"filters,omitempty"` + // The definition of a gateway pipeline to support CDC. + GatewayDefinition *IngestionGatewayPipelineDefinition `json:"gateway_definition,omitempty"` // Unique identifier for this pipeline. Id string `json:"id,omitempty"` // The configuration for a managed ingestion pipeline. These settings cannot @@ -1195,6 +1231,11 @@ type SchemaSpec struct { SourceCatalog string `json:"source_catalog,omitempty"` // Required. Schema name in the source database. SourceSchema string `json:"source_schema,omitempty"` + // Configuration settings to control the ingestion of tables. These settings + // are applied to all tables in this schema and override the + // table_configuration defined in the ManagedIngestionPipelineDefinition + // object. + TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` ForceSendFields []string `json:"-"` } @@ -1367,6 +1408,10 @@ type TableSpec struct { SourceSchema string `json:"source_schema,omitempty"` // Required. Table name in the source database. SourceTable string `json:"source_table,omitempty"` + // Configuration settings to control the ingestion of tables. These settings + // override the table_configuration defined in the + // ManagedIngestionPipelineDefinition object and the SchemaSpec. + TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` ForceSendFields []string `json:"-"` } @@ -1379,6 +1424,54 @@ func (s TableSpec) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type TableSpecificConfig struct { + // The primary key of the table used to apply changes. + PrimaryKeys []string `json:"primary_keys,omitempty"` + // If true, formula fields defined in the table are included in the + // ingestion. This setting is only valid for the Salesforce connector + SalesforceIncludeFormulaFields bool `json:"salesforce_include_formula_fields,omitempty"` + // The SCD type to use to ingest the table. + ScdType TableSpecificConfigScdType `json:"scd_type,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *TableSpecificConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s TableSpecificConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// The SCD type to use to ingest the table. +type TableSpecificConfigScdType string + +const TableSpecificConfigScdTypeScdType1 TableSpecificConfigScdType = `SCD_TYPE_1` + +const TableSpecificConfigScdTypeScdType2 TableSpecificConfigScdType = `SCD_TYPE_2` + +// String representation for [fmt.Print] +func (f *TableSpecificConfigScdType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *TableSpecificConfigScdType) Set(v string) error { + switch v { + case `SCD_TYPE_1`, `SCD_TYPE_2`: + *f = TableSpecificConfigScdType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "SCD_TYPE_1", "SCD_TYPE_2"`, v) + } +} + +// Type always returns TableSpecificConfigScdType to satisfy [pflag.Value] interface +func (f *TableSpecificConfigScdType) Type() string { + return "TableSpecificConfigScdType" +} + type UpdateInfo struct { // What triggered this update. Cause UpdateInfoCause `json:"cause,omitempty"` diff --git a/service/pkg.go b/service/pkg.go index a09d4eb9e..a4e8181a9 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -96,8 +96,6 @@ // // - [jobs.JobsAPI]: The Jobs API allows you to create, edit, and delete jobs. // -// - [catalog.LakehouseMonitorsAPI]: A monitor computes and monitors data or model quality metrics for a table over time. -// // - [dashboards.LakeviewAPI]: These APIs provide specific management operations for Lakeview dashboards. // // - [compute.LibrariesAPI]: The Libraries API allows you to install and uninstall libraries and get the status of libraries on a cluster. @@ -152,6 +150,8 @@ // // - [oauth2.PublishedAppIntegrationAPI]: These APIs enable administrators to manage published oauth app integrations, which is required for adding/using Published OAuth App Integration like Tableau Desktop for Databricks in AWS cloud. // +// - [catalog.QualityMonitorsAPI]: A monitor computes and monitors data or model quality metrics for a table over time. +// // - [sql.QueriesAPI]: These endpoints are used for CRUD operations on query definitions. // // - [sql.QueryHistoryAPI]: Access the history of queries through SQL warehouses. @@ -303,7 +303,6 @@ var ( _ *settings.IpAccessListsAPI = nil _ *settings.AccountIpAccessListsAPI = nil _ *jobs.JobsAPI = nil - _ *catalog.LakehouseMonitorsAPI = nil _ *dashboards.LakeviewAPI = nil _ *compute.LibrariesAPI = nil _ *billing.LogDeliveryAPI = nil @@ -331,6 +330,7 @@ var ( _ *marketplace.ProviderProvidersAPI = nil _ *sharing.ProvidersAPI = nil _ *oauth2.PublishedAppIntegrationAPI = nil + _ *catalog.QualityMonitorsAPI = nil _ *sql.QueriesAPI = nil _ *sql.QueryHistoryAPI = nil _ *sql.QueryVisualizationsAPI = nil diff --git a/service/serving/api.go b/service/serving/api.go index adfd0eea3..2771bdba0 100755 --- a/service/serving/api.go +++ b/service/serving/api.go @@ -597,13 +597,13 @@ type ServingEndpointsInterface interface { // // Retrieves the metrics associated with the provided serving endpoint in either // Prometheus or OpenMetrics exposition format. - ExportMetrics(ctx context.Context, request ExportMetricsRequest) error + ExportMetrics(ctx context.Context, request ExportMetricsRequest) (*ExportMetricsResponse, error) // Get metrics of a serving endpoint. // // Retrieves the metrics associated with the provided serving endpoint in either // Prometheus or OpenMetrics exposition format. - ExportMetricsByName(ctx context.Context, name string) error + ExportMetricsByName(ctx context.Context, name string) (*ExportMetricsResponse, error) // Get a single serving endpoint. // @@ -887,7 +887,7 @@ func (a *ServingEndpointsAPI) DeleteByName(ctx context.Context, name string) err // // Retrieves the metrics associated with the provided serving endpoint in either // Prometheus or OpenMetrics exposition format. -func (a *ServingEndpointsAPI) ExportMetrics(ctx context.Context, request ExportMetricsRequest) error { +func (a *ServingEndpointsAPI) ExportMetrics(ctx context.Context, request ExportMetricsRequest) (*ExportMetricsResponse, error) { return a.impl.ExportMetrics(ctx, request) } @@ -895,7 +895,7 @@ func (a *ServingEndpointsAPI) ExportMetrics(ctx context.Context, request ExportM // // Retrieves the metrics associated with the provided serving endpoint in either // Prometheus or OpenMetrics exposition format. -func (a *ServingEndpointsAPI) ExportMetricsByName(ctx context.Context, name string) error { +func (a *ServingEndpointsAPI) ExportMetricsByName(ctx context.Context, name string) (*ExportMetricsResponse, error) { return a.impl.ExportMetrics(ctx, ExportMetricsRequest{ Name: name, }) diff --git a/service/serving/impl.go b/service/serving/impl.go index 72748f570..bbaee1b8f 100755 --- a/service/serving/impl.go +++ b/service/serving/impl.go @@ -142,12 +142,13 @@ func (a *servingEndpointsImpl) Delete(ctx context.Context, request DeleteServing return err } -func (a *servingEndpointsImpl) ExportMetrics(ctx context.Context, request ExportMetricsRequest) error { +func (a *servingEndpointsImpl) ExportMetrics(ctx context.Context, request ExportMetricsRequest) (*ExportMetricsResponse, error) { var exportMetricsResponse ExportMetricsResponse path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/metrics", request.Name) headers := make(map[string]string) + headers["Accept"] = "text/plain" err := a.client.Do(ctx, http.MethodGet, path, headers, request, &exportMetricsResponse) - return err + return &exportMetricsResponse, err } func (a *servingEndpointsImpl) Get(ctx context.Context, request GetServingEndpointRequest) (*ServingEndpointDetailed, error) { diff --git a/service/serving/interface.go b/service/serving/interface.go index c38f73faf..6ee7f076f 100755 --- a/service/serving/interface.go +++ b/service/serving/interface.go @@ -97,7 +97,7 @@ type ServingEndpointsService interface { // // Retrieves the metrics associated with the provided serving endpoint in // either Prometheus or OpenMetrics exposition format. - ExportMetrics(ctx context.Context, request ExportMetricsRequest) error + ExportMetrics(ctx context.Context, request ExportMetricsRequest) (*ExportMetricsResponse, error) // Get a single serving endpoint. // diff --git a/service/serving/model.go b/service/serving/model.go index ba643e483..3441b166a 100755 --- a/service/serving/model.go +++ b/service/serving/model.go @@ -4,6 +4,7 @@ package serving import ( "fmt" + "io" "github.com/databricks/databricks-sdk-go/marshal" ) @@ -106,6 +107,8 @@ type AppDeployment struct { CreateTime string `json:"create_time,omitempty"` // The email of the user creates the deployment. Creator string `json:"creator,omitempty"` + // The deployment artifacts for an app. + DeploymentArtifacts *AppDeploymentArtifacts `json:"deployment_artifacts,omitempty"` // The unique id of the deployment. DeploymentId string `json:"deployment_id,omitempty"` // The source code path of the deployment. @@ -126,6 +129,21 @@ func (s AppDeployment) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type AppDeploymentArtifacts struct { + // The source code of the deployment. + SourceCodePath string `json:"source_code_path,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *AppDeploymentArtifacts) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AppDeploymentArtifacts) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type AppDeploymentState string const AppDeploymentStateCancelled AppDeploymentState = `CANCELLED` @@ -136,6 +154,8 @@ const AppDeploymentStateInProgress AppDeploymentState = `IN_PROGRESS` const AppDeploymentStateStateUnspecified AppDeploymentState = `STATE_UNSPECIFIED` +const AppDeploymentStateStopped AppDeploymentState = `STOPPED` + const AppDeploymentStateSucceeded AppDeploymentState = `SUCCEEDED` // String representation for [fmt.Print] @@ -146,11 +166,11 @@ func (f *AppDeploymentState) String() string { // Set raw string value and validate it against allowed values func (f *AppDeploymentState) Set(v string) error { switch v { - case `CANCELLED`, `FAILED`, `IN_PROGRESS`, `STATE_UNSPECIFIED`, `SUCCEEDED`: + case `CANCELLED`, `FAILED`, `IN_PROGRESS`, `STATE_UNSPECIFIED`, `STOPPED`, `SUCCEEDED`: *f = AppDeploymentState(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "CANCELLED", "FAILED", "IN_PROGRESS", "STATE_UNSPECIFIED", "SUCCEEDED"`, v) + return fmt.Errorf(`value "%s" is not one of "CANCELLED", "FAILED", "IN_PROGRESS", "STATE_UNSPECIFIED", "STOPPED", "SUCCEEDED"`, v) } } @@ -399,9 +419,21 @@ type CreateServingEndpoint struct { // Rate limits to be applied to the serving endpoint. NOTE: only external // and foundation model endpoints are supported as of now. RateLimits []RateLimit `json:"rate_limits,omitempty"` + // Enable route optimization for the serving endpoint. + RouteOptimized bool `json:"route_optimized,omitempty"` // Tags to be attached to the serving endpoint and automatically propagated // to billing logs. Tags []EndpointTag `json:"tags,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *CreateServingEndpoint) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateServingEndpoint) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DatabricksModelServingConfig struct { @@ -682,6 +714,7 @@ type ExportMetricsRequest struct { } type ExportMetricsResponse struct { + Contents io.ReadCloser `json:"-"` } type ExternalModel struct { @@ -1773,6 +1806,8 @@ type ServingEndpointDetailed struct { CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // The email of the user who created the serving endpoint. Creator string `json:"creator,omitempty"` + // Endpoint invocation url if route optimization is enabled for endpoint + EndpointUrl string `json:"endpoint_url,omitempty"` // System-generated ID of the endpoint. This is used to refer to the // endpoint in the Permissions API Id string `json:"id,omitempty"` @@ -1784,6 +1819,9 @@ type ServingEndpointDetailed struct { PendingConfig *EndpointPendingConfig `json:"pending_config,omitempty"` // The permission level of the principal making the request. PermissionLevel ServingEndpointDetailedPermissionLevel `json:"permission_level,omitempty"` + // Boolean representing if route optimization has been enabled for the + // endpoint + RouteOptimized bool `json:"route_optimized,omitempty"` // Information corresponding to the state of the serving endpoint. State *EndpointState `json:"state,omitempty"` // Tags attached to the serving endpoint. diff --git a/service/vectorsearch/api.go b/service/vectorsearch/api.go index 115d0ab7f..a763a1dbc 100755 --- a/service/vectorsearch/api.go +++ b/service/vectorsearch/api.go @@ -314,6 +314,12 @@ type VectorSearchIndexesInterface interface { // Query the specified vector index. QueryIndex(ctx context.Context, request QueryVectorIndexRequest) (*QueryVectorIndexResponse, error) + // Scan an index. + // + // Scan the specified vector index and return the first `num_results` entries + // after the exclusive `primary_key`. + ScanIndex(ctx context.Context, request ScanVectorIndexRequest) (*ScanVectorIndexResponse, error) + // Synchronize an index. // // Triggers a synchronization process for a specified vector index. @@ -455,6 +461,14 @@ func (a *VectorSearchIndexesAPI) QueryIndex(ctx context.Context, request QueryVe return a.impl.QueryIndex(ctx, request) } +// Scan an index. +// +// Scan the specified vector index and return the first `num_results` entries +// after the exclusive `primary_key`. +func (a *VectorSearchIndexesAPI) ScanIndex(ctx context.Context, request ScanVectorIndexRequest) (*ScanVectorIndexResponse, error) { + return a.impl.ScanIndex(ctx, request) +} + // Synchronize an index. // // Triggers a synchronization process for a specified vector index. diff --git a/service/vectorsearch/impl.go b/service/vectorsearch/impl.go index dbb171ab4..976099dfa 100755 --- a/service/vectorsearch/impl.go +++ b/service/vectorsearch/impl.go @@ -112,6 +112,16 @@ func (a *vectorSearchIndexesImpl) QueryIndex(ctx context.Context, request QueryV return &queryVectorIndexResponse, err } +func (a *vectorSearchIndexesImpl) ScanIndex(ctx context.Context, request ScanVectorIndexRequest) (*ScanVectorIndexResponse, error) { + var scanVectorIndexResponse ScanVectorIndexResponse + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/scan", request.IndexName) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, request, &scanVectorIndexResponse) + return &scanVectorIndexResponse, err +} + func (a *vectorSearchIndexesImpl) SyncIndex(ctx context.Context, request SyncIndexRequest) error { var syncIndexResponse SyncIndexResponse path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/sync", request.IndexName) diff --git a/service/vectorsearch/interface.go b/service/vectorsearch/interface.go index 067b40156..9c416c3fd 100755 --- a/service/vectorsearch/interface.go +++ b/service/vectorsearch/interface.go @@ -70,6 +70,12 @@ type VectorSearchIndexesService interface { // Query the specified vector index. QueryIndex(ctx context.Context, request QueryVectorIndexRequest) (*QueryVectorIndexResponse, error) + // Scan an index. + // + // Scan the specified vector index and return the first `num_results` + // entries after the exclusive `primary_key`. + ScanIndex(ctx context.Context, request ScanVectorIndexRequest) (*ScanVectorIndexResponse, error) + // Synchronize an index. // // Triggers a synchronization process for a specified vector index. diff --git a/service/vectorsearch/model.go b/service/vectorsearch/model.go index 9e68d0b21..80899e39d 100755 --- a/service/vectorsearch/model.go +++ b/service/vectorsearch/model.go @@ -143,7 +143,8 @@ type DeleteIndexResponse struct { type DeltaSyncVectorIndexSpecRequest struct { // The columns that contain the embedding source. EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` - // The columns that contain the embedding vectors. + // The columns that contain the embedding vectors. The format should be + // array[double]. EmbeddingVectorColumns []EmbeddingVectorColumn `json:"embedding_vector_columns,omitempty"` // Pipeline execution mode. // @@ -425,6 +426,10 @@ func (s ListIndexesRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListValue struct { + Values []Value `json:"values,omitempty"` +} + type ListVectorIndexesResponse struct { // A token that can be used to get the next page of results. If not present, // there are no more results to show. @@ -443,6 +448,24 @@ func (s ListVectorIndexesResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Key-value pair. +type MapStringValueEntry struct { + // Column name. + Key string `json:"key,omitempty"` + // Column value, nullable. + Value *Value `json:"value,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *MapStringValueEntry) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s MapStringValueEntry) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type MiniVectorIndex struct { // The user who created the index. Creator string `json:"creator,omitempty"` @@ -589,6 +612,49 @@ func (s ResultManifest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Request payload for scanning data from a vector index. +type ScanVectorIndexRequest struct { + // Name of the vector index to scan. + IndexName string `json:"-" url:"-"` + // Primary key of the last entry returned in the previous scan. + LastPrimaryKey string `json:"last_primary_key,omitempty"` + // Number of results to return. Defaults to 10. + NumResults int `json:"num_results,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ScanVectorIndexRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ScanVectorIndexRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Response to a scan vector index request. +type ScanVectorIndexResponse struct { + // List of data entries + Data []Struct `json:"data,omitempty"` + // Primary key of the last entry. + LastPrimaryKey string `json:"last_primary_key,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ScanVectorIndexResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ScanVectorIndexResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type Struct struct { + // Data entry, corresponding to a row in a vector index. + Fields []MapStringValueEntry `json:"fields,omitempty"` +} + // Synchronize an index type SyncIndexRequest struct { // Name of the vector index to synchronize. Must be a Delta Sync Index. @@ -663,6 +729,30 @@ type UpsertDataVectorIndexResponse struct { Status UpsertDataStatus `json:"status,omitempty"` } +type Value struct { + BoolValue bool `json:"bool_value,omitempty"` + + ListValue *ListValue `json:"list_value,omitempty"` + + NullValue string `json:"null_value,omitempty"` + + NumberValue float64 `json:"number_value,omitempty"` + + StringValue string `json:"string_value,omitempty"` + + StructValue *Struct `json:"struct_value,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *Value) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Value) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type VectorIndex struct { // The user who created the index. Creator string `json:"creator,omitempty"` diff --git a/service/workspace/model.go b/service/workspace/model.go index 2ddf9f843..1d4a1274a 100755 --- a/service/workspace/model.go +++ b/service/workspace/model.go @@ -114,8 +114,9 @@ func (s CreateCredentialsResponse) MarshalJSON() ([]byte, error) { } type CreateRepo struct { - // Desired path for the repo in the workspace. Must be in the format - // /Repos/{folder}/{repo-name}. + // Desired path for the repo in the workspace. Almost any path in the + // workspace can be chosen. If repo is created in /Repos, path must be in + // the format /Repos/{folder}/{repo-name}. Path string `json:"path,omitempty"` // Git provider. This field is case-insensitive. The available Git providers // are gitHub, bitbucketCloud, gitLab, azureDevOpsServices, @@ -574,7 +575,8 @@ type ListReposRequest struct { // first page of results as well as a next page token if there are more // results. NextPageToken string `json:"-" url:"next_page_token,omitempty"` - // Filters repos that have paths starting with the given path prefix. + // Filters repos that have paths starting with the given path prefix. If not + // provided repos from /Repos will be served. PathPrefix string `json:"-" url:"path_prefix,omitempty"` ForceSendFields []string `json:"-"` @@ -823,8 +825,9 @@ type RepoInfo struct { HeadCommitId string `json:"head_commit_id,omitempty"` // ID of the repo object in the workspace. Id int64 `json:"id,omitempty"` - // Desired path for the repo in the workspace. Must be in the format - // /Repos/{folder}/{repo-name}. + // Desired path for the repo in the workspace. Almost any path in the + // workspace can be chosen. If repo is created in /Repos, path must be in + // the format /Repos/{folder}/{repo-name}. Path string `json:"path,omitempty"` // Git provider. This field is case-insensitive. The available Git providers // are gitHub, bitbucketCloud, gitLab, azureDevOpsServices, diff --git a/workspace_client.go b/workspace_client.go index 06f39a766..38b535e0f 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -382,17 +382,6 @@ type WorkspaceClient struct { // [Secrets utility]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-secrets Jobs jobs.JobsInterface - // A monitor computes and monitors data or model quality metrics for a table - // over time. It generates metrics tables and a dashboard that you can use - // to monitor table health and set alerts. - // - // Most write operations require the user to be the owner of the table (or - // its parent schema or parent catalog). Viewing the dashboard, computed - // metrics, or monitor configuration only requires the user to have - // **SELECT** privileges on the table (along with **USE_SCHEMA** and - // **USE_CATALOG**). - LakehouseMonitors catalog.LakehouseMonitorsInterface - // These APIs provide specific management operations for Lakeview // dashboards. Generic resource management can be done with Workspace API // (import, export, get-status, list, delete). @@ -574,6 +563,17 @@ type WorkspaceClient struct { // contain the shared data. Providers sharing.ProvidersInterface + // A monitor computes and monitors data or model quality metrics for a table + // over time. It generates metrics tables and a dashboard that you can use + // to monitor table health and set alerts. + // + // Most write operations require the user to be the owner of the table (or + // its parent schema or parent catalog). Viewing the dashboard, computed + // metrics, or monitor configuration only requires the user to have + // **SELECT** privileges on the table (along with **USE_SCHEMA** and + // **USE_CATALOG**). + QualityMonitors catalog.QualityMonitorsInterface + // These endpoints are used for CRUD operations on query definitions. Query // definitions include the target SQL warehouse, query text, name, // description, tags, parameters, and visualizations. Queries can be @@ -1036,7 +1036,6 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { InstanceProfiles: compute.NewInstanceProfiles(databricksClient), IpAccessLists: settings.NewIpAccessLists(databricksClient), Jobs: jobs.NewJobs(databricksClient), - LakehouseMonitors: catalog.NewLakehouseMonitors(databricksClient), Lakeview: dashboards.NewLakeview(databricksClient), Libraries: compute.NewLibraries(databricksClient), Metastores: catalog.NewMetastores(databricksClient), @@ -1055,6 +1054,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { ProviderProviderAnalyticsDashboards: marketplace.NewProviderProviderAnalyticsDashboards(databricksClient), ProviderProviders: marketplace.NewProviderProviders(databricksClient), Providers: sharing.NewProviders(databricksClient), + QualityMonitors: catalog.NewQualityMonitors(databricksClient), Queries: sql.NewQueries(databricksClient), QueryHistory: sql.NewQueryHistory(databricksClient), QueryVisualizations: sql.NewQueryVisualizations(databricksClient),