diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index b867878f4..73633aa1e 100755 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -50a10950ac51e28984f99a85f0d4511e90d6ae94 \ No newline at end of file +bd6e15a1d13c8bf0fcaa1675bde0fd8fa37df2d0 \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 1213d40a0..c834264c5 100755 --- a/.gitattributes +++ b/.gitattributes @@ -250,6 +250,10 @@ service/billing/api.go linguist-generated=true service/billing/impl.go linguist-generated=true service/billing/interface.go linguist-generated=true service/billing/model.go linguist-generated=true +service/bundle/api.go linguist-generated=true +service/bundle/impl.go linguist-generated=true +service/bundle/interface.go linguist-generated=true +service/bundle/model.go linguist-generated=true service/catalog/api.go linguist-generated=true service/catalog/impl.go linguist-generated=true service/catalog/interface.go linguist-generated=true diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md old mode 100644 new mode 100755 index 9dabad71e..47a50d91e --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -13,3 +13,6 @@ ### Internal Changes ### API Changes +* Add [bundle](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/bundle) package. +* Add [w.Bundle](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/bundle#BundleAPI) workspace-level service. +* Add `MtlsConfig` field for [ml.AuthConfig](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/ml#AuthConfig). \ No newline at end of file diff --git a/experimental/mocks/mock_workspace_client.go b/experimental/mocks/mock_workspace_client.go index 18c2d5adc..a9f13c168 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -9,6 +9,7 @@ import ( "github.com/databricks/databricks-sdk-go/experimental/mocks/service/agentbricks" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/apps" + "github.com/databricks/databricks-sdk-go/experimental/mocks/service/bundle" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/catalog" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/cleanrooms" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/compute" @@ -63,6 +64,7 @@ func NewMockWorkspaceClient(t interface { Apps: apps.NewMockAppsInterface(t), AppsSettings: apps.NewMockAppsSettingsInterface(t), ArtifactAllowlists: catalog.NewMockArtifactAllowlistsInterface(t), + Bundle: bundle.NewMockBundleInterface(t), Catalogs: catalog.NewMockCatalogsInterface(t), CleanRoomAssetRevisions: cleanrooms.NewMockCleanRoomAssetRevisionsInterface(t), CleanRoomAssets: cleanrooms.NewMockCleanRoomAssetsInterface(t), @@ -441,6 +443,14 @@ func (m *MockWorkspaceClient) GetMockArtifactAllowlistsAPI() *catalog.MockArtifa return api } +func (m *MockWorkspaceClient) GetMockBundleAPI() *bundle.MockBundleInterface { + api, ok := m.WorkspaceClient.Bundle.(*bundle.MockBundleInterface) + if !ok { + panic(fmt.Sprintf("expected Bundle to be *bundle.MockBundleInterface, actual was %T", m.WorkspaceClient.Bundle)) + } + return api +} + func (m *MockWorkspaceClient) GetMockCatalogsAPI() *catalog.MockCatalogsInterface { api, ok := m.WorkspaceClient.Catalogs.(*catalog.MockCatalogsInterface) if !ok { diff --git a/experimental/mocks/service/bundle/mock_bundle_interface.go b/experimental/mocks/service/bundle/mock_bundle_interface.go new file mode 100755 index 000000000..0278846b2 --- /dev/null +++ b/experimental/mocks/service/bundle/mock_bundle_interface.go @@ -0,0 +1,1048 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package bundle + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + bundle "github.com/databricks/databricks-sdk-go/service/bundle" + mock "github.com/stretchr/testify/mock" +) + +// MockBundleInterface is an autogenerated mock type for the BundleInterface type +type MockBundleInterface struct { + mock.Mock +} + +type MockBundleInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockBundleInterface) EXPECT() *MockBundleInterface_Expecter { + return &MockBundleInterface_Expecter{mock: &_m.Mock} +} + +// CompleteVersion provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) CompleteVersion(ctx context.Context, request bundle.CompleteVersionRequest) (*bundle.Version, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CompleteVersion") + } + + var r0 *bundle.Version + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.CompleteVersionRequest) (*bundle.Version, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.CompleteVersionRequest) *bundle.Version); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*bundle.Version) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.CompleteVersionRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_CompleteVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompleteVersion' +type MockBundleInterface_CompleteVersion_Call struct { + *mock.Call +} + +// CompleteVersion is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.CompleteVersionRequest +func (_e *MockBundleInterface_Expecter) CompleteVersion(ctx interface{}, request interface{}) *MockBundleInterface_CompleteVersion_Call { + return &MockBundleInterface_CompleteVersion_Call{Call: _e.mock.On("CompleteVersion", ctx, request)} +} + +func (_c *MockBundleInterface_CompleteVersion_Call) Run(run func(ctx context.Context, request bundle.CompleteVersionRequest)) *MockBundleInterface_CompleteVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.CompleteVersionRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_CompleteVersion_Call) Return(_a0 *bundle.Version, _a1 error) *MockBundleInterface_CompleteVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_CompleteVersion_Call) RunAndReturn(run func(context.Context, bundle.CompleteVersionRequest) (*bundle.Version, error)) *MockBundleInterface_CompleteVersion_Call { + _c.Call.Return(run) + return _c +} + +// CreateDeployment provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) CreateDeployment(ctx context.Context, request bundle.CreateDeploymentRequest) (*bundle.Deployment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDeployment") + } + + var r0 *bundle.Deployment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.CreateDeploymentRequest) (*bundle.Deployment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.CreateDeploymentRequest) *bundle.Deployment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*bundle.Deployment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.CreateDeploymentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_CreateDeployment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDeployment' +type MockBundleInterface_CreateDeployment_Call struct { + *mock.Call +} + +// CreateDeployment is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.CreateDeploymentRequest +func (_e *MockBundleInterface_Expecter) CreateDeployment(ctx interface{}, request interface{}) *MockBundleInterface_CreateDeployment_Call { + return &MockBundleInterface_CreateDeployment_Call{Call: _e.mock.On("CreateDeployment", ctx, request)} +} + +func (_c *MockBundleInterface_CreateDeployment_Call) Run(run func(ctx context.Context, request bundle.CreateDeploymentRequest)) *MockBundleInterface_CreateDeployment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.CreateDeploymentRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_CreateDeployment_Call) Return(_a0 *bundle.Deployment, _a1 error) *MockBundleInterface_CreateDeployment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_CreateDeployment_Call) RunAndReturn(run func(context.Context, bundle.CreateDeploymentRequest) (*bundle.Deployment, error)) *MockBundleInterface_CreateDeployment_Call { + _c.Call.Return(run) + return _c +} + +// CreateOperation provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) CreateOperation(ctx context.Context, request bundle.CreateOperationRequest) (*bundle.Operation, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateOperation") + } + + var r0 *bundle.Operation + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.CreateOperationRequest) (*bundle.Operation, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.CreateOperationRequest) *bundle.Operation); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*bundle.Operation) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.CreateOperationRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_CreateOperation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateOperation' +type MockBundleInterface_CreateOperation_Call struct { + *mock.Call +} + +// CreateOperation is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.CreateOperationRequest +func (_e *MockBundleInterface_Expecter) CreateOperation(ctx interface{}, request interface{}) *MockBundleInterface_CreateOperation_Call { + return &MockBundleInterface_CreateOperation_Call{Call: _e.mock.On("CreateOperation", ctx, request)} +} + +func (_c *MockBundleInterface_CreateOperation_Call) Run(run func(ctx context.Context, request bundle.CreateOperationRequest)) *MockBundleInterface_CreateOperation_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.CreateOperationRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_CreateOperation_Call) Return(_a0 *bundle.Operation, _a1 error) *MockBundleInterface_CreateOperation_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_CreateOperation_Call) RunAndReturn(run func(context.Context, bundle.CreateOperationRequest) (*bundle.Operation, error)) *MockBundleInterface_CreateOperation_Call { + _c.Call.Return(run) + return _c +} + +// CreateVersion provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) CreateVersion(ctx context.Context, request bundle.CreateVersionRequest) (*bundle.Version, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateVersion") + } + + var r0 *bundle.Version + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.CreateVersionRequest) (*bundle.Version, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.CreateVersionRequest) *bundle.Version); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*bundle.Version) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.CreateVersionRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_CreateVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateVersion' +type MockBundleInterface_CreateVersion_Call struct { + *mock.Call +} + +// CreateVersion is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.CreateVersionRequest +func (_e *MockBundleInterface_Expecter) CreateVersion(ctx interface{}, request interface{}) *MockBundleInterface_CreateVersion_Call { + return &MockBundleInterface_CreateVersion_Call{Call: _e.mock.On("CreateVersion", ctx, request)} +} + +func (_c *MockBundleInterface_CreateVersion_Call) Run(run func(ctx context.Context, request bundle.CreateVersionRequest)) *MockBundleInterface_CreateVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.CreateVersionRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_CreateVersion_Call) Return(_a0 *bundle.Version, _a1 error) *MockBundleInterface_CreateVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_CreateVersion_Call) RunAndReturn(run func(context.Context, bundle.CreateVersionRequest) (*bundle.Version, error)) *MockBundleInterface_CreateVersion_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDeployment provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) DeleteDeployment(ctx context.Context, request bundle.DeleteDeploymentRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteDeployment") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.DeleteDeploymentRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockBundleInterface_DeleteDeployment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDeployment' +type MockBundleInterface_DeleteDeployment_Call struct { + *mock.Call +} + +// DeleteDeployment is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.DeleteDeploymentRequest +func (_e *MockBundleInterface_Expecter) DeleteDeployment(ctx interface{}, request interface{}) *MockBundleInterface_DeleteDeployment_Call { + return &MockBundleInterface_DeleteDeployment_Call{Call: _e.mock.On("DeleteDeployment", ctx, request)} +} + +func (_c *MockBundleInterface_DeleteDeployment_Call) Run(run func(ctx context.Context, request bundle.DeleteDeploymentRequest)) *MockBundleInterface_DeleteDeployment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.DeleteDeploymentRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_DeleteDeployment_Call) Return(_a0 error) *MockBundleInterface_DeleteDeployment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockBundleInterface_DeleteDeployment_Call) RunAndReturn(run func(context.Context, bundle.DeleteDeploymentRequest) error) *MockBundleInterface_DeleteDeployment_Call { + _c.Call.Return(run) + return _c +} + +// GetDeployment provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) GetDeployment(ctx context.Context, request bundle.GetDeploymentRequest) (*bundle.Deployment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDeployment") + } + + var r0 *bundle.Deployment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.GetDeploymentRequest) (*bundle.Deployment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.GetDeploymentRequest) *bundle.Deployment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*bundle.Deployment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.GetDeploymentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_GetDeployment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDeployment' +type MockBundleInterface_GetDeployment_Call struct { + *mock.Call +} + +// GetDeployment is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.GetDeploymentRequest +func (_e *MockBundleInterface_Expecter) GetDeployment(ctx interface{}, request interface{}) *MockBundleInterface_GetDeployment_Call { + return &MockBundleInterface_GetDeployment_Call{Call: _e.mock.On("GetDeployment", ctx, request)} +} + +func (_c *MockBundleInterface_GetDeployment_Call) Run(run func(ctx context.Context, request bundle.GetDeploymentRequest)) *MockBundleInterface_GetDeployment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.GetDeploymentRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_GetDeployment_Call) Return(_a0 *bundle.Deployment, _a1 error) *MockBundleInterface_GetDeployment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_GetDeployment_Call) RunAndReturn(run func(context.Context, bundle.GetDeploymentRequest) (*bundle.Deployment, error)) *MockBundleInterface_GetDeployment_Call { + _c.Call.Return(run) + return _c +} + +// GetOperation provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) GetOperation(ctx context.Context, request bundle.GetOperationRequest) (*bundle.Operation, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetOperation") + } + + var r0 *bundle.Operation + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.GetOperationRequest) (*bundle.Operation, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.GetOperationRequest) *bundle.Operation); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*bundle.Operation) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.GetOperationRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_GetOperation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOperation' +type MockBundleInterface_GetOperation_Call struct { + *mock.Call +} + +// GetOperation is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.GetOperationRequest +func (_e *MockBundleInterface_Expecter) GetOperation(ctx interface{}, request interface{}) *MockBundleInterface_GetOperation_Call { + return &MockBundleInterface_GetOperation_Call{Call: _e.mock.On("GetOperation", ctx, request)} +} + +func (_c *MockBundleInterface_GetOperation_Call) Run(run func(ctx context.Context, request bundle.GetOperationRequest)) *MockBundleInterface_GetOperation_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.GetOperationRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_GetOperation_Call) Return(_a0 *bundle.Operation, _a1 error) *MockBundleInterface_GetOperation_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_GetOperation_Call) RunAndReturn(run func(context.Context, bundle.GetOperationRequest) (*bundle.Operation, error)) *MockBundleInterface_GetOperation_Call { + _c.Call.Return(run) + return _c +} + +// GetResource provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) GetResource(ctx context.Context, request bundle.GetResourceRequest) (*bundle.Resource, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetResource") + } + + var r0 *bundle.Resource + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.GetResourceRequest) (*bundle.Resource, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.GetResourceRequest) *bundle.Resource); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*bundle.Resource) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.GetResourceRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_GetResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetResource' +type MockBundleInterface_GetResource_Call struct { + *mock.Call +} + +// GetResource is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.GetResourceRequest +func (_e *MockBundleInterface_Expecter) GetResource(ctx interface{}, request interface{}) *MockBundleInterface_GetResource_Call { + return &MockBundleInterface_GetResource_Call{Call: _e.mock.On("GetResource", ctx, request)} +} + +func (_c *MockBundleInterface_GetResource_Call) Run(run func(ctx context.Context, request bundle.GetResourceRequest)) *MockBundleInterface_GetResource_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.GetResourceRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_GetResource_Call) Return(_a0 *bundle.Resource, _a1 error) *MockBundleInterface_GetResource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_GetResource_Call) RunAndReturn(run func(context.Context, bundle.GetResourceRequest) (*bundle.Resource, error)) *MockBundleInterface_GetResource_Call { + _c.Call.Return(run) + return _c +} + +// GetVersion provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) GetVersion(ctx context.Context, request bundle.GetVersionRequest) (*bundle.Version, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetVersion") + } + + var r0 *bundle.Version + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.GetVersionRequest) (*bundle.Version, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.GetVersionRequest) *bundle.Version); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*bundle.Version) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.GetVersionRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_GetVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetVersion' +type MockBundleInterface_GetVersion_Call struct { + *mock.Call +} + +// GetVersion is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.GetVersionRequest +func (_e *MockBundleInterface_Expecter) GetVersion(ctx interface{}, request interface{}) *MockBundleInterface_GetVersion_Call { + return &MockBundleInterface_GetVersion_Call{Call: _e.mock.On("GetVersion", ctx, request)} +} + +func (_c *MockBundleInterface_GetVersion_Call) Run(run func(ctx context.Context, request bundle.GetVersionRequest)) *MockBundleInterface_GetVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.GetVersionRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_GetVersion_Call) Return(_a0 *bundle.Version, _a1 error) *MockBundleInterface_GetVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_GetVersion_Call) RunAndReturn(run func(context.Context, bundle.GetVersionRequest) (*bundle.Version, error)) *MockBundleInterface_GetVersion_Call { + _c.Call.Return(run) + return _c +} + +// Heartbeat provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) Heartbeat(ctx context.Context, request bundle.HeartbeatRequest) (*bundle.HeartbeatResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Heartbeat") + } + + var r0 *bundle.HeartbeatResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.HeartbeatRequest) (*bundle.HeartbeatResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.HeartbeatRequest) *bundle.HeartbeatResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*bundle.HeartbeatResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.HeartbeatRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_Heartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Heartbeat' +type MockBundleInterface_Heartbeat_Call struct { + *mock.Call +} + +// Heartbeat is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.HeartbeatRequest +func (_e *MockBundleInterface_Expecter) Heartbeat(ctx interface{}, request interface{}) *MockBundleInterface_Heartbeat_Call { + return &MockBundleInterface_Heartbeat_Call{Call: _e.mock.On("Heartbeat", ctx, request)} +} + +func (_c *MockBundleInterface_Heartbeat_Call) Run(run func(ctx context.Context, request bundle.HeartbeatRequest)) *MockBundleInterface_Heartbeat_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.HeartbeatRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_Heartbeat_Call) Return(_a0 *bundle.HeartbeatResponse, _a1 error) *MockBundleInterface_Heartbeat_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_Heartbeat_Call) RunAndReturn(run func(context.Context, bundle.HeartbeatRequest) (*bundle.HeartbeatResponse, error)) *MockBundleInterface_Heartbeat_Call { + _c.Call.Return(run) + return _c +} + +// ListDeployments provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) ListDeployments(ctx context.Context, request bundle.ListDeploymentsRequest) listing.Iterator[bundle.Deployment] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDeployments") + } + + var r0 listing.Iterator[bundle.Deployment] + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListDeploymentsRequest) listing.Iterator[bundle.Deployment]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[bundle.Deployment]) + } + } + + return r0 +} + +// MockBundleInterface_ListDeployments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDeployments' +type MockBundleInterface_ListDeployments_Call struct { + *mock.Call +} + +// ListDeployments is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.ListDeploymentsRequest +func (_e *MockBundleInterface_Expecter) ListDeployments(ctx interface{}, request interface{}) *MockBundleInterface_ListDeployments_Call { + return &MockBundleInterface_ListDeployments_Call{Call: _e.mock.On("ListDeployments", ctx, request)} +} + +func (_c *MockBundleInterface_ListDeployments_Call) Run(run func(ctx context.Context, request bundle.ListDeploymentsRequest)) *MockBundleInterface_ListDeployments_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.ListDeploymentsRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_ListDeployments_Call) Return(_a0 listing.Iterator[bundle.Deployment]) *MockBundleInterface_ListDeployments_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockBundleInterface_ListDeployments_Call) RunAndReturn(run func(context.Context, bundle.ListDeploymentsRequest) listing.Iterator[bundle.Deployment]) *MockBundleInterface_ListDeployments_Call { + _c.Call.Return(run) + return _c +} + +// ListDeploymentsAll provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) ListDeploymentsAll(ctx context.Context, request bundle.ListDeploymentsRequest) ([]bundle.Deployment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDeploymentsAll") + } + + var r0 []bundle.Deployment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListDeploymentsRequest) ([]bundle.Deployment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListDeploymentsRequest) []bundle.Deployment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]bundle.Deployment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.ListDeploymentsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_ListDeploymentsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDeploymentsAll' +type MockBundleInterface_ListDeploymentsAll_Call struct { + *mock.Call +} + +// ListDeploymentsAll is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.ListDeploymentsRequest +func (_e *MockBundleInterface_Expecter) ListDeploymentsAll(ctx interface{}, request interface{}) *MockBundleInterface_ListDeploymentsAll_Call { + return &MockBundleInterface_ListDeploymentsAll_Call{Call: _e.mock.On("ListDeploymentsAll", ctx, request)} +} + +func (_c *MockBundleInterface_ListDeploymentsAll_Call) Run(run func(ctx context.Context, request bundle.ListDeploymentsRequest)) *MockBundleInterface_ListDeploymentsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.ListDeploymentsRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_ListDeploymentsAll_Call) Return(_a0 []bundle.Deployment, _a1 error) *MockBundleInterface_ListDeploymentsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_ListDeploymentsAll_Call) RunAndReturn(run func(context.Context, bundle.ListDeploymentsRequest) ([]bundle.Deployment, error)) *MockBundleInterface_ListDeploymentsAll_Call { + _c.Call.Return(run) + return _c +} + +// ListOperations provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) ListOperations(ctx context.Context, request bundle.ListOperationsRequest) listing.Iterator[bundle.Operation] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListOperations") + } + + var r0 listing.Iterator[bundle.Operation] + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListOperationsRequest) listing.Iterator[bundle.Operation]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[bundle.Operation]) + } + } + + return r0 +} + +// MockBundleInterface_ListOperations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListOperations' +type MockBundleInterface_ListOperations_Call struct { + *mock.Call +} + +// ListOperations is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.ListOperationsRequest +func (_e *MockBundleInterface_Expecter) ListOperations(ctx interface{}, request interface{}) *MockBundleInterface_ListOperations_Call { + return &MockBundleInterface_ListOperations_Call{Call: _e.mock.On("ListOperations", ctx, request)} +} + +func (_c *MockBundleInterface_ListOperations_Call) Run(run func(ctx context.Context, request bundle.ListOperationsRequest)) *MockBundleInterface_ListOperations_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.ListOperationsRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_ListOperations_Call) Return(_a0 listing.Iterator[bundle.Operation]) *MockBundleInterface_ListOperations_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockBundleInterface_ListOperations_Call) RunAndReturn(run func(context.Context, bundle.ListOperationsRequest) listing.Iterator[bundle.Operation]) *MockBundleInterface_ListOperations_Call { + _c.Call.Return(run) + return _c +} + +// ListOperationsAll provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) ListOperationsAll(ctx context.Context, request bundle.ListOperationsRequest) ([]bundle.Operation, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListOperationsAll") + } + + var r0 []bundle.Operation + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListOperationsRequest) ([]bundle.Operation, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListOperationsRequest) []bundle.Operation); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]bundle.Operation) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.ListOperationsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_ListOperationsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListOperationsAll' +type MockBundleInterface_ListOperationsAll_Call struct { + *mock.Call +} + +// ListOperationsAll is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.ListOperationsRequest +func (_e *MockBundleInterface_Expecter) ListOperationsAll(ctx interface{}, request interface{}) *MockBundleInterface_ListOperationsAll_Call { + return &MockBundleInterface_ListOperationsAll_Call{Call: _e.mock.On("ListOperationsAll", ctx, request)} +} + +func (_c *MockBundleInterface_ListOperationsAll_Call) Run(run func(ctx context.Context, request bundle.ListOperationsRequest)) *MockBundleInterface_ListOperationsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.ListOperationsRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_ListOperationsAll_Call) Return(_a0 []bundle.Operation, _a1 error) *MockBundleInterface_ListOperationsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_ListOperationsAll_Call) RunAndReturn(run func(context.Context, bundle.ListOperationsRequest) ([]bundle.Operation, error)) *MockBundleInterface_ListOperationsAll_Call { + _c.Call.Return(run) + return _c +} + +// ListResources provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) ListResources(ctx context.Context, request bundle.ListResourcesRequest) listing.Iterator[bundle.Resource] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListResources") + } + + var r0 listing.Iterator[bundle.Resource] + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListResourcesRequest) listing.Iterator[bundle.Resource]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[bundle.Resource]) + } + } + + return r0 +} + +// MockBundleInterface_ListResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListResources' +type MockBundleInterface_ListResources_Call struct { + *mock.Call +} + +// ListResources is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.ListResourcesRequest +func (_e *MockBundleInterface_Expecter) ListResources(ctx interface{}, request interface{}) *MockBundleInterface_ListResources_Call { + return &MockBundleInterface_ListResources_Call{Call: _e.mock.On("ListResources", ctx, request)} +} + +func (_c *MockBundleInterface_ListResources_Call) Run(run func(ctx context.Context, request bundle.ListResourcesRequest)) *MockBundleInterface_ListResources_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.ListResourcesRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_ListResources_Call) Return(_a0 listing.Iterator[bundle.Resource]) *MockBundleInterface_ListResources_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockBundleInterface_ListResources_Call) RunAndReturn(run func(context.Context, bundle.ListResourcesRequest) listing.Iterator[bundle.Resource]) *MockBundleInterface_ListResources_Call { + _c.Call.Return(run) + return _c +} + +// ListResourcesAll provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) ListResourcesAll(ctx context.Context, request bundle.ListResourcesRequest) ([]bundle.Resource, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListResourcesAll") + } + + var r0 []bundle.Resource + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListResourcesRequest) ([]bundle.Resource, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListResourcesRequest) []bundle.Resource); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]bundle.Resource) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.ListResourcesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_ListResourcesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListResourcesAll' +type MockBundleInterface_ListResourcesAll_Call struct { + *mock.Call +} + +// ListResourcesAll is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.ListResourcesRequest +func (_e *MockBundleInterface_Expecter) ListResourcesAll(ctx interface{}, request interface{}) *MockBundleInterface_ListResourcesAll_Call { + return &MockBundleInterface_ListResourcesAll_Call{Call: _e.mock.On("ListResourcesAll", ctx, request)} +} + +func (_c *MockBundleInterface_ListResourcesAll_Call) Run(run func(ctx context.Context, request bundle.ListResourcesRequest)) *MockBundleInterface_ListResourcesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.ListResourcesRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_ListResourcesAll_Call) Return(_a0 []bundle.Resource, _a1 error) *MockBundleInterface_ListResourcesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_ListResourcesAll_Call) RunAndReturn(run func(context.Context, bundle.ListResourcesRequest) ([]bundle.Resource, error)) *MockBundleInterface_ListResourcesAll_Call { + _c.Call.Return(run) + return _c +} + +// ListVersions provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) ListVersions(ctx context.Context, request bundle.ListVersionsRequest) listing.Iterator[bundle.Version] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListVersions") + } + + var r0 listing.Iterator[bundle.Version] + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListVersionsRequest) listing.Iterator[bundle.Version]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[bundle.Version]) + } + } + + return r0 +} + +// MockBundleInterface_ListVersions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListVersions' +type MockBundleInterface_ListVersions_Call struct { + *mock.Call +} + +// ListVersions is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.ListVersionsRequest +func (_e *MockBundleInterface_Expecter) ListVersions(ctx interface{}, request interface{}) *MockBundleInterface_ListVersions_Call { + return &MockBundleInterface_ListVersions_Call{Call: _e.mock.On("ListVersions", ctx, request)} +} + +func (_c *MockBundleInterface_ListVersions_Call) Run(run func(ctx context.Context, request bundle.ListVersionsRequest)) *MockBundleInterface_ListVersions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.ListVersionsRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_ListVersions_Call) Return(_a0 listing.Iterator[bundle.Version]) *MockBundleInterface_ListVersions_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockBundleInterface_ListVersions_Call) RunAndReturn(run func(context.Context, bundle.ListVersionsRequest) listing.Iterator[bundle.Version]) *MockBundleInterface_ListVersions_Call { + _c.Call.Return(run) + return _c +} + +// ListVersionsAll provides a mock function with given fields: ctx, request +func (_m *MockBundleInterface) ListVersionsAll(ctx context.Context, request bundle.ListVersionsRequest) ([]bundle.Version, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListVersionsAll") + } + + var r0 []bundle.Version + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListVersionsRequest) ([]bundle.Version, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, bundle.ListVersionsRequest) []bundle.Version); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]bundle.Version) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bundle.ListVersionsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBundleInterface_ListVersionsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListVersionsAll' +type MockBundleInterface_ListVersionsAll_Call struct { + *mock.Call +} + +// ListVersionsAll is a helper method to define mock.On call +// - ctx context.Context +// - request bundle.ListVersionsRequest +func (_e *MockBundleInterface_Expecter) ListVersionsAll(ctx interface{}, request interface{}) *MockBundleInterface_ListVersionsAll_Call { + return &MockBundleInterface_ListVersionsAll_Call{Call: _e.mock.On("ListVersionsAll", ctx, request)} +} + +func (_c *MockBundleInterface_ListVersionsAll_Call) Run(run func(ctx context.Context, request bundle.ListVersionsRequest)) *MockBundleInterface_ListVersionsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(bundle.ListVersionsRequest)) + }) + return _c +} + +func (_c *MockBundleInterface_ListVersionsAll_Call) Return(_a0 []bundle.Version, _a1 error) *MockBundleInterface_ListVersionsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBundleInterface_ListVersionsAll_Call) RunAndReturn(run func(context.Context, bundle.ListVersionsRequest) ([]bundle.Version, error)) *MockBundleInterface_ListVersionsAll_Call { + _c.Call.Return(run) + return _c +} + +// NewMockBundleInterface creates a new instance of MockBundleInterface. 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 NewMockBundleInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockBundleInterface { + mock := &MockBundleInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/service/bundle/api.go b/service/bundle/api.go new file mode 100755 index 000000000..d7441156a --- /dev/null +++ b/service/bundle/api.go @@ -0,0 +1,129 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +// Service for managing bundle deployment metadata. +package bundle + +import ( + "context" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" +) + +type BundleInterface interface { + + // Marks a version as complete and releases the deployment lock. + // + // The server atomically: 1. Sets the version status to the provided terminal + // status. 2. Sets `complete_time` to the current server timestamp. 3. Releases + // the lock on the parent deployment. 4. Updates the parent deployment's + // `status` and `last_version_id`. + CompleteVersion(ctx context.Context, request CompleteVersionRequest) (*Version, error) + + // Creates a new deployment in the workspace. + // + // The caller must provide a `deployment_id` which becomes the final component + // of the deployment's resource name. If a deployment with the same ID already + // exists, the server returns `ALREADY_EXISTS`. + CreateDeployment(ctx context.Context, request CreateDeploymentRequest) (*Deployment, error) + + // Creates a resource operation under a version. + // + // The caller must provide a `resource_key` which becomes the final component of + // the operation's name. If an operation with the same key already exists under + // the version, the server returns `ALREADY_EXISTS`. + // + // On success the server also updates the corresponding deployment-level + // Resource (creating it if this is the first operation for that resource_key, + // or removing it if action_type is DELETE). + CreateOperation(ctx context.Context, request CreateOperationRequest) (*Operation, error) + + // Creates a new version under a deployment. + // + // Creating a version acquires an exclusive lock on the deployment, preventing + // concurrent deploys. The caller provides a `version_id` which the server + // validates equals `last_version_id + 1` on the deployment. + CreateVersion(ctx context.Context, request CreateVersionRequest) (*Version, error) + + // Deletes a deployment. + // + // The deployment is marked as deleted. It and all its children (versions and + // their operations) will be permanently deleted after the retention policy + // expires. If the deployment has an in-progress version, the server returns + // `RESOURCE_CONFLICT`. + DeleteDeployment(ctx context.Context, request DeleteDeploymentRequest) error + + // Retrieves a deployment by its resource name. + GetDeployment(ctx context.Context, request GetDeploymentRequest) (*Deployment, error) + + // Retrieves a resource operation by its resource name. + GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error) + + // Retrieves a deployment resource by its resource name. + GetResource(ctx context.Context, request GetResourceRequest) (*Resource, error) + + // Retrieves a version by its resource name. + GetVersion(ctx context.Context, request GetVersionRequest) (*Version, error) + + // Sends a heartbeat to renew the lock held by a version. + // + // The server validates that the version is the active (non-terminal) version on + // the parent deployment and resets the lock expiry. If the lock has already + // expired or the version is no longer active, the server returns `ABORTED`. + Heartbeat(ctx context.Context, request HeartbeatRequest) (*HeartbeatResponse, error) + + // Lists deployments in the workspace. + // + // This method is generated by Databricks SDK Code Generator. + ListDeployments(ctx context.Context, request ListDeploymentsRequest) listing.Iterator[Deployment] + + // Lists deployments in the workspace. + // + // This method is generated by Databricks SDK Code Generator. + ListDeploymentsAll(ctx context.Context, request ListDeploymentsRequest) ([]Deployment, error) + + // Lists resource operations under a version. + // + // This method is generated by Databricks SDK Code Generator. + ListOperations(ctx context.Context, request ListOperationsRequest) listing.Iterator[Operation] + + // Lists resource operations under a version. + // + // This method is generated by Databricks SDK Code Generator. + ListOperationsAll(ctx context.Context, request ListOperationsRequest) ([]Operation, error) + + // Lists resources under a deployment. + // + // This method is generated by Databricks SDK Code Generator. + ListResources(ctx context.Context, request ListResourcesRequest) listing.Iterator[Resource] + + // Lists resources under a deployment. + // + // This method is generated by Databricks SDK Code Generator. + ListResourcesAll(ctx context.Context, request ListResourcesRequest) ([]Resource, error) + + // Lists versions under a deployment, ordered by version_id descending (most + // recent first). + // + // This method is generated by Databricks SDK Code Generator. + ListVersions(ctx context.Context, request ListVersionsRequest) listing.Iterator[Version] + + // Lists versions under a deployment, ordered by version_id descending (most + // recent first). + // + // This method is generated by Databricks SDK Code Generator. + ListVersionsAll(ctx context.Context, request ListVersionsRequest) ([]Version, error) +} + +func NewBundle(client *client.DatabricksClient) *BundleAPI { + return &BundleAPI{ + bundleImpl: bundleImpl{ + client: client, + }, + } +} + +// Service for managing bundle deployment metadata. +type BundleAPI struct { + bundleImpl +} diff --git a/service/bundle/impl.go b/service/bundle/impl.go new file mode 100755 index 000000000..6997117a1 --- /dev/null +++ b/service/bundle/impl.go @@ -0,0 +1,356 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package bundle + +import ( + "context" + "fmt" + "net/http" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/useragent" +) + +// unexported type that holds implementations of just Bundle API methods +type bundleImpl struct { + client *client.DatabricksClient +} + +func (a *bundleImpl) CompleteVersion(ctx context.Context, request CompleteVersionRequest) (*Version, error) { + var version Version + path := fmt.Sprintf("/api/2.0/bundle/%v/complete", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &version) + return &version, err +} + +func (a *bundleImpl) CreateDeployment(ctx context.Context, request CreateDeploymentRequest) (*Deployment, error) { + var deployment Deployment + path := "/api/2.0/bundle/deployments" + queryParams := make(map[string]any) + + if request.DeploymentId != "" { + queryParams["deployment_id"] = request.DeploymentId + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Deployment, &deployment) + return &deployment, err +} + +func (a *bundleImpl) CreateOperation(ctx context.Context, request CreateOperationRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/bundle/%v/operations", request.Parent) + queryParams := make(map[string]any) + + if request.ResourceKey != "" { + queryParams["resource_key"] = request.ResourceKey + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Operation, &operation) + return &operation, err +} + +func (a *bundleImpl) CreateVersion(ctx context.Context, request CreateVersionRequest) (*Version, error) { + var version Version + path := fmt.Sprintf("/api/2.0/bundle/%v/versions", request.Parent) + queryParams := make(map[string]any) + + if request.VersionId != "" { + queryParams["version_id"] = request.VersionId + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Version, &version) + return &version, err +} + +func (a *bundleImpl) DeleteDeployment(ctx context.Context, request DeleteDeploymentRequest) error { + path := fmt.Sprintf("/api/2.0/bundle/%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-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *bundleImpl) GetDeployment(ctx context.Context, request GetDeploymentRequest) (*Deployment, error) { + var deployment Deployment + path := fmt.Sprintf("/api/2.0/bundle/%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-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &deployment) + return &deployment, err +} + +func (a *bundleImpl) GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/bundle/%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-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &operation) + return &operation, err +} + +func (a *bundleImpl) GetResource(ctx context.Context, request GetResourceRequest) (*Resource, error) { + var resource Resource + path := fmt.Sprintf("/api/2.0/bundle/%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-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &resource) + return &resource, err +} + +func (a *bundleImpl) GetVersion(ctx context.Context, request GetVersionRequest) (*Version, error) { + var version Version + path := fmt.Sprintf("/api/2.0/bundle/%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-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &version) + return &version, err +} + +func (a *bundleImpl) Heartbeat(ctx context.Context, request HeartbeatRequest) (*HeartbeatResponse, error) { + var heartbeatResponse HeartbeatResponse + path := fmt.Sprintf("/api/2.0/bundle/%v/heartbeat", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &heartbeatResponse) + return &heartbeatResponse, err +} + +// Lists deployments in the workspace. +func (a *bundleImpl) ListDeployments(ctx context.Context, request ListDeploymentsRequest) listing.Iterator[Deployment] { + + getNextPage := func(ctx context.Context, req ListDeploymentsRequest) (*ListDeploymentsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListDeployments(ctx, req) + } + getItems := func(resp *ListDeploymentsResponse) []Deployment { + return resp.Deployments + } + getNextReq := func(resp *ListDeploymentsResponse) *ListDeploymentsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Lists deployments in the workspace. +func (a *bundleImpl) ListDeploymentsAll(ctx context.Context, request ListDeploymentsRequest) ([]Deployment, error) { + iterator := a.ListDeployments(ctx, request) + return listing.ToSlice[Deployment](ctx, iterator) +} + +func (a *bundleImpl) internalListDeployments(ctx context.Context, request ListDeploymentsRequest) (*ListDeploymentsResponse, error) { + var listDeploymentsResponse ListDeploymentsResponse + path := "/api/2.0/bundle/deployments" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + cfg := a.client.Config + if cfg.WorkspaceID != "" { + headers["X-Databricks-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDeploymentsResponse) + return &listDeploymentsResponse, err +} + +// Lists resource operations under a version. +func (a *bundleImpl) ListOperations(ctx context.Context, request ListOperationsRequest) listing.Iterator[Operation] { + + getNextPage := func(ctx context.Context, req ListOperationsRequest) (*ListOperationsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListOperations(ctx, req) + } + getItems := func(resp *ListOperationsResponse) []Operation { + return resp.Operations + } + getNextReq := func(resp *ListOperationsResponse) *ListOperationsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Lists resource operations under a version. +func (a *bundleImpl) ListOperationsAll(ctx context.Context, request ListOperationsRequest) ([]Operation, error) { + iterator := a.ListOperations(ctx, request) + return listing.ToSlice[Operation](ctx, iterator) +} + +func (a *bundleImpl) internalListOperations(ctx context.Context, request ListOperationsRequest) (*ListOperationsResponse, error) { + var listOperationsResponse ListOperationsResponse + path := fmt.Sprintf("/api/2.0/bundle/%v/operations", 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-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listOperationsResponse) + return &listOperationsResponse, err +} + +// Lists resources under a deployment. +func (a *bundleImpl) ListResources(ctx context.Context, request ListResourcesRequest) listing.Iterator[Resource] { + + getNextPage := func(ctx context.Context, req ListResourcesRequest) (*ListResourcesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListResources(ctx, req) + } + getItems := func(resp *ListResourcesResponse) []Resource { + return resp.Resources + } + getNextReq := func(resp *ListResourcesResponse) *ListResourcesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Lists resources under a deployment. +func (a *bundleImpl) ListResourcesAll(ctx context.Context, request ListResourcesRequest) ([]Resource, error) { + iterator := a.ListResources(ctx, request) + return listing.ToSlice[Resource](ctx, iterator) +} + +func (a *bundleImpl) internalListResources(ctx context.Context, request ListResourcesRequest) (*ListResourcesResponse, error) { + var listResourcesResponse ListResourcesResponse + path := fmt.Sprintf("/api/2.0/bundle/%v/resources", 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-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listResourcesResponse) + return &listResourcesResponse, err +} + +// Lists versions under a deployment, ordered by version_id descending (most +// recent first). +func (a *bundleImpl) ListVersions(ctx context.Context, request ListVersionsRequest) listing.Iterator[Version] { + + getNextPage := func(ctx context.Context, req ListVersionsRequest) (*ListVersionsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListVersions(ctx, req) + } + getItems := func(resp *ListVersionsResponse) []Version { + return resp.Versions + } + getNextReq := func(resp *ListVersionsResponse) *ListVersionsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Lists versions under a deployment, ordered by version_id descending (most +// recent first). +func (a *bundleImpl) ListVersionsAll(ctx context.Context, request ListVersionsRequest) ([]Version, error) { + iterator := a.ListVersions(ctx, request) + return listing.ToSlice[Version](ctx, iterator) +} + +func (a *bundleImpl) internalListVersions(ctx context.Context, request ListVersionsRequest) (*ListVersionsResponse, error) { + var listVersionsResponse ListVersionsResponse + path := fmt.Sprintf("/api/2.0/bundle/%v/versions", 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-Org-Id"] = cfg.WorkspaceID + } + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listVersionsResponse) + return &listVersionsResponse, err +} diff --git a/service/bundle/interface.go b/service/bundle/interface.go new file mode 100755 index 000000000..08a4b7849 --- /dev/null +++ b/service/bundle/interface.go @@ -0,0 +1,87 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package bundle + +import ( + "context" +) + +// Service for managing bundle deployment metadata. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type BundleService interface { + + // Marks a version as complete and releases the deployment lock. + // + // The server atomically: 1. Sets the version status to the provided + // terminal status. 2. Sets `complete_time` to the current server timestamp. + // 3. Releases the lock on the parent deployment. 4. Updates the parent + // deployment's `status` and `last_version_id`. + CompleteVersion(ctx context.Context, request CompleteVersionRequest) (*Version, error) + + // Creates a new deployment in the workspace. + // + // The caller must provide a `deployment_id` which becomes the final + // component of the deployment's resource name. If a deployment with the + // same ID already exists, the server returns `ALREADY_EXISTS`. + CreateDeployment(ctx context.Context, request CreateDeploymentRequest) (*Deployment, error) + + // Creates a resource operation under a version. + // + // The caller must provide a `resource_key` which becomes the final + // component of the operation's name. If an operation with the same key + // already exists under the version, the server returns `ALREADY_EXISTS`. + // + // On success the server also updates the corresponding deployment-level + // Resource (creating it if this is the first operation for that + // resource_key, or removing it if action_type is DELETE). + CreateOperation(ctx context.Context, request CreateOperationRequest) (*Operation, error) + + // Creates a new version under a deployment. + // + // Creating a version acquires an exclusive lock on the deployment, + // preventing concurrent deploys. The caller provides a `version_id` which + // the server validates equals `last_version_id + 1` on the deployment. + CreateVersion(ctx context.Context, request CreateVersionRequest) (*Version, error) + + // Deletes a deployment. + // + // The deployment is marked as deleted. It and all its children (versions + // and their operations) will be permanently deleted after the retention + // policy expires. If the deployment has an in-progress version, the server + // returns `RESOURCE_CONFLICT`. + DeleteDeployment(ctx context.Context, request DeleteDeploymentRequest) error + + // Retrieves a deployment by its resource name. + GetDeployment(ctx context.Context, request GetDeploymentRequest) (*Deployment, error) + + // Retrieves a resource operation by its resource name. + GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error) + + // Retrieves a deployment resource by its resource name. + GetResource(ctx context.Context, request GetResourceRequest) (*Resource, error) + + // Retrieves a version by its resource name. + GetVersion(ctx context.Context, request GetVersionRequest) (*Version, error) + + // Sends a heartbeat to renew the lock held by a version. + // + // The server validates that the version is the active (non-terminal) + // version on the parent deployment and resets the lock expiry. If the lock + // has already expired or the version is no longer active, the server + // returns `ABORTED`. + Heartbeat(ctx context.Context, request HeartbeatRequest) (*HeartbeatResponse, error) + + // Lists deployments in the workspace. + ListDeployments(ctx context.Context, request ListDeploymentsRequest) (*ListDeploymentsResponse, error) + + // Lists resource operations under a version. + ListOperations(ctx context.Context, request ListOperationsRequest) (*ListOperationsResponse, error) + + // Lists resources under a deployment. + ListResources(ctx context.Context, request ListResourcesRequest) (*ListResourcesResponse, error) + + // Lists versions under a deployment, ordered by version_id descending (most + // recent first). + ListVersions(ctx context.Context, request ListVersionsRequest) (*ListVersionsResponse, error) +} diff --git a/service/bundle/model.go b/service/bundle/model.go new file mode 100755 index 000000000..1fdb38e5f --- /dev/null +++ b/service/bundle/model.go @@ -0,0 +1,798 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package bundle + +import ( + "encoding/json" + "fmt" + + "github.com/databricks/databricks-sdk-go/common/types/time" + "github.com/databricks/databricks-sdk-go/marshal" +) + +// A request to complete a Version. +type CompleteVersionRequest struct { + // The reason for completing the version. Must be a terminal reason: + // VERSION_COMPLETE_SUCCESS, VERSION_COMPLETE_FAILURE, or + // VERSION_COMPLETE_FORCE_ABORT. + CompletionReason VersionComplete `json:"completion_reason"` + // If true, force-completes the version even if the caller is not the + // original creator. The completion_reason must be + // VERSION_COMPLETE_FORCE_ABORT when force is true. + Force bool `json:"force,omitempty"` + // The name of the version to complete. Format: + // deployments/{deployment_id}/versions/{version_id} + Name string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CompleteVersionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CompleteVersionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateDeploymentRequest struct { + // The deployment to create. + Deployment Deployment `json:"deployment"` + // The ID to use for the deployment, which will become the final component + // of the deployment's resource name (i.e. `deployments/{deployment_id}`). + DeploymentId string `json:"-" url:"deployment_id"` +} + +type CreateOperationRequest struct { + // The resource operation to create. + Operation Operation `json:"operation"` + // The parent version where this operation will be recorded. Format: + // deployments/{deployment_id}/versions/{version_id} + Parent string `json:"-" url:"-"` + // The key identifying the resource this operation applies to. Becomes the + // final component of the operation's name. + ResourceKey string `json:"-" url:"resource_key"` +} + +type CreateVersionRequest struct { + // The parent deployment where this version will be created. Format: + // deployments/{deployment_id} + Parent string `json:"-" url:"-"` + // The version to create. + Version Version `json:"version"` + // The version ID the caller expects to create. The server validates this + // equals `last_version_id + 1` on the deployment. If it doesn't match, the + // server returns `ABORTED`. + VersionId string `json:"-" url:"version_id"` +} + +type DeleteDeploymentRequest struct { + // Resource name of the deployment to delete. Format: + // deployments/{deployment_id} + Name string `json:"-" url:"-"` +} + +// A bundle deployment registered with the control plane. +type Deployment struct { + // When the deployment was created. + CreateTime *time.Time `json:"create_time,omitempty"` + // The user who created the deployment (email or principal name). + CreatedBy string `json:"created_by,omitempty"` + // When the deployment was destroyed (i.e. `bundle destroy` completed). + // Unset if the deployment has not been destroyed. Named destroy_time (not + // delete_time) because this tracks the `databricks bundle destroy` command, + // not the API-level deletion. + DestroyTime *time.Time `json:"destroy_time,omitempty"` + // The user who destroyed the deployment (email or principal name). Unset if + // the deployment has not been destroyed. + DestroyedBy string `json:"destroyed_by,omitempty"` + // Human-readable name for the deployment. + DisplayName string `json:"display_name,omitempty"` + // The version_id of the most recent deployment version. + LastVersionId string `json:"last_version_id,omitempty"` + // Resource name of the deployment. Format: deployments/{deployment_id} + Name string `json:"name,omitempty"` + // Current status of the deployment. + Status DeploymentStatus `json:"status,omitempty"` + // The bundle target name associated with this deployment. + TargetName string `json:"target_name,omitempty"` + // When the deployment was last updated. + UpdateTime *time.Time `json:"update_time,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Deployment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Deployment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Type of a deployment resource. +type DeploymentResourceType string + +const DeploymentResourceTypeDeploymentResourceTypeAlert DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_ALERT` + +const DeploymentResourceTypeDeploymentResourceTypeApp DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_APP` + +const DeploymentResourceTypeDeploymentResourceTypeCatalog DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_CATALOG` + +const DeploymentResourceTypeDeploymentResourceTypeCluster DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_CLUSTER` + +const DeploymentResourceTypeDeploymentResourceTypeDashboard DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_DASHBOARD` + +const DeploymentResourceTypeDeploymentResourceTypeDatabaseCatalog DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_DATABASE_CATALOG` + +const DeploymentResourceTypeDeploymentResourceTypeDatabaseInstance DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_DATABASE_INSTANCE` + +const DeploymentResourceTypeDeploymentResourceTypeExperiment DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_EXPERIMENT` + +const DeploymentResourceTypeDeploymentResourceTypeExternalLocation DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_EXTERNAL_LOCATION` + +const DeploymentResourceTypeDeploymentResourceTypeJob DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_JOB` + +const DeploymentResourceTypeDeploymentResourceTypeModel DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_MODEL` + +const DeploymentResourceTypeDeploymentResourceTypeModelServingEndpoint DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_MODEL_SERVING_ENDPOINT` + +const DeploymentResourceTypeDeploymentResourceTypePipeline DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_PIPELINE` + +const DeploymentResourceTypeDeploymentResourceTypePostgresBranch DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_POSTGRES_BRANCH` + +const DeploymentResourceTypeDeploymentResourceTypePostgresEndpoint DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_POSTGRES_ENDPOINT` + +const DeploymentResourceTypeDeploymentResourceTypePostgresProject DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_POSTGRES_PROJECT` + +const DeploymentResourceTypeDeploymentResourceTypeQualityMonitor DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_QUALITY_MONITOR` + +const DeploymentResourceTypeDeploymentResourceTypeRegisteredModel DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_REGISTERED_MODEL` + +const DeploymentResourceTypeDeploymentResourceTypeSchema DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_SCHEMA` + +const DeploymentResourceTypeDeploymentResourceTypeSecretScope DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_SECRET_SCOPE` + +const DeploymentResourceTypeDeploymentResourceTypeSqlWarehouse DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_SQL_WAREHOUSE` + +const DeploymentResourceTypeDeploymentResourceTypeSyncedDatabaseTable DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_SYNCED_DATABASE_TABLE` + +const DeploymentResourceTypeDeploymentResourceTypeVolume DeploymentResourceType = `DEPLOYMENT_RESOURCE_TYPE_VOLUME` + +// String representation for [fmt.Print] +func (f *DeploymentResourceType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DeploymentResourceType) Set(v string) error { + switch v { + case `DEPLOYMENT_RESOURCE_TYPE_ALERT`, `DEPLOYMENT_RESOURCE_TYPE_APP`, `DEPLOYMENT_RESOURCE_TYPE_CATALOG`, `DEPLOYMENT_RESOURCE_TYPE_CLUSTER`, `DEPLOYMENT_RESOURCE_TYPE_DASHBOARD`, `DEPLOYMENT_RESOURCE_TYPE_DATABASE_CATALOG`, `DEPLOYMENT_RESOURCE_TYPE_DATABASE_INSTANCE`, `DEPLOYMENT_RESOURCE_TYPE_EXPERIMENT`, `DEPLOYMENT_RESOURCE_TYPE_EXTERNAL_LOCATION`, `DEPLOYMENT_RESOURCE_TYPE_JOB`, `DEPLOYMENT_RESOURCE_TYPE_MODEL`, `DEPLOYMENT_RESOURCE_TYPE_MODEL_SERVING_ENDPOINT`, `DEPLOYMENT_RESOURCE_TYPE_PIPELINE`, `DEPLOYMENT_RESOURCE_TYPE_POSTGRES_BRANCH`, `DEPLOYMENT_RESOURCE_TYPE_POSTGRES_ENDPOINT`, `DEPLOYMENT_RESOURCE_TYPE_POSTGRES_PROJECT`, `DEPLOYMENT_RESOURCE_TYPE_QUALITY_MONITOR`, `DEPLOYMENT_RESOURCE_TYPE_REGISTERED_MODEL`, `DEPLOYMENT_RESOURCE_TYPE_SCHEMA`, `DEPLOYMENT_RESOURCE_TYPE_SECRET_SCOPE`, `DEPLOYMENT_RESOURCE_TYPE_SQL_WAREHOUSE`, `DEPLOYMENT_RESOURCE_TYPE_SYNCED_DATABASE_TABLE`, `DEPLOYMENT_RESOURCE_TYPE_VOLUME`: + *f = DeploymentResourceType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DEPLOYMENT_RESOURCE_TYPE_ALERT", "DEPLOYMENT_RESOURCE_TYPE_APP", "DEPLOYMENT_RESOURCE_TYPE_CATALOG", "DEPLOYMENT_RESOURCE_TYPE_CLUSTER", "DEPLOYMENT_RESOURCE_TYPE_DASHBOARD", "DEPLOYMENT_RESOURCE_TYPE_DATABASE_CATALOG", "DEPLOYMENT_RESOURCE_TYPE_DATABASE_INSTANCE", "DEPLOYMENT_RESOURCE_TYPE_EXPERIMENT", "DEPLOYMENT_RESOURCE_TYPE_EXTERNAL_LOCATION", "DEPLOYMENT_RESOURCE_TYPE_JOB", "DEPLOYMENT_RESOURCE_TYPE_MODEL", "DEPLOYMENT_RESOURCE_TYPE_MODEL_SERVING_ENDPOINT", "DEPLOYMENT_RESOURCE_TYPE_PIPELINE", "DEPLOYMENT_RESOURCE_TYPE_POSTGRES_BRANCH", "DEPLOYMENT_RESOURCE_TYPE_POSTGRES_ENDPOINT", "DEPLOYMENT_RESOURCE_TYPE_POSTGRES_PROJECT", "DEPLOYMENT_RESOURCE_TYPE_QUALITY_MONITOR", "DEPLOYMENT_RESOURCE_TYPE_REGISTERED_MODEL", "DEPLOYMENT_RESOURCE_TYPE_SCHEMA", "DEPLOYMENT_RESOURCE_TYPE_SECRET_SCOPE", "DEPLOYMENT_RESOURCE_TYPE_SQL_WAREHOUSE", "DEPLOYMENT_RESOURCE_TYPE_SYNCED_DATABASE_TABLE", "DEPLOYMENT_RESOURCE_TYPE_VOLUME"`, v) + } +} + +// Values returns all possible values for DeploymentResourceType. +// +// There is no guarantee on the order of the values in the slice. +func (f *DeploymentResourceType) Values() []DeploymentResourceType { + return []DeploymentResourceType{ + DeploymentResourceTypeDeploymentResourceTypeAlert, + DeploymentResourceTypeDeploymentResourceTypeApp, + DeploymentResourceTypeDeploymentResourceTypeCatalog, + DeploymentResourceTypeDeploymentResourceTypeCluster, + DeploymentResourceTypeDeploymentResourceTypeDashboard, + DeploymentResourceTypeDeploymentResourceTypeDatabaseCatalog, + DeploymentResourceTypeDeploymentResourceTypeDatabaseInstance, + DeploymentResourceTypeDeploymentResourceTypeExperiment, + DeploymentResourceTypeDeploymentResourceTypeExternalLocation, + DeploymentResourceTypeDeploymentResourceTypeJob, + DeploymentResourceTypeDeploymentResourceTypeModel, + DeploymentResourceTypeDeploymentResourceTypeModelServingEndpoint, + DeploymentResourceTypeDeploymentResourceTypePipeline, + DeploymentResourceTypeDeploymentResourceTypePostgresBranch, + DeploymentResourceTypeDeploymentResourceTypePostgresEndpoint, + DeploymentResourceTypeDeploymentResourceTypePostgresProject, + DeploymentResourceTypeDeploymentResourceTypeQualityMonitor, + DeploymentResourceTypeDeploymentResourceTypeRegisteredModel, + DeploymentResourceTypeDeploymentResourceTypeSchema, + DeploymentResourceTypeDeploymentResourceTypeSecretScope, + DeploymentResourceTypeDeploymentResourceTypeSqlWarehouse, + DeploymentResourceTypeDeploymentResourceTypeSyncedDatabaseTable, + DeploymentResourceTypeDeploymentResourceTypeVolume, + } +} + +// Type always returns DeploymentResourceType to satisfy [pflag.Value] interface +func (f *DeploymentResourceType) Type() string { + return "DeploymentResourceType" +} + +// Status of a deployment. +type DeploymentStatus string + +const DeploymentStatusDeploymentStatusActive DeploymentStatus = `DEPLOYMENT_STATUS_ACTIVE` + +const DeploymentStatusDeploymentStatusDeleted DeploymentStatus = `DEPLOYMENT_STATUS_DELETED` + +const DeploymentStatusDeploymentStatusFailed DeploymentStatus = `DEPLOYMENT_STATUS_FAILED` + +const DeploymentStatusDeploymentStatusInProgress DeploymentStatus = `DEPLOYMENT_STATUS_IN_PROGRESS` + +// String representation for [fmt.Print] +func (f *DeploymentStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DeploymentStatus) Set(v string) error { + switch v { + case `DEPLOYMENT_STATUS_ACTIVE`, `DEPLOYMENT_STATUS_DELETED`, `DEPLOYMENT_STATUS_FAILED`, `DEPLOYMENT_STATUS_IN_PROGRESS`: + *f = DeploymentStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DEPLOYMENT_STATUS_ACTIVE", "DEPLOYMENT_STATUS_DELETED", "DEPLOYMENT_STATUS_FAILED", "DEPLOYMENT_STATUS_IN_PROGRESS"`, v) + } +} + +// Values returns all possible values for DeploymentStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *DeploymentStatus) Values() []DeploymentStatus { + return []DeploymentStatus{ + DeploymentStatusDeploymentStatusActive, + DeploymentStatusDeploymentStatusDeleted, + DeploymentStatusDeploymentStatusFailed, + DeploymentStatusDeploymentStatusInProgress, + } +} + +// Type always returns DeploymentStatus to satisfy [pflag.Value] interface +func (f *DeploymentStatus) Type() string { + return "DeploymentStatus" +} + +type GetDeploymentRequest struct { + // Resource name of the deployment to retrieve. Format: + // deployments/{deployment_id} + Name string `json:"-" url:"-"` +} + +type GetOperationRequest struct { + // The name of the resource operation to retrieve. Format: + // deployments/{deployment_id}/versions/{version_id}/operations/{resource_key} + Name string `json:"-" url:"-"` +} + +type GetResourceRequest struct { + // The name of the resource to retrieve. Format: + // deployments/{deployment_id}/resources/{resource_key} + Name string `json:"-" url:"-"` +} + +type GetVersionRequest struct { + // The name of the version to retrieve. Format: + // deployments/{deployment_id}/versions/{version_id} + Name string `json:"-" url:"-"` +} + +// A request to send a heartbeat for a Version. +type HeartbeatRequest struct { + // The version whose lock to renew. Format: + // deployments/{deployment_id}/versions/{version_id} + Name string `json:"-" url:"-"` +} + +// Response for Heartbeat. +type HeartbeatResponse struct { + // The new lock expiry time after renewal. + ExpireTime *time.Time `json:"expire_time,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *HeartbeatResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s HeartbeatResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListDeploymentsRequest struct { + // The maximum number of deployments to return. The service may return fewer + // than this value. If unspecified, at most 50 deployments will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous `ListDeployments` call. Provide + // this to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDeploymentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDeploymentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Response for ListDeployments. +type ListDeploymentsResponse struct { + // The deployments from the queried workspace. + Deployments []Deployment `json:"deployments,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDeploymentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDeploymentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListOperationsRequest struct { + // The maximum number of operations to return. The service may return fewer + // than this value. If unspecified, at most 50 operations will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous `ListOperations` call. Provide + // this to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + // The parent version. Format: + // deployments/{deployment_id}/versions/{version_id} + Parent string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListOperationsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListOperationsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Response for ListOperations. +type ListOperationsResponse struct { + // A token, which can be sent as `page_token` to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + // The resource operations under the specified version. + Operations []Operation `json:"operations,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListOperationsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListOperationsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListResourcesRequest struct { + // The maximum number of resources to return. The service may return fewer + // than this value. If unspecified, at most 50 resources will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous `ListResources` call. Provide this + // to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + // The parent deployment. Format: deployments/{deployment_id} + Parent string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListResourcesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListResourcesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Response for ListResources. +type ListResourcesResponse struct { + // A token, which can be sent as `page_token` to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + // The resources under the specified deployment. + Resources []Resource `json:"resources,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListResourcesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListResourcesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListVersionsRequest struct { + // The maximum number of versions to return. The service may return fewer + // than this value. If unspecified, at most 50 versions will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous `ListVersions` call. Provide this + // to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + // The parent deployment. Format: deployments/{deployment_id} + Parent string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListVersionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListVersionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Response for ListVersions. +type ListVersionsResponse struct { + // A token, which can be sent as `page_token` to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + // The versions under the specified deployment. + Versions []Version `json:"versions,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListVersionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListVersionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// An operation on a single resource performed during a version. Operations are +// append-only and record the result of applying a resource change to the +// workspace. +type Operation struct { + // The type of operation performed on this resource. + ActionType OperationActionType `json:"action_type,omitempty"` + // When the operation was recorded. + CreateTime *time.Time `json:"create_time,omitempty"` + // Error message if the operation failed. Set when status is + // OPERATION_STATUS_FAILED. Captures the error encountered while applying + // the resource to the workspace. + ErrorMessage string `json:"error_message,omitempty"` + // Resource name of the operation. Format: + // deployments/{deployment_id}/versions/{version_id}/operations/{resource_key} + Name string `json:"name,omitempty"` + // ID reference for the actual resource in the workspace (e.g. the job ID, + // pipeline ID). Should be unset for delete operations. + ResourceId string `json:"resource_id,omitempty"` + // Resource identifier within the bundle (e.g. "jobs.foo", "pipelines.bar", + // "jobs.foo.permissions", "files."). Can be an arbitrary UTF-8 + // encoded string key. This key links the operation to the corresponding + // deployment-level Resource. + ResourceKey string `json:"resource_key,omitempty"` + // Serialized local config state after the operation. Should be unset for + // delete operations. + State *json.RawMessage `json:"state,omitempty"` + // Whether the operation succeeded or failed. + Status OperationStatus `json:"status"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Operation) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Operation) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Type of action performed on a resource during a deployment. +type OperationActionType string + +const OperationActionTypeOperationActionTypeBind OperationActionType = `OPERATION_ACTION_TYPE_BIND` + +const OperationActionTypeOperationActionTypeBindAndUpdate OperationActionType = `OPERATION_ACTION_TYPE_BIND_AND_UPDATE` + +const OperationActionTypeOperationActionTypeCreate OperationActionType = `OPERATION_ACTION_TYPE_CREATE` + +const OperationActionTypeOperationActionTypeDelete OperationActionType = `OPERATION_ACTION_TYPE_DELETE` + +const OperationActionTypeOperationActionTypeInitialRegister OperationActionType = `OPERATION_ACTION_TYPE_INITIAL_REGISTER` + +const OperationActionTypeOperationActionTypeRecreate OperationActionType = `OPERATION_ACTION_TYPE_RECREATE` + +const OperationActionTypeOperationActionTypeResize OperationActionType = `OPERATION_ACTION_TYPE_RESIZE` + +const OperationActionTypeOperationActionTypeUpdate OperationActionType = `OPERATION_ACTION_TYPE_UPDATE` + +const OperationActionTypeOperationActionTypeUpdateWithId OperationActionType = `OPERATION_ACTION_TYPE_UPDATE_WITH_ID` + +// String representation for [fmt.Print] +func (f *OperationActionType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *OperationActionType) Set(v string) error { + switch v { + case `OPERATION_ACTION_TYPE_BIND`, `OPERATION_ACTION_TYPE_BIND_AND_UPDATE`, `OPERATION_ACTION_TYPE_CREATE`, `OPERATION_ACTION_TYPE_DELETE`, `OPERATION_ACTION_TYPE_INITIAL_REGISTER`, `OPERATION_ACTION_TYPE_RECREATE`, `OPERATION_ACTION_TYPE_RESIZE`, `OPERATION_ACTION_TYPE_UPDATE`, `OPERATION_ACTION_TYPE_UPDATE_WITH_ID`: + *f = OperationActionType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "OPERATION_ACTION_TYPE_BIND", "OPERATION_ACTION_TYPE_BIND_AND_UPDATE", "OPERATION_ACTION_TYPE_CREATE", "OPERATION_ACTION_TYPE_DELETE", "OPERATION_ACTION_TYPE_INITIAL_REGISTER", "OPERATION_ACTION_TYPE_RECREATE", "OPERATION_ACTION_TYPE_RESIZE", "OPERATION_ACTION_TYPE_UPDATE", "OPERATION_ACTION_TYPE_UPDATE_WITH_ID"`, v) + } +} + +// Values returns all possible values for OperationActionType. +// +// There is no guarantee on the order of the values in the slice. +func (f *OperationActionType) Values() []OperationActionType { + return []OperationActionType{ + OperationActionTypeOperationActionTypeBind, + OperationActionTypeOperationActionTypeBindAndUpdate, + OperationActionTypeOperationActionTypeCreate, + OperationActionTypeOperationActionTypeDelete, + OperationActionTypeOperationActionTypeInitialRegister, + OperationActionTypeOperationActionTypeRecreate, + OperationActionTypeOperationActionTypeResize, + OperationActionTypeOperationActionTypeUpdate, + OperationActionTypeOperationActionTypeUpdateWithId, + } +} + +// Type always returns OperationActionType to satisfy [pflag.Value] interface +func (f *OperationActionType) Type() string { + return "OperationActionType" +} + +// Status of a resource operation. +type OperationStatus string + +const OperationStatusOperationStatusFailed OperationStatus = `OPERATION_STATUS_FAILED` + +const OperationStatusOperationStatusSucceeded OperationStatus = `OPERATION_STATUS_SUCCEEDED` + +// String representation for [fmt.Print] +func (f *OperationStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *OperationStatus) Set(v string) error { + switch v { + case `OPERATION_STATUS_FAILED`, `OPERATION_STATUS_SUCCEEDED`: + *f = OperationStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "OPERATION_STATUS_FAILED", "OPERATION_STATUS_SUCCEEDED"`, v) + } +} + +// Values returns all possible values for OperationStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *OperationStatus) Values() []OperationStatus { + return []OperationStatus{ + OperationStatusOperationStatusFailed, + OperationStatusOperationStatusSucceeded, + } +} + +// Type always returns OperationStatus to satisfy [pflag.Value] interface +func (f *OperationStatus) Type() string { + return "OperationStatus" +} + +// A resource managed by a deployment. Resources are implicitly created, +// updated, or deleted when operations are recorded on a version. +type Resource struct { + // The action performed on this resource during the last version. + LastActionType OperationActionType `json:"last_action_type,omitempty"` + // The version_id of the last version where this resource was updated. + LastVersionId string `json:"last_version_id,omitempty"` + // Resource name. Format: + // deployments/{deployment_id}/resources/{resource_key} + Name string `json:"name,omitempty"` + // ID that references the actual resource in the workspace (e.g. the job ID, + // pipeline ID). + ResourceId string `json:"resource_id,omitempty"` + // Resource identifier within the bundle (e.g. "jobs.foo", "pipelines.bar", + // "jobs.foo.permissions"). + ResourceKey string `json:"resource_key,omitempty"` + // The type of the deployment resource. + ResourceType DeploymentResourceType `json:"resource_type"` + // Serialized local config state (what the CLI deployed). + State *json.RawMessage `json:"state,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Resource) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Resource) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// A single invocation of a deploy or destroy command against a deployment. +// Creating a version acquires an exclusive lock on the parent deployment. +type Version struct { + // CLI version used to initiate the version. + CliVersion string `json:"cli_version,omitempty"` + // When the version completed. Unset while the version is in progress. + CompleteTime *time.Time `json:"complete_time,omitempty"` + // The user who completed the version (email or principal name). May differ + // from `created_by` when another user force-completes the version. + CompletedBy string `json:"completed_by,omitempty"` + // Why the version was completed. Unset while in progress. Set when status + // transitions to COMPLETED. + CompletionReason VersionComplete `json:"completion_reason,omitempty"` + // When the version was created. + CreateTime *time.Time `json:"create_time,omitempty"` + // The user who created the version (email or principal name). + CreatedBy string `json:"created_by,omitempty"` + // Display name for the deployment, captured at the time of this version. + DisplayName string `json:"display_name,omitempty"` + // Resource name of the version. Format: + // deployments/{deployment_id}/versions/{version_id} + Name string `json:"name,omitempty"` + // Status of the version: IN_PROGRESS or COMPLETED. + Status VersionStatus `json:"status,omitempty"` + // Target name of the deployment, captured at the time of this version. + TargetName string `json:"target_name,omitempty"` + // Monotonically increasing version identifier within the parent deployment. + // Assigned by the client on creation. + VersionId string `json:"version_id,omitempty"` + // Type of version (deploy or destroy). + VersionType VersionType `json:"version_type"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Version) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Version) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Reason why a version was completed. +type VersionComplete string + +const VersionCompleteVersionCompleteFailure VersionComplete = `VERSION_COMPLETE_FAILURE` + +const VersionCompleteVersionCompleteForceAbort VersionComplete = `VERSION_COMPLETE_FORCE_ABORT` + +const VersionCompleteVersionCompleteLeaseExpired VersionComplete = `VERSION_COMPLETE_LEASE_EXPIRED` + +const VersionCompleteVersionCompleteSuccess VersionComplete = `VERSION_COMPLETE_SUCCESS` + +// String representation for [fmt.Print] +func (f *VersionComplete) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *VersionComplete) Set(v string) error { + switch v { + case `VERSION_COMPLETE_FAILURE`, `VERSION_COMPLETE_FORCE_ABORT`, `VERSION_COMPLETE_LEASE_EXPIRED`, `VERSION_COMPLETE_SUCCESS`: + *f = VersionComplete(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "VERSION_COMPLETE_FAILURE", "VERSION_COMPLETE_FORCE_ABORT", "VERSION_COMPLETE_LEASE_EXPIRED", "VERSION_COMPLETE_SUCCESS"`, v) + } +} + +// Values returns all possible values for VersionComplete. +// +// There is no guarantee on the order of the values in the slice. +func (f *VersionComplete) Values() []VersionComplete { + return []VersionComplete{ + VersionCompleteVersionCompleteFailure, + VersionCompleteVersionCompleteForceAbort, + VersionCompleteVersionCompleteLeaseExpired, + VersionCompleteVersionCompleteSuccess, + } +} + +// Type always returns VersionComplete to satisfy [pflag.Value] interface +func (f *VersionComplete) Type() string { + return "VersionComplete" +} + +// Status of a version. +type VersionStatus string + +const VersionStatusVersionStatusCompleted VersionStatus = `VERSION_STATUS_COMPLETED` + +const VersionStatusVersionStatusInProgress VersionStatus = `VERSION_STATUS_IN_PROGRESS` + +// String representation for [fmt.Print] +func (f *VersionStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *VersionStatus) Set(v string) error { + switch v { + case `VERSION_STATUS_COMPLETED`, `VERSION_STATUS_IN_PROGRESS`: + *f = VersionStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "VERSION_STATUS_COMPLETED", "VERSION_STATUS_IN_PROGRESS"`, v) + } +} + +// Values returns all possible values for VersionStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *VersionStatus) Values() []VersionStatus { + return []VersionStatus{ + VersionStatusVersionStatusCompleted, + VersionStatusVersionStatusInProgress, + } +} + +// Type always returns VersionStatus to satisfy [pflag.Value] interface +func (f *VersionStatus) Type() string { + return "VersionStatus" +} + +// Type of version. +type VersionType string + +const VersionTypeVersionTypeDeploy VersionType = `VERSION_TYPE_DEPLOY` + +const VersionTypeVersionTypeDestroy VersionType = `VERSION_TYPE_DESTROY` + +// String representation for [fmt.Print] +func (f *VersionType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *VersionType) Set(v string) error { + switch v { + case `VERSION_TYPE_DEPLOY`, `VERSION_TYPE_DESTROY`: + *f = VersionType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "VERSION_TYPE_DEPLOY", "VERSION_TYPE_DESTROY"`, v) + } +} + +// Values returns all possible values for VersionType. +// +// There is no guarantee on the order of the values in the slice. +func (f *VersionType) Values() []VersionType { + return []VersionType{ + VersionTypeVersionTypeDeploy, + VersionTypeVersionTypeDestroy, + } +} + +// Type always returns VersionType to satisfy [pflag.Value] interface +func (f *VersionType) Type() string { + return "VersionType" +} diff --git a/service/catalog/model.go b/service/catalog/model.go index 98833dcd7..8cc611cd9 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -7241,7 +7241,11 @@ func (s Securable) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Latest kind: CONNECTION_ONEDRIVE_OAUTH_U2M = 329; Next id: 330 +// Specific variant of a SecurableType: identifies the concrete implementation +// or backing system for a UC securable (e.g. CATALOG_STANDARD vs +// CATALOG_DELTASHARING; MEMORY_STORE_STANDARD for Conversations-backed memory +// stores). Used to dispatch type-specific handling in the entity model. Latest +// kind: MEMORY_STORE_STANDARD = 330; Next id: 331 type SecurableKind string const SecurableKindTableDbStorage SecurableKind = `TABLE_DB_STORAGE` diff --git a/service/ml/model.go b/service/ml/model.go index fc98ad1c3..6b0e75b71 100755 --- a/service/ml/model.go +++ b/service/ml/model.go @@ -313,6 +313,8 @@ func (s ApproxPercentileFunction) MarshalJSON() ([]byte, error) { } type AuthConfig struct { + // Mutual-TLS authentication. See MtlsConfig. + MtlsConfig *MtlsConfig `json:"mtls_config,omitempty"` // Name of the Unity Catalog service credential. This value will be set // under the option databricks.serviceCredential UcServiceCredentialName string `json:"uc_service_credential_name,omitempty"` @@ -3203,6 +3205,60 @@ func (s ModelVersionTag) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Mutual-TLS (mTLS) authentication configuration. The keystore (client +// certificate + private key) and truststore (CAs trusted to verify the broker) +// live as JKS files on Unity Catalog volumes, with their passwords stored in +// Databricks secret scopes. This matches the SSL setup pattern documented at +// https://docs.databricks.com/en/connect/streaming/kafka/authentication#use-ssl-to-connect-databricks-to-kafka. +// +// At materialization time, the generated PySpark code passes the JKS file paths +// and resolved passwords through to the Kafka SSL options +// (kafka.ssl.keystore.location, kafka.ssl.keystore.password, +// kafka.ssl.key.password, kafka.ssl.truststore.location, +// kafka.ssl.truststore.password). Passwords are resolved on the Spark cluster +// via dbutils.secrets.get; this message stores only references, never password +// values. +type MtlsConfig struct { + // Set to true only when the broker certificate's SAN intentionally does not + // match the connection endpoint — for example when reaching the cluster + // through a PrivateLink endpoint whose DNS name is not in the broker + // certificate. Skipping the hostname check removes a defense against + // man-in-the-middle attacks; do not enable casually. mTLS client + // authentication is unaffected by this option. + // + // See the Apache Kafka SSL security guide for background on this check: + // https://kafka.apache.org/42/security/encryption-and-authentication-using-ssl/#host-name-verification + DisableHostnameVerification bool `json:"disable_hostname_verification,omitempty"` + // Secret-scope reference for the private key password. Often the same value + // as the keystore password (keytool's default), but provided as a separate + // field because Apache Kafka requires it as a distinct option + // (kafka.ssl.key.password). + KeyPasswordRef SecretScopeReference `json:"key_password_ref"` + // Unity Catalog volume path to the JKS keystore file containing the client + // certificate and private key. e.g. + // "/Volumes////client.jks". The materialization + // compute must have read permission on this volume. + KeystoreLocation string `json:"keystore_location"` + // Secret-scope reference for the JKS keystore password. + KeystorePasswordRef SecretScopeReference `json:"keystore_password_ref"` + // Unity Catalog volume path to the JKS truststore file containing the CA + // certificate(s) trusted to verify the Kafka broker's server certificate. + // e.g. "/Volumes////truststore.jks". + TruststoreLocation string `json:"truststore_location"` + // Secret-scope reference for the JKS truststore password. + TruststorePasswordRef SecretScopeReference `json:"truststore_password_ref"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *MtlsConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s MtlsConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Configuration for offline store destination. type OfflineStoreConfig struct { // The Unity Catalog catalog name. @@ -4471,6 +4527,16 @@ func (s SearchRunsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Reference to an entry in a Databricks secret scope. The referenced value is +// fetched on the Spark cluster at materialization time via +// dbutils.secrets.get(scope, key). +type SecretScopeReference struct { + // The key within the scope. + Key string `json:"key"` + // The Databricks secret scope name. + Scope string `json:"scope"` +} + type SetExperimentTag struct { // ID of the experiment under which to log the tag. Must be provided. ExperimentId string `json:"experiment_id"` diff --git a/service/pkg.go b/service/pkg.go index a78d81c15..177759df8 100755 --- a/service/pkg.go +++ b/service/pkg.go @@ -32,6 +32,8 @@ // // - [billing.BudgetsAPI]: These APIs manage budget configurations for this account. // +// - [bundle.BundleAPI]: Service for managing bundle deployment metadata. +// // - [catalog.CatalogsAPI]: A catalog is the first layer of Unity Catalog’s three-level namespace. // // - [cleanrooms.CleanRoomAssetRevisionsAPI]: Clean Room Asset Revisions denote new versions of uploaded assets (e.g. @@ -377,6 +379,7 @@ import ( "github.com/databricks/databricks-sdk-go/service/agentbricks" "github.com/databricks/databricks-sdk-go/service/apps" "github.com/databricks/databricks-sdk-go/service/billing" + "github.com/databricks/databricks-sdk-go/service/bundle" "github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/cleanrooms" "github.com/databricks/databricks-sdk-go/service/compute" @@ -431,6 +434,7 @@ var ( _ *billing.BillableUsageAPI = nil _ *billing.BudgetPolicyAPI = nil _ *billing.BudgetsAPI = nil + _ *bundle.BundleAPI = nil _ *catalog.CatalogsAPI = nil _ *cleanrooms.CleanRoomAssetRevisionsAPI = nil _ *cleanrooms.CleanRoomAssetsAPI = nil diff --git a/workspace_client.go b/workspace_client.go index 0cdbec33e..b332050be 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -9,6 +9,7 @@ import ( "github.com/databricks/databricks-sdk-go/service/agentbricks" "github.com/databricks/databricks-sdk-go/service/apps" + "github.com/databricks/databricks-sdk-go/service/bundle" "github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/cleanrooms" "github.com/databricks/databricks-sdk-go/service/compute" @@ -94,6 +95,9 @@ type WorkspaceClient struct { // artifacts on compute configured with shared access mode. ArtifactAllowlists catalog.ArtifactAllowlistsInterface + // Service for managing bundle deployment metadata. + Bundle bundle.BundleInterface + // A catalog is the first layer of Unity Catalog’s three-level namespace. // It’s used to organize your data assets. Users can see all catalogs on // which they have been assigned the USE_CATALOG data permission. @@ -1455,6 +1459,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { Apps: apps.NewApps(databricksClient), AppsSettings: apps.NewAppsSettings(databricksClient), ArtifactAllowlists: catalog.NewArtifactAllowlists(databricksClient), + Bundle: bundle.NewBundle(databricksClient), Catalogs: catalog.NewCatalogs(databricksClient), CleanRoomAssetRevisions: cleanrooms.NewCleanRoomAssetRevisions(databricksClient), CleanRoomAssets: cleanrooms.NewCleanRoomAssets(databricksClient),