From 45edad8cc0953869254c911cd620b2710b28763a Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 7 Jun 2024 11:00:16 +0200 Subject: [PATCH 1/3] Generate from latest spec --- .codegen/_openapi_sha | 2 +- experimental/mocks/mock_workspace_client.go | 9 + .../catalog/mock_endpoints_interface.go | 404 ++++++ .../dashboards/mock_lakeview_interface.go | 1216 +++++++++++++++-- service/catalog/api.go | 86 +- service/catalog/impl.go | 33 + service/catalog/interface.go | 13 + service/catalog/model.go | 93 +- service/compute/model.go | 6 +- service/dashboards/api.go | 215 +++ service/dashboards/impl.go | 84 ++ service/dashboards/interface.go | 31 + service/dashboards/model.go | 335 +++++ service/iam/model.go | 6 +- service/jobs/model.go | 39 + service/pipelines/model.go | 2 +- service/pkg.go | 3 + service/serving/model.go | 4 + service/sql/model.go | 9 +- workspace_client.go | 4 + 20 files changed, 2433 insertions(+), 161 deletions(-) create mode 100644 experimental/mocks/service/catalog/mock_endpoints_interface.go diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index de0f45ab9..2efdf11e6 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -37b925eba37dfb3d7e05b6ba2d458454ce62d3a0 \ No newline at end of file +fc26589775a1c48b14211cd11b6903d1b4ed071c \ No newline at end of file diff --git a/experimental/mocks/mock_workspace_client.go b/experimental/mocks/mock_workspace_client.go index 79f03eccf..d5736f5d4 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -61,6 +61,7 @@ func NewMockWorkspaceClient(t interface { DataSources: sql.NewMockDataSourcesInterface(t), Dbfs: files.NewMockDbfsInterface(t), DbsqlPermissions: sql.NewMockDbsqlPermissionsInterface(t), + Endpoints: catalog.NewMockEndpointsInterface(t), Experiments: ml.NewMockExperimentsInterface(t), ExternalLocations: catalog.NewMockExternalLocationsInterface(t), Files: files.NewMockFilesInterface(t), @@ -359,6 +360,14 @@ func (m *MockWorkspaceClient) GetMockDbsqlPermissionsAPI() *sql.MockDbsqlPermiss return api } +func (m *MockWorkspaceClient) GetMockEndpointsAPI() *catalog.MockEndpointsInterface { + api, ok := m.WorkspaceClient.Endpoints.(*catalog.MockEndpointsInterface) + if !ok { + panic(fmt.Sprintf("expected Endpoints to be *catalog.MockEndpointsInterface, actual was %T", m.WorkspaceClient.Endpoints)) + } + return api +} + func (m *MockWorkspaceClient) GetMockExperimentsAPI() *ml.MockExperimentsInterface { api, ok := m.WorkspaceClient.Experiments.(*ml.MockExperimentsInterface) if !ok { diff --git a/experimental/mocks/service/catalog/mock_endpoints_interface.go b/experimental/mocks/service/catalog/mock_endpoints_interface.go new file mode 100644 index 000000000..c2f86f08b --- /dev/null +++ b/experimental/mocks/service/catalog/mock_endpoints_interface.go @@ -0,0 +1,404 @@ +// 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" +) + +// MockEndpointsInterface is an autogenerated mock type for the EndpointsInterface type +type MockEndpointsInterface struct { + mock.Mock +} + +type MockEndpointsInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockEndpointsInterface) EXPECT() *MockEndpointsInterface_Expecter { + return &MockEndpointsInterface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockEndpointsInterface) Create(ctx context.Context, request catalog.CreateEndpointRequest) (*catalog.Endpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *catalog.Endpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateEndpointRequest) (*catalog.Endpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateEndpointRequest) *catalog.Endpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.Endpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.CreateEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEndpointsInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockEndpointsInterface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.CreateEndpointRequest +func (_e *MockEndpointsInterface_Expecter) Create(ctx interface{}, request interface{}) *MockEndpointsInterface_Create_Call { + return &MockEndpointsInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockEndpointsInterface_Create_Call) Run(run func(ctx context.Context, request catalog.CreateEndpointRequest)) *MockEndpointsInterface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.CreateEndpointRequest)) + }) + return _c +} + +func (_c *MockEndpointsInterface_Create_Call) Return(_a0 *catalog.Endpoint, _a1 error) *MockEndpointsInterface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEndpointsInterface_Create_Call) RunAndReturn(run func(context.Context, catalog.CreateEndpointRequest) (*catalog.Endpoint, error)) *MockEndpointsInterface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockEndpointsInterface) Delete(ctx context.Context, request catalog.DeleteEndpointRequest) 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.DeleteEndpointRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockEndpointsInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockEndpointsInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.DeleteEndpointRequest +func (_e *MockEndpointsInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockEndpointsInterface_Delete_Call { + return &MockEndpointsInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockEndpointsInterface_Delete_Call) Run(run func(ctx context.Context, request catalog.DeleteEndpointRequest)) *MockEndpointsInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.DeleteEndpointRequest)) + }) + return _c +} + +func (_c *MockEndpointsInterface_Delete_Call) Return(_a0 error) *MockEndpointsInterface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEndpointsInterface_Delete_Call) RunAndReturn(run func(context.Context, catalog.DeleteEndpointRequest) error) *MockEndpointsInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// DeleteByName provides a mock function with given fields: ctx, name +func (_m *MockEndpointsInterface) DeleteByName(ctx context.Context, name string) error { + ret := _m.Called(ctx, name) + + if len(ret) == 0 { + panic("no return value specified for DeleteByName") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockEndpointsInterface_DeleteByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByName' +type MockEndpointsInterface_DeleteByName_Call struct { + *mock.Call +} + +// DeleteByName is a helper method to define mock.On call +// - ctx context.Context +// - name string +func (_e *MockEndpointsInterface_Expecter) DeleteByName(ctx interface{}, name interface{}) *MockEndpointsInterface_DeleteByName_Call { + return &MockEndpointsInterface_DeleteByName_Call{Call: _e.mock.On("DeleteByName", ctx, name)} +} + +func (_c *MockEndpointsInterface_DeleteByName_Call) Run(run func(ctx context.Context, name string)) *MockEndpointsInterface_DeleteByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockEndpointsInterface_DeleteByName_Call) Return(_a0 error) *MockEndpointsInterface_DeleteByName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEndpointsInterface_DeleteByName_Call) RunAndReturn(run func(context.Context, string) error) *MockEndpointsInterface_DeleteByName_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockEndpointsInterface) Get(ctx context.Context, request catalog.GetEndpointRequest) (*catalog.Endpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *catalog.Endpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetEndpointRequest) (*catalog.Endpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetEndpointRequest) *catalog.Endpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.Endpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.GetEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEndpointsInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockEndpointsInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.GetEndpointRequest +func (_e *MockEndpointsInterface_Expecter) Get(ctx interface{}, request interface{}) *MockEndpointsInterface_Get_Call { + return &MockEndpointsInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockEndpointsInterface_Get_Call) Run(run func(ctx context.Context, request catalog.GetEndpointRequest)) *MockEndpointsInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.GetEndpointRequest)) + }) + return _c +} + +func (_c *MockEndpointsInterface_Get_Call) Return(_a0 *catalog.Endpoint, _a1 error) *MockEndpointsInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEndpointsInterface_Get_Call) RunAndReturn(run func(context.Context, catalog.GetEndpointRequest) (*catalog.Endpoint, error)) *MockEndpointsInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetByName provides a mock function with given fields: ctx, name +func (_m *MockEndpointsInterface) GetByName(ctx context.Context, name string) (*catalog.Endpoint, error) { + ret := _m.Called(ctx, name) + + if len(ret) == 0 { + panic("no return value specified for GetByName") + } + + var r0 *catalog.Endpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*catalog.Endpoint, error)); ok { + return rf(ctx, name) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *catalog.Endpoint); ok { + r0 = rf(ctx, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.Endpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEndpointsInterface_GetByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByName' +type MockEndpointsInterface_GetByName_Call struct { + *mock.Call +} + +// GetByName is a helper method to define mock.On call +// - ctx context.Context +// - name string +func (_e *MockEndpointsInterface_Expecter) GetByName(ctx interface{}, name interface{}) *MockEndpointsInterface_GetByName_Call { + return &MockEndpointsInterface_GetByName_Call{Call: _e.mock.On("GetByName", ctx, name)} +} + +func (_c *MockEndpointsInterface_GetByName_Call) Run(run func(ctx context.Context, name string)) *MockEndpointsInterface_GetByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockEndpointsInterface_GetByName_Call) Return(_a0 *catalog.Endpoint, _a1 error) *MockEndpointsInterface_GetByName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEndpointsInterface_GetByName_Call) RunAndReturn(run func(context.Context, string) (*catalog.Endpoint, error)) *MockEndpointsInterface_GetByName_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockEndpointsInterface) Impl() catalog.EndpointsService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 catalog.EndpointsService + if rf, ok := ret.Get(0).(func() catalog.EndpointsService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(catalog.EndpointsService) + } + } + + return r0 +} + +// MockEndpointsInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockEndpointsInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockEndpointsInterface_Expecter) Impl() *MockEndpointsInterface_Impl_Call { + return &MockEndpointsInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockEndpointsInterface_Impl_Call) Run(run func()) *MockEndpointsInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEndpointsInterface_Impl_Call) Return(_a0 catalog.EndpointsService) *MockEndpointsInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEndpointsInterface_Impl_Call) RunAndReturn(run func() catalog.EndpointsService) *MockEndpointsInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockEndpointsInterface) WithImpl(impl catalog.EndpointsService) catalog.EndpointsInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 catalog.EndpointsInterface + if rf, ok := ret.Get(0).(func(catalog.EndpointsService) catalog.EndpointsInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(catalog.EndpointsInterface) + } + } + + return r0 +} + +// MockEndpointsInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockEndpointsInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl catalog.EndpointsService +func (_e *MockEndpointsInterface_Expecter) WithImpl(impl interface{}) *MockEndpointsInterface_WithImpl_Call { + return &MockEndpointsInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockEndpointsInterface_WithImpl_Call) Run(run func(impl catalog.EndpointsService)) *MockEndpointsInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(catalog.EndpointsService)) + }) + return _c +} + +func (_c *MockEndpointsInterface_WithImpl_Call) Return(_a0 catalog.EndpointsInterface) *MockEndpointsInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEndpointsInterface_WithImpl_Call) RunAndReturn(run func(catalog.EndpointsService) catalog.EndpointsInterface) *MockEndpointsInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockEndpointsInterface creates a new instance of MockEndpointsInterface. 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 NewMockEndpointsInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockEndpointsInterface { + mock := &MockEndpointsInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/dashboards/mock_lakeview_interface.go b/experimental/mocks/service/dashboards/mock_lakeview_interface.go index db05a87d9..48a91c8a8 100644 --- a/experimental/mocks/service/dashboards/mock_lakeview_interface.go +++ b/experimental/mocks/service/dashboards/mock_lakeview_interface.go @@ -5,104 +5,986 @@ package dashboards import ( context "context" + listing "github.com/databricks/databricks-sdk-go/listing" dashboards "github.com/databricks/databricks-sdk-go/service/dashboards" + mock "github.com/stretchr/testify/mock" ) -// MockLakeviewInterface is an autogenerated mock type for the LakeviewInterface type -type MockLakeviewInterface struct { - mock.Mock +// MockLakeviewInterface is an autogenerated mock type for the LakeviewInterface type +type MockLakeviewInterface struct { + mock.Mock +} + +type MockLakeviewInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockLakeviewInterface) EXPECT() *MockLakeviewInterface_Expecter { + return &MockLakeviewInterface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) Create(ctx context.Context, request dashboards.CreateDashboardRequest) (*dashboards.Dashboard, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *dashboards.Dashboard + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.CreateDashboardRequest) (*dashboards.Dashboard, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.CreateDashboardRequest) *dashboards.Dashboard); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.Dashboard) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.CreateDashboardRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockLakeviewInterface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.CreateDashboardRequest +func (_e *MockLakeviewInterface_Expecter) Create(ctx interface{}, request interface{}) *MockLakeviewInterface_Create_Call { + return &MockLakeviewInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockLakeviewInterface_Create_Call) Run(run func(ctx context.Context, request dashboards.CreateDashboardRequest)) *MockLakeviewInterface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.CreateDashboardRequest)) + }) + return _c +} + +func (_c *MockLakeviewInterface_Create_Call) Return(_a0 *dashboards.Dashboard, _a1 error) *MockLakeviewInterface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_Create_Call) RunAndReturn(run func(context.Context, dashboards.CreateDashboardRequest) (*dashboards.Dashboard, error)) *MockLakeviewInterface_Create_Call { + _c.Call.Return(run) + return _c +} + +// CreateSchedule provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) CreateSchedule(ctx context.Context, request dashboards.CreateScheduleRequest) (*dashboards.Schedule, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateSchedule") + } + + var r0 *dashboards.Schedule + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.CreateScheduleRequest) (*dashboards.Schedule, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.CreateScheduleRequest) *dashboards.Schedule); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.Schedule) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.CreateScheduleRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_CreateSchedule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateSchedule' +type MockLakeviewInterface_CreateSchedule_Call struct { + *mock.Call +} + +// CreateSchedule is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.CreateScheduleRequest +func (_e *MockLakeviewInterface_Expecter) CreateSchedule(ctx interface{}, request interface{}) *MockLakeviewInterface_CreateSchedule_Call { + return &MockLakeviewInterface_CreateSchedule_Call{Call: _e.mock.On("CreateSchedule", ctx, request)} +} + +func (_c *MockLakeviewInterface_CreateSchedule_Call) Run(run func(ctx context.Context, request dashboards.CreateScheduleRequest)) *MockLakeviewInterface_CreateSchedule_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.CreateScheduleRequest)) + }) + return _c +} + +func (_c *MockLakeviewInterface_CreateSchedule_Call) Return(_a0 *dashboards.Schedule, _a1 error) *MockLakeviewInterface_CreateSchedule_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_CreateSchedule_Call) RunAndReturn(run func(context.Context, dashboards.CreateScheduleRequest) (*dashboards.Schedule, error)) *MockLakeviewInterface_CreateSchedule_Call { + _c.Call.Return(run) + return _c +} + +// CreateSubscription provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) CreateSubscription(ctx context.Context, request dashboards.CreateSubscriptionRequest) (*dashboards.Subscription, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateSubscription") + } + + var r0 *dashboards.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.CreateSubscriptionRequest) (*dashboards.Subscription, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.CreateSubscriptionRequest) *dashboards.Subscription); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.CreateSubscriptionRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_CreateSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateSubscription' +type MockLakeviewInterface_CreateSubscription_Call struct { + *mock.Call +} + +// CreateSubscription is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.CreateSubscriptionRequest +func (_e *MockLakeviewInterface_Expecter) CreateSubscription(ctx interface{}, request interface{}) *MockLakeviewInterface_CreateSubscription_Call { + return &MockLakeviewInterface_CreateSubscription_Call{Call: _e.mock.On("CreateSubscription", ctx, request)} +} + +func (_c *MockLakeviewInterface_CreateSubscription_Call) Run(run func(ctx context.Context, request dashboards.CreateSubscriptionRequest)) *MockLakeviewInterface_CreateSubscription_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.CreateSubscriptionRequest)) + }) + return _c +} + +func (_c *MockLakeviewInterface_CreateSubscription_Call) Return(_a0 *dashboards.Subscription, _a1 error) *MockLakeviewInterface_CreateSubscription_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_CreateSubscription_Call) RunAndReturn(run func(context.Context, dashboards.CreateSubscriptionRequest) (*dashboards.Subscription, error)) *MockLakeviewInterface_CreateSubscription_Call { + _c.Call.Return(run) + return _c +} + +// DeleteSchedule provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) DeleteSchedule(ctx context.Context, request dashboards.DeleteScheduleRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteSchedule") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.DeleteScheduleRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLakeviewInterface_DeleteSchedule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteSchedule' +type MockLakeviewInterface_DeleteSchedule_Call struct { + *mock.Call +} + +// DeleteSchedule is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.DeleteScheduleRequest +func (_e *MockLakeviewInterface_Expecter) DeleteSchedule(ctx interface{}, request interface{}) *MockLakeviewInterface_DeleteSchedule_Call { + return &MockLakeviewInterface_DeleteSchedule_Call{Call: _e.mock.On("DeleteSchedule", ctx, request)} +} + +func (_c *MockLakeviewInterface_DeleteSchedule_Call) Run(run func(ctx context.Context, request dashboards.DeleteScheduleRequest)) *MockLakeviewInterface_DeleteSchedule_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.DeleteScheduleRequest)) + }) + return _c +} + +func (_c *MockLakeviewInterface_DeleteSchedule_Call) Return(_a0 error) *MockLakeviewInterface_DeleteSchedule_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLakeviewInterface_DeleteSchedule_Call) RunAndReturn(run func(context.Context, dashboards.DeleteScheduleRequest) error) *MockLakeviewInterface_DeleteSchedule_Call { + _c.Call.Return(run) + return _c +} + +// DeleteScheduleByDashboardIdAndScheduleId provides a mock function with given fields: ctx, dashboardId, scheduleId +func (_m *MockLakeviewInterface) DeleteScheduleByDashboardIdAndScheduleId(ctx context.Context, dashboardId string, scheduleId string) error { + ret := _m.Called(ctx, dashboardId, scheduleId) + + if len(ret) == 0 { + panic("no return value specified for DeleteScheduleByDashboardIdAndScheduleId") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { + r0 = rf(ctx, dashboardId, scheduleId) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLakeviewInterface_DeleteScheduleByDashboardIdAndScheduleId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteScheduleByDashboardIdAndScheduleId' +type MockLakeviewInterface_DeleteScheduleByDashboardIdAndScheduleId_Call struct { + *mock.Call +} + +// DeleteScheduleByDashboardIdAndScheduleId is a helper method to define mock.On call +// - ctx context.Context +// - dashboardId string +// - scheduleId string +func (_e *MockLakeviewInterface_Expecter) DeleteScheduleByDashboardIdAndScheduleId(ctx interface{}, dashboardId interface{}, scheduleId interface{}) *MockLakeviewInterface_DeleteScheduleByDashboardIdAndScheduleId_Call { + return &MockLakeviewInterface_DeleteScheduleByDashboardIdAndScheduleId_Call{Call: _e.mock.On("DeleteScheduleByDashboardIdAndScheduleId", ctx, dashboardId, scheduleId)} +} + +func (_c *MockLakeviewInterface_DeleteScheduleByDashboardIdAndScheduleId_Call) Run(run func(ctx context.Context, dashboardId string, scheduleId string)) *MockLakeviewInterface_DeleteScheduleByDashboardIdAndScheduleId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockLakeviewInterface_DeleteScheduleByDashboardIdAndScheduleId_Call) Return(_a0 error) *MockLakeviewInterface_DeleteScheduleByDashboardIdAndScheduleId_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLakeviewInterface_DeleteScheduleByDashboardIdAndScheduleId_Call) RunAndReturn(run func(context.Context, string, string) error) *MockLakeviewInterface_DeleteScheduleByDashboardIdAndScheduleId_Call { + _c.Call.Return(run) + return _c +} + +// DeleteSubscription provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) DeleteSubscription(ctx context.Context, request dashboards.DeleteSubscriptionRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteSubscription") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.DeleteSubscriptionRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLakeviewInterface_DeleteSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteSubscription' +type MockLakeviewInterface_DeleteSubscription_Call struct { + *mock.Call +} + +// DeleteSubscription is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.DeleteSubscriptionRequest +func (_e *MockLakeviewInterface_Expecter) DeleteSubscription(ctx interface{}, request interface{}) *MockLakeviewInterface_DeleteSubscription_Call { + return &MockLakeviewInterface_DeleteSubscription_Call{Call: _e.mock.On("DeleteSubscription", ctx, request)} +} + +func (_c *MockLakeviewInterface_DeleteSubscription_Call) Run(run func(ctx context.Context, request dashboards.DeleteSubscriptionRequest)) *MockLakeviewInterface_DeleteSubscription_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.DeleteSubscriptionRequest)) + }) + return _c +} + +func (_c *MockLakeviewInterface_DeleteSubscription_Call) Return(_a0 error) *MockLakeviewInterface_DeleteSubscription_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLakeviewInterface_DeleteSubscription_Call) RunAndReturn(run func(context.Context, dashboards.DeleteSubscriptionRequest) error) *MockLakeviewInterface_DeleteSubscription_Call { + _c.Call.Return(run) + return _c +} + +// DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId provides a mock function with given fields: ctx, dashboardId, scheduleId, subscriptionId +func (_m *MockLakeviewInterface) DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId(ctx context.Context, dashboardId string, scheduleId string, subscriptionId string) error { + ret := _m.Called(ctx, dashboardId, scheduleId, subscriptionId) + + if len(ret) == 0 { + panic("no return value specified for DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string) error); ok { + r0 = rf(ctx, dashboardId, scheduleId, subscriptionId) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLakeviewInterface_DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId' +type MockLakeviewInterface_DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call struct { + *mock.Call +} + +// DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId is a helper method to define mock.On call +// - ctx context.Context +// - dashboardId string +// - scheduleId string +// - subscriptionId string +func (_e *MockLakeviewInterface_Expecter) DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId(ctx interface{}, dashboardId interface{}, scheduleId interface{}, subscriptionId interface{}) *MockLakeviewInterface_DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call { + return &MockLakeviewInterface_DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call{Call: _e.mock.On("DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId", ctx, dashboardId, scheduleId, subscriptionId)} +} + +func (_c *MockLakeviewInterface_DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call) Run(run func(ctx context.Context, dashboardId string, scheduleId string, subscriptionId string)) *MockLakeviewInterface_DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(string)) + }) + return _c +} + +func (_c *MockLakeviewInterface_DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call) Return(_a0 error) *MockLakeviewInterface_DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLakeviewInterface_DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call) RunAndReturn(run func(context.Context, string, string, string) error) *MockLakeviewInterface_DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) Get(ctx context.Context, request dashboards.GetDashboardRequest) (*dashboards.Dashboard, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *dashboards.Dashboard + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetDashboardRequest) (*dashboards.Dashboard, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetDashboardRequest) *dashboards.Dashboard); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.Dashboard) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GetDashboardRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockLakeviewInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GetDashboardRequest +func (_e *MockLakeviewInterface_Expecter) Get(ctx interface{}, request interface{}) *MockLakeviewInterface_Get_Call { + return &MockLakeviewInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockLakeviewInterface_Get_Call) Run(run func(ctx context.Context, request dashboards.GetDashboardRequest)) *MockLakeviewInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GetDashboardRequest)) + }) + return _c +} + +func (_c *MockLakeviewInterface_Get_Call) Return(_a0 *dashboards.Dashboard, _a1 error) *MockLakeviewInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_Get_Call) RunAndReturn(run func(context.Context, dashboards.GetDashboardRequest) (*dashboards.Dashboard, error)) *MockLakeviewInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetByDashboardId provides a mock function with given fields: ctx, dashboardId +func (_m *MockLakeviewInterface) GetByDashboardId(ctx context.Context, dashboardId string) (*dashboards.Dashboard, error) { + ret := _m.Called(ctx, dashboardId) + + if len(ret) == 0 { + panic("no return value specified for GetByDashboardId") + } + + var r0 *dashboards.Dashboard + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*dashboards.Dashboard, error)); ok { + return rf(ctx, dashboardId) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *dashboards.Dashboard); ok { + r0 = rf(ctx, dashboardId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.Dashboard) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, dashboardId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_GetByDashboardId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByDashboardId' +type MockLakeviewInterface_GetByDashboardId_Call struct { + *mock.Call +} + +// GetByDashboardId is a helper method to define mock.On call +// - ctx context.Context +// - dashboardId string +func (_e *MockLakeviewInterface_Expecter) GetByDashboardId(ctx interface{}, dashboardId interface{}) *MockLakeviewInterface_GetByDashboardId_Call { + return &MockLakeviewInterface_GetByDashboardId_Call{Call: _e.mock.On("GetByDashboardId", ctx, dashboardId)} +} + +func (_c *MockLakeviewInterface_GetByDashboardId_Call) Run(run func(ctx context.Context, dashboardId string)) *MockLakeviewInterface_GetByDashboardId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockLakeviewInterface_GetByDashboardId_Call) Return(_a0 *dashboards.Dashboard, _a1 error) *MockLakeviewInterface_GetByDashboardId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_GetByDashboardId_Call) RunAndReturn(run func(context.Context, string) (*dashboards.Dashboard, error)) *MockLakeviewInterface_GetByDashboardId_Call { + _c.Call.Return(run) + return _c +} + +// GetPublished provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) GetPublished(ctx context.Context, request dashboards.GetPublishedDashboardRequest) (*dashboards.PublishedDashboard, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetPublished") + } + + var r0 *dashboards.PublishedDashboard + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetPublishedDashboardRequest) (*dashboards.PublishedDashboard, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetPublishedDashboardRequest) *dashboards.PublishedDashboard); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.PublishedDashboard) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GetPublishedDashboardRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_GetPublished_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublished' +type MockLakeviewInterface_GetPublished_Call struct { + *mock.Call +} + +// GetPublished is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GetPublishedDashboardRequest +func (_e *MockLakeviewInterface_Expecter) GetPublished(ctx interface{}, request interface{}) *MockLakeviewInterface_GetPublished_Call { + return &MockLakeviewInterface_GetPublished_Call{Call: _e.mock.On("GetPublished", ctx, request)} +} + +func (_c *MockLakeviewInterface_GetPublished_Call) Run(run func(ctx context.Context, request dashboards.GetPublishedDashboardRequest)) *MockLakeviewInterface_GetPublished_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GetPublishedDashboardRequest)) + }) + return _c +} + +func (_c *MockLakeviewInterface_GetPublished_Call) Return(_a0 *dashboards.PublishedDashboard, _a1 error) *MockLakeviewInterface_GetPublished_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_GetPublished_Call) RunAndReturn(run func(context.Context, dashboards.GetPublishedDashboardRequest) (*dashboards.PublishedDashboard, error)) *MockLakeviewInterface_GetPublished_Call { + _c.Call.Return(run) + return _c +} + +// GetPublishedByDashboardId provides a mock function with given fields: ctx, dashboardId +func (_m *MockLakeviewInterface) GetPublishedByDashboardId(ctx context.Context, dashboardId string) (*dashboards.PublishedDashboard, error) { + ret := _m.Called(ctx, dashboardId) + + if len(ret) == 0 { + panic("no return value specified for GetPublishedByDashboardId") + } + + var r0 *dashboards.PublishedDashboard + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*dashboards.PublishedDashboard, error)); ok { + return rf(ctx, dashboardId) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *dashboards.PublishedDashboard); ok { + r0 = rf(ctx, dashboardId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.PublishedDashboard) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, dashboardId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_GetPublishedByDashboardId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublishedByDashboardId' +type MockLakeviewInterface_GetPublishedByDashboardId_Call struct { + *mock.Call +} + +// GetPublishedByDashboardId is a helper method to define mock.On call +// - ctx context.Context +// - dashboardId string +func (_e *MockLakeviewInterface_Expecter) GetPublishedByDashboardId(ctx interface{}, dashboardId interface{}) *MockLakeviewInterface_GetPublishedByDashboardId_Call { + return &MockLakeviewInterface_GetPublishedByDashboardId_Call{Call: _e.mock.On("GetPublishedByDashboardId", ctx, dashboardId)} +} + +func (_c *MockLakeviewInterface_GetPublishedByDashboardId_Call) Run(run func(ctx context.Context, dashboardId string)) *MockLakeviewInterface_GetPublishedByDashboardId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockLakeviewInterface_GetPublishedByDashboardId_Call) Return(_a0 *dashboards.PublishedDashboard, _a1 error) *MockLakeviewInterface_GetPublishedByDashboardId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_GetPublishedByDashboardId_Call) RunAndReturn(run func(context.Context, string) (*dashboards.PublishedDashboard, error)) *MockLakeviewInterface_GetPublishedByDashboardId_Call { + _c.Call.Return(run) + return _c +} + +// GetSchedule provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) GetSchedule(ctx context.Context, request dashboards.GetScheduleRequest) (*dashboards.Schedule, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetSchedule") + } + + var r0 *dashboards.Schedule + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetScheduleRequest) (*dashboards.Schedule, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetScheduleRequest) *dashboards.Schedule); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.Schedule) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GetScheduleRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_GetSchedule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSchedule' +type MockLakeviewInterface_GetSchedule_Call struct { + *mock.Call +} + +// GetSchedule is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GetScheduleRequest +func (_e *MockLakeviewInterface_Expecter) GetSchedule(ctx interface{}, request interface{}) *MockLakeviewInterface_GetSchedule_Call { + return &MockLakeviewInterface_GetSchedule_Call{Call: _e.mock.On("GetSchedule", ctx, request)} +} + +func (_c *MockLakeviewInterface_GetSchedule_Call) Run(run func(ctx context.Context, request dashboards.GetScheduleRequest)) *MockLakeviewInterface_GetSchedule_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GetScheduleRequest)) + }) + return _c +} + +func (_c *MockLakeviewInterface_GetSchedule_Call) Return(_a0 *dashboards.Schedule, _a1 error) *MockLakeviewInterface_GetSchedule_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_GetSchedule_Call) RunAndReturn(run func(context.Context, dashboards.GetScheduleRequest) (*dashboards.Schedule, error)) *MockLakeviewInterface_GetSchedule_Call { + _c.Call.Return(run) + return _c +} + +// GetScheduleByDashboardIdAndScheduleId provides a mock function with given fields: ctx, dashboardId, scheduleId +func (_m *MockLakeviewInterface) GetScheduleByDashboardIdAndScheduleId(ctx context.Context, dashboardId string, scheduleId string) (*dashboards.Schedule, error) { + ret := _m.Called(ctx, dashboardId, scheduleId) + + if len(ret) == 0 { + panic("no return value specified for GetScheduleByDashboardIdAndScheduleId") + } + + var r0 *dashboards.Schedule + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*dashboards.Schedule, error)); ok { + return rf(ctx, dashboardId, scheduleId) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) *dashboards.Schedule); ok { + r0 = rf(ctx, dashboardId, scheduleId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.Schedule) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, dashboardId, scheduleId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_GetScheduleByDashboardIdAndScheduleId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetScheduleByDashboardIdAndScheduleId' +type MockLakeviewInterface_GetScheduleByDashboardIdAndScheduleId_Call struct { + *mock.Call +} + +// GetScheduleByDashboardIdAndScheduleId is a helper method to define mock.On call +// - ctx context.Context +// - dashboardId string +// - scheduleId string +func (_e *MockLakeviewInterface_Expecter) GetScheduleByDashboardIdAndScheduleId(ctx interface{}, dashboardId interface{}, scheduleId interface{}) *MockLakeviewInterface_GetScheduleByDashboardIdAndScheduleId_Call { + return &MockLakeviewInterface_GetScheduleByDashboardIdAndScheduleId_Call{Call: _e.mock.On("GetScheduleByDashboardIdAndScheduleId", ctx, dashboardId, scheduleId)} +} + +func (_c *MockLakeviewInterface_GetScheduleByDashboardIdAndScheduleId_Call) Run(run func(ctx context.Context, dashboardId string, scheduleId string)) *MockLakeviewInterface_GetScheduleByDashboardIdAndScheduleId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockLakeviewInterface_GetScheduleByDashboardIdAndScheduleId_Call) Return(_a0 *dashboards.Schedule, _a1 error) *MockLakeviewInterface_GetScheduleByDashboardIdAndScheduleId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_GetScheduleByDashboardIdAndScheduleId_Call) RunAndReturn(run func(context.Context, string, string) (*dashboards.Schedule, error)) *MockLakeviewInterface_GetScheduleByDashboardIdAndScheduleId_Call { + _c.Call.Return(run) + return _c +} + +// GetSubscription provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) GetSubscription(ctx context.Context, request dashboards.GetSubscriptionRequest) (*dashboards.Subscription, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetSubscription") + } + + var r0 *dashboards.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetSubscriptionRequest) (*dashboards.Subscription, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetSubscriptionRequest) *dashboards.Subscription); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GetSubscriptionRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_GetSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSubscription' +type MockLakeviewInterface_GetSubscription_Call struct { + *mock.Call +} + +// GetSubscription is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GetSubscriptionRequest +func (_e *MockLakeviewInterface_Expecter) GetSubscription(ctx interface{}, request interface{}) *MockLakeviewInterface_GetSubscription_Call { + return &MockLakeviewInterface_GetSubscription_Call{Call: _e.mock.On("GetSubscription", ctx, request)} +} + +func (_c *MockLakeviewInterface_GetSubscription_Call) Run(run func(ctx context.Context, request dashboards.GetSubscriptionRequest)) *MockLakeviewInterface_GetSubscription_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GetSubscriptionRequest)) + }) + return _c +} + +func (_c *MockLakeviewInterface_GetSubscription_Call) Return(_a0 *dashboards.Subscription, _a1 error) *MockLakeviewInterface_GetSubscription_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_GetSubscription_Call) RunAndReturn(run func(context.Context, dashboards.GetSubscriptionRequest) (*dashboards.Subscription, error)) *MockLakeviewInterface_GetSubscription_Call { + _c.Call.Return(run) + return _c +} + +// GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId provides a mock function with given fields: ctx, dashboardId, scheduleId, subscriptionId +func (_m *MockLakeviewInterface) GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId(ctx context.Context, dashboardId string, scheduleId string, subscriptionId string) (*dashboards.Subscription, error) { + ret := _m.Called(ctx, dashboardId, scheduleId, subscriptionId) + + if len(ret) == 0 { + panic("no return value specified for GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId") + } + + var r0 *dashboards.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string) (*dashboards.Subscription, error)); ok { + return rf(ctx, dashboardId, scheduleId, subscriptionId) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *dashboards.Subscription); ok { + r0 = rf(ctx, dashboardId, scheduleId, subscriptionId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { + r1 = rf(ctx, dashboardId, scheduleId, subscriptionId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId' +type MockLakeviewInterface_GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call struct { + *mock.Call } -type MockLakeviewInterface_Expecter struct { - mock *mock.Mock +// GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId is a helper method to define mock.On call +// - ctx context.Context +// - dashboardId string +// - scheduleId string +// - subscriptionId string +func (_e *MockLakeviewInterface_Expecter) GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId(ctx interface{}, dashboardId interface{}, scheduleId interface{}, subscriptionId interface{}) *MockLakeviewInterface_GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call { + return &MockLakeviewInterface_GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call{Call: _e.mock.On("GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId", ctx, dashboardId, scheduleId, subscriptionId)} } -func (_m *MockLakeviewInterface) EXPECT() *MockLakeviewInterface_Expecter { - return &MockLakeviewInterface_Expecter{mock: &_m.Mock} +func (_c *MockLakeviewInterface_GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call) Run(run func(ctx context.Context, dashboardId string, scheduleId string, subscriptionId string)) *MockLakeviewInterface_GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(string)) + }) + return _c } -// Create provides a mock function with given fields: ctx, request -func (_m *MockLakeviewInterface) Create(ctx context.Context, request dashboards.CreateDashboardRequest) (*dashboards.Dashboard, error) { - ret := _m.Called(ctx, request) +func (_c *MockLakeviewInterface_GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call) Return(_a0 *dashboards.Subscription, _a1 error) *MockLakeviewInterface_GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call) RunAndReturn(run func(context.Context, string, string, string) (*dashboards.Subscription, error)) *MockLakeviewInterface_GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockLakeviewInterface) Impl() dashboards.LakeviewService { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for Create") + panic("no return value specified for Impl") } - var r0 *dashboards.Dashboard - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, dashboards.CreateDashboardRequest) (*dashboards.Dashboard, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, dashboards.CreateDashboardRequest) *dashboards.Dashboard); ok { - r0 = rf(ctx, request) + var r0 dashboards.LakeviewService + if rf, ok := ret.Get(0).(func() dashboards.LakeviewService); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*dashboards.Dashboard) + r0 = ret.Get(0).(dashboards.LakeviewService) } } - if rf, ok := ret.Get(1).(func(context.Context, dashboards.CreateDashboardRequest) error); ok { - r1 = rf(ctx, request) + return r0 +} + +// MockLakeviewInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockLakeviewInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockLakeviewInterface_Expecter) Impl() *MockLakeviewInterface_Impl_Call { + return &MockLakeviewInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockLakeviewInterface_Impl_Call) Run(run func()) *MockLakeviewInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockLakeviewInterface_Impl_Call) Return(_a0 dashboards.LakeviewService) *MockLakeviewInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLakeviewInterface_Impl_Call) RunAndReturn(run func() dashboards.LakeviewService) *MockLakeviewInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// ListSchedules provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) ListSchedules(ctx context.Context, request dashboards.ListSchedulesRequest) listing.Iterator[dashboards.Schedule] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListSchedules") + } + + var r0 listing.Iterator[dashboards.Schedule] + if rf, ok := ret.Get(0).(func(context.Context, dashboards.ListSchedulesRequest) listing.Iterator[dashboards.Schedule]); ok { + r0 = rf(ctx, request) } else { - r1 = ret.Error(1) + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[dashboards.Schedule]) + } } - return r0, r1 + return r0 } -// MockLakeviewInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' -type MockLakeviewInterface_Create_Call struct { +// MockLakeviewInterface_ListSchedules_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSchedules' +type MockLakeviewInterface_ListSchedules_Call struct { *mock.Call } -// Create is a helper method to define mock.On call +// ListSchedules is a helper method to define mock.On call // - ctx context.Context -// - request dashboards.CreateDashboardRequest -func (_e *MockLakeviewInterface_Expecter) Create(ctx interface{}, request interface{}) *MockLakeviewInterface_Create_Call { - return &MockLakeviewInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +// - request dashboards.ListSchedulesRequest +func (_e *MockLakeviewInterface_Expecter) ListSchedules(ctx interface{}, request interface{}) *MockLakeviewInterface_ListSchedules_Call { + return &MockLakeviewInterface_ListSchedules_Call{Call: _e.mock.On("ListSchedules", ctx, request)} } -func (_c *MockLakeviewInterface_Create_Call) Run(run func(ctx context.Context, request dashboards.CreateDashboardRequest)) *MockLakeviewInterface_Create_Call { +func (_c *MockLakeviewInterface_ListSchedules_Call) Run(run func(ctx context.Context, request dashboards.ListSchedulesRequest)) *MockLakeviewInterface_ListSchedules_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(dashboards.CreateDashboardRequest)) + run(args[0].(context.Context), args[1].(dashboards.ListSchedulesRequest)) }) return _c } -func (_c *MockLakeviewInterface_Create_Call) Return(_a0 *dashboards.Dashboard, _a1 error) *MockLakeviewInterface_Create_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockLakeviewInterface_ListSchedules_Call) Return(_a0 listing.Iterator[dashboards.Schedule]) *MockLakeviewInterface_ListSchedules_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockLakeviewInterface_Create_Call) RunAndReturn(run func(context.Context, dashboards.CreateDashboardRequest) (*dashboards.Dashboard, error)) *MockLakeviewInterface_Create_Call { +func (_c *MockLakeviewInterface_ListSchedules_Call) RunAndReturn(run func(context.Context, dashboards.ListSchedulesRequest) listing.Iterator[dashboards.Schedule]) *MockLakeviewInterface_ListSchedules_Call { _c.Call.Return(run) return _c } -// Get provides a mock function with given fields: ctx, request -func (_m *MockLakeviewInterface) Get(ctx context.Context, request dashboards.GetDashboardRequest) (*dashboards.Dashboard, error) { +// ListSchedulesAll provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) ListSchedulesAll(ctx context.Context, request dashboards.ListSchedulesRequest) ([]dashboards.Schedule, error) { ret := _m.Called(ctx, request) if len(ret) == 0 { - panic("no return value specified for Get") + panic("no return value specified for ListSchedulesAll") } - var r0 *dashboards.Dashboard + var r0 []dashboards.Schedule var r1 error - if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetDashboardRequest) (*dashboards.Dashboard, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, dashboards.ListSchedulesRequest) ([]dashboards.Schedule, error)); ok { return rf(ctx, request) } - if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetDashboardRequest) *dashboards.Dashboard); ok { + if rf, ok := ret.Get(0).(func(context.Context, dashboards.ListSchedulesRequest) []dashboards.Schedule); ok { r0 = rf(ctx, request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*dashboards.Dashboard) + r0 = ret.Get(0).([]dashboards.Schedule) } } - if rf, ok := ret.Get(1).(func(context.Context, dashboards.GetDashboardRequest) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, dashboards.ListSchedulesRequest) error); ok { r1 = rf(ctx, request) } else { r1 = ret.Error(1) @@ -111,53 +993,53 @@ func (_m *MockLakeviewInterface) Get(ctx context.Context, request dashboards.Get return r0, r1 } -// MockLakeviewInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' -type MockLakeviewInterface_Get_Call struct { +// MockLakeviewInterface_ListSchedulesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSchedulesAll' +type MockLakeviewInterface_ListSchedulesAll_Call struct { *mock.Call } -// Get is a helper method to define mock.On call +// ListSchedulesAll is a helper method to define mock.On call // - ctx context.Context -// - request dashboards.GetDashboardRequest -func (_e *MockLakeviewInterface_Expecter) Get(ctx interface{}, request interface{}) *MockLakeviewInterface_Get_Call { - return &MockLakeviewInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +// - request dashboards.ListSchedulesRequest +func (_e *MockLakeviewInterface_Expecter) ListSchedulesAll(ctx interface{}, request interface{}) *MockLakeviewInterface_ListSchedulesAll_Call { + return &MockLakeviewInterface_ListSchedulesAll_Call{Call: _e.mock.On("ListSchedulesAll", ctx, request)} } -func (_c *MockLakeviewInterface_Get_Call) Run(run func(ctx context.Context, request dashboards.GetDashboardRequest)) *MockLakeviewInterface_Get_Call { +func (_c *MockLakeviewInterface_ListSchedulesAll_Call) Run(run func(ctx context.Context, request dashboards.ListSchedulesRequest)) *MockLakeviewInterface_ListSchedulesAll_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(dashboards.GetDashboardRequest)) + run(args[0].(context.Context), args[1].(dashboards.ListSchedulesRequest)) }) return _c } -func (_c *MockLakeviewInterface_Get_Call) Return(_a0 *dashboards.Dashboard, _a1 error) *MockLakeviewInterface_Get_Call { +func (_c *MockLakeviewInterface_ListSchedulesAll_Call) Return(_a0 []dashboards.Schedule, _a1 error) *MockLakeviewInterface_ListSchedulesAll_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockLakeviewInterface_Get_Call) RunAndReturn(run func(context.Context, dashboards.GetDashboardRequest) (*dashboards.Dashboard, error)) *MockLakeviewInterface_Get_Call { +func (_c *MockLakeviewInterface_ListSchedulesAll_Call) RunAndReturn(run func(context.Context, dashboards.ListSchedulesRequest) ([]dashboards.Schedule, error)) *MockLakeviewInterface_ListSchedulesAll_Call { _c.Call.Return(run) return _c } -// GetByDashboardId provides a mock function with given fields: ctx, dashboardId -func (_m *MockLakeviewInterface) GetByDashboardId(ctx context.Context, dashboardId string) (*dashboards.Dashboard, error) { +// ListSchedulesByDashboardId provides a mock function with given fields: ctx, dashboardId +func (_m *MockLakeviewInterface) ListSchedulesByDashboardId(ctx context.Context, dashboardId string) (*dashboards.ListSchedulesResponse, error) { ret := _m.Called(ctx, dashboardId) if len(ret) == 0 { - panic("no return value specified for GetByDashboardId") + panic("no return value specified for ListSchedulesByDashboardId") } - var r0 *dashboards.Dashboard + var r0 *dashboards.ListSchedulesResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*dashboards.Dashboard, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, string) (*dashboards.ListSchedulesResponse, error)); ok { return rf(ctx, dashboardId) } - if rf, ok := ret.Get(0).(func(context.Context, string) *dashboards.Dashboard); ok { + if rf, ok := ret.Get(0).(func(context.Context, string) *dashboards.ListSchedulesResponse); ok { r0 = rf(ctx, dashboardId) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*dashboards.Dashboard) + r0 = ret.Get(0).(*dashboards.ListSchedulesResponse) } } @@ -170,117 +1052,107 @@ func (_m *MockLakeviewInterface) GetByDashboardId(ctx context.Context, dashboard return r0, r1 } -// MockLakeviewInterface_GetByDashboardId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByDashboardId' -type MockLakeviewInterface_GetByDashboardId_Call struct { +// MockLakeviewInterface_ListSchedulesByDashboardId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSchedulesByDashboardId' +type MockLakeviewInterface_ListSchedulesByDashboardId_Call struct { *mock.Call } -// GetByDashboardId is a helper method to define mock.On call +// ListSchedulesByDashboardId is a helper method to define mock.On call // - ctx context.Context // - dashboardId string -func (_e *MockLakeviewInterface_Expecter) GetByDashboardId(ctx interface{}, dashboardId interface{}) *MockLakeviewInterface_GetByDashboardId_Call { - return &MockLakeviewInterface_GetByDashboardId_Call{Call: _e.mock.On("GetByDashboardId", ctx, dashboardId)} +func (_e *MockLakeviewInterface_Expecter) ListSchedulesByDashboardId(ctx interface{}, dashboardId interface{}) *MockLakeviewInterface_ListSchedulesByDashboardId_Call { + return &MockLakeviewInterface_ListSchedulesByDashboardId_Call{Call: _e.mock.On("ListSchedulesByDashboardId", ctx, dashboardId)} } -func (_c *MockLakeviewInterface_GetByDashboardId_Call) Run(run func(ctx context.Context, dashboardId string)) *MockLakeviewInterface_GetByDashboardId_Call { +func (_c *MockLakeviewInterface_ListSchedulesByDashboardId_Call) Run(run func(ctx context.Context, dashboardId string)) *MockLakeviewInterface_ListSchedulesByDashboardId_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(string)) }) return _c } -func (_c *MockLakeviewInterface_GetByDashboardId_Call) Return(_a0 *dashboards.Dashboard, _a1 error) *MockLakeviewInterface_GetByDashboardId_Call { +func (_c *MockLakeviewInterface_ListSchedulesByDashboardId_Call) Return(_a0 *dashboards.ListSchedulesResponse, _a1 error) *MockLakeviewInterface_ListSchedulesByDashboardId_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockLakeviewInterface_GetByDashboardId_Call) RunAndReturn(run func(context.Context, string) (*dashboards.Dashboard, error)) *MockLakeviewInterface_GetByDashboardId_Call { +func (_c *MockLakeviewInterface_ListSchedulesByDashboardId_Call) RunAndReturn(run func(context.Context, string) (*dashboards.ListSchedulesResponse, error)) *MockLakeviewInterface_ListSchedulesByDashboardId_Call { _c.Call.Return(run) return _c } -// GetPublished provides a mock function with given fields: ctx, request -func (_m *MockLakeviewInterface) GetPublished(ctx context.Context, request dashboards.GetPublishedDashboardRequest) (*dashboards.PublishedDashboard, error) { +// ListSubscriptions provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) ListSubscriptions(ctx context.Context, request dashboards.ListSubscriptionsRequest) listing.Iterator[dashboards.Subscription] { ret := _m.Called(ctx, request) if len(ret) == 0 { - panic("no return value specified for GetPublished") + panic("no return value specified for ListSubscriptions") } - var r0 *dashboards.PublishedDashboard - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetPublishedDashboardRequest) (*dashboards.PublishedDashboard, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetPublishedDashboardRequest) *dashboards.PublishedDashboard); ok { + var r0 listing.Iterator[dashboards.Subscription] + if rf, ok := ret.Get(0).(func(context.Context, dashboards.ListSubscriptionsRequest) listing.Iterator[dashboards.Subscription]); ok { r0 = rf(ctx, request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*dashboards.PublishedDashboard) + r0 = ret.Get(0).(listing.Iterator[dashboards.Subscription]) } } - if rf, ok := ret.Get(1).(func(context.Context, dashboards.GetPublishedDashboardRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } -// MockLakeviewInterface_GetPublished_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublished' -type MockLakeviewInterface_GetPublished_Call struct { +// MockLakeviewInterface_ListSubscriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSubscriptions' +type MockLakeviewInterface_ListSubscriptions_Call struct { *mock.Call } -// GetPublished is a helper method to define mock.On call +// ListSubscriptions is a helper method to define mock.On call // - ctx context.Context -// - request dashboards.GetPublishedDashboardRequest -func (_e *MockLakeviewInterface_Expecter) GetPublished(ctx interface{}, request interface{}) *MockLakeviewInterface_GetPublished_Call { - return &MockLakeviewInterface_GetPublished_Call{Call: _e.mock.On("GetPublished", ctx, request)} +// - request dashboards.ListSubscriptionsRequest +func (_e *MockLakeviewInterface_Expecter) ListSubscriptions(ctx interface{}, request interface{}) *MockLakeviewInterface_ListSubscriptions_Call { + return &MockLakeviewInterface_ListSubscriptions_Call{Call: _e.mock.On("ListSubscriptions", ctx, request)} } -func (_c *MockLakeviewInterface_GetPublished_Call) Run(run func(ctx context.Context, request dashboards.GetPublishedDashboardRequest)) *MockLakeviewInterface_GetPublished_Call { +func (_c *MockLakeviewInterface_ListSubscriptions_Call) Run(run func(ctx context.Context, request dashboards.ListSubscriptionsRequest)) *MockLakeviewInterface_ListSubscriptions_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(dashboards.GetPublishedDashboardRequest)) + run(args[0].(context.Context), args[1].(dashboards.ListSubscriptionsRequest)) }) return _c } -func (_c *MockLakeviewInterface_GetPublished_Call) Return(_a0 *dashboards.PublishedDashboard, _a1 error) *MockLakeviewInterface_GetPublished_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockLakeviewInterface_ListSubscriptions_Call) Return(_a0 listing.Iterator[dashboards.Subscription]) *MockLakeviewInterface_ListSubscriptions_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockLakeviewInterface_GetPublished_Call) RunAndReturn(run func(context.Context, dashboards.GetPublishedDashboardRequest) (*dashboards.PublishedDashboard, error)) *MockLakeviewInterface_GetPublished_Call { +func (_c *MockLakeviewInterface_ListSubscriptions_Call) RunAndReturn(run func(context.Context, dashboards.ListSubscriptionsRequest) listing.Iterator[dashboards.Subscription]) *MockLakeviewInterface_ListSubscriptions_Call { _c.Call.Return(run) return _c } -// GetPublishedByDashboardId provides a mock function with given fields: ctx, dashboardId -func (_m *MockLakeviewInterface) GetPublishedByDashboardId(ctx context.Context, dashboardId string) (*dashboards.PublishedDashboard, error) { - ret := _m.Called(ctx, dashboardId) +// ListSubscriptionsAll provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) ListSubscriptionsAll(ctx context.Context, request dashboards.ListSubscriptionsRequest) ([]dashboards.Subscription, error) { + ret := _m.Called(ctx, request) if len(ret) == 0 { - panic("no return value specified for GetPublishedByDashboardId") + panic("no return value specified for ListSubscriptionsAll") } - var r0 *dashboards.PublishedDashboard + var r0 []dashboards.Subscription var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*dashboards.PublishedDashboard, error)); ok { - return rf(ctx, dashboardId) + if rf, ok := ret.Get(0).(func(context.Context, dashboards.ListSubscriptionsRequest) ([]dashboards.Subscription, error)); ok { + return rf(ctx, request) } - if rf, ok := ret.Get(0).(func(context.Context, string) *dashboards.PublishedDashboard); ok { - r0 = rf(ctx, dashboardId) + if rf, ok := ret.Get(0).(func(context.Context, dashboards.ListSubscriptionsRequest) []dashboards.Subscription); ok { + r0 = rf(ctx, request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*dashboards.PublishedDashboard) + r0 = ret.Get(0).([]dashboards.Subscription) } } - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, dashboardId) + if rf, ok := ret.Get(1).(func(context.Context, dashboards.ListSubscriptionsRequest) error); ok { + r1 = rf(ctx, request) } else { r1 = ret.Error(1) } @@ -288,78 +1160,91 @@ func (_m *MockLakeviewInterface) GetPublishedByDashboardId(ctx context.Context, return r0, r1 } -// MockLakeviewInterface_GetPublishedByDashboardId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublishedByDashboardId' -type MockLakeviewInterface_GetPublishedByDashboardId_Call struct { +// MockLakeviewInterface_ListSubscriptionsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSubscriptionsAll' +type MockLakeviewInterface_ListSubscriptionsAll_Call struct { *mock.Call } -// GetPublishedByDashboardId is a helper method to define mock.On call +// ListSubscriptionsAll is a helper method to define mock.On call // - ctx context.Context -// - dashboardId string -func (_e *MockLakeviewInterface_Expecter) GetPublishedByDashboardId(ctx interface{}, dashboardId interface{}) *MockLakeviewInterface_GetPublishedByDashboardId_Call { - return &MockLakeviewInterface_GetPublishedByDashboardId_Call{Call: _e.mock.On("GetPublishedByDashboardId", ctx, dashboardId)} +// - request dashboards.ListSubscriptionsRequest +func (_e *MockLakeviewInterface_Expecter) ListSubscriptionsAll(ctx interface{}, request interface{}) *MockLakeviewInterface_ListSubscriptionsAll_Call { + return &MockLakeviewInterface_ListSubscriptionsAll_Call{Call: _e.mock.On("ListSubscriptionsAll", ctx, request)} } -func (_c *MockLakeviewInterface_GetPublishedByDashboardId_Call) Run(run func(ctx context.Context, dashboardId string)) *MockLakeviewInterface_GetPublishedByDashboardId_Call { +func (_c *MockLakeviewInterface_ListSubscriptionsAll_Call) Run(run func(ctx context.Context, request dashboards.ListSubscriptionsRequest)) *MockLakeviewInterface_ListSubscriptionsAll_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) + run(args[0].(context.Context), args[1].(dashboards.ListSubscriptionsRequest)) }) return _c } -func (_c *MockLakeviewInterface_GetPublishedByDashboardId_Call) Return(_a0 *dashboards.PublishedDashboard, _a1 error) *MockLakeviewInterface_GetPublishedByDashboardId_Call { +func (_c *MockLakeviewInterface_ListSubscriptionsAll_Call) Return(_a0 []dashboards.Subscription, _a1 error) *MockLakeviewInterface_ListSubscriptionsAll_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockLakeviewInterface_GetPublishedByDashboardId_Call) RunAndReturn(run func(context.Context, string) (*dashboards.PublishedDashboard, error)) *MockLakeviewInterface_GetPublishedByDashboardId_Call { +func (_c *MockLakeviewInterface_ListSubscriptionsAll_Call) RunAndReturn(run func(context.Context, dashboards.ListSubscriptionsRequest) ([]dashboards.Subscription, error)) *MockLakeviewInterface_ListSubscriptionsAll_Call { _c.Call.Return(run) return _c } -// Impl provides a mock function with given fields: -func (_m *MockLakeviewInterface) Impl() dashboards.LakeviewService { - ret := _m.Called() +// ListSubscriptionsByDashboardIdAndScheduleId provides a mock function with given fields: ctx, dashboardId, scheduleId +func (_m *MockLakeviewInterface) ListSubscriptionsByDashboardIdAndScheduleId(ctx context.Context, dashboardId string, scheduleId string) (*dashboards.ListSubscriptionsResponse, error) { + ret := _m.Called(ctx, dashboardId, scheduleId) if len(ret) == 0 { - panic("no return value specified for Impl") + panic("no return value specified for ListSubscriptionsByDashboardIdAndScheduleId") } - var r0 dashboards.LakeviewService - if rf, ok := ret.Get(0).(func() dashboards.LakeviewService); ok { - r0 = rf() + var r0 *dashboards.ListSubscriptionsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*dashboards.ListSubscriptionsResponse, error)); ok { + return rf(ctx, dashboardId, scheduleId) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) *dashboards.ListSubscriptionsResponse); ok { + r0 = rf(ctx, dashboardId, scheduleId) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(dashboards.LakeviewService) + r0 = ret.Get(0).(*dashboards.ListSubscriptionsResponse) } } - return r0 + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, dashboardId, scheduleId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 } -// MockLakeviewInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' -type MockLakeviewInterface_Impl_Call struct { +// MockLakeviewInterface_ListSubscriptionsByDashboardIdAndScheduleId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSubscriptionsByDashboardIdAndScheduleId' +type MockLakeviewInterface_ListSubscriptionsByDashboardIdAndScheduleId_Call struct { *mock.Call } -// Impl is a helper method to define mock.On call -func (_e *MockLakeviewInterface_Expecter) Impl() *MockLakeviewInterface_Impl_Call { - return &MockLakeviewInterface_Impl_Call{Call: _e.mock.On("Impl")} +// ListSubscriptionsByDashboardIdAndScheduleId is a helper method to define mock.On call +// - ctx context.Context +// - dashboardId string +// - scheduleId string +func (_e *MockLakeviewInterface_Expecter) ListSubscriptionsByDashboardIdAndScheduleId(ctx interface{}, dashboardId interface{}, scheduleId interface{}) *MockLakeviewInterface_ListSubscriptionsByDashboardIdAndScheduleId_Call { + return &MockLakeviewInterface_ListSubscriptionsByDashboardIdAndScheduleId_Call{Call: _e.mock.On("ListSubscriptionsByDashboardIdAndScheduleId", ctx, dashboardId, scheduleId)} } -func (_c *MockLakeviewInterface_Impl_Call) Run(run func()) *MockLakeviewInterface_Impl_Call { +func (_c *MockLakeviewInterface_ListSubscriptionsByDashboardIdAndScheduleId_Call) Run(run func(ctx context.Context, dashboardId string, scheduleId string)) *MockLakeviewInterface_ListSubscriptionsByDashboardIdAndScheduleId_Call { _c.Call.Run(func(args mock.Arguments) { - run() + run(args[0].(context.Context), args[1].(string), args[2].(string)) }) return _c } -func (_c *MockLakeviewInterface_Impl_Call) Return(_a0 dashboards.LakeviewService) *MockLakeviewInterface_Impl_Call { - _c.Call.Return(_a0) +func (_c *MockLakeviewInterface_ListSubscriptionsByDashboardIdAndScheduleId_Call) Return(_a0 *dashboards.ListSubscriptionsResponse, _a1 error) *MockLakeviewInterface_ListSubscriptionsByDashboardIdAndScheduleId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MockLakeviewInterface_Impl_Call) RunAndReturn(run func() dashboards.LakeviewService) *MockLakeviewInterface_Impl_Call { +func (_c *MockLakeviewInterface_ListSubscriptionsByDashboardIdAndScheduleId_Call) RunAndReturn(run func(context.Context, string, string) (*dashboards.ListSubscriptionsResponse, error)) *MockLakeviewInterface_ListSubscriptionsByDashboardIdAndScheduleId_Call { _c.Call.Return(run) return _c } @@ -729,6 +1614,65 @@ func (_c *MockLakeviewInterface_Update_Call) RunAndReturn(run func(context.Conte return _c } +// UpdateSchedule provides a mock function with given fields: ctx, request +func (_m *MockLakeviewInterface) UpdateSchedule(ctx context.Context, request dashboards.UpdateScheduleRequest) (*dashboards.Schedule, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateSchedule") + } + + var r0 *dashboards.Schedule + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.UpdateScheduleRequest) (*dashboards.Schedule, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.UpdateScheduleRequest) *dashboards.Schedule); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.Schedule) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.UpdateScheduleRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLakeviewInterface_UpdateSchedule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateSchedule' +type MockLakeviewInterface_UpdateSchedule_Call struct { + *mock.Call +} + +// UpdateSchedule is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.UpdateScheduleRequest +func (_e *MockLakeviewInterface_Expecter) UpdateSchedule(ctx interface{}, request interface{}) *MockLakeviewInterface_UpdateSchedule_Call { + return &MockLakeviewInterface_UpdateSchedule_Call{Call: _e.mock.On("UpdateSchedule", ctx, request)} +} + +func (_c *MockLakeviewInterface_UpdateSchedule_Call) Run(run func(ctx context.Context, request dashboards.UpdateScheduleRequest)) *MockLakeviewInterface_UpdateSchedule_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.UpdateScheduleRequest)) + }) + return _c +} + +func (_c *MockLakeviewInterface_UpdateSchedule_Call) Return(_a0 *dashboards.Schedule, _a1 error) *MockLakeviewInterface_UpdateSchedule_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLakeviewInterface_UpdateSchedule_Call) RunAndReturn(run func(context.Context, dashboards.UpdateScheduleRequest) (*dashboards.Schedule, error)) *MockLakeviewInterface_UpdateSchedule_Call { + _c.Call.Return(run) + return _c +} + // WithImpl provides a mock function with given fields: impl func (_m *MockLakeviewInterface) WithImpl(impl dashboards.LakeviewService) dashboards.LakeviewInterface { ret := _m.Called(impl) diff --git a/service/catalog/api.go b/service/catalog/api.go index fcfa5423b..344a4e07b 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, Metastores, Model Versions, Online Tables, Quality Monitors, 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, Endpoints, 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 ( @@ -1108,6 +1108,90 @@ func (a *ConnectionsAPI) Update(ctx context.Context, request UpdateConnection) ( return a.impl.Update(ctx, request) } +type EndpointsInterface 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 MockEndpointsInterface instead. + WithImpl(impl EndpointsService) EndpointsInterface + + // Impl returns low-level Endpoints API implementation + // Deprecated: use MockEndpointsInterface instead. + Impl() EndpointsService + + // Create an Endpoint. + Create(ctx context.Context, request CreateEndpointRequest) (*Endpoint, error) + + // Delete an Endpoint. + Delete(ctx context.Context, request DeleteEndpointRequest) error + + // Delete an Endpoint. + DeleteByName(ctx context.Context, name string) error + + // Get an Endpoint. + Get(ctx context.Context, request GetEndpointRequest) (*Endpoint, error) + + // Get an Endpoint. + GetByName(ctx context.Context, name string) (*Endpoint, error) +} + +func NewEndpoints(client *client.DatabricksClient) *EndpointsAPI { + return &EndpointsAPI{ + impl: &endpointsImpl{ + client: client, + }, + } +} + +// Endpoints are used to connect to PG clusters. +type EndpointsAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(EndpointsService) + impl EndpointsService +} + +// 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 MockEndpointsInterface instead. +func (a *EndpointsAPI) WithImpl(impl EndpointsService) EndpointsInterface { + a.impl = impl + return a +} + +// Impl returns low-level Endpoints API implementation +// Deprecated: use MockEndpointsInterface instead. +func (a *EndpointsAPI) Impl() EndpointsService { + return a.impl +} + +// Create an Endpoint. +func (a *EndpointsAPI) Create(ctx context.Context, request CreateEndpointRequest) (*Endpoint, error) { + return a.impl.Create(ctx, request) +} + +// Delete an Endpoint. +func (a *EndpointsAPI) Delete(ctx context.Context, request DeleteEndpointRequest) error { + return a.impl.Delete(ctx, request) +} + +// Delete an Endpoint. +func (a *EndpointsAPI) DeleteByName(ctx context.Context, name string) error { + return a.impl.Delete(ctx, DeleteEndpointRequest{ + Name: name, + }) +} + +// Get an Endpoint. +func (a *EndpointsAPI) Get(ctx context.Context, request GetEndpointRequest) (*Endpoint, error) { + return a.impl.Get(ctx, request) +} + +// Get an Endpoint. +func (a *EndpointsAPI) GetByName(ctx context.Context, name string) (*Endpoint, error) { + return a.impl.Get(ctx, GetEndpointRequest{ + Name: name, + }) +} + type ExternalLocationsInterface interface { // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. diff --git a/service/catalog/impl.go b/service/catalog/impl.go index 312d9522c..93a6a4928 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -294,6 +294,39 @@ func (a *connectionsImpl) Update(ctx context.Context, request UpdateConnection) return &connectionInfo, err } +// unexported type that holds implementations of just Endpoints API methods +type endpointsImpl struct { + client *client.DatabricksClient +} + +func (a *endpointsImpl) Create(ctx context.Context, request CreateEndpointRequest) (*Endpoint, error) { + var endpoint Endpoint + path := "/api/2.0/hadron-endpoints" + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, request, &endpoint) + return &endpoint, err +} + +func (a *endpointsImpl) Delete(ctx context.Context, request DeleteEndpointRequest) error { + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/hadron-endpoints/%v", request.Name) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deleteResponse) + return err +} + +func (a *endpointsImpl) Get(ctx context.Context, request GetEndpointRequest) (*Endpoint, error) { + var endpoint Endpoint + path := fmt.Sprintf("/api/2.0/hadron-endpoints/%v", request.Name) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &endpoint) + return &endpoint, err +} + // unexported type that holds implementations of just ExternalLocations API methods type externalLocationsImpl struct { client *client.DatabricksClient diff --git a/service/catalog/interface.go b/service/catalog/interface.go index f5c406a46..3aab6d738 100755 --- a/service/catalog/interface.go +++ b/service/catalog/interface.go @@ -234,6 +234,19 @@ type ConnectionsService interface { Update(ctx context.Context, request UpdateConnection) (*ConnectionInfo, error) } +// Endpoints are used to connect to PG clusters. +type EndpointsService interface { + + // Create an Endpoint. + Create(ctx context.Context, request CreateEndpointRequest) (*Endpoint, error) + + // Delete an Endpoint. + Delete(ctx context.Context, request DeleteEndpointRequest) error + + // Get an Endpoint. + Get(ctx context.Context, request GetEndpointRequest) (*Endpoint, error) +} + // An external location is an object that combines a cloud storage path with a // storage credential that authorizes access to the cloud storage path. Each // external location is subject to Unity Catalog access-control policies that diff --git a/service/catalog/model.go b/service/catalog/model.go index 8a25042f3..7fe1e82d9 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -311,10 +311,6 @@ const CatalogInfoSecurableKindCatalogForeignSqlserver CatalogInfoSecurableKind = const CatalogInfoSecurableKindCatalogInternal CatalogInfoSecurableKind = `CATALOG_INTERNAL` -const CatalogInfoSecurableKindCatalogOnline CatalogInfoSecurableKind = `CATALOG_ONLINE` - -const CatalogInfoSecurableKindCatalogOnlineIndex CatalogInfoSecurableKind = `CATALOG_ONLINE_INDEX` - const CatalogInfoSecurableKindCatalogStandard CatalogInfoSecurableKind = `CATALOG_STANDARD` const CatalogInfoSecurableKindCatalogSystem CatalogInfoSecurableKind = `CATALOG_SYSTEM` @@ -329,11 +325,11 @@ func (f *CatalogInfoSecurableKind) String() string { // Set raw string value and validate it against allowed values func (f *CatalogInfoSecurableKind) Set(v string) error { switch v { - case `CATALOG_DELTASHARING`, `CATALOG_FOREIGN_BIGQUERY`, `CATALOG_FOREIGN_DATABRICKS`, `CATALOG_FOREIGN_MYSQL`, `CATALOG_FOREIGN_POSTGRESQL`, `CATALOG_FOREIGN_REDSHIFT`, `CATALOG_FOREIGN_SNOWFLAKE`, `CATALOG_FOREIGN_SQLDW`, `CATALOG_FOREIGN_SQLSERVER`, `CATALOG_INTERNAL`, `CATALOG_ONLINE`, `CATALOG_ONLINE_INDEX`, `CATALOG_STANDARD`, `CATALOG_SYSTEM`, `CATALOG_SYSTEM_DELTASHARING`: + case `CATALOG_DELTASHARING`, `CATALOG_FOREIGN_BIGQUERY`, `CATALOG_FOREIGN_DATABRICKS`, `CATALOG_FOREIGN_MYSQL`, `CATALOG_FOREIGN_POSTGRESQL`, `CATALOG_FOREIGN_REDSHIFT`, `CATALOG_FOREIGN_SNOWFLAKE`, `CATALOG_FOREIGN_SQLDW`, `CATALOG_FOREIGN_SQLSERVER`, `CATALOG_INTERNAL`, `CATALOG_STANDARD`, `CATALOG_SYSTEM`, `CATALOG_SYSTEM_DELTASHARING`: *f = CatalogInfoSecurableKind(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "CATALOG_DELTASHARING", "CATALOG_FOREIGN_BIGQUERY", "CATALOG_FOREIGN_DATABRICKS", "CATALOG_FOREIGN_MYSQL", "CATALOG_FOREIGN_POSTGRESQL", "CATALOG_FOREIGN_REDSHIFT", "CATALOG_FOREIGN_SNOWFLAKE", "CATALOG_FOREIGN_SQLDW", "CATALOG_FOREIGN_SQLSERVER", "CATALOG_INTERNAL", "CATALOG_ONLINE", "CATALOG_ONLINE_INDEX", "CATALOG_STANDARD", "CATALOG_SYSTEM", "CATALOG_SYSTEM_DELTASHARING"`, v) + return fmt.Errorf(`value "%s" is not one of "CATALOG_DELTASHARING", "CATALOG_FOREIGN_BIGQUERY", "CATALOG_FOREIGN_DATABRICKS", "CATALOG_FOREIGN_MYSQL", "CATALOG_FOREIGN_POSTGRESQL", "CATALOG_FOREIGN_REDSHIFT", "CATALOG_FOREIGN_SNOWFLAKE", "CATALOG_FOREIGN_SQLDW", "CATALOG_FOREIGN_SQLSERVER", "CATALOG_INTERNAL", "CATALOG_STANDARD", "CATALOG_SYSTEM", "CATALOG_SYSTEM_DELTASHARING"`, v) } } @@ -720,6 +716,11 @@ func (s CreateConnection) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateEndpointRequest struct { + // Endpoint + Endpoint *Endpoint `json:"endpoint,omitempty"` +} + type CreateExternalLocation struct { // The AWS access point to use when accesing s3 for this external location. AccessPoint string `json:"access_point,omitempty"` @@ -1087,7 +1088,7 @@ type CreateStorageCredential struct { CloudflareApiToken *CloudflareApiToken `json:"cloudflare_api_token,omitempty"` // Comment associated with the credential. Comment string `json:"comment,omitempty"` - // The managed GCP service account configuration. + // The Databricks managed GCP service account configuration. DatabricksGcpServiceAccount *DatabricksGcpServiceAccountRequest `json:"databricks_gcp_service_account,omitempty"` // The credential name. The name must be unique within the metastore. Name string `json:"name"` @@ -1347,6 +1348,11 @@ type DeleteConnectionRequest struct { Name string `json:"-" url:"-"` } +// Delete an Endpoint +type DeleteEndpointRequest struct { + Name string `json:"-" url:"-"` +} + // Delete an external location type DeleteExternalLocationRequest struct { // Force deletion even if there are dependent external tables or mounts. @@ -1660,6 +1666,56 @@ type EncryptionDetails struct { SseEncryptionDetails *SseEncryptionDetails `json:"sse_encryption_details,omitempty"` } +// Endpoint +type Endpoint struct { + Name string `json:"name,omitempty"` + + Status EndpointState `json:"status,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *Endpoint) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Endpoint) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type EndpointState string + +const EndpointStateEndpointDeleting EndpointState = `ENDPOINT_DELETING` + +const EndpointStateEndpointFailed EndpointState = `ENDPOINT_FAILED` + +const EndpointStateEndpointOnline EndpointState = `ENDPOINT_ONLINE` + +const EndpointStateEndpointProvisioning EndpointState = `ENDPOINT_PROVISIONING` + +const EndpointStateEndpointStateUnspecified EndpointState = `ENDPOINT_STATE_UNSPECIFIED` + +// String representation for [fmt.Print] +func (f *EndpointState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *EndpointState) Set(v string) error { + switch v { + case `ENDPOINT_DELETING`, `ENDPOINT_FAILED`, `ENDPOINT_ONLINE`, `ENDPOINT_PROVISIONING`, `ENDPOINT_STATE_UNSPECIFIED`: + *f = EndpointState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ENDPOINT_DELETING", "ENDPOINT_FAILED", "ENDPOINT_ONLINE", "ENDPOINT_PROVISIONING", "ENDPOINT_STATE_UNSPECIFIED"`, v) + } +} + +// Type always returns EndpointState to satisfy [pflag.Value] interface +func (f *EndpointState) Type() string { + return "EndpointState" +} + // Get boolean reflecting if table exists type ExistsRequest struct { // Full name of the table. @@ -1685,6 +1741,9 @@ type ExternalLocationInfo struct { CredentialName string `json:"credential_name,omitempty"` // Encryption options that apply to clients connecting to cloud storage. EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` + // Whether the current securable is accessible from all workspaces or a + // specific set of workspaces. + IsolationMode IsolationMode `json:"isolation_mode,omitempty"` // Unique identifier of metastore hosting the external location. MetastoreId string `json:"metastore_id,omitempty"` // Name of the external location. @@ -2132,6 +2191,11 @@ func (s GetEffectiveRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Get an Endpoint +type GetEndpointRequest struct { + Name string `json:"-" url:"-"` +} + // Get an external location type GetExternalLocationRequest struct { // Whether to include external locations in the response for which the @@ -2394,9 +2458,9 @@ type GetWorkspaceBindingRequest struct { // set of workspaces. type IsolationMode string -const IsolationModeIsolated IsolationMode = `ISOLATED` +const IsolationModeIsolationModeIsolated IsolationMode = `ISOLATION_MODE_ISOLATED` -const IsolationModeOpen IsolationMode = `OPEN` +const IsolationModeIsolationModeOpen IsolationMode = `ISOLATION_MODE_OPEN` // String representation for [fmt.Print] func (f *IsolationMode) String() string { @@ -2406,11 +2470,11 @@ func (f *IsolationMode) String() string { // Set raw string value and validate it against allowed values func (f *IsolationMode) Set(v string) error { switch v { - case `ISOLATED`, `OPEN`: + case `ISOLATION_MODE_ISOLATED`, `ISOLATION_MODE_OPEN`: *f = IsolationMode(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "ISOLATED", "OPEN"`, v) + return fmt.Errorf(`value "%s" is not one of "ISOLATION_MODE_ISOLATED", "ISOLATION_MODE_OPEN"`, v) } } @@ -4270,10 +4334,13 @@ type StorageCredentialInfo struct { CreatedAt int64 `json:"created_at,omitempty"` // Username of credential creator. CreatedBy string `json:"created_by,omitempty"` - // The managed GCP service account configuration. + // The Databricks managed GCP service account configuration. DatabricksGcpServiceAccount *DatabricksGcpServiceAccountResponse `json:"databricks_gcp_service_account,omitempty"` // The unique identifier of the credential. Id string `json:"id,omitempty"` + // Whether the current securable is accessible from all workspaces or a + // specific set of workspaces. + IsolationMode IsolationMode `json:"isolation_mode,omitempty"` // Unique identifier of parent metastore. MetastoreId string `json:"metastore_id,omitempty"` // The credential name. The name must be unique within the metastore. @@ -4898,7 +4965,7 @@ type UpdateStorageCredential struct { CloudflareApiToken *CloudflareApiToken `json:"cloudflare_api_token,omitempty"` // Comment associated with the credential. Comment string `json:"comment,omitempty"` - // The managed GCP service account configuration. + // The Databricks managed GCP service account configuration. DatabricksGcpServiceAccount *DatabricksGcpServiceAccountRequest `json:"databricks_gcp_service_account,omitempty"` // Force update even if there are dependent external locations or external // tables. diff --git a/service/compute/model.go b/service/compute/model.go index 354002147..3f4fba20a 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -633,8 +633,8 @@ type ClusterDetails struct { DockerImage *DockerImage `json:"docker_image,omitempty"` // Node on which the Spark driver resides. The driver node contains the - // Spark master and the application that manages the - // per-notebook Spark REPLs. + // Spark master and the Databricks application that manages the per-notebook + // Spark REPLs. Driver *SparkNode `json:"driver,omitempty"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id @@ -4101,7 +4101,7 @@ type Policy struct { Definition string `json:"definition,omitempty"` // Additional human-readable description of the cluster policy. Description string `json:"description,omitempty"` - // If true, policy is a default policy created and managed by . + // If true, policy is a default policy created and managed by Databricks. // Default policies cannot be deleted, and their policy families cannot be // changed. IsDefault bool `json:"is_default,omitempty"` diff --git a/service/dashboards/api.go b/service/dashboards/api.go index 57273bab2..3e23829a1 100755 --- a/service/dashboards/api.go +++ b/service/dashboards/api.go @@ -7,6 +7,8 @@ import ( "context" "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/useragent" ) type LakeviewInterface interface { @@ -24,6 +26,24 @@ type LakeviewInterface interface { // Create a draft dashboard. Create(ctx context.Context, request CreateDashboardRequest) (*Dashboard, error) + // Create dashboard schedule. + CreateSchedule(ctx context.Context, request CreateScheduleRequest) (*Schedule, error) + + // Create schedule subscription. + CreateSubscription(ctx context.Context, request CreateSubscriptionRequest) (*Subscription, error) + + // Delete dashboard schedule. + DeleteSchedule(ctx context.Context, request DeleteScheduleRequest) error + + // Delete dashboard schedule. + DeleteScheduleByDashboardIdAndScheduleId(ctx context.Context, dashboardId string, scheduleId string) error + + // Delete schedule subscription. + DeleteSubscription(ctx context.Context, request DeleteSubscriptionRequest) error + + // Delete schedule subscription. + DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId(ctx context.Context, dashboardId string, scheduleId string, subscriptionId string) error + // Get dashboard. // // Get a draft dashboard. @@ -44,6 +64,44 @@ type LakeviewInterface interface { // Get the current published dashboard. GetPublishedByDashboardId(ctx context.Context, dashboardId string) (*PublishedDashboard, error) + // Get dashboard schedule. + GetSchedule(ctx context.Context, request GetScheduleRequest) (*Schedule, error) + + // Get dashboard schedule. + GetScheduleByDashboardIdAndScheduleId(ctx context.Context, dashboardId string, scheduleId string) (*Schedule, error) + + // Get schedule subscription. + GetSubscription(ctx context.Context, request GetSubscriptionRequest) (*Subscription, error) + + // Get schedule subscription. + GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId(ctx context.Context, dashboardId string, scheduleId string, subscriptionId string) (*Subscription, error) + + // List dashboard schedules. + // + // This method is generated by Databricks SDK Code Generator. + ListSchedules(ctx context.Context, request ListSchedulesRequest) listing.Iterator[Schedule] + + // List dashboard schedules. + // + // This method is generated by Databricks SDK Code Generator. + ListSchedulesAll(ctx context.Context, request ListSchedulesRequest) ([]Schedule, error) + + // List dashboard schedules. + ListSchedulesByDashboardId(ctx context.Context, dashboardId string) (*ListSchedulesResponse, error) + + // List schedule subscriptions. + // + // This method is generated by Databricks SDK Code Generator. + ListSubscriptions(ctx context.Context, request ListSubscriptionsRequest) listing.Iterator[Subscription] + + // List schedule subscriptions. + // + // This method is generated by Databricks SDK Code Generator. + ListSubscriptionsAll(ctx context.Context, request ListSubscriptionsRequest) ([]Subscription, error) + + // List schedule subscriptions. + ListSubscriptionsByDashboardIdAndScheduleId(ctx context.Context, dashboardId string, scheduleId string) (*ListSubscriptionsResponse, error) + // Migrate dashboard. // // Migrates a classic SQL dashboard to Lakeview. @@ -78,6 +136,9 @@ type LakeviewInterface interface { // // Update a draft dashboard. Update(ctx context.Context, request UpdateDashboardRequest) (*Dashboard, error) + + // Update dashboard schedule. + UpdateSchedule(ctx context.Context, request UpdateScheduleRequest) (*Schedule, error) } func NewLakeview(client *client.DatabricksClient) *LakeviewAPI { @@ -118,6 +179,43 @@ func (a *LakeviewAPI) Create(ctx context.Context, request CreateDashboardRequest return a.impl.Create(ctx, request) } +// Create dashboard schedule. +func (a *LakeviewAPI) CreateSchedule(ctx context.Context, request CreateScheduleRequest) (*Schedule, error) { + return a.impl.CreateSchedule(ctx, request) +} + +// Create schedule subscription. +func (a *LakeviewAPI) CreateSubscription(ctx context.Context, request CreateSubscriptionRequest) (*Subscription, error) { + return a.impl.CreateSubscription(ctx, request) +} + +// Delete dashboard schedule. +func (a *LakeviewAPI) DeleteSchedule(ctx context.Context, request DeleteScheduleRequest) error { + return a.impl.DeleteSchedule(ctx, request) +} + +// Delete dashboard schedule. +func (a *LakeviewAPI) DeleteScheduleByDashboardIdAndScheduleId(ctx context.Context, dashboardId string, scheduleId string) error { + return a.impl.DeleteSchedule(ctx, DeleteScheduleRequest{ + DashboardId: dashboardId, + ScheduleId: scheduleId, + }) +} + +// Delete schedule subscription. +func (a *LakeviewAPI) DeleteSubscription(ctx context.Context, request DeleteSubscriptionRequest) error { + return a.impl.DeleteSubscription(ctx, request) +} + +// Delete schedule subscription. +func (a *LakeviewAPI) DeleteSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId(ctx context.Context, dashboardId string, scheduleId string, subscriptionId string) error { + return a.impl.DeleteSubscription(ctx, DeleteSubscriptionRequest{ + DashboardId: dashboardId, + ScheduleId: scheduleId, + SubscriptionId: subscriptionId, + }) +} + // Get dashboard. // // Get a draft dashboard. @@ -150,6 +248,118 @@ func (a *LakeviewAPI) GetPublishedByDashboardId(ctx context.Context, dashboardId }) } +// Get dashboard schedule. +func (a *LakeviewAPI) GetSchedule(ctx context.Context, request GetScheduleRequest) (*Schedule, error) { + return a.impl.GetSchedule(ctx, request) +} + +// Get dashboard schedule. +func (a *LakeviewAPI) GetScheduleByDashboardIdAndScheduleId(ctx context.Context, dashboardId string, scheduleId string) (*Schedule, error) { + return a.impl.GetSchedule(ctx, GetScheduleRequest{ + DashboardId: dashboardId, + ScheduleId: scheduleId, + }) +} + +// Get schedule subscription. +func (a *LakeviewAPI) GetSubscription(ctx context.Context, request GetSubscriptionRequest) (*Subscription, error) { + return a.impl.GetSubscription(ctx, request) +} + +// Get schedule subscription. +func (a *LakeviewAPI) GetSubscriptionByDashboardIdAndScheduleIdAndSubscriptionId(ctx context.Context, dashboardId string, scheduleId string, subscriptionId string) (*Subscription, error) { + return a.impl.GetSubscription(ctx, GetSubscriptionRequest{ + DashboardId: dashboardId, + ScheduleId: scheduleId, + SubscriptionId: subscriptionId, + }) +} + +// List dashboard schedules. +// +// This method is generated by Databricks SDK Code Generator. +func (a *LakeviewAPI) ListSchedules(ctx context.Context, request ListSchedulesRequest) listing.Iterator[Schedule] { + + getNextPage := func(ctx context.Context, req ListSchedulesRequest) (*ListSchedulesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.impl.ListSchedules(ctx, req) + } + getItems := func(resp *ListSchedulesResponse) []Schedule { + return resp.Schedules + } + getNextReq := func(resp *ListSchedulesResponse) *ListSchedulesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List dashboard schedules. +// +// This method is generated by Databricks SDK Code Generator. +func (a *LakeviewAPI) ListSchedulesAll(ctx context.Context, request ListSchedulesRequest) ([]Schedule, error) { + iterator := a.ListSchedules(ctx, request) + return listing.ToSlice[Schedule](ctx, iterator) +} + +// List dashboard schedules. +func (a *LakeviewAPI) ListSchedulesByDashboardId(ctx context.Context, dashboardId string) (*ListSchedulesResponse, error) { + return a.impl.ListSchedules(ctx, ListSchedulesRequest{ + DashboardId: dashboardId, + }) +} + +// List schedule subscriptions. +// +// This method is generated by Databricks SDK Code Generator. +func (a *LakeviewAPI) ListSubscriptions(ctx context.Context, request ListSubscriptionsRequest) listing.Iterator[Subscription] { + + getNextPage := func(ctx context.Context, req ListSubscriptionsRequest) (*ListSubscriptionsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.impl.ListSubscriptions(ctx, req) + } + getItems := func(resp *ListSubscriptionsResponse) []Subscription { + return resp.Subscriptions + } + getNextReq := func(resp *ListSubscriptionsResponse) *ListSubscriptionsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List schedule subscriptions. +// +// This method is generated by Databricks SDK Code Generator. +func (a *LakeviewAPI) ListSubscriptionsAll(ctx context.Context, request ListSubscriptionsRequest) ([]Subscription, error) { + iterator := a.ListSubscriptions(ctx, request) + return listing.ToSlice[Subscription](ctx, iterator) +} + +// List schedule subscriptions. +func (a *LakeviewAPI) ListSubscriptionsByDashboardIdAndScheduleId(ctx context.Context, dashboardId string, scheduleId string) (*ListSubscriptionsResponse, error) { + return a.impl.ListSubscriptions(ctx, ListSubscriptionsRequest{ + DashboardId: dashboardId, + ScheduleId: scheduleId, + }) +} + // Migrate dashboard. // // Migrates a classic SQL dashboard to Lakeview. @@ -202,3 +412,8 @@ func (a *LakeviewAPI) UnpublishByDashboardId(ctx context.Context, dashboardId st func (a *LakeviewAPI) Update(ctx context.Context, request UpdateDashboardRequest) (*Dashboard, error) { return a.impl.Update(ctx, request) } + +// Update dashboard schedule. +func (a *LakeviewAPI) UpdateSchedule(ctx context.Context, request UpdateScheduleRequest) (*Schedule, error) { + return a.impl.UpdateSchedule(ctx, request) +} diff --git a/service/dashboards/impl.go b/service/dashboards/impl.go index dc716589b..ea15b310d 100755 --- a/service/dashboards/impl.go +++ b/service/dashboards/impl.go @@ -25,6 +25,44 @@ func (a *lakeviewImpl) Create(ctx context.Context, request CreateDashboardReques return &dashboard, err } +func (a *lakeviewImpl) CreateSchedule(ctx context.Context, request CreateScheduleRequest) (*Schedule, error) { + var schedule Schedule + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules", request.DashboardId) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, request, &schedule) + return &schedule, err +} + +func (a *lakeviewImpl) CreateSubscription(ctx context.Context, request CreateSubscriptionRequest) (*Subscription, error) { + var subscription Subscription + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions", request.DashboardId, request.ScheduleId) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, request, &subscription) + return &subscription, err +} + +func (a *lakeviewImpl) DeleteSchedule(ctx context.Context, request DeleteScheduleRequest) error { + var deleteScheduleResponse DeleteScheduleResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v", request.DashboardId, request.ScheduleId) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deleteScheduleResponse) + return err +} + +func (a *lakeviewImpl) DeleteSubscription(ctx context.Context, request DeleteSubscriptionRequest) error { + var deleteSubscriptionResponse DeleteSubscriptionResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions/%v", request.DashboardId, request.ScheduleId, request.SubscriptionId) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deleteSubscriptionResponse) + return err +} + func (a *lakeviewImpl) Get(ctx context.Context, request GetDashboardRequest) (*Dashboard, error) { var dashboard Dashboard path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v", request.DashboardId) @@ -43,6 +81,42 @@ func (a *lakeviewImpl) GetPublished(ctx context.Context, request GetPublishedDas return &publishedDashboard, err } +func (a *lakeviewImpl) GetSchedule(ctx context.Context, request GetScheduleRequest) (*Schedule, error) { + var schedule Schedule + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v", request.DashboardId, request.ScheduleId) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &schedule) + return &schedule, err +} + +func (a *lakeviewImpl) GetSubscription(ctx context.Context, request GetSubscriptionRequest) (*Subscription, error) { + var subscription Subscription + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions/%v", request.DashboardId, request.ScheduleId, request.SubscriptionId) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &subscription) + return &subscription, err +} + +func (a *lakeviewImpl) ListSchedules(ctx context.Context, request ListSchedulesRequest) (*ListSchedulesResponse, error) { + var listSchedulesResponse ListSchedulesResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules", request.DashboardId) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &listSchedulesResponse) + return &listSchedulesResponse, err +} + +func (a *lakeviewImpl) ListSubscriptions(ctx context.Context, request ListSubscriptionsRequest) (*ListSubscriptionsResponse, error) { + var listSubscriptionsResponse ListSubscriptionsResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions", request.DashboardId, request.ScheduleId) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &listSubscriptionsResponse) + return &listSubscriptionsResponse, err +} + func (a *lakeviewImpl) Migrate(ctx context.Context, request MigrateDashboardRequest) (*Dashboard, error) { var dashboard Dashboard path := "/api/2.0/lakeview/dashboards/migrate" @@ -90,3 +164,13 @@ func (a *lakeviewImpl) Update(ctx context.Context, request UpdateDashboardReques err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &dashboard) return &dashboard, err } + +func (a *lakeviewImpl) UpdateSchedule(ctx context.Context, request UpdateScheduleRequest) (*Schedule, error) { + var schedule Schedule + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v", request.DashboardId, request.ScheduleId) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, request, &schedule) + return &schedule, err +} diff --git a/service/dashboards/interface.go b/service/dashboards/interface.go index cdc6b8d00..e8e491caa 100755 --- a/service/dashboards/interface.go +++ b/service/dashboards/interface.go @@ -16,6 +16,18 @@ type LakeviewService interface { // Create a draft dashboard. Create(ctx context.Context, request CreateDashboardRequest) (*Dashboard, error) + // Create dashboard schedule. + CreateSchedule(ctx context.Context, request CreateScheduleRequest) (*Schedule, error) + + // Create schedule subscription. + CreateSubscription(ctx context.Context, request CreateSubscriptionRequest) (*Subscription, error) + + // Delete dashboard schedule. + DeleteSchedule(ctx context.Context, request DeleteScheduleRequest) error + + // Delete schedule subscription. + DeleteSubscription(ctx context.Context, request DeleteSubscriptionRequest) error + // Get dashboard. // // Get a draft dashboard. @@ -26,6 +38,22 @@ type LakeviewService interface { // Get the current published dashboard. GetPublished(ctx context.Context, request GetPublishedDashboardRequest) (*PublishedDashboard, error) + // Get dashboard schedule. + GetSchedule(ctx context.Context, request GetScheduleRequest) (*Schedule, error) + + // Get schedule subscription. + GetSubscription(ctx context.Context, request GetSubscriptionRequest) (*Subscription, error) + + // List dashboard schedules. + // + // Use ListSchedulesAll() to get all Schedule instances, which will iterate over every result page. + ListSchedules(ctx context.Context, request ListSchedulesRequest) (*ListSchedulesResponse, error) + + // List schedule subscriptions. + // + // Use ListSubscriptionsAll() to get all Subscription instances, which will iterate over every result page. + ListSubscriptions(ctx context.Context, request ListSubscriptionsRequest) (*ListSubscriptionsResponse, error) + // Migrate dashboard. // // Migrates a classic SQL dashboard to Lakeview. @@ -50,4 +78,7 @@ type LakeviewService interface { // // Update a draft dashboard. Update(ctx context.Context, request UpdateDashboardRequest) (*Dashboard, error) + + // Update dashboard schedule. + UpdateSchedule(ctx context.Context, request UpdateScheduleRequest) (*Schedule, error) } diff --git a/service/dashboards/model.go b/service/dashboards/model.go index 23dd8e858..3b8d07f52 100755 --- a/service/dashboards/model.go +++ b/service/dashboards/model.go @@ -30,6 +30,51 @@ func (s CreateDashboardRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateScheduleRequest struct { + // The cron expression describing the frequency of the periodic refresh for + // this schedule. + CronSchedule CronSchedule `json:"cron_schedule"` + // UUID identifying the dashboard to which the schedule belongs. + DashboardId string `json:"-" url:"-"` + // The display name for schedule. + DisplayName string `json:"display_name,omitempty"` + // The status indicates whether this schedule is paused or not. + PauseStatus SchedulePauseStatus `json:"pause_status,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *CreateScheduleRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateScheduleRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateSubscriptionRequest struct { + // UUID identifying the dashboard to which the subscription belongs. + DashboardId string `json:"-" url:"-"` + // UUID identifying the schedule to which the subscription belongs. + ScheduleId string `json:"-" url:"-"` + // Subscriber details for users and destinations to be added as subscribers + // to the schedule. + Subscriber Subscriber `json:"subscriber"` +} + +type CronSchedule struct { + // A cron expression using quartz syntax. EX: `0 0 8 * * ?` represents + // everyday at 8am. See [Cron Trigger] for details. + // + // [Cron Trigger]: http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html + QuartzCronExpression string `json:"quartz_cron_expression"` + // A Java timezone id. The schedule will be resolved with respect to this + // timezone. See [Java TimeZone] for details. + // + // [Java TimeZone]: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html + TimezoneId string `json:"timezone_id"` +} + type Dashboard struct { // The timestamp of when the dashboard was created. CreateTime string `json:"create_time,omitempty"` @@ -65,6 +110,56 @@ func (s Dashboard) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Delete dashboard schedule +type DeleteScheduleRequest struct { + // UUID identifying the dashboard to which the schedule belongs. + DashboardId string `json:"-" url:"-"` + // The etag for the schedule. Optionally, it can be provided to verify that + // the schedule has not been modified from its last retrieval. + Etag string `json:"-" url:"etag,omitempty"` + // UUID identifying the schedule. + ScheduleId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-"` +} + +func (s *DeleteScheduleRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DeleteScheduleRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DeleteScheduleResponse struct { +} + +// Delete schedule subscription +type DeleteSubscriptionRequest struct { + // UUID identifying the dashboard which the subscription belongs. + DashboardId string `json:"-" url:"-"` + // The etag for the subscription. Can be optionally provided to ensure that + // the subscription has not been modified since the last read. + Etag string `json:"-" url:"etag,omitempty"` + // UUID identifying the schedule which the subscription belongs. + ScheduleId string `json:"-" url:"-"` + // UUID identifying the subscription. + SubscriptionId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-"` +} + +func (s *DeleteSubscriptionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DeleteSubscriptionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DeleteSubscriptionResponse struct { +} + // Get dashboard type GetDashboardRequest struct { // UUID identifying the dashboard. @@ -77,6 +172,24 @@ type GetPublishedDashboardRequest struct { DashboardId string `json:"-" url:"-"` } +// Get dashboard schedule +type GetScheduleRequest struct { + // UUID identifying the dashboard to which the schedule belongs. + DashboardId string `json:"-" url:"-"` + // UUID identifying the schedule. + ScheduleId string `json:"-" url:"-"` +} + +// Get schedule subscription +type GetSubscriptionRequest struct { + // UUID identifying the dashboard which the subscription belongs. + DashboardId string `json:"-" url:"-"` + // UUID identifying the schedule which the subscription belongs. + ScheduleId string `json:"-" url:"-"` + // UUID identifying the subscription. + SubscriptionId string `json:"-" url:"-"` +} + type LifecycleState string const LifecycleStateActive LifecycleState = `ACTIVE` @@ -104,6 +217,88 @@ func (f *LifecycleState) Type() string { return "LifecycleState" } +// List dashboard schedules +type ListSchedulesRequest struct { + // UUID identifying the dashboard to which the schedule belongs. + DashboardId string `json:"-" url:"-"` + // The number of schedules to return per page. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous `ListSchedules` call. Use this to + // retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ListSchedulesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListSchedulesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListSchedulesResponse struct { + // A token that can be used as a `page_token` in subsequent requests to + // retrieve the next page of results. If this field is omitted, there are no + // subsequent schedules. + NextPageToken string `json:"next_page_token,omitempty"` + + Schedules []Schedule `json:"schedules,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ListSchedulesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListSchedulesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// List schedule subscriptions +type ListSubscriptionsRequest struct { + // UUID identifying the dashboard to which the subscription belongs. + DashboardId string `json:"-" url:"-"` + // The number of subscriptions to return per page. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous `ListSubscriptions` call. Use this + // to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + // UUID identifying the schedule to which the subscription belongs. + ScheduleId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-"` +} + +func (s *ListSubscriptionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListSubscriptionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListSubscriptionsResponse struct { + // A token that can be used as a `page_token` in subsequent requests to + // retrieve the next page of results. If this field is omitted, there are no + // subsequent subscriptions. + NextPageToken string `json:"next_page_token,omitempty"` + + Subscriptions []Subscription `json:"subscriptions,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ListSubscriptionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListSubscriptionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type MigrateDashboardRequest struct { // Display name for the new Lakeview dashboard. DisplayName string `json:"display_name,omitempty"` @@ -167,6 +362,118 @@ func (s PublishedDashboard) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type Schedule struct { + // A timestamp indicating when the schedule was created. + CreateTime string `json:"create_time,omitempty"` + // The cron expression describing the frequency of the periodic refresh for + // this schedule. + CronSchedule CronSchedule `json:"cron_schedule"` + // UUID identifying the dashboard to which the schedule belongs. + DashboardId string `json:"dashboard_id,omitempty"` + // The display name for schedule. + DisplayName string `json:"display_name,omitempty"` + // The etag for the schedule. Must be left empty on create, must be provided + // on updates to ensure that the schedule has not been modified since the + // last read, and can be optionally provided on delete. + Etag string `json:"etag,omitempty"` + // The status indicates whether this schedule is paused or not. + PauseStatus SchedulePauseStatus `json:"pause_status,omitempty"` + // UUID identifying the schedule. + ScheduleId string `json:"schedule_id,omitempty"` + // A timestamp indicating when the schedule was last updated. + UpdateTime string `json:"update_time,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *Schedule) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Schedule) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type SchedulePauseStatus string + +const SchedulePauseStatusPaused SchedulePauseStatus = `PAUSED` + +const SchedulePauseStatusUnpaused SchedulePauseStatus = `UNPAUSED` + +// String representation for [fmt.Print] +func (f *SchedulePauseStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *SchedulePauseStatus) Set(v string) error { + switch v { + case `PAUSED`, `UNPAUSED`: + *f = SchedulePauseStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "PAUSED", "UNPAUSED"`, v) + } +} + +// Type always returns SchedulePauseStatus to satisfy [pflag.Value] interface +func (f *SchedulePauseStatus) Type() string { + return "SchedulePauseStatus" +} + +type Subscriber struct { + // The destination to receive the subscription email. This parameter is + // mutually exclusive with `user_subscriber`. + DestinationSubscriber *SubscriptionSubscriberDestination `json:"destination_subscriber,omitempty"` + // The user to receive the subscription email. This parameter is mutually + // exclusive with `destination_subscriber`. + UserSubscriber *SubscriptionSubscriberUser `json:"user_subscriber,omitempty"` +} + +type Subscription struct { + // A timestamp indicating when the subscription was created. + CreateTime string `json:"create_time,omitempty"` + // UserId of the user who adds subscribers (users or notification + // destinations) to the dashboard's schedule. + CreatedByUserId int64 `json:"created_by_user_id,omitempty"` + // UUID identifying the dashboard to which the subscription belongs. + DashboardId string `json:"dashboard_id,omitempty"` + // The etag for the subscription. Must be left empty on create, can be + // optionally provided on delete to ensure that the subscription has not + // been deleted since the last read. + Etag string `json:"etag,omitempty"` + // UUID identifying the schedule to which the subscription belongs. + ScheduleId string `json:"schedule_id,omitempty"` + // Subscriber details for users and destinations to be added as subscribers + // to the schedule. + Subscriber Subscriber `json:"subscriber"` + // UUID identifying the subscription. + SubscriptionId string `json:"subscription_id,omitempty"` + // A timestamp indicating when the subscription was last updated. + UpdateTime string `json:"update_time,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *Subscription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Subscription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type SubscriptionSubscriberDestination struct { + // The canonical identifier of the destination to receive email + // notification. + DestinationId string `json:"destination_id"` +} + +type SubscriptionSubscriberUser struct { + // UserId of the subscriber. + UserId int64 `json:"user_id"` +} + // Trash dashboard type TrashDashboardRequest struct { // UUID identifying the dashboard. @@ -208,3 +515,31 @@ func (s *UpdateDashboardRequest) UnmarshalJSON(b []byte) error { func (s UpdateDashboardRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } + +type UpdateScheduleRequest struct { + // The cron expression describing the frequency of the periodic refresh for + // this schedule. + CronSchedule CronSchedule `json:"cron_schedule"` + // UUID identifying the dashboard to which the schedule belongs. + DashboardId string `json:"-" url:"-"` + // The display name for schedule. + DisplayName string `json:"display_name,omitempty"` + // The etag for the schedule. Must be left empty on create, must be provided + // on updates to ensure that the schedule has not been modified since the + // last read, and can be optionally provided on delete. + Etag string `json:"etag,omitempty"` + // The status indicates whether this schedule is paused or not. + PauseStatus SchedulePauseStatus `json:"pause_status,omitempty"` + // UUID identifying the schedule. + ScheduleId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-"` +} + +func (s *UpdateScheduleRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateScheduleRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} diff --git a/service/iam/model.go b/service/iam/model.go index 55e4ccf6b..c2f2067d1 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"` + Id string `json:"id,omitempty" url:"-"` 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"` + Id string `json:"id,omitempty" url:"-"` // Corresponds to AWS instance profile/arn role. Roles []ComplexValue `json:"roles,omitempty"` // The schema of the List response. @@ -1317,7 +1317,7 @@ type User struct { Groups []ComplexValue `json:"groups,omitempty"` // Databricks user ID. This is automatically set by Databricks. Any value // provided by the client will be ignored. - Id string `json:"id,omitempty" url:"-"` + Id string `json:"id,omitempty"` Name *Name `json:"name,omitempty"` // Corresponds to AWS instance profile/arn role. diff --git a/service/jobs/model.go b/service/jobs/model.go index 3981a1f18..7a17a360d 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -1704,6 +1704,43 @@ func (f *PauseStatus) Type() string { return "PauseStatus" } +type PeriodicTriggerConfiguration struct { + Interval int `json:"interval"` + + Unit PeriodicTriggerConfigurationTimeUnit `json:"unit"` +} + +type PeriodicTriggerConfigurationTimeUnit string + +const PeriodicTriggerConfigurationTimeUnitDays PeriodicTriggerConfigurationTimeUnit = `DAYS` + +const PeriodicTriggerConfigurationTimeUnitHours PeriodicTriggerConfigurationTimeUnit = `HOURS` + +const PeriodicTriggerConfigurationTimeUnitTimeUnitUnspecified PeriodicTriggerConfigurationTimeUnit = `TIME_UNIT_UNSPECIFIED` + +const PeriodicTriggerConfigurationTimeUnitWeeks PeriodicTriggerConfigurationTimeUnit = `WEEKS` + +// String representation for [fmt.Print] +func (f *PeriodicTriggerConfigurationTimeUnit) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *PeriodicTriggerConfigurationTimeUnit) Set(v string) error { + switch v { + case `DAYS`, `HOURS`, `TIME_UNIT_UNSPECIFIED`, `WEEKS`: + *f = PeriodicTriggerConfigurationTimeUnit(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DAYS", "HOURS", "TIME_UNIT_UNSPECIFIED", "WEEKS"`, v) + } +} + +// Type always returns PeriodicTriggerConfigurationTimeUnit to satisfy [pflag.Value] interface +func (f *PeriodicTriggerConfigurationTimeUnit) Type() string { + return "PeriodicTriggerConfigurationTimeUnit" +} + type PipelineParams struct { // If true, triggers a full refresh on the delta live table. FullRefresh bool `json:"full_refresh,omitempty"` @@ -3881,6 +3918,8 @@ type TriggerSettings struct { FileArrival *FileArrivalTriggerConfiguration `json:"file_arrival,omitempty"` // Whether this trigger is paused or not. PauseStatus PauseStatus `json:"pause_status,omitempty"` + + Periodic *PeriodicTriggerConfiguration `json:"periodic,omitempty"` // Old table trigger settings name. Deprecated in favor of `table_update`. Table *TableUpdateTriggerConfiguration `json:"table,omitempty"` diff --git a/service/pipelines/model.go b/service/pipelines/model.go index 97d104003..1c615f354 100755 --- a/service/pipelines/model.go +++ b/service/pipelines/model.go @@ -978,7 +978,7 @@ type PipelineLibrary struct { // Specification of a maven library to be installed. Maven *compute.MavenLibrary `json:"maven,omitempty"` // The path to a notebook that defines a pipeline and is stored in the - // workspace. + // Databricks workspace. Notebook *NotebookLibrary `json:"notebook,omitempty"` ForceSendFields []string `json:"-"` diff --git a/service/pkg.go b/service/pkg.go index a4e8181a9..e5688291b 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -64,6 +64,8 @@ // // - [provisioning.EncryptionKeysAPI]: These APIs manage encryption key configurations for this workspace (optional). // +// - [catalog.EndpointsAPI]: Endpoints are used to connect to PG clusters. +// // - [settings.EnhancedSecurityMonitoringAPI]: Controls whether enhanced security monitoring is enabled for the current workspace. // // - [settings.EsmEnablementAccountAPI]: The enhanced security monitoring setting at the account level controls whether to enable the feature on new workspaces. @@ -287,6 +289,7 @@ var ( _ *sql.DbsqlPermissionsAPI = nil _ *settings.DefaultNamespaceAPI = nil _ *provisioning.EncryptionKeysAPI = nil + _ *catalog.EndpointsAPI = nil _ *settings.EnhancedSecurityMonitoringAPI = nil _ *settings.EsmEnablementAccountAPI = nil _ *ml.ExperimentsAPI = nil diff --git a/service/serving/model.go b/service/serving/model.go index 72d976efb..472d7a34d 100755 --- a/service/serving/model.go +++ b/service/serving/model.go @@ -83,6 +83,10 @@ type App struct { // The pending deployment of the app. PendingDeployment *AppDeployment `json:"pending_deployment,omitempty"` + ServicePrincipalId int64 `json:"service_principal_id,omitempty"` + + ServicePrincipalName string `json:"service_principal_name,omitempty"` + Status *AppStatus `json:"status,omitempty"` // The update time of the app. Formatted timestamp in ISO 6801. UpdateTime string `json:"update_time,omitempty"` diff --git a/service/sql/model.go b/service/sql/model.go index e08608ba1..c7db41440 100755 --- a/service/sql/model.go +++ b/service/sql/model.go @@ -1326,7 +1326,9 @@ type ExecuteStatementRequest struct { // determines what should happen after the timeout is reached. WaitTimeout string `json:"wait_timeout,omitempty"` // Warehouse upon which to execute a statement. See also [What are SQL - // warehouses?](/sql/admin/warehouse-type.html) + // warehouses?] + // + // [What are SQL warehouses?]: https://docs.databricks.com/sql/admin/warehouse-type.html WarehouseId string `json:"warehouse_id"` ForceSendFields []string `json:"-"` @@ -3065,9 +3067,10 @@ type StatementParameterListItem struct { // The data type, given as a string. For example: `INT`, `STRING`, // `DECIMAL(10,2)`. If no type is given the type is assumed to be `STRING`. // Complex types, such as `ARRAY`, `MAP`, and `STRUCT` are not supported. - // For valid types, refer to the section [Data - // types](/sql/language-manual/functions/cast.html) of the SQL language + // For valid types, refer to the section [Data types] of the SQL language // reference. + // + // [Data types]: https://docs.databricks.com/sql/language-manual/functions/cast.html Type string `json:"type,omitempty"` // The value to substitute, represented as a string. If omitted, the value // is interpreted as NULL. diff --git a/workspace_client.go b/workspace_client.go index 9d176242b..95cbfe389 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -217,6 +217,9 @@ type WorkspaceClient struct { // permissions (superset of `CAN_RUN`) DbsqlPermissions sql.DbsqlPermissionsInterface + // Endpoints are used to connect to PG clusters. + Endpoints catalog.EndpointsInterface + // Experiments are the primary unit of organization in MLflow; all MLflow // runs belong to an experiment. Each experiment lets you visualize, search, // and compare runs, as well as download run artifacts or metadata for @@ -1039,6 +1042,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { DataSources: sql.NewDataSources(databricksClient), Dbfs: files.NewDbfs(databricksClient), DbsqlPermissions: sql.NewDbsqlPermissions(databricksClient), + Endpoints: catalog.NewEndpoints(databricksClient), Experiments: ml.NewExperiments(databricksClient), ExternalLocations: catalog.NewExternalLocations(databricksClient), Files: files.NewFiles(databricksClient), From 99d635b9c0d453efe34c9216ddb0e5d37e1987f3 Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 7 Jun 2024 11:02:14 +0200 Subject: [PATCH 2/3] fixes --- internal/catalog_test.go | 2 +- service/catalog/catalogs_usage_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/catalog_test.go b/internal/catalog_test.go index a8aa09c09..7b7e9a9ee 100644 --- a/internal/catalog_test.go +++ b/internal/catalog_test.go @@ -364,7 +364,7 @@ func TestUcAccCatalogWorkspaceBindings(t *testing.T) { _, err = w.Catalogs.Update(ctx, catalog.UpdateCatalog{ Name: created.Name, - IsolationMode: catalog.IsolationModeIsolated, + IsolationMode: catalog.IsolationModeIsolationModeIsolated, }) require.NoError(t, err) diff --git a/service/catalog/catalogs_usage_test.go b/service/catalog/catalogs_usage_test.go index d1725a701..e2d1a696c 100755 --- a/service/catalog/catalogs_usage_test.go +++ b/service/catalog/catalogs_usage_test.go @@ -274,7 +274,7 @@ func ExampleCatalogsAPI_Update_catalogWorkspaceBindings() { _, err = w.Catalogs.Update(ctx, catalog.UpdateCatalog{ Name: created.Name, - IsolationMode: catalog.IsolationModeIsolated, + IsolationMode: catalog.IsolationModeIsolationModeIsolated, }) if err != nil { panic(err) From cd3841827a4756c43707a3593222ff763b03d298 Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 7 Jun 2024 11:13:53 +0200 Subject: [PATCH 3/3] Fixes --- experimental/mocks/mock_workspace_client.go | 9 - .../catalog/mock_endpoints_interface.go | 404 ------------------ service/catalog/api.go | 86 +--- service/catalog/impl.go | 33 -- service/catalog/interface.go | 13 - service/catalog/model.go | 65 --- service/pkg.go | 3 - workspace_client.go | 4 - 8 files changed, 1 insertion(+), 616 deletions(-) delete mode 100644 experimental/mocks/service/catalog/mock_endpoints_interface.go diff --git a/experimental/mocks/mock_workspace_client.go b/experimental/mocks/mock_workspace_client.go index d5736f5d4..79f03eccf 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -61,7 +61,6 @@ func NewMockWorkspaceClient(t interface { DataSources: sql.NewMockDataSourcesInterface(t), Dbfs: files.NewMockDbfsInterface(t), DbsqlPermissions: sql.NewMockDbsqlPermissionsInterface(t), - Endpoints: catalog.NewMockEndpointsInterface(t), Experiments: ml.NewMockExperimentsInterface(t), ExternalLocations: catalog.NewMockExternalLocationsInterface(t), Files: files.NewMockFilesInterface(t), @@ -360,14 +359,6 @@ func (m *MockWorkspaceClient) GetMockDbsqlPermissionsAPI() *sql.MockDbsqlPermiss return api } -func (m *MockWorkspaceClient) GetMockEndpointsAPI() *catalog.MockEndpointsInterface { - api, ok := m.WorkspaceClient.Endpoints.(*catalog.MockEndpointsInterface) - if !ok { - panic(fmt.Sprintf("expected Endpoints to be *catalog.MockEndpointsInterface, actual was %T", m.WorkspaceClient.Endpoints)) - } - return api -} - func (m *MockWorkspaceClient) GetMockExperimentsAPI() *ml.MockExperimentsInterface { api, ok := m.WorkspaceClient.Experiments.(*ml.MockExperimentsInterface) if !ok { diff --git a/experimental/mocks/service/catalog/mock_endpoints_interface.go b/experimental/mocks/service/catalog/mock_endpoints_interface.go deleted file mode 100644 index c2f86f08b..000000000 --- a/experimental/mocks/service/catalog/mock_endpoints_interface.go +++ /dev/null @@ -1,404 +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" -) - -// MockEndpointsInterface is an autogenerated mock type for the EndpointsInterface type -type MockEndpointsInterface struct { - mock.Mock -} - -type MockEndpointsInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockEndpointsInterface) EXPECT() *MockEndpointsInterface_Expecter { - return &MockEndpointsInterface_Expecter{mock: &_m.Mock} -} - -// Create provides a mock function with given fields: ctx, request -func (_m *MockEndpointsInterface) Create(ctx context.Context, request catalog.CreateEndpointRequest) (*catalog.Endpoint, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for Create") - } - - var r0 *catalog.Endpoint - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateEndpointRequest) (*catalog.Endpoint, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateEndpointRequest) *catalog.Endpoint); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.Endpoint) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, catalog.CreateEndpointRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockEndpointsInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' -type MockEndpointsInterface_Create_Call struct { - *mock.Call -} - -// Create is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.CreateEndpointRequest -func (_e *MockEndpointsInterface_Expecter) Create(ctx interface{}, request interface{}) *MockEndpointsInterface_Create_Call { - return &MockEndpointsInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} -} - -func (_c *MockEndpointsInterface_Create_Call) Run(run func(ctx context.Context, request catalog.CreateEndpointRequest)) *MockEndpointsInterface_Create_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.CreateEndpointRequest)) - }) - return _c -} - -func (_c *MockEndpointsInterface_Create_Call) Return(_a0 *catalog.Endpoint, _a1 error) *MockEndpointsInterface_Create_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockEndpointsInterface_Create_Call) RunAndReturn(run func(context.Context, catalog.CreateEndpointRequest) (*catalog.Endpoint, error)) *MockEndpointsInterface_Create_Call { - _c.Call.Return(run) - return _c -} - -// Delete provides a mock function with given fields: ctx, request -func (_m *MockEndpointsInterface) Delete(ctx context.Context, request catalog.DeleteEndpointRequest) 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.DeleteEndpointRequest) error); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockEndpointsInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' -type MockEndpointsInterface_Delete_Call struct { - *mock.Call -} - -// Delete is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.DeleteEndpointRequest -func (_e *MockEndpointsInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockEndpointsInterface_Delete_Call { - return &MockEndpointsInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} -} - -func (_c *MockEndpointsInterface_Delete_Call) Run(run func(ctx context.Context, request catalog.DeleteEndpointRequest)) *MockEndpointsInterface_Delete_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.DeleteEndpointRequest)) - }) - return _c -} - -func (_c *MockEndpointsInterface_Delete_Call) Return(_a0 error) *MockEndpointsInterface_Delete_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockEndpointsInterface_Delete_Call) RunAndReturn(run func(context.Context, catalog.DeleteEndpointRequest) error) *MockEndpointsInterface_Delete_Call { - _c.Call.Return(run) - return _c -} - -// DeleteByName provides a mock function with given fields: ctx, name -func (_m *MockEndpointsInterface) DeleteByName(ctx context.Context, name string) error { - ret := _m.Called(ctx, name) - - if len(ret) == 0 { - panic("no return value specified for DeleteByName") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { - r0 = rf(ctx, name) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockEndpointsInterface_DeleteByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByName' -type MockEndpointsInterface_DeleteByName_Call struct { - *mock.Call -} - -// DeleteByName is a helper method to define mock.On call -// - ctx context.Context -// - name string -func (_e *MockEndpointsInterface_Expecter) DeleteByName(ctx interface{}, name interface{}) *MockEndpointsInterface_DeleteByName_Call { - return &MockEndpointsInterface_DeleteByName_Call{Call: _e.mock.On("DeleteByName", ctx, name)} -} - -func (_c *MockEndpointsInterface_DeleteByName_Call) Run(run func(ctx context.Context, name string)) *MockEndpointsInterface_DeleteByName_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) - }) - return _c -} - -func (_c *MockEndpointsInterface_DeleteByName_Call) Return(_a0 error) *MockEndpointsInterface_DeleteByName_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockEndpointsInterface_DeleteByName_Call) RunAndReturn(run func(context.Context, string) error) *MockEndpointsInterface_DeleteByName_Call { - _c.Call.Return(run) - return _c -} - -// Get provides a mock function with given fields: ctx, request -func (_m *MockEndpointsInterface) Get(ctx context.Context, request catalog.GetEndpointRequest) (*catalog.Endpoint, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for Get") - } - - var r0 *catalog.Endpoint - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, catalog.GetEndpointRequest) (*catalog.Endpoint, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, catalog.GetEndpointRequest) *catalog.Endpoint); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.Endpoint) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, catalog.GetEndpointRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockEndpointsInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' -type MockEndpointsInterface_Get_Call struct { - *mock.Call -} - -// Get is a helper method to define mock.On call -// - ctx context.Context -// - request catalog.GetEndpointRequest -func (_e *MockEndpointsInterface_Expecter) Get(ctx interface{}, request interface{}) *MockEndpointsInterface_Get_Call { - return &MockEndpointsInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} -} - -func (_c *MockEndpointsInterface_Get_Call) Run(run func(ctx context.Context, request catalog.GetEndpointRequest)) *MockEndpointsInterface_Get_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(catalog.GetEndpointRequest)) - }) - return _c -} - -func (_c *MockEndpointsInterface_Get_Call) Return(_a0 *catalog.Endpoint, _a1 error) *MockEndpointsInterface_Get_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockEndpointsInterface_Get_Call) RunAndReturn(run func(context.Context, catalog.GetEndpointRequest) (*catalog.Endpoint, error)) *MockEndpointsInterface_Get_Call { - _c.Call.Return(run) - return _c -} - -// GetByName provides a mock function with given fields: ctx, name -func (_m *MockEndpointsInterface) GetByName(ctx context.Context, name string) (*catalog.Endpoint, error) { - ret := _m.Called(ctx, name) - - if len(ret) == 0 { - panic("no return value specified for GetByName") - } - - var r0 *catalog.Endpoint - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*catalog.Endpoint, error)); ok { - return rf(ctx, name) - } - if rf, ok := ret.Get(0).(func(context.Context, string) *catalog.Endpoint); ok { - r0 = rf(ctx, name) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*catalog.Endpoint) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, name) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockEndpointsInterface_GetByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByName' -type MockEndpointsInterface_GetByName_Call struct { - *mock.Call -} - -// GetByName is a helper method to define mock.On call -// - ctx context.Context -// - name string -func (_e *MockEndpointsInterface_Expecter) GetByName(ctx interface{}, name interface{}) *MockEndpointsInterface_GetByName_Call { - return &MockEndpointsInterface_GetByName_Call{Call: _e.mock.On("GetByName", ctx, name)} -} - -func (_c *MockEndpointsInterface_GetByName_Call) Run(run func(ctx context.Context, name string)) *MockEndpointsInterface_GetByName_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) - }) - return _c -} - -func (_c *MockEndpointsInterface_GetByName_Call) Return(_a0 *catalog.Endpoint, _a1 error) *MockEndpointsInterface_GetByName_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockEndpointsInterface_GetByName_Call) RunAndReturn(run func(context.Context, string) (*catalog.Endpoint, error)) *MockEndpointsInterface_GetByName_Call { - _c.Call.Return(run) - return _c -} - -// Impl provides a mock function with given fields: -func (_m *MockEndpointsInterface) Impl() catalog.EndpointsService { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Impl") - } - - var r0 catalog.EndpointsService - if rf, ok := ret.Get(0).(func() catalog.EndpointsService); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(catalog.EndpointsService) - } - } - - return r0 -} - -// MockEndpointsInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' -type MockEndpointsInterface_Impl_Call struct { - *mock.Call -} - -// Impl is a helper method to define mock.On call -func (_e *MockEndpointsInterface_Expecter) Impl() *MockEndpointsInterface_Impl_Call { - return &MockEndpointsInterface_Impl_Call{Call: _e.mock.On("Impl")} -} - -func (_c *MockEndpointsInterface_Impl_Call) Run(run func()) *MockEndpointsInterface_Impl_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockEndpointsInterface_Impl_Call) Return(_a0 catalog.EndpointsService) *MockEndpointsInterface_Impl_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockEndpointsInterface_Impl_Call) RunAndReturn(run func() catalog.EndpointsService) *MockEndpointsInterface_Impl_Call { - _c.Call.Return(run) - return _c -} - -// WithImpl provides a mock function with given fields: impl -func (_m *MockEndpointsInterface) WithImpl(impl catalog.EndpointsService) catalog.EndpointsInterface { - ret := _m.Called(impl) - - if len(ret) == 0 { - panic("no return value specified for WithImpl") - } - - var r0 catalog.EndpointsInterface - if rf, ok := ret.Get(0).(func(catalog.EndpointsService) catalog.EndpointsInterface); ok { - r0 = rf(impl) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(catalog.EndpointsInterface) - } - } - - return r0 -} - -// MockEndpointsInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' -type MockEndpointsInterface_WithImpl_Call struct { - *mock.Call -} - -// WithImpl is a helper method to define mock.On call -// - impl catalog.EndpointsService -func (_e *MockEndpointsInterface_Expecter) WithImpl(impl interface{}) *MockEndpointsInterface_WithImpl_Call { - return &MockEndpointsInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} -} - -func (_c *MockEndpointsInterface_WithImpl_Call) Run(run func(impl catalog.EndpointsService)) *MockEndpointsInterface_WithImpl_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(catalog.EndpointsService)) - }) - return _c -} - -func (_c *MockEndpointsInterface_WithImpl_Call) Return(_a0 catalog.EndpointsInterface) *MockEndpointsInterface_WithImpl_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockEndpointsInterface_WithImpl_Call) RunAndReturn(run func(catalog.EndpointsService) catalog.EndpointsInterface) *MockEndpointsInterface_WithImpl_Call { - _c.Call.Return(run) - return _c -} - -// NewMockEndpointsInterface creates a new instance of MockEndpointsInterface. 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 NewMockEndpointsInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MockEndpointsInterface { - mock := &MockEndpointsInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/service/catalog/api.go b/service/catalog/api.go index 344a4e07b..fcfa5423b 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, Endpoints, 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. +// 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 ( @@ -1108,90 +1108,6 @@ func (a *ConnectionsAPI) Update(ctx context.Context, request UpdateConnection) ( return a.impl.Update(ctx, request) } -type EndpointsInterface 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 MockEndpointsInterface instead. - WithImpl(impl EndpointsService) EndpointsInterface - - // Impl returns low-level Endpoints API implementation - // Deprecated: use MockEndpointsInterface instead. - Impl() EndpointsService - - // Create an Endpoint. - Create(ctx context.Context, request CreateEndpointRequest) (*Endpoint, error) - - // Delete an Endpoint. - Delete(ctx context.Context, request DeleteEndpointRequest) error - - // Delete an Endpoint. - DeleteByName(ctx context.Context, name string) error - - // Get an Endpoint. - Get(ctx context.Context, request GetEndpointRequest) (*Endpoint, error) - - // Get an Endpoint. - GetByName(ctx context.Context, name string) (*Endpoint, error) -} - -func NewEndpoints(client *client.DatabricksClient) *EndpointsAPI { - return &EndpointsAPI{ - impl: &endpointsImpl{ - client: client, - }, - } -} - -// Endpoints are used to connect to PG clusters. -type EndpointsAPI struct { - // impl contains low-level REST API interface, that could be overridden - // through WithImpl(EndpointsService) - impl EndpointsService -} - -// 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 MockEndpointsInterface instead. -func (a *EndpointsAPI) WithImpl(impl EndpointsService) EndpointsInterface { - a.impl = impl - return a -} - -// Impl returns low-level Endpoints API implementation -// Deprecated: use MockEndpointsInterface instead. -func (a *EndpointsAPI) Impl() EndpointsService { - return a.impl -} - -// Create an Endpoint. -func (a *EndpointsAPI) Create(ctx context.Context, request CreateEndpointRequest) (*Endpoint, error) { - return a.impl.Create(ctx, request) -} - -// Delete an Endpoint. -func (a *EndpointsAPI) Delete(ctx context.Context, request DeleteEndpointRequest) error { - return a.impl.Delete(ctx, request) -} - -// Delete an Endpoint. -func (a *EndpointsAPI) DeleteByName(ctx context.Context, name string) error { - return a.impl.Delete(ctx, DeleteEndpointRequest{ - Name: name, - }) -} - -// Get an Endpoint. -func (a *EndpointsAPI) Get(ctx context.Context, request GetEndpointRequest) (*Endpoint, error) { - return a.impl.Get(ctx, request) -} - -// Get an Endpoint. -func (a *EndpointsAPI) GetByName(ctx context.Context, name string) (*Endpoint, error) { - return a.impl.Get(ctx, GetEndpointRequest{ - Name: name, - }) -} - type ExternalLocationsInterface interface { // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. diff --git a/service/catalog/impl.go b/service/catalog/impl.go index 93a6a4928..312d9522c 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -294,39 +294,6 @@ func (a *connectionsImpl) Update(ctx context.Context, request UpdateConnection) return &connectionInfo, err } -// unexported type that holds implementations of just Endpoints API methods -type endpointsImpl struct { - client *client.DatabricksClient -} - -func (a *endpointsImpl) Create(ctx context.Context, request CreateEndpointRequest) (*Endpoint, error) { - var endpoint Endpoint - path := "/api/2.0/hadron-endpoints" - headers := make(map[string]string) - headers["Accept"] = "application/json" - headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPost, path, headers, request, &endpoint) - return &endpoint, err -} - -func (a *endpointsImpl) Delete(ctx context.Context, request DeleteEndpointRequest) error { - var deleteResponse DeleteResponse - path := fmt.Sprintf("/api/2.0/hadron-endpoints/%v", request.Name) - headers := make(map[string]string) - headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deleteResponse) - return err -} - -func (a *endpointsImpl) Get(ctx context.Context, request GetEndpointRequest) (*Endpoint, error) { - var endpoint Endpoint - path := fmt.Sprintf("/api/2.0/hadron-endpoints/%v", request.Name) - headers := make(map[string]string) - headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &endpoint) - return &endpoint, err -} - // unexported type that holds implementations of just ExternalLocations API methods type externalLocationsImpl struct { client *client.DatabricksClient diff --git a/service/catalog/interface.go b/service/catalog/interface.go index 3aab6d738..f5c406a46 100755 --- a/service/catalog/interface.go +++ b/service/catalog/interface.go @@ -234,19 +234,6 @@ type ConnectionsService interface { Update(ctx context.Context, request UpdateConnection) (*ConnectionInfo, error) } -// Endpoints are used to connect to PG clusters. -type EndpointsService interface { - - // Create an Endpoint. - Create(ctx context.Context, request CreateEndpointRequest) (*Endpoint, error) - - // Delete an Endpoint. - Delete(ctx context.Context, request DeleteEndpointRequest) error - - // Get an Endpoint. - Get(ctx context.Context, request GetEndpointRequest) (*Endpoint, error) -} - // An external location is an object that combines a cloud storage path with a // storage credential that authorizes access to the cloud storage path. Each // external location is subject to Unity Catalog access-control policies that diff --git a/service/catalog/model.go b/service/catalog/model.go index 7fe1e82d9..efb4f7268 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -716,11 +716,6 @@ func (s CreateConnection) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -type CreateEndpointRequest struct { - // Endpoint - Endpoint *Endpoint `json:"endpoint,omitempty"` -} - type CreateExternalLocation struct { // The AWS access point to use when accesing s3 for this external location. AccessPoint string `json:"access_point,omitempty"` @@ -1348,11 +1343,6 @@ type DeleteConnectionRequest struct { Name string `json:"-" url:"-"` } -// Delete an Endpoint -type DeleteEndpointRequest struct { - Name string `json:"-" url:"-"` -} - // Delete an external location type DeleteExternalLocationRequest struct { // Force deletion even if there are dependent external tables or mounts. @@ -1666,56 +1656,6 @@ type EncryptionDetails struct { SseEncryptionDetails *SseEncryptionDetails `json:"sse_encryption_details,omitempty"` } -// Endpoint -type Endpoint struct { - Name string `json:"name,omitempty"` - - Status EndpointState `json:"status,omitempty"` - - ForceSendFields []string `json:"-"` -} - -func (s *Endpoint) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, s) -} - -func (s Endpoint) MarshalJSON() ([]byte, error) { - return marshal.Marshal(s) -} - -type EndpointState string - -const EndpointStateEndpointDeleting EndpointState = `ENDPOINT_DELETING` - -const EndpointStateEndpointFailed EndpointState = `ENDPOINT_FAILED` - -const EndpointStateEndpointOnline EndpointState = `ENDPOINT_ONLINE` - -const EndpointStateEndpointProvisioning EndpointState = `ENDPOINT_PROVISIONING` - -const EndpointStateEndpointStateUnspecified EndpointState = `ENDPOINT_STATE_UNSPECIFIED` - -// String representation for [fmt.Print] -func (f *EndpointState) String() string { - return string(*f) -} - -// Set raw string value and validate it against allowed values -func (f *EndpointState) Set(v string) error { - switch v { - case `ENDPOINT_DELETING`, `ENDPOINT_FAILED`, `ENDPOINT_ONLINE`, `ENDPOINT_PROVISIONING`, `ENDPOINT_STATE_UNSPECIFIED`: - *f = EndpointState(v) - return nil - default: - return fmt.Errorf(`value "%s" is not one of "ENDPOINT_DELETING", "ENDPOINT_FAILED", "ENDPOINT_ONLINE", "ENDPOINT_PROVISIONING", "ENDPOINT_STATE_UNSPECIFIED"`, v) - } -} - -// Type always returns EndpointState to satisfy [pflag.Value] interface -func (f *EndpointState) Type() string { - return "EndpointState" -} - // Get boolean reflecting if table exists type ExistsRequest struct { // Full name of the table. @@ -2191,11 +2131,6 @@ func (s GetEffectiveRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Get an Endpoint -type GetEndpointRequest struct { - Name string `json:"-" url:"-"` -} - // Get an external location type GetExternalLocationRequest struct { // Whether to include external locations in the response for which the diff --git a/service/pkg.go b/service/pkg.go index e5688291b..a4e8181a9 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -64,8 +64,6 @@ // // - [provisioning.EncryptionKeysAPI]: These APIs manage encryption key configurations for this workspace (optional). // -// - [catalog.EndpointsAPI]: Endpoints are used to connect to PG clusters. -// // - [settings.EnhancedSecurityMonitoringAPI]: Controls whether enhanced security monitoring is enabled for the current workspace. // // - [settings.EsmEnablementAccountAPI]: The enhanced security monitoring setting at the account level controls whether to enable the feature on new workspaces. @@ -289,7 +287,6 @@ var ( _ *sql.DbsqlPermissionsAPI = nil _ *settings.DefaultNamespaceAPI = nil _ *provisioning.EncryptionKeysAPI = nil - _ *catalog.EndpointsAPI = nil _ *settings.EnhancedSecurityMonitoringAPI = nil _ *settings.EsmEnablementAccountAPI = nil _ *ml.ExperimentsAPI = nil diff --git a/workspace_client.go b/workspace_client.go index 95cbfe389..9d176242b 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -217,9 +217,6 @@ type WorkspaceClient struct { // permissions (superset of `CAN_RUN`) DbsqlPermissions sql.DbsqlPermissionsInterface - // Endpoints are used to connect to PG clusters. - Endpoints catalog.EndpointsInterface - // Experiments are the primary unit of organization in MLflow; all MLflow // runs belong to an experiment. Each experiment lets you visualize, search, // and compare runs, as well as download run artifacts or metadata for @@ -1042,7 +1039,6 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { DataSources: sql.NewDataSources(databricksClient), Dbfs: files.NewDbfs(databricksClient), DbsqlPermissions: sql.NewDbsqlPermissions(databricksClient), - Endpoints: catalog.NewEndpoints(databricksClient), Experiments: ml.NewExperiments(databricksClient), ExternalLocations: catalog.NewExternalLocations(databricksClient), Files: files.NewFiles(databricksClient),