From 672b0526a9a3f21e08865c463b2316cb568839e6 Mon Sep 17 00:00:00 2001 From: "databricks-ci-ghec-2[bot]" <184307802+databricks-ci-ghec-2[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 03:39:17 +0000 Subject: [PATCH] Update SDK to 5443705509e5ac693d61a35ba974cb7f68f444c6 --- .codegen/_openapi_sha | 2 +- NEXT_CHANGELOG.md | 4 + ...k_create_cdf_config_operation_interface.go | 268 +++++++++++ ...k_delete_cdf_config_operation_interface.go | 256 ++++++++++ .../postgres/mock_postgres_interface.go | 452 ++++++++++++++++++ service/catalog/model.go | 7 + service/jobs/model.go | 7 +- service/postgres/api.go | 320 +++++++++++++ service/postgres/impl.go | 153 ++++++ service/postgres/interface.go | 25 + service/postgres/model.go | 253 ++++++++++ service/supervisoragents/api.go | 8 +- service/supervisoragents/interface.go | 8 +- service/supervisoragents/model.go | 8 +- 14 files changed, 1759 insertions(+), 12 deletions(-) create mode 100644 experimental/mocks/service/postgres/mock_create_cdf_config_operation_interface.go create mode 100644 experimental/mocks/service/postgres/mock_delete_cdf_config_operation_interface.go mode change 100755 => 100644 experimental/mocks/service/postgres/mock_postgres_interface.go mode change 100755 => 100644 service/postgres/api.go mode change 100755 => 100644 service/postgres/impl.go mode change 100755 => 100644 service/postgres/interface.go mode change 100755 => 100644 service/supervisoragents/api.go mode change 100755 => 100644 service/supervisoragents/interface.go mode change 100755 => 100644 service/supervisoragents/model.go diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index c65050618..1933662a1 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -f561754f59f7073b13f51aef07550e0ddaabf4ce \ No newline at end of file +5443705509e5ac693d61a35ba974cb7f68f444c6 \ No newline at end of file diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index b610012ae..ca8e2d872 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -13,3 +13,7 @@ ### Internal Changes ### API Changes +* Add `CreateCdfConfig`, `DeleteCdfConfig`, `GetCdfConfig`, `GetCdfStatus`, `ListCdfConfigs` and `ListCdfStatuses` methods for [w.Postgres](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/postgres#PostgresAPI) workspace-level service. +* Add `Parent` field for [catalog.CreateConnection](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#CreateConnection). +* Add `Parent` field for [catalog.ListConnectionsRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ListConnectionsRequest). +* Add `Minutes` enum value for [jobs.PeriodicTriggerConfigurationTimeUnit](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#PeriodicTriggerConfigurationTimeUnit). \ No newline at end of file diff --git a/experimental/mocks/service/postgres/mock_create_cdf_config_operation_interface.go b/experimental/mocks/service/postgres/mock_create_cdf_config_operation_interface.go new file mode 100644 index 000000000..47e2d6746 --- /dev/null +++ b/experimental/mocks/service/postgres/mock_create_cdf_config_operation_interface.go @@ -0,0 +1,268 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package postgres + +import ( + context "context" + + api "github.com/databricks/databricks-sdk-go/experimental/api" + postgres "github.com/databricks/databricks-sdk-go/service/postgres" + mock "github.com/stretchr/testify/mock" +) + +// MockCreateCdfConfigOperationInterface is an autogenerated mock type for the CreateCdfConfigOperationInterface type +type MockCreateCdfConfigOperationInterface struct { + mock.Mock +} + +type MockCreateCdfConfigOperationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockCreateCdfConfigOperationInterface) EXPECT() *MockCreateCdfConfigOperationInterface_Expecter { + return &MockCreateCdfConfigOperationInterface_Expecter{mock: &_m.Mock} +} + +// Done provides a mock function with no fields +func (_m *MockCreateCdfConfigOperationInterface) Done() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Done") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateCdfConfigOperationInterface_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done' +type MockCreateCdfConfigOperationInterface_Done_Call struct { + *mock.Call +} + +// Done is a helper method to define mock.On call +func (_e *MockCreateCdfConfigOperationInterface_Expecter) Done() *MockCreateCdfConfigOperationInterface_Done_Call { + return &MockCreateCdfConfigOperationInterface_Done_Call{Call: _e.mock.On("Done")} +} + +func (_c *MockCreateCdfConfigOperationInterface_Done_Call) Run(run func()) *MockCreateCdfConfigOperationInterface_Done_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateCdfConfigOperationInterface_Done_Call) Return(_a0 bool, _a1 error) *MockCreateCdfConfigOperationInterface_Done_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateCdfConfigOperationInterface_Done_Call) RunAndReturn(run func() (bool, error)) *MockCreateCdfConfigOperationInterface_Done_Call { + _c.Call.Return(run) + return _c +} + +// Metadata provides a mock function with no fields +func (_m *MockCreateCdfConfigOperationInterface) Metadata() (*postgres.CdfConfigOperationMetadata, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Metadata") + } + + var r0 *postgres.CdfConfigOperationMetadata + var r1 error + if rf, ok := ret.Get(0).(func() (*postgres.CdfConfigOperationMetadata, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *postgres.CdfConfigOperationMetadata); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.CdfConfigOperationMetadata) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateCdfConfigOperationInterface_Metadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Metadata' +type MockCreateCdfConfigOperationInterface_Metadata_Call struct { + *mock.Call +} + +// Metadata is a helper method to define mock.On call +func (_e *MockCreateCdfConfigOperationInterface_Expecter) Metadata() *MockCreateCdfConfigOperationInterface_Metadata_Call { + return &MockCreateCdfConfigOperationInterface_Metadata_Call{Call: _e.mock.On("Metadata")} +} + +func (_c *MockCreateCdfConfigOperationInterface_Metadata_Call) Run(run func()) *MockCreateCdfConfigOperationInterface_Metadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateCdfConfigOperationInterface_Metadata_Call) Return(_a0 *postgres.CdfConfigOperationMetadata, _a1 error) *MockCreateCdfConfigOperationInterface_Metadata_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateCdfConfigOperationInterface_Metadata_Call) RunAndReturn(run func() (*postgres.CdfConfigOperationMetadata, error)) *MockCreateCdfConfigOperationInterface_Metadata_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with no fields +func (_m *MockCreateCdfConfigOperationInterface) Name() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Name") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// MockCreateCdfConfigOperationInterface_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type MockCreateCdfConfigOperationInterface_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *MockCreateCdfConfigOperationInterface_Expecter) Name() *MockCreateCdfConfigOperationInterface_Name_Call { + return &MockCreateCdfConfigOperationInterface_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *MockCreateCdfConfigOperationInterface_Name_Call) Run(run func()) *MockCreateCdfConfigOperationInterface_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateCdfConfigOperationInterface_Name_Call) Return(_a0 string) *MockCreateCdfConfigOperationInterface_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockCreateCdfConfigOperationInterface_Name_Call) RunAndReturn(run func() string) *MockCreateCdfConfigOperationInterface_Name_Call { + _c.Call.Return(run) + return _c +} + +// Wait provides a mock function with given fields: ctx, opts +func (_m *MockCreateCdfConfigOperationInterface) Wait(ctx context.Context, opts ...api.Option) (*postgres.CdfConfig, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Wait") + } + + var r0 *postgres.CdfConfig + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ...api.Option) (*postgres.CdfConfig, error)); ok { + return rf(ctx, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, ...api.Option) *postgres.CdfConfig); ok { + r0 = rf(ctx, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.CdfConfig) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ...api.Option) error); ok { + r1 = rf(ctx, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateCdfConfigOperationInterface_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait' +type MockCreateCdfConfigOperationInterface_Wait_Call struct { + *mock.Call +} + +// Wait is a helper method to define mock.On call +// - ctx context.Context +// - opts ...api.Option +func (_e *MockCreateCdfConfigOperationInterface_Expecter) Wait(ctx interface{}, opts ...interface{}) *MockCreateCdfConfigOperationInterface_Wait_Call { + return &MockCreateCdfConfigOperationInterface_Wait_Call{Call: _e.mock.On("Wait", + append([]interface{}{ctx}, opts...)...)} +} + +func (_c *MockCreateCdfConfigOperationInterface_Wait_Call) Run(run func(ctx context.Context, opts ...api.Option)) *MockCreateCdfConfigOperationInterface_Wait_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]api.Option, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(api.Option) + } + } + run(args[0].(context.Context), variadicArgs...) + }) + return _c +} + +func (_c *MockCreateCdfConfigOperationInterface_Wait_Call) Return(_a0 *postgres.CdfConfig, _a1 error) *MockCreateCdfConfigOperationInterface_Wait_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateCdfConfigOperationInterface_Wait_Call) RunAndReturn(run func(context.Context, ...api.Option) (*postgres.CdfConfig, error)) *MockCreateCdfConfigOperationInterface_Wait_Call { + _c.Call.Return(run) + return _c +} + +// NewMockCreateCdfConfigOperationInterface creates a new instance of MockCreateCdfConfigOperationInterface. 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 NewMockCreateCdfConfigOperationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockCreateCdfConfigOperationInterface { + mock := &MockCreateCdfConfigOperationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/postgres/mock_delete_cdf_config_operation_interface.go b/experimental/mocks/service/postgres/mock_delete_cdf_config_operation_interface.go new file mode 100644 index 000000000..bbceb38ad --- /dev/null +++ b/experimental/mocks/service/postgres/mock_delete_cdf_config_operation_interface.go @@ -0,0 +1,256 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package postgres + +import ( + context "context" + + api "github.com/databricks/databricks-sdk-go/experimental/api" + postgres "github.com/databricks/databricks-sdk-go/service/postgres" + mock "github.com/stretchr/testify/mock" +) + +// MockDeleteCdfConfigOperationInterface is an autogenerated mock type for the DeleteCdfConfigOperationInterface type +type MockDeleteCdfConfigOperationInterface struct { + mock.Mock +} + +type MockDeleteCdfConfigOperationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockDeleteCdfConfigOperationInterface) EXPECT() *MockDeleteCdfConfigOperationInterface_Expecter { + return &MockDeleteCdfConfigOperationInterface_Expecter{mock: &_m.Mock} +} + +// Done provides a mock function with no fields +func (_m *MockDeleteCdfConfigOperationInterface) Done() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Done") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDeleteCdfConfigOperationInterface_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done' +type MockDeleteCdfConfigOperationInterface_Done_Call struct { + *mock.Call +} + +// Done is a helper method to define mock.On call +func (_e *MockDeleteCdfConfigOperationInterface_Expecter) Done() *MockDeleteCdfConfigOperationInterface_Done_Call { + return &MockDeleteCdfConfigOperationInterface_Done_Call{Call: _e.mock.On("Done")} +} + +func (_c *MockDeleteCdfConfigOperationInterface_Done_Call) Run(run func()) *MockDeleteCdfConfigOperationInterface_Done_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockDeleteCdfConfigOperationInterface_Done_Call) Return(_a0 bool, _a1 error) *MockDeleteCdfConfigOperationInterface_Done_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDeleteCdfConfigOperationInterface_Done_Call) RunAndReturn(run func() (bool, error)) *MockDeleteCdfConfigOperationInterface_Done_Call { + _c.Call.Return(run) + return _c +} + +// Metadata provides a mock function with no fields +func (_m *MockDeleteCdfConfigOperationInterface) Metadata() (*postgres.CdfConfigOperationMetadata, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Metadata") + } + + var r0 *postgres.CdfConfigOperationMetadata + var r1 error + if rf, ok := ret.Get(0).(func() (*postgres.CdfConfigOperationMetadata, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *postgres.CdfConfigOperationMetadata); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.CdfConfigOperationMetadata) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDeleteCdfConfigOperationInterface_Metadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Metadata' +type MockDeleteCdfConfigOperationInterface_Metadata_Call struct { + *mock.Call +} + +// Metadata is a helper method to define mock.On call +func (_e *MockDeleteCdfConfigOperationInterface_Expecter) Metadata() *MockDeleteCdfConfigOperationInterface_Metadata_Call { + return &MockDeleteCdfConfigOperationInterface_Metadata_Call{Call: _e.mock.On("Metadata")} +} + +func (_c *MockDeleteCdfConfigOperationInterface_Metadata_Call) Run(run func()) *MockDeleteCdfConfigOperationInterface_Metadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockDeleteCdfConfigOperationInterface_Metadata_Call) Return(_a0 *postgres.CdfConfigOperationMetadata, _a1 error) *MockDeleteCdfConfigOperationInterface_Metadata_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDeleteCdfConfigOperationInterface_Metadata_Call) RunAndReturn(run func() (*postgres.CdfConfigOperationMetadata, error)) *MockDeleteCdfConfigOperationInterface_Metadata_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with no fields +func (_m *MockDeleteCdfConfigOperationInterface) Name() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Name") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// MockDeleteCdfConfigOperationInterface_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type MockDeleteCdfConfigOperationInterface_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *MockDeleteCdfConfigOperationInterface_Expecter) Name() *MockDeleteCdfConfigOperationInterface_Name_Call { + return &MockDeleteCdfConfigOperationInterface_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *MockDeleteCdfConfigOperationInterface_Name_Call) Run(run func()) *MockDeleteCdfConfigOperationInterface_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockDeleteCdfConfigOperationInterface_Name_Call) Return(_a0 string) *MockDeleteCdfConfigOperationInterface_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDeleteCdfConfigOperationInterface_Name_Call) RunAndReturn(run func() string) *MockDeleteCdfConfigOperationInterface_Name_Call { + _c.Call.Return(run) + return _c +} + +// Wait provides a mock function with given fields: ctx, opts +func (_m *MockDeleteCdfConfigOperationInterface) Wait(ctx context.Context, opts ...api.Option) error { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Wait") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, ...api.Option) error); ok { + r0 = rf(ctx, opts...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockDeleteCdfConfigOperationInterface_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait' +type MockDeleteCdfConfigOperationInterface_Wait_Call struct { + *mock.Call +} + +// Wait is a helper method to define mock.On call +// - ctx context.Context +// - opts ...api.Option +func (_e *MockDeleteCdfConfigOperationInterface_Expecter) Wait(ctx interface{}, opts ...interface{}) *MockDeleteCdfConfigOperationInterface_Wait_Call { + return &MockDeleteCdfConfigOperationInterface_Wait_Call{Call: _e.mock.On("Wait", + append([]interface{}{ctx}, opts...)...)} +} + +func (_c *MockDeleteCdfConfigOperationInterface_Wait_Call) Run(run func(ctx context.Context, opts ...api.Option)) *MockDeleteCdfConfigOperationInterface_Wait_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]api.Option, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(api.Option) + } + } + run(args[0].(context.Context), variadicArgs...) + }) + return _c +} + +func (_c *MockDeleteCdfConfigOperationInterface_Wait_Call) Return(_a0 error) *MockDeleteCdfConfigOperationInterface_Wait_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDeleteCdfConfigOperationInterface_Wait_Call) RunAndReturn(run func(context.Context, ...api.Option) error) *MockDeleteCdfConfigOperationInterface_Wait_Call { + _c.Call.Return(run) + return _c +} + +// NewMockDeleteCdfConfigOperationInterface creates a new instance of MockDeleteCdfConfigOperationInterface. 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 NewMockDeleteCdfConfigOperationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockDeleteCdfConfigOperationInterface { + mock := &MockDeleteCdfConfigOperationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/postgres/mock_postgres_interface.go b/experimental/mocks/service/postgres/mock_postgres_interface.go old mode 100755 new mode 100644 index bd6fa3158..653611319 --- a/experimental/mocks/service/postgres/mock_postgres_interface.go +++ b/experimental/mocks/service/postgres/mock_postgres_interface.go @@ -141,6 +141,65 @@ func (_c *MockPostgresInterface_CreateCatalog_Call) RunAndReturn(run func(contex return _c } +// CreateCdfConfig provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) CreateCdfConfig(ctx context.Context, request postgres.CreateCdfConfigRequest) (postgres.CreateCdfConfigOperationInterface, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateCdfConfig") + } + + var r0 postgres.CreateCdfConfigOperationInterface + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.CreateCdfConfigRequest) (postgres.CreateCdfConfigOperationInterface, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.CreateCdfConfigRequest) postgres.CreateCdfConfigOperationInterface); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(postgres.CreateCdfConfigOperationInterface) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.CreateCdfConfigRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_CreateCdfConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateCdfConfig' +type MockPostgresInterface_CreateCdfConfig_Call struct { + *mock.Call +} + +// CreateCdfConfig is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.CreateCdfConfigRequest +func (_e *MockPostgresInterface_Expecter) CreateCdfConfig(ctx interface{}, request interface{}) *MockPostgresInterface_CreateCdfConfig_Call { + return &MockPostgresInterface_CreateCdfConfig_Call{Call: _e.mock.On("CreateCdfConfig", ctx, request)} +} + +func (_c *MockPostgresInterface_CreateCdfConfig_Call) Run(run func(ctx context.Context, request postgres.CreateCdfConfigRequest)) *MockPostgresInterface_CreateCdfConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.CreateCdfConfigRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_CreateCdfConfig_Call) Return(_a0 postgres.CreateCdfConfigOperationInterface, _a1 error) *MockPostgresInterface_CreateCdfConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_CreateCdfConfig_Call) RunAndReturn(run func(context.Context, postgres.CreateCdfConfigRequest) (postgres.CreateCdfConfigOperationInterface, error)) *MockPostgresInterface_CreateCdfConfig_Call { + _c.Call.Return(run) + return _c +} + // CreateDataApi provides a mock function with given fields: ctx, request func (_m *MockPostgresInterface) CreateDataApi(ctx context.Context, request postgres.CreateDataApiRequest) (postgres.CreateDataApiOperationInterface, error) { ret := _m.Called(ctx, request) @@ -613,6 +672,65 @@ func (_c *MockPostgresInterface_DeleteCatalog_Call) RunAndReturn(run func(contex return _c } +// DeleteCdfConfig provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) DeleteCdfConfig(ctx context.Context, request postgres.DeleteCdfConfigRequest) (postgres.DeleteCdfConfigOperationInterface, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteCdfConfig") + } + + var r0 postgres.DeleteCdfConfigOperationInterface + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.DeleteCdfConfigRequest) (postgres.DeleteCdfConfigOperationInterface, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.DeleteCdfConfigRequest) postgres.DeleteCdfConfigOperationInterface); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(postgres.DeleteCdfConfigOperationInterface) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.DeleteCdfConfigRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_DeleteCdfConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteCdfConfig' +type MockPostgresInterface_DeleteCdfConfig_Call struct { + *mock.Call +} + +// DeleteCdfConfig is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.DeleteCdfConfigRequest +func (_e *MockPostgresInterface_Expecter) DeleteCdfConfig(ctx interface{}, request interface{}) *MockPostgresInterface_DeleteCdfConfig_Call { + return &MockPostgresInterface_DeleteCdfConfig_Call{Call: _e.mock.On("DeleteCdfConfig", ctx, request)} +} + +func (_c *MockPostgresInterface_DeleteCdfConfig_Call) Run(run func(ctx context.Context, request postgres.DeleteCdfConfigRequest)) *MockPostgresInterface_DeleteCdfConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.DeleteCdfConfigRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_DeleteCdfConfig_Call) Return(_a0 postgres.DeleteCdfConfigOperationInterface, _a1 error) *MockPostgresInterface_DeleteCdfConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_DeleteCdfConfig_Call) RunAndReturn(run func(context.Context, postgres.DeleteCdfConfigRequest) (postgres.DeleteCdfConfigOperationInterface, error)) *MockPostgresInterface_DeleteCdfConfig_Call { + _c.Call.Return(run) + return _c +} + // DeleteDataApi provides a mock function with given fields: ctx, request func (_m *MockPostgresInterface) DeleteDataApi(ctx context.Context, request postgres.DeleteDataApiRequest) (postgres.DeleteDataApiOperationInterface, error) { ret := _m.Called(ctx, request) @@ -1144,6 +1262,124 @@ func (_c *MockPostgresInterface_GetCatalog_Call) RunAndReturn(run func(context.C return _c } +// GetCdfConfig provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) GetCdfConfig(ctx context.Context, request postgres.GetCdfConfigRequest) (*postgres.CdfConfig, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetCdfConfig") + } + + var r0 *postgres.CdfConfig + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetCdfConfigRequest) (*postgres.CdfConfig, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetCdfConfigRequest) *postgres.CdfConfig); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.CdfConfig) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.GetCdfConfigRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_GetCdfConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCdfConfig' +type MockPostgresInterface_GetCdfConfig_Call struct { + *mock.Call +} + +// GetCdfConfig is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.GetCdfConfigRequest +func (_e *MockPostgresInterface_Expecter) GetCdfConfig(ctx interface{}, request interface{}) *MockPostgresInterface_GetCdfConfig_Call { + return &MockPostgresInterface_GetCdfConfig_Call{Call: _e.mock.On("GetCdfConfig", ctx, request)} +} + +func (_c *MockPostgresInterface_GetCdfConfig_Call) Run(run func(ctx context.Context, request postgres.GetCdfConfigRequest)) *MockPostgresInterface_GetCdfConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.GetCdfConfigRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_GetCdfConfig_Call) Return(_a0 *postgres.CdfConfig, _a1 error) *MockPostgresInterface_GetCdfConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_GetCdfConfig_Call) RunAndReturn(run func(context.Context, postgres.GetCdfConfigRequest) (*postgres.CdfConfig, error)) *MockPostgresInterface_GetCdfConfig_Call { + _c.Call.Return(run) + return _c +} + +// GetCdfStatus provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) GetCdfStatus(ctx context.Context, request postgres.GetCdfStatusRequest) (*postgres.CdfStatus, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetCdfStatus") + } + + var r0 *postgres.CdfStatus + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetCdfStatusRequest) (*postgres.CdfStatus, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetCdfStatusRequest) *postgres.CdfStatus); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.CdfStatus) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.GetCdfStatusRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_GetCdfStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCdfStatus' +type MockPostgresInterface_GetCdfStatus_Call struct { + *mock.Call +} + +// GetCdfStatus is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.GetCdfStatusRequest +func (_e *MockPostgresInterface_Expecter) GetCdfStatus(ctx interface{}, request interface{}) *MockPostgresInterface_GetCdfStatus_Call { + return &MockPostgresInterface_GetCdfStatus_Call{Call: _e.mock.On("GetCdfStatus", ctx, request)} +} + +func (_c *MockPostgresInterface_GetCdfStatus_Call) Run(run func(ctx context.Context, request postgres.GetCdfStatusRequest)) *MockPostgresInterface_GetCdfStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.GetCdfStatusRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_GetCdfStatus_Call) Return(_a0 *postgres.CdfStatus, _a1 error) *MockPostgresInterface_GetCdfStatus_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_GetCdfStatus_Call) RunAndReturn(run func(context.Context, postgres.GetCdfStatusRequest) (*postgres.CdfStatus, error)) *MockPostgresInterface_GetCdfStatus_Call { + _c.Call.Return(run) + return _c +} + // GetDataApi provides a mock function with given fields: ctx, request func (_m *MockPostgresInterface) GetDataApi(ctx context.Context, request postgres.GetDataApiRequest) (*postgres.DataApi, error) { ret := _m.Called(ctx, request) @@ -1665,6 +1901,222 @@ func (_c *MockPostgresInterface_ListBranchesAll_Call) RunAndReturn(run func(cont return _c } +// ListCdfConfigs provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) ListCdfConfigs(ctx context.Context, request postgres.ListCdfConfigsRequest) listing.Iterator[postgres.CdfConfig] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListCdfConfigs") + } + + var r0 listing.Iterator[postgres.CdfConfig] + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListCdfConfigsRequest) listing.Iterator[postgres.CdfConfig]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[postgres.CdfConfig]) + } + } + + return r0 +} + +// MockPostgresInterface_ListCdfConfigs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCdfConfigs' +type MockPostgresInterface_ListCdfConfigs_Call struct { + *mock.Call +} + +// ListCdfConfigs is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.ListCdfConfigsRequest +func (_e *MockPostgresInterface_Expecter) ListCdfConfigs(ctx interface{}, request interface{}) *MockPostgresInterface_ListCdfConfigs_Call { + return &MockPostgresInterface_ListCdfConfigs_Call{Call: _e.mock.On("ListCdfConfigs", ctx, request)} +} + +func (_c *MockPostgresInterface_ListCdfConfigs_Call) Run(run func(ctx context.Context, request postgres.ListCdfConfigsRequest)) *MockPostgresInterface_ListCdfConfigs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.ListCdfConfigsRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_ListCdfConfigs_Call) Return(_a0 listing.Iterator[postgres.CdfConfig]) *MockPostgresInterface_ListCdfConfigs_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPostgresInterface_ListCdfConfigs_Call) RunAndReturn(run func(context.Context, postgres.ListCdfConfigsRequest) listing.Iterator[postgres.CdfConfig]) *MockPostgresInterface_ListCdfConfigs_Call { + _c.Call.Return(run) + return _c +} + +// ListCdfConfigsAll provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) ListCdfConfigsAll(ctx context.Context, request postgres.ListCdfConfigsRequest) ([]postgres.CdfConfig, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListCdfConfigsAll") + } + + var r0 []postgres.CdfConfig + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListCdfConfigsRequest) ([]postgres.CdfConfig, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListCdfConfigsRequest) []postgres.CdfConfig); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]postgres.CdfConfig) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.ListCdfConfigsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_ListCdfConfigsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCdfConfigsAll' +type MockPostgresInterface_ListCdfConfigsAll_Call struct { + *mock.Call +} + +// ListCdfConfigsAll is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.ListCdfConfigsRequest +func (_e *MockPostgresInterface_Expecter) ListCdfConfigsAll(ctx interface{}, request interface{}) *MockPostgresInterface_ListCdfConfigsAll_Call { + return &MockPostgresInterface_ListCdfConfigsAll_Call{Call: _e.mock.On("ListCdfConfigsAll", ctx, request)} +} + +func (_c *MockPostgresInterface_ListCdfConfigsAll_Call) Run(run func(ctx context.Context, request postgres.ListCdfConfigsRequest)) *MockPostgresInterface_ListCdfConfigsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.ListCdfConfigsRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_ListCdfConfigsAll_Call) Return(_a0 []postgres.CdfConfig, _a1 error) *MockPostgresInterface_ListCdfConfigsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_ListCdfConfigsAll_Call) RunAndReturn(run func(context.Context, postgres.ListCdfConfigsRequest) ([]postgres.CdfConfig, error)) *MockPostgresInterface_ListCdfConfigsAll_Call { + _c.Call.Return(run) + return _c +} + +// ListCdfStatuses provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) ListCdfStatuses(ctx context.Context, request postgres.ListCdfStatusesRequest) listing.Iterator[postgres.CdfStatus] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListCdfStatuses") + } + + var r0 listing.Iterator[postgres.CdfStatus] + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListCdfStatusesRequest) listing.Iterator[postgres.CdfStatus]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[postgres.CdfStatus]) + } + } + + return r0 +} + +// MockPostgresInterface_ListCdfStatuses_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCdfStatuses' +type MockPostgresInterface_ListCdfStatuses_Call struct { + *mock.Call +} + +// ListCdfStatuses is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.ListCdfStatusesRequest +func (_e *MockPostgresInterface_Expecter) ListCdfStatuses(ctx interface{}, request interface{}) *MockPostgresInterface_ListCdfStatuses_Call { + return &MockPostgresInterface_ListCdfStatuses_Call{Call: _e.mock.On("ListCdfStatuses", ctx, request)} +} + +func (_c *MockPostgresInterface_ListCdfStatuses_Call) Run(run func(ctx context.Context, request postgres.ListCdfStatusesRequest)) *MockPostgresInterface_ListCdfStatuses_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.ListCdfStatusesRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_ListCdfStatuses_Call) Return(_a0 listing.Iterator[postgres.CdfStatus]) *MockPostgresInterface_ListCdfStatuses_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPostgresInterface_ListCdfStatuses_Call) RunAndReturn(run func(context.Context, postgres.ListCdfStatusesRequest) listing.Iterator[postgres.CdfStatus]) *MockPostgresInterface_ListCdfStatuses_Call { + _c.Call.Return(run) + return _c +} + +// ListCdfStatusesAll provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) ListCdfStatusesAll(ctx context.Context, request postgres.ListCdfStatusesRequest) ([]postgres.CdfStatus, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListCdfStatusesAll") + } + + var r0 []postgres.CdfStatus + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListCdfStatusesRequest) ([]postgres.CdfStatus, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListCdfStatusesRequest) []postgres.CdfStatus); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]postgres.CdfStatus) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.ListCdfStatusesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_ListCdfStatusesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCdfStatusesAll' +type MockPostgresInterface_ListCdfStatusesAll_Call struct { + *mock.Call +} + +// ListCdfStatusesAll is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.ListCdfStatusesRequest +func (_e *MockPostgresInterface_Expecter) ListCdfStatusesAll(ctx interface{}, request interface{}) *MockPostgresInterface_ListCdfStatusesAll_Call { + return &MockPostgresInterface_ListCdfStatusesAll_Call{Call: _e.mock.On("ListCdfStatusesAll", ctx, request)} +} + +func (_c *MockPostgresInterface_ListCdfStatusesAll_Call) Run(run func(ctx context.Context, request postgres.ListCdfStatusesRequest)) *MockPostgresInterface_ListCdfStatusesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.ListCdfStatusesRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_ListCdfStatusesAll_Call) Return(_a0 []postgres.CdfStatus, _a1 error) *MockPostgresInterface_ListCdfStatusesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_ListCdfStatusesAll_Call) RunAndReturn(run func(context.Context, postgres.ListCdfStatusesRequest) ([]postgres.CdfStatus, error)) *MockPostgresInterface_ListCdfStatusesAll_Call { + _c.Call.Return(run) + return _c +} + // ListDatabases provides a mock function with given fields: ctx, request func (_m *MockPostgresInterface) ListDatabases(ctx context.Context, request postgres.ListDatabasesRequest) listing.Iterator[postgres.Database] { ret := _m.Called(ctx, request) diff --git a/service/catalog/model.go b/service/catalog/model.go index c7b9b4c9f..9a7b57561 100644 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -1246,6 +1246,10 @@ type CreateConnection struct { Name string `json:"name"` // A map of key-value properties attached to the securable. Options map[string]string `json:"options"` + // Parent schema for schema-level connections, in format + // "schemas/{catalog}.{schema}". Absent for metastore-level (L1) + // connections. + Parent string `json:"parent,omitempty"` // A map of key-value properties attached to the securable. Properties map[string]string `json:"properties,omitempty"` // If the connection is read only. @@ -4453,6 +4457,9 @@ type ListConnectionsRequest struct { MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. PageToken string `json:"-" url:"page_token,omitempty"` + // Optional. Parent schema filter for listing schema-level connections, in + // format "schemas/{catalog}.{schema}". + Parent string `json:"-" url:"parent,omitempty"` ForceSendFields []string `json:"-" url:"-"` } diff --git a/service/jobs/model.go b/service/jobs/model.go index b5cade638..dcbe6fd30 100644 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -3121,6 +3121,8 @@ const PeriodicTriggerConfigurationTimeUnitDays PeriodicTriggerConfigurationTimeU const PeriodicTriggerConfigurationTimeUnitHours PeriodicTriggerConfigurationTimeUnit = `HOURS` +const PeriodicTriggerConfigurationTimeUnitMinutes PeriodicTriggerConfigurationTimeUnit = `MINUTES` + const PeriodicTriggerConfigurationTimeUnitWeeks PeriodicTriggerConfigurationTimeUnit = `WEEKS` // String representation for [fmt.Print] @@ -3131,11 +3133,11 @@ func (f *PeriodicTriggerConfigurationTimeUnit) String() string { // Set raw string value and validate it against allowed values func (f *PeriodicTriggerConfigurationTimeUnit) Set(v string) error { switch v { - case `DAYS`, `HOURS`, `WEEKS`: + case `DAYS`, `HOURS`, `MINUTES`, `WEEKS`: *f = PeriodicTriggerConfigurationTimeUnit(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "DAYS", "HOURS", "WEEKS"`, v) + return fmt.Errorf(`value "%s" is not one of "DAYS", "HOURS", "MINUTES", "WEEKS"`, v) } } @@ -3146,6 +3148,7 @@ func (f *PeriodicTriggerConfigurationTimeUnit) Values() []PeriodicTriggerConfigu return []PeriodicTriggerConfigurationTimeUnit{ PeriodicTriggerConfigurationTimeUnitDays, PeriodicTriggerConfigurationTimeUnitHours, + PeriodicTriggerConfigurationTimeUnitMinutes, PeriodicTriggerConfigurationTimeUnitWeeks, } } diff --git a/service/postgres/api.go b/service/postgres/api.go old mode 100755 new mode 100644 index e6a2275a7..e0ec47eb4 --- a/service/postgres/api.go +++ b/service/postgres/api.go @@ -32,6 +32,8 @@ type PostgresInterface interface { CreateCatalog(ctx context.Context, request CreateCatalogRequest) (CreateCatalogOperationInterface, error) + CreateCdfConfig(ctx context.Context, request CreateCdfConfigRequest) (CreateCdfConfigOperationInterface, error) + CreateDataApi(ctx context.Context, request CreateDataApiRequest) (CreateDataApiOperationInterface, error) CreateDatabase(ctx context.Context, request CreateDatabaseRequest) (CreateDatabaseOperationInterface, error) @@ -48,6 +50,8 @@ type PostgresInterface interface { DeleteCatalog(ctx context.Context, request DeleteCatalogRequest) (DeleteCatalogOperationInterface, error) + DeleteCdfConfig(ctx context.Context, request DeleteCdfConfigRequest) (DeleteCdfConfigOperationInterface, error) + DeleteDataApi(ctx context.Context, request DeleteDataApiRequest) (DeleteDataApiOperationInterface, error) DeleteDatabase(ctx context.Context, request DeleteDatabaseRequest) (DeleteDatabaseOperationInterface, error) @@ -69,6 +73,13 @@ type PostgresInterface interface { // Get a Database Catalog. GetCatalog(ctx context.Context, request GetCatalogRequest) (*Catalog, error) + // Get a single Lakebase CDF configuration (CdfConfig). + GetCdfConfig(ctx context.Context, request GetCdfConfigRequest) (*CdfConfig, error) + + // Get the replication status of a single replicated table within a Lakebase CDF + // configuration. + GetCdfStatus(ctx context.Context, request GetCdfStatusRequest) (*CdfStatus, error) + // Get Data API configuration for a database. GetDataApi(ctx context.Context, request GetDataApiRequest) (*DataApi, error) @@ -102,6 +113,28 @@ type PostgresInterface interface { // This method is generated by Databricks SDK Code Generator. ListBranchesAll(ctx context.Context, request ListBranchesRequest) ([]Branch, error) + // List the Lakebase CDF configurations (CdfConfigs) under a database. + // + // This method is generated by Databricks SDK Code Generator. + ListCdfConfigs(ctx context.Context, request ListCdfConfigsRequest) listing.Iterator[CdfConfig] + + // List the Lakebase CDF configurations (CdfConfigs) under a database. + // + // This method is generated by Databricks SDK Code Generator. + ListCdfConfigsAll(ctx context.Context, request ListCdfConfigsRequest) ([]CdfConfig, error) + + // List the replication statuses of all tables replicated under a Lakebase CDF + // configuration. + // + // This method is generated by Databricks SDK Code Generator. + ListCdfStatuses(ctx context.Context, request ListCdfStatusesRequest) listing.Iterator[CdfStatus] + + // List the replication statuses of all tables replicated under a Lakebase CDF + // configuration. + // + // This method is generated by Databricks SDK Code Generator. + ListCdfStatusesAll(ctx context.Context, request ListCdfStatusesRequest) ([]CdfStatus, error) + // List Databases. // // This method is generated by Databricks SDK Code Generator. @@ -484,6 +517,155 @@ func (a *createCatalogOperation) Done() (bool, error) { return operation.Done, nil } +func (a *PostgresAPI) CreateCdfConfig(ctx context.Context, request CreateCdfConfigRequest) (CreateCdfConfigOperationInterface, error) { + operation, err := a.postgresImpl.CreateCdfConfig(ctx, request) + if err != nil { + return nil, err + } + return &createCdfConfigOperation{ + impl: &a.postgresImpl, + operation: operation, + }, nil +} + +type CreateCdfConfigOperationInterface interface { + + // Wait blocks until the long-running operation is completed. If no timeout is + // specified, this will poll indefinitely. If a timeout is provided and the operation + // didn't finish within the timeout, this function will return an error, otherwise + // returns successful response and any errors encountered. + Wait(ctx context.Context, opts ...api.Option) (*CdfConfig, error) + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*CdfConfigOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + +type createCdfConfigOperation struct { + impl *postgresImpl + operation *Operation +} + +// Wait blocks until the long-running operation is completed. If no timeout is +// specified, this will poll indefinitely. If a timeout is provided and the operation +// didn't finish within the timeout, this function will return an error, otherwise +// returns successful response and any errors encountered. +func (a *createCdfConfigOperation) Wait(ctx context.Context, opts ...api.Option) (*CdfConfig, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + + errOperationInProgress := errors.New("operation still in progress") + var result *CdfConfig + call := func(ctx context.Context) error { + operation, err := a.impl.GetOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return err + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return errOperationInProgress + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return fmt.Errorf("operation failed: %s", errorMsg) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return fmt.Errorf("operation completed but no response available") + } + + var cdfConfig CdfConfig + err = json.Unmarshal(operation.Response, &cdfConfig) + if err != nil { + return fmt.Errorf("failed to unmarshal cdfConfig response: %w", err) + } + + result = &cdfConfig + + return nil + } + + // Create a retrier that retries on errOperationInProgress with exponential backoff. + retrier := api.RetryOn(api.BackoffPolicy{}, func(err error) bool { + return errors.Is(err, errOperationInProgress) + }) + + // Add default retrier. + defaultOpts := []api.Option{ + api.WithRetrier(func() api.Retrier { return retrier }), + } + allOpts := append(defaultOpts, opts...) + + err := api.Execute(ctx, call, allOpts...) + + if err != nil { + return nil, err + } + return result, nil + +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *createCdfConfigOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *createCdfConfigOperation) Metadata() (*CdfConfigOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata CdfConfigOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *createCdfConfigOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} + func (a *PostgresAPI) CreateDataApi(ctx context.Context, request CreateDataApiRequest) (CreateDataApiOperationInterface, error) { operation, err := a.postgresImpl.CreateDataApi(ctx, request) if err != nil { @@ -1654,6 +1836,144 @@ func (a *deleteCatalogOperation) Done() (bool, error) { return operation.Done, nil } +func (a *PostgresAPI) DeleteCdfConfig(ctx context.Context, request DeleteCdfConfigRequest) (DeleteCdfConfigOperationInterface, error) { + operation, err := a.postgresImpl.DeleteCdfConfig(ctx, request) + if err != nil { + return nil, err + } + return &deleteCdfConfigOperation{ + impl: &a.postgresImpl, + operation: operation, + }, nil +} + +type DeleteCdfConfigOperationInterface interface { + + // Wait blocks until the long-running operation is completed. If no timeout is + // specified, this will poll indefinitely. If a timeout is provided and the operation + // didn't finish within the timeout, this function will return an error, otherwise + // returns successful response and any errors encountered. + Wait(ctx context.Context, opts ...api.Option) error + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*CdfConfigOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + +type deleteCdfConfigOperation struct { + impl *postgresImpl + operation *Operation +} + +// Wait blocks until the long-running operation is completed. If no timeout is +// specified, this will poll indefinitely. If a timeout is provided and the operation +// didn't finish within the timeout, this function will return an error, otherwise +// returns successful response and any errors encountered. +func (a *deleteCdfConfigOperation) Wait(ctx context.Context, opts ...api.Option) error { + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + + errOperationInProgress := errors.New("operation still in progress") + + call := func(ctx context.Context) error { + operation, err := a.impl.GetOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return err + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return errOperationInProgress + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return fmt.Errorf("operation failed: %s", errorMsg) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return fmt.Errorf("operation completed but no response available") + } + + return nil + } + + // Create a retrier that retries on errOperationInProgress with exponential backoff. + retrier := api.RetryOn(api.BackoffPolicy{}, func(err error) bool { + return errors.Is(err, errOperationInProgress) + }) + + // Add default retrier. + defaultOpts := []api.Option{ + api.WithRetrier(func() api.Retrier { return retrier }), + } + allOpts := append(defaultOpts, opts...) + + err := api.Execute(ctx, call, allOpts...) + + return err + +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *deleteCdfConfigOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *deleteCdfConfigOperation) Metadata() (*CdfConfigOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata CdfConfigOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *deleteCdfConfigOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} + func (a *PostgresAPI) DeleteDataApi(ctx context.Context, request DeleteDataApiRequest) (DeleteDataApiOperationInterface, error) { operation, err := a.postgresImpl.DeleteDataApi(ctx, request) if err != nil { diff --git a/service/postgres/impl.go b/service/postgres/impl.go old mode 100755 new mode 100644 index 20a35c30f..fba4abb09 --- a/service/postgres/impl.go +++ b/service/postgres/impl.go @@ -62,6 +62,25 @@ func (a *postgresImpl) CreateCatalog(ctx context.Context, request CreateCatalogR return &operation, err } +func (a *postgresImpl) CreateCdfConfig(ctx context.Context, request CreateCdfConfigRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/postgres/%v/cdf-configs", request.Parent) + queryParams := make(map[string]any) + + if request.CdfConfigId != "" || slices.Contains(request.ForceSendFields, "CdfConfigId") { + queryParams["cdf_config_id"] = request.CdfConfigId + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Workspace-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.CdfConfig, &operation) + return &operation, err +} + func (a *postgresImpl) CreateDataApi(ctx context.Context, request CreateDataApiRequest) (*Operation, error) { var operation Operation path := fmt.Sprintf("/api/2.0/postgres/%v/data-api", request.Parent) @@ -212,6 +231,20 @@ func (a *postgresImpl) DeleteCatalog(ctx context.Context, request DeleteCatalogR return &operation, err } +func (a *postgresImpl) DeleteCdfConfig(ctx context.Context, request DeleteCdfConfigRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Workspace-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &operation) + return &operation, err +} + func (a *postgresImpl) DeleteDataApi(ctx context.Context, request DeleteDataApiRequest) (*Operation, error) { var operation Operation path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) @@ -339,6 +372,34 @@ func (a *postgresImpl) GetCatalog(ctx context.Context, request GetCatalogRequest return &catalog, err } +func (a *postgresImpl) GetCdfConfig(ctx context.Context, request GetCdfConfigRequest) (*CdfConfig, error) { + var cdfConfig CdfConfig + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Workspace-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &cdfConfig) + return &cdfConfig, err +} + +func (a *postgresImpl) GetCdfStatus(ctx context.Context, request GetCdfStatusRequest) (*CdfStatus, error) { + var cdfStatus CdfStatus + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Workspace-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &cdfStatus) + return &cdfStatus, err +} + func (a *postgresImpl) GetDataApi(ctx context.Context, request GetDataApiRequest) (*DataApi, error) { var dataApi DataApi path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) @@ -482,6 +543,98 @@ func (a *postgresImpl) internalListBranches(ctx context.Context, request ListBra return &listBranchesResponse, err } +// List the Lakebase CDF configurations (CdfConfigs) under a database. +func (a *postgresImpl) ListCdfConfigs(ctx context.Context, request ListCdfConfigsRequest) listing.Iterator[CdfConfig] { + + getNextPage := func(ctx context.Context, req ListCdfConfigsRequest) (*ListCdfConfigsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListCdfConfigs(ctx, req) + } + getItems := func(resp *ListCdfConfigsResponse) []CdfConfig { + return resp.CdfConfigs + } + getNextReq := func(resp *ListCdfConfigsResponse) *ListCdfConfigsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List the Lakebase CDF configurations (CdfConfigs) under a database. +func (a *postgresImpl) ListCdfConfigsAll(ctx context.Context, request ListCdfConfigsRequest) ([]CdfConfig, error) { + iterator := a.ListCdfConfigs(ctx, request) + return listing.ToSlice[CdfConfig](ctx, iterator) +} + +func (a *postgresImpl) internalListCdfConfigs(ctx context.Context, request ListCdfConfigsRequest) (*ListCdfConfigsResponse, error) { + var listCdfConfigsResponse ListCdfConfigsResponse + path := fmt.Sprintf("/api/2.0/postgres/%v/cdf-configs", request.Parent) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Workspace-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCdfConfigsResponse) + return &listCdfConfigsResponse, err +} + +// List the replication statuses of all tables replicated under a Lakebase CDF +// configuration. +func (a *postgresImpl) ListCdfStatuses(ctx context.Context, request ListCdfStatusesRequest) listing.Iterator[CdfStatus] { + + getNextPage := func(ctx context.Context, req ListCdfStatusesRequest) (*ListCdfStatusesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListCdfStatuses(ctx, req) + } + getItems := func(resp *ListCdfStatusesResponse) []CdfStatus { + return resp.CdfStatuses + } + getNextReq := func(resp *ListCdfStatusesResponse) *ListCdfStatusesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List the replication statuses of all tables replicated under a Lakebase CDF +// configuration. +func (a *postgresImpl) ListCdfStatusesAll(ctx context.Context, request ListCdfStatusesRequest) ([]CdfStatus, error) { + iterator := a.ListCdfStatuses(ctx, request) + return listing.ToSlice[CdfStatus](ctx, iterator) +} + +func (a *postgresImpl) internalListCdfStatuses(ctx context.Context, request ListCdfStatusesRequest) (*ListCdfStatusesResponse, error) { + var listCdfStatusesResponse ListCdfStatusesResponse + path := fmt.Sprintf("/api/2.0/postgres/%v/cdf-statuses", request.Parent) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Workspace-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCdfStatusesResponse) + return &listCdfStatusesResponse, err +} + // List Databases. func (a *postgresImpl) ListDatabases(ctx context.Context, request ListDatabasesRequest) listing.Iterator[Database] { diff --git a/service/postgres/interface.go b/service/postgres/interface.go old mode 100755 new mode 100644 index e875c76df..9d648d17d --- a/service/postgres/interface.go +++ b/service/postgres/interface.go @@ -29,6 +29,12 @@ type PostgresService interface { // Register a Postgres database in the Unity Catalog. CreateCatalog(ctx context.Context, request CreateCatalogRequest) (*Operation, error) + // Create a Lakebase CDF configuration (CdfConfig). Replicates the tables of + // a Postgres schema into a Unity Catalog schema. Returns ALREADY_EXISTS if + // a config with the requested id exists, or if another config already + // replicates the target Postgres schema. + CreateCdfConfig(ctx context.Context, request CreateCdfConfigRequest) (*Operation, error) + // Enable Data API for a database. CreateDataApi(ctx context.Context, request CreateDataApiRequest) (*Operation, error) @@ -57,6 +63,11 @@ type PostgresService interface { // Delete a Database Catalog. DeleteCatalog(ctx context.Context, request DeleteCatalogRequest) (*Operation, error) + // Delete a Lakebase CDF configuration (CdfConfig). Stops replication and + // removes the config. When force is true, also drops the replicated Delta + // tables in Unity Catalog. + DeleteCdfConfig(ctx context.Context, request DeleteCdfConfigRequest) (*Operation, error) + // Disable Data API for a database. DeleteDataApi(ctx context.Context, request DeleteDataApiRequest) (*Operation, error) @@ -84,6 +95,13 @@ type PostgresService interface { // Get a Database Catalog. GetCatalog(ctx context.Context, request GetCatalogRequest) (*Catalog, error) + // Get a single Lakebase CDF configuration (CdfConfig). + GetCdfConfig(ctx context.Context, request GetCdfConfigRequest) (*CdfConfig, error) + + // Get the replication status of a single replicated table within a Lakebase + // CDF configuration. + GetCdfStatus(ctx context.Context, request GetCdfStatusRequest) (*CdfStatus, error) + // Get Data API configuration for a database. GetDataApi(ctx context.Context, request GetDataApiRequest) (*DataApi, error) @@ -110,6 +128,13 @@ type PostgresService interface { // Returns a paginated list of database branches in the project. ListBranches(ctx context.Context, request ListBranchesRequest) (*ListBranchesResponse, error) + // List the Lakebase CDF configurations (CdfConfigs) under a database. + ListCdfConfigs(ctx context.Context, request ListCdfConfigsRequest) (*ListCdfConfigsResponse, error) + + // List the replication statuses of all tables replicated under a Lakebase + // CDF configuration. + ListCdfStatuses(ctx context.Context, request ListCdfStatusesRequest) (*ListCdfStatusesResponse, error) + // List Databases. ListDatabases(ctx context.Context, request ListDatabasesRequest) (*ListDatabasesResponse, error) diff --git a/service/postgres/model.go b/service/postgres/model.go index 9fae62a37..a17707e13 100644 --- a/service/postgres/model.go +++ b/service/postgres/model.go @@ -288,6 +288,124 @@ func (s CatalogCatalogStatus) MarshalJSON() ([]byte, error) { type CatalogOperationMetadata struct { } +// A Lakebase CDF configuration (CdfConfig): one per Postgres schema per +// database, replicating that schema's tables into a Unity Catalog schema. +// Immutable once created. +type CdfConfig struct { + // The Unity Catalog catalog that replicated tables are written into. Set at + // creation; the CdfConfig is immutable. + Catalog string `json:"catalog"` + // The user-specified id; equals the final segment of `name`. Defaults to + // the Postgres schema name for configs without an explicit id. + CdfConfigId string `json:"cdf_config_id,omitempty"` + // When the CdfConfig was created. + CreateTime *time.Time `json:"create_time,omitempty"` + // Output only. The full resource name of the CdfConfig. Format: + // projects/{project}/branches/{branch}/databases/{database}/cdf-configs/{cdf_config} + Name string `json:"name,omitempty"` + // The Postgres schema this CdfConfig replicates from. Unique within the + // parent database. Set at creation; the CdfConfig is immutable. + PostgresSchema string `json:"postgres_schema"` + // The Unity Catalog schema that replicated tables are written into. Set at + // creation; the CdfConfig is immutable. + Schema string `json:"schema"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CdfConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CdfConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Metadata for CdfConfig long-running operations. Intentionally empty today; +// fields (e.g. progress) may be added as the operation contract grows. +type CdfConfigOperationMetadata struct { +} + +// The replication state of a single replicated table (CdfStatus), as reported +// by the wal2delta extension on the primary compute. +type CdfState string + +const CdfStateCdfStateSkipped CdfState = `CDF_STATE_SKIPPED` + +const CdfStateCdfStateSnapshotting CdfState = `CDF_STATE_SNAPSHOTTING` + +const CdfStateCdfStateStreaming CdfState = `CDF_STATE_STREAMING` + +const CdfStateCdfStateTerminated CdfState = `CDF_STATE_TERMINATED` + +// String representation for [fmt.Print] +func (f *CdfState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *CdfState) Set(v string) error { + switch v { + case `CDF_STATE_SKIPPED`, `CDF_STATE_SNAPSHOTTING`, `CDF_STATE_STREAMING`, `CDF_STATE_TERMINATED`: + *f = CdfState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CDF_STATE_SKIPPED", "CDF_STATE_SNAPSHOTTING", "CDF_STATE_STREAMING", "CDF_STATE_TERMINATED"`, v) + } +} + +// Values returns all possible values for CdfState. +// +// There is no guarantee on the order of the values in the slice. +func (f *CdfState) Values() []CdfState { + return []CdfState{ + CdfStateCdfStateSkipped, + CdfStateCdfStateSnapshotting, + CdfStateCdfStateStreaming, + CdfStateCdfStateTerminated, + } +} + +// Type always returns CdfState to satisfy [pflag.Value] interface +func (f *CdfState) Type() string { + return "CdfState" +} + +// The read-only replication status of a single Postgres table replicated under +// a CdfConfig. One status exists per replicated table. It is created +// automatically and cannot be modified. +type CdfStatus struct { + // The high-watermark Log Sequence Number (LSN) committed to Delta Lake. + CommittedLsn string `json:"committed_lsn,omitempty"` + // When replication for this table was first established. + CreateTime *time.Time `json:"create_time,omitempty"` + // The last time wal2delta wrote changes for this table. + LastSyncTime *time.Time `json:"last_sync_time,omitempty"` + // Output only. The full resource name of the CdfStatus. Format: + // projects/{project}/branches/{branch}/databases/{database}/cdf-configs/{cdf_config}/cdf-statuses/{cdf_status} + // The {cdf_status} segment is the Postgres table name. + Name string `json:"name,omitempty"` + // The Postgres table being replicated. + PostgresTable string `json:"postgres_table,omitempty"` + // The current replication state of this table. + State CdfState `json:"state,omitempty"` + // Human-readable detail for the current state (e.g. the skip/error reason). + // Empty for healthy states. + StatusDetail string `json:"status_detail,omitempty"` + // The Unity Catalog table receiving replicated data. + UcTable string `json:"uc_table,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CdfStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CdfStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type CreateBranchRequest struct { // The Branch to create. Branch Branch `json:"branch"` @@ -322,6 +440,29 @@ type CreateCatalogRequest struct { CatalogId string `json:"-" url:"catalog_id"` } +type CreateCdfConfigRequest struct { + // The CdfConfig to create. The catalog, schema, and postgres_schema fields + // are required; all other fields are output only and ignored on input. + CdfConfig CdfConfig `json:"cdf_config"` + // The user-specified id for the CdfConfig, forming the final segment of its + // resource name. Must match the pattern `[a-z][a-z0-9_]{0,62}`. Defaults to + // the Postgres schema name when omitted. + CdfConfigId string `json:"-" url:"cdf_config_id,omitempty"` + // The parent database under which to create the CdfConfig. Format: + // projects/{project}/branches/{branch}/databases/{database} + Parent string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateCdfConfigRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateCdfConfigRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type CreateDataApiRequest struct { // The Data API configuration to create. DataApi DataApi `json:"data_api"` @@ -705,6 +846,26 @@ type DeleteCatalogRequest struct { Name string `json:"-" url:"-"` } +type DeleteCdfConfigRequest struct { + // When true, also drops the replicated Delta tables in Unity Catalog. When + // false (the default), the replicated tables are preserved at their last + // synced state. + Force bool `json:"-" url:"force,omitempty"` + // The resource name of the CdfConfig to delete. Format: + // projects/{project}/branches/{branch}/databases/{database}/cdf-configs/{cdf_config} + Name string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DeleteCdfConfigRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DeleteCdfConfigRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type DeleteDataApiRequest struct { // Resource name: // projects/{project_id}/branches/{branch_id}/databases/{database_id}/data-api @@ -1392,6 +1553,18 @@ type GetCatalogRequest struct { Name string `json:"-" url:"-"` } +type GetCdfConfigRequest struct { + // The resource name of the CdfConfig to retrieve. Format: + // projects/{project}/branches/{branch}/databases/{database}/cdf-configs/{cdf_config} + Name string `json:"-" url:"-"` +} + +type GetCdfStatusRequest struct { + // The resource name of the CdfStatus to retrieve. Format: + // projects/{project}/branches/{branch}/databases/{database}/cdf-configs/{cdf_config}/cdf-statuses/{cdf_status} + Name string `json:"-" url:"-"` +} + type GetDataApiRequest struct { // Resource name: // projects/{project_id}/branches/{branch_id}/databases/{database_id}/data-api @@ -1521,6 +1694,86 @@ func (s ListBranchesResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListCdfConfigsRequest struct { + // Maximum number of CdfConfigs to return. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token returned by a previous ListCdfConfigs call. Empty on the + // first page. + PageToken string `json:"-" url:"page_token,omitempty"` + // The parent database to list CdfConfigs for. Format: + // projects/{project}/branches/{branch}/databases/{database} + Parent string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListCdfConfigsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListCdfConfigsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Response to a ListCdfConfigs request, containing a page of CdfConfigs and a +// token for fetching the next page. +type ListCdfConfigsResponse struct { + // The CdfConfigs under the parent database. + CdfConfigs []CdfConfig `json:"cdf_configs,omitempty"` + // Token to retrieve the next page of results; empty when there are no more. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListCdfConfigsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListCdfConfigsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListCdfStatusesRequest struct { + // Maximum number of CdfStatuses to return. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token returned by a previous ListCdfStatuses call. Empty on + // the first page. + PageToken string `json:"-" url:"page_token,omitempty"` + // The parent CdfConfig to list CdfStatuses for. Format: + // projects/{project}/branches/{branch}/databases/{database}/cdf-configs/{cdf_config} + Parent string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListCdfStatusesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListCdfStatusesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Response to a ListCdfStatuses request, containing a page of replicated table +// statuses and a token for fetching the next page. +type ListCdfStatusesResponse struct { + // The replicated tables under the parent CdfConfig. + CdfStatuses []CdfStatus `json:"cdf_statuses,omitempty"` + // Token to retrieve the next page of results; empty when there are no more. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListCdfStatusesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListCdfStatusesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListDatabasesRequest struct { // Upper bound for items returned. PageSize int `json:"-" url:"page_size,omitempty"` diff --git a/service/supervisoragents/api.go b/service/supervisoragents/api.go old mode 100755 new mode 100644 index dd693ebbb..765dc7f6a --- a/service/supervisoragents/api.go +++ b/service/supervisoragents/api.go @@ -21,9 +21,11 @@ type SupervisorAgentsInterface interface { // Creates a Tool under a Supervisor Agent. Specify one of "genie_space", // "knowledge_assistant", "uc_function", "uc_connection", "app", "volume", // "dashboard", "table", "vector_search_index", "catalog", "schema", - // "supervisor_agent", "web_search", "skill" in the request body. The legacy - // values "lakeview_dashboard" and "uc_table" are also accepted and remain - // equivalent to "dashboard" and "table" respectively. + // "supervisor_agent", "databricks_web_search", "skill" in the request body. The + // legacy values "lakeview_dashboard", "uc_table", and "web_search" are also + // accepted and remain equivalent to "dashboard", "table", and + // "databricks_web_search" respectively. The "databricks_web_search" tool_type + // maps to the `web_search` spec field. CreateTool(ctx context.Context, request CreateToolRequest) (*Tool, error) // Deletes an example from a Supervisor Agent. diff --git a/service/supervisoragents/interface.go b/service/supervisoragents/interface.go old mode 100755 new mode 100644 index de844f4ca..b0dbb3781 --- a/service/supervisoragents/interface.go +++ b/service/supervisoragents/interface.go @@ -20,9 +20,11 @@ type SupervisorAgentsService interface { // Creates a Tool under a Supervisor Agent. Specify one of "genie_space", // "knowledge_assistant", "uc_function", "uc_connection", "app", "volume", // "dashboard", "table", "vector_search_index", "catalog", "schema", - // "supervisor_agent", "web_search", "skill" in the request body. The legacy - // values "lakeview_dashboard" and "uc_table" are also accepted and remain - // equivalent to "dashboard" and "table" respectively. + // "supervisor_agent", "databricks_web_search", "skill" in the request body. + // The legacy values "lakeview_dashboard", "uc_table", and "web_search" are + // also accepted and remain equivalent to "dashboard", "table", and + // "databricks_web_search" respectively. The "databricks_web_search" + // tool_type maps to the `web_search` spec field. CreateTool(ctx context.Context, request CreateToolRequest) (*Tool, error) // Deletes an example from a Supervisor Agent. diff --git a/service/supervisoragents/model.go b/service/supervisoragents/model.go old mode 100755 new mode 100644 index 03ab9edac..c189fa93f --- a/service/supervisoragents/model.go +++ b/service/supervisoragents/model.go @@ -445,9 +445,11 @@ type Tool struct { // Tool type. Must be one of: "genie_space", "knowledge_assistant", // "uc_function", "uc_connection", "uc_mcp", "app", "volume", "dashboard", // "serving_endpoint", "table", "vector_search_index", "catalog", "schema", - // "supervisor_agent", "web_search", "skill". The legacy values - // "lakeview_dashboard" and "uc_table" are also accepted and remain - // equivalent to "dashboard" and "table" respectively. + // "supervisor_agent", "databricks_web_search", "skill". The legacy values + // "lakeview_dashboard", "uc_table", and "web_search" are also accepted and + // remain equivalent to "dashboard", "table", and "databricks_web_search" + // respectively. The "databricks_web_search" tool_type maps to the + // `web_search` spec field. ToolType string `json:"tool_type"` UcConnection *UcConnection `json:"uc_connection,omitempty"`