From bd87a7dd8ba932cf87828a46465bfcf0783c550d Mon Sep 17 00:00:00 2001 From: Tanmay Rustagi Date: Tue, 20 May 2025 16:29:15 +0200 Subject: [PATCH 1/2] [Internal] Update SDK to latest OpenAPI Spec --- .codegen/_openapi_sha | 2 +- NEXT_CHANGELOG.md | 18 + account_client.go | 21 + experimental/mocks/mock_account_client.go | 18 + experimental/mocks/mock_workspace_client.go | 9 + .../service/ml/mock_experiments_interface.go | 743 ++++++++++++++++++ .../mock_network_policies_interface.go | 477 +++++++++++ ...rkspace_network_configuration_interface.go | 214 +++++ ...recipient_federation_policies_interface.go | 538 +++++++++++++ service/apps/model.go | 62 ++ service/catalog/impl.go | 2 - service/catalog/model.go | 42 +- service/cleanrooms/model.go | 90 +++ service/compute/api.go | 6 +- service/compute/interface.go | 5 +- service/compute/model.go | 30 +- service/iam/api.go | 10 +- service/iam/interface.go | 10 +- service/iam/model.go | 61 +- service/jobs/model.go | 6 +- service/ml/api.go | 95 +++ service/ml/impl.go | 106 +++ service/ml/interface.go | 47 ++ service/ml/model.go | 378 +++++++++ service/pipelines/model.go | 12 + service/pkg.go | 17 +- service/settings/api.go | 180 ++++- service/settings/impl.go | 118 +++ service/settings/interface.go | 75 +- service/settings/model.go | 338 ++++++++ service/sharing/api.go | 154 +++- service/sharing/impl.go | 100 +++ service/sharing/interface.go | 78 ++ service/sharing/model.go | 165 ++++ service/sql/model.go | 29 + workspace_client.go | 32 +- 36 files changed, 4205 insertions(+), 83 deletions(-) create mode 100644 experimental/mocks/service/settings/mock_network_policies_interface.go create mode 100644 experimental/mocks/service/settings/mock_workspace_network_configuration_interface.go create mode 100644 experimental/mocks/service/sharing/mock_recipient_federation_policies_interface.go diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 864d90a5f..a31772880 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -6b2dbf5489ec706709fed80ee65caed7d10a2f38 \ No newline at end of file +6b835c53b0f2394f1586c12894ffc8dd4ed042cc \ No newline at end of file diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 9683a9fb6..e7638e945 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -11,3 +11,21 @@ ### Internal Changes ### API Changes +* Added [a.NetworkPolicies](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#NetworkPoliciesAPI) account-level service and [a.WorkspaceNetworkConfiguration](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#WorkspaceNetworkConfigurationAPI) account-level service. +* Added [w.RecipientFederationPolicies](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#RecipientFederationPoliciesAPI) workspace-level service. +* Added `CreateLoggedModel`, `DeleteLoggedModel`, `DeleteLoggedModelTag`, `FinalizeLoggedModel`, `GetLoggedModel`, `ListLoggedModelArtifacts`, `LogLoggedModelParams`, `LogOutputs`, `SearchLoggedModels` and `SetLoggedModelTags` methods for [w.Experiments](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/ml#ExperimentsAPI) workspace-level service. +* Added `UcSecurable` field for [apps.AppResource](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#AppResource). +* Added `TimeseriesColumns` field for [catalog.PrimaryKeyConstraint](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#PrimaryKeyConstraint). +* Added `ReviewState`, `Reviews` and `RunnerCollaboratorAliases` fields for [cleanrooms.CleanRoomAssetNotebook](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/cleanrooms#CleanRoomAssetNotebook). +* Added `NotebookEtag` and `NotebookUpdatedAt` fields for [cleanrooms.CleanRoomNotebookTaskRun](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/cleanrooms#CleanRoomNotebookTaskRun). +* Added `RootPath` field for [pipelines.CreatePipeline](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#CreatePipeline). +* Added `RootPath` field for [pipelines.EditPipeline](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#EditPipeline). +* Added `RootPath` field for [pipelines.PipelineSpec](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#PipelineSpec). +* Added `MaterializationNamespace` field for [sharing.Table](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#Table). +* Added `OmitPermissionsList` field for [sharing.UpdateSharePermissions](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#UpdateSharePermissions). +* Added `AutoResolveDisplayName` field for [sql.UpdateAlertRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#UpdateAlertRequest). +* Added `AutoResolveDisplayName` field for [sql.UpdateQueryRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#UpdateQueryRequest). +* Added `InternalCatalog`, `ManagedOnlineCatalog` and `UnknownCatalogType` enum values for [catalog.CatalogType](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#CatalogType). +* Added `Catalog`, `CleanRoom`, `Connection`, `Credential`, `ExternalLocation`, `ExternalMetadata`, `Function`, `Metastore`, `Pipeline`, `Provider`, `Recipient`, `Schema`, `Share`, `StagingTable`, `StorageCredential`, `Table`, `UnknownSecurableType` and `Volume` enum values for [catalog.SecurableType](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#SecurableType). +* [Breaking] Changed `SecurableType` field for [catalog.CatalogInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#CatalogInfo) to type [catalog.SecurableType](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#SecurableType). +* Changed `Etag` and `Name` fields for [iam.RuleSetResponse](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/iam#RuleSetResponse) to be required. diff --git a/account_client.go b/account_client.go index d431b9dd1..8e2420860 100755 --- a/account_client.go +++ b/account_client.go @@ -234,6 +234,16 @@ type AccountClient struct { // [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security NetworkConnectivity settings.NetworkConnectivityInterface + // These APIs manage network policies for this account. Network policies + // control which network destinations can be accessed from the Databricks + // environment. Each Databricks account includes a default policy named + // 'default-policy'. 'default-policy' is associated with any workspace + // lacking an explicit network policy assignment, and is automatically + // associated with each newly created workspace. 'default-policy' is + // reserved and cannot be deleted, but it can be updated to customize the + // default network access rules for your account. + NetworkPolicies settings.NetworkPoliciesInterface + // These APIs manage network configurations for customer-managed VPCs // (optional). Its ID is used when creating a new workspace if you use // customer-managed VPCs. @@ -376,6 +386,15 @@ type AccountClient struct { // permissions for principals in your account. WorkspaceAssignment iam.WorkspaceAssignmentInterface + // These APIs allow configuration of network settings for Databricks + // workspaces. Each workspace is always associated with exactly one network + // policy that controls which network destinations can be accessed from the + // Databricks environment. By default, workspaces are associated with the + // 'default-policy' network policy. You cannot create or delete a + // workspace's network configuration, only update it to associate the + // workspace with a different policy. + WorkspaceNetworkConfiguration settings.WorkspaceNetworkConfigurationInterface + // These APIs manage workspaces for this account. A Databricks workspace is // an environment for accessing all of your Databricks assets. The workspace // organizes objects (notebooks, libraries, and experiments) into folders, @@ -435,6 +454,7 @@ func NewAccountClient(c ...*Config) (*AccountClient, error) { MetastoreAssignments: catalog.NewAccountMetastoreAssignments(apiClient), Metastores: catalog.NewAccountMetastores(apiClient), NetworkConnectivity: settings.NewNetworkConnectivity(apiClient), + NetworkPolicies: settings.NewNetworkPolicies(apiClient), Networks: provisioning.NewNetworks(apiClient), OAuthPublishedApps: oauth2.NewOAuthPublishedApps(apiClient), PrivateAccess: provisioning.NewPrivateAccess(apiClient), @@ -449,6 +469,7 @@ func NewAccountClient(c ...*Config) (*AccountClient, error) { Users: iam.NewAccountUsers(apiClient), VpcEndpoints: provisioning.NewVpcEndpoints(apiClient), WorkspaceAssignment: iam.NewWorkspaceAssignment(apiClient), + WorkspaceNetworkConfiguration: settings.NewWorkspaceNetworkConfiguration(apiClient), Workspaces: provisioning.NewWorkspaces(apiClient), Budgets: billing.NewBudgets(apiClient), }, nil diff --git a/experimental/mocks/mock_account_client.go b/experimental/mocks/mock_account_client.go index eb604c67e..4fe986b31 100755 --- a/experimental/mocks/mock_account_client.go +++ b/experimental/mocks/mock_account_client.go @@ -43,6 +43,7 @@ func NewMockAccountClient(t interface { MetastoreAssignments: catalog.NewMockAccountMetastoreAssignmentsInterface(t), Metastores: catalog.NewMockAccountMetastoresInterface(t), NetworkConnectivity: settings.NewMockNetworkConnectivityInterface(t), + NetworkPolicies: settings.NewMockNetworkPoliciesInterface(t), Networks: provisioning.NewMockNetworksInterface(t), OAuthPublishedApps: oauth2.NewMockOAuthPublishedAppsInterface(t), PrivateAccess: provisioning.NewMockPrivateAccessInterface(t), @@ -57,6 +58,7 @@ func NewMockAccountClient(t interface { Users: iam.NewMockAccountUsersInterface(t), VpcEndpoints: provisioning.NewMockVpcEndpointsInterface(t), WorkspaceAssignment: iam.NewMockWorkspaceAssignmentInterface(t), + WorkspaceNetworkConfiguration: settings.NewMockWorkspaceNetworkConfigurationInterface(t), Workspaces: provisioning.NewMockWorkspacesInterface(t), Budgets: billing.NewMockBudgetsInterface(t), }, @@ -248,6 +250,14 @@ func (m *MockAccountClient) GetMockNetworkConnectivityAPI() *settings.MockNetwor return api } +func (m *MockAccountClient) GetMockNetworkPoliciesAPI() *settings.MockNetworkPoliciesInterface { + api, ok := m.AccountClient.NetworkPolicies.(*settings.MockNetworkPoliciesInterface) + if !ok { + panic(fmt.Sprintf("expected NetworkPolicies to be *settings.MockNetworkPoliciesInterface, actual was %T", m.AccountClient.NetworkPolicies)) + } + return api +} + func (m *MockAccountClient) GetMockNetworksAPI() *provisioning.MockNetworksInterface { api, ok := m.AccountClient.Networks.(*provisioning.MockNetworksInterface) if !ok { @@ -360,6 +370,14 @@ func (m *MockAccountClient) GetMockWorkspaceAssignmentAPI() *iam.MockWorkspaceAs return api } +func (m *MockAccountClient) GetMockWorkspaceNetworkConfigurationAPI() *settings.MockWorkspaceNetworkConfigurationInterface { + api, ok := m.AccountClient.WorkspaceNetworkConfiguration.(*settings.MockWorkspaceNetworkConfigurationInterface) + if !ok { + panic(fmt.Sprintf("expected WorkspaceNetworkConfiguration to be *settings.MockWorkspaceNetworkConfigurationInterface, actual was %T", m.AccountClient.WorkspaceNetworkConfiguration)) + } + return api +} + func (m *MockAccountClient) GetMockWorkspacesAPI() *provisioning.MockWorkspacesInterface { api, ok := m.AccountClient.Workspaces.(*provisioning.MockWorkspacesInterface) if !ok { diff --git a/experimental/mocks/mock_workspace_client.go b/experimental/mocks/mock_workspace_client.go index 9cec59ca3..a4ba1626b 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -113,6 +113,7 @@ func NewMockWorkspaceClient(t interface { QueryVisualizations: sql.NewMockQueryVisualizationsInterface(t), QueryVisualizationsLegacy: sql.NewMockQueryVisualizationsLegacyInterface(t), RecipientActivation: sharing.NewMockRecipientActivationInterface(t), + RecipientFederationPolicies: sharing.NewMockRecipientFederationPoliciesInterface(t), Recipients: sharing.NewMockRecipientsInterface(t), RedashConfig: sql.NewMockRedashConfigInterface(t), RegisteredModels: catalog.NewMockRegisteredModelsInterface(t), @@ -869,6 +870,14 @@ func (m *MockWorkspaceClient) GetMockRecipientActivationAPI() *sharing.MockRecip return api } +func (m *MockWorkspaceClient) GetMockRecipientFederationPoliciesAPI() *sharing.MockRecipientFederationPoliciesInterface { + api, ok := m.WorkspaceClient.RecipientFederationPolicies.(*sharing.MockRecipientFederationPoliciesInterface) + if !ok { + panic(fmt.Sprintf("expected RecipientFederationPolicies to be *sharing.MockRecipientFederationPoliciesInterface, actual was %T", m.WorkspaceClient.RecipientFederationPolicies)) + } + return api +} + func (m *MockWorkspaceClient) GetMockRecipientsAPI() *sharing.MockRecipientsInterface { api, ok := m.WorkspaceClient.Recipients.(*sharing.MockRecipientsInterface) if !ok { diff --git a/experimental/mocks/service/ml/mock_experiments_interface.go b/experimental/mocks/service/ml/mock_experiments_interface.go index 7a7226309..29ec45751 100644 --- a/experimental/mocks/service/ml/mock_experiments_interface.go +++ b/experimental/mocks/service/ml/mock_experiments_interface.go @@ -83,6 +83,65 @@ func (_c *MockExperimentsInterface_CreateExperiment_Call) RunAndReturn(run func( return _c } +// CreateLoggedModel provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) CreateLoggedModel(ctx context.Context, request ml.CreateLoggedModelRequest) (*ml.CreateLoggedModelResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateLoggedModel") + } + + var r0 *ml.CreateLoggedModelResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.CreateLoggedModelRequest) (*ml.CreateLoggedModelResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.CreateLoggedModelRequest) *ml.CreateLoggedModelResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.CreateLoggedModelResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.CreateLoggedModelRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExperimentsInterface_CreateLoggedModel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateLoggedModel' +type MockExperimentsInterface_CreateLoggedModel_Call struct { + *mock.Call +} + +// CreateLoggedModel is a helper method to define mock.On call +// - ctx context.Context +// - request ml.CreateLoggedModelRequest +func (_e *MockExperimentsInterface_Expecter) CreateLoggedModel(ctx interface{}, request interface{}) *MockExperimentsInterface_CreateLoggedModel_Call { + return &MockExperimentsInterface_CreateLoggedModel_Call{Call: _e.mock.On("CreateLoggedModel", ctx, request)} +} + +func (_c *MockExperimentsInterface_CreateLoggedModel_Call) Run(run func(ctx context.Context, request ml.CreateLoggedModelRequest)) *MockExperimentsInterface_CreateLoggedModel_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.CreateLoggedModelRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_CreateLoggedModel_Call) Return(_a0 *ml.CreateLoggedModelResponse, _a1 error) *MockExperimentsInterface_CreateLoggedModel_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExperimentsInterface_CreateLoggedModel_Call) RunAndReturn(run func(context.Context, ml.CreateLoggedModelRequest) (*ml.CreateLoggedModelResponse, error)) *MockExperimentsInterface_CreateLoggedModel_Call { + _c.Call.Return(run) + return _c +} + // CreateRun provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) CreateRun(ctx context.Context, request ml.CreateRun) (*ml.CreateRunResponse, error) { ret := _m.Called(ctx, request) @@ -189,6 +248,195 @@ func (_c *MockExperimentsInterface_DeleteExperiment_Call) RunAndReturn(run func( return _c } +// DeleteLoggedModel provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) DeleteLoggedModel(ctx context.Context, request ml.DeleteLoggedModelRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteLoggedModel") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, ml.DeleteLoggedModelRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockExperimentsInterface_DeleteLoggedModel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteLoggedModel' +type MockExperimentsInterface_DeleteLoggedModel_Call struct { + *mock.Call +} + +// DeleteLoggedModel is a helper method to define mock.On call +// - ctx context.Context +// - request ml.DeleteLoggedModelRequest +func (_e *MockExperimentsInterface_Expecter) DeleteLoggedModel(ctx interface{}, request interface{}) *MockExperimentsInterface_DeleteLoggedModel_Call { + return &MockExperimentsInterface_DeleteLoggedModel_Call{Call: _e.mock.On("DeleteLoggedModel", ctx, request)} +} + +func (_c *MockExperimentsInterface_DeleteLoggedModel_Call) Run(run func(ctx context.Context, request ml.DeleteLoggedModelRequest)) *MockExperimentsInterface_DeleteLoggedModel_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.DeleteLoggedModelRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_DeleteLoggedModel_Call) Return(_a0 error) *MockExperimentsInterface_DeleteLoggedModel_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockExperimentsInterface_DeleteLoggedModel_Call) RunAndReturn(run func(context.Context, ml.DeleteLoggedModelRequest) error) *MockExperimentsInterface_DeleteLoggedModel_Call { + _c.Call.Return(run) + return _c +} + +// DeleteLoggedModelByModelId provides a mock function with given fields: ctx, modelId +func (_m *MockExperimentsInterface) DeleteLoggedModelByModelId(ctx context.Context, modelId string) error { + ret := _m.Called(ctx, modelId) + + if len(ret) == 0 { + panic("no return value specified for DeleteLoggedModelByModelId") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, modelId) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockExperimentsInterface_DeleteLoggedModelByModelId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteLoggedModelByModelId' +type MockExperimentsInterface_DeleteLoggedModelByModelId_Call struct { + *mock.Call +} + +// DeleteLoggedModelByModelId is a helper method to define mock.On call +// - ctx context.Context +// - modelId string +func (_e *MockExperimentsInterface_Expecter) DeleteLoggedModelByModelId(ctx interface{}, modelId interface{}) *MockExperimentsInterface_DeleteLoggedModelByModelId_Call { + return &MockExperimentsInterface_DeleteLoggedModelByModelId_Call{Call: _e.mock.On("DeleteLoggedModelByModelId", ctx, modelId)} +} + +func (_c *MockExperimentsInterface_DeleteLoggedModelByModelId_Call) Run(run func(ctx context.Context, modelId string)) *MockExperimentsInterface_DeleteLoggedModelByModelId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockExperimentsInterface_DeleteLoggedModelByModelId_Call) Return(_a0 error) *MockExperimentsInterface_DeleteLoggedModelByModelId_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockExperimentsInterface_DeleteLoggedModelByModelId_Call) RunAndReturn(run func(context.Context, string) error) *MockExperimentsInterface_DeleteLoggedModelByModelId_Call { + _c.Call.Return(run) + return _c +} + +// DeleteLoggedModelTag provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) DeleteLoggedModelTag(ctx context.Context, request ml.DeleteLoggedModelTagRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteLoggedModelTag") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, ml.DeleteLoggedModelTagRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockExperimentsInterface_DeleteLoggedModelTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteLoggedModelTag' +type MockExperimentsInterface_DeleteLoggedModelTag_Call struct { + *mock.Call +} + +// DeleteLoggedModelTag is a helper method to define mock.On call +// - ctx context.Context +// - request ml.DeleteLoggedModelTagRequest +func (_e *MockExperimentsInterface_Expecter) DeleteLoggedModelTag(ctx interface{}, request interface{}) *MockExperimentsInterface_DeleteLoggedModelTag_Call { + return &MockExperimentsInterface_DeleteLoggedModelTag_Call{Call: _e.mock.On("DeleteLoggedModelTag", ctx, request)} +} + +func (_c *MockExperimentsInterface_DeleteLoggedModelTag_Call) Run(run func(ctx context.Context, request ml.DeleteLoggedModelTagRequest)) *MockExperimentsInterface_DeleteLoggedModelTag_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.DeleteLoggedModelTagRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_DeleteLoggedModelTag_Call) Return(_a0 error) *MockExperimentsInterface_DeleteLoggedModelTag_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockExperimentsInterface_DeleteLoggedModelTag_Call) RunAndReturn(run func(context.Context, ml.DeleteLoggedModelTagRequest) error) *MockExperimentsInterface_DeleteLoggedModelTag_Call { + _c.Call.Return(run) + return _c +} + +// DeleteLoggedModelTagByModelIdAndTagKey provides a mock function with given fields: ctx, modelId, tagKey +func (_m *MockExperimentsInterface) DeleteLoggedModelTagByModelIdAndTagKey(ctx context.Context, modelId string, tagKey string) error { + ret := _m.Called(ctx, modelId, tagKey) + + if len(ret) == 0 { + panic("no return value specified for DeleteLoggedModelTagByModelIdAndTagKey") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { + r0 = rf(ctx, modelId, tagKey) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockExperimentsInterface_DeleteLoggedModelTagByModelIdAndTagKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteLoggedModelTagByModelIdAndTagKey' +type MockExperimentsInterface_DeleteLoggedModelTagByModelIdAndTagKey_Call struct { + *mock.Call +} + +// DeleteLoggedModelTagByModelIdAndTagKey is a helper method to define mock.On call +// - ctx context.Context +// - modelId string +// - tagKey string +func (_e *MockExperimentsInterface_Expecter) DeleteLoggedModelTagByModelIdAndTagKey(ctx interface{}, modelId interface{}, tagKey interface{}) *MockExperimentsInterface_DeleteLoggedModelTagByModelIdAndTagKey_Call { + return &MockExperimentsInterface_DeleteLoggedModelTagByModelIdAndTagKey_Call{Call: _e.mock.On("DeleteLoggedModelTagByModelIdAndTagKey", ctx, modelId, tagKey)} +} + +func (_c *MockExperimentsInterface_DeleteLoggedModelTagByModelIdAndTagKey_Call) Run(run func(ctx context.Context, modelId string, tagKey string)) *MockExperimentsInterface_DeleteLoggedModelTagByModelIdAndTagKey_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockExperimentsInterface_DeleteLoggedModelTagByModelIdAndTagKey_Call) Return(_a0 error) *MockExperimentsInterface_DeleteLoggedModelTagByModelIdAndTagKey_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockExperimentsInterface_DeleteLoggedModelTagByModelIdAndTagKey_Call) RunAndReturn(run func(context.Context, string, string) error) *MockExperimentsInterface_DeleteLoggedModelTagByModelIdAndTagKey_Call { + _c.Call.Return(run) + return _c +} + // DeleteRun provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) DeleteRun(ctx context.Context, request ml.DeleteRun) error { ret := _m.Called(ctx, request) @@ -342,6 +590,65 @@ func (_c *MockExperimentsInterface_DeleteTag_Call) RunAndReturn(run func(context return _c } +// FinalizeLoggedModel provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) FinalizeLoggedModel(ctx context.Context, request ml.FinalizeLoggedModelRequest) (*ml.FinalizeLoggedModelResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for FinalizeLoggedModel") + } + + var r0 *ml.FinalizeLoggedModelResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.FinalizeLoggedModelRequest) (*ml.FinalizeLoggedModelResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.FinalizeLoggedModelRequest) *ml.FinalizeLoggedModelResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.FinalizeLoggedModelResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.FinalizeLoggedModelRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExperimentsInterface_FinalizeLoggedModel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FinalizeLoggedModel' +type MockExperimentsInterface_FinalizeLoggedModel_Call struct { + *mock.Call +} + +// FinalizeLoggedModel is a helper method to define mock.On call +// - ctx context.Context +// - request ml.FinalizeLoggedModelRequest +func (_e *MockExperimentsInterface_Expecter) FinalizeLoggedModel(ctx interface{}, request interface{}) *MockExperimentsInterface_FinalizeLoggedModel_Call { + return &MockExperimentsInterface_FinalizeLoggedModel_Call{Call: _e.mock.On("FinalizeLoggedModel", ctx, request)} +} + +func (_c *MockExperimentsInterface_FinalizeLoggedModel_Call) Run(run func(ctx context.Context, request ml.FinalizeLoggedModelRequest)) *MockExperimentsInterface_FinalizeLoggedModel_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.FinalizeLoggedModelRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_FinalizeLoggedModel_Call) Return(_a0 *ml.FinalizeLoggedModelResponse, _a1 error) *MockExperimentsInterface_FinalizeLoggedModel_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExperimentsInterface_FinalizeLoggedModel_Call) RunAndReturn(run func(context.Context, ml.FinalizeLoggedModelRequest) (*ml.FinalizeLoggedModelResponse, error)) *MockExperimentsInterface_FinalizeLoggedModel_Call { + _c.Call.Return(run) + return _c +} + // GetByName provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) GetByName(ctx context.Context, request ml.GetByNameRequest) (*ml.GetExperimentByNameResponse, error) { ret := _m.Called(ctx, request) @@ -804,6 +1111,124 @@ func (_c *MockExperimentsInterface_GetHistoryAll_Call) RunAndReturn(run func(con return _c } +// GetLoggedModel provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) GetLoggedModel(ctx context.Context, request ml.GetLoggedModelRequest) (*ml.GetLoggedModelResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetLoggedModel") + } + + var r0 *ml.GetLoggedModelResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.GetLoggedModelRequest) (*ml.GetLoggedModelResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.GetLoggedModelRequest) *ml.GetLoggedModelResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.GetLoggedModelResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.GetLoggedModelRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExperimentsInterface_GetLoggedModel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLoggedModel' +type MockExperimentsInterface_GetLoggedModel_Call struct { + *mock.Call +} + +// GetLoggedModel is a helper method to define mock.On call +// - ctx context.Context +// - request ml.GetLoggedModelRequest +func (_e *MockExperimentsInterface_Expecter) GetLoggedModel(ctx interface{}, request interface{}) *MockExperimentsInterface_GetLoggedModel_Call { + return &MockExperimentsInterface_GetLoggedModel_Call{Call: _e.mock.On("GetLoggedModel", ctx, request)} +} + +func (_c *MockExperimentsInterface_GetLoggedModel_Call) Run(run func(ctx context.Context, request ml.GetLoggedModelRequest)) *MockExperimentsInterface_GetLoggedModel_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.GetLoggedModelRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_GetLoggedModel_Call) Return(_a0 *ml.GetLoggedModelResponse, _a1 error) *MockExperimentsInterface_GetLoggedModel_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExperimentsInterface_GetLoggedModel_Call) RunAndReturn(run func(context.Context, ml.GetLoggedModelRequest) (*ml.GetLoggedModelResponse, error)) *MockExperimentsInterface_GetLoggedModel_Call { + _c.Call.Return(run) + return _c +} + +// GetLoggedModelByModelId provides a mock function with given fields: ctx, modelId +func (_m *MockExperimentsInterface) GetLoggedModelByModelId(ctx context.Context, modelId string) (*ml.GetLoggedModelResponse, error) { + ret := _m.Called(ctx, modelId) + + if len(ret) == 0 { + panic("no return value specified for GetLoggedModelByModelId") + } + + var r0 *ml.GetLoggedModelResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*ml.GetLoggedModelResponse, error)); ok { + return rf(ctx, modelId) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *ml.GetLoggedModelResponse); ok { + r0 = rf(ctx, modelId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.GetLoggedModelResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, modelId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExperimentsInterface_GetLoggedModelByModelId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLoggedModelByModelId' +type MockExperimentsInterface_GetLoggedModelByModelId_Call struct { + *mock.Call +} + +// GetLoggedModelByModelId is a helper method to define mock.On call +// - ctx context.Context +// - modelId string +func (_e *MockExperimentsInterface_Expecter) GetLoggedModelByModelId(ctx interface{}, modelId interface{}) *MockExperimentsInterface_GetLoggedModelByModelId_Call { + return &MockExperimentsInterface_GetLoggedModelByModelId_Call{Call: _e.mock.On("GetLoggedModelByModelId", ctx, modelId)} +} + +func (_c *MockExperimentsInterface_GetLoggedModelByModelId_Call) Run(run func(ctx context.Context, modelId string)) *MockExperimentsInterface_GetLoggedModelByModelId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockExperimentsInterface_GetLoggedModelByModelId_Call) Return(_a0 *ml.GetLoggedModelResponse, _a1 error) *MockExperimentsInterface_GetLoggedModelByModelId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExperimentsInterface_GetLoggedModelByModelId_Call) RunAndReturn(run func(context.Context, string) (*ml.GetLoggedModelResponse, error)) *MockExperimentsInterface_GetLoggedModelByModelId_Call { + _c.Call.Return(run) + return _c +} + // GetPermissionLevels provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) GetPermissionLevels(ctx context.Context, request ml.GetExperimentPermissionLevelsRequest) (*ml.GetExperimentPermissionLevelsResponse, error) { ret := _m.Called(ctx, request) @@ -1315,6 +1740,124 @@ func (_c *MockExperimentsInterface_ListExperimentsAll_Call) RunAndReturn(run fun return _c } +// ListLoggedModelArtifacts provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) ListLoggedModelArtifacts(ctx context.Context, request ml.ListLoggedModelArtifactsRequest) (*ml.ListLoggedModelArtifactsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListLoggedModelArtifacts") + } + + var r0 *ml.ListLoggedModelArtifactsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.ListLoggedModelArtifactsRequest) (*ml.ListLoggedModelArtifactsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.ListLoggedModelArtifactsRequest) *ml.ListLoggedModelArtifactsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.ListLoggedModelArtifactsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.ListLoggedModelArtifactsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExperimentsInterface_ListLoggedModelArtifacts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListLoggedModelArtifacts' +type MockExperimentsInterface_ListLoggedModelArtifacts_Call struct { + *mock.Call +} + +// ListLoggedModelArtifacts is a helper method to define mock.On call +// - ctx context.Context +// - request ml.ListLoggedModelArtifactsRequest +func (_e *MockExperimentsInterface_Expecter) ListLoggedModelArtifacts(ctx interface{}, request interface{}) *MockExperimentsInterface_ListLoggedModelArtifacts_Call { + return &MockExperimentsInterface_ListLoggedModelArtifacts_Call{Call: _e.mock.On("ListLoggedModelArtifacts", ctx, request)} +} + +func (_c *MockExperimentsInterface_ListLoggedModelArtifacts_Call) Run(run func(ctx context.Context, request ml.ListLoggedModelArtifactsRequest)) *MockExperimentsInterface_ListLoggedModelArtifacts_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.ListLoggedModelArtifactsRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_ListLoggedModelArtifacts_Call) Return(_a0 *ml.ListLoggedModelArtifactsResponse, _a1 error) *MockExperimentsInterface_ListLoggedModelArtifacts_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExperimentsInterface_ListLoggedModelArtifacts_Call) RunAndReturn(run func(context.Context, ml.ListLoggedModelArtifactsRequest) (*ml.ListLoggedModelArtifactsResponse, error)) *MockExperimentsInterface_ListLoggedModelArtifacts_Call { + _c.Call.Return(run) + return _c +} + +// ListLoggedModelArtifactsByModelId provides a mock function with given fields: ctx, modelId +func (_m *MockExperimentsInterface) ListLoggedModelArtifactsByModelId(ctx context.Context, modelId string) (*ml.ListLoggedModelArtifactsResponse, error) { + ret := _m.Called(ctx, modelId) + + if len(ret) == 0 { + panic("no return value specified for ListLoggedModelArtifactsByModelId") + } + + var r0 *ml.ListLoggedModelArtifactsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*ml.ListLoggedModelArtifactsResponse, error)); ok { + return rf(ctx, modelId) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *ml.ListLoggedModelArtifactsResponse); ok { + r0 = rf(ctx, modelId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.ListLoggedModelArtifactsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, modelId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExperimentsInterface_ListLoggedModelArtifactsByModelId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListLoggedModelArtifactsByModelId' +type MockExperimentsInterface_ListLoggedModelArtifactsByModelId_Call struct { + *mock.Call +} + +// ListLoggedModelArtifactsByModelId is a helper method to define mock.On call +// - ctx context.Context +// - modelId string +func (_e *MockExperimentsInterface_Expecter) ListLoggedModelArtifactsByModelId(ctx interface{}, modelId interface{}) *MockExperimentsInterface_ListLoggedModelArtifactsByModelId_Call { + return &MockExperimentsInterface_ListLoggedModelArtifactsByModelId_Call{Call: _e.mock.On("ListLoggedModelArtifactsByModelId", ctx, modelId)} +} + +func (_c *MockExperimentsInterface_ListLoggedModelArtifactsByModelId_Call) Run(run func(ctx context.Context, modelId string)) *MockExperimentsInterface_ListLoggedModelArtifactsByModelId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockExperimentsInterface_ListLoggedModelArtifactsByModelId_Call) Return(_a0 *ml.ListLoggedModelArtifactsResponse, _a1 error) *MockExperimentsInterface_ListLoggedModelArtifactsByModelId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExperimentsInterface_ListLoggedModelArtifactsByModelId_Call) RunAndReturn(run func(context.Context, string) (*ml.ListLoggedModelArtifactsResponse, error)) *MockExperimentsInterface_ListLoggedModelArtifactsByModelId_Call { + _c.Call.Return(run) + return _c +} + // LogBatch provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) LogBatch(ctx context.Context, request ml.LogBatch) error { ret := _m.Called(ctx, request) @@ -1409,6 +1952,53 @@ func (_c *MockExperimentsInterface_LogInputs_Call) RunAndReturn(run func(context return _c } +// LogLoggedModelParams provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) LogLoggedModelParams(ctx context.Context, request ml.LogLoggedModelParamsRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for LogLoggedModelParams") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, ml.LogLoggedModelParamsRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockExperimentsInterface_LogLoggedModelParams_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LogLoggedModelParams' +type MockExperimentsInterface_LogLoggedModelParams_Call struct { + *mock.Call +} + +// LogLoggedModelParams is a helper method to define mock.On call +// - ctx context.Context +// - request ml.LogLoggedModelParamsRequest +func (_e *MockExperimentsInterface_Expecter) LogLoggedModelParams(ctx interface{}, request interface{}) *MockExperimentsInterface_LogLoggedModelParams_Call { + return &MockExperimentsInterface_LogLoggedModelParams_Call{Call: _e.mock.On("LogLoggedModelParams", ctx, request)} +} + +func (_c *MockExperimentsInterface_LogLoggedModelParams_Call) Run(run func(ctx context.Context, request ml.LogLoggedModelParamsRequest)) *MockExperimentsInterface_LogLoggedModelParams_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.LogLoggedModelParamsRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_LogLoggedModelParams_Call) Return(_a0 error) *MockExperimentsInterface_LogLoggedModelParams_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockExperimentsInterface_LogLoggedModelParams_Call) RunAndReturn(run func(context.Context, ml.LogLoggedModelParamsRequest) error) *MockExperimentsInterface_LogLoggedModelParams_Call { + _c.Call.Return(run) + return _c +} + // LogMetric provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) LogMetric(ctx context.Context, request ml.LogMetric) error { ret := _m.Called(ctx, request) @@ -1503,6 +2093,53 @@ func (_c *MockExperimentsInterface_LogModel_Call) RunAndReturn(run func(context. return _c } +// LogOutputs provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) LogOutputs(ctx context.Context, request ml.LogOutputsRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for LogOutputs") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, ml.LogOutputsRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockExperimentsInterface_LogOutputs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LogOutputs' +type MockExperimentsInterface_LogOutputs_Call struct { + *mock.Call +} + +// LogOutputs is a helper method to define mock.On call +// - ctx context.Context +// - request ml.LogOutputsRequest +func (_e *MockExperimentsInterface_Expecter) LogOutputs(ctx interface{}, request interface{}) *MockExperimentsInterface_LogOutputs_Call { + return &MockExperimentsInterface_LogOutputs_Call{Call: _e.mock.On("LogOutputs", ctx, request)} +} + +func (_c *MockExperimentsInterface_LogOutputs_Call) Run(run func(ctx context.Context, request ml.LogOutputsRequest)) *MockExperimentsInterface_LogOutputs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.LogOutputsRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_LogOutputs_Call) Return(_a0 error) *MockExperimentsInterface_LogOutputs_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockExperimentsInterface_LogOutputs_Call) RunAndReturn(run func(context.Context, ml.LogOutputsRequest) error) *MockExperimentsInterface_LogOutputs_Call { + _c.Call.Return(run) + return _c +} + // LogParam provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) LogParam(ctx context.Context, request ml.LogParam) error { ret := _m.Called(ctx, request) @@ -1811,6 +2448,65 @@ func (_c *MockExperimentsInterface_SearchExperimentsAll_Call) RunAndReturn(run f return _c } +// SearchLoggedModels provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) SearchLoggedModels(ctx context.Context, request ml.SearchLoggedModelsRequest) (*ml.SearchLoggedModelsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for SearchLoggedModels") + } + + var r0 *ml.SearchLoggedModelsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.SearchLoggedModelsRequest) (*ml.SearchLoggedModelsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.SearchLoggedModelsRequest) *ml.SearchLoggedModelsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.SearchLoggedModelsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.SearchLoggedModelsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExperimentsInterface_SearchLoggedModels_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SearchLoggedModels' +type MockExperimentsInterface_SearchLoggedModels_Call struct { + *mock.Call +} + +// SearchLoggedModels is a helper method to define mock.On call +// - ctx context.Context +// - request ml.SearchLoggedModelsRequest +func (_e *MockExperimentsInterface_Expecter) SearchLoggedModels(ctx interface{}, request interface{}) *MockExperimentsInterface_SearchLoggedModels_Call { + return &MockExperimentsInterface_SearchLoggedModels_Call{Call: _e.mock.On("SearchLoggedModels", ctx, request)} +} + +func (_c *MockExperimentsInterface_SearchLoggedModels_Call) Run(run func(ctx context.Context, request ml.SearchLoggedModelsRequest)) *MockExperimentsInterface_SearchLoggedModels_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.SearchLoggedModelsRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_SearchLoggedModels_Call) Return(_a0 *ml.SearchLoggedModelsResponse, _a1 error) *MockExperimentsInterface_SearchLoggedModels_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExperimentsInterface_SearchLoggedModels_Call) RunAndReturn(run func(context.Context, ml.SearchLoggedModelsRequest) (*ml.SearchLoggedModelsResponse, error)) *MockExperimentsInterface_SearchLoggedModels_Call { + _c.Call.Return(run) + return _c +} + // SearchRuns provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) SearchRuns(ctx context.Context, request ml.SearchRuns) listing.Iterator[ml.Run] { ret := _m.Called(ctx, request) @@ -1966,6 +2662,53 @@ func (_c *MockExperimentsInterface_SetExperimentTag_Call) RunAndReturn(run func( return _c } +// SetLoggedModelTags provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) SetLoggedModelTags(ctx context.Context, request ml.SetLoggedModelTagsRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for SetLoggedModelTags") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, ml.SetLoggedModelTagsRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockExperimentsInterface_SetLoggedModelTags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLoggedModelTags' +type MockExperimentsInterface_SetLoggedModelTags_Call struct { + *mock.Call +} + +// SetLoggedModelTags is a helper method to define mock.On call +// - ctx context.Context +// - request ml.SetLoggedModelTagsRequest +func (_e *MockExperimentsInterface_Expecter) SetLoggedModelTags(ctx interface{}, request interface{}) *MockExperimentsInterface_SetLoggedModelTags_Call { + return &MockExperimentsInterface_SetLoggedModelTags_Call{Call: _e.mock.On("SetLoggedModelTags", ctx, request)} +} + +func (_c *MockExperimentsInterface_SetLoggedModelTags_Call) Run(run func(ctx context.Context, request ml.SetLoggedModelTagsRequest)) *MockExperimentsInterface_SetLoggedModelTags_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.SetLoggedModelTagsRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_SetLoggedModelTags_Call) Return(_a0 error) *MockExperimentsInterface_SetLoggedModelTags_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockExperimentsInterface_SetLoggedModelTags_Call) RunAndReturn(run func(context.Context, ml.SetLoggedModelTagsRequest) error) *MockExperimentsInterface_SetLoggedModelTags_Call { + _c.Call.Return(run) + return _c +} + // SetPermissions provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) SetPermissions(ctx context.Context, request ml.ExperimentPermissionsRequest) (*ml.ExperimentPermissions, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/settings/mock_network_policies_interface.go b/experimental/mocks/service/settings/mock_network_policies_interface.go new file mode 100644 index 000000000..513c90a5c --- /dev/null +++ b/experimental/mocks/service/settings/mock_network_policies_interface.go @@ -0,0 +1,477 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package settings + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + settings "github.com/databricks/databricks-sdk-go/service/settings" +) + +// MockNetworkPoliciesInterface is an autogenerated mock type for the NetworkPoliciesInterface type +type MockNetworkPoliciesInterface struct { + mock.Mock +} + +type MockNetworkPoliciesInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockNetworkPoliciesInterface) EXPECT() *MockNetworkPoliciesInterface_Expecter { + return &MockNetworkPoliciesInterface_Expecter{mock: &_m.Mock} +} + +// CreateNetworkPolicyRpc provides a mock function with given fields: ctx, request +func (_m *MockNetworkPoliciesInterface) CreateNetworkPolicyRpc(ctx context.Context, request settings.CreateNetworkPolicyRequest) (*settings.AccountNetworkPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateNetworkPolicyRpc") + } + + var r0 *settings.AccountNetworkPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.CreateNetworkPolicyRequest) (*settings.AccountNetworkPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.CreateNetworkPolicyRequest) *settings.AccountNetworkPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.AccountNetworkPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.CreateNetworkPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNetworkPoliciesInterface_CreateNetworkPolicyRpc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateNetworkPolicyRpc' +type MockNetworkPoliciesInterface_CreateNetworkPolicyRpc_Call struct { + *mock.Call +} + +// CreateNetworkPolicyRpc is a helper method to define mock.On call +// - ctx context.Context +// - request settings.CreateNetworkPolicyRequest +func (_e *MockNetworkPoliciesInterface_Expecter) CreateNetworkPolicyRpc(ctx interface{}, request interface{}) *MockNetworkPoliciesInterface_CreateNetworkPolicyRpc_Call { + return &MockNetworkPoliciesInterface_CreateNetworkPolicyRpc_Call{Call: _e.mock.On("CreateNetworkPolicyRpc", ctx, request)} +} + +func (_c *MockNetworkPoliciesInterface_CreateNetworkPolicyRpc_Call) Run(run func(ctx context.Context, request settings.CreateNetworkPolicyRequest)) *MockNetworkPoliciesInterface_CreateNetworkPolicyRpc_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.CreateNetworkPolicyRequest)) + }) + return _c +} + +func (_c *MockNetworkPoliciesInterface_CreateNetworkPolicyRpc_Call) Return(_a0 *settings.AccountNetworkPolicy, _a1 error) *MockNetworkPoliciesInterface_CreateNetworkPolicyRpc_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNetworkPoliciesInterface_CreateNetworkPolicyRpc_Call) RunAndReturn(run func(context.Context, settings.CreateNetworkPolicyRequest) (*settings.AccountNetworkPolicy, error)) *MockNetworkPoliciesInterface_CreateNetworkPolicyRpc_Call { + _c.Call.Return(run) + return _c +} + +// DeleteNetworkPolicyRpc provides a mock function with given fields: ctx, request +func (_m *MockNetworkPoliciesInterface) DeleteNetworkPolicyRpc(ctx context.Context, request settings.DeleteNetworkPolicyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteNetworkPolicyRpc") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteNetworkPolicyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockNetworkPoliciesInterface_DeleteNetworkPolicyRpc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteNetworkPolicyRpc' +type MockNetworkPoliciesInterface_DeleteNetworkPolicyRpc_Call struct { + *mock.Call +} + +// DeleteNetworkPolicyRpc is a helper method to define mock.On call +// - ctx context.Context +// - request settings.DeleteNetworkPolicyRequest +func (_e *MockNetworkPoliciesInterface_Expecter) DeleteNetworkPolicyRpc(ctx interface{}, request interface{}) *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpc_Call { + return &MockNetworkPoliciesInterface_DeleteNetworkPolicyRpc_Call{Call: _e.mock.On("DeleteNetworkPolicyRpc", ctx, request)} +} + +func (_c *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpc_Call) Run(run func(ctx context.Context, request settings.DeleteNetworkPolicyRequest)) *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpc_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.DeleteNetworkPolicyRequest)) + }) + return _c +} + +func (_c *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpc_Call) Return(_a0 error) *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpc_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpc_Call) RunAndReturn(run func(context.Context, settings.DeleteNetworkPolicyRequest) error) *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpc_Call { + _c.Call.Return(run) + return _c +} + +// DeleteNetworkPolicyRpcByNetworkPolicyId provides a mock function with given fields: ctx, networkPolicyId +func (_m *MockNetworkPoliciesInterface) DeleteNetworkPolicyRpcByNetworkPolicyId(ctx context.Context, networkPolicyId string) error { + ret := _m.Called(ctx, networkPolicyId) + + if len(ret) == 0 { + panic("no return value specified for DeleteNetworkPolicyRpcByNetworkPolicyId") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, networkPolicyId) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockNetworkPoliciesInterface_DeleteNetworkPolicyRpcByNetworkPolicyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteNetworkPolicyRpcByNetworkPolicyId' +type MockNetworkPoliciesInterface_DeleteNetworkPolicyRpcByNetworkPolicyId_Call struct { + *mock.Call +} + +// DeleteNetworkPolicyRpcByNetworkPolicyId is a helper method to define mock.On call +// - ctx context.Context +// - networkPolicyId string +func (_e *MockNetworkPoliciesInterface_Expecter) DeleteNetworkPolicyRpcByNetworkPolicyId(ctx interface{}, networkPolicyId interface{}) *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpcByNetworkPolicyId_Call { + return &MockNetworkPoliciesInterface_DeleteNetworkPolicyRpcByNetworkPolicyId_Call{Call: _e.mock.On("DeleteNetworkPolicyRpcByNetworkPolicyId", ctx, networkPolicyId)} +} + +func (_c *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpcByNetworkPolicyId_Call) Run(run func(ctx context.Context, networkPolicyId string)) *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpcByNetworkPolicyId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpcByNetworkPolicyId_Call) Return(_a0 error) *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpcByNetworkPolicyId_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpcByNetworkPolicyId_Call) RunAndReturn(run func(context.Context, string) error) *MockNetworkPoliciesInterface_DeleteNetworkPolicyRpcByNetworkPolicyId_Call { + _c.Call.Return(run) + return _c +} + +// GetNetworkPolicyRpc provides a mock function with given fields: ctx, request +func (_m *MockNetworkPoliciesInterface) GetNetworkPolicyRpc(ctx context.Context, request settings.GetNetworkPolicyRequest) (*settings.AccountNetworkPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetNetworkPolicyRpc") + } + + var r0 *settings.AccountNetworkPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetNetworkPolicyRequest) (*settings.AccountNetworkPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetNetworkPolicyRequest) *settings.AccountNetworkPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.AccountNetworkPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetNetworkPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNetworkPoliciesInterface_GetNetworkPolicyRpc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNetworkPolicyRpc' +type MockNetworkPoliciesInterface_GetNetworkPolicyRpc_Call struct { + *mock.Call +} + +// GetNetworkPolicyRpc is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetNetworkPolicyRequest +func (_e *MockNetworkPoliciesInterface_Expecter) GetNetworkPolicyRpc(ctx interface{}, request interface{}) *MockNetworkPoliciesInterface_GetNetworkPolicyRpc_Call { + return &MockNetworkPoliciesInterface_GetNetworkPolicyRpc_Call{Call: _e.mock.On("GetNetworkPolicyRpc", ctx, request)} +} + +func (_c *MockNetworkPoliciesInterface_GetNetworkPolicyRpc_Call) Run(run func(ctx context.Context, request settings.GetNetworkPolicyRequest)) *MockNetworkPoliciesInterface_GetNetworkPolicyRpc_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetNetworkPolicyRequest)) + }) + return _c +} + +func (_c *MockNetworkPoliciesInterface_GetNetworkPolicyRpc_Call) Return(_a0 *settings.AccountNetworkPolicy, _a1 error) *MockNetworkPoliciesInterface_GetNetworkPolicyRpc_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNetworkPoliciesInterface_GetNetworkPolicyRpc_Call) RunAndReturn(run func(context.Context, settings.GetNetworkPolicyRequest) (*settings.AccountNetworkPolicy, error)) *MockNetworkPoliciesInterface_GetNetworkPolicyRpc_Call { + _c.Call.Return(run) + return _c +} + +// GetNetworkPolicyRpcByNetworkPolicyId provides a mock function with given fields: ctx, networkPolicyId +func (_m *MockNetworkPoliciesInterface) GetNetworkPolicyRpcByNetworkPolicyId(ctx context.Context, networkPolicyId string) (*settings.AccountNetworkPolicy, error) { + ret := _m.Called(ctx, networkPolicyId) + + if len(ret) == 0 { + panic("no return value specified for GetNetworkPolicyRpcByNetworkPolicyId") + } + + var r0 *settings.AccountNetworkPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*settings.AccountNetworkPolicy, error)); ok { + return rf(ctx, networkPolicyId) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *settings.AccountNetworkPolicy); ok { + r0 = rf(ctx, networkPolicyId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.AccountNetworkPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, networkPolicyId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNetworkPoliciesInterface_GetNetworkPolicyRpcByNetworkPolicyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNetworkPolicyRpcByNetworkPolicyId' +type MockNetworkPoliciesInterface_GetNetworkPolicyRpcByNetworkPolicyId_Call struct { + *mock.Call +} + +// GetNetworkPolicyRpcByNetworkPolicyId is a helper method to define mock.On call +// - ctx context.Context +// - networkPolicyId string +func (_e *MockNetworkPoliciesInterface_Expecter) GetNetworkPolicyRpcByNetworkPolicyId(ctx interface{}, networkPolicyId interface{}) *MockNetworkPoliciesInterface_GetNetworkPolicyRpcByNetworkPolicyId_Call { + return &MockNetworkPoliciesInterface_GetNetworkPolicyRpcByNetworkPolicyId_Call{Call: _e.mock.On("GetNetworkPolicyRpcByNetworkPolicyId", ctx, networkPolicyId)} +} + +func (_c *MockNetworkPoliciesInterface_GetNetworkPolicyRpcByNetworkPolicyId_Call) Run(run func(ctx context.Context, networkPolicyId string)) *MockNetworkPoliciesInterface_GetNetworkPolicyRpcByNetworkPolicyId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockNetworkPoliciesInterface_GetNetworkPolicyRpcByNetworkPolicyId_Call) Return(_a0 *settings.AccountNetworkPolicy, _a1 error) *MockNetworkPoliciesInterface_GetNetworkPolicyRpcByNetworkPolicyId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNetworkPoliciesInterface_GetNetworkPolicyRpcByNetworkPolicyId_Call) RunAndReturn(run func(context.Context, string) (*settings.AccountNetworkPolicy, error)) *MockNetworkPoliciesInterface_GetNetworkPolicyRpcByNetworkPolicyId_Call { + _c.Call.Return(run) + return _c +} + +// ListNetworkPoliciesRpc provides a mock function with given fields: ctx, request +func (_m *MockNetworkPoliciesInterface) ListNetworkPoliciesRpc(ctx context.Context, request settings.ListNetworkPoliciesRequest) listing.Iterator[settings.AccountNetworkPolicy] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListNetworkPoliciesRpc") + } + + var r0 listing.Iterator[settings.AccountNetworkPolicy] + if rf, ok := ret.Get(0).(func(context.Context, settings.ListNetworkPoliciesRequest) listing.Iterator[settings.AccountNetworkPolicy]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[settings.AccountNetworkPolicy]) + } + } + + return r0 +} + +// MockNetworkPoliciesInterface_ListNetworkPoliciesRpc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListNetworkPoliciesRpc' +type MockNetworkPoliciesInterface_ListNetworkPoliciesRpc_Call struct { + *mock.Call +} + +// ListNetworkPoliciesRpc is a helper method to define mock.On call +// - ctx context.Context +// - request settings.ListNetworkPoliciesRequest +func (_e *MockNetworkPoliciesInterface_Expecter) ListNetworkPoliciesRpc(ctx interface{}, request interface{}) *MockNetworkPoliciesInterface_ListNetworkPoliciesRpc_Call { + return &MockNetworkPoliciesInterface_ListNetworkPoliciesRpc_Call{Call: _e.mock.On("ListNetworkPoliciesRpc", ctx, request)} +} + +func (_c *MockNetworkPoliciesInterface_ListNetworkPoliciesRpc_Call) Run(run func(ctx context.Context, request settings.ListNetworkPoliciesRequest)) *MockNetworkPoliciesInterface_ListNetworkPoliciesRpc_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.ListNetworkPoliciesRequest)) + }) + return _c +} + +func (_c *MockNetworkPoliciesInterface_ListNetworkPoliciesRpc_Call) Return(_a0 listing.Iterator[settings.AccountNetworkPolicy]) *MockNetworkPoliciesInterface_ListNetworkPoliciesRpc_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockNetworkPoliciesInterface_ListNetworkPoliciesRpc_Call) RunAndReturn(run func(context.Context, settings.ListNetworkPoliciesRequest) listing.Iterator[settings.AccountNetworkPolicy]) *MockNetworkPoliciesInterface_ListNetworkPoliciesRpc_Call { + _c.Call.Return(run) + return _c +} + +// ListNetworkPoliciesRpcAll provides a mock function with given fields: ctx, request +func (_m *MockNetworkPoliciesInterface) ListNetworkPoliciesRpcAll(ctx context.Context, request settings.ListNetworkPoliciesRequest) ([]settings.AccountNetworkPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListNetworkPoliciesRpcAll") + } + + var r0 []settings.AccountNetworkPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.ListNetworkPoliciesRequest) ([]settings.AccountNetworkPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.ListNetworkPoliciesRequest) []settings.AccountNetworkPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]settings.AccountNetworkPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.ListNetworkPoliciesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNetworkPoliciesInterface_ListNetworkPoliciesRpcAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListNetworkPoliciesRpcAll' +type MockNetworkPoliciesInterface_ListNetworkPoliciesRpcAll_Call struct { + *mock.Call +} + +// ListNetworkPoliciesRpcAll is a helper method to define mock.On call +// - ctx context.Context +// - request settings.ListNetworkPoliciesRequest +func (_e *MockNetworkPoliciesInterface_Expecter) ListNetworkPoliciesRpcAll(ctx interface{}, request interface{}) *MockNetworkPoliciesInterface_ListNetworkPoliciesRpcAll_Call { + return &MockNetworkPoliciesInterface_ListNetworkPoliciesRpcAll_Call{Call: _e.mock.On("ListNetworkPoliciesRpcAll", ctx, request)} +} + +func (_c *MockNetworkPoliciesInterface_ListNetworkPoliciesRpcAll_Call) Run(run func(ctx context.Context, request settings.ListNetworkPoliciesRequest)) *MockNetworkPoliciesInterface_ListNetworkPoliciesRpcAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.ListNetworkPoliciesRequest)) + }) + return _c +} + +func (_c *MockNetworkPoliciesInterface_ListNetworkPoliciesRpcAll_Call) Return(_a0 []settings.AccountNetworkPolicy, _a1 error) *MockNetworkPoliciesInterface_ListNetworkPoliciesRpcAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNetworkPoliciesInterface_ListNetworkPoliciesRpcAll_Call) RunAndReturn(run func(context.Context, settings.ListNetworkPoliciesRequest) ([]settings.AccountNetworkPolicy, error)) *MockNetworkPoliciesInterface_ListNetworkPoliciesRpcAll_Call { + _c.Call.Return(run) + return _c +} + +// UpdateNetworkPolicyRpc provides a mock function with given fields: ctx, request +func (_m *MockNetworkPoliciesInterface) UpdateNetworkPolicyRpc(ctx context.Context, request settings.UpdateNetworkPolicyRequest) (*settings.AccountNetworkPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateNetworkPolicyRpc") + } + + var r0 *settings.AccountNetworkPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateNetworkPolicyRequest) (*settings.AccountNetworkPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateNetworkPolicyRequest) *settings.AccountNetworkPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.AccountNetworkPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateNetworkPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNetworkPoliciesInterface_UpdateNetworkPolicyRpc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateNetworkPolicyRpc' +type MockNetworkPoliciesInterface_UpdateNetworkPolicyRpc_Call struct { + *mock.Call +} + +// UpdateNetworkPolicyRpc is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdateNetworkPolicyRequest +func (_e *MockNetworkPoliciesInterface_Expecter) UpdateNetworkPolicyRpc(ctx interface{}, request interface{}) *MockNetworkPoliciesInterface_UpdateNetworkPolicyRpc_Call { + return &MockNetworkPoliciesInterface_UpdateNetworkPolicyRpc_Call{Call: _e.mock.On("UpdateNetworkPolicyRpc", ctx, request)} +} + +func (_c *MockNetworkPoliciesInterface_UpdateNetworkPolicyRpc_Call) Run(run func(ctx context.Context, request settings.UpdateNetworkPolicyRequest)) *MockNetworkPoliciesInterface_UpdateNetworkPolicyRpc_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdateNetworkPolicyRequest)) + }) + return _c +} + +func (_c *MockNetworkPoliciesInterface_UpdateNetworkPolicyRpc_Call) Return(_a0 *settings.AccountNetworkPolicy, _a1 error) *MockNetworkPoliciesInterface_UpdateNetworkPolicyRpc_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNetworkPoliciesInterface_UpdateNetworkPolicyRpc_Call) RunAndReturn(run func(context.Context, settings.UpdateNetworkPolicyRequest) (*settings.AccountNetworkPolicy, error)) *MockNetworkPoliciesInterface_UpdateNetworkPolicyRpc_Call { + _c.Call.Return(run) + return _c +} + +// NewMockNetworkPoliciesInterface creates a new instance of MockNetworkPoliciesInterface. 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 NewMockNetworkPoliciesInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockNetworkPoliciesInterface { + mock := &MockNetworkPoliciesInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settings/mock_workspace_network_configuration_interface.go b/experimental/mocks/service/settings/mock_workspace_network_configuration_interface.go new file mode 100644 index 000000000..eea4528dd --- /dev/null +++ b/experimental/mocks/service/settings/mock_workspace_network_configuration_interface.go @@ -0,0 +1,214 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package settings + +import ( + context "context" + + settings "github.com/databricks/databricks-sdk-go/service/settings" + mock "github.com/stretchr/testify/mock" +) + +// MockWorkspaceNetworkConfigurationInterface is an autogenerated mock type for the WorkspaceNetworkConfigurationInterface type +type MockWorkspaceNetworkConfigurationInterface struct { + mock.Mock +} + +type MockWorkspaceNetworkConfigurationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockWorkspaceNetworkConfigurationInterface) EXPECT() *MockWorkspaceNetworkConfigurationInterface_Expecter { + return &MockWorkspaceNetworkConfigurationInterface_Expecter{mock: &_m.Mock} +} + +// GetWorkspaceNetworkOptionRpc provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceNetworkConfigurationInterface) GetWorkspaceNetworkOptionRpc(ctx context.Context, request settings.GetWorkspaceNetworkOptionRequest) (*settings.WorkspaceNetworkOption, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetWorkspaceNetworkOptionRpc") + } + + var r0 *settings.WorkspaceNetworkOption + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetWorkspaceNetworkOptionRequest) (*settings.WorkspaceNetworkOption, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetWorkspaceNetworkOptionRequest) *settings.WorkspaceNetworkOption); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.WorkspaceNetworkOption) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetWorkspaceNetworkOptionRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceNetworkOptionRpc' +type MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpc_Call struct { + *mock.Call +} + +// GetWorkspaceNetworkOptionRpc is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetWorkspaceNetworkOptionRequest +func (_e *MockWorkspaceNetworkConfigurationInterface_Expecter) GetWorkspaceNetworkOptionRpc(ctx interface{}, request interface{}) *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpc_Call { + return &MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpc_Call{Call: _e.mock.On("GetWorkspaceNetworkOptionRpc", ctx, request)} +} + +func (_c *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpc_Call) Run(run func(ctx context.Context, request settings.GetWorkspaceNetworkOptionRequest)) *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpc_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetWorkspaceNetworkOptionRequest)) + }) + return _c +} + +func (_c *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpc_Call) Return(_a0 *settings.WorkspaceNetworkOption, _a1 error) *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpc_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpc_Call) RunAndReturn(run func(context.Context, settings.GetWorkspaceNetworkOptionRequest) (*settings.WorkspaceNetworkOption, error)) *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpc_Call { + _c.Call.Return(run) + return _c +} + +// GetWorkspaceNetworkOptionRpcByWorkspaceId provides a mock function with given fields: ctx, workspaceId +func (_m *MockWorkspaceNetworkConfigurationInterface) GetWorkspaceNetworkOptionRpcByWorkspaceId(ctx context.Context, workspaceId int64) (*settings.WorkspaceNetworkOption, error) { + ret := _m.Called(ctx, workspaceId) + + if len(ret) == 0 { + panic("no return value specified for GetWorkspaceNetworkOptionRpcByWorkspaceId") + } + + var r0 *settings.WorkspaceNetworkOption + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, int64) (*settings.WorkspaceNetworkOption, error)); ok { + return rf(ctx, workspaceId) + } + if rf, ok := ret.Get(0).(func(context.Context, int64) *settings.WorkspaceNetworkOption); ok { + r0 = rf(ctx, workspaceId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.WorkspaceNetworkOption) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { + r1 = rf(ctx, workspaceId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpcByWorkspaceId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceNetworkOptionRpcByWorkspaceId' +type MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpcByWorkspaceId_Call struct { + *mock.Call +} + +// GetWorkspaceNetworkOptionRpcByWorkspaceId is a helper method to define mock.On call +// - ctx context.Context +// - workspaceId int64 +func (_e *MockWorkspaceNetworkConfigurationInterface_Expecter) GetWorkspaceNetworkOptionRpcByWorkspaceId(ctx interface{}, workspaceId interface{}) *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpcByWorkspaceId_Call { + return &MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpcByWorkspaceId_Call{Call: _e.mock.On("GetWorkspaceNetworkOptionRpcByWorkspaceId", ctx, workspaceId)} +} + +func (_c *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpcByWorkspaceId_Call) Run(run func(ctx context.Context, workspaceId int64)) *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpcByWorkspaceId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(int64)) + }) + return _c +} + +func (_c *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpcByWorkspaceId_Call) Return(_a0 *settings.WorkspaceNetworkOption, _a1 error) *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpcByWorkspaceId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpcByWorkspaceId_Call) RunAndReturn(run func(context.Context, int64) (*settings.WorkspaceNetworkOption, error)) *MockWorkspaceNetworkConfigurationInterface_GetWorkspaceNetworkOptionRpcByWorkspaceId_Call { + _c.Call.Return(run) + return _c +} + +// UpdateWorkspaceNetworkOptionRpc provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceNetworkConfigurationInterface) UpdateWorkspaceNetworkOptionRpc(ctx context.Context, request settings.UpdateWorkspaceNetworkOptionRequest) (*settings.WorkspaceNetworkOption, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateWorkspaceNetworkOptionRpc") + } + + var r0 *settings.WorkspaceNetworkOption + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateWorkspaceNetworkOptionRequest) (*settings.WorkspaceNetworkOption, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateWorkspaceNetworkOptionRequest) *settings.WorkspaceNetworkOption); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.WorkspaceNetworkOption) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateWorkspaceNetworkOptionRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceNetworkConfigurationInterface_UpdateWorkspaceNetworkOptionRpc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateWorkspaceNetworkOptionRpc' +type MockWorkspaceNetworkConfigurationInterface_UpdateWorkspaceNetworkOptionRpc_Call struct { + *mock.Call +} + +// UpdateWorkspaceNetworkOptionRpc is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdateWorkspaceNetworkOptionRequest +func (_e *MockWorkspaceNetworkConfigurationInterface_Expecter) UpdateWorkspaceNetworkOptionRpc(ctx interface{}, request interface{}) *MockWorkspaceNetworkConfigurationInterface_UpdateWorkspaceNetworkOptionRpc_Call { + return &MockWorkspaceNetworkConfigurationInterface_UpdateWorkspaceNetworkOptionRpc_Call{Call: _e.mock.On("UpdateWorkspaceNetworkOptionRpc", ctx, request)} +} + +func (_c *MockWorkspaceNetworkConfigurationInterface_UpdateWorkspaceNetworkOptionRpc_Call) Run(run func(ctx context.Context, request settings.UpdateWorkspaceNetworkOptionRequest)) *MockWorkspaceNetworkConfigurationInterface_UpdateWorkspaceNetworkOptionRpc_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdateWorkspaceNetworkOptionRequest)) + }) + return _c +} + +func (_c *MockWorkspaceNetworkConfigurationInterface_UpdateWorkspaceNetworkOptionRpc_Call) Return(_a0 *settings.WorkspaceNetworkOption, _a1 error) *MockWorkspaceNetworkConfigurationInterface_UpdateWorkspaceNetworkOptionRpc_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceNetworkConfigurationInterface_UpdateWorkspaceNetworkOptionRpc_Call) RunAndReturn(run func(context.Context, settings.UpdateWorkspaceNetworkOptionRequest) (*settings.WorkspaceNetworkOption, error)) *MockWorkspaceNetworkConfigurationInterface_UpdateWorkspaceNetworkOptionRpc_Call { + _c.Call.Return(run) + return _c +} + +// NewMockWorkspaceNetworkConfigurationInterface creates a new instance of MockWorkspaceNetworkConfigurationInterface. 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 NewMockWorkspaceNetworkConfigurationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockWorkspaceNetworkConfigurationInterface { + mock := &MockWorkspaceNetworkConfigurationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/sharing/mock_recipient_federation_policies_interface.go b/experimental/mocks/service/sharing/mock_recipient_federation_policies_interface.go new file mode 100644 index 000000000..878c069bf --- /dev/null +++ b/experimental/mocks/service/sharing/mock_recipient_federation_policies_interface.go @@ -0,0 +1,538 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package sharing + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + sharing "github.com/databricks/databricks-sdk-go/service/sharing" +) + +// MockRecipientFederationPoliciesInterface is an autogenerated mock type for the RecipientFederationPoliciesInterface type +type MockRecipientFederationPoliciesInterface struct { + mock.Mock +} + +type MockRecipientFederationPoliciesInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockRecipientFederationPoliciesInterface) EXPECT() *MockRecipientFederationPoliciesInterface_Expecter { + return &MockRecipientFederationPoliciesInterface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockRecipientFederationPoliciesInterface) Create(ctx context.Context, request sharing.CreateFederationPolicyRequest) (*sharing.FederationPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *sharing.FederationPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, sharing.CreateFederationPolicyRequest) (*sharing.FederationPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, sharing.CreateFederationPolicyRequest) *sharing.FederationPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*sharing.FederationPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, sharing.CreateFederationPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRecipientFederationPoliciesInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockRecipientFederationPoliciesInterface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request sharing.CreateFederationPolicyRequest +func (_e *MockRecipientFederationPoliciesInterface_Expecter) Create(ctx interface{}, request interface{}) *MockRecipientFederationPoliciesInterface_Create_Call { + return &MockRecipientFederationPoliciesInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockRecipientFederationPoliciesInterface_Create_Call) Run(run func(ctx context.Context, request sharing.CreateFederationPolicyRequest)) *MockRecipientFederationPoliciesInterface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(sharing.CreateFederationPolicyRequest)) + }) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_Create_Call) Return(_a0 *sharing.FederationPolicy, _a1 error) *MockRecipientFederationPoliciesInterface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_Create_Call) RunAndReturn(run func(context.Context, sharing.CreateFederationPolicyRequest) (*sharing.FederationPolicy, error)) *MockRecipientFederationPoliciesInterface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockRecipientFederationPoliciesInterface) Delete(ctx context.Context, request sharing.DeleteFederationPolicyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, sharing.DeleteFederationPolicyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockRecipientFederationPoliciesInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockRecipientFederationPoliciesInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request sharing.DeleteFederationPolicyRequest +func (_e *MockRecipientFederationPoliciesInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockRecipientFederationPoliciesInterface_Delete_Call { + return &MockRecipientFederationPoliciesInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockRecipientFederationPoliciesInterface_Delete_Call) Run(run func(ctx context.Context, request sharing.DeleteFederationPolicyRequest)) *MockRecipientFederationPoliciesInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(sharing.DeleteFederationPolicyRequest)) + }) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_Delete_Call) Return(_a0 error) *MockRecipientFederationPoliciesInterface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_Delete_Call) RunAndReturn(run func(context.Context, sharing.DeleteFederationPolicyRequest) error) *MockRecipientFederationPoliciesInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// DeleteByRecipientNameAndName provides a mock function with given fields: ctx, recipientName, name +func (_m *MockRecipientFederationPoliciesInterface) DeleteByRecipientNameAndName(ctx context.Context, recipientName string, name string) error { + ret := _m.Called(ctx, recipientName, name) + + if len(ret) == 0 { + panic("no return value specified for DeleteByRecipientNameAndName") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { + r0 = rf(ctx, recipientName, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockRecipientFederationPoliciesInterface_DeleteByRecipientNameAndName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByRecipientNameAndName' +type MockRecipientFederationPoliciesInterface_DeleteByRecipientNameAndName_Call struct { + *mock.Call +} + +// DeleteByRecipientNameAndName is a helper method to define mock.On call +// - ctx context.Context +// - recipientName string +// - name string +func (_e *MockRecipientFederationPoliciesInterface_Expecter) DeleteByRecipientNameAndName(ctx interface{}, recipientName interface{}, name interface{}) *MockRecipientFederationPoliciesInterface_DeleteByRecipientNameAndName_Call { + return &MockRecipientFederationPoliciesInterface_DeleteByRecipientNameAndName_Call{Call: _e.mock.On("DeleteByRecipientNameAndName", ctx, recipientName, name)} +} + +func (_c *MockRecipientFederationPoliciesInterface_DeleteByRecipientNameAndName_Call) Run(run func(ctx context.Context, recipientName string, name string)) *MockRecipientFederationPoliciesInterface_DeleteByRecipientNameAndName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_DeleteByRecipientNameAndName_Call) Return(_a0 error) *MockRecipientFederationPoliciesInterface_DeleteByRecipientNameAndName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_DeleteByRecipientNameAndName_Call) RunAndReturn(run func(context.Context, string, string) error) *MockRecipientFederationPoliciesInterface_DeleteByRecipientNameAndName_Call { + _c.Call.Return(run) + return _c +} + +// GetFederationPolicy provides a mock function with given fields: ctx, request +func (_m *MockRecipientFederationPoliciesInterface) GetFederationPolicy(ctx context.Context, request sharing.GetFederationPolicyRequest) (*sharing.FederationPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetFederationPolicy") + } + + var r0 *sharing.FederationPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, sharing.GetFederationPolicyRequest) (*sharing.FederationPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, sharing.GetFederationPolicyRequest) *sharing.FederationPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*sharing.FederationPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, sharing.GetFederationPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRecipientFederationPoliciesInterface_GetFederationPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFederationPolicy' +type MockRecipientFederationPoliciesInterface_GetFederationPolicy_Call struct { + *mock.Call +} + +// GetFederationPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request sharing.GetFederationPolicyRequest +func (_e *MockRecipientFederationPoliciesInterface_Expecter) GetFederationPolicy(ctx interface{}, request interface{}) *MockRecipientFederationPoliciesInterface_GetFederationPolicy_Call { + return &MockRecipientFederationPoliciesInterface_GetFederationPolicy_Call{Call: _e.mock.On("GetFederationPolicy", ctx, request)} +} + +func (_c *MockRecipientFederationPoliciesInterface_GetFederationPolicy_Call) Run(run func(ctx context.Context, request sharing.GetFederationPolicyRequest)) *MockRecipientFederationPoliciesInterface_GetFederationPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(sharing.GetFederationPolicyRequest)) + }) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_GetFederationPolicy_Call) Return(_a0 *sharing.FederationPolicy, _a1 error) *MockRecipientFederationPoliciesInterface_GetFederationPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_GetFederationPolicy_Call) RunAndReturn(run func(context.Context, sharing.GetFederationPolicyRequest) (*sharing.FederationPolicy, error)) *MockRecipientFederationPoliciesInterface_GetFederationPolicy_Call { + _c.Call.Return(run) + return _c +} + +// GetFederationPolicyByRecipientNameAndName provides a mock function with given fields: ctx, recipientName, name +func (_m *MockRecipientFederationPoliciesInterface) GetFederationPolicyByRecipientNameAndName(ctx context.Context, recipientName string, name string) (*sharing.FederationPolicy, error) { + ret := _m.Called(ctx, recipientName, name) + + if len(ret) == 0 { + panic("no return value specified for GetFederationPolicyByRecipientNameAndName") + } + + var r0 *sharing.FederationPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*sharing.FederationPolicy, error)); ok { + return rf(ctx, recipientName, name) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) *sharing.FederationPolicy); ok { + r0 = rf(ctx, recipientName, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*sharing.FederationPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, recipientName, name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRecipientFederationPoliciesInterface_GetFederationPolicyByRecipientNameAndName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFederationPolicyByRecipientNameAndName' +type MockRecipientFederationPoliciesInterface_GetFederationPolicyByRecipientNameAndName_Call struct { + *mock.Call +} + +// GetFederationPolicyByRecipientNameAndName is a helper method to define mock.On call +// - ctx context.Context +// - recipientName string +// - name string +func (_e *MockRecipientFederationPoliciesInterface_Expecter) GetFederationPolicyByRecipientNameAndName(ctx interface{}, recipientName interface{}, name interface{}) *MockRecipientFederationPoliciesInterface_GetFederationPolicyByRecipientNameAndName_Call { + return &MockRecipientFederationPoliciesInterface_GetFederationPolicyByRecipientNameAndName_Call{Call: _e.mock.On("GetFederationPolicyByRecipientNameAndName", ctx, recipientName, name)} +} + +func (_c *MockRecipientFederationPoliciesInterface_GetFederationPolicyByRecipientNameAndName_Call) Run(run func(ctx context.Context, recipientName string, name string)) *MockRecipientFederationPoliciesInterface_GetFederationPolicyByRecipientNameAndName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_GetFederationPolicyByRecipientNameAndName_Call) Return(_a0 *sharing.FederationPolicy, _a1 error) *MockRecipientFederationPoliciesInterface_GetFederationPolicyByRecipientNameAndName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_GetFederationPolicyByRecipientNameAndName_Call) RunAndReturn(run func(context.Context, string, string) (*sharing.FederationPolicy, error)) *MockRecipientFederationPoliciesInterface_GetFederationPolicyByRecipientNameAndName_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockRecipientFederationPoliciesInterface) List(ctx context.Context, request sharing.ListFederationPoliciesRequest) listing.Iterator[sharing.FederationPolicy] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[sharing.FederationPolicy] + if rf, ok := ret.Get(0).(func(context.Context, sharing.ListFederationPoliciesRequest) listing.Iterator[sharing.FederationPolicy]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[sharing.FederationPolicy]) + } + } + + return r0 +} + +// MockRecipientFederationPoliciesInterface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockRecipientFederationPoliciesInterface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request sharing.ListFederationPoliciesRequest +func (_e *MockRecipientFederationPoliciesInterface_Expecter) List(ctx interface{}, request interface{}) *MockRecipientFederationPoliciesInterface_List_Call { + return &MockRecipientFederationPoliciesInterface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockRecipientFederationPoliciesInterface_List_Call) Run(run func(ctx context.Context, request sharing.ListFederationPoliciesRequest)) *MockRecipientFederationPoliciesInterface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(sharing.ListFederationPoliciesRequest)) + }) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_List_Call) Return(_a0 listing.Iterator[sharing.FederationPolicy]) *MockRecipientFederationPoliciesInterface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_List_Call) RunAndReturn(run func(context.Context, sharing.ListFederationPoliciesRequest) listing.Iterator[sharing.FederationPolicy]) *MockRecipientFederationPoliciesInterface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockRecipientFederationPoliciesInterface) ListAll(ctx context.Context, request sharing.ListFederationPoliciesRequest) ([]sharing.FederationPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []sharing.FederationPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, sharing.ListFederationPoliciesRequest) ([]sharing.FederationPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, sharing.ListFederationPoliciesRequest) []sharing.FederationPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]sharing.FederationPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, sharing.ListFederationPoliciesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRecipientFederationPoliciesInterface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockRecipientFederationPoliciesInterface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request sharing.ListFederationPoliciesRequest +func (_e *MockRecipientFederationPoliciesInterface_Expecter) ListAll(ctx interface{}, request interface{}) *MockRecipientFederationPoliciesInterface_ListAll_Call { + return &MockRecipientFederationPoliciesInterface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockRecipientFederationPoliciesInterface_ListAll_Call) Run(run func(ctx context.Context, request sharing.ListFederationPoliciesRequest)) *MockRecipientFederationPoliciesInterface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(sharing.ListFederationPoliciesRequest)) + }) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_ListAll_Call) Return(_a0 []sharing.FederationPolicy, _a1 error) *MockRecipientFederationPoliciesInterface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_ListAll_Call) RunAndReturn(run func(context.Context, sharing.ListFederationPoliciesRequest) ([]sharing.FederationPolicy, error)) *MockRecipientFederationPoliciesInterface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// ListByRecipientName provides a mock function with given fields: ctx, recipientName +func (_m *MockRecipientFederationPoliciesInterface) ListByRecipientName(ctx context.Context, recipientName string) (*sharing.ListFederationPoliciesResponse, error) { + ret := _m.Called(ctx, recipientName) + + if len(ret) == 0 { + panic("no return value specified for ListByRecipientName") + } + + var r0 *sharing.ListFederationPoliciesResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*sharing.ListFederationPoliciesResponse, error)); ok { + return rf(ctx, recipientName) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *sharing.ListFederationPoliciesResponse); ok { + r0 = rf(ctx, recipientName) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*sharing.ListFederationPoliciesResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, recipientName) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRecipientFederationPoliciesInterface_ListByRecipientName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListByRecipientName' +type MockRecipientFederationPoliciesInterface_ListByRecipientName_Call struct { + *mock.Call +} + +// ListByRecipientName is a helper method to define mock.On call +// - ctx context.Context +// - recipientName string +func (_e *MockRecipientFederationPoliciesInterface_Expecter) ListByRecipientName(ctx interface{}, recipientName interface{}) *MockRecipientFederationPoliciesInterface_ListByRecipientName_Call { + return &MockRecipientFederationPoliciesInterface_ListByRecipientName_Call{Call: _e.mock.On("ListByRecipientName", ctx, recipientName)} +} + +func (_c *MockRecipientFederationPoliciesInterface_ListByRecipientName_Call) Run(run func(ctx context.Context, recipientName string)) *MockRecipientFederationPoliciesInterface_ListByRecipientName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_ListByRecipientName_Call) Return(_a0 *sharing.ListFederationPoliciesResponse, _a1 error) *MockRecipientFederationPoliciesInterface_ListByRecipientName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_ListByRecipientName_Call) RunAndReturn(run func(context.Context, string) (*sharing.ListFederationPoliciesResponse, error)) *MockRecipientFederationPoliciesInterface_ListByRecipientName_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockRecipientFederationPoliciesInterface) Update(ctx context.Context, request sharing.UpdateFederationPolicyRequest) (*sharing.FederationPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *sharing.FederationPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, sharing.UpdateFederationPolicyRequest) (*sharing.FederationPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, sharing.UpdateFederationPolicyRequest) *sharing.FederationPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*sharing.FederationPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, sharing.UpdateFederationPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRecipientFederationPoliciesInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockRecipientFederationPoliciesInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request sharing.UpdateFederationPolicyRequest +func (_e *MockRecipientFederationPoliciesInterface_Expecter) Update(ctx interface{}, request interface{}) *MockRecipientFederationPoliciesInterface_Update_Call { + return &MockRecipientFederationPoliciesInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockRecipientFederationPoliciesInterface_Update_Call) Run(run func(ctx context.Context, request sharing.UpdateFederationPolicyRequest)) *MockRecipientFederationPoliciesInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(sharing.UpdateFederationPolicyRequest)) + }) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_Update_Call) Return(_a0 *sharing.FederationPolicy, _a1 error) *MockRecipientFederationPoliciesInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_Update_Call) RunAndReturn(run func(context.Context, sharing.UpdateFederationPolicyRequest) (*sharing.FederationPolicy, error)) *MockRecipientFederationPoliciesInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockRecipientFederationPoliciesInterface creates a new instance of MockRecipientFederationPoliciesInterface. 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 NewMockRecipientFederationPoliciesInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRecipientFederationPoliciesInterface { + mock := &MockRecipientFederationPoliciesInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/service/apps/model.go b/service/apps/model.go index e15a6693e..a6a9bfe27 100755 --- a/service/apps/model.go +++ b/service/apps/model.go @@ -342,6 +342,8 @@ type AppResource struct { SqlWarehouse *AppResourceSqlWarehouse `json:"sql_warehouse,omitempty"` + UcSecurable *AppResourceUcSecurable `json:"uc_securable,omitempty"` + ForceSendFields []string `json:"-" url:"-"` } @@ -507,6 +509,66 @@ func (f *AppResourceSqlWarehouseSqlWarehousePermission) Type() string { return "AppResourceSqlWarehouseSqlWarehousePermission" } +type AppResourceUcSecurable struct { + Permission AppResourceUcSecurableUcSecurablePermission `json:"permission"` + + SecurableFullName string `json:"securable_full_name"` + + SecurableType AppResourceUcSecurableUcSecurableType `json:"securable_type"` +} + +type AppResourceUcSecurableUcSecurablePermission string + +const AppResourceUcSecurableUcSecurablePermissionReadVolume AppResourceUcSecurableUcSecurablePermission = `READ_VOLUME` + +const AppResourceUcSecurableUcSecurablePermissionWriteVolume AppResourceUcSecurableUcSecurablePermission = `WRITE_VOLUME` + +// String representation for [fmt.Print] +func (f *AppResourceUcSecurableUcSecurablePermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppResourceUcSecurableUcSecurablePermission) Set(v string) error { + switch v { + case `READ_VOLUME`, `WRITE_VOLUME`: + *f = AppResourceUcSecurableUcSecurablePermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "READ_VOLUME", "WRITE_VOLUME"`, v) + } +} + +// Type always returns AppResourceUcSecurableUcSecurablePermission to satisfy [pflag.Value] interface +func (f *AppResourceUcSecurableUcSecurablePermission) Type() string { + return "AppResourceUcSecurableUcSecurablePermission" +} + +type AppResourceUcSecurableUcSecurableType string + +const AppResourceUcSecurableUcSecurableTypeVolume AppResourceUcSecurableUcSecurableType = `VOLUME` + +// String representation for [fmt.Print] +func (f *AppResourceUcSecurableUcSecurableType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppResourceUcSecurableUcSecurableType) Set(v string) error { + switch v { + case `VOLUME`: + *f = AppResourceUcSecurableUcSecurableType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "VOLUME"`, v) + } +} + +// Type always returns AppResourceUcSecurableUcSecurableType to satisfy [pflag.Value] interface +func (f *AppResourceUcSecurableUcSecurableType) Type() string { + return "AppResourceUcSecurableUcSecurableType" +} + type ApplicationState string const ApplicationStateCrashed ApplicationState = `CRASHED` diff --git a/service/catalog/impl.go b/service/catalog/impl.go index 72d12d524..cc376b6e9 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -346,8 +346,6 @@ func (a *catalogsImpl) Get(ctx context.Context, request GetCatalogRequest) (*Cat // the array. func (a *catalogsImpl) List(ctx context.Context, request ListCatalogsRequest) listing.Iterator[CatalogInfo] { - request.ForceSendFields = append(request.ForceSendFields, "MaxResults") - getNextPage := func(ctx context.Context, req ListCatalogsRequest) (*ListCatalogsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) diff --git a/service/catalog/model.go b/service/catalog/model.go index dfb7d62c4..25d5c1b64 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -378,8 +378,8 @@ type CatalogInfo struct { ProviderName string `json:"provider_name,omitempty"` // Status of an asynchronously provisioned resource. ProvisioningInfo *ProvisioningInfo `json:"provisioning_info,omitempty"` - - SecurableType string `json:"securable_type,omitempty"` + // The type of Unity Catalog securable. + SecurableType SecurableType `json:"securable_type,omitempty"` // The name of the share under the share provider. ShareName string `json:"share_name,omitempty"` // Storage Location URL (full path) for managed tables within catalog. @@ -402,8 +402,6 @@ func (s CatalogInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Whether the current securable is accessible from all workspaces or a specific -// set of workspaces. type CatalogIsolationMode string const CatalogIsolationModeIsolated CatalogIsolationMode = `ISOLATED` @@ -438,10 +436,16 @@ const CatalogTypeDeltasharingCatalog CatalogType = `DELTASHARING_CATALOG` const CatalogTypeForeignCatalog CatalogType = `FOREIGN_CATALOG` +const CatalogTypeInternalCatalog CatalogType = `INTERNAL_CATALOG` + const CatalogTypeManagedCatalog CatalogType = `MANAGED_CATALOG` +const CatalogTypeManagedOnlineCatalog CatalogType = `MANAGED_ONLINE_CATALOG` + const CatalogTypeSystemCatalog CatalogType = `SYSTEM_CATALOG` +const CatalogTypeUnknownCatalogType CatalogType = `UNKNOWN_CATALOG_TYPE` + // String representation for [fmt.Print] func (f *CatalogType) String() string { return string(*f) @@ -450,11 +454,11 @@ func (f *CatalogType) String() string { // Set raw string value and validate it against allowed values func (f *CatalogType) Set(v string) error { switch v { - case `DELTASHARING_CATALOG`, `FOREIGN_CATALOG`, `MANAGED_CATALOG`, `SYSTEM_CATALOG`: + case `DELTASHARING_CATALOG`, `FOREIGN_CATALOG`, `INTERNAL_CATALOG`, `MANAGED_CATALOG`, `MANAGED_ONLINE_CATALOG`, `SYSTEM_CATALOG`, `UNKNOWN_CATALOG_TYPE`: *f = CatalogType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "DELTASHARING_CATALOG", "FOREIGN_CATALOG", "MANAGED_CATALOG", "SYSTEM_CATALOG"`, v) + return fmt.Errorf(`value "%s" is not one of "DELTASHARING_CATALOG", "FOREIGN_CATALOG", "INTERNAL_CATALOG", "MANAGED_CATALOG", "MANAGED_ONLINE_CATALOG", "SYSTEM_CATALOG", "UNKNOWN_CATALOG_TYPE"`, v) } } @@ -2023,8 +2027,6 @@ func (s EffectivePrivilegeAssignment) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Whether predictive optimization should be enabled for this object and objects -// under it. type EnablePredictiveOptimization string const EnablePredictiveOptimizationDisable EnablePredictiveOptimization = `DISABLE` @@ -4674,6 +4676,8 @@ type PrimaryKeyConstraint struct { ChildColumns []string `json:"child_columns"` // The name of the constraint. Name string `json:"name"` + // Column names that represent a timeseries. + TimeseriesColumns []string `json:"timeseries_columns,omitempty"` } type Privilege string @@ -4819,6 +4823,7 @@ type PropertiesKvPairs map[string]string // Status of an asynchronously provisioned resource. type ProvisioningInfo struct { + // The provisioning state of the resource. State ProvisioningInfoState `json:"state,omitempty"` } @@ -5053,8 +5058,7 @@ type SchemaInfo struct { CreatedBy string `json:"created_by,omitempty"` EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` - // Whether predictive optimization should be enabled for this object and - // objects under it. + EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` // Full name of schema, in form of __catalog_name__.__schema_name__. FullName string `json:"full_name,omitempty"` @@ -5094,7 +5098,7 @@ type SecurableOptionsMap map[string]string // A map of key-value properties attached to the securable. type SecurablePropertiesMap map[string]string -// The type of Unity Catalog securable +// The type of Unity Catalog securable. type SecurableType string const SecurableTypeCatalog SecurableType = `CATALOG` @@ -5107,6 +5111,8 @@ const SecurableTypeCredential SecurableType = `CREDENTIAL` const SecurableTypeExternalLocation SecurableType = `EXTERNAL_LOCATION` +const SecurableTypeExternalMetadata SecurableType = `EXTERNAL_METADATA` + const SecurableTypeFunction SecurableType = `FUNCTION` const SecurableTypeMetastore SecurableType = `METASTORE` @@ -5121,10 +5127,14 @@ const SecurableTypeSchema SecurableType = `SCHEMA` const SecurableTypeShare SecurableType = `SHARE` +const SecurableTypeStagingTable SecurableType = `STAGING_TABLE` + const SecurableTypeStorageCredential SecurableType = `STORAGE_CREDENTIAL` const SecurableTypeTable SecurableType = `TABLE` +const SecurableTypeUnknownSecurableType SecurableType = `UNKNOWN_SECURABLE_TYPE` + const SecurableTypeVolume SecurableType = `VOLUME` // String representation for [fmt.Print] @@ -5135,11 +5145,11 @@ func (f *SecurableType) String() string { // Set raw string value and validate it against allowed values func (f *SecurableType) Set(v string) error { switch v { - case `CATALOG`, `CLEAN_ROOM`, `CONNECTION`, `CREDENTIAL`, `EXTERNAL_LOCATION`, `FUNCTION`, `METASTORE`, `PIPELINE`, `PROVIDER`, `RECIPIENT`, `SCHEMA`, `SHARE`, `STORAGE_CREDENTIAL`, `TABLE`, `VOLUME`: + case `CATALOG`, `CLEAN_ROOM`, `CONNECTION`, `CREDENTIAL`, `EXTERNAL_LOCATION`, `EXTERNAL_METADATA`, `FUNCTION`, `METASTORE`, `PIPELINE`, `PROVIDER`, `RECIPIENT`, `SCHEMA`, `SHARE`, `STAGING_TABLE`, `STORAGE_CREDENTIAL`, `TABLE`, `UNKNOWN_SECURABLE_TYPE`, `VOLUME`: *f = SecurableType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "CATALOG", "CLEAN_ROOM", "CONNECTION", "CREDENTIAL", "EXTERNAL_LOCATION", "FUNCTION", "METASTORE", "PIPELINE", "PROVIDER", "RECIPIENT", "SCHEMA", "SHARE", "STORAGE_CREDENTIAL", "TABLE", "VOLUME"`, v) + return fmt.Errorf(`value "%s" is not one of "CATALOG", "CLEAN_ROOM", "CONNECTION", "CREDENTIAL", "EXTERNAL_LOCATION", "EXTERNAL_METADATA", "FUNCTION", "METASTORE", "PIPELINE", "PROVIDER", "RECIPIENT", "SCHEMA", "SHARE", "STAGING_TABLE", "STORAGE_CREDENTIAL", "TABLE", "UNKNOWN_SECURABLE_TYPE", "VOLUME"`, v) } } @@ -5456,8 +5466,7 @@ type TableInfo struct { DeltaRuntimePropertiesKvpairs *DeltaRuntimePropertiesKvPairs `json:"delta_runtime_properties_kvpairs,omitempty"` EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` - // Whether predictive optimization should be enabled for this object and - // objects under it. + EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` // Encryption options that apply to clients connecting to cloud storage. EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` @@ -6045,8 +6054,7 @@ type UpdateResponse struct { type UpdateSchema struct { // User-provided free-form text description. Comment string `json:"comment,omitempty"` - // Whether predictive optimization should be enabled for this object and - // objects under it. + EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` // Full name of the schema. FullName string `json:"-" url:"-"` diff --git a/service/cleanrooms/model.go b/service/cleanrooms/model.go index 468cbfa6c..b51d9d7c8 100755 --- a/service/cleanrooms/model.go +++ b/service/cleanrooms/model.go @@ -196,6 +196,12 @@ type CleanRoomAssetNotebook struct { // Base 64 representation of the notebook contents. This is the same format // as returned by :method:workspace/export with the format of **HTML**. NotebookContent string `json:"notebook_content,omitempty"` + // top-level status derived from all reviews + ReviewState CleanRoomNotebookReviewNotebookReviewState `json:"review_state,omitempty"` + // All existing approvals or rejections + Reviews []CleanRoomNotebookReview `json:"reviews,omitempty"` + // collaborators that can run the notebook + RunnerCollaboratorAliases []string `json:"runner_collaborator_aliases,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -340,6 +346,85 @@ func (s CleanRoomCollaborator) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CleanRoomNotebookReview struct { + // review comment + Comment string `json:"comment,omitempty"` + // timestamp of when the review was submitted + CreatedAtMillis int64 `json:"created_at_millis,omitempty"` + // review outcome + ReviewState CleanRoomNotebookReviewNotebookReviewState `json:"review_state,omitempty"` + // specified when the review was not explicitly made by a user + ReviewSubReason CleanRoomNotebookReviewNotebookReviewSubReason `json:"review_sub_reason,omitempty"` + // collaborator alias of the reviewer + ReviewerCollaboratorAlias string `json:"reviewer_collaborator_alias,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CleanRoomNotebookReview) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CleanRoomNotebookReview) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CleanRoomNotebookReviewNotebookReviewState string + +const CleanRoomNotebookReviewNotebookReviewStateApproved CleanRoomNotebookReviewNotebookReviewState = `APPROVED` + +const CleanRoomNotebookReviewNotebookReviewStatePending CleanRoomNotebookReviewNotebookReviewState = `PENDING` + +const CleanRoomNotebookReviewNotebookReviewStateRejected CleanRoomNotebookReviewNotebookReviewState = `REJECTED` + +// String representation for [fmt.Print] +func (f *CleanRoomNotebookReviewNotebookReviewState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *CleanRoomNotebookReviewNotebookReviewState) Set(v string) error { + switch v { + case `APPROVED`, `PENDING`, `REJECTED`: + *f = CleanRoomNotebookReviewNotebookReviewState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "APPROVED", "PENDING", "REJECTED"`, v) + } +} + +// Type always returns CleanRoomNotebookReviewNotebookReviewState to satisfy [pflag.Value] interface +func (f *CleanRoomNotebookReviewNotebookReviewState) Type() string { + return "CleanRoomNotebookReviewNotebookReviewState" +} + +type CleanRoomNotebookReviewNotebookReviewSubReason string + +const CleanRoomNotebookReviewNotebookReviewSubReasonAutoApproved CleanRoomNotebookReviewNotebookReviewSubReason = `AUTO_APPROVED` + +const CleanRoomNotebookReviewNotebookReviewSubReasonBackfilled CleanRoomNotebookReviewNotebookReviewSubReason = `BACKFILLED` + +// String representation for [fmt.Print] +func (f *CleanRoomNotebookReviewNotebookReviewSubReason) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *CleanRoomNotebookReviewNotebookReviewSubReason) Set(v string) error { + switch v { + case `AUTO_APPROVED`, `BACKFILLED`: + *f = CleanRoomNotebookReviewNotebookReviewSubReason(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "AUTO_APPROVED", "BACKFILLED"`, v) + } +} + +// Type always returns CleanRoomNotebookReviewNotebookReviewSubReason to satisfy [pflag.Value] interface +func (f *CleanRoomNotebookReviewNotebookReviewSubReason) Type() string { + return "CleanRoomNotebookReviewNotebookReviewSubReason" +} + // Stores information about a single task run. type CleanRoomNotebookTaskRun struct { // Job run info of the task in the runner's local workspace. This field is @@ -347,10 +432,15 @@ type CleanRoomNotebookTaskRun struct { // workspace the API is being called. If the task run was in a different // workspace under the same metastore, only the workspace_id is included. CollaboratorJobRunInfo *CollaboratorJobRunInfo `json:"collaborator_job_run_info,omitempty"` + // Etag of the notebook executed in this task run, used to identify the + // notebook version. + NotebookEtag string `json:"notebook_etag,omitempty"` // State of the task run. NotebookJobRunState *jobs.CleanRoomTaskRunState `json:"notebook_job_run_state,omitempty"` // Asset name of the notebook executed in this task run. NotebookName string `json:"notebook_name,omitempty"` + // The timestamp of when the notebook was last updated. + NotebookUpdatedAt int64 `json:"notebook_updated_at,omitempty"` // Expiration time of the output schema of the task run (if any), in epoch // milliseconds. OutputSchemaExpirationTime int64 `json:"output_schema_expiration_time,omitempty"` diff --git a/service/compute/api.go b/service/compute/api.go index d4aa79438..108ddf102 100755 --- a/service/compute/api.go +++ b/service/compute/api.go @@ -2079,8 +2079,10 @@ type InstanceProfilesInterface interface { // Register an instance profile. // - // In the UI, you can select the instance profile when launching clusters. This - // API is only available to admin users. + // Registers an instance profile in Databricks. In the UI, you can then give + // users the permission to use this instance profile when launching clusters. + // + // This API is only available to admin users. Add(ctx context.Context, request AddInstanceProfile) error // Edit an instance profile. diff --git a/service/compute/interface.go b/service/compute/interface.go index 87da5ac34..40c9b3d96 100755 --- a/service/compute/interface.go +++ b/service/compute/interface.go @@ -472,7 +472,10 @@ type InstanceProfilesService interface { // Register an instance profile. // - // In the UI, you can select the instance profile when launching clusters. + // Registers an instance profile in Databricks. In the UI, you can then give + // users the permission to use this instance profile when launching + // clusters. + // // This API is only available to admin users. Add(ctx context.Context, request AddInstanceProfile) error diff --git a/service/compute/model.go b/service/compute/model.go index 0b654bf54..86cc5d944 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -425,7 +425,9 @@ type ClusterAttributes struct { // is `$destination/$clusterId/executor`. ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If - // not specified at creation, the cluster name will be an empty string. + // not specified at creation, the cluster name will be an empty string. For + // job clusters, the cluster name is automatically set based on the job and + // job run IDs. ClusterName string `json:"cluster_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -649,7 +651,9 @@ type ClusterDetails struct { // Total amount of cluster memory, in megabytes ClusterMemoryMb int64 `json:"cluster_memory_mb,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If - // not specified at creation, the cluster name will be an empty string. + // not specified at creation, the cluster name will be an empty string. For + // job clusters, the cluster name is automatically set based on the job and + // job run IDs. ClusterName string `json:"cluster_name,omitempty"` // Determines whether the cluster was created by a user through the UI, // created by the Databricks Jobs Scheduler, or through an API request. @@ -1278,7 +1282,9 @@ type ClusterSpec struct { // is `$destination/$clusterId/executor`. ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If - // not specified at creation, the cluster name will be an empty string. + // not specified at creation, the cluster name will be an empty string. For + // job clusters, the cluster name is automatically set based on the job and + // job run IDs. ClusterName string `json:"cluster_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -1626,7 +1632,9 @@ type CreateCluster struct { // is `$destination/$clusterId/executor`. ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If - // not specified at creation, the cluster name will be an empty string. + // not specified at creation, the cluster name will be an empty string. For + // job clusters, the cluster name is automatically set based on the job and + // job run IDs. ClusterName string `json:"cluster_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -2428,7 +2436,9 @@ type EditCluster struct { // is `$destination/$clusterId/executor`. ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If - // not specified at creation, the cluster name will be an empty string. + // not specified at creation, the cluster name will be an empty string. For + // job clusters, the cluster name is automatically set based on the job and + // job run IDs. ClusterName string `json:"cluster_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -2745,10 +2755,8 @@ func (s EnforceClusterComplianceResponse) MarshalJSON() ([]byte, error) { // The environment entity used to preserve serverless environment side panel, // jobs' environment for non-notebook task, and DLT's environment for classic -// and serverless pipelines. (Note: DLT uses a copied version of the Environment -// proto below, at -// //spark/pipelines/api/protos/copied/libraries-environments-copy.proto) In -// this minimal environment spec, only pip dependencies are supported. +// and serverless pipelines. In this minimal environment spec, only pip +// dependencies are supported. type Environment struct { // Client version used by the environment The client is the user-facing // environment of the runtime. Each client comes with a specific set of @@ -5719,7 +5727,9 @@ type UpdateClusterResource struct { // is `$destination/$clusterId/executor`. ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If - // not specified at creation, the cluster name will be an empty string. + // not specified at creation, the cluster name will be an empty string. For + // job clusters, the cluster name is automatically set based on the job and + // job run IDs. ClusterName string `json:"cluster_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in diff --git a/service/iam/api.go b/service/iam/api.go index e4dbdc586..349cf8372 100755 --- a/service/iam/api.go +++ b/service/iam/api.go @@ -74,7 +74,7 @@ type AccountAccessControlProxyInterface interface { // Get assignable roles for a resource. // - // Gets all the roles that can be granted on an account-level resource. A role + // Gets all the roles that can be granted on an account level resource. A role // is grantable if the rule set on the resource can contain an access rule of // the role. GetAssignableRolesForResource(ctx context.Context, request GetAssignableRolesForResourceRequest) (*GetAssignableRolesForResourceResponse, error) @@ -88,9 +88,9 @@ type AccountAccessControlProxyInterface interface { // Update a rule set. // - // Replace the rules of a rule set. First, use a GET rule set request to read - // the current version of the rule set before modifying it. This pattern helps - // prevent conflicts between concurrent updates. + // Replace the rules of a rule set. First, use get to read the current version + // of the rule set before modifying it. This pattern helps prevent conflicts + // between concurrent updates. UpdateRuleSet(ctx context.Context, request UpdateRuleSetRequest) (*RuleSetResponse, error) } @@ -105,7 +105,7 @@ func NewAccountAccessControlProxy(client *client.DatabricksClient) *AccountAcces // These APIs manage access rules on resources in an account. Currently, only // grant rules are supported. A grant rule specifies a role assigned to a set of // principals. A list of rules attached to a resource is called a rule set. A -// workspace must belong to an account for these APIs to work. +// workspace must belong to an account for these APIs to work type AccountAccessControlProxyAPI struct { accountAccessControlProxyImpl } diff --git a/service/iam/interface.go b/service/iam/interface.go index 5739c8f75..ba75f5a47 100755 --- a/service/iam/interface.go +++ b/service/iam/interface.go @@ -43,12 +43,12 @@ type AccountAccessControlService interface { // These APIs manage access rules on resources in an account. Currently, only // grant rules are supported. A grant rule specifies a role assigned to a set of // principals. A list of rules attached to a resource is called a rule set. A -// workspace must belong to an account for these APIs to work. +// workspace must belong to an account for these APIs to work type AccountAccessControlProxyService interface { // Get assignable roles for a resource. // - // Gets all the roles that can be granted on an account-level resource. A + // Gets all the roles that can be granted on an account level resource. A // role is grantable if the rule set on the resource can contain an access // rule of the role. GetAssignableRolesForResource(ctx context.Context, request GetAssignableRolesForResourceRequest) (*GetAssignableRolesForResourceResponse, error) @@ -62,9 +62,9 @@ type AccountAccessControlProxyService interface { // Update a rule set. // - // Replace the rules of a rule set. First, use a GET rule set request to - // read the current version of the rule set before modifying it. This - // pattern helps prevent conflicts between concurrent updates. + // Replace the rules of a rule set. First, use get to read the current + // version of the rule set before modifying it. This pattern helps prevent + // conflicts between concurrent updates. UpdateRuleSet(ctx context.Context, request UpdateRuleSetRequest) (*RuleSetResponse, error) } diff --git a/service/iam/model.go b/service/iam/model.go index c9317880e..0bd923991 100755 --- a/service/iam/model.go +++ b/service/iam/model.go @@ -231,6 +231,12 @@ func (s GetAccountUserRequest) MarshalJSON() ([]byte, error) { // Get assignable roles for a resource type GetAssignableRolesForResourceRequest struct { // The resource name for which assignable roles will be listed. + // + // Examples | Summary :--- | :--- `resource=accounts/` | A + // resource name for the account. + // `resource=accounts//groups/` | A resource name for + // the group. `resource=accounts//servicePrincipals/` | A + // resource name for the service principal. Resource string `json:"-" url:"resource"` } @@ -287,8 +293,21 @@ type GetRuleSetRequest struct { // avoid race conditions that is get an etag from a GET rule set request, // and pass it with the PUT update request to identify the rule set version // you are updating. + // + // Examples | Summary :--- | :--- `etag=` | An empty etag can only be used + // in GET to indicate no freshness requirements. + // `etag=RENUAAABhSweA4NvVmmUYdiU717H3Tgy0UJdor3gE4a+mq/oj9NjAf8ZsQ==` | An + // etag encoded a specific version of the rule set to get or to be updated. Etag string `json:"-" url:"etag"` // The ruleset name associated with the request. + // + // Examples | Summary :--- | :--- + // `name=accounts//ruleSets/default` | A name for a rule set on + // the account. + // `name=accounts//groups//ruleSets/default` | A name + // for a rule set on the group. + // `name=accounts//servicePrincipals//ruleSets/default` + // | A name for a rule set on the service principal. Name string `json:"-" url:"name"` } @@ -369,7 +388,11 @@ type GetWorkspaceAssignmentRequest struct { } type GrantRule struct { - // Principals this grant rule applies to. + // Principals this grant rule applies to. A principal can be a user (for end + // users), a service principal (for applications and compute workloads), or + // an account group. Each principal has its own identifier format: * + // users/ * groups/ * + // servicePrincipals/ Principals []string `json:"principals,omitempty"` // Role that is assigned to the list of principals. Role string `json:"role"` @@ -1290,28 +1313,32 @@ type Role struct { } type RuleSetResponse struct { - // Identifies the version of the rule set returned. - Etag string `json:"etag,omitempty"` + // Identifies the version of the rule set returned. Etag used for + // versioning. The response is at least as fresh as the eTag provided. Etag + // is used for optimistic concurrency control as a way to help prevent + // simultaneous updates of a rule set from overwriting each other. It is + // strongly suggested that systems make use of the etag in the read -> + // modify -> write pattern to perform rule set updates in order to avoid + // race conditions that is get an etag from a GET rule set request, and pass + // it with the PUT update request to identify the rule set version you are + // updating. + Etag string `json:"etag"` GrantRules []GrantRule `json:"grant_rules,omitempty"` // Name of the rule set. - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func (s *RuleSetResponse) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, s) -} - -func (s RuleSetResponse) MarshalJSON() ([]byte, error) { - return marshal.Marshal(s) + Name string `json:"name"` } type RuleSetUpdateRequest struct { - // The expected etag of the rule set to update. The update will fail if the - // value does not match the value that is stored in account access control - // service. + // Identifies the version of the rule set returned. Etag used for + // versioning. The response is at least as fresh as the eTag provided. Etag + // is used for optimistic concurrency control as a way to help prevent + // simultaneous updates of a rule set from overwriting each other. It is + // strongly suggested that systems make use of the etag in the read -> + // modify -> write pattern to perform rule set updates in order to avoid + // race conditions that is get an etag from a GET rule set request, and pass + // it with the PUT update request to identify the rule set version you are + // updating. Etag string `json:"etag"` GrantRules []GrantRule `json:"grant_rules,omitempty"` diff --git a/service/jobs/model.go b/service/jobs/model.go index fc65ffec0..c4b1f796e 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -1575,10 +1575,8 @@ type JobEnvironment struct { EnvironmentKey string `json:"environment_key"` // The environment entity used to preserve serverless environment side // panel, jobs' environment for non-notebook task, and DLT's environment for - // classic and serverless pipelines. (Note: DLT uses a copied version of the - // Environment proto below, at - // //spark/pipelines/api/protos/copied/libraries-environments-copy.proto) In - // this minimal environment spec, only pip dependencies are supported. + // classic and serverless pipelines. In this minimal environment spec, only + // pip dependencies are supported. Spec *compute.Environment `json:"spec,omitempty"` } diff --git a/service/ml/api.go b/service/ml/api.go index 25fd7909b..8b0100367 100755 --- a/service/ml/api.go +++ b/service/ml/api.go @@ -26,6 +26,9 @@ type ExperimentsInterface interface { // Throws `RESOURCE_ALREADY_EXISTS` if an experiment with the given name exists. CreateExperiment(ctx context.Context, request CreateExperiment) (*CreateExperimentResponse, error) + // Create a logged model. + CreateLoggedModel(ctx context.Context, request CreateLoggedModelRequest) (*CreateLoggedModelResponse, error) + // Create a run. // // Creates a new run within an experiment. A run is usually a single execution @@ -41,6 +44,18 @@ type ExperimentsInterface interface { // experiment are also deleted. DeleteExperiment(ctx context.Context, request DeleteExperiment) error + // Delete a logged model. + DeleteLoggedModel(ctx context.Context, request DeleteLoggedModelRequest) error + + // Delete a logged model. + DeleteLoggedModelByModelId(ctx context.Context, modelId string) error + + // Delete a tag on a logged model. + DeleteLoggedModelTag(ctx context.Context, request DeleteLoggedModelTagRequest) error + + // Delete a tag on a logged model. + DeleteLoggedModelTagByModelIdAndTagKey(ctx context.Context, modelId string, tagKey string) error + // Delete a run. // // Marks a run for deletion. @@ -59,6 +74,9 @@ type ExperimentsInterface interface { // run and after a run completes. DeleteTag(ctx context.Context, request DeleteTag) error + // Finalize a logged model. + FinalizeLoggedModel(ctx context.Context, request FinalizeLoggedModelRequest) (*FinalizeLoggedModelResponse, error) + // Get an experiment by name. // // Gets metadata for an experiment. @@ -103,6 +121,12 @@ type ExperimentsInterface interface { // This method is generated by Databricks SDK Code Generator. GetHistoryAll(ctx context.Context, request GetHistoryRequest) ([]Metric, error) + // Get a logged model. + GetLoggedModel(ctx context.Context, request GetLoggedModelRequest) (*GetLoggedModelResponse, error) + + // Get a logged model. + GetLoggedModelByModelId(ctx context.Context, modelId string) (*GetLoggedModelResponse, error) + // Get experiment permission levels. // // Gets the permission levels that a user can have on an object. @@ -173,6 +197,20 @@ type ExperimentsInterface interface { // This method is generated by Databricks SDK Code Generator. ListExperimentsAll(ctx context.Context, request ListExperimentsRequest) ([]Experiment, error) + // List artifacts for a logged model. + // + // List artifacts for a logged model. Takes an optional + // ``artifact_directory_path`` prefix which if specified, the response contains + // only artifacts with the specified prefix. + ListLoggedModelArtifacts(ctx context.Context, request ListLoggedModelArtifactsRequest) (*ListLoggedModelArtifactsResponse, error) + + // List artifacts for a logged model. + // + // List artifacts for a logged model. Takes an optional + // ``artifact_directory_path`` prefix which if specified, the response contains + // only artifacts with the specified prefix. + ListLoggedModelArtifactsByModelId(ctx context.Context, modelId string) (*ListLoggedModelArtifactsResponse, error) + // Log a batch of metrics/params/tags for a run. // // Logs a batch of metrics, params, and tags for a run. If any data failed to be @@ -228,6 +266,14 @@ type ExperimentsInterface interface { // Logs inputs, such as datasets and models, to an MLflow Run. LogInputs(ctx context.Context, request LogInputs) error + // Log params for a logged model. + // + // Logs params for a logged model. A param is a key-value pair (string key, + // string value). Examples include hyperparameters used for ML model training. A + // param can be logged only once for a logged model, and attempting to overwrite + // an existing param with a different value will result in an error + LogLoggedModelParams(ctx context.Context, request LogLoggedModelParamsRequest) error + // Log a metric for a run. // // Log a metric for a run. A metric is a key-value pair (string key, float @@ -241,6 +287,14 @@ type ExperimentsInterface interface { // without warning. LogModel(ctx context.Context, request LogModel) error + // Log outputs from a run. + // + // **NOTE**: Experimental: This API may change or be removed in a future release + // without warning. + // + // Logs outputs, such as models, from an MLflow Run. + LogOutputs(ctx context.Context, request LogOutputsRequest) error + // Log a param for a run. // // Logs a param used for a run. A param is a key-value pair (string key, string @@ -289,6 +343,11 @@ type ExperimentsInterface interface { // This method is generated by Databricks SDK Code Generator. SearchExperimentsAll(ctx context.Context, request SearchExperiments) ([]Experiment, error) + // Search logged models. + // + // Search for Logged Models that satisfy specified search criteria. + SearchLoggedModels(ctx context.Context, request SearchLoggedModelsRequest) (*SearchLoggedModelsResponse, error) + // Search for runs. // // Searches for runs that satisfy expressions. @@ -313,6 +372,9 @@ type ExperimentsInterface interface { // updated. SetExperimentTag(ctx context.Context, request SetExperimentTag) error + // Set a tag for a logged model. + SetLoggedModelTags(ctx context.Context, request SetLoggedModelTagsRequest) error + // Set experiment permissions. // // Sets permissions on an object, replacing existing permissions if they exist. @@ -364,6 +426,21 @@ type ExperimentsAPI struct { experimentsImpl } +// Delete a logged model. +func (a *ExperimentsAPI) DeleteLoggedModelByModelId(ctx context.Context, modelId string) error { + return a.experimentsImpl.DeleteLoggedModel(ctx, DeleteLoggedModelRequest{ + ModelId: modelId, + }) +} + +// Delete a tag on a logged model. +func (a *ExperimentsAPI) DeleteLoggedModelTagByModelIdAndTagKey(ctx context.Context, modelId string, tagKey string) error { + return a.experimentsImpl.DeleteLoggedModelTag(ctx, DeleteLoggedModelTagRequest{ + ModelId: modelId, + TagKey: tagKey, + }) +} + // Get credentials to download trace data. func (a *ExperimentsAPI) GetCredentialsForTraceDataDownloadByRequestId(ctx context.Context, requestId string) (*GetCredentialsForTraceDataDownloadResponse, error) { return a.experimentsImpl.GetCredentialsForTraceDataDownload(ctx, GetCredentialsForTraceDataDownloadRequest{ @@ -378,6 +455,13 @@ func (a *ExperimentsAPI) GetCredentialsForTraceDataUploadByRequestId(ctx context }) } +// Get a logged model. +func (a *ExperimentsAPI) GetLoggedModelByModelId(ctx context.Context, modelId string) (*GetLoggedModelResponse, error) { + return a.experimentsImpl.GetLoggedModel(ctx, GetLoggedModelRequest{ + ModelId: modelId, + }) +} + // Get experiment permission levels. // // Gets the permission levels that a user can have on an object. @@ -397,6 +481,17 @@ func (a *ExperimentsAPI) GetPermissionsByExperimentId(ctx context.Context, exper }) } +// List artifacts for a logged model. +// +// List artifacts for a logged model. Takes an optional +// “artifact_directory_path“ prefix which if specified, the response contains +// only artifacts with the specified prefix. +func (a *ExperimentsAPI) ListLoggedModelArtifactsByModelId(ctx context.Context, modelId string) (*ListLoggedModelArtifactsResponse, error) { + return a.experimentsImpl.ListLoggedModelArtifacts(ctx, ListLoggedModelArtifactsRequest{ + ModelId: modelId, + }) +} + type ForecastingInterface interface { // WaitGetExperimentForecastingSucceeded repeatedly calls [ForecastingAPI.GetExperiment] and waits to reach SUCCEEDED state diff --git a/service/ml/impl.go b/service/ml/impl.go index ce1d4c630..35364656b 100755 --- a/service/ml/impl.go +++ b/service/ml/impl.go @@ -28,6 +28,17 @@ func (a *experimentsImpl) CreateExperiment(ctx context.Context, request CreateEx return &createExperimentResponse, err } +func (a *experimentsImpl) CreateLoggedModel(ctx context.Context, request CreateLoggedModelRequest) (*CreateLoggedModelResponse, error) { + var createLoggedModelResponse CreateLoggedModelResponse + path := "/api/2.0/mlflow/logged-models" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createLoggedModelResponse) + return &createLoggedModelResponse, err +} + func (a *experimentsImpl) CreateRun(ctx context.Context, request CreateRun) (*CreateRunResponse, error) { var createRunResponse CreateRunResponse path := "/api/2.0/mlflow/runs/create" @@ -50,6 +61,26 @@ func (a *experimentsImpl) DeleteExperiment(ctx context.Context, request DeleteEx return err } +func (a *experimentsImpl) DeleteLoggedModel(ctx context.Context, request DeleteLoggedModelRequest) error { + var deleteLoggedModelResponse DeleteLoggedModelResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v", request.ModelId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteLoggedModelResponse) + return err +} + +func (a *experimentsImpl) DeleteLoggedModelTag(ctx context.Context, request DeleteLoggedModelTagRequest) error { + var deleteLoggedModelTagResponse DeleteLoggedModelTagResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v/tags/%v", request.ModelId, request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteLoggedModelTagResponse) + return err +} + func (a *experimentsImpl) DeleteRun(ctx context.Context, request DeleteRun) error { var deleteRunResponse DeleteRunResponse path := "/api/2.0/mlflow/runs/delete" @@ -83,6 +114,17 @@ func (a *experimentsImpl) DeleteTag(ctx context.Context, request DeleteTag) erro return err } +func (a *experimentsImpl) FinalizeLoggedModel(ctx context.Context, request FinalizeLoggedModelRequest) (*FinalizeLoggedModelResponse, error) { + var finalizeLoggedModelResponse FinalizeLoggedModelResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v", request.ModelId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &finalizeLoggedModelResponse) + return &finalizeLoggedModelResponse, err +} + func (a *experimentsImpl) GetByName(ctx context.Context, request GetByNameRequest) (*GetExperimentByNameResponse, error) { var getExperimentByNameResponse GetExperimentByNameResponse path := "/api/2.0/mlflow/experiments/get-by-name" @@ -168,6 +210,16 @@ func (a *experimentsImpl) internalGetHistory(ctx context.Context, request GetHis return &getMetricHistoryResponse, err } +func (a *experimentsImpl) GetLoggedModel(ctx context.Context, request GetLoggedModelRequest) (*GetLoggedModelResponse, error) { + var getLoggedModelResponse GetLoggedModelResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v", request.ModelId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getLoggedModelResponse) + return &getLoggedModelResponse, err +} + func (a *experimentsImpl) GetPermissionLevels(ctx context.Context, request GetExperimentPermissionLevelsRequest) (*GetExperimentPermissionLevelsResponse, error) { var getExperimentPermissionLevelsResponse GetExperimentPermissionLevelsResponse path := fmt.Sprintf("/api/2.0/permissions/experiments/%v/permissionLevels", request.ExperimentId) @@ -298,6 +350,16 @@ func (a *experimentsImpl) internalListExperiments(ctx context.Context, request L return &listExperimentsResponse, err } +func (a *experimentsImpl) ListLoggedModelArtifacts(ctx context.Context, request ListLoggedModelArtifactsRequest) (*ListLoggedModelArtifactsResponse, error) { + var listLoggedModelArtifactsResponse ListLoggedModelArtifactsResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v/artifacts/directories", request.ModelId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listLoggedModelArtifactsResponse) + return &listLoggedModelArtifactsResponse, err +} + func (a *experimentsImpl) LogBatch(ctx context.Context, request LogBatch) error { var logBatchResponse LogBatchResponse path := "/api/2.0/mlflow/runs/log-batch" @@ -320,6 +382,17 @@ func (a *experimentsImpl) LogInputs(ctx context.Context, request LogInputs) erro return err } +func (a *experimentsImpl) LogLoggedModelParams(ctx context.Context, request LogLoggedModelParamsRequest) error { + var logLoggedModelParamsRequestResponse LogLoggedModelParamsRequestResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v/params", request.ModelId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &logLoggedModelParamsRequestResponse) + return err +} + func (a *experimentsImpl) LogMetric(ctx context.Context, request LogMetric) error { var logMetricResponse LogMetricResponse path := "/api/2.0/mlflow/runs/log-metric" @@ -342,6 +415,17 @@ func (a *experimentsImpl) LogModel(ctx context.Context, request LogModel) error return err } +func (a *experimentsImpl) LogOutputs(ctx context.Context, request LogOutputsRequest) error { + var logOutputsResponse LogOutputsResponse + path := "/api/2.0/mlflow/runs/outputs" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &logOutputsResponse) + return err +} + func (a *experimentsImpl) LogParam(ctx context.Context, request LogParam) error { var logParamResponse LogParamResponse path := "/api/2.0/mlflow/runs/log-parameter" @@ -432,6 +516,17 @@ func (a *experimentsImpl) internalSearchExperiments(ctx context.Context, request return &searchExperimentsResponse, err } +func (a *experimentsImpl) SearchLoggedModels(ctx context.Context, request SearchLoggedModelsRequest) (*SearchLoggedModelsResponse, error) { + var searchLoggedModelsResponse SearchLoggedModelsResponse + path := "/api/2.0/mlflow/logged-models/search" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &searchLoggedModelsResponse) + return &searchLoggedModelsResponse, err +} + // Search for runs. // // Searches for runs that satisfy expressions. @@ -493,6 +588,17 @@ func (a *experimentsImpl) SetExperimentTag(ctx context.Context, request SetExper return err } +func (a *experimentsImpl) SetLoggedModelTags(ctx context.Context, request SetLoggedModelTagsRequest) error { + var setLoggedModelTagsResponse SetLoggedModelTagsResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v/tags", request.ModelId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &setLoggedModelTagsResponse) + return err +} + func (a *experimentsImpl) SetPermissions(ctx context.Context, request ExperimentPermissionsRequest) (*ExperimentPermissions, error) { var experimentPermissions ExperimentPermissions path := fmt.Sprintf("/api/2.0/permissions/experiments/%v", request.ExperimentId) diff --git a/service/ml/interface.go b/service/ml/interface.go index 928e99553..ec7e6d77f 100755 --- a/service/ml/interface.go +++ b/service/ml/interface.go @@ -28,6 +28,9 @@ type ExperimentsService interface { // exists. CreateExperiment(ctx context.Context, request CreateExperiment) (*CreateExperimentResponse, error) + // Create a logged model. + CreateLoggedModel(ctx context.Context, request CreateLoggedModelRequest) (*CreateLoggedModelResponse, error) + // Create a run. // // Creates a new run within an experiment. A run is usually a single @@ -43,6 +46,12 @@ type ExperimentsService interface { // with the experiment are also deleted. DeleteExperiment(ctx context.Context, request DeleteExperiment) error + // Delete a logged model. + DeleteLoggedModel(ctx context.Context, request DeleteLoggedModelRequest) error + + // Delete a tag on a logged model. + DeleteLoggedModelTag(ctx context.Context, request DeleteLoggedModelTagRequest) error + // Delete a run. // // Marks a run for deletion. @@ -62,6 +71,9 @@ type ExperimentsService interface { // a run and after a run completes. DeleteTag(ctx context.Context, request DeleteTag) error + // Finalize a logged model. + FinalizeLoggedModel(ctx context.Context, request FinalizeLoggedModelRequest) (*FinalizeLoggedModelResponse, error) + // Get an experiment by name. // // Gets metadata for an experiment. @@ -94,6 +106,9 @@ type ExperimentsService interface { // Use GetHistoryAll() to get all Metric instances, which will iterate over every result page. GetHistory(ctx context.Context, request GetHistoryRequest) (*GetMetricHistoryResponse, error) + // Get a logged model. + GetLoggedModel(ctx context.Context, request GetLoggedModelRequest) (*GetLoggedModelResponse, error) + // Get experiment permission levels. // // Gets the permission levels that a user can have on an object. @@ -134,6 +149,13 @@ type ExperimentsService interface { // Use ListExperimentsAll() to get all Experiment instances, which will iterate over every result page. ListExperiments(ctx context.Context, request ListExperimentsRequest) (*ListExperimentsResponse, error) + // List artifacts for a logged model. + // + // List artifacts for a logged model. Takes an optional + // ``artifact_directory_path`` prefix which if specified, the response + // contains only artifacts with the specified prefix. + ListLoggedModelArtifacts(ctx context.Context, request ListLoggedModelArtifactsRequest) (*ListLoggedModelArtifactsResponse, error) + // Log a batch of metrics/params/tags for a run. // // Logs a batch of metrics, params, and tags for a run. If any data failed @@ -195,6 +217,15 @@ type ExperimentsService interface { // Logs inputs, such as datasets and models, to an MLflow Run. LogInputs(ctx context.Context, request LogInputs) error + // Log params for a logged model. + // + // Logs params for a logged model. A param is a key-value pair (string key, + // string value). Examples include hyperparameters used for ML model + // training. A param can be logged only once for a logged model, and + // attempting to overwrite an existing param with a different value will + // result in an error + LogLoggedModelParams(ctx context.Context, request LogLoggedModelParamsRequest) error + // Log a metric for a run. // // Log a metric for a run. A metric is a key-value pair (string key, float @@ -208,6 +239,14 @@ type ExperimentsService interface { // release without warning. LogModel(ctx context.Context, request LogModel) error + // Log outputs from a run. + // + // **NOTE**: Experimental: This API may change or be removed in a future + // release without warning. + // + // Logs outputs, such as models, from an MLflow Run. + LogOutputs(ctx context.Context, request LogOutputsRequest) error + // Log a param for a run. // // Logs a param used for a run. A param is a key-value pair (string key, @@ -250,6 +289,11 @@ type ExperimentsService interface { // Use SearchExperimentsAll() to get all Experiment instances, which will iterate over every result page. SearchExperiments(ctx context.Context, request SearchExperiments) (*SearchExperimentsResponse, error) + // Search logged models. + // + // Search for Logged Models that satisfy specified search criteria. + SearchLoggedModels(ctx context.Context, request SearchLoggedModelsRequest) (*SearchLoggedModelsResponse, error) + // Search for runs. // // Searches for runs that satisfy expressions. @@ -265,6 +309,9 @@ type ExperimentsService interface { // updated. SetExperimentTag(ctx context.Context, request SetExperimentTag) error + // Set a tag for a logged model. + SetLoggedModelTags(ctx context.Context, request SetLoggedModelTagsRequest) error + // Set experiment permissions. // // Sets permissions on an object, replacing existing permissions if they diff --git a/service/ml/model.go b/service/ml/model.go index 80d5f6c48..46f7d3002 100755 --- a/service/ml/model.go +++ b/service/ml/model.go @@ -483,6 +483,36 @@ func (s CreateForecastingExperimentResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateLoggedModelRequest struct { + // The ID of the experiment that owns the model. + ExperimentId string `json:"experiment_id"` + // The type of the model, such as ``"Agent"``, ``"Classifier"``, ``"LLM"``. + ModelType string `json:"model_type,omitempty"` + // The name of the model (optional). If not specified one will be generated. + Name string `json:"name,omitempty"` + // Parameters attached to the model. + Params []LoggedModelParameter `json:"params,omitempty"` + // The ID of the run that created the model. + SourceRunId string `json:"source_run_id,omitempty"` + // Tags attached to the model. + Tags []LoggedModelTag `json:"tags,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateLoggedModelRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateLoggedModelRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateLoggedModelResponse struct { + // The newly created logged model. + Model *LoggedModel `json:"model,omitempty"` +} + type CreateModelRequest struct { // Optional description for registered model. Description string `json:"description,omitempty"` @@ -730,6 +760,26 @@ type DeleteExperiment struct { type DeleteExperimentResponse struct { } +// Delete a logged model +type DeleteLoggedModelRequest struct { + // The ID of the logged model to delete. + ModelId string `json:"-" url:"-"` +} + +type DeleteLoggedModelResponse struct { +} + +// Delete a tag on a logged model +type DeleteLoggedModelTagRequest struct { + // The ID of the logged model to delete the tag from. + ModelId string `json:"-" url:"-"` + // The tag key. + TagKey string `json:"-" url:"-"` +} + +type DeleteLoggedModelTagResponse struct { +} + // Delete a model type DeleteModelRequest struct { // Registered model unique name identifier. @@ -1117,6 +1167,20 @@ func (s FileInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type FinalizeLoggedModelRequest struct { + // The ID of the logged model to finalize. + ModelId string `json:"-" url:"-"` + // Whether or not the model is ready for use. + // ``"LOGGED_MODEL_UPLOAD_FAILED"`` indicates that something went wrong when + // logging the model weights / agent code). + Status LoggedModelStatus `json:"status"` +} + +type FinalizeLoggedModelResponse struct { + // The updated logged model. + Model *LoggedModel `json:"model,omitempty"` +} + // Represents a forecasting experiment with its unique identifier, URL, and // state. type ForecastingExperiment struct { @@ -1279,6 +1343,17 @@ type GetLatestVersionsResponse struct { ModelVersions []ModelVersion `json:"model_versions,omitempty"` } +// Get a logged model +type GetLoggedModelRequest struct { + // The ID of the logged model to retrieve. + ModelId string `json:"-" url:"-"` +} + +type GetLoggedModelResponse struct { + // The retrieved logged model. + Model *LoggedModel `json:"model,omitempty"` +} + type GetMetricHistoryResponse struct { // All logged values for this metric if `max_results` is not specified in // the request or if the total count of metrics returned is less than the @@ -1583,6 +1658,51 @@ func (s ListExperimentsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// List artifacts for a logged model +type ListLoggedModelArtifactsRequest struct { + // Filter artifacts matching this path (a relative path from the root + // artifact directory). + ArtifactDirectoryPath string `json:"-" url:"artifact_directory_path,omitempty"` + // The ID of the logged model for which to list the artifacts. + ModelId string `json:"-" url:"-"` + // Token indicating the page of artifact results to fetch. `page_token` is + // not supported when listing artifacts in UC Volumes. A maximum of 1000 + // artifacts will be retrieved for UC Volumes. Please call + // `/api/2.0/fs/directories{directory_path}` for listing artifacts in UC + // Volumes, which supports pagination. See [List directory contents | Files + // API](/api/workspace/files/listdirectorycontents). + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListLoggedModelArtifactsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListLoggedModelArtifactsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListLoggedModelArtifactsResponse struct { + // File location and metadata for artifacts. + Files []FileInfo `json:"files,omitempty"` + // Token that can be used to retrieve the next page of artifact results + NextPageToken string `json:"next_page_token,omitempty"` + // Root artifact directory for the logged model. + RootUri string `json:"root_uri,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListLoggedModelArtifactsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListLoggedModelArtifactsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // List models type ListModelsRequest struct { // Maximum number of registered models desired. Max threshold is 1000. @@ -1710,6 +1830,16 @@ type LogInputs struct { type LogInputsResponse struct { } +type LogLoggedModelParamsRequest struct { + // The ID of the logged model to log params for. + ModelId string `json:"-" url:"-"` + // Parameters to attach to the model. + Params []LoggedModelParameter `json:"params,omitempty"` +} + +type LogLoggedModelParamsRequestResponse struct { +} + type LogMetric struct { // Dataset digest of the dataset associated with the metric, e.g. an md5 // hash of the dataset that uniquely identifies it within datasets of the @@ -1768,6 +1898,16 @@ func (s LogModel) MarshalJSON() ([]byte, error) { type LogModelResponse struct { } +type LogOutputsRequest struct { + // The model outputs from the Run. + Models []ModelOutput `json:"models,omitempty"` + // The ID of the Run from which to log outputs. + RunId string `json:"run_id"` +} + +type LogOutputsResponse struct { +} + type LogParam struct { // Name of the param. Maximum size is 255 bytes. Key string `json:"key"` @@ -1793,6 +1933,130 @@ func (s LogParam) MarshalJSON() ([]byte, error) { type LogParamResponse struct { } +// A logged model message includes logged model attributes, tags, registration +// info, params, and linked run metrics. +type LoggedModel struct { + // The params and metrics attached to the logged model. + Data *LoggedModelData `json:"data,omitempty"` + // The logged model attributes such as model ID, status, tags, etc. + Info *LoggedModelInfo `json:"info,omitempty"` +} + +// A LoggedModelData message includes logged model params and linked metrics. +type LoggedModelData struct { + // Performance metrics linked to the model. + Metrics []Metric `json:"metrics,omitempty"` + // Immutable string key-value pairs of the model. + Params []LoggedModelParameter `json:"params,omitempty"` +} + +// A LoggedModelInfo includes logged model attributes, tags, and registration +// info. +type LoggedModelInfo struct { + // The URI of the directory where model artifacts are stored. + ArtifactUri string `json:"artifact_uri,omitempty"` + // The timestamp when the model was created in milliseconds since the UNIX + // epoch. + CreationTimestampMs int64 `json:"creation_timestamp_ms,omitempty"` + // The ID of the user or principal that created the model. + CreatorId int64 `json:"creator_id,omitempty"` + // The ID of the experiment that owns the model. + ExperimentId string `json:"experiment_id,omitempty"` + // The timestamp when the model was last updated in milliseconds since the + // UNIX epoch. + LastUpdatedTimestampMs int64 `json:"last_updated_timestamp_ms,omitempty"` + // The unique identifier for the logged model. + ModelId string `json:"model_id,omitempty"` + // The type of model, such as ``"Agent"``, ``"Classifier"``, ``"LLM"``. + ModelType string `json:"model_type,omitempty"` + // The name of the model. + Name string `json:"name,omitempty"` + // The ID of the run that created the model. + SourceRunId string `json:"source_run_id,omitempty"` + // The status of whether or not the model is ready for use. + Status LoggedModelStatus `json:"status,omitempty"` + // Details on the current model status. + StatusMessage string `json:"status_message,omitempty"` + // Mutable string key-value pairs set on the model. + Tags []LoggedModelTag `json:"tags,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *LoggedModelInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s LoggedModelInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Parameter associated with a LoggedModel. +type LoggedModelParameter struct { + // The key identifying this param. + Key string `json:"key,omitempty"` + // The value of this param. + Value string `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *LoggedModelParameter) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s LoggedModelParameter) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// A LoggedModelStatus enum value represents the status of a logged model. +type LoggedModelStatus string + +const LoggedModelStatusLoggedModelPending LoggedModelStatus = `LOGGED_MODEL_PENDING` + +const LoggedModelStatusLoggedModelReady LoggedModelStatus = `LOGGED_MODEL_READY` + +const LoggedModelStatusLoggedModelUploadFailed LoggedModelStatus = `LOGGED_MODEL_UPLOAD_FAILED` + +// String representation for [fmt.Print] +func (f *LoggedModelStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *LoggedModelStatus) Set(v string) error { + switch v { + case `LOGGED_MODEL_PENDING`, `LOGGED_MODEL_READY`, `LOGGED_MODEL_UPLOAD_FAILED`: + *f = LoggedModelStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "LOGGED_MODEL_PENDING", "LOGGED_MODEL_READY", "LOGGED_MODEL_UPLOAD_FAILED"`, v) + } +} + +// Type always returns LoggedModelStatus to satisfy [pflag.Value] interface +func (f *LoggedModelStatus) Type() string { + return "LoggedModelStatus" +} + +// Tag for a LoggedModel. +type LoggedModelTag struct { + // The tag key. + Key string `json:"key,omitempty"` + // The tag value. + Value string `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *LoggedModelTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s LoggedModelTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Metric associated with a run, represented as a key-value pair. type Metric struct { // The dataset digest of the dataset associated with the metric, e.g. an md5 @@ -1894,6 +2158,14 @@ type ModelInput struct { ModelId string `json:"model_id"` } +// Represents a LoggedModel output of a Run. +type ModelOutput struct { + // The unique identifier of the model. + ModelId string `json:"model_id"` + // The step at which the model was produced. + Step int64 `json:"step"` +} + type ModelTag struct { // The tag key. Key string `json:"key,omitempty"` @@ -2685,6 +2957,102 @@ func (s SearchExperimentsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type SearchLoggedModelsDataset struct { + // The digest of the dataset. + DatasetDigest string `json:"dataset_digest,omitempty"` + // The name of the dataset. + DatasetName string `json:"dataset_name"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *SearchLoggedModelsDataset) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SearchLoggedModelsDataset) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type SearchLoggedModelsOrderBy struct { + // Whether the search results order is ascending or not. + Ascending bool `json:"ascending,omitempty"` + // If ``field_name`` refers to a metric, this field specifies the digest of + // the dataset associated with the metric. Only metrics associated with the + // specified dataset name and digest will be considered for ordering. This + // field may only be set if ``dataset_name`` is also set. + DatasetDigest string `json:"dataset_digest,omitempty"` + // If ``field_name`` refers to a metric, this field specifies the name of + // the dataset associated with the metric. Only metrics associated with the + // specified dataset name will be considered for ordering. This field may + // only be set if ``field_name`` refers to a metric. + DatasetName string `json:"dataset_name,omitempty"` + // The name of the field to order by, e.g. "metrics.accuracy". + FieldName string `json:"field_name"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *SearchLoggedModelsOrderBy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SearchLoggedModelsOrderBy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type SearchLoggedModelsRequest struct { + // List of datasets on which to apply the metrics filter clauses. For + // example, a filter with `metrics.accuracy > 0.9` and dataset info with + // name "test_dataset" means we will return all logged models with accuracy + // > 0.9 on the test_dataset. Metric values from ANY dataset matching the + // criteria are considered. If no datasets are specified, then metrics + // across all datasets are considered in the filter. + Datasets []SearchLoggedModelsDataset `json:"datasets,omitempty"` + // The IDs of the experiments in which to search for logged models. + ExperimentIds []string `json:"experiment_ids,omitempty"` + // A filter expression over logged model info and data that allows returning + // a subset of logged models. The syntax is a subset of SQL that supports + // AND'ing together binary operations. + // + // Example: ``params.alpha < 0.3 AND metrics.accuracy > 0.9``. + Filter string `json:"filter,omitempty"` + // The maximum number of Logged Models to return. The maximum limit is 50. + MaxResults int `json:"max_results,omitempty"` + // The list of columns for ordering the results, with additional fields for + // sorting criteria. + OrderBy []SearchLoggedModelsOrderBy `json:"order_by,omitempty"` + // The token indicating the page of logged models to fetch. + PageToken string `json:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *SearchLoggedModelsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SearchLoggedModelsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type SearchLoggedModelsResponse struct { + // Logged models that match the search criteria. + Models []LoggedModel `json:"models,omitempty"` + // The token that can be used to retrieve the next page of logged models. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *SearchLoggedModelsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SearchLoggedModelsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Searches model versions type SearchModelVersionsRequest struct { // String filter condition, like "name='my-model-name'". Must be a single @@ -2844,6 +3212,16 @@ type SetExperimentTag struct { type SetExperimentTagResponse struct { } +type SetLoggedModelTagsRequest struct { + // The ID of the logged model to set the tags on. + ModelId string `json:"-" url:"-"` + // The tags to set on the logged model. + Tags []LoggedModelTag `json:"tags,omitempty"` +} + +type SetLoggedModelTagsResponse struct { +} + type SetModelTagRequest struct { // Name of the tag. Maximum size depends on storage backend. If a tag with // this name already exists, its preexisting value will be replaced by the diff --git a/service/pipelines/model.go b/service/pipelines/model.go index b35e66473..c8f53b00a 100755 --- a/service/pipelines/model.go +++ b/service/pipelines/model.go @@ -58,6 +58,10 @@ type CreatePipeline struct { Photon bool `json:"photon,omitempty"` // Restart window of this pipeline. RestartWindow *RestartWindow `json:"restart_window,omitempty"` + // Root path for this pipeline. This is used as the root directory when + // editing the pipeline in the Databricks user interface and it is added to + // sys.path when executing Python sources during pipeline execution. + RootPath string `json:"root_path,omitempty"` // Write-only setting, available only in Create/Update calls. Specifies the // user or service principal that the pipeline runs as. If not specified, // the pipeline runs as the user who created the pipeline. @@ -269,6 +273,10 @@ type EditPipeline struct { PipelineId string `json:"-" url:"-"` // Restart window of this pipeline. RestartWindow *RestartWindow `json:"restart_window,omitempty"` + // Root path for this pipeline. This is used as the root directory when + // editing the pipeline in the Databricks user interface and it is added to + // sys.path when executing Python sources during pipeline execution. + RootPath string `json:"root_path,omitempty"` // Write-only setting, available only in Create/Update calls. Specifies the // user or service principal that the pipeline runs as. If not specified, // the pipeline runs as the user who created the pipeline. @@ -1300,6 +1308,10 @@ type PipelineSpec struct { Photon bool `json:"photon,omitempty"` // Restart window of this pipeline. RestartWindow *RestartWindow `json:"restart_window,omitempty"` + // Root path for this pipeline. This is used as the root directory when + // editing the pipeline in the Databricks user interface and it is added to + // sys.path when executing Python sources during pipeline execution. + RootPath string `json:"root_path,omitempty"` // The default schema (database) where tables are read from or published to. Schema string `json:"schema,omitempty"` // Whether serverless compute is enabled for this pipeline. diff --git a/service/pkg.go b/service/pkg.go index 3ea06a164..8cd72c43e 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -54,10 +54,10 @@ // // - [marketplace.ConsumerProvidersAPI]: Providers are the entities that publish listings to the Marketplace. // -// - [catalog.CredentialsAPI]: A credential represents an authentication and authorization mechanism for accessing services on your cloud tenant. -// // - [provisioning.CredentialsAPI]: These APIs manage credential configurations for this workspace. // +// - [catalog.CredentialsAPI]: A credential represents an authentication and authorization mechanism for accessing services on your cloud tenant. +// // - [settings.CredentialsManagerAPI]: Credentials manager interacts with with Identity Providers to to perform token exchanges using stored credentials and refresh tokens. // // - [settings.CspEnablementAccountAPI]: The compliance security profile settings at the account level control whether to enable it for new workspaces. @@ -82,7 +82,7 @@ // // - [settings.DisableLegacyAccessAPI]: 'Disabling legacy access' has the following impacts: 1. // -// - [settings.DisableLegacyDbfsAPI]: When this setting is on, access to DBFS root and DBFS mounts is disallowed (as well as creation of new mounts). +// - [settings.DisableLegacyDbfsAPI]: Disabling legacy DBFS has the following implications: 1. // // - [settings.DisableLegacyFeaturesAPI]: Disable legacy features for new Databricks workspaces. // @@ -158,6 +158,8 @@ // // - [settings.NetworkConnectivityAPI]: These APIs provide configurations for the network connectivity of your workspaces for serverless compute resources. // +// - [settings.NetworkPoliciesAPI]: These APIs manage network policies for this account. +// // - [provisioning.NetworksAPI]: These APIs manage network configurations for customer-managed VPCs (optional). // // - [settings.NotificationDestinationsAPI]: The notification destinations API lets you programmatically manage a workspace's notification destinations. @@ -216,6 +218,8 @@ // // - [sharing.RecipientActivationAPI]: The Recipient Activation API is only applicable in the open sharing model where the recipient object has the authentication type of `TOKEN`. // +// - [sharing.RecipientFederationPoliciesAPI]: The Recipient Federation Policies APIs are only applicable in the open sharing model where the recipient object has the authentication type of `OIDC_RECIPIENT`, enabling data sharing from Databricks to non-Databricks recipients. +// // - [sharing.RecipientsAPI]: A recipient is an object you create using :method:recipients/create to represent an organization which you want to allow access shares. // // - [sql.RedashConfigAPI]: Redash V2 service for workspace configurations (internal). @@ -294,6 +298,8 @@ // // - [settings.WorkspaceConfAPI]: This API allows updating known workspace settings for advanced users. // +// - [settings.WorkspaceNetworkConfigurationAPI]: These APIs allow configuration of network settings for Databricks workspaces. +// // - [provisioning.WorkspacesAPI]: These APIs manage workspaces for this account. // // - [billing.BudgetsAPI]: These APIs manage budget configurations for this account. @@ -356,8 +362,8 @@ var ( _ *marketplace.ConsumerListingsAPI = nil _ *marketplace.ConsumerPersonalizationRequestsAPI = nil _ *marketplace.ConsumerProvidersAPI = nil - _ *catalog.CredentialsAPI = nil _ *provisioning.CredentialsAPI = nil + _ *catalog.CredentialsAPI = nil _ *settings.CredentialsManagerAPI = nil _ *settings.CspEnablementAccountAPI = nil _ *iam.CurrentUserAPI = nil @@ -408,6 +414,7 @@ var ( _ *ml.ModelRegistryAPI = nil _ *catalog.ModelVersionsAPI = nil _ *settings.NetworkConnectivityAPI = nil + _ *settings.NetworkPoliciesAPI = nil _ *provisioning.NetworksAPI = nil _ *settings.NotificationDestinationsAPI = nil _ *oauth2.OAuthPublishedAppsAPI = nil @@ -437,6 +444,7 @@ var ( _ *sql.QueryVisualizationsAPI = nil _ *sql.QueryVisualizationsLegacyAPI = nil _ *sharing.RecipientActivationAPI = nil + _ *sharing.RecipientFederationPoliciesAPI = nil _ *sharing.RecipientsAPI = nil _ *sql.RedashConfigAPI = nil _ *catalog.RegisteredModelsAPI = nil @@ -476,6 +484,7 @@ var ( _ *iam.WorkspaceAssignmentAPI = nil _ *catalog.WorkspaceBindingsAPI = nil _ *settings.WorkspaceConfAPI = nil + _ *settings.WorkspaceNetworkConfigurationAPI = nil _ *provisioning.WorkspacesAPI = nil _ *billing.BudgetsAPI = nil _ *ml.ForecastingAPI = nil diff --git a/service/settings/api.go b/service/settings/api.go index 0ce1c2291..9fc67a28e 100755 --- a/service/settings/api.go +++ b/service/settings/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Account Ip Access Lists, Account Settings, Aibi Dashboard Embedding Access Policy, Aibi Dashboard Embedding Approved Domains, Automatic Cluster Update, Compliance Security Profile, Credentials Manager, Csp Enablement Account, Default Namespace, Disable Legacy Access, Disable Legacy Dbfs, Disable Legacy Features, Enable Export Notebook, Enable Ip Access Lists, Enable Notebook Table Clipboard, Enable Results Downloading, Enhanced Security Monitoring, Esm Enablement Account, Ip Access Lists, Llm Proxy Partner Powered Account, Llm Proxy Partner Powered Enforce, Llm Proxy Partner Powered Workspace, Network Connectivity, Notification Destinations, Personal Compute, Restrict Workspace Admins, Settings, Token Management, Tokens, Workspace Conf, etc. +// These APIs allow you to manage Account Ip Access Lists, Account Settings, Aibi Dashboard Embedding Access Policy, Aibi Dashboard Embedding Approved Domains, Automatic Cluster Update, Compliance Security Profile, Credentials Manager, Csp Enablement Account, Default Namespace, Disable Legacy Access, Disable Legacy Dbfs, Disable Legacy Features, Enable Export Notebook, Enable Ip Access Lists, Enable Notebook Table Clipboard, Enable Results Downloading, Enhanced Security Monitoring, Esm Enablement Account, Ip Access Lists, Llm Proxy Partner Powered Account, Llm Proxy Partner Powered Enforce, Llm Proxy Partner Powered Workspace, Network Connectivity, Network Policies, Notification Destinations, Personal Compute, Restrict Workspace Admins, Settings, Token Management, Tokens, Workspace Conf, Workspace Network Configuration, etc. package settings import ( @@ -689,9 +689,15 @@ func NewDisableLegacyDbfs(client *client.DatabricksClient) *DisableLegacyDbfsAPI } } -// When this setting is on, access to DBFS root and DBFS mounts is disallowed -// (as well as creation of new mounts). When the setting is off, all DBFS -// functionality is enabled +// Disabling legacy DBFS has the following implications: +// +// 1. Access to DBFS root and DBFS mounts is disallowed (as well as the creation +// of new mounts). 2. Disables Databricks Runtime versions prior to 13.3LTS. +// +// When the setting is off, all DBFS functionality is enabled and no +// restrictions are imposed on Databricks Runtime versions. This setting can +// take up to 20 minutes to take effect and requires a manual restart of +// all-purpose compute clusters and SQL warehouses. type DisableLegacyDbfsAPI struct { disableLegacyDbfsImpl } @@ -1419,6 +1425,92 @@ func (a *NetworkConnectivityAPI) ListPrivateEndpointRulesByNetworkConnectivityCo }) } +type NetworkPoliciesInterface interface { + + // Create a network policy. + // + // Creates a new network policy to manage which network destinations can be + // accessed from the Databricks environment. + CreateNetworkPolicyRpc(ctx context.Context, request CreateNetworkPolicyRequest) (*AccountNetworkPolicy, error) + + // Delete a network policy. + // + // Deletes a network policy. Cannot be called on 'default-policy'. + DeleteNetworkPolicyRpc(ctx context.Context, request DeleteNetworkPolicyRequest) error + + // Delete a network policy. + // + // Deletes a network policy. Cannot be called on 'default-policy'. + DeleteNetworkPolicyRpcByNetworkPolicyId(ctx context.Context, networkPolicyId string) error + + // Get a network policy. + // + // Gets a network policy. + GetNetworkPolicyRpc(ctx context.Context, request GetNetworkPolicyRequest) (*AccountNetworkPolicy, error) + + // Get a network policy. + // + // Gets a network policy. + GetNetworkPolicyRpcByNetworkPolicyId(ctx context.Context, networkPolicyId string) (*AccountNetworkPolicy, error) + + // List network policies. + // + // Gets an array of network policies. + // + // This method is generated by Databricks SDK Code Generator. + ListNetworkPoliciesRpc(ctx context.Context, request ListNetworkPoliciesRequest) listing.Iterator[AccountNetworkPolicy] + + // List network policies. + // + // Gets an array of network policies. + // + // This method is generated by Databricks SDK Code Generator. + ListNetworkPoliciesRpcAll(ctx context.Context, request ListNetworkPoliciesRequest) ([]AccountNetworkPolicy, error) + + // Update a network policy. + // + // Updates a network policy. This allows you to modify the configuration of a + // network policy. + UpdateNetworkPolicyRpc(ctx context.Context, request UpdateNetworkPolicyRequest) (*AccountNetworkPolicy, error) +} + +func NewNetworkPolicies(client *client.DatabricksClient) *NetworkPoliciesAPI { + return &NetworkPoliciesAPI{ + networkPoliciesImpl: networkPoliciesImpl{ + client: client, + }, + } +} + +// These APIs manage network policies for this account. Network policies control +// which network destinations can be accessed from the Databricks environment. +// Each Databricks account includes a default policy named 'default-policy'. +// 'default-policy' is associated with any workspace lacking an explicit network +// policy assignment, and is automatically associated with each newly created +// workspace. 'default-policy' is reserved and cannot be deleted, but it can be +// updated to customize the default network access rules for your account. +type NetworkPoliciesAPI struct { + networkPoliciesImpl +} + +// Delete a network policy. +// +// Deletes a network policy. Cannot be called on 'default-policy'. +func (a *NetworkPoliciesAPI) DeleteNetworkPolicyRpcByNetworkPolicyId(ctx context.Context, networkPolicyId string) error { + return a.networkPoliciesImpl.DeleteNetworkPolicyRpc(ctx, DeleteNetworkPolicyRequest{ + NetworkPolicyId: networkPolicyId, + }) +} + +// Get a network policy. +// +// Gets a network policy. +func (a *NetworkPoliciesAPI) GetNetworkPolicyRpcByNetworkPolicyId(ctx context.Context, networkPolicyId string) (*AccountNetworkPolicy, error) { + return a.networkPoliciesImpl.GetNetworkPolicyRpc(ctx, GetNetworkPolicyRequest{ + NetworkPolicyId: networkPolicyId, + }) +} + type NotificationDestinationsInterface interface { // Create a notification destination. @@ -1638,9 +1730,16 @@ type SettingsInterface interface { // 3. Disables Databricks Runtime versions prior to 13.3LTS. DisableLegacyAccess() DisableLegacyAccessInterface - // When this setting is on, access to DBFS root and DBFS mounts is - // disallowed (as well as creation of new mounts). When the setting is off, - // all DBFS functionality is enabled + // Disabling legacy DBFS has the following implications: + // + // 1. Access to DBFS root and DBFS mounts is disallowed (as well as the + // creation of new mounts). 2. Disables Databricks Runtime versions prior to + // 13.3LTS. + // + // When the setting is off, all DBFS functionality is enabled and no + // restrictions are imposed on Databricks Runtime versions. This setting can + // take up to 20 minutes to take effect and requires a manual restart of + // all-purpose compute clusters and SQL warehouses. DisableLegacyDbfs() DisableLegacyDbfsInterface // Controls whether users can export notebooks and files from the Workspace @@ -1767,9 +1866,16 @@ type SettingsAPI struct { // 3. Disables Databricks Runtime versions prior to 13.3LTS. disableLegacyAccess DisableLegacyAccessInterface - // When this setting is on, access to DBFS root and DBFS mounts is - // disallowed (as well as creation of new mounts). When the setting is off, - // all DBFS functionality is enabled + // Disabling legacy DBFS has the following implications: + // + // 1. Access to DBFS root and DBFS mounts is disallowed (as well as the + // creation of new mounts). 2. Disables Databricks Runtime versions prior to + // 13.3LTS. + // + // When the setting is off, all DBFS functionality is enabled and no + // restrictions are imposed on Databricks Runtime versions. This setting can + // take up to 20 minutes to take effect and requires a manual restart of + // all-purpose compute clusters and SQL warehouses. disableLegacyDbfs DisableLegacyDbfsInterface // Controls whether users can export notebooks and files from the Workspace @@ -2199,3 +2305,57 @@ func NewWorkspaceConf(client *client.DatabricksClient) *WorkspaceConfAPI { type WorkspaceConfAPI struct { workspaceConfImpl } + +type WorkspaceNetworkConfigurationInterface interface { + + // Get workspace network configuration. + // + // Gets the network configuration for a workspace. Every workspace has exactly + // one network policy binding, with 'default-policy' used if no explicit + // assignment exists. + GetWorkspaceNetworkOptionRpc(ctx context.Context, request GetWorkspaceNetworkOptionRequest) (*WorkspaceNetworkOption, error) + + // Get workspace network configuration. + // + // Gets the network configuration for a workspace. Every workspace has exactly + // one network policy binding, with 'default-policy' used if no explicit + // assignment exists. + GetWorkspaceNetworkOptionRpcByWorkspaceId(ctx context.Context, workspaceId int64) (*WorkspaceNetworkOption, error) + + // Update workspace network configuration. + // + // Updates the network configuration for a workspace. This operation associates + // the workspace with the specified network policy. To revert to the default + // policy, specify 'default-policy' as the network_policy_id. + UpdateWorkspaceNetworkOptionRpc(ctx context.Context, request UpdateWorkspaceNetworkOptionRequest) (*WorkspaceNetworkOption, error) +} + +func NewWorkspaceNetworkConfiguration(client *client.DatabricksClient) *WorkspaceNetworkConfigurationAPI { + return &WorkspaceNetworkConfigurationAPI{ + workspaceNetworkConfigurationImpl: workspaceNetworkConfigurationImpl{ + client: client, + }, + } +} + +// These APIs allow configuration of network settings for Databricks workspaces. +// Each workspace is always associated with exactly one network policy that +// controls which network destinations can be accessed from the Databricks +// environment. By default, workspaces are associated with the 'default-policy' +// network policy. You cannot create or delete a workspace's network +// configuration, only update it to associate the workspace with a different +// policy. +type WorkspaceNetworkConfigurationAPI struct { + workspaceNetworkConfigurationImpl +} + +// Get workspace network configuration. +// +// Gets the network configuration for a workspace. Every workspace has exactly +// one network policy binding, with 'default-policy' used if no explicit +// assignment exists. +func (a *WorkspaceNetworkConfigurationAPI) GetWorkspaceNetworkOptionRpcByWorkspaceId(ctx context.Context, workspaceId int64) (*WorkspaceNetworkOption, error) { + return a.workspaceNetworkConfigurationImpl.GetWorkspaceNetworkOptionRpc(ctx, GetWorkspaceNetworkOptionRequest{ + WorkspaceId: workspaceId, + }) +} diff --git a/service/settings/impl.go b/service/settings/impl.go index c48ad614b..7a7db6444 100755 --- a/service/settings/impl.go +++ b/service/settings/impl.go @@ -942,6 +942,98 @@ func (a *networkConnectivityImpl) UpdateNccAzurePrivateEndpointRulePublic(ctx co return &nccAzurePrivateEndpointRule, err } +// unexported type that holds implementations of just NetworkPolicies API methods +type networkPoliciesImpl struct { + client *client.DatabricksClient +} + +func (a *networkPoliciesImpl) CreateNetworkPolicyRpc(ctx context.Context, request CreateNetworkPolicyRequest) (*AccountNetworkPolicy, error) { + var accountNetworkPolicy AccountNetworkPolicy + path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.NetworkPolicy, &accountNetworkPolicy) + return &accountNetworkPolicy, err +} + +func (a *networkPoliciesImpl) DeleteNetworkPolicyRpc(ctx context.Context, request DeleteNetworkPolicyRequest) error { + var deleteNetworkPolicyRpcResponse DeleteNetworkPolicyRpcResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies/%v", a.client.ConfiguredAccountID(), request.NetworkPolicyId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteNetworkPolicyRpcResponse) + return err +} + +func (a *networkPoliciesImpl) GetNetworkPolicyRpc(ctx context.Context, request GetNetworkPolicyRequest) (*AccountNetworkPolicy, error) { + var accountNetworkPolicy AccountNetworkPolicy + path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies/%v", a.client.ConfiguredAccountID(), request.NetworkPolicyId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accountNetworkPolicy) + return &accountNetworkPolicy, err +} + +// List network policies. +// +// Gets an array of network policies. +func (a *networkPoliciesImpl) ListNetworkPoliciesRpc(ctx context.Context, request ListNetworkPoliciesRequest) listing.Iterator[AccountNetworkPolicy] { + + getNextPage := func(ctx context.Context, req ListNetworkPoliciesRequest) (*ListNetworkPoliciesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListNetworkPoliciesRpc(ctx, req) + } + getItems := func(resp *ListNetworkPoliciesResponse) []AccountNetworkPolicy { + return resp.Items + } + getNextReq := func(resp *ListNetworkPoliciesResponse) *ListNetworkPoliciesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List network policies. +// +// Gets an array of network policies. +func (a *networkPoliciesImpl) ListNetworkPoliciesRpcAll(ctx context.Context, request ListNetworkPoliciesRequest) ([]AccountNetworkPolicy, error) { + iterator := a.ListNetworkPoliciesRpc(ctx, request) + return listing.ToSlice[AccountNetworkPolicy](ctx, iterator) +} + +func (a *networkPoliciesImpl) internalListNetworkPoliciesRpc(ctx context.Context, request ListNetworkPoliciesRequest) (*ListNetworkPoliciesResponse, error) { + var listNetworkPoliciesResponse ListNetworkPoliciesResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listNetworkPoliciesResponse) + return &listNetworkPoliciesResponse, err +} + +func (a *networkPoliciesImpl) UpdateNetworkPolicyRpc(ctx context.Context, request UpdateNetworkPolicyRequest) (*AccountNetworkPolicy, error) { + var accountNetworkPolicy AccountNetworkPolicy + path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies/%v", a.client.ConfiguredAccountID(), request.NetworkPolicyId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.NetworkPolicy, &accountNetworkPolicy) + return &accountNetworkPolicy, err +} + // unexported type that holds implementations of just NotificationDestinations API methods type notificationDestinationsImpl struct { client *client.DatabricksClient @@ -1318,3 +1410,29 @@ func (a *workspaceConfImpl) SetStatus(ctx context.Context, request WorkspaceConf err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &setStatusResponse) return err } + +// unexported type that holds implementations of just WorkspaceNetworkConfiguration API methods +type workspaceNetworkConfigurationImpl struct { + client *client.DatabricksClient +} + +func (a *workspaceNetworkConfigurationImpl) GetWorkspaceNetworkOptionRpc(ctx context.Context, request GetWorkspaceNetworkOptionRequest) (*WorkspaceNetworkOption, error) { + var workspaceNetworkOption WorkspaceNetworkOption + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/network", a.client.ConfiguredAccountID(), request.WorkspaceId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspaceNetworkOption) + return &workspaceNetworkOption, err +} + +func (a *workspaceNetworkConfigurationImpl) UpdateWorkspaceNetworkOptionRpc(ctx context.Context, request UpdateWorkspaceNetworkOptionRequest) (*WorkspaceNetworkOption, error) { + var workspaceNetworkOption WorkspaceNetworkOption + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/network", a.client.ConfiguredAccountID(), request.WorkspaceId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.WorkspaceNetworkOption, &workspaceNetworkOption) + return &workspaceNetworkOption, err +} diff --git a/service/settings/interface.go b/service/settings/interface.go index 132159c03..4ca2dd1ab 100755 --- a/service/settings/interface.go +++ b/service/settings/interface.go @@ -297,9 +297,15 @@ type DisableLegacyAccessService interface { Update(ctx context.Context, request UpdateDisableLegacyAccessRequest) (*DisableLegacyAccess, error) } -// When this setting is on, access to DBFS root and DBFS mounts is disallowed -// (as well as creation of new mounts). When the setting is off, all DBFS -// functionality is enabled +// Disabling legacy DBFS has the following implications: +// +// 1. Access to DBFS root and DBFS mounts is disallowed (as well as the creation +// of new mounts). 2. Disables Databricks Runtime versions prior to 13.3LTS. +// +// When the setting is off, all DBFS functionality is enabled and no +// restrictions are imposed on Databricks Runtime versions. This setting can +// take up to 20 minutes to take effect and requires a manual restart of +// all-purpose compute clusters and SQL warehouses. type DisableLegacyDbfsService interface { // Delete the disable legacy DBFS setting. @@ -704,6 +710,45 @@ type NetworkConnectivityService interface { UpdateNccAzurePrivateEndpointRulePublic(ctx context.Context, request UpdateNccAzurePrivateEndpointRulePublicRequest) (*NccAzurePrivateEndpointRule, error) } +// These APIs manage network policies for this account. Network policies control +// which network destinations can be accessed from the Databricks environment. +// Each Databricks account includes a default policy named 'default-policy'. +// 'default-policy' is associated with any workspace lacking an explicit network +// policy assignment, and is automatically associated with each newly created +// workspace. 'default-policy' is reserved and cannot be deleted, but it can be +// updated to customize the default network access rules for your account. +type NetworkPoliciesService interface { + + // Create a network policy. + // + // Creates a new network policy to manage which network destinations can be + // accessed from the Databricks environment. + CreateNetworkPolicyRpc(ctx context.Context, request CreateNetworkPolicyRequest) (*AccountNetworkPolicy, error) + + // Delete a network policy. + // + // Deletes a network policy. Cannot be called on 'default-policy'. + DeleteNetworkPolicyRpc(ctx context.Context, request DeleteNetworkPolicyRequest) error + + // Get a network policy. + // + // Gets a network policy. + GetNetworkPolicyRpc(ctx context.Context, request GetNetworkPolicyRequest) (*AccountNetworkPolicy, error) + + // List network policies. + // + // Gets an array of network policies. + // + // Use ListNetworkPoliciesRpcAll() to get all AccountNetworkPolicy instances, which will iterate over every result page. + ListNetworkPoliciesRpc(ctx context.Context, request ListNetworkPoliciesRequest) (*ListNetworkPoliciesResponse, error) + + // Update a network policy. + // + // Updates a network policy. This allows you to modify the configuration of + // a network policy. + UpdateNetworkPolicyRpc(ctx context.Context, request UpdateNetworkPolicyRequest) (*AccountNetworkPolicy, error) +} + // The notification destinations API lets you programmatically manage a // workspace's notification destinations. Notification destinations are used to // send notifications for query alerts and jobs to destinations outside of @@ -906,3 +951,27 @@ type WorkspaceConfService interface { // disabling it. SetStatus(ctx context.Context, request WorkspaceConf) error } + +// These APIs allow configuration of network settings for Databricks workspaces. +// Each workspace is always associated with exactly one network policy that +// controls which network destinations can be accessed from the Databricks +// environment. By default, workspaces are associated with the 'default-policy' +// network policy. You cannot create or delete a workspace's network +// configuration, only update it to associate the workspace with a different +// policy. +type WorkspaceNetworkConfigurationService interface { + + // Get workspace network configuration. + // + // Gets the network configuration for a workspace. Every workspace has + // exactly one network policy binding, with 'default-policy' used if no + // explicit assignment exists. + GetWorkspaceNetworkOptionRpc(ctx context.Context, request GetWorkspaceNetworkOptionRequest) (*WorkspaceNetworkOption, error) + + // Update workspace network configuration. + // + // Updates the network configuration for a workspace. This operation + // associates the workspace with the specified network policy. To revert to + // the default policy, specify 'default-policy' as the network_policy_id. + UpdateWorkspaceNetworkOptionRpc(ctx context.Context, request UpdateWorkspaceNetworkOptionRequest) (*WorkspaceNetworkOption, error) +} diff --git a/service/settings/model.go b/service/settings/model.go index 71c9b19af..2a71a9cb0 100755 --- a/service/settings/model.go +++ b/service/settings/model.go @@ -36,6 +36,25 @@ func (s AccountIpAccessEnable) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type AccountNetworkPolicy struct { + // The associated account ID for this Network Policy object. + AccountId string `json:"account_id,omitempty"` + // The network policies applying for egress traffic. + Egress *NetworkPolicyEgress `json:"egress,omitempty"` + // The unique identifier for the network policy. + NetworkPolicyId string `json:"network_policy_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AccountNetworkPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AccountNetworkPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type AibiDashboardEmbeddingAccessPolicy struct { AccessPolicyType AibiDashboardEmbeddingAccessPolicyAccessPolicyType `json:"access_policy_type"` } @@ -474,6 +493,11 @@ type CreateNetworkConnectivityConfiguration struct { Region string `json:"region"` } +// Create a network policy +type CreateNetworkPolicyRequest struct { + NetworkPolicy AccountNetworkPolicy `json:"network_policy"` +} + type CreateNotificationDestinationRequest struct { // The configuration for the notification destination. Must wrap EXACTLY one // of the nested configs. @@ -982,6 +1006,15 @@ type DeleteNetworkConnectivityConfigurationRequest struct { type DeleteNetworkConnectivityConfigurationResponse struct { } +// Delete a network policy +type DeleteNetworkPolicyRequest struct { + // The unique identifier of the network policy to delete. + NetworkPolicyId string `json:"-" url:"-"` +} + +type DeleteNetworkPolicyRpcResponse struct { +} + // Delete a notification destination type DeleteNotificationDestinationRequest struct { Id string `json:"-" url:"-"` @@ -1450,6 +1483,217 @@ func (f *EgressNetworkPolicyInternetAccessPolicyStorageDestinationStorageDestina return "EgressNetworkPolicyInternetAccessPolicyStorageDestinationStorageDestinationType" } +type EgressNetworkPolicyNetworkAccessPolicy struct { + // List of internet destinations that serverless workloads are allowed to + // access when in RESTRICTED_ACCESS mode. + AllowedInternetDestinations []EgressNetworkPolicyNetworkAccessPolicyInternetDestination `json:"allowed_internet_destinations,omitempty"` + // List of storage destinations that serverless workloads are allowed to + // access when in RESTRICTED_ACCESS mode. + AllowedStorageDestinations []EgressNetworkPolicyNetworkAccessPolicyStorageDestination `json:"allowed_storage_destinations,omitempty"` + // Optional. When policy_enforcement is not provided, we default to + // ENFORCE_MODE_ALL_SERVICES + PolicyEnforcement *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcement `json:"policy_enforcement,omitempty"` + // The restriction mode that controls how serverless workloads can access + // the internet. + RestrictionMode EgressNetworkPolicyNetworkAccessPolicyRestrictionMode `json:"restriction_mode"` +} + +// Users can specify accessible internet destinations when outbound access is +// restricted. We only support DNS_NAME (FQDN format) destinations for the time +// being. Going forward we may extend support to host names and IP addresses. +type EgressNetworkPolicyNetworkAccessPolicyInternetDestination struct { + // The internet destination to which access will be allowed. Format + // dependent on the destination type. + Destination string `json:"destination,omitempty"` + // The type of internet destination. Currently only DNS_NAME is supported. + InternetDestinationType EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType `json:"internet_destination_type,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *EgressNetworkPolicyNetworkAccessPolicyInternetDestination) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s EgressNetworkPolicyNetworkAccessPolicyInternetDestination) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType string + +const EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationTypeDnsName EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType = `DNS_NAME` + +// String representation for [fmt.Print] +func (f *EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType) Set(v string) error { + switch v { + case `DNS_NAME`: + *f = EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DNS_NAME"`, v) + } +} + +// Type always returns EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType to satisfy [pflag.Value] interface +func (f *EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType) Type() string { + return "EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType" +} + +type EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcement struct { + // When empty, it means dry run for all products. When non-empty, it means + // dry run for specific products and for the other products, they will run + // in enforced mode. + DryRunModeProductFilter []EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter `json:"dry_run_mode_product_filter,omitempty"` + // The mode of policy enforcement. ENFORCED blocks traffic that violates + // policy, while DRY_RUN only logs violations without blocking. When not + // specified, defaults to ENFORCED. + EnforcementMode EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode `json:"enforcement_mode,omitempty"` +} + +// The values should match the list of workloads used in networkconfig.proto +type EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter string + +const EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilterDbsql EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter = `DBSQL` + +const EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilterMlServing EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter = `ML_SERVING` + +// String representation for [fmt.Print] +func (f *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter) Set(v string) error { + switch v { + case `DBSQL`, `ML_SERVING`: + *f = EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DBSQL", "ML_SERVING"`, v) + } +} + +// Type always returns EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter to satisfy [pflag.Value] interface +func (f *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter) Type() string { + return "EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter" +} + +type EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode string + +const EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementModeDryRun EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode = `DRY_RUN` + +const EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementModeEnforced EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode = `ENFORCED` + +// String representation for [fmt.Print] +func (f *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode) Set(v string) error { + switch v { + case `DRY_RUN`, `ENFORCED`: + *f = EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DRY_RUN", "ENFORCED"`, v) + } +} + +// Type always returns EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode to satisfy [pflag.Value] interface +func (f *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode) Type() string { + return "EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode" +} + +// At which level can Databricks and Databricks managed compute access Internet. +// FULL_ACCESS: Databricks can access Internet. No blocking rules will apply. +// RESTRICTED_ACCESS: Databricks can only access explicitly allowed internet and +// storage destinations, as well as UC connections and external locations. +type EgressNetworkPolicyNetworkAccessPolicyRestrictionMode string + +const EgressNetworkPolicyNetworkAccessPolicyRestrictionModeFullAccess EgressNetworkPolicyNetworkAccessPolicyRestrictionMode = `FULL_ACCESS` + +const EgressNetworkPolicyNetworkAccessPolicyRestrictionModeRestrictedAccess EgressNetworkPolicyNetworkAccessPolicyRestrictionMode = `RESTRICTED_ACCESS` + +// String representation for [fmt.Print] +func (f *EgressNetworkPolicyNetworkAccessPolicyRestrictionMode) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *EgressNetworkPolicyNetworkAccessPolicyRestrictionMode) Set(v string) error { + switch v { + case `FULL_ACCESS`, `RESTRICTED_ACCESS`: + *f = EgressNetworkPolicyNetworkAccessPolicyRestrictionMode(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "FULL_ACCESS", "RESTRICTED_ACCESS"`, v) + } +} + +// Type always returns EgressNetworkPolicyNetworkAccessPolicyRestrictionMode to satisfy [pflag.Value] interface +func (f *EgressNetworkPolicyNetworkAccessPolicyRestrictionMode) Type() string { + return "EgressNetworkPolicyNetworkAccessPolicyRestrictionMode" +} + +// Users can specify accessible storage destinations. +type EgressNetworkPolicyNetworkAccessPolicyStorageDestination struct { + // The Azure storage account name. + AzureStorageAccount string `json:"azure_storage_account,omitempty"` + // The Azure storage service type (blob, dfs, etc.). + AzureStorageService string `json:"azure_storage_service,omitempty"` + + BucketName string `json:"bucket_name,omitempty"` + // The region of the S3 bucket. + Region string `json:"region,omitempty"` + // The type of storage destination. + StorageDestinationType EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType `json:"storage_destination_type,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *EgressNetworkPolicyNetworkAccessPolicyStorageDestination) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s EgressNetworkPolicyNetworkAccessPolicyStorageDestination) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType string + +const EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationTypeAwsS3 EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType = `AWS_S3` + +const EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationTypeAzureStorage EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType = `AZURE_STORAGE` + +const EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationTypeGoogleCloudStorage EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType = `GOOGLE_CLOUD_STORAGE` + +// String representation for [fmt.Print] +func (f *EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType) Set(v string) error { + switch v { + case `AWS_S3`, `AZURE_STORAGE`, `GOOGLE_CLOUD_STORAGE`: + *f = EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "AWS_S3", "AZURE_STORAGE", "GOOGLE_CLOUD_STORAGE"`, v) + } +} + +// Type always returns EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType to satisfy [pflag.Value] interface +func (f *EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType) Type() string { + return "EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType" +} + // The target resources that are supported by Network Connectivity Config. Note: // some egress types can support general types that are not defined in // EgressResourceType. E.g.: Azure private endpoint supports private link @@ -2064,6 +2308,12 @@ type GetNetworkConnectivityConfigurationRequest struct { NetworkConnectivityConfigId string `json:"-" url:"-"` } +// Get a network policy +type GetNetworkPolicyRequest struct { + // The unique identifier of the network policy to retrieve. + NetworkPolicyId string `json:"-" url:"-"` +} + // Get a notification destination type GetNotificationDestinationRequest struct { Id string `json:"-" url:"-"` @@ -2142,6 +2392,12 @@ type GetTokenResponse struct { TokenInfo *TokenInfo `json:"token_info,omitempty"` } +// Get workspace network configuration +type GetWorkspaceNetworkOptionRequest struct { + // The workspace ID. + WorkspaceId int64 `json:"-" url:"-"` +} + // Definition of an IP Access list type IpAccessListInfo struct { // Total number of IP or CIDR values. @@ -2238,6 +2494,40 @@ func (s ListNetworkConnectivityConfigurationsResponse) MarshalJSON() ([]byte, er return marshal.Marshal(s) } +// List network policies +type ListNetworkPoliciesRequest struct { + // Pagination token to go to next page based on previous query. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListNetworkPoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListNetworkPoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListNetworkPoliciesResponse struct { + // List of network policies. + Items []AccountNetworkPolicy `json:"items,omitempty"` + // A token that can be used to get the next page of results. If null, there + // are no more results to show. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListNetworkPoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListNetworkPoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // List notification destinations type ListNotificationDestinationsRequest struct { PageSize int64 `json:"-" url:"page_size,omitempty"` @@ -2660,6 +2950,18 @@ func (s NetworkConnectivityConfiguration) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// The network policies applying for egress traffic. This message is used by the +// UI/REST API. We translate this message to the format expected by the +// dataplane in Lakehouse Network Manager (for the format expected by the +// dataplane, see networkconfig.textproto). This policy should be consistent +// with [[com.databricks.api.proto.settingspolicy.EgressNetworkPolicy]]. Details +// see API-design: +// https://docs.google.com/document/d/1DKWO_FpZMCY4cF2O62LpwII1lx8gsnDGG-qgE3t3TOA/ +type NetworkPolicyEgress struct { + // The access policy enforced for egress traffic to the internet. + NetworkAccess *EgressNetworkPolicyNetworkAccessPolicy `json:"network_access,omitempty"` +} + type NotificationDestination struct { // The configuration for the notification destination. Will be exactly one // of the nested configs. Only returns for users with workspace admin @@ -3564,6 +3866,13 @@ type UpdateNccAzurePrivateEndpointRulePublicRequest struct { UpdateMask string `json:"-" url:"update_mask"` } +// Update a network policy +type UpdateNetworkPolicyRequest struct { + NetworkPolicy AccountNetworkPolicy `json:"network_policy"` + // The unique identifier for the network policy. + NetworkPolicyId string `json:"-" url:"-"` +} + type UpdateNotificationDestinationRequest struct { // The configuration for the notification destination. Must wrap EXACTLY one // of the nested configs. @@ -3639,4 +3948,33 @@ type UpdateRestrictWorkspaceAdminsSettingRequest struct { Setting RestrictWorkspaceAdminsSetting `json:"setting"` } +// Update workspace network configuration +type UpdateWorkspaceNetworkOptionRequest struct { + // The workspace ID. + WorkspaceId int64 `json:"-" url:"-"` + + WorkspaceNetworkOption WorkspaceNetworkOption `json:"workspace_network_option"` +} + type WorkspaceConf map[string]string + +type WorkspaceNetworkOption struct { + // The network policy ID to apply to the workspace. This controls the + // network access rules for all serverless compute resources in the + // workspace. Each workspace can only be linked to one policy at a time. If + // no policy is explicitly assigned, the workspace will use + // 'default-policy'. + NetworkPolicyId string `json:"network_policy_id,omitempty"` + // The workspace ID. + WorkspaceId int64 `json:"workspace_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *WorkspaceNetworkOption) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s WorkspaceNetworkOption) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} diff --git a/service/sharing/api.go b/service/sharing/api.go index f56e53d7d..2aa7ab7a3 100755 --- a/service/sharing/api.go +++ b/service/sharing/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Providers, Recipient Activation, Recipients, Shares, etc. +// These APIs allow you to manage Providers, Recipient Activation, Recipient Federation Policies, Recipients, Shares, etc. package sharing import ( @@ -270,6 +270,158 @@ func (a *RecipientActivationAPI) RetrieveTokenByActivationUrl(ctx context.Contex }) } +type RecipientFederationPoliciesInterface interface { + + // Create recipient federation policy. + // + // Create a federation policy for an OIDC_FEDERATION recipient for sharing data + // from Databricks to non-Databricks recipients. The caller must be the owner of + // the recipient. When sharing data from Databricks to non-Databricks clients, + // you can define a federation policy to authenticate non-Databricks recipients. + // The federation policy validates OIDC claims in federated tokens and is + // defined at the recipient level. This enables secretless sharing clients to + // authenticate using OIDC tokens. + // + // Supported scenarios for federation policies: 1. **User-to-Machine (U2M) + // flow** (e.g., PowerBI): A user accesses a resource using their own identity. + // 2. **Machine-to-Machine (M2M) flow** (e.g., OAuth App): An OAuth App accesses + // a resource using its own identity, typically for tasks like running nightly + // jobs. + // + // For an overview, refer to: - + // https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security + // - https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed + Create(ctx context.Context, request CreateFederationPolicyRequest) (*FederationPolicy, error) + + // Delete recipient federation policy. + // + // Deletes an existing federation policy for an OIDC_FEDERATION recipient. The + // caller must be the owner of the recipient. + Delete(ctx context.Context, request DeleteFederationPolicyRequest) error + + // Delete recipient federation policy. + // + // Deletes an existing federation policy for an OIDC_FEDERATION recipient. The + // caller must be the owner of the recipient. + DeleteByRecipientNameAndName(ctx context.Context, recipientName string, name string) error + + // Get recipient federation policy. + // + // Reads an existing federation policy for an OIDC_FEDERATION recipient for + // sharing data from Databricks to non-Databricks recipients. The caller must + // have read access to the recipient. + GetFederationPolicy(ctx context.Context, request GetFederationPolicyRequest) (*FederationPolicy, error) + + // Get recipient federation policy. + // + // Reads an existing federation policy for an OIDC_FEDERATION recipient for + // sharing data from Databricks to non-Databricks recipients. The caller must + // have read access to the recipient. + GetFederationPolicyByRecipientNameAndName(ctx context.Context, recipientName string, name string) (*FederationPolicy, error) + + // List recipient federation policies. + // + // Lists federation policies for an OIDC_FEDERATION recipient for sharing data + // from Databricks to non-Databricks recipients. The caller must have read + // access to the recipient. + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListFederationPoliciesRequest) listing.Iterator[FederationPolicy] + + // List recipient federation policies. + // + // Lists federation policies for an OIDC_FEDERATION recipient for sharing data + // from Databricks to non-Databricks recipients. The caller must have read + // access to the recipient. + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListFederationPoliciesRequest) ([]FederationPolicy, error) + + // List recipient federation policies. + // + // Lists federation policies for an OIDC_FEDERATION recipient for sharing data + // from Databricks to non-Databricks recipients. The caller must have read + // access to the recipient. + ListByRecipientName(ctx context.Context, recipientName string) (*ListFederationPoliciesResponse, error) + + // Update recipient federation policy. + // + // Updates an existing federation policy for an OIDC_RECIPIENT. The caller must + // be the owner of the recipient. + Update(ctx context.Context, request UpdateFederationPolicyRequest) (*FederationPolicy, error) +} + +func NewRecipientFederationPolicies(client *client.DatabricksClient) *RecipientFederationPoliciesAPI { + return &RecipientFederationPoliciesAPI{ + recipientFederationPoliciesImpl: recipientFederationPoliciesImpl{ + client: client, + }, + } +} + +// The Recipient Federation Policies APIs are only applicable in the open +// sharing model where the recipient object has the authentication type of +// `OIDC_RECIPIENT`, enabling data sharing from Databricks to non-Databricks +// recipients. OIDC Token Federation enables secure, secret-less authentication +// for accessing Delta Sharing servers. Users and applications authenticate +// using short-lived OIDC tokens issued by their own Identity Provider (IdP), +// such as Azure Entra ID or Okta, without the need for managing static +// credentials or client secrets. A federation policy defines how non-Databricks +// recipients authenticate using OIDC tokens. It validates the OIDC claims in +// federated tokens and is set at the recipient level. The caller must be the +// owner of the recipient to create or manage a federation policy. Federation +// policies support the following scenarios: - User-to-Machine (U2M) flow: A +// user accesses Delta Shares using their own identity, such as connecting +// through PowerBI Delta Sharing Client. - Machine-to-Machine (M2M) flow: An +// application accesses Delta Shares using its own identity, typically for +// automation tasks like nightly jobs through Python Delta Sharing Client. OIDC +// Token Federation enables fine-grained access control, supports Multi-Factor +// Authentication (MFA), and enhances security by minimizing the risk of +// credential leakage through the use of short-lived, expiring tokens. It is +// designed for strong identity governance, secure cross-platform data sharing, +// and reduced operational overhead for credential management. +// +// For more information, see +// https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security +// and https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed +type RecipientFederationPoliciesAPI struct { + recipientFederationPoliciesImpl +} + +// Delete recipient federation policy. +// +// Deletes an existing federation policy for an OIDC_FEDERATION recipient. The +// caller must be the owner of the recipient. +func (a *RecipientFederationPoliciesAPI) DeleteByRecipientNameAndName(ctx context.Context, recipientName string, name string) error { + return a.recipientFederationPoliciesImpl.Delete(ctx, DeleteFederationPolicyRequest{ + RecipientName: recipientName, + Name: name, + }) +} + +// Get recipient federation policy. +// +// Reads an existing federation policy for an OIDC_FEDERATION recipient for +// sharing data from Databricks to non-Databricks recipients. The caller must +// have read access to the recipient. +func (a *RecipientFederationPoliciesAPI) GetFederationPolicyByRecipientNameAndName(ctx context.Context, recipientName string, name string) (*FederationPolicy, error) { + return a.recipientFederationPoliciesImpl.GetFederationPolicy(ctx, GetFederationPolicyRequest{ + RecipientName: recipientName, + Name: name, + }) +} + +// List recipient federation policies. +// +// Lists federation policies for an OIDC_FEDERATION recipient for sharing data +// from Databricks to non-Databricks recipients. The caller must have read +// access to the recipient. +func (a *RecipientFederationPoliciesAPI) ListByRecipientName(ctx context.Context, recipientName string) (*ListFederationPoliciesResponse, error) { + return a.recipientFederationPoliciesImpl.internalList(ctx, ListFederationPoliciesRequest{ + RecipientName: recipientName, + }) +} + type RecipientsInterface interface { // Create a share recipient. diff --git a/service/sharing/impl.go b/service/sharing/impl.go index c6d48d3fa..38b194198 100755 --- a/service/sharing/impl.go +++ b/service/sharing/impl.go @@ -10,6 +10,7 @@ import ( "github.com/databricks/databricks-sdk-go/client" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" + "golang.org/x/exp/slices" ) // unexported type that holds implementations of just Providers API methods @@ -197,6 +198,105 @@ func (a *recipientActivationImpl) RetrieveToken(ctx context.Context, request Ret return &retrieveTokenResponse, err } +// unexported type that holds implementations of just RecipientFederationPolicies API methods +type recipientFederationPoliciesImpl struct { + client *client.DatabricksClient +} + +func (a *recipientFederationPoliciesImpl) Create(ctx context.Context, request CreateFederationPolicyRequest) (*FederationPolicy, error) { + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies", request.RecipientName) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Policy, &federationPolicy) + return &federationPolicy, err +} + +func (a *recipientFederationPoliciesImpl) Delete(ctx context.Context, request DeleteFederationPolicyRequest) error { + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", request.RecipientName, request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) + return err +} + +func (a *recipientFederationPoliciesImpl) GetFederationPolicy(ctx context.Context, request GetFederationPolicyRequest) (*FederationPolicy, error) { + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", request.RecipientName, request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &federationPolicy) + return &federationPolicy, err +} + +// List recipient federation policies. +// +// Lists federation policies for an OIDC_FEDERATION recipient for sharing data +// from Databricks to non-Databricks recipients. The caller must have read +// access to the recipient. +func (a *recipientFederationPoliciesImpl) List(ctx context.Context, request ListFederationPoliciesRequest) listing.Iterator[FederationPolicy] { + + getNextPage := func(ctx context.Context, req ListFederationPoliciesRequest) (*ListFederationPoliciesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListFederationPoliciesResponse) []FederationPolicy { + return resp.Policies + } + getNextReq := func(resp *ListFederationPoliciesResponse) *ListFederationPoliciesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List recipient federation policies. +// +// Lists federation policies for an OIDC_FEDERATION recipient for sharing data +// from Databricks to non-Databricks recipients. The caller must have read +// access to the recipient. +func (a *recipientFederationPoliciesImpl) ListAll(ctx context.Context, request ListFederationPoliciesRequest) ([]FederationPolicy, error) { + iterator := a.List(ctx, request) + return listing.ToSlice[FederationPolicy](ctx, iterator) +} + +func (a *recipientFederationPoliciesImpl) internalList(ctx context.Context, request ListFederationPoliciesRequest) (*ListFederationPoliciesResponse, error) { + var listFederationPoliciesResponse ListFederationPoliciesResponse + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies", request.RecipientName) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFederationPoliciesResponse) + return &listFederationPoliciesResponse, err +} + +func (a *recipientFederationPoliciesImpl) Update(ctx context.Context, request UpdateFederationPolicyRequest) (*FederationPolicy, error) { + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", request.RecipientName, request.Name) + queryParams := make(map[string]any) + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Policy, &federationPolicy) + return &federationPolicy, err +} + // unexported type that holds implementations of just Recipients API methods type recipientsImpl struct { client *client.DatabricksClient diff --git a/service/sharing/interface.go b/service/sharing/interface.go index 312f0c368..99f39c4ac 100755 --- a/service/sharing/interface.go +++ b/service/sharing/interface.go @@ -89,6 +89,84 @@ type RecipientActivationService interface { RetrieveToken(ctx context.Context, request RetrieveTokenRequest) (*RetrieveTokenResponse, error) } +// The Recipient Federation Policies APIs are only applicable in the open +// sharing model where the recipient object has the authentication type of +// `OIDC_RECIPIENT`, enabling data sharing from Databricks to non-Databricks +// recipients. OIDC Token Federation enables secure, secret-less authentication +// for accessing Delta Sharing servers. Users and applications authenticate +// using short-lived OIDC tokens issued by their own Identity Provider (IdP), +// such as Azure Entra ID or Okta, without the need for managing static +// credentials or client secrets. A federation policy defines how non-Databricks +// recipients authenticate using OIDC tokens. It validates the OIDC claims in +// federated tokens and is set at the recipient level. The caller must be the +// owner of the recipient to create or manage a federation policy. Federation +// policies support the following scenarios: - User-to-Machine (U2M) flow: A +// user accesses Delta Shares using their own identity, such as connecting +// through PowerBI Delta Sharing Client. - Machine-to-Machine (M2M) flow: An +// application accesses Delta Shares using its own identity, typically for +// automation tasks like nightly jobs through Python Delta Sharing Client. OIDC +// Token Federation enables fine-grained access control, supports Multi-Factor +// Authentication (MFA), and enhances security by minimizing the risk of +// credential leakage through the use of short-lived, expiring tokens. It is +// designed for strong identity governance, secure cross-platform data sharing, +// and reduced operational overhead for credential management. +// +// For more information, see +// https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security +// and https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed +type RecipientFederationPoliciesService interface { + + // Create recipient federation policy. + // + // Create a federation policy for an OIDC_FEDERATION recipient for sharing + // data from Databricks to non-Databricks recipients. The caller must be the + // owner of the recipient. When sharing data from Databricks to + // non-Databricks clients, you can define a federation policy to + // authenticate non-Databricks recipients. The federation policy validates + // OIDC claims in federated tokens and is defined at the recipient level. + // This enables secretless sharing clients to authenticate using OIDC + // tokens. + // + // Supported scenarios for federation policies: 1. **User-to-Machine (U2M) + // flow** (e.g., PowerBI): A user accesses a resource using their own + // identity. 2. **Machine-to-Machine (M2M) flow** (e.g., OAuth App): An + // OAuth App accesses a resource using its own identity, typically for tasks + // like running nightly jobs. + // + // For an overview, refer to: - + // https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security + // - https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed + Create(ctx context.Context, request CreateFederationPolicyRequest) (*FederationPolicy, error) + + // Delete recipient federation policy. + // + // Deletes an existing federation policy for an OIDC_FEDERATION recipient. + // The caller must be the owner of the recipient. + Delete(ctx context.Context, request DeleteFederationPolicyRequest) error + + // Get recipient federation policy. + // + // Reads an existing federation policy for an OIDC_FEDERATION recipient for + // sharing data from Databricks to non-Databricks recipients. The caller + // must have read access to the recipient. + GetFederationPolicy(ctx context.Context, request GetFederationPolicyRequest) (*FederationPolicy, error) + + // List recipient federation policies. + // + // Lists federation policies for an OIDC_FEDERATION recipient for sharing + // data from Databricks to non-Databricks recipients. The caller must have + // read access to the recipient. + // + // Use ListAll() to get all FederationPolicy instances, which will iterate over every result page. + List(ctx context.Context, request ListFederationPoliciesRequest) (*ListFederationPoliciesResponse, error) + + // Update recipient federation policy. + // + // Updates an existing federation policy for an OIDC_RECIPIENT. The caller + // must be the owner of the recipient. + Update(ctx context.Context, request UpdateFederationPolicyRequest) (*FederationPolicy, error) +} + // A recipient is an object you create using :method:recipients/create to // represent an organization which you want to allow access shares. The way how // sharing works differs depending on whether or not your recipient has access diff --git a/service/sharing/model.go b/service/sharing/model.go index 887ee4a24..74a136f1c 100755 --- a/service/sharing/model.go +++ b/service/sharing/model.go @@ -108,6 +108,14 @@ func (f *ColumnTypeName) Type() string { return "ColumnTypeName" } +// Create recipient federation policy +type CreateFederationPolicyRequest struct { + Policy FederationPolicy `json:"policy"` + // Name of the recipient. This is the name of the recipient for which the + // policy is being created. + RecipientName string `json:"-" url:"-"` +} + type CreateProvider struct { // The delta sharing authentication type. AuthenticationType AuthenticationType `json:"authentication_type"` @@ -187,6 +195,15 @@ func (s CreateShare) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Delete recipient federation policy +type DeleteFederationPolicyRequest struct { + // Name of the policy. This is the name of the policy to be deleted. + Name string `json:"-" url:"-"` + // Name of the recipient. This is the name of the recipient for which the + // policy is being deleted. + RecipientName string `json:"-" url:"-"` +} + // Delete a provider type DeleteProviderRequest struct { // Name of the provider. @@ -301,6 +318,33 @@ func (s DeltaSharingTableDependency) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type FederationPolicy struct { + // Description of the policy. This is a user-provided description. + Comment string `json:"comment,omitempty"` + // System-generated timestamp indicating when the policy was created. + CreateTime string `json:"create_time,omitempty"` + // Unique, immutable system-generated identifier for the federation policy. + Id string `json:"id,omitempty"` + // Name of the federation policy. A recipient can have multiple policies + // with different names. + Name string `json:"name,omitempty"` + // Specifies the policy to use for validating OIDC claims in the federated + // tokens. + OidcPolicy *OidcFederationPolicy `json:"oidc_policy,omitempty"` + // System-generated timestamp indicating when the policy was last updated. + UpdateTime string `json:"update_time,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *FederationPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s FederationPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Represents a parameter of a function. The same message is used for both input // and output columns. type FunctionParameterInfo struct { @@ -410,6 +454,15 @@ type GetActivationUrlInfoRequest struct { type GetActivationUrlInfoResponse struct { } +// Get recipient federation policy +type GetFederationPolicyRequest struct { + // Name of the policy. This is the name of the policy to be retrieved. + Name string `json:"-" url:"-"` + // Name of the recipient. This is the name of the recipient for which the + // policy is being retrieved. + RecipientName string `json:"-" url:"-"` +} + // Get a provider type GetProviderRequest struct { // Name of the provider. @@ -483,6 +536,42 @@ type IpAccessList struct { AllowedIpAddresses []string `json:"allowed_ip_addresses,omitempty"` } +// List recipient federation policies +type ListFederationPoliciesRequest struct { + MaxResults int `json:"-" url:"max_results,omitempty"` + + PageToken string `json:"-" url:"page_token,omitempty"` + // Name of the recipient. This is the name of the recipient for which the + // policies are being listed. + RecipientName string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListFederationPoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListFederationPoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListFederationPoliciesResponse struct { + NextPageToken string `json:"next_page_token,omitempty"` + + Policies []FederationPolicy `json:"policies,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListFederationPoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListFederationPoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // List assets by provider share type ListProviderShareAssetsRequest struct { // Maximum number of functions to return. @@ -709,6 +798,39 @@ func (s NotebookFile) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Specifies the policy to use for validating OIDC claims in your federated +// tokens from Delta Sharing Clients. Refer to +// https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed for +// more details. +type OidcFederationPolicy struct { + // The allowed token audiences, as specified in the 'aud' claim of federated + // tokens. The audience identifier is intended to represent the recipient of + // the token. Can be any non-empty string value. As long as the audience in + // the token matches at least one audience in the policy, + Audiences []string `json:"audiences,omitempty"` + // The required token issuer, as specified in the 'iss' claim of federated + // tokens. + Issuer string `json:"issuer"` + // The required token subject, as specified in the subject claim of + // federated tokens. The value of subject claim identifies the identity of + // the user or machine that is accessing the resource. For example for Entra + // ID (AAD) - For U2M flow, when allowing a group of users to access a + // resource and the subject claim is `groups`, this must be the Object ID of + // the group in Entra ID - For U2M flow, when allowing a user to access a + // resource and the subject claim is `oid`, this must be the Object ID of + // the user in Entra Id. - For M2M flow, when allowing an OAuth App + // registered to access a resource and the subject claim is `azp`, this must + // be the client-id of the oauth app registered in Entra ID. + Subject string `json:"subject"` + // The claim that contains the subject of the token. Depending on the + // identity provider and the use case U2M or M2M, this can be different. For + // example for Entra ID (AAD) - For U2M flow, when allowing a group of users + // to access a resource, this must be `groups` - For U2M flow, when allowing + // a user to access a resource, this must be `oid` - For M2M flow, when + // allowing an OAuth App registered to access a resource, this must be `azp` + SubjectClaim string `json:"subject_claim"` +} + type Partition struct { // An array of partition values. Values []PartitionValue `json:"values,omitempty"` @@ -1454,6 +1576,8 @@ type Table struct { // Internal information for D2D sharing that should not be disclosed to // external users. InternalAttributes *TableInternalAttributes `json:"internal_attributes,omitempty"` + // The catalog and schema of the materialized table + MaterializationNamespace string `json:"materialization_namespace,omitempty"` // The name of a materialized table. MaterializedTableName string `json:"materialized_table_name,omitempty"` // The name of the table. @@ -1544,6 +1668,34 @@ func (f *TableInternalAttributesSharedTableType) Type() string { return "TableInternalAttributesSharedTableType" } +// Update recipient federation policy +type UpdateFederationPolicyRequest struct { + // Name of the policy. This is the name of the current name of the policy. + Name string `json:"-" url:"-"` + + Policy FederationPolicy `json:"policy"` + // Name of the recipient. This is the name of the recipient for which the + // policy is being updated. + RecipientName string `json:"-" url:"-"` + // The field mask specifies which fields of the policy to update. To specify + // multiple fields in the field mask, use comma as the separator (no space). + // The special value '*' indicates that all fields should be updated (full + // replacement). If unspecified, all fields that are set in the policy + // provided in the update request will overwrite the corresponding fields in + // the existing policy. Example value: 'comment,oidc_policy.audiences'. + UpdateMask string `json:"-" url:"update_mask,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateFederationPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateFederationPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type UpdateProvider struct { // Description about the provider. Comment string `json:"comment,omitempty"` @@ -1628,6 +1780,19 @@ type UpdateSharePermissions struct { Changes []PermissionsChange `json:"changes,omitempty"` // The name of the share. Name string `json:"-" url:"-"` + // Optional. Whether to return the latest permissions list of the share in + // the response. + OmitPermissionsList bool `json:"omit_permissions_list,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateSharePermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateSharePermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateSharePermissionsResponse struct { diff --git a/service/sql/model.go b/service/sql/model.go index 89cd9f838..5ae6fd898 100755 --- a/service/sql/model.go +++ b/service/sql/model.go @@ -4800,6 +4800,10 @@ type TrashQueryRequest struct { type UpdateAlertRequest struct { Alert *UpdateAlertRequestAlert `json:"alert,omitempty"` + // If true, automatically resolve alert display name conflicts. Otherwise, + // fail the request if the alert's display name conflicts with an existing + // alert's display name. + AutoResolveDisplayName bool `json:"auto_resolve_display_name,omitempty"` Id string `json:"-" url:"-"` // The field mask must be a single string, with multiple fields separated by @@ -4814,6 +4818,16 @@ type UpdateAlertRequest struct { // wildcards, as it can lead to unintended results if the API changes in the // future. UpdateMask string `json:"update_mask"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateAlertRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateAlertRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateAlertRequestAlert struct { @@ -4875,6 +4889,11 @@ type UpdateAlertV2Request struct { } type UpdateQueryRequest struct { + // If true, automatically resolve alert display name conflicts. Otherwise, + // fail the request if the alert's display name conflicts with an existing + // alert's display name. + AutoResolveDisplayName bool `json:"auto_resolve_display_name,omitempty"` + Id string `json:"-" url:"-"` Query *UpdateQueryRequestQuery `json:"query,omitempty"` @@ -4890,6 +4909,16 @@ type UpdateQueryRequest struct { // wildcards, as it can lead to unintended results if the API changes in the // future. UpdateMask string `json:"update_mask"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateQueryRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateQueryRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateQueryRequestQuery struct { diff --git a/workspace_client.go b/workspace_client.go index af148b368..655f94feb 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -38,7 +38,7 @@ type WorkspaceClient struct { // These APIs manage access rules on resources in an account. Currently, // only grant rules are supported. A grant rule specifies a role assigned to // a set of principals. A list of rules attached to a resource is called a - // rule set. A workspace must belong to an account for these APIs to work. + // rule set. A workspace must belong to an account for these APIs to work AccountAccessControlProxy iam.AccountAccessControlProxyInterface // The alerts API can be used to perform CRUD operations on alerts. An alert @@ -710,6 +710,35 @@ type WorkspaceClient struct { // outside of their organization. RecipientActivation sharing.RecipientActivationInterface + // The Recipient Federation Policies APIs are only applicable in the open + // sharing model where the recipient object has the authentication type of + // `OIDC_RECIPIENT`, enabling data sharing from Databricks to non-Databricks + // recipients. OIDC Token Federation enables secure, secret-less + // authentication for accessing Delta Sharing servers. Users and + // applications authenticate using short-lived OIDC tokens issued by their + // own Identity Provider (IdP), such as Azure Entra ID or Okta, without the + // need for managing static credentials or client secrets. A federation + // policy defines how non-Databricks recipients authenticate using OIDC + // tokens. It validates the OIDC claims in federated tokens and is set at + // the recipient level. The caller must be the owner of the recipient to + // create or manage a federation policy. Federation policies support the + // following scenarios: - User-to-Machine (U2M) flow: A user accesses Delta + // Shares using their own identity, such as connecting through PowerBI Delta + // Sharing Client. - Machine-to-Machine (M2M) flow: An application accesses + // Delta Shares using its own identity, typically for automation tasks like + // nightly jobs through Python Delta Sharing Client. OIDC Token Federation + // enables fine-grained access control, supports Multi-Factor Authentication + // (MFA), and enhances security by minimizing the risk of credential leakage + // through the use of short-lived, expiring tokens. It is designed for + // strong identity governance, secure cross-platform data sharing, and + // reduced operational overhead for credential management. + // + // For more information, see + // https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security + // and + // https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed + RecipientFederationPolicies sharing.RecipientFederationPoliciesInterface + // A recipient is an object you create using :method:recipients/create to // represent an organization which you want to allow access shares. The way // how sharing works differs depending on whether or not your recipient has @@ -1229,6 +1258,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { QueryVisualizations: sql.NewQueryVisualizations(databricksClient), QueryVisualizationsLegacy: sql.NewQueryVisualizationsLegacy(databricksClient), RecipientActivation: sharing.NewRecipientActivation(databricksClient), + RecipientFederationPolicies: sharing.NewRecipientFederationPolicies(databricksClient), Recipients: sharing.NewRecipients(databricksClient), RedashConfig: sql.NewRedashConfig(databricksClient), RegisteredModels: catalog.NewRegisteredModels(databricksClient), From b9391ac5009ad698a7104e7d04cd3d842f33328f Mon Sep 17 00:00:00 2001 From: Tanmay Rustagi Date: Wed, 21 May 2025 11:37:06 +0200 Subject: [PATCH 2/2] - --- .codegen/_openapi_sha | 2 +- .gitattributes | 3 + NEXT_CHANGELOG.md | 7 +++ service/catalog/impl.go | 2 - service/catalog/model.go | 111 +++++++++++++++++++++++++++++++---- service/oauth2/model.go | 5 ++ service/pkg.go | 6 +- service/sharing/api.go | 13 +++- service/sharing/interface.go | 13 +++- service/sharing/model.go | 32 +++++----- 10 files changed, 159 insertions(+), 35 deletions(-) diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index a31772880..3e6708180 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -6b835c53b0f2394f1586c12894ffc8dd4ed042cc \ No newline at end of file +2cee201b2e8d656f7306b2f9ec98edfa721e9829 \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index ccd4fbc7e..84d55704b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -122,6 +122,7 @@ experimental/mocks/service/settings/mock_llm_proxy_partner_powered_account_inter experimental/mocks/service/settings/mock_llm_proxy_partner_powered_enforce_interface.go linguist-generated=true experimental/mocks/service/settings/mock_llm_proxy_partner_powered_workspace_interface.go linguist-generated=true experimental/mocks/service/settings/mock_network_connectivity_interface.go linguist-generated=true +experimental/mocks/service/settings/mock_network_policies_interface.go linguist-generated=true experimental/mocks/service/settings/mock_notification_destinations_interface.go linguist-generated=true experimental/mocks/service/settings/mock_personal_compute_interface.go linguist-generated=true experimental/mocks/service/settings/mock_restrict_workspace_admins_interface.go linguist-generated=true @@ -129,8 +130,10 @@ experimental/mocks/service/settings/mock_settings_interface.go linguist-generate experimental/mocks/service/settings/mock_token_management_interface.go linguist-generated=true experimental/mocks/service/settings/mock_tokens_interface.go linguist-generated=true experimental/mocks/service/settings/mock_workspace_conf_interface.go linguist-generated=true +experimental/mocks/service/settings/mock_workspace_network_configuration_interface.go linguist-generated=true experimental/mocks/service/sharing/mock_providers_interface.go linguist-generated=true experimental/mocks/service/sharing/mock_recipient_activation_interface.go linguist-generated=true +experimental/mocks/service/sharing/mock_recipient_federation_policies_interface.go linguist-generated=true experimental/mocks/service/sharing/mock_recipients_interface.go linguist-generated=true experimental/mocks/service/sharing/mock_shares_interface.go linguist-generated=true experimental/mocks/service/sql/mock_alerts_interface.go linguist-generated=true diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index e7638e945..9274c4a34 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -29,3 +29,10 @@ * Added `Catalog`, `CleanRoom`, `Connection`, `Credential`, `ExternalLocation`, `ExternalMetadata`, `Function`, `Metastore`, `Pipeline`, `Provider`, `Recipient`, `Schema`, `Share`, `StagingTable`, `StorageCredential`, `Table`, `UnknownSecurableType` and `Volume` enum values for [catalog.SecurableType](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#SecurableType). * [Breaking] Changed `SecurableType` field for [catalog.CatalogInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#CatalogInfo) to type [catalog.SecurableType](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#SecurableType). * Changed `Etag` and `Name` fields for [iam.RuleSetResponse](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/iam#RuleSetResponse) to be required. +* Added `EnableFileEvents` and `FileEventQueue` fields for [catalog.CreateExternalLocation](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#CreateExternalLocation). +* Added `EnableFileEvents` and `FileEventQueue` fields for [catalog.ExternalLocationInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ExternalLocationInfo). +* Added `EnableFileEvents` and `FileEventQueue` fields for [catalog.UpdateExternalLocation](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#UpdateExternalLocation). +* Added `PolicyId` and `ServicePrincipalId` fields for [oauth2.FederationPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#FederationPolicy). +* [Breaking] Removed `AccessPoint` field for [catalog.CreateExternalLocation](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#CreateExternalLocation). +* [Breaking] Removed `AccessPoint` field for [catalog.ExternalLocationInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ExternalLocationInfo). +* [Breaking] Removed `AccessPoint` field for [catalog.UpdateExternalLocation](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#UpdateExternalLocation). diff --git a/service/catalog/impl.go b/service/catalog/impl.go index cc376b6e9..45e0ccb51 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -827,8 +827,6 @@ func (a *externalLocationsImpl) Get(ctx context.Context, request GetExternalLoca // array. func (a *externalLocationsImpl) List(ctx context.Context, request ListExternalLocationsRequest) listing.Iterator[ExternalLocationInfo] { - request.ForceSendFields = append(request.ForceSendFields, "MaxResults") - getNextPage := func(ctx context.Context, req ListExternalLocationsRequest) (*ListExternalLocationsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) diff --git a/service/catalog/model.go b/service/catalog/model.go index 25d5c1b64..726327ff9 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -196,6 +196,26 @@ func (s AwsIamRoleResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type AwsSqsQueue struct { + // Unique identifier included in the name of file events managed cloud + // resources. + ManagedResourceId string `json:"managed_resource_id,omitempty"` + // The AQS queue url in the format + // https://sqs.{region}.amazonaws.com/{account id}/{queue name} REQUIRED for + // provided_sqs. + QueueUrl string `json:"queue_url,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AwsSqsQueue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AwsSqsQueue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Azure Active Directory token, essentially the Oauth token for Azure Service // Principal or Managed Identity. Read more at // https://learn.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token @@ -295,6 +315,33 @@ func (s AzureManagedIdentityResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type AzureQueueStorage struct { + // Unique identifier included in the name of file events managed cloud + // resources. + ManagedResourceId string `json:"managed_resource_id,omitempty"` + // The AQS queue url in the format https://{storage + // account}.queue.core.windows.net/{queue name} REQUIRED for provided_aqs. + QueueUrl string `json:"queue_url,omitempty"` + // The resource group for the queue, event grid subscription, and external + // location storage account. ONLY REQUIRED for locations with a service + // principal storage credential + ResourceGroup string `json:"resource_group,omitempty"` + // OPTIONAL: The subscription id for the queue, event grid subscription, and + // external location storage account. REQUIRED for locations with a service + // principal storage credential + SubscriptionId string `json:"subscription_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AzureQueueStorage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AzureQueueStorage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // The Azure service principal configuration. Only applicable when purpose is // **STORAGE**. type AzureServicePrincipal struct { @@ -835,18 +882,21 @@ type CreateDatabaseInstanceRequest struct { } type CreateExternalLocation struct { - // The AWS access point to use when accesing s3 for this external location. - AccessPoint string `json:"access_point,omitempty"` // User-provided free-form text description. Comment string `json:"comment,omitempty"` // Name of the storage credential used with this location. CredentialName string `json:"credential_name"` + // [Create:OPT Update:OPT] Whether to enable file events on this external + // location. + EnableFileEvents bool `json:"enable_file_events,omitempty"` // Encryption options that apply to clients connecting to cloud storage. EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` // Indicates whether fallback mode is enabled for this external location. // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. Fallback bool `json:"fallback,omitempty"` + // [Create:OPT Update:OPT] File event queue settings. + FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` // Name of the external location. Name string `json:"name"` // Indicates whether the external location is read-only. @@ -2091,8 +2141,6 @@ type ExistsRequest struct { } type ExternalLocationInfo struct { - // The AWS access point to use when accesing s3 for this external location. - AccessPoint string `json:"access_point,omitempty"` // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. @@ -2107,12 +2155,17 @@ type ExternalLocationInfo struct { CredentialId string `json:"credential_id,omitempty"` // Name of the storage credential used with this location. CredentialName string `json:"credential_name,omitempty"` + // [Create:OPT Update:OPT] Whether to enable file events on this external + // location. + EnableFileEvents bool `json:"enable_file_events,omitempty"` // Encryption options that apply to clients connecting to cloud storage. EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` // Indicates whether fallback mode is enabled for this external location. // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. Fallback bool `json:"fallback,omitempty"` + // [Create:OPT Update:OPT] File event queue settings. + FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` IsolationMode IsolationMode `json:"isolation_mode,omitempty"` // Unique identifier of metastore hosting the external location. @@ -2166,6 +2219,20 @@ func (s FailedStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type FileEventQueue struct { + ManagedAqs *AzureQueueStorage `json:"managed_aqs,omitempty"` + + ManagedPubsub *GcpPubsub `json:"managed_pubsub,omitempty"` + + ManagedSqs *AwsSqsQueue `json:"managed_sqs,omitempty"` + + ProvidedAqs *AzureQueueStorage `json:"provided_aqs,omitempty"` + + ProvidedPubsub *GcpPubsub `json:"provided_pubsub,omitempty"` + + ProvidedSqs *AwsSqsQueue `json:"provided_sqs,omitempty"` +} + // Find a Database Instance by uid type FindDatabaseInstanceByUidRequest struct { // UID of the cluster to get. @@ -2506,6 +2573,26 @@ func (s GcpOauthToken) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type GcpPubsub struct { + // Unique identifier included in the name of file events managed cloud + // resources. + ManagedResourceId string `json:"managed_resource_id,omitempty"` + // The Pub/Sub subscription name in the format + // projects/{project}/subscriptions/{subscription name} REQUIRED for + // provided_pubsub. + SubscriptionName string `json:"subscription_name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GcpPubsub) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GcpPubsub) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // The Azure cloud options to customize the requested temporary credential type GenerateTemporaryServiceCredentialAzureOptions struct { // The resources to which the temporary Azure credential should apply. These @@ -5192,10 +5279,12 @@ type SetRegisteredModelAliasRequest struct { // Server-Side Encryption properties for clients communicating with AWS s3. type SseEncryptionDetails struct { - // The type of key encryption to use (affects headers from s3 client). + // Sets the value of the 'x-amz-server-side-encryption' header in S3 + // request. Algorithm SseEncryptionDetailsAlgorithm `json:"algorithm,omitempty"` - // When algorithm is **AWS_SSE_KMS** this field specifies the ARN of the SSE - // key to use. + // Optional. The ARN of the SSE-KMS key used with the S3 location, when + // algorithm = "SSE-KMS". Sets the value of the + // 'x-amz-server-side-encryption-aws-kms-key-id' header. AwsKmsKeyArn string `json:"aws_kms_key_arn,omitempty"` ForceSendFields []string `json:"-" url:"-"` @@ -5209,7 +5298,6 @@ func (s SseEncryptionDetails) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// The type of key encryption to use (affects headers from s3 client). type SseEncryptionDetailsAlgorithm string const SseEncryptionDetailsAlgorithmAwsSseKms SseEncryptionDetailsAlgorithm = `AWS_SSE_KMS` @@ -5813,18 +5901,21 @@ type UpdateDatabaseInstanceRequest struct { } type UpdateExternalLocation struct { - // The AWS access point to use when accesing s3 for this external location. - AccessPoint string `json:"access_point,omitempty"` // User-provided free-form text description. Comment string `json:"comment,omitempty"` // Name of the storage credential used with this location. CredentialName string `json:"credential_name,omitempty"` + // [Create:OPT Update:OPT] Whether to enable file events on this external + // location. + EnableFileEvents bool `json:"enable_file_events,omitempty"` // Encryption options that apply to clients connecting to cloud storage. EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` // Indicates whether fallback mode is enabled for this external location. // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. Fallback bool `json:"fallback,omitempty"` + // [Create:OPT Update:OPT] File event queue settings. + FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` // Force update even if changing url invalidates dependent external tables // or mounts. Force bool `json:"force,omitempty"` diff --git a/service/oauth2/model.go b/service/oauth2/model.go index 9782ef127..d8ddc772a 100755 --- a/service/oauth2/model.go +++ b/service/oauth2/model.go @@ -231,6 +231,11 @@ type FederationPolicy struct { // Specifies the policy to use for validating OIDC claims in your federated // tokens. OidcPolicy *OidcFederationPolicy `json:"oidc_policy,omitempty"` + // The ID of the federation policy. + PolicyId string `json:"policy_id,omitempty"` + // The service principal ID that this federation policy applies to. Only set + // for service principal federation policies. + ServicePrincipalId int64 `json:"service_principal_id,omitempty"` // Unique, immutable id of the federation policy. Uid string `json:"uid,omitempty"` // Last update time of the federation policy. diff --git a/service/pkg.go b/service/pkg.go index 8cd72c43e..599ac820d 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -54,10 +54,10 @@ // // - [marketplace.ConsumerProvidersAPI]: Providers are the entities that publish listings to the Marketplace. // -// - [provisioning.CredentialsAPI]: These APIs manage credential configurations for this workspace. -// // - [catalog.CredentialsAPI]: A credential represents an authentication and authorization mechanism for accessing services on your cloud tenant. // +// - [provisioning.CredentialsAPI]: These APIs manage credential configurations for this workspace. +// // - [settings.CredentialsManagerAPI]: Credentials manager interacts with with Identity Providers to to perform token exchanges using stored credentials and refresh tokens. // // - [settings.CspEnablementAccountAPI]: The compliance security profile settings at the account level control whether to enable it for new workspaces. @@ -362,8 +362,8 @@ var ( _ *marketplace.ConsumerListingsAPI = nil _ *marketplace.ConsumerPersonalizationRequestsAPI = nil _ *marketplace.ConsumerProvidersAPI = nil - _ *provisioning.CredentialsAPI = nil _ *catalog.CredentialsAPI = nil + _ *provisioning.CredentialsAPI = nil _ *settings.CredentialsManagerAPI = nil _ *settings.CspEnablementAccountAPI = nil _ *iam.CurrentUserAPI = nil diff --git a/service/sharing/api.go b/service/sharing/api.go index 2aa7ab7a3..8578b4440 100755 --- a/service/sharing/api.go +++ b/service/sharing/api.go @@ -288,9 +288,18 @@ type RecipientFederationPoliciesInterface interface { // a resource using its own identity, typically for tasks like running nightly // jobs. // - // For an overview, refer to: - + // For an overview, refer to: - Blog post: Overview of feature: // https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security - // - https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed + // + // For detailed configuration guides based on your use case: - Creating a + // Federation Policy as a provider: + // https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed - + // Configuration and usage for Machine-to-Machine (M2M) applications (e.g., + // Python Delta Sharing Client): + // https://docs.databricks.com/aws/en/delta-sharing/sharing-over-oidc-m2m - + // Configuration and usage for User-to-Machine (U2M) applications (e.g., + // PowerBI): + // https://docs.databricks.com/aws/en/delta-sharing/sharing-over-oidc-u2m Create(ctx context.Context, request CreateFederationPolicyRequest) (*FederationPolicy, error) // Delete recipient federation policy. diff --git a/service/sharing/interface.go b/service/sharing/interface.go index 99f39c4ac..caa6d31ce 100755 --- a/service/sharing/interface.go +++ b/service/sharing/interface.go @@ -133,9 +133,18 @@ type RecipientFederationPoliciesService interface { // OAuth App accesses a resource using its own identity, typically for tasks // like running nightly jobs. // - // For an overview, refer to: - + // For an overview, refer to: - Blog post: Overview of feature: // https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security - // - https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed + // + // For detailed configuration guides based on your use case: - Creating a + // Federation Policy as a provider: + // https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed - + // Configuration and usage for Machine-to-Machine (M2M) applications (e.g., + // Python Delta Sharing Client): + // https://docs.databricks.com/aws/en/delta-sharing/sharing-over-oidc-m2m - + // Configuration and usage for User-to-Machine (U2M) applications (e.g., + // PowerBI): + // https://docs.databricks.com/aws/en/delta-sharing/sharing-over-oidc-u2m Create(ctx context.Context, request CreateFederationPolicyRequest) (*FederationPolicy, error) // Delete recipient federation policy. diff --git a/service/sharing/model.go b/service/sharing/model.go index 74a136f1c..d54e5421f 100755 --- a/service/sharing/model.go +++ b/service/sharing/model.go @@ -326,7 +326,8 @@ type FederationPolicy struct { // Unique, immutable system-generated identifier for the federation policy. Id string `json:"id,omitempty"` // Name of the federation policy. A recipient can have multiple policies - // with different names. + // with different names. The name must contain only lowercase alphanumeric + // characters, numbers, and hyphens. Name string `json:"name,omitempty"` // Specifies the policy to use for validating OIDC claims in the federated // tokens. @@ -812,22 +813,23 @@ type OidcFederationPolicy struct { // tokens. Issuer string `json:"issuer"` // The required token subject, as specified in the subject claim of - // federated tokens. The value of subject claim identifies the identity of - // the user or machine that is accessing the resource. For example for Entra - // ID (AAD) - For U2M flow, when allowing a group of users to access a - // resource and the subject claim is `groups`, this must be the Object ID of - // the group in Entra ID - For U2M flow, when allowing a user to access a - // resource and the subject claim is `oid`, this must be the Object ID of - // the user in Entra Id. - For M2M flow, when allowing an OAuth App - // registered to access a resource and the subject claim is `azp`, this must - // be the client-id of the oauth app registered in Entra ID. + // federated tokens. The subject claim identifies the identity of the user + // or machine accessing the resource. Examples for Entra ID (AAD): - U2M + // flow (group access): If the subject claim is `groups`, this must be the + // Object ID of the group in Entra ID. - U2M flow (user access): If the + // subject claim is `oid`, this must be the Object ID of the user in Entra + // ID. - M2M flow (OAuth App access): If the subject claim is `azp`, this + // must be the client ID of the OAuth app registered in Entra ID. Subject string `json:"subject"` // The claim that contains the subject of the token. Depending on the - // identity provider and the use case U2M or M2M, this can be different. For - // example for Entra ID (AAD) - For U2M flow, when allowing a group of users - // to access a resource, this must be `groups` - For U2M flow, when allowing - // a user to access a resource, this must be `oid` - For M2M flow, when - // allowing an OAuth App registered to access a resource, this must be `azp` + // identity provider and the use case (U2M or M2M), this can vary: - For + // Entra ID (AAD): * U2M flow (group access): Use `groups`. * U2M flow (user + // access): Use `oid`. * M2M flow (OAuth App access): Use `azp`. - For other + // IdPs, refer to the specific IdP documentation. + // + // Supported `subject_claim` values are: - `oid`: Object ID of the user. - + // `azp`: Client ID of the OAuth app. - `groups`: Object ID of the group. - + // `sub`: Subject identifier for other use cases. SubjectClaim string `json:"subject_claim"` }