From 09c6382686567da37b34f1fe2b9f7bbf7d683ed5 Mon Sep 17 00:00:00 2001 From: Tanmay Rustagi <88379306+tanmay-db@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:46:22 +0100 Subject: [PATCH] Update SDK to latest OpenAPI spec (#839) ## Changes Updating SDK for OpenAPI changes ## Tests Unit tests, will run nightly on release - [ ] `make test` passing - [ ] `make fmt` applied - [ ] relevant integration tests applied --- .codegen/_openapi_sha | 2 +- .gitattributes | 9 + account_client.go | 21 +- experimental/mocks/mock_account_client.go | 35 + experimental/mocks/mock_workspace_client.go | 66 + .../mock_permission_migration_interface.go | 191 +++ .../mock_account_settings_interface.go | 388 +---- ...mock_automatic_cluster_update_interface.go | 250 +++ .../mock_csp_enablement_account_interface.go | 250 +++ .../settings/mock_csp_enablement_interface.go | 250 +++ .../mock_default_namespace_interface.go | 309 ++++ .../mock_esm_enablement_account_interface.go | 250 +++ .../settings/mock_esm_enablement_interface.go | 250 +++ .../mock_personal_compute_interface.go | 309 ++++ ...ock_restrict_workspace_admins_interface.go | 309 ++++ .../settings/mock_settings_interface.go | 665 ++------ service/compute/model.go | 8 +- service/iam/api.go | 57 +- service/iam/impl.go | 15 + service/iam/interface.go | 11 + service/iam/model.go | 42 +- service/jobs/model.go | 16 +- service/pkg.go | 31 +- service/provisioning/api.go | 172 +- service/provisioning/interface.go | 84 +- service/provisioning/model.go | 3 +- service/settings/api.go | 1480 +++++++++++------ service/settings/impl.go | 276 +-- service/settings/interface.go | 330 ++-- service/settings/model.go | 90 +- service/vectorsearch/impl.go | 4 +- service/vectorsearch/model.go | 22 +- workspace_client.go | 20 +- 33 files changed, 4351 insertions(+), 1864 deletions(-) create mode 100644 experimental/mocks/service/iam/mock_permission_migration_interface.go create mode 100644 experimental/mocks/service/settings/mock_automatic_cluster_update_interface.go create mode 100644 experimental/mocks/service/settings/mock_csp_enablement_account_interface.go create mode 100644 experimental/mocks/service/settings/mock_csp_enablement_interface.go create mode 100644 experimental/mocks/service/settings/mock_default_namespace_interface.go create mode 100644 experimental/mocks/service/settings/mock_esm_enablement_account_interface.go create mode 100644 experimental/mocks/service/settings/mock_esm_enablement_interface.go create mode 100644 experimental/mocks/service/settings/mock_personal_compute_interface.go create mode 100644 experimental/mocks/service/settings/mock_restrict_workspace_admins_interface.go diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 5ea614e9d..fb91589e9 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -23fe1139476cb1a8c7b8ff2ff1fbc0132380f7a5 \ No newline at end of file +d855b30f25a06fe84f25214efa20e7f1fffcdf9e \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 2e334f663..c1118525c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -45,6 +45,7 @@ experimental/mocks/service/iam/mock_account_service_principals_interface.go ling experimental/mocks/service/iam/mock_account_users_interface.go linguist-generated=true experimental/mocks/service/iam/mock_current_user_interface.go linguist-generated=true experimental/mocks/service/iam/mock_groups_interface.go linguist-generated=true +experimental/mocks/service/iam/mock_permission_migration_interface.go linguist-generated=true experimental/mocks/service/iam/mock_permissions_interface.go linguist-generated=true experimental/mocks/service/iam/mock_service_principals_interface.go linguist-generated=true experimental/mocks/service/iam/mock_users_interface.go linguist-generated=true @@ -68,9 +69,17 @@ experimental/mocks/service/serving/mock_apps_interface.go linguist-generated=tru experimental/mocks/service/serving/mock_serving_endpoints_interface.go linguist-generated=true experimental/mocks/service/settings/mock_account_ip_access_lists_interface.go linguist-generated=true experimental/mocks/service/settings/mock_account_settings_interface.go linguist-generated=true +experimental/mocks/service/settings/mock_automatic_cluster_update_interface.go linguist-generated=true experimental/mocks/service/settings/mock_credentials_manager_interface.go linguist-generated=true +experimental/mocks/service/settings/mock_csp_enablement_account_interface.go linguist-generated=true +experimental/mocks/service/settings/mock_csp_enablement_interface.go linguist-generated=true +experimental/mocks/service/settings/mock_default_namespace_interface.go linguist-generated=true +experimental/mocks/service/settings/mock_esm_enablement_account_interface.go linguist-generated=true +experimental/mocks/service/settings/mock_esm_enablement_interface.go linguist-generated=true experimental/mocks/service/settings/mock_ip_access_lists_interface.go linguist-generated=true experimental/mocks/service/settings/mock_network_connectivity_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 experimental/mocks/service/settings/mock_settings_interface.go linguist-generated=true experimental/mocks/service/settings/mock_token_management_interface.go linguist-generated=true experimental/mocks/service/settings/mock_tokens_interface.go linguist-generated=true diff --git a/account_client.go b/account_client.go index a8aad817b..2596a826e 100755 --- a/account_client.go +++ b/account_client.go @@ -171,14 +171,7 @@ type AccountClient struct { Metastores catalog.AccountMetastoresInterface // These APIs provide configurations for the network connectivity of your - // workspaces for serverless compute resources. This API provides stable - // subnets for your workspace so that you can configure your firewalls on - // your Azure Storage accounts to allow access from Databricks. You can also - // use the API to provision private endpoints for Databricks to privately - // connect serverless compute resources to your Azure resources using Azure - // Private Link. See [configure serverless secure connectivity]. - // - // [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security + // workspaces for serverless compute resources. NetworkConnectivity settings.NetworkConnectivityInterface // These APIs manage network configurations for customer-managed VPCs @@ -224,16 +217,8 @@ type AccountClient struct { // data by accident. ServicePrincipals iam.AccountServicePrincipalsInterface - // The Personal Compute enablement setting lets you control which users can - // use the Personal Compute default policy to create compute resources. By - // default all users in all workspaces have access (ON), but you can change - // the setting to instead let individual workspaces configure access control - // (DELEGATE). - // - // There is only one instance of this setting per account. Since this - // setting has a default value, this setting is present on all accounts even - // though it's never set on a given account. Deletion reverts the value of - // the setting back to the default value. + // Accounts Settings API allows users to manage settings at the account + // level. Settings settings.AccountSettingsInterface // These APIs manage storage configurations for this workspace. A root diff --git a/experimental/mocks/mock_account_client.go b/experimental/mocks/mock_account_client.go index 2e62b98a1..b1236565d 100755 --- a/experimental/mocks/mock_account_client.go +++ b/experimental/mocks/mock_account_client.go @@ -58,9 +58,44 @@ func NewMockAccountClient(t interface { }, } + mockAccountSettingsAPI := cli.GetMockAccountSettingsAPI() + + mockCspEnablementAccount := settings.NewMockCspEnablementAccountInterface(t) + mockAccountSettingsAPI.On("CspEnablementAccount").Return(mockCspEnablementAccount).Maybe() + + mockEsmEnablementAccount := settings.NewMockEsmEnablementAccountInterface(t) + mockAccountSettingsAPI.On("EsmEnablementAccount").Return(mockEsmEnablementAccount).Maybe() + + mockPersonalCompute := settings.NewMockPersonalComputeInterface(t) + mockAccountSettingsAPI.On("PersonalCompute").Return(mockPersonalCompute).Maybe() + return cli } +func (m *MockAccountClient) GetMockCspEnablementAccountAPI() *settings.MockCspEnablementAccountInterface { + api, ok := m.GetMockAccountSettingsAPI().CspEnablementAccount().(*settings.MockCspEnablementAccountInterface) + if !ok { + panic(fmt.Sprintf("expected CspEnablementAccount to be *settings.MockCspEnablementAccountInterface, actual was %T", m.GetMockAccountSettingsAPI().CspEnablementAccount())) + } + return api +} + +func (m *MockAccountClient) GetMockEsmEnablementAccountAPI() *settings.MockEsmEnablementAccountInterface { + api, ok := m.GetMockAccountSettingsAPI().EsmEnablementAccount().(*settings.MockEsmEnablementAccountInterface) + if !ok { + panic(fmt.Sprintf("expected EsmEnablementAccount to be *settings.MockEsmEnablementAccountInterface, actual was %T", m.GetMockAccountSettingsAPI().EsmEnablementAccount())) + } + return api +} + +func (m *MockAccountClient) GetMockPersonalComputeAPI() *settings.MockPersonalComputeInterface { + api, ok := m.GetMockAccountSettingsAPI().PersonalCompute().(*settings.MockPersonalComputeInterface) + if !ok { + panic(fmt.Sprintf("expected PersonalCompute to be *settings.MockPersonalComputeInterface, actual was %T", m.GetMockAccountSettingsAPI().PersonalCompute())) + } + return api +} + func (m *MockAccountClient) GetMockAccountAccessControlAPI() *iam.MockAccountAccessControlInterface { api, ok := m.AccountClient.AccessControl.(*iam.MockAccountAccessControlInterface) if !ok { diff --git a/experimental/mocks/mock_workspace_client.go b/experimental/mocks/mock_workspace_client.go index d76db6121..276b58576 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -74,6 +74,7 @@ func NewMockWorkspaceClient(t interface { ModelRegistry: ml.NewMockModelRegistryInterface(t), ModelVersions: catalog.NewMockModelVersionsInterface(t), OnlineTables: catalog.NewMockOnlineTablesInterface(t), + PermissionMigration: iam.NewMockPermissionMigrationInterface(t), Permissions: iam.NewMockPermissionsInterface(t), Pipelines: pipelines.NewMockPipelinesInterface(t), PolicyFamilies: compute.NewMockPolicyFamiliesInterface(t), @@ -109,9 +110,66 @@ func NewMockWorkspaceClient(t interface { }, } + mocksettingsAPI := cli.GetMockSettingsAPI() + + mockautomaticClusterUpdate := settings.NewMockAutomaticClusterUpdateInterface(t) + mocksettingsAPI.On("AutomaticClusterUpdate").Return(mockautomaticClusterUpdate).Maybe() + + mockcspEnablement := settings.NewMockCspEnablementInterface(t) + mocksettingsAPI.On("CspEnablement").Return(mockcspEnablement).Maybe() + + mockdefaultNamespace := settings.NewMockDefaultNamespaceInterface(t) + mocksettingsAPI.On("DefaultNamespace").Return(mockdefaultNamespace).Maybe() + + mockesmEnablement := settings.NewMockEsmEnablementInterface(t) + mocksettingsAPI.On("EsmEnablement").Return(mockesmEnablement).Maybe() + + mockrestrictWorkspaceAdmins := settings.NewMockRestrictWorkspaceAdminsInterface(t) + mocksettingsAPI.On("RestrictWorkspaceAdmins").Return(mockrestrictWorkspaceAdmins).Maybe() + return cli } +func (m *MockWorkspaceClient) GetMockAutomaticClusterUpdateAPI() *settings.MockAutomaticClusterUpdateInterface { + api, ok := m.GetMockSettingsAPI().AutomaticClusterUpdate().(*settings.MockAutomaticClusterUpdateInterface) + if !ok { + panic(fmt.Sprintf("expected AutomaticClusterUpdate to be *settings.MockAutomaticClusterUpdateInterface, actual was %T", m.GetMockSettingsAPI().AutomaticClusterUpdate())) + } + return api +} + +func (m *MockWorkspaceClient) GetMockCspEnablementAPI() *settings.MockCspEnablementInterface { + api, ok := m.GetMockSettingsAPI().CspEnablement().(*settings.MockCspEnablementInterface) + if !ok { + panic(fmt.Sprintf("expected CspEnablement to be *settings.MockCspEnablementInterface, actual was %T", m.GetMockSettingsAPI().CspEnablement())) + } + return api +} + +func (m *MockWorkspaceClient) GetMockDefaultNamespaceAPI() *settings.MockDefaultNamespaceInterface { + api, ok := m.GetMockSettingsAPI().DefaultNamespace().(*settings.MockDefaultNamespaceInterface) + if !ok { + panic(fmt.Sprintf("expected DefaultNamespace to be *settings.MockDefaultNamespaceInterface, actual was %T", m.GetMockSettingsAPI().DefaultNamespace())) + } + return api +} + +func (m *MockWorkspaceClient) GetMockEsmEnablementAPI() *settings.MockEsmEnablementInterface { + api, ok := m.GetMockSettingsAPI().EsmEnablement().(*settings.MockEsmEnablementInterface) + if !ok { + panic(fmt.Sprintf("expected EsmEnablement to be *settings.MockEsmEnablementInterface, actual was %T", m.GetMockSettingsAPI().EsmEnablement())) + } + return api +} + +func (m *MockWorkspaceClient) GetMockRestrictWorkspaceAdminsAPI() *settings.MockRestrictWorkspaceAdminsInterface { + api, ok := m.GetMockSettingsAPI().RestrictWorkspaceAdmins().(*settings.MockRestrictWorkspaceAdminsInterface) + if !ok { + panic(fmt.Sprintf("expected RestrictWorkspaceAdmins to be *settings.MockRestrictWorkspaceAdminsInterface, actual was %T", m.GetMockSettingsAPI().RestrictWorkspaceAdmins())) + } + return api +} + func (m *MockWorkspaceClient) GetMockAccountAccessControlProxyAPI() *iam.MockAccountAccessControlProxyInterface { api, ok := m.WorkspaceClient.AccountAccessControlProxy.(*iam.MockAccountAccessControlProxyInterface) if !ok { @@ -400,6 +458,14 @@ func (m *MockWorkspaceClient) GetMockOnlineTablesAPI() *catalog.MockOnlineTables return api } +func (m *MockWorkspaceClient) GetMockPermissionMigrationAPI() *iam.MockPermissionMigrationInterface { + api, ok := m.WorkspaceClient.PermissionMigration.(*iam.MockPermissionMigrationInterface) + if !ok { + panic(fmt.Sprintf("expected PermissionMigration to be *iam.MockPermissionMigrationInterface, actual was %T", m.WorkspaceClient.PermissionMigration)) + } + return api +} + func (m *MockWorkspaceClient) GetMockPermissionsAPI() *iam.MockPermissionsInterface { api, ok := m.WorkspaceClient.Permissions.(*iam.MockPermissionsInterface) if !ok { diff --git a/experimental/mocks/service/iam/mock_permission_migration_interface.go b/experimental/mocks/service/iam/mock_permission_migration_interface.go new file mode 100644 index 000000000..ad6446732 --- /dev/null +++ b/experimental/mocks/service/iam/mock_permission_migration_interface.go @@ -0,0 +1,191 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package iam + +import ( + context "context" + + iam "github.com/databricks/databricks-sdk-go/service/iam" + mock "github.com/stretchr/testify/mock" +) + +// MockPermissionMigrationInterface is an autogenerated mock type for the PermissionMigrationInterface type +type MockPermissionMigrationInterface struct { + mock.Mock +} + +type MockPermissionMigrationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockPermissionMigrationInterface) EXPECT() *MockPermissionMigrationInterface_Expecter { + return &MockPermissionMigrationInterface_Expecter{mock: &_m.Mock} +} + +// Impl provides a mock function with given fields: +func (_m *MockPermissionMigrationInterface) Impl() iam.PermissionMigrationService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 iam.PermissionMigrationService + if rf, ok := ret.Get(0).(func() iam.PermissionMigrationService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(iam.PermissionMigrationService) + } + } + + return r0 +} + +// MockPermissionMigrationInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockPermissionMigrationInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockPermissionMigrationInterface_Expecter) Impl() *MockPermissionMigrationInterface_Impl_Call { + return &MockPermissionMigrationInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockPermissionMigrationInterface_Impl_Call) Run(run func()) *MockPermissionMigrationInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPermissionMigrationInterface_Impl_Call) Return(_a0 iam.PermissionMigrationService) *MockPermissionMigrationInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPermissionMigrationInterface_Impl_Call) RunAndReturn(run func() iam.PermissionMigrationService) *MockPermissionMigrationInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// MigratePermissions provides a mock function with given fields: ctx, request +func (_m *MockPermissionMigrationInterface) MigratePermissions(ctx context.Context, request iam.PermissionMigrationRequest) (*iam.PermissionMigrationResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for MigratePermissions") + } + + var r0 *iam.PermissionMigrationResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iam.PermissionMigrationRequest) (*iam.PermissionMigrationResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iam.PermissionMigrationRequest) *iam.PermissionMigrationResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iam.PermissionMigrationResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iam.PermissionMigrationRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPermissionMigrationInterface_MigratePermissions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MigratePermissions' +type MockPermissionMigrationInterface_MigratePermissions_Call struct { + *mock.Call +} + +// MigratePermissions is a helper method to define mock.On call +// - ctx context.Context +// - request iam.PermissionMigrationRequest +func (_e *MockPermissionMigrationInterface_Expecter) MigratePermissions(ctx interface{}, request interface{}) *MockPermissionMigrationInterface_MigratePermissions_Call { + return &MockPermissionMigrationInterface_MigratePermissions_Call{Call: _e.mock.On("MigratePermissions", ctx, request)} +} + +func (_c *MockPermissionMigrationInterface_MigratePermissions_Call) Run(run func(ctx context.Context, request iam.PermissionMigrationRequest)) *MockPermissionMigrationInterface_MigratePermissions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iam.PermissionMigrationRequest)) + }) + return _c +} + +func (_c *MockPermissionMigrationInterface_MigratePermissions_Call) Return(_a0 *iam.PermissionMigrationResponse, _a1 error) *MockPermissionMigrationInterface_MigratePermissions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPermissionMigrationInterface_MigratePermissions_Call) RunAndReturn(run func(context.Context, iam.PermissionMigrationRequest) (*iam.PermissionMigrationResponse, error)) *MockPermissionMigrationInterface_MigratePermissions_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockPermissionMigrationInterface) WithImpl(impl iam.PermissionMigrationService) iam.PermissionMigrationInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 iam.PermissionMigrationInterface + if rf, ok := ret.Get(0).(func(iam.PermissionMigrationService) iam.PermissionMigrationInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(iam.PermissionMigrationInterface) + } + } + + return r0 +} + +// MockPermissionMigrationInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockPermissionMigrationInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl iam.PermissionMigrationService +func (_e *MockPermissionMigrationInterface_Expecter) WithImpl(impl interface{}) *MockPermissionMigrationInterface_WithImpl_Call { + return &MockPermissionMigrationInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockPermissionMigrationInterface_WithImpl_Call) Run(run func(impl iam.PermissionMigrationService)) *MockPermissionMigrationInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(iam.PermissionMigrationService)) + }) + return _c +} + +func (_c *MockPermissionMigrationInterface_WithImpl_Call) Return(_a0 iam.PermissionMigrationInterface) *MockPermissionMigrationInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPermissionMigrationInterface_WithImpl_Call) RunAndReturn(run func(iam.PermissionMigrationService) iam.PermissionMigrationInterface) *MockPermissionMigrationInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockPermissionMigrationInterface creates a new instance of MockPermissionMigrationInterface. 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 NewMockPermissionMigrationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockPermissionMigrationInterface { + mock := &MockPermissionMigrationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settings/mock_account_settings_interface.go b/experimental/mocks/service/settings/mock_account_settings_interface.go index 8167d0554..a7eca69f7 100644 --- a/experimental/mocks/service/settings/mock_account_settings_interface.go +++ b/experimental/mocks/service/settings/mock_account_settings_interface.go @@ -3,8 +3,6 @@ package settings import ( - context "context" - settings "github.com/databricks/databricks-sdk-go/service/settings" mock "github.com/stretchr/testify/mock" ) @@ -22,238 +20,96 @@ func (_m *MockAccountSettingsInterface) EXPECT() *MockAccountSettingsInterface_E return &MockAccountSettingsInterface_Expecter{mock: &_m.Mock} } -// DeletePersonalComputeSetting provides a mock function with given fields: ctx, request -func (_m *MockAccountSettingsInterface) DeletePersonalComputeSetting(ctx context.Context, request settings.DeletePersonalComputeSettingRequest) (*settings.DeletePersonalComputeSettingResponse, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for DeletePersonalComputeSetting") - } - - var r0 *settings.DeletePersonalComputeSettingResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.DeletePersonalComputeSettingRequest) (*settings.DeletePersonalComputeSettingResponse, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.DeletePersonalComputeSettingRequest) *settings.DeletePersonalComputeSettingResponse); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.DeletePersonalComputeSettingResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.DeletePersonalComputeSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockAccountSettingsInterface_DeletePersonalComputeSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeletePersonalComputeSetting' -type MockAccountSettingsInterface_DeletePersonalComputeSetting_Call struct { - *mock.Call -} - -// DeletePersonalComputeSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.DeletePersonalComputeSettingRequest -func (_e *MockAccountSettingsInterface_Expecter) DeletePersonalComputeSetting(ctx interface{}, request interface{}) *MockAccountSettingsInterface_DeletePersonalComputeSetting_Call { - return &MockAccountSettingsInterface_DeletePersonalComputeSetting_Call{Call: _e.mock.On("DeletePersonalComputeSetting", ctx, request)} -} - -func (_c *MockAccountSettingsInterface_DeletePersonalComputeSetting_Call) Run(run func(ctx context.Context, request settings.DeletePersonalComputeSettingRequest)) *MockAccountSettingsInterface_DeletePersonalComputeSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.DeletePersonalComputeSettingRequest)) - }) - return _c -} - -func (_c *MockAccountSettingsInterface_DeletePersonalComputeSetting_Call) Return(_a0 *settings.DeletePersonalComputeSettingResponse, _a1 error) *MockAccountSettingsInterface_DeletePersonalComputeSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockAccountSettingsInterface_DeletePersonalComputeSetting_Call) RunAndReturn(run func(context.Context, settings.DeletePersonalComputeSettingRequest) (*settings.DeletePersonalComputeSettingResponse, error)) *MockAccountSettingsInterface_DeletePersonalComputeSetting_Call { - _c.Call.Return(run) - return _c -} - -// GetCspEnablementAccountSetting provides a mock function with given fields: ctx, request -func (_m *MockAccountSettingsInterface) GetCspEnablementAccountSetting(ctx context.Context, request settings.GetCspEnablementAccountSettingRequest) (*settings.CspEnablementAccountSetting, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for GetCspEnablementAccountSetting") - } - - var r0 *settings.CspEnablementAccountSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.GetCspEnablementAccountSettingRequest) (*settings.CspEnablementAccountSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.GetCspEnablementAccountSettingRequest) *settings.CspEnablementAccountSetting); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.CspEnablementAccountSetting) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.GetCspEnablementAccountSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockAccountSettingsInterface_GetCspEnablementAccountSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCspEnablementAccountSetting' -type MockAccountSettingsInterface_GetCspEnablementAccountSetting_Call struct { - *mock.Call -} - -// GetCspEnablementAccountSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.GetCspEnablementAccountSettingRequest -func (_e *MockAccountSettingsInterface_Expecter) GetCspEnablementAccountSetting(ctx interface{}, request interface{}) *MockAccountSettingsInterface_GetCspEnablementAccountSetting_Call { - return &MockAccountSettingsInterface_GetCspEnablementAccountSetting_Call{Call: _e.mock.On("GetCspEnablementAccountSetting", ctx, request)} -} - -func (_c *MockAccountSettingsInterface_GetCspEnablementAccountSetting_Call) Run(run func(ctx context.Context, request settings.GetCspEnablementAccountSettingRequest)) *MockAccountSettingsInterface_GetCspEnablementAccountSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.GetCspEnablementAccountSettingRequest)) - }) - return _c -} - -func (_c *MockAccountSettingsInterface_GetCspEnablementAccountSetting_Call) Return(_a0 *settings.CspEnablementAccountSetting, _a1 error) *MockAccountSettingsInterface_GetCspEnablementAccountSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockAccountSettingsInterface_GetCspEnablementAccountSetting_Call) RunAndReturn(run func(context.Context, settings.GetCspEnablementAccountSettingRequest) (*settings.CspEnablementAccountSetting, error)) *MockAccountSettingsInterface_GetCspEnablementAccountSetting_Call { - _c.Call.Return(run) - return _c -} - -// GetEsmEnablementAccountSetting provides a mock function with given fields: ctx, request -func (_m *MockAccountSettingsInterface) GetEsmEnablementAccountSetting(ctx context.Context, request settings.GetEsmEnablementAccountSettingRequest) (*settings.EsmEnablementAccountSetting, error) { - ret := _m.Called(ctx, request) +// CspEnablementAccount provides a mock function with given fields: +func (_m *MockAccountSettingsInterface) CspEnablementAccount() settings.CspEnablementAccountInterface { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for GetEsmEnablementAccountSetting") + panic("no return value specified for CspEnablementAccount") } - var r0 *settings.EsmEnablementAccountSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.GetEsmEnablementAccountSettingRequest) (*settings.EsmEnablementAccountSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.GetEsmEnablementAccountSettingRequest) *settings.EsmEnablementAccountSetting); ok { - r0 = rf(ctx, request) + var r0 settings.CspEnablementAccountInterface + if rf, ok := ret.Get(0).(func() settings.CspEnablementAccountInterface); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.EsmEnablementAccountSetting) + r0 = ret.Get(0).(settings.CspEnablementAccountInterface) } } - if rf, ok := ret.Get(1).(func(context.Context, settings.GetEsmEnablementAccountSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } -// MockAccountSettingsInterface_GetEsmEnablementAccountSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEsmEnablementAccountSetting' -type MockAccountSettingsInterface_GetEsmEnablementAccountSetting_Call struct { +// MockAccountSettingsInterface_CspEnablementAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CspEnablementAccount' +type MockAccountSettingsInterface_CspEnablementAccount_Call struct { *mock.Call } -// GetEsmEnablementAccountSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.GetEsmEnablementAccountSettingRequest -func (_e *MockAccountSettingsInterface_Expecter) GetEsmEnablementAccountSetting(ctx interface{}, request interface{}) *MockAccountSettingsInterface_GetEsmEnablementAccountSetting_Call { - return &MockAccountSettingsInterface_GetEsmEnablementAccountSetting_Call{Call: _e.mock.On("GetEsmEnablementAccountSetting", ctx, request)} +// CspEnablementAccount is a helper method to define mock.On call +func (_e *MockAccountSettingsInterface_Expecter) CspEnablementAccount() *MockAccountSettingsInterface_CspEnablementAccount_Call { + return &MockAccountSettingsInterface_CspEnablementAccount_Call{Call: _e.mock.On("CspEnablementAccount")} } -func (_c *MockAccountSettingsInterface_GetEsmEnablementAccountSetting_Call) Run(run func(ctx context.Context, request settings.GetEsmEnablementAccountSettingRequest)) *MockAccountSettingsInterface_GetEsmEnablementAccountSetting_Call { +func (_c *MockAccountSettingsInterface_CspEnablementAccount_Call) Run(run func()) *MockAccountSettingsInterface_CspEnablementAccount_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.GetEsmEnablementAccountSettingRequest)) + run() }) return _c } -func (_c *MockAccountSettingsInterface_GetEsmEnablementAccountSetting_Call) Return(_a0 *settings.EsmEnablementAccountSetting, _a1 error) *MockAccountSettingsInterface_GetEsmEnablementAccountSetting_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockAccountSettingsInterface_CspEnablementAccount_Call) Return(_a0 settings.CspEnablementAccountInterface) *MockAccountSettingsInterface_CspEnablementAccount_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockAccountSettingsInterface_GetEsmEnablementAccountSetting_Call) RunAndReturn(run func(context.Context, settings.GetEsmEnablementAccountSettingRequest) (*settings.EsmEnablementAccountSetting, error)) *MockAccountSettingsInterface_GetEsmEnablementAccountSetting_Call { +func (_c *MockAccountSettingsInterface_CspEnablementAccount_Call) RunAndReturn(run func() settings.CspEnablementAccountInterface) *MockAccountSettingsInterface_CspEnablementAccount_Call { _c.Call.Return(run) return _c } -// GetPersonalComputeSetting provides a mock function with given fields: ctx, request -func (_m *MockAccountSettingsInterface) GetPersonalComputeSetting(ctx context.Context, request settings.GetPersonalComputeSettingRequest) (*settings.PersonalComputeSetting, error) { - ret := _m.Called(ctx, request) +// EsmEnablementAccount provides a mock function with given fields: +func (_m *MockAccountSettingsInterface) EsmEnablementAccount() settings.EsmEnablementAccountInterface { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for GetPersonalComputeSetting") + panic("no return value specified for EsmEnablementAccount") } - var r0 *settings.PersonalComputeSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.GetPersonalComputeSettingRequest) (*settings.PersonalComputeSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.GetPersonalComputeSettingRequest) *settings.PersonalComputeSetting); ok { - r0 = rf(ctx, request) + var r0 settings.EsmEnablementAccountInterface + if rf, ok := ret.Get(0).(func() settings.EsmEnablementAccountInterface); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.PersonalComputeSetting) + r0 = ret.Get(0).(settings.EsmEnablementAccountInterface) } } - if rf, ok := ret.Get(1).(func(context.Context, settings.GetPersonalComputeSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } -// MockAccountSettingsInterface_GetPersonalComputeSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPersonalComputeSetting' -type MockAccountSettingsInterface_GetPersonalComputeSetting_Call struct { +// MockAccountSettingsInterface_EsmEnablementAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EsmEnablementAccount' +type MockAccountSettingsInterface_EsmEnablementAccount_Call struct { *mock.Call } -// GetPersonalComputeSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.GetPersonalComputeSettingRequest -func (_e *MockAccountSettingsInterface_Expecter) GetPersonalComputeSetting(ctx interface{}, request interface{}) *MockAccountSettingsInterface_GetPersonalComputeSetting_Call { - return &MockAccountSettingsInterface_GetPersonalComputeSetting_Call{Call: _e.mock.On("GetPersonalComputeSetting", ctx, request)} +// EsmEnablementAccount is a helper method to define mock.On call +func (_e *MockAccountSettingsInterface_Expecter) EsmEnablementAccount() *MockAccountSettingsInterface_EsmEnablementAccount_Call { + return &MockAccountSettingsInterface_EsmEnablementAccount_Call{Call: _e.mock.On("EsmEnablementAccount")} } -func (_c *MockAccountSettingsInterface_GetPersonalComputeSetting_Call) Run(run func(ctx context.Context, request settings.GetPersonalComputeSettingRequest)) *MockAccountSettingsInterface_GetPersonalComputeSetting_Call { +func (_c *MockAccountSettingsInterface_EsmEnablementAccount_Call) Run(run func()) *MockAccountSettingsInterface_EsmEnablementAccount_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.GetPersonalComputeSettingRequest)) + run() }) return _c } -func (_c *MockAccountSettingsInterface_GetPersonalComputeSetting_Call) Return(_a0 *settings.PersonalComputeSetting, _a1 error) *MockAccountSettingsInterface_GetPersonalComputeSetting_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockAccountSettingsInterface_EsmEnablementAccount_Call) Return(_a0 settings.EsmEnablementAccountInterface) *MockAccountSettingsInterface_EsmEnablementAccount_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockAccountSettingsInterface_GetPersonalComputeSetting_Call) RunAndReturn(run func(context.Context, settings.GetPersonalComputeSettingRequest) (*settings.PersonalComputeSetting, error)) *MockAccountSettingsInterface_GetPersonalComputeSetting_Call { +func (_c *MockAccountSettingsInterface_EsmEnablementAccount_Call) RunAndReturn(run func() settings.EsmEnablementAccountInterface) *MockAccountSettingsInterface_EsmEnablementAccount_Call { _c.Call.Return(run) return _c } @@ -305,179 +161,49 @@ func (_c *MockAccountSettingsInterface_Impl_Call) RunAndReturn(run func() settin return _c } -// UpdateCspEnablementAccountSetting provides a mock function with given fields: ctx, request -func (_m *MockAccountSettingsInterface) UpdateCspEnablementAccountSetting(ctx context.Context, request settings.UpdateCspEnablementAccountSettingRequest) (*settings.CspEnablementAccountSetting, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for UpdateCspEnablementAccountSetting") - } - - var r0 *settings.CspEnablementAccountSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateCspEnablementAccountSettingRequest) (*settings.CspEnablementAccountSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateCspEnablementAccountSettingRequest) *settings.CspEnablementAccountSetting); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.CspEnablementAccountSetting) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateCspEnablementAccountSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockAccountSettingsInterface_UpdateCspEnablementAccountSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCspEnablementAccountSetting' -type MockAccountSettingsInterface_UpdateCspEnablementAccountSetting_Call struct { - *mock.Call -} - -// UpdateCspEnablementAccountSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.UpdateCspEnablementAccountSettingRequest -func (_e *MockAccountSettingsInterface_Expecter) UpdateCspEnablementAccountSetting(ctx interface{}, request interface{}) *MockAccountSettingsInterface_UpdateCspEnablementAccountSetting_Call { - return &MockAccountSettingsInterface_UpdateCspEnablementAccountSetting_Call{Call: _e.mock.On("UpdateCspEnablementAccountSetting", ctx, request)} -} - -func (_c *MockAccountSettingsInterface_UpdateCspEnablementAccountSetting_Call) Run(run func(ctx context.Context, request settings.UpdateCspEnablementAccountSettingRequest)) *MockAccountSettingsInterface_UpdateCspEnablementAccountSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.UpdateCspEnablementAccountSettingRequest)) - }) - return _c -} - -func (_c *MockAccountSettingsInterface_UpdateCspEnablementAccountSetting_Call) Return(_a0 *settings.CspEnablementAccountSetting, _a1 error) *MockAccountSettingsInterface_UpdateCspEnablementAccountSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockAccountSettingsInterface_UpdateCspEnablementAccountSetting_Call) RunAndReturn(run func(context.Context, settings.UpdateCspEnablementAccountSettingRequest) (*settings.CspEnablementAccountSetting, error)) *MockAccountSettingsInterface_UpdateCspEnablementAccountSetting_Call { - _c.Call.Return(run) - return _c -} - -// UpdateEsmEnablementAccountSetting provides a mock function with given fields: ctx, request -func (_m *MockAccountSettingsInterface) UpdateEsmEnablementAccountSetting(ctx context.Context, request settings.UpdateEsmEnablementAccountSettingRequest) (*settings.EsmEnablementAccountSetting, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for UpdateEsmEnablementAccountSetting") - } - - var r0 *settings.EsmEnablementAccountSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateEsmEnablementAccountSettingRequest) (*settings.EsmEnablementAccountSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateEsmEnablementAccountSettingRequest) *settings.EsmEnablementAccountSetting); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.EsmEnablementAccountSetting) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateEsmEnablementAccountSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockAccountSettingsInterface_UpdateEsmEnablementAccountSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateEsmEnablementAccountSetting' -type MockAccountSettingsInterface_UpdateEsmEnablementAccountSetting_Call struct { - *mock.Call -} - -// UpdateEsmEnablementAccountSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.UpdateEsmEnablementAccountSettingRequest -func (_e *MockAccountSettingsInterface_Expecter) UpdateEsmEnablementAccountSetting(ctx interface{}, request interface{}) *MockAccountSettingsInterface_UpdateEsmEnablementAccountSetting_Call { - return &MockAccountSettingsInterface_UpdateEsmEnablementAccountSetting_Call{Call: _e.mock.On("UpdateEsmEnablementAccountSetting", ctx, request)} -} - -func (_c *MockAccountSettingsInterface_UpdateEsmEnablementAccountSetting_Call) Run(run func(ctx context.Context, request settings.UpdateEsmEnablementAccountSettingRequest)) *MockAccountSettingsInterface_UpdateEsmEnablementAccountSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.UpdateEsmEnablementAccountSettingRequest)) - }) - return _c -} - -func (_c *MockAccountSettingsInterface_UpdateEsmEnablementAccountSetting_Call) Return(_a0 *settings.EsmEnablementAccountSetting, _a1 error) *MockAccountSettingsInterface_UpdateEsmEnablementAccountSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockAccountSettingsInterface_UpdateEsmEnablementAccountSetting_Call) RunAndReturn(run func(context.Context, settings.UpdateEsmEnablementAccountSettingRequest) (*settings.EsmEnablementAccountSetting, error)) *MockAccountSettingsInterface_UpdateEsmEnablementAccountSetting_Call { - _c.Call.Return(run) - return _c -} - -// UpdatePersonalComputeSetting provides a mock function with given fields: ctx, request -func (_m *MockAccountSettingsInterface) UpdatePersonalComputeSetting(ctx context.Context, request settings.UpdatePersonalComputeSettingRequest) (*settings.PersonalComputeSetting, error) { - ret := _m.Called(ctx, request) +// PersonalCompute provides a mock function with given fields: +func (_m *MockAccountSettingsInterface) PersonalCompute() settings.PersonalComputeInterface { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for UpdatePersonalComputeSetting") + panic("no return value specified for PersonalCompute") } - var r0 *settings.PersonalComputeSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdatePersonalComputeSettingRequest) (*settings.PersonalComputeSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdatePersonalComputeSettingRequest) *settings.PersonalComputeSetting); ok { - r0 = rf(ctx, request) + var r0 settings.PersonalComputeInterface + if rf, ok := ret.Get(0).(func() settings.PersonalComputeInterface); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.PersonalComputeSetting) + r0 = ret.Get(0).(settings.PersonalComputeInterface) } } - if rf, ok := ret.Get(1).(func(context.Context, settings.UpdatePersonalComputeSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } -// MockAccountSettingsInterface_UpdatePersonalComputeSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePersonalComputeSetting' -type MockAccountSettingsInterface_UpdatePersonalComputeSetting_Call struct { +// MockAccountSettingsInterface_PersonalCompute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PersonalCompute' +type MockAccountSettingsInterface_PersonalCompute_Call struct { *mock.Call } -// UpdatePersonalComputeSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.UpdatePersonalComputeSettingRequest -func (_e *MockAccountSettingsInterface_Expecter) UpdatePersonalComputeSetting(ctx interface{}, request interface{}) *MockAccountSettingsInterface_UpdatePersonalComputeSetting_Call { - return &MockAccountSettingsInterface_UpdatePersonalComputeSetting_Call{Call: _e.mock.On("UpdatePersonalComputeSetting", ctx, request)} +// PersonalCompute is a helper method to define mock.On call +func (_e *MockAccountSettingsInterface_Expecter) PersonalCompute() *MockAccountSettingsInterface_PersonalCompute_Call { + return &MockAccountSettingsInterface_PersonalCompute_Call{Call: _e.mock.On("PersonalCompute")} } -func (_c *MockAccountSettingsInterface_UpdatePersonalComputeSetting_Call) Run(run func(ctx context.Context, request settings.UpdatePersonalComputeSettingRequest)) *MockAccountSettingsInterface_UpdatePersonalComputeSetting_Call { +func (_c *MockAccountSettingsInterface_PersonalCompute_Call) Run(run func()) *MockAccountSettingsInterface_PersonalCompute_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.UpdatePersonalComputeSettingRequest)) + run() }) return _c } -func (_c *MockAccountSettingsInterface_UpdatePersonalComputeSetting_Call) Return(_a0 *settings.PersonalComputeSetting, _a1 error) *MockAccountSettingsInterface_UpdatePersonalComputeSetting_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockAccountSettingsInterface_PersonalCompute_Call) Return(_a0 settings.PersonalComputeInterface) *MockAccountSettingsInterface_PersonalCompute_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockAccountSettingsInterface_UpdatePersonalComputeSetting_Call) RunAndReturn(run func(context.Context, settings.UpdatePersonalComputeSettingRequest) (*settings.PersonalComputeSetting, error)) *MockAccountSettingsInterface_UpdatePersonalComputeSetting_Call { +func (_c *MockAccountSettingsInterface_PersonalCompute_Call) RunAndReturn(run func() settings.PersonalComputeInterface) *MockAccountSettingsInterface_PersonalCompute_Call { _c.Call.Return(run) return _c } diff --git a/experimental/mocks/service/settings/mock_automatic_cluster_update_interface.go b/experimental/mocks/service/settings/mock_automatic_cluster_update_interface.go new file mode 100644 index 000000000..6c4748048 --- /dev/null +++ b/experimental/mocks/service/settings/mock_automatic_cluster_update_interface.go @@ -0,0 +1,250 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package settings + +import ( + context "context" + + settings "github.com/databricks/databricks-sdk-go/service/settings" + mock "github.com/stretchr/testify/mock" +) + +// MockAutomaticClusterUpdateInterface is an autogenerated mock type for the AutomaticClusterUpdateInterface type +type MockAutomaticClusterUpdateInterface struct { + mock.Mock +} + +type MockAutomaticClusterUpdateInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAutomaticClusterUpdateInterface) EXPECT() *MockAutomaticClusterUpdateInterface_Expecter { + return &MockAutomaticClusterUpdateInterface_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockAutomaticClusterUpdateInterface) Get(ctx context.Context, request settings.GetAutomaticClusterUpdateRequest) (*settings.AutomaticClusterUpdateSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *settings.AutomaticClusterUpdateSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetAutomaticClusterUpdateRequest) (*settings.AutomaticClusterUpdateSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetAutomaticClusterUpdateRequest) *settings.AutomaticClusterUpdateSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.AutomaticClusterUpdateSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetAutomaticClusterUpdateRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAutomaticClusterUpdateInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockAutomaticClusterUpdateInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetAutomaticClusterUpdateRequest +func (_e *MockAutomaticClusterUpdateInterface_Expecter) Get(ctx interface{}, request interface{}) *MockAutomaticClusterUpdateInterface_Get_Call { + return &MockAutomaticClusterUpdateInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockAutomaticClusterUpdateInterface_Get_Call) Run(run func(ctx context.Context, request settings.GetAutomaticClusterUpdateRequest)) *MockAutomaticClusterUpdateInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetAutomaticClusterUpdateRequest)) + }) + return _c +} + +func (_c *MockAutomaticClusterUpdateInterface_Get_Call) Return(_a0 *settings.AutomaticClusterUpdateSetting, _a1 error) *MockAutomaticClusterUpdateInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAutomaticClusterUpdateInterface_Get_Call) RunAndReturn(run func(context.Context, settings.GetAutomaticClusterUpdateRequest) (*settings.AutomaticClusterUpdateSetting, error)) *MockAutomaticClusterUpdateInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockAutomaticClusterUpdateInterface) Impl() settings.AutomaticClusterUpdateService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 settings.AutomaticClusterUpdateService + if rf, ok := ret.Get(0).(func() settings.AutomaticClusterUpdateService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.AutomaticClusterUpdateService) + } + } + + return r0 +} + +// MockAutomaticClusterUpdateInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockAutomaticClusterUpdateInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockAutomaticClusterUpdateInterface_Expecter) Impl() *MockAutomaticClusterUpdateInterface_Impl_Call { + return &MockAutomaticClusterUpdateInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockAutomaticClusterUpdateInterface_Impl_Call) Run(run func()) *MockAutomaticClusterUpdateInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockAutomaticClusterUpdateInterface_Impl_Call) Return(_a0 settings.AutomaticClusterUpdateService) *MockAutomaticClusterUpdateInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAutomaticClusterUpdateInterface_Impl_Call) RunAndReturn(run func() settings.AutomaticClusterUpdateService) *MockAutomaticClusterUpdateInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockAutomaticClusterUpdateInterface) Update(ctx context.Context, request settings.UpdateAutomaticClusterUpdateSettingRequest) (*settings.AutomaticClusterUpdateSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *settings.AutomaticClusterUpdateSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateAutomaticClusterUpdateSettingRequest) (*settings.AutomaticClusterUpdateSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateAutomaticClusterUpdateSettingRequest) *settings.AutomaticClusterUpdateSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.AutomaticClusterUpdateSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateAutomaticClusterUpdateSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAutomaticClusterUpdateInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockAutomaticClusterUpdateInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdateAutomaticClusterUpdateSettingRequest +func (_e *MockAutomaticClusterUpdateInterface_Expecter) Update(ctx interface{}, request interface{}) *MockAutomaticClusterUpdateInterface_Update_Call { + return &MockAutomaticClusterUpdateInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockAutomaticClusterUpdateInterface_Update_Call) Run(run func(ctx context.Context, request settings.UpdateAutomaticClusterUpdateSettingRequest)) *MockAutomaticClusterUpdateInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdateAutomaticClusterUpdateSettingRequest)) + }) + return _c +} + +func (_c *MockAutomaticClusterUpdateInterface_Update_Call) Return(_a0 *settings.AutomaticClusterUpdateSetting, _a1 error) *MockAutomaticClusterUpdateInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAutomaticClusterUpdateInterface_Update_Call) RunAndReturn(run func(context.Context, settings.UpdateAutomaticClusterUpdateSettingRequest) (*settings.AutomaticClusterUpdateSetting, error)) *MockAutomaticClusterUpdateInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockAutomaticClusterUpdateInterface) WithImpl(impl settings.AutomaticClusterUpdateService) settings.AutomaticClusterUpdateInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 settings.AutomaticClusterUpdateInterface + if rf, ok := ret.Get(0).(func(settings.AutomaticClusterUpdateService) settings.AutomaticClusterUpdateInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.AutomaticClusterUpdateInterface) + } + } + + return r0 +} + +// MockAutomaticClusterUpdateInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockAutomaticClusterUpdateInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl settings.AutomaticClusterUpdateService +func (_e *MockAutomaticClusterUpdateInterface_Expecter) WithImpl(impl interface{}) *MockAutomaticClusterUpdateInterface_WithImpl_Call { + return &MockAutomaticClusterUpdateInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockAutomaticClusterUpdateInterface_WithImpl_Call) Run(run func(impl settings.AutomaticClusterUpdateService)) *MockAutomaticClusterUpdateInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(settings.AutomaticClusterUpdateService)) + }) + return _c +} + +func (_c *MockAutomaticClusterUpdateInterface_WithImpl_Call) Return(_a0 settings.AutomaticClusterUpdateInterface) *MockAutomaticClusterUpdateInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAutomaticClusterUpdateInterface_WithImpl_Call) RunAndReturn(run func(settings.AutomaticClusterUpdateService) settings.AutomaticClusterUpdateInterface) *MockAutomaticClusterUpdateInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAutomaticClusterUpdateInterface creates a new instance of MockAutomaticClusterUpdateInterface. 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 NewMockAutomaticClusterUpdateInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAutomaticClusterUpdateInterface { + mock := &MockAutomaticClusterUpdateInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settings/mock_csp_enablement_account_interface.go b/experimental/mocks/service/settings/mock_csp_enablement_account_interface.go new file mode 100644 index 000000000..53dd1803a --- /dev/null +++ b/experimental/mocks/service/settings/mock_csp_enablement_account_interface.go @@ -0,0 +1,250 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package settings + +import ( + context "context" + + settings "github.com/databricks/databricks-sdk-go/service/settings" + mock "github.com/stretchr/testify/mock" +) + +// MockCspEnablementAccountInterface is an autogenerated mock type for the CspEnablementAccountInterface type +type MockCspEnablementAccountInterface struct { + mock.Mock +} + +type MockCspEnablementAccountInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockCspEnablementAccountInterface) EXPECT() *MockCspEnablementAccountInterface_Expecter { + return &MockCspEnablementAccountInterface_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockCspEnablementAccountInterface) Get(ctx context.Context, request settings.GetCspEnablementAccountRequest) (*settings.CspEnablementAccountSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *settings.CspEnablementAccountSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetCspEnablementAccountRequest) (*settings.CspEnablementAccountSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetCspEnablementAccountRequest) *settings.CspEnablementAccountSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.CspEnablementAccountSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetCspEnablementAccountRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCspEnablementAccountInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockCspEnablementAccountInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetCspEnablementAccountRequest +func (_e *MockCspEnablementAccountInterface_Expecter) Get(ctx interface{}, request interface{}) *MockCspEnablementAccountInterface_Get_Call { + return &MockCspEnablementAccountInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockCspEnablementAccountInterface_Get_Call) Run(run func(ctx context.Context, request settings.GetCspEnablementAccountRequest)) *MockCspEnablementAccountInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetCspEnablementAccountRequest)) + }) + return _c +} + +func (_c *MockCspEnablementAccountInterface_Get_Call) Return(_a0 *settings.CspEnablementAccountSetting, _a1 error) *MockCspEnablementAccountInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCspEnablementAccountInterface_Get_Call) RunAndReturn(run func(context.Context, settings.GetCspEnablementAccountRequest) (*settings.CspEnablementAccountSetting, error)) *MockCspEnablementAccountInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockCspEnablementAccountInterface) Impl() settings.CspEnablementAccountService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 settings.CspEnablementAccountService + if rf, ok := ret.Get(0).(func() settings.CspEnablementAccountService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.CspEnablementAccountService) + } + } + + return r0 +} + +// MockCspEnablementAccountInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockCspEnablementAccountInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockCspEnablementAccountInterface_Expecter) Impl() *MockCspEnablementAccountInterface_Impl_Call { + return &MockCspEnablementAccountInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockCspEnablementAccountInterface_Impl_Call) Run(run func()) *MockCspEnablementAccountInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCspEnablementAccountInterface_Impl_Call) Return(_a0 settings.CspEnablementAccountService) *MockCspEnablementAccountInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockCspEnablementAccountInterface_Impl_Call) RunAndReturn(run func() settings.CspEnablementAccountService) *MockCspEnablementAccountInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockCspEnablementAccountInterface) Update(ctx context.Context, request settings.UpdateCspEnablementAccountSettingRequest) (*settings.CspEnablementAccountSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *settings.CspEnablementAccountSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateCspEnablementAccountSettingRequest) (*settings.CspEnablementAccountSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateCspEnablementAccountSettingRequest) *settings.CspEnablementAccountSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.CspEnablementAccountSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateCspEnablementAccountSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCspEnablementAccountInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockCspEnablementAccountInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdateCspEnablementAccountSettingRequest +func (_e *MockCspEnablementAccountInterface_Expecter) Update(ctx interface{}, request interface{}) *MockCspEnablementAccountInterface_Update_Call { + return &MockCspEnablementAccountInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockCspEnablementAccountInterface_Update_Call) Run(run func(ctx context.Context, request settings.UpdateCspEnablementAccountSettingRequest)) *MockCspEnablementAccountInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdateCspEnablementAccountSettingRequest)) + }) + return _c +} + +func (_c *MockCspEnablementAccountInterface_Update_Call) Return(_a0 *settings.CspEnablementAccountSetting, _a1 error) *MockCspEnablementAccountInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCspEnablementAccountInterface_Update_Call) RunAndReturn(run func(context.Context, settings.UpdateCspEnablementAccountSettingRequest) (*settings.CspEnablementAccountSetting, error)) *MockCspEnablementAccountInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockCspEnablementAccountInterface) WithImpl(impl settings.CspEnablementAccountService) settings.CspEnablementAccountInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 settings.CspEnablementAccountInterface + if rf, ok := ret.Get(0).(func(settings.CspEnablementAccountService) settings.CspEnablementAccountInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.CspEnablementAccountInterface) + } + } + + return r0 +} + +// MockCspEnablementAccountInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockCspEnablementAccountInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl settings.CspEnablementAccountService +func (_e *MockCspEnablementAccountInterface_Expecter) WithImpl(impl interface{}) *MockCspEnablementAccountInterface_WithImpl_Call { + return &MockCspEnablementAccountInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockCspEnablementAccountInterface_WithImpl_Call) Run(run func(impl settings.CspEnablementAccountService)) *MockCspEnablementAccountInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(settings.CspEnablementAccountService)) + }) + return _c +} + +func (_c *MockCspEnablementAccountInterface_WithImpl_Call) Return(_a0 settings.CspEnablementAccountInterface) *MockCspEnablementAccountInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockCspEnablementAccountInterface_WithImpl_Call) RunAndReturn(run func(settings.CspEnablementAccountService) settings.CspEnablementAccountInterface) *MockCspEnablementAccountInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockCspEnablementAccountInterface creates a new instance of MockCspEnablementAccountInterface. 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 NewMockCspEnablementAccountInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockCspEnablementAccountInterface { + mock := &MockCspEnablementAccountInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settings/mock_csp_enablement_interface.go b/experimental/mocks/service/settings/mock_csp_enablement_interface.go new file mode 100644 index 000000000..abd829167 --- /dev/null +++ b/experimental/mocks/service/settings/mock_csp_enablement_interface.go @@ -0,0 +1,250 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package settings + +import ( + context "context" + + settings "github.com/databricks/databricks-sdk-go/service/settings" + mock "github.com/stretchr/testify/mock" +) + +// MockCspEnablementInterface is an autogenerated mock type for the CspEnablementInterface type +type MockCspEnablementInterface struct { + mock.Mock +} + +type MockCspEnablementInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockCspEnablementInterface) EXPECT() *MockCspEnablementInterface_Expecter { + return &MockCspEnablementInterface_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockCspEnablementInterface) Get(ctx context.Context, request settings.GetCspEnablementRequest) (*settings.CspEnablementSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *settings.CspEnablementSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetCspEnablementRequest) (*settings.CspEnablementSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetCspEnablementRequest) *settings.CspEnablementSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.CspEnablementSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetCspEnablementRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCspEnablementInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockCspEnablementInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetCspEnablementRequest +func (_e *MockCspEnablementInterface_Expecter) Get(ctx interface{}, request interface{}) *MockCspEnablementInterface_Get_Call { + return &MockCspEnablementInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockCspEnablementInterface_Get_Call) Run(run func(ctx context.Context, request settings.GetCspEnablementRequest)) *MockCspEnablementInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetCspEnablementRequest)) + }) + return _c +} + +func (_c *MockCspEnablementInterface_Get_Call) Return(_a0 *settings.CspEnablementSetting, _a1 error) *MockCspEnablementInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCspEnablementInterface_Get_Call) RunAndReturn(run func(context.Context, settings.GetCspEnablementRequest) (*settings.CspEnablementSetting, error)) *MockCspEnablementInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockCspEnablementInterface) Impl() settings.CspEnablementService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 settings.CspEnablementService + if rf, ok := ret.Get(0).(func() settings.CspEnablementService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.CspEnablementService) + } + } + + return r0 +} + +// MockCspEnablementInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockCspEnablementInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockCspEnablementInterface_Expecter) Impl() *MockCspEnablementInterface_Impl_Call { + return &MockCspEnablementInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockCspEnablementInterface_Impl_Call) Run(run func()) *MockCspEnablementInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCspEnablementInterface_Impl_Call) Return(_a0 settings.CspEnablementService) *MockCspEnablementInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockCspEnablementInterface_Impl_Call) RunAndReturn(run func() settings.CspEnablementService) *MockCspEnablementInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockCspEnablementInterface) Update(ctx context.Context, request settings.UpdateCspEnablementSettingRequest) (*settings.CspEnablementSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *settings.CspEnablementSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateCspEnablementSettingRequest) (*settings.CspEnablementSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateCspEnablementSettingRequest) *settings.CspEnablementSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.CspEnablementSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateCspEnablementSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCspEnablementInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockCspEnablementInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdateCspEnablementSettingRequest +func (_e *MockCspEnablementInterface_Expecter) Update(ctx interface{}, request interface{}) *MockCspEnablementInterface_Update_Call { + return &MockCspEnablementInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockCspEnablementInterface_Update_Call) Run(run func(ctx context.Context, request settings.UpdateCspEnablementSettingRequest)) *MockCspEnablementInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdateCspEnablementSettingRequest)) + }) + return _c +} + +func (_c *MockCspEnablementInterface_Update_Call) Return(_a0 *settings.CspEnablementSetting, _a1 error) *MockCspEnablementInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCspEnablementInterface_Update_Call) RunAndReturn(run func(context.Context, settings.UpdateCspEnablementSettingRequest) (*settings.CspEnablementSetting, error)) *MockCspEnablementInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockCspEnablementInterface) WithImpl(impl settings.CspEnablementService) settings.CspEnablementInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 settings.CspEnablementInterface + if rf, ok := ret.Get(0).(func(settings.CspEnablementService) settings.CspEnablementInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.CspEnablementInterface) + } + } + + return r0 +} + +// MockCspEnablementInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockCspEnablementInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl settings.CspEnablementService +func (_e *MockCspEnablementInterface_Expecter) WithImpl(impl interface{}) *MockCspEnablementInterface_WithImpl_Call { + return &MockCspEnablementInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockCspEnablementInterface_WithImpl_Call) Run(run func(impl settings.CspEnablementService)) *MockCspEnablementInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(settings.CspEnablementService)) + }) + return _c +} + +func (_c *MockCspEnablementInterface_WithImpl_Call) Return(_a0 settings.CspEnablementInterface) *MockCspEnablementInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockCspEnablementInterface_WithImpl_Call) RunAndReturn(run func(settings.CspEnablementService) settings.CspEnablementInterface) *MockCspEnablementInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockCspEnablementInterface creates a new instance of MockCspEnablementInterface. 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 NewMockCspEnablementInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockCspEnablementInterface { + mock := &MockCspEnablementInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settings/mock_default_namespace_interface.go b/experimental/mocks/service/settings/mock_default_namespace_interface.go new file mode 100644 index 000000000..dff98859b --- /dev/null +++ b/experimental/mocks/service/settings/mock_default_namespace_interface.go @@ -0,0 +1,309 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package settings + +import ( + context "context" + + settings "github.com/databricks/databricks-sdk-go/service/settings" + mock "github.com/stretchr/testify/mock" +) + +// MockDefaultNamespaceInterface is an autogenerated mock type for the DefaultNamespaceInterface type +type MockDefaultNamespaceInterface struct { + mock.Mock +} + +type MockDefaultNamespaceInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockDefaultNamespaceInterface) EXPECT() *MockDefaultNamespaceInterface_Expecter { + return &MockDefaultNamespaceInterface_Expecter{mock: &_m.Mock} +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockDefaultNamespaceInterface) Delete(ctx context.Context, request settings.DeleteDefaultNamespaceRequest) (*settings.DeleteDefaultNamespaceSettingResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 *settings.DeleteDefaultNamespaceSettingResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteDefaultNamespaceRequest) (*settings.DeleteDefaultNamespaceSettingResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteDefaultNamespaceRequest) *settings.DeleteDefaultNamespaceSettingResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.DeleteDefaultNamespaceSettingResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.DeleteDefaultNamespaceRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDefaultNamespaceInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockDefaultNamespaceInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request settings.DeleteDefaultNamespaceRequest +func (_e *MockDefaultNamespaceInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockDefaultNamespaceInterface_Delete_Call { + return &MockDefaultNamespaceInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockDefaultNamespaceInterface_Delete_Call) Run(run func(ctx context.Context, request settings.DeleteDefaultNamespaceRequest)) *MockDefaultNamespaceInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.DeleteDefaultNamespaceRequest)) + }) + return _c +} + +func (_c *MockDefaultNamespaceInterface_Delete_Call) Return(_a0 *settings.DeleteDefaultNamespaceSettingResponse, _a1 error) *MockDefaultNamespaceInterface_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDefaultNamespaceInterface_Delete_Call) RunAndReturn(run func(context.Context, settings.DeleteDefaultNamespaceRequest) (*settings.DeleteDefaultNamespaceSettingResponse, error)) *MockDefaultNamespaceInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockDefaultNamespaceInterface) Get(ctx context.Context, request settings.GetDefaultNamespaceRequest) (*settings.DefaultNamespaceSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *settings.DefaultNamespaceSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetDefaultNamespaceRequest) (*settings.DefaultNamespaceSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetDefaultNamespaceRequest) *settings.DefaultNamespaceSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.DefaultNamespaceSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetDefaultNamespaceRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDefaultNamespaceInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockDefaultNamespaceInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetDefaultNamespaceRequest +func (_e *MockDefaultNamespaceInterface_Expecter) Get(ctx interface{}, request interface{}) *MockDefaultNamespaceInterface_Get_Call { + return &MockDefaultNamespaceInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockDefaultNamespaceInterface_Get_Call) Run(run func(ctx context.Context, request settings.GetDefaultNamespaceRequest)) *MockDefaultNamespaceInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetDefaultNamespaceRequest)) + }) + return _c +} + +func (_c *MockDefaultNamespaceInterface_Get_Call) Return(_a0 *settings.DefaultNamespaceSetting, _a1 error) *MockDefaultNamespaceInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDefaultNamespaceInterface_Get_Call) RunAndReturn(run func(context.Context, settings.GetDefaultNamespaceRequest) (*settings.DefaultNamespaceSetting, error)) *MockDefaultNamespaceInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockDefaultNamespaceInterface) Impl() settings.DefaultNamespaceService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 settings.DefaultNamespaceService + if rf, ok := ret.Get(0).(func() settings.DefaultNamespaceService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.DefaultNamespaceService) + } + } + + return r0 +} + +// MockDefaultNamespaceInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockDefaultNamespaceInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockDefaultNamespaceInterface_Expecter) Impl() *MockDefaultNamespaceInterface_Impl_Call { + return &MockDefaultNamespaceInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockDefaultNamespaceInterface_Impl_Call) Run(run func()) *MockDefaultNamespaceInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockDefaultNamespaceInterface_Impl_Call) Return(_a0 settings.DefaultNamespaceService) *MockDefaultNamespaceInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDefaultNamespaceInterface_Impl_Call) RunAndReturn(run func() settings.DefaultNamespaceService) *MockDefaultNamespaceInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockDefaultNamespaceInterface) Update(ctx context.Context, request settings.UpdateDefaultNamespaceSettingRequest) (*settings.DefaultNamespaceSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *settings.DefaultNamespaceSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateDefaultNamespaceSettingRequest) (*settings.DefaultNamespaceSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateDefaultNamespaceSettingRequest) *settings.DefaultNamespaceSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.DefaultNamespaceSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateDefaultNamespaceSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDefaultNamespaceInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockDefaultNamespaceInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdateDefaultNamespaceSettingRequest +func (_e *MockDefaultNamespaceInterface_Expecter) Update(ctx interface{}, request interface{}) *MockDefaultNamespaceInterface_Update_Call { + return &MockDefaultNamespaceInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockDefaultNamespaceInterface_Update_Call) Run(run func(ctx context.Context, request settings.UpdateDefaultNamespaceSettingRequest)) *MockDefaultNamespaceInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdateDefaultNamespaceSettingRequest)) + }) + return _c +} + +func (_c *MockDefaultNamespaceInterface_Update_Call) Return(_a0 *settings.DefaultNamespaceSetting, _a1 error) *MockDefaultNamespaceInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDefaultNamespaceInterface_Update_Call) RunAndReturn(run func(context.Context, settings.UpdateDefaultNamespaceSettingRequest) (*settings.DefaultNamespaceSetting, error)) *MockDefaultNamespaceInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockDefaultNamespaceInterface) WithImpl(impl settings.DefaultNamespaceService) settings.DefaultNamespaceInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 settings.DefaultNamespaceInterface + if rf, ok := ret.Get(0).(func(settings.DefaultNamespaceService) settings.DefaultNamespaceInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.DefaultNamespaceInterface) + } + } + + return r0 +} + +// MockDefaultNamespaceInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockDefaultNamespaceInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl settings.DefaultNamespaceService +func (_e *MockDefaultNamespaceInterface_Expecter) WithImpl(impl interface{}) *MockDefaultNamespaceInterface_WithImpl_Call { + return &MockDefaultNamespaceInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockDefaultNamespaceInterface_WithImpl_Call) Run(run func(impl settings.DefaultNamespaceService)) *MockDefaultNamespaceInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(settings.DefaultNamespaceService)) + }) + return _c +} + +func (_c *MockDefaultNamespaceInterface_WithImpl_Call) Return(_a0 settings.DefaultNamespaceInterface) *MockDefaultNamespaceInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDefaultNamespaceInterface_WithImpl_Call) RunAndReturn(run func(settings.DefaultNamespaceService) settings.DefaultNamespaceInterface) *MockDefaultNamespaceInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockDefaultNamespaceInterface creates a new instance of MockDefaultNamespaceInterface. 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 NewMockDefaultNamespaceInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockDefaultNamespaceInterface { + mock := &MockDefaultNamespaceInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settings/mock_esm_enablement_account_interface.go b/experimental/mocks/service/settings/mock_esm_enablement_account_interface.go new file mode 100644 index 000000000..70be44007 --- /dev/null +++ b/experimental/mocks/service/settings/mock_esm_enablement_account_interface.go @@ -0,0 +1,250 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package settings + +import ( + context "context" + + settings "github.com/databricks/databricks-sdk-go/service/settings" + mock "github.com/stretchr/testify/mock" +) + +// MockEsmEnablementAccountInterface is an autogenerated mock type for the EsmEnablementAccountInterface type +type MockEsmEnablementAccountInterface struct { + mock.Mock +} + +type MockEsmEnablementAccountInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockEsmEnablementAccountInterface) EXPECT() *MockEsmEnablementAccountInterface_Expecter { + return &MockEsmEnablementAccountInterface_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockEsmEnablementAccountInterface) Get(ctx context.Context, request settings.GetEsmEnablementAccountRequest) (*settings.EsmEnablementAccountSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *settings.EsmEnablementAccountSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetEsmEnablementAccountRequest) (*settings.EsmEnablementAccountSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetEsmEnablementAccountRequest) *settings.EsmEnablementAccountSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.EsmEnablementAccountSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetEsmEnablementAccountRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEsmEnablementAccountInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockEsmEnablementAccountInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetEsmEnablementAccountRequest +func (_e *MockEsmEnablementAccountInterface_Expecter) Get(ctx interface{}, request interface{}) *MockEsmEnablementAccountInterface_Get_Call { + return &MockEsmEnablementAccountInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockEsmEnablementAccountInterface_Get_Call) Run(run func(ctx context.Context, request settings.GetEsmEnablementAccountRequest)) *MockEsmEnablementAccountInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetEsmEnablementAccountRequest)) + }) + return _c +} + +func (_c *MockEsmEnablementAccountInterface_Get_Call) Return(_a0 *settings.EsmEnablementAccountSetting, _a1 error) *MockEsmEnablementAccountInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEsmEnablementAccountInterface_Get_Call) RunAndReturn(run func(context.Context, settings.GetEsmEnablementAccountRequest) (*settings.EsmEnablementAccountSetting, error)) *MockEsmEnablementAccountInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockEsmEnablementAccountInterface) Impl() settings.EsmEnablementAccountService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 settings.EsmEnablementAccountService + if rf, ok := ret.Get(0).(func() settings.EsmEnablementAccountService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.EsmEnablementAccountService) + } + } + + return r0 +} + +// MockEsmEnablementAccountInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockEsmEnablementAccountInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockEsmEnablementAccountInterface_Expecter) Impl() *MockEsmEnablementAccountInterface_Impl_Call { + return &MockEsmEnablementAccountInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockEsmEnablementAccountInterface_Impl_Call) Run(run func()) *MockEsmEnablementAccountInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEsmEnablementAccountInterface_Impl_Call) Return(_a0 settings.EsmEnablementAccountService) *MockEsmEnablementAccountInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEsmEnablementAccountInterface_Impl_Call) RunAndReturn(run func() settings.EsmEnablementAccountService) *MockEsmEnablementAccountInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockEsmEnablementAccountInterface) Update(ctx context.Context, request settings.UpdateEsmEnablementAccountSettingRequest) (*settings.EsmEnablementAccountSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *settings.EsmEnablementAccountSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateEsmEnablementAccountSettingRequest) (*settings.EsmEnablementAccountSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateEsmEnablementAccountSettingRequest) *settings.EsmEnablementAccountSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.EsmEnablementAccountSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateEsmEnablementAccountSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEsmEnablementAccountInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockEsmEnablementAccountInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdateEsmEnablementAccountSettingRequest +func (_e *MockEsmEnablementAccountInterface_Expecter) Update(ctx interface{}, request interface{}) *MockEsmEnablementAccountInterface_Update_Call { + return &MockEsmEnablementAccountInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockEsmEnablementAccountInterface_Update_Call) Run(run func(ctx context.Context, request settings.UpdateEsmEnablementAccountSettingRequest)) *MockEsmEnablementAccountInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdateEsmEnablementAccountSettingRequest)) + }) + return _c +} + +func (_c *MockEsmEnablementAccountInterface_Update_Call) Return(_a0 *settings.EsmEnablementAccountSetting, _a1 error) *MockEsmEnablementAccountInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEsmEnablementAccountInterface_Update_Call) RunAndReturn(run func(context.Context, settings.UpdateEsmEnablementAccountSettingRequest) (*settings.EsmEnablementAccountSetting, error)) *MockEsmEnablementAccountInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockEsmEnablementAccountInterface) WithImpl(impl settings.EsmEnablementAccountService) settings.EsmEnablementAccountInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 settings.EsmEnablementAccountInterface + if rf, ok := ret.Get(0).(func(settings.EsmEnablementAccountService) settings.EsmEnablementAccountInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.EsmEnablementAccountInterface) + } + } + + return r0 +} + +// MockEsmEnablementAccountInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockEsmEnablementAccountInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl settings.EsmEnablementAccountService +func (_e *MockEsmEnablementAccountInterface_Expecter) WithImpl(impl interface{}) *MockEsmEnablementAccountInterface_WithImpl_Call { + return &MockEsmEnablementAccountInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockEsmEnablementAccountInterface_WithImpl_Call) Run(run func(impl settings.EsmEnablementAccountService)) *MockEsmEnablementAccountInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(settings.EsmEnablementAccountService)) + }) + return _c +} + +func (_c *MockEsmEnablementAccountInterface_WithImpl_Call) Return(_a0 settings.EsmEnablementAccountInterface) *MockEsmEnablementAccountInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEsmEnablementAccountInterface_WithImpl_Call) RunAndReturn(run func(settings.EsmEnablementAccountService) settings.EsmEnablementAccountInterface) *MockEsmEnablementAccountInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockEsmEnablementAccountInterface creates a new instance of MockEsmEnablementAccountInterface. 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 NewMockEsmEnablementAccountInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockEsmEnablementAccountInterface { + mock := &MockEsmEnablementAccountInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settings/mock_esm_enablement_interface.go b/experimental/mocks/service/settings/mock_esm_enablement_interface.go new file mode 100644 index 000000000..8f0128b47 --- /dev/null +++ b/experimental/mocks/service/settings/mock_esm_enablement_interface.go @@ -0,0 +1,250 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package settings + +import ( + context "context" + + settings "github.com/databricks/databricks-sdk-go/service/settings" + mock "github.com/stretchr/testify/mock" +) + +// MockEsmEnablementInterface is an autogenerated mock type for the EsmEnablementInterface type +type MockEsmEnablementInterface struct { + mock.Mock +} + +type MockEsmEnablementInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockEsmEnablementInterface) EXPECT() *MockEsmEnablementInterface_Expecter { + return &MockEsmEnablementInterface_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockEsmEnablementInterface) Get(ctx context.Context, request settings.GetEsmEnablementRequest) (*settings.EsmEnablementSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *settings.EsmEnablementSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetEsmEnablementRequest) (*settings.EsmEnablementSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetEsmEnablementRequest) *settings.EsmEnablementSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.EsmEnablementSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetEsmEnablementRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEsmEnablementInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockEsmEnablementInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetEsmEnablementRequest +func (_e *MockEsmEnablementInterface_Expecter) Get(ctx interface{}, request interface{}) *MockEsmEnablementInterface_Get_Call { + return &MockEsmEnablementInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockEsmEnablementInterface_Get_Call) Run(run func(ctx context.Context, request settings.GetEsmEnablementRequest)) *MockEsmEnablementInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetEsmEnablementRequest)) + }) + return _c +} + +func (_c *MockEsmEnablementInterface_Get_Call) Return(_a0 *settings.EsmEnablementSetting, _a1 error) *MockEsmEnablementInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEsmEnablementInterface_Get_Call) RunAndReturn(run func(context.Context, settings.GetEsmEnablementRequest) (*settings.EsmEnablementSetting, error)) *MockEsmEnablementInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockEsmEnablementInterface) Impl() settings.EsmEnablementService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 settings.EsmEnablementService + if rf, ok := ret.Get(0).(func() settings.EsmEnablementService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.EsmEnablementService) + } + } + + return r0 +} + +// MockEsmEnablementInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockEsmEnablementInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockEsmEnablementInterface_Expecter) Impl() *MockEsmEnablementInterface_Impl_Call { + return &MockEsmEnablementInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockEsmEnablementInterface_Impl_Call) Run(run func()) *MockEsmEnablementInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEsmEnablementInterface_Impl_Call) Return(_a0 settings.EsmEnablementService) *MockEsmEnablementInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEsmEnablementInterface_Impl_Call) RunAndReturn(run func() settings.EsmEnablementService) *MockEsmEnablementInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockEsmEnablementInterface) Update(ctx context.Context, request settings.UpdateEsmEnablementSettingRequest) (*settings.EsmEnablementSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *settings.EsmEnablementSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateEsmEnablementSettingRequest) (*settings.EsmEnablementSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateEsmEnablementSettingRequest) *settings.EsmEnablementSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.EsmEnablementSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateEsmEnablementSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEsmEnablementInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockEsmEnablementInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdateEsmEnablementSettingRequest +func (_e *MockEsmEnablementInterface_Expecter) Update(ctx interface{}, request interface{}) *MockEsmEnablementInterface_Update_Call { + return &MockEsmEnablementInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockEsmEnablementInterface_Update_Call) Run(run func(ctx context.Context, request settings.UpdateEsmEnablementSettingRequest)) *MockEsmEnablementInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdateEsmEnablementSettingRequest)) + }) + return _c +} + +func (_c *MockEsmEnablementInterface_Update_Call) Return(_a0 *settings.EsmEnablementSetting, _a1 error) *MockEsmEnablementInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEsmEnablementInterface_Update_Call) RunAndReturn(run func(context.Context, settings.UpdateEsmEnablementSettingRequest) (*settings.EsmEnablementSetting, error)) *MockEsmEnablementInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockEsmEnablementInterface) WithImpl(impl settings.EsmEnablementService) settings.EsmEnablementInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 settings.EsmEnablementInterface + if rf, ok := ret.Get(0).(func(settings.EsmEnablementService) settings.EsmEnablementInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.EsmEnablementInterface) + } + } + + return r0 +} + +// MockEsmEnablementInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockEsmEnablementInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl settings.EsmEnablementService +func (_e *MockEsmEnablementInterface_Expecter) WithImpl(impl interface{}) *MockEsmEnablementInterface_WithImpl_Call { + return &MockEsmEnablementInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockEsmEnablementInterface_WithImpl_Call) Run(run func(impl settings.EsmEnablementService)) *MockEsmEnablementInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(settings.EsmEnablementService)) + }) + return _c +} + +func (_c *MockEsmEnablementInterface_WithImpl_Call) Return(_a0 settings.EsmEnablementInterface) *MockEsmEnablementInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEsmEnablementInterface_WithImpl_Call) RunAndReturn(run func(settings.EsmEnablementService) settings.EsmEnablementInterface) *MockEsmEnablementInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockEsmEnablementInterface creates a new instance of MockEsmEnablementInterface. 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 NewMockEsmEnablementInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockEsmEnablementInterface { + mock := &MockEsmEnablementInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settings/mock_personal_compute_interface.go b/experimental/mocks/service/settings/mock_personal_compute_interface.go new file mode 100644 index 000000000..c3bdf6624 --- /dev/null +++ b/experimental/mocks/service/settings/mock_personal_compute_interface.go @@ -0,0 +1,309 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package settings + +import ( + context "context" + + settings "github.com/databricks/databricks-sdk-go/service/settings" + mock "github.com/stretchr/testify/mock" +) + +// MockPersonalComputeInterface is an autogenerated mock type for the PersonalComputeInterface type +type MockPersonalComputeInterface struct { + mock.Mock +} + +type MockPersonalComputeInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockPersonalComputeInterface) EXPECT() *MockPersonalComputeInterface_Expecter { + return &MockPersonalComputeInterface_Expecter{mock: &_m.Mock} +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockPersonalComputeInterface) Delete(ctx context.Context, request settings.DeletePersonalComputeRequest) (*settings.DeletePersonalComputeSettingResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 *settings.DeletePersonalComputeSettingResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.DeletePersonalComputeRequest) (*settings.DeletePersonalComputeSettingResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.DeletePersonalComputeRequest) *settings.DeletePersonalComputeSettingResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.DeletePersonalComputeSettingResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.DeletePersonalComputeRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPersonalComputeInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockPersonalComputeInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request settings.DeletePersonalComputeRequest +func (_e *MockPersonalComputeInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockPersonalComputeInterface_Delete_Call { + return &MockPersonalComputeInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockPersonalComputeInterface_Delete_Call) Run(run func(ctx context.Context, request settings.DeletePersonalComputeRequest)) *MockPersonalComputeInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.DeletePersonalComputeRequest)) + }) + return _c +} + +func (_c *MockPersonalComputeInterface_Delete_Call) Return(_a0 *settings.DeletePersonalComputeSettingResponse, _a1 error) *MockPersonalComputeInterface_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPersonalComputeInterface_Delete_Call) RunAndReturn(run func(context.Context, settings.DeletePersonalComputeRequest) (*settings.DeletePersonalComputeSettingResponse, error)) *MockPersonalComputeInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockPersonalComputeInterface) Get(ctx context.Context, request settings.GetPersonalComputeRequest) (*settings.PersonalComputeSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *settings.PersonalComputeSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetPersonalComputeRequest) (*settings.PersonalComputeSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetPersonalComputeRequest) *settings.PersonalComputeSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.PersonalComputeSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetPersonalComputeRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPersonalComputeInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockPersonalComputeInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetPersonalComputeRequest +func (_e *MockPersonalComputeInterface_Expecter) Get(ctx interface{}, request interface{}) *MockPersonalComputeInterface_Get_Call { + return &MockPersonalComputeInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockPersonalComputeInterface_Get_Call) Run(run func(ctx context.Context, request settings.GetPersonalComputeRequest)) *MockPersonalComputeInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetPersonalComputeRequest)) + }) + return _c +} + +func (_c *MockPersonalComputeInterface_Get_Call) Return(_a0 *settings.PersonalComputeSetting, _a1 error) *MockPersonalComputeInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPersonalComputeInterface_Get_Call) RunAndReturn(run func(context.Context, settings.GetPersonalComputeRequest) (*settings.PersonalComputeSetting, error)) *MockPersonalComputeInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockPersonalComputeInterface) Impl() settings.PersonalComputeService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 settings.PersonalComputeService + if rf, ok := ret.Get(0).(func() settings.PersonalComputeService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.PersonalComputeService) + } + } + + return r0 +} + +// MockPersonalComputeInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockPersonalComputeInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockPersonalComputeInterface_Expecter) Impl() *MockPersonalComputeInterface_Impl_Call { + return &MockPersonalComputeInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockPersonalComputeInterface_Impl_Call) Run(run func()) *MockPersonalComputeInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPersonalComputeInterface_Impl_Call) Return(_a0 settings.PersonalComputeService) *MockPersonalComputeInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPersonalComputeInterface_Impl_Call) RunAndReturn(run func() settings.PersonalComputeService) *MockPersonalComputeInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockPersonalComputeInterface) Update(ctx context.Context, request settings.UpdatePersonalComputeSettingRequest) (*settings.PersonalComputeSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *settings.PersonalComputeSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdatePersonalComputeSettingRequest) (*settings.PersonalComputeSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdatePersonalComputeSettingRequest) *settings.PersonalComputeSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.PersonalComputeSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdatePersonalComputeSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPersonalComputeInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockPersonalComputeInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdatePersonalComputeSettingRequest +func (_e *MockPersonalComputeInterface_Expecter) Update(ctx interface{}, request interface{}) *MockPersonalComputeInterface_Update_Call { + return &MockPersonalComputeInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockPersonalComputeInterface_Update_Call) Run(run func(ctx context.Context, request settings.UpdatePersonalComputeSettingRequest)) *MockPersonalComputeInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdatePersonalComputeSettingRequest)) + }) + return _c +} + +func (_c *MockPersonalComputeInterface_Update_Call) Return(_a0 *settings.PersonalComputeSetting, _a1 error) *MockPersonalComputeInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPersonalComputeInterface_Update_Call) RunAndReturn(run func(context.Context, settings.UpdatePersonalComputeSettingRequest) (*settings.PersonalComputeSetting, error)) *MockPersonalComputeInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockPersonalComputeInterface) WithImpl(impl settings.PersonalComputeService) settings.PersonalComputeInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 settings.PersonalComputeInterface + if rf, ok := ret.Get(0).(func(settings.PersonalComputeService) settings.PersonalComputeInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.PersonalComputeInterface) + } + } + + return r0 +} + +// MockPersonalComputeInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockPersonalComputeInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl settings.PersonalComputeService +func (_e *MockPersonalComputeInterface_Expecter) WithImpl(impl interface{}) *MockPersonalComputeInterface_WithImpl_Call { + return &MockPersonalComputeInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockPersonalComputeInterface_WithImpl_Call) Run(run func(impl settings.PersonalComputeService)) *MockPersonalComputeInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(settings.PersonalComputeService)) + }) + return _c +} + +func (_c *MockPersonalComputeInterface_WithImpl_Call) Return(_a0 settings.PersonalComputeInterface) *MockPersonalComputeInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPersonalComputeInterface_WithImpl_Call) RunAndReturn(run func(settings.PersonalComputeService) settings.PersonalComputeInterface) *MockPersonalComputeInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockPersonalComputeInterface creates a new instance of MockPersonalComputeInterface. 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 NewMockPersonalComputeInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockPersonalComputeInterface { + mock := &MockPersonalComputeInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settings/mock_restrict_workspace_admins_interface.go b/experimental/mocks/service/settings/mock_restrict_workspace_admins_interface.go new file mode 100644 index 000000000..52e652796 --- /dev/null +++ b/experimental/mocks/service/settings/mock_restrict_workspace_admins_interface.go @@ -0,0 +1,309 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package settings + +import ( + context "context" + + settings "github.com/databricks/databricks-sdk-go/service/settings" + mock "github.com/stretchr/testify/mock" +) + +// MockRestrictWorkspaceAdminsInterface is an autogenerated mock type for the RestrictWorkspaceAdminsInterface type +type MockRestrictWorkspaceAdminsInterface struct { + mock.Mock +} + +type MockRestrictWorkspaceAdminsInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockRestrictWorkspaceAdminsInterface) EXPECT() *MockRestrictWorkspaceAdminsInterface_Expecter { + return &MockRestrictWorkspaceAdminsInterface_Expecter{mock: &_m.Mock} +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockRestrictWorkspaceAdminsInterface) Delete(ctx context.Context, request settings.DeleteRestrictWorkspaceAdminRequest) (*settings.DeleteRestrictWorkspaceAdminsSettingResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 *settings.DeleteRestrictWorkspaceAdminsSettingResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteRestrictWorkspaceAdminRequest) (*settings.DeleteRestrictWorkspaceAdminsSettingResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteRestrictWorkspaceAdminRequest) *settings.DeleteRestrictWorkspaceAdminsSettingResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.DeleteRestrictWorkspaceAdminsSettingResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.DeleteRestrictWorkspaceAdminRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRestrictWorkspaceAdminsInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockRestrictWorkspaceAdminsInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request settings.DeleteRestrictWorkspaceAdminRequest +func (_e *MockRestrictWorkspaceAdminsInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockRestrictWorkspaceAdminsInterface_Delete_Call { + return &MockRestrictWorkspaceAdminsInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Delete_Call) Run(run func(ctx context.Context, request settings.DeleteRestrictWorkspaceAdminRequest)) *MockRestrictWorkspaceAdminsInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.DeleteRestrictWorkspaceAdminRequest)) + }) + return _c +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Delete_Call) Return(_a0 *settings.DeleteRestrictWorkspaceAdminsSettingResponse, _a1 error) *MockRestrictWorkspaceAdminsInterface_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Delete_Call) RunAndReturn(run func(context.Context, settings.DeleteRestrictWorkspaceAdminRequest) (*settings.DeleteRestrictWorkspaceAdminsSettingResponse, error)) *MockRestrictWorkspaceAdminsInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockRestrictWorkspaceAdminsInterface) Get(ctx context.Context, request settings.GetRestrictWorkspaceAdminRequest) (*settings.RestrictWorkspaceAdminsSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *settings.RestrictWorkspaceAdminsSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetRestrictWorkspaceAdminRequest) (*settings.RestrictWorkspaceAdminsSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetRestrictWorkspaceAdminRequest) *settings.RestrictWorkspaceAdminsSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.RestrictWorkspaceAdminsSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetRestrictWorkspaceAdminRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRestrictWorkspaceAdminsInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockRestrictWorkspaceAdminsInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetRestrictWorkspaceAdminRequest +func (_e *MockRestrictWorkspaceAdminsInterface_Expecter) Get(ctx interface{}, request interface{}) *MockRestrictWorkspaceAdminsInterface_Get_Call { + return &MockRestrictWorkspaceAdminsInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Get_Call) Run(run func(ctx context.Context, request settings.GetRestrictWorkspaceAdminRequest)) *MockRestrictWorkspaceAdminsInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetRestrictWorkspaceAdminRequest)) + }) + return _c +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Get_Call) Return(_a0 *settings.RestrictWorkspaceAdminsSetting, _a1 error) *MockRestrictWorkspaceAdminsInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Get_Call) RunAndReturn(run func(context.Context, settings.GetRestrictWorkspaceAdminRequest) (*settings.RestrictWorkspaceAdminsSetting, error)) *MockRestrictWorkspaceAdminsInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// Impl provides a mock function with given fields: +func (_m *MockRestrictWorkspaceAdminsInterface) Impl() settings.RestrictWorkspaceAdminsService { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Impl") + } + + var r0 settings.RestrictWorkspaceAdminsService + if rf, ok := ret.Get(0).(func() settings.RestrictWorkspaceAdminsService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.RestrictWorkspaceAdminsService) + } + } + + return r0 +} + +// MockRestrictWorkspaceAdminsInterface_Impl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Impl' +type MockRestrictWorkspaceAdminsInterface_Impl_Call struct { + *mock.Call +} + +// Impl is a helper method to define mock.On call +func (_e *MockRestrictWorkspaceAdminsInterface_Expecter) Impl() *MockRestrictWorkspaceAdminsInterface_Impl_Call { + return &MockRestrictWorkspaceAdminsInterface_Impl_Call{Call: _e.mock.On("Impl")} +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Impl_Call) Run(run func()) *MockRestrictWorkspaceAdminsInterface_Impl_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Impl_Call) Return(_a0 settings.RestrictWorkspaceAdminsService) *MockRestrictWorkspaceAdminsInterface_Impl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Impl_Call) RunAndReturn(run func() settings.RestrictWorkspaceAdminsService) *MockRestrictWorkspaceAdminsInterface_Impl_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockRestrictWorkspaceAdminsInterface) Update(ctx context.Context, request settings.UpdateRestrictWorkspaceAdminsSettingRequest) (*settings.RestrictWorkspaceAdminsSetting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *settings.RestrictWorkspaceAdminsSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateRestrictWorkspaceAdminsSettingRequest) (*settings.RestrictWorkspaceAdminsSetting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateRestrictWorkspaceAdminsSettingRequest) *settings.RestrictWorkspaceAdminsSetting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.RestrictWorkspaceAdminsSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateRestrictWorkspaceAdminsSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRestrictWorkspaceAdminsInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockRestrictWorkspaceAdminsInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdateRestrictWorkspaceAdminsSettingRequest +func (_e *MockRestrictWorkspaceAdminsInterface_Expecter) Update(ctx interface{}, request interface{}) *MockRestrictWorkspaceAdminsInterface_Update_Call { + return &MockRestrictWorkspaceAdminsInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Update_Call) Run(run func(ctx context.Context, request settings.UpdateRestrictWorkspaceAdminsSettingRequest)) *MockRestrictWorkspaceAdminsInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdateRestrictWorkspaceAdminsSettingRequest)) + }) + return _c +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Update_Call) Return(_a0 *settings.RestrictWorkspaceAdminsSetting, _a1 error) *MockRestrictWorkspaceAdminsInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRestrictWorkspaceAdminsInterface_Update_Call) RunAndReturn(run func(context.Context, settings.UpdateRestrictWorkspaceAdminsSettingRequest) (*settings.RestrictWorkspaceAdminsSetting, error)) *MockRestrictWorkspaceAdminsInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// WithImpl provides a mock function with given fields: impl +func (_m *MockRestrictWorkspaceAdminsInterface) WithImpl(impl settings.RestrictWorkspaceAdminsService) settings.RestrictWorkspaceAdminsInterface { + ret := _m.Called(impl) + + if len(ret) == 0 { + panic("no return value specified for WithImpl") + } + + var r0 settings.RestrictWorkspaceAdminsInterface + if rf, ok := ret.Get(0).(func(settings.RestrictWorkspaceAdminsService) settings.RestrictWorkspaceAdminsInterface); ok { + r0 = rf(impl) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.RestrictWorkspaceAdminsInterface) + } + } + + return r0 +} + +// MockRestrictWorkspaceAdminsInterface_WithImpl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithImpl' +type MockRestrictWorkspaceAdminsInterface_WithImpl_Call struct { + *mock.Call +} + +// WithImpl is a helper method to define mock.On call +// - impl settings.RestrictWorkspaceAdminsService +func (_e *MockRestrictWorkspaceAdminsInterface_Expecter) WithImpl(impl interface{}) *MockRestrictWorkspaceAdminsInterface_WithImpl_Call { + return &MockRestrictWorkspaceAdminsInterface_WithImpl_Call{Call: _e.mock.On("WithImpl", impl)} +} + +func (_c *MockRestrictWorkspaceAdminsInterface_WithImpl_Call) Run(run func(impl settings.RestrictWorkspaceAdminsService)) *MockRestrictWorkspaceAdminsInterface_WithImpl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(settings.RestrictWorkspaceAdminsService)) + }) + return _c +} + +func (_c *MockRestrictWorkspaceAdminsInterface_WithImpl_Call) Return(_a0 settings.RestrictWorkspaceAdminsInterface) *MockRestrictWorkspaceAdminsInterface_WithImpl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockRestrictWorkspaceAdminsInterface_WithImpl_Call) RunAndReturn(run func(settings.RestrictWorkspaceAdminsService) settings.RestrictWorkspaceAdminsInterface) *MockRestrictWorkspaceAdminsInterface_WithImpl_Call { + _c.Call.Return(run) + return _c +} + +// NewMockRestrictWorkspaceAdminsInterface creates a new instance of MockRestrictWorkspaceAdminsInterface. 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 NewMockRestrictWorkspaceAdminsInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRestrictWorkspaceAdminsInterface { + mock := &MockRestrictWorkspaceAdminsInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settings/mock_settings_interface.go b/experimental/mocks/service/settings/mock_settings_interface.go index 971a6270e..0a1af098c 100644 --- a/experimental/mocks/service/settings/mock_settings_interface.go +++ b/experimental/mocks/service/settings/mock_settings_interface.go @@ -3,8 +3,6 @@ package settings import ( - context "context" - settings "github.com/databricks/databricks-sdk-go/service/settings" mock "github.com/stretchr/testify/mock" ) @@ -22,415 +20,190 @@ func (_m *MockSettingsInterface) EXPECT() *MockSettingsInterface_Expecter { return &MockSettingsInterface_Expecter{mock: &_m.Mock} } -// DeleteDefaultNamespaceSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) DeleteDefaultNamespaceSetting(ctx context.Context, request settings.DeleteDefaultNamespaceSettingRequest) (*settings.DeleteDefaultNamespaceSettingResponse, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for DeleteDefaultNamespaceSetting") - } - - var r0 *settings.DeleteDefaultNamespaceSettingResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteDefaultNamespaceSettingRequest) (*settings.DeleteDefaultNamespaceSettingResponse, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteDefaultNamespaceSettingRequest) *settings.DeleteDefaultNamespaceSettingResponse); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.DeleteDefaultNamespaceSettingResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.DeleteDefaultNamespaceSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSettingsInterface_DeleteDefaultNamespaceSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDefaultNamespaceSetting' -type MockSettingsInterface_DeleteDefaultNamespaceSetting_Call struct { - *mock.Call -} - -// DeleteDefaultNamespaceSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.DeleteDefaultNamespaceSettingRequest -func (_e *MockSettingsInterface_Expecter) DeleteDefaultNamespaceSetting(ctx interface{}, request interface{}) *MockSettingsInterface_DeleteDefaultNamespaceSetting_Call { - return &MockSettingsInterface_DeleteDefaultNamespaceSetting_Call{Call: _e.mock.On("DeleteDefaultNamespaceSetting", ctx, request)} -} - -func (_c *MockSettingsInterface_DeleteDefaultNamespaceSetting_Call) Run(run func(ctx context.Context, request settings.DeleteDefaultNamespaceSettingRequest)) *MockSettingsInterface_DeleteDefaultNamespaceSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.DeleteDefaultNamespaceSettingRequest)) - }) - return _c -} - -func (_c *MockSettingsInterface_DeleteDefaultNamespaceSetting_Call) Return(_a0 *settings.DeleteDefaultNamespaceSettingResponse, _a1 error) *MockSettingsInterface_DeleteDefaultNamespaceSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSettingsInterface_DeleteDefaultNamespaceSetting_Call) RunAndReturn(run func(context.Context, settings.DeleteDefaultNamespaceSettingRequest) (*settings.DeleteDefaultNamespaceSettingResponse, error)) *MockSettingsInterface_DeleteDefaultNamespaceSetting_Call { - _c.Call.Return(run) - return _c -} - -// DeleteRestrictWorkspaceAdminsSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) DeleteRestrictWorkspaceAdminsSetting(ctx context.Context, request settings.DeleteRestrictWorkspaceAdminsSettingRequest) (*settings.DeleteRestrictWorkspaceAdminsSettingResponse, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for DeleteRestrictWorkspaceAdminsSetting") - } - - var r0 *settings.DeleteRestrictWorkspaceAdminsSettingResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteRestrictWorkspaceAdminsSettingRequest) (*settings.DeleteRestrictWorkspaceAdminsSettingResponse, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteRestrictWorkspaceAdminsSettingRequest) *settings.DeleteRestrictWorkspaceAdminsSettingResponse); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.DeleteRestrictWorkspaceAdminsSettingResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.DeleteRestrictWorkspaceAdminsSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSettingsInterface_DeleteRestrictWorkspaceAdminsSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteRestrictWorkspaceAdminsSetting' -type MockSettingsInterface_DeleteRestrictWorkspaceAdminsSetting_Call struct { - *mock.Call -} - -// DeleteRestrictWorkspaceAdminsSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.DeleteRestrictWorkspaceAdminsSettingRequest -func (_e *MockSettingsInterface_Expecter) DeleteRestrictWorkspaceAdminsSetting(ctx interface{}, request interface{}) *MockSettingsInterface_DeleteRestrictWorkspaceAdminsSetting_Call { - return &MockSettingsInterface_DeleteRestrictWorkspaceAdminsSetting_Call{Call: _e.mock.On("DeleteRestrictWorkspaceAdminsSetting", ctx, request)} -} - -func (_c *MockSettingsInterface_DeleteRestrictWorkspaceAdminsSetting_Call) Run(run func(ctx context.Context, request settings.DeleteRestrictWorkspaceAdminsSettingRequest)) *MockSettingsInterface_DeleteRestrictWorkspaceAdminsSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.DeleteRestrictWorkspaceAdminsSettingRequest)) - }) - return _c -} - -func (_c *MockSettingsInterface_DeleteRestrictWorkspaceAdminsSetting_Call) Return(_a0 *settings.DeleteRestrictWorkspaceAdminsSettingResponse, _a1 error) *MockSettingsInterface_DeleteRestrictWorkspaceAdminsSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSettingsInterface_DeleteRestrictWorkspaceAdminsSetting_Call) RunAndReturn(run func(context.Context, settings.DeleteRestrictWorkspaceAdminsSettingRequest) (*settings.DeleteRestrictWorkspaceAdminsSettingResponse, error)) *MockSettingsInterface_DeleteRestrictWorkspaceAdminsSetting_Call { - _c.Call.Return(run) - return _c -} - -// GetAutomaticClusterUpdateSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) GetAutomaticClusterUpdateSetting(ctx context.Context, request settings.GetAutomaticClusterUpdateSettingRequest) (*settings.AutomaticClusterUpdateSetting, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for GetAutomaticClusterUpdateSetting") - } - - var r0 *settings.AutomaticClusterUpdateSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.GetAutomaticClusterUpdateSettingRequest) (*settings.AutomaticClusterUpdateSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.GetAutomaticClusterUpdateSettingRequest) *settings.AutomaticClusterUpdateSetting); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.AutomaticClusterUpdateSetting) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.GetAutomaticClusterUpdateSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSettingsInterface_GetAutomaticClusterUpdateSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAutomaticClusterUpdateSetting' -type MockSettingsInterface_GetAutomaticClusterUpdateSetting_Call struct { - *mock.Call -} - -// GetAutomaticClusterUpdateSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.GetAutomaticClusterUpdateSettingRequest -func (_e *MockSettingsInterface_Expecter) GetAutomaticClusterUpdateSetting(ctx interface{}, request interface{}) *MockSettingsInterface_GetAutomaticClusterUpdateSetting_Call { - return &MockSettingsInterface_GetAutomaticClusterUpdateSetting_Call{Call: _e.mock.On("GetAutomaticClusterUpdateSetting", ctx, request)} -} - -func (_c *MockSettingsInterface_GetAutomaticClusterUpdateSetting_Call) Run(run func(ctx context.Context, request settings.GetAutomaticClusterUpdateSettingRequest)) *MockSettingsInterface_GetAutomaticClusterUpdateSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.GetAutomaticClusterUpdateSettingRequest)) - }) - return _c -} - -func (_c *MockSettingsInterface_GetAutomaticClusterUpdateSetting_Call) Return(_a0 *settings.AutomaticClusterUpdateSetting, _a1 error) *MockSettingsInterface_GetAutomaticClusterUpdateSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSettingsInterface_GetAutomaticClusterUpdateSetting_Call) RunAndReturn(run func(context.Context, settings.GetAutomaticClusterUpdateSettingRequest) (*settings.AutomaticClusterUpdateSetting, error)) *MockSettingsInterface_GetAutomaticClusterUpdateSetting_Call { - _c.Call.Return(run) - return _c -} - -// GetCspEnablementSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) GetCspEnablementSetting(ctx context.Context, request settings.GetCspEnablementSettingRequest) (*settings.CspEnablementSetting, error) { - ret := _m.Called(ctx, request) +// AutomaticClusterUpdate provides a mock function with given fields: +func (_m *MockSettingsInterface) AutomaticClusterUpdate() settings.AutomaticClusterUpdateInterface { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for GetCspEnablementSetting") + panic("no return value specified for AutomaticClusterUpdate") } - var r0 *settings.CspEnablementSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.GetCspEnablementSettingRequest) (*settings.CspEnablementSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.GetCspEnablementSettingRequest) *settings.CspEnablementSetting); ok { - r0 = rf(ctx, request) + var r0 settings.AutomaticClusterUpdateInterface + if rf, ok := ret.Get(0).(func() settings.AutomaticClusterUpdateInterface); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.CspEnablementSetting) + r0 = ret.Get(0).(settings.AutomaticClusterUpdateInterface) } } - if rf, ok := ret.Get(1).(func(context.Context, settings.GetCspEnablementSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } -// MockSettingsInterface_GetCspEnablementSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCspEnablementSetting' -type MockSettingsInterface_GetCspEnablementSetting_Call struct { +// MockSettingsInterface_AutomaticClusterUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AutomaticClusterUpdate' +type MockSettingsInterface_AutomaticClusterUpdate_Call struct { *mock.Call } -// GetCspEnablementSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.GetCspEnablementSettingRequest -func (_e *MockSettingsInterface_Expecter) GetCspEnablementSetting(ctx interface{}, request interface{}) *MockSettingsInterface_GetCspEnablementSetting_Call { - return &MockSettingsInterface_GetCspEnablementSetting_Call{Call: _e.mock.On("GetCspEnablementSetting", ctx, request)} +// AutomaticClusterUpdate is a helper method to define mock.On call +func (_e *MockSettingsInterface_Expecter) AutomaticClusterUpdate() *MockSettingsInterface_AutomaticClusterUpdate_Call { + return &MockSettingsInterface_AutomaticClusterUpdate_Call{Call: _e.mock.On("AutomaticClusterUpdate")} } -func (_c *MockSettingsInterface_GetCspEnablementSetting_Call) Run(run func(ctx context.Context, request settings.GetCspEnablementSettingRequest)) *MockSettingsInterface_GetCspEnablementSetting_Call { +func (_c *MockSettingsInterface_AutomaticClusterUpdate_Call) Run(run func()) *MockSettingsInterface_AutomaticClusterUpdate_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.GetCspEnablementSettingRequest)) + run() }) return _c } -func (_c *MockSettingsInterface_GetCspEnablementSetting_Call) Return(_a0 *settings.CspEnablementSetting, _a1 error) *MockSettingsInterface_GetCspEnablementSetting_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockSettingsInterface_AutomaticClusterUpdate_Call) Return(_a0 settings.AutomaticClusterUpdateInterface) *MockSettingsInterface_AutomaticClusterUpdate_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockSettingsInterface_GetCspEnablementSetting_Call) RunAndReturn(run func(context.Context, settings.GetCspEnablementSettingRequest) (*settings.CspEnablementSetting, error)) *MockSettingsInterface_GetCspEnablementSetting_Call { +func (_c *MockSettingsInterface_AutomaticClusterUpdate_Call) RunAndReturn(run func() settings.AutomaticClusterUpdateInterface) *MockSettingsInterface_AutomaticClusterUpdate_Call { _c.Call.Return(run) return _c } -// GetDefaultNamespaceSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) GetDefaultNamespaceSetting(ctx context.Context, request settings.GetDefaultNamespaceSettingRequest) (*settings.DefaultNamespaceSetting, error) { - ret := _m.Called(ctx, request) +// CspEnablement provides a mock function with given fields: +func (_m *MockSettingsInterface) CspEnablement() settings.CspEnablementInterface { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for GetDefaultNamespaceSetting") + panic("no return value specified for CspEnablement") } - var r0 *settings.DefaultNamespaceSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.GetDefaultNamespaceSettingRequest) (*settings.DefaultNamespaceSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.GetDefaultNamespaceSettingRequest) *settings.DefaultNamespaceSetting); ok { - r0 = rf(ctx, request) + var r0 settings.CspEnablementInterface + if rf, ok := ret.Get(0).(func() settings.CspEnablementInterface); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.DefaultNamespaceSetting) + r0 = ret.Get(0).(settings.CspEnablementInterface) } } - if rf, ok := ret.Get(1).(func(context.Context, settings.GetDefaultNamespaceSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } -// MockSettingsInterface_GetDefaultNamespaceSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDefaultNamespaceSetting' -type MockSettingsInterface_GetDefaultNamespaceSetting_Call struct { +// MockSettingsInterface_CspEnablement_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CspEnablement' +type MockSettingsInterface_CspEnablement_Call struct { *mock.Call } -// GetDefaultNamespaceSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.GetDefaultNamespaceSettingRequest -func (_e *MockSettingsInterface_Expecter) GetDefaultNamespaceSetting(ctx interface{}, request interface{}) *MockSettingsInterface_GetDefaultNamespaceSetting_Call { - return &MockSettingsInterface_GetDefaultNamespaceSetting_Call{Call: _e.mock.On("GetDefaultNamespaceSetting", ctx, request)} +// CspEnablement is a helper method to define mock.On call +func (_e *MockSettingsInterface_Expecter) CspEnablement() *MockSettingsInterface_CspEnablement_Call { + return &MockSettingsInterface_CspEnablement_Call{Call: _e.mock.On("CspEnablement")} } -func (_c *MockSettingsInterface_GetDefaultNamespaceSetting_Call) Run(run func(ctx context.Context, request settings.GetDefaultNamespaceSettingRequest)) *MockSettingsInterface_GetDefaultNamespaceSetting_Call { +func (_c *MockSettingsInterface_CspEnablement_Call) Run(run func()) *MockSettingsInterface_CspEnablement_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.GetDefaultNamespaceSettingRequest)) + run() }) return _c } -func (_c *MockSettingsInterface_GetDefaultNamespaceSetting_Call) Return(_a0 *settings.DefaultNamespaceSetting, _a1 error) *MockSettingsInterface_GetDefaultNamespaceSetting_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockSettingsInterface_CspEnablement_Call) Return(_a0 settings.CspEnablementInterface) *MockSettingsInterface_CspEnablement_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockSettingsInterface_GetDefaultNamespaceSetting_Call) RunAndReturn(run func(context.Context, settings.GetDefaultNamespaceSettingRequest) (*settings.DefaultNamespaceSetting, error)) *MockSettingsInterface_GetDefaultNamespaceSetting_Call { +func (_c *MockSettingsInterface_CspEnablement_Call) RunAndReturn(run func() settings.CspEnablementInterface) *MockSettingsInterface_CspEnablement_Call { _c.Call.Return(run) return _c } -// GetEsmEnablementSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) GetEsmEnablementSetting(ctx context.Context, request settings.GetEsmEnablementSettingRequest) (*settings.EsmEnablementSetting, error) { - ret := _m.Called(ctx, request) +// DefaultNamespace provides a mock function with given fields: +func (_m *MockSettingsInterface) DefaultNamespace() settings.DefaultNamespaceInterface { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for GetEsmEnablementSetting") + panic("no return value specified for DefaultNamespace") } - var r0 *settings.EsmEnablementSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.GetEsmEnablementSettingRequest) (*settings.EsmEnablementSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.GetEsmEnablementSettingRequest) *settings.EsmEnablementSetting); ok { - r0 = rf(ctx, request) + var r0 settings.DefaultNamespaceInterface + if rf, ok := ret.Get(0).(func() settings.DefaultNamespaceInterface); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.EsmEnablementSetting) + r0 = ret.Get(0).(settings.DefaultNamespaceInterface) } } - if rf, ok := ret.Get(1).(func(context.Context, settings.GetEsmEnablementSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } -// MockSettingsInterface_GetEsmEnablementSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEsmEnablementSetting' -type MockSettingsInterface_GetEsmEnablementSetting_Call struct { +// MockSettingsInterface_DefaultNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DefaultNamespace' +type MockSettingsInterface_DefaultNamespace_Call struct { *mock.Call } -// GetEsmEnablementSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.GetEsmEnablementSettingRequest -func (_e *MockSettingsInterface_Expecter) GetEsmEnablementSetting(ctx interface{}, request interface{}) *MockSettingsInterface_GetEsmEnablementSetting_Call { - return &MockSettingsInterface_GetEsmEnablementSetting_Call{Call: _e.mock.On("GetEsmEnablementSetting", ctx, request)} +// DefaultNamespace is a helper method to define mock.On call +func (_e *MockSettingsInterface_Expecter) DefaultNamespace() *MockSettingsInterface_DefaultNamespace_Call { + return &MockSettingsInterface_DefaultNamespace_Call{Call: _e.mock.On("DefaultNamespace")} } -func (_c *MockSettingsInterface_GetEsmEnablementSetting_Call) Run(run func(ctx context.Context, request settings.GetEsmEnablementSettingRequest)) *MockSettingsInterface_GetEsmEnablementSetting_Call { +func (_c *MockSettingsInterface_DefaultNamespace_Call) Run(run func()) *MockSettingsInterface_DefaultNamespace_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.GetEsmEnablementSettingRequest)) + run() }) return _c } -func (_c *MockSettingsInterface_GetEsmEnablementSetting_Call) Return(_a0 *settings.EsmEnablementSetting, _a1 error) *MockSettingsInterface_GetEsmEnablementSetting_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockSettingsInterface_DefaultNamespace_Call) Return(_a0 settings.DefaultNamespaceInterface) *MockSettingsInterface_DefaultNamespace_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockSettingsInterface_GetEsmEnablementSetting_Call) RunAndReturn(run func(context.Context, settings.GetEsmEnablementSettingRequest) (*settings.EsmEnablementSetting, error)) *MockSettingsInterface_GetEsmEnablementSetting_Call { +func (_c *MockSettingsInterface_DefaultNamespace_Call) RunAndReturn(run func() settings.DefaultNamespaceInterface) *MockSettingsInterface_DefaultNamespace_Call { _c.Call.Return(run) return _c } -// GetRestrictWorkspaceAdminsSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) GetRestrictWorkspaceAdminsSetting(ctx context.Context, request settings.GetRestrictWorkspaceAdminsSettingRequest) (*settings.RestrictWorkspaceAdminsSetting, error) { - ret := _m.Called(ctx, request) +// EsmEnablement provides a mock function with given fields: +func (_m *MockSettingsInterface) EsmEnablement() settings.EsmEnablementInterface { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for GetRestrictWorkspaceAdminsSetting") + panic("no return value specified for EsmEnablement") } - var r0 *settings.RestrictWorkspaceAdminsSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.GetRestrictWorkspaceAdminsSettingRequest) (*settings.RestrictWorkspaceAdminsSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.GetRestrictWorkspaceAdminsSettingRequest) *settings.RestrictWorkspaceAdminsSetting); ok { - r0 = rf(ctx, request) + var r0 settings.EsmEnablementInterface + if rf, ok := ret.Get(0).(func() settings.EsmEnablementInterface); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.RestrictWorkspaceAdminsSetting) + r0 = ret.Get(0).(settings.EsmEnablementInterface) } } - if rf, ok := ret.Get(1).(func(context.Context, settings.GetRestrictWorkspaceAdminsSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } -// MockSettingsInterface_GetRestrictWorkspaceAdminsSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRestrictWorkspaceAdminsSetting' -type MockSettingsInterface_GetRestrictWorkspaceAdminsSetting_Call struct { +// MockSettingsInterface_EsmEnablement_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EsmEnablement' +type MockSettingsInterface_EsmEnablement_Call struct { *mock.Call } -// GetRestrictWorkspaceAdminsSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.GetRestrictWorkspaceAdminsSettingRequest -func (_e *MockSettingsInterface_Expecter) GetRestrictWorkspaceAdminsSetting(ctx interface{}, request interface{}) *MockSettingsInterface_GetRestrictWorkspaceAdminsSetting_Call { - return &MockSettingsInterface_GetRestrictWorkspaceAdminsSetting_Call{Call: _e.mock.On("GetRestrictWorkspaceAdminsSetting", ctx, request)} +// EsmEnablement is a helper method to define mock.On call +func (_e *MockSettingsInterface_Expecter) EsmEnablement() *MockSettingsInterface_EsmEnablement_Call { + return &MockSettingsInterface_EsmEnablement_Call{Call: _e.mock.On("EsmEnablement")} } -func (_c *MockSettingsInterface_GetRestrictWorkspaceAdminsSetting_Call) Run(run func(ctx context.Context, request settings.GetRestrictWorkspaceAdminsSettingRequest)) *MockSettingsInterface_GetRestrictWorkspaceAdminsSetting_Call { +func (_c *MockSettingsInterface_EsmEnablement_Call) Run(run func()) *MockSettingsInterface_EsmEnablement_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.GetRestrictWorkspaceAdminsSettingRequest)) + run() }) return _c } -func (_c *MockSettingsInterface_GetRestrictWorkspaceAdminsSetting_Call) Return(_a0 *settings.RestrictWorkspaceAdminsSetting, _a1 error) *MockSettingsInterface_GetRestrictWorkspaceAdminsSetting_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockSettingsInterface_EsmEnablement_Call) Return(_a0 settings.EsmEnablementInterface) *MockSettingsInterface_EsmEnablement_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockSettingsInterface_GetRestrictWorkspaceAdminsSetting_Call) RunAndReturn(run func(context.Context, settings.GetRestrictWorkspaceAdminsSettingRequest) (*settings.RestrictWorkspaceAdminsSetting, error)) *MockSettingsInterface_GetRestrictWorkspaceAdminsSetting_Call { +func (_c *MockSettingsInterface_EsmEnablement_Call) RunAndReturn(run func() settings.EsmEnablementInterface) *MockSettingsInterface_EsmEnablement_Call { _c.Call.Return(run) return _c } @@ -482,297 +255,49 @@ func (_c *MockSettingsInterface_Impl_Call) RunAndReturn(run func() settings.Sett return _c } -// UpdateAutomaticClusterUpdateSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) UpdateAutomaticClusterUpdateSetting(ctx context.Context, request settings.UpdateAutomaticClusterUpdateSettingRequest) (*settings.AutomaticClusterUpdateSetting, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for UpdateAutomaticClusterUpdateSetting") - } - - var r0 *settings.AutomaticClusterUpdateSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateAutomaticClusterUpdateSettingRequest) (*settings.AutomaticClusterUpdateSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateAutomaticClusterUpdateSettingRequest) *settings.AutomaticClusterUpdateSetting); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.AutomaticClusterUpdateSetting) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateAutomaticClusterUpdateSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSettingsInterface_UpdateAutomaticClusterUpdateSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAutomaticClusterUpdateSetting' -type MockSettingsInterface_UpdateAutomaticClusterUpdateSetting_Call struct { - *mock.Call -} - -// UpdateAutomaticClusterUpdateSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.UpdateAutomaticClusterUpdateSettingRequest -func (_e *MockSettingsInterface_Expecter) UpdateAutomaticClusterUpdateSetting(ctx interface{}, request interface{}) *MockSettingsInterface_UpdateAutomaticClusterUpdateSetting_Call { - return &MockSettingsInterface_UpdateAutomaticClusterUpdateSetting_Call{Call: _e.mock.On("UpdateAutomaticClusterUpdateSetting", ctx, request)} -} - -func (_c *MockSettingsInterface_UpdateAutomaticClusterUpdateSetting_Call) Run(run func(ctx context.Context, request settings.UpdateAutomaticClusterUpdateSettingRequest)) *MockSettingsInterface_UpdateAutomaticClusterUpdateSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.UpdateAutomaticClusterUpdateSettingRequest)) - }) - return _c -} - -func (_c *MockSettingsInterface_UpdateAutomaticClusterUpdateSetting_Call) Return(_a0 *settings.AutomaticClusterUpdateSetting, _a1 error) *MockSettingsInterface_UpdateAutomaticClusterUpdateSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSettingsInterface_UpdateAutomaticClusterUpdateSetting_Call) RunAndReturn(run func(context.Context, settings.UpdateAutomaticClusterUpdateSettingRequest) (*settings.AutomaticClusterUpdateSetting, error)) *MockSettingsInterface_UpdateAutomaticClusterUpdateSetting_Call { - _c.Call.Return(run) - return _c -} - -// UpdateCspEnablementSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) UpdateCspEnablementSetting(ctx context.Context, request settings.UpdateCspEnablementSettingRequest) (*settings.CspEnablementSetting, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for UpdateCspEnablementSetting") - } - - var r0 *settings.CspEnablementSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateCspEnablementSettingRequest) (*settings.CspEnablementSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateCspEnablementSettingRequest) *settings.CspEnablementSetting); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.CspEnablementSetting) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateCspEnablementSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSettingsInterface_UpdateCspEnablementSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCspEnablementSetting' -type MockSettingsInterface_UpdateCspEnablementSetting_Call struct { - *mock.Call -} - -// UpdateCspEnablementSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.UpdateCspEnablementSettingRequest -func (_e *MockSettingsInterface_Expecter) UpdateCspEnablementSetting(ctx interface{}, request interface{}) *MockSettingsInterface_UpdateCspEnablementSetting_Call { - return &MockSettingsInterface_UpdateCspEnablementSetting_Call{Call: _e.mock.On("UpdateCspEnablementSetting", ctx, request)} -} - -func (_c *MockSettingsInterface_UpdateCspEnablementSetting_Call) Run(run func(ctx context.Context, request settings.UpdateCspEnablementSettingRequest)) *MockSettingsInterface_UpdateCspEnablementSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.UpdateCspEnablementSettingRequest)) - }) - return _c -} - -func (_c *MockSettingsInterface_UpdateCspEnablementSetting_Call) Return(_a0 *settings.CspEnablementSetting, _a1 error) *MockSettingsInterface_UpdateCspEnablementSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSettingsInterface_UpdateCspEnablementSetting_Call) RunAndReturn(run func(context.Context, settings.UpdateCspEnablementSettingRequest) (*settings.CspEnablementSetting, error)) *MockSettingsInterface_UpdateCspEnablementSetting_Call { - _c.Call.Return(run) - return _c -} - -// UpdateDefaultNamespaceSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) UpdateDefaultNamespaceSetting(ctx context.Context, request settings.UpdateDefaultNamespaceSettingRequest) (*settings.DefaultNamespaceSetting, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for UpdateDefaultNamespaceSetting") - } - - var r0 *settings.DefaultNamespaceSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateDefaultNamespaceSettingRequest) (*settings.DefaultNamespaceSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateDefaultNamespaceSettingRequest) *settings.DefaultNamespaceSetting); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.DefaultNamespaceSetting) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateDefaultNamespaceSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSettingsInterface_UpdateDefaultNamespaceSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDefaultNamespaceSetting' -type MockSettingsInterface_UpdateDefaultNamespaceSetting_Call struct { - *mock.Call -} - -// UpdateDefaultNamespaceSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.UpdateDefaultNamespaceSettingRequest -func (_e *MockSettingsInterface_Expecter) UpdateDefaultNamespaceSetting(ctx interface{}, request interface{}) *MockSettingsInterface_UpdateDefaultNamespaceSetting_Call { - return &MockSettingsInterface_UpdateDefaultNamespaceSetting_Call{Call: _e.mock.On("UpdateDefaultNamespaceSetting", ctx, request)} -} - -func (_c *MockSettingsInterface_UpdateDefaultNamespaceSetting_Call) Run(run func(ctx context.Context, request settings.UpdateDefaultNamespaceSettingRequest)) *MockSettingsInterface_UpdateDefaultNamespaceSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.UpdateDefaultNamespaceSettingRequest)) - }) - return _c -} - -func (_c *MockSettingsInterface_UpdateDefaultNamespaceSetting_Call) Return(_a0 *settings.DefaultNamespaceSetting, _a1 error) *MockSettingsInterface_UpdateDefaultNamespaceSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSettingsInterface_UpdateDefaultNamespaceSetting_Call) RunAndReturn(run func(context.Context, settings.UpdateDefaultNamespaceSettingRequest) (*settings.DefaultNamespaceSetting, error)) *MockSettingsInterface_UpdateDefaultNamespaceSetting_Call { - _c.Call.Return(run) - return _c -} - -// UpdateEsmEnablementSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) UpdateEsmEnablementSetting(ctx context.Context, request settings.UpdateEsmEnablementSettingRequest) (*settings.EsmEnablementSetting, error) { - ret := _m.Called(ctx, request) - - if len(ret) == 0 { - panic("no return value specified for UpdateEsmEnablementSetting") - } - - var r0 *settings.EsmEnablementSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateEsmEnablementSettingRequest) (*settings.EsmEnablementSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateEsmEnablementSettingRequest) *settings.EsmEnablementSetting); ok { - r0 = rf(ctx, request) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.EsmEnablementSetting) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateEsmEnablementSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSettingsInterface_UpdateEsmEnablementSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateEsmEnablementSetting' -type MockSettingsInterface_UpdateEsmEnablementSetting_Call struct { - *mock.Call -} - -// UpdateEsmEnablementSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.UpdateEsmEnablementSettingRequest -func (_e *MockSettingsInterface_Expecter) UpdateEsmEnablementSetting(ctx interface{}, request interface{}) *MockSettingsInterface_UpdateEsmEnablementSetting_Call { - return &MockSettingsInterface_UpdateEsmEnablementSetting_Call{Call: _e.mock.On("UpdateEsmEnablementSetting", ctx, request)} -} - -func (_c *MockSettingsInterface_UpdateEsmEnablementSetting_Call) Run(run func(ctx context.Context, request settings.UpdateEsmEnablementSettingRequest)) *MockSettingsInterface_UpdateEsmEnablementSetting_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.UpdateEsmEnablementSettingRequest)) - }) - return _c -} - -func (_c *MockSettingsInterface_UpdateEsmEnablementSetting_Call) Return(_a0 *settings.EsmEnablementSetting, _a1 error) *MockSettingsInterface_UpdateEsmEnablementSetting_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSettingsInterface_UpdateEsmEnablementSetting_Call) RunAndReturn(run func(context.Context, settings.UpdateEsmEnablementSettingRequest) (*settings.EsmEnablementSetting, error)) *MockSettingsInterface_UpdateEsmEnablementSetting_Call { - _c.Call.Return(run) - return _c -} - -// UpdateRestrictWorkspaceAdminsSetting provides a mock function with given fields: ctx, request -func (_m *MockSettingsInterface) UpdateRestrictWorkspaceAdminsSetting(ctx context.Context, request settings.UpdateRestrictWorkspaceAdminsSettingRequest) (*settings.RestrictWorkspaceAdminsSetting, error) { - ret := _m.Called(ctx, request) +// RestrictWorkspaceAdmins provides a mock function with given fields: +func (_m *MockSettingsInterface) RestrictWorkspaceAdmins() settings.RestrictWorkspaceAdminsInterface { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for UpdateRestrictWorkspaceAdminsSetting") + panic("no return value specified for RestrictWorkspaceAdmins") } - var r0 *settings.RestrictWorkspaceAdminsSetting - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateRestrictWorkspaceAdminsSettingRequest) (*settings.RestrictWorkspaceAdminsSetting, error)); ok { - return rf(ctx, request) - } - if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateRestrictWorkspaceAdminsSettingRequest) *settings.RestrictWorkspaceAdminsSetting); ok { - r0 = rf(ctx, request) + var r0 settings.RestrictWorkspaceAdminsInterface + if rf, ok := ret.Get(0).(func() settings.RestrictWorkspaceAdminsInterface); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*settings.RestrictWorkspaceAdminsSetting) + r0 = ret.Get(0).(settings.RestrictWorkspaceAdminsInterface) } } - if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateRestrictWorkspaceAdminsSettingRequest) error); ok { - r1 = rf(ctx, request) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } -// MockSettingsInterface_UpdateRestrictWorkspaceAdminsSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRestrictWorkspaceAdminsSetting' -type MockSettingsInterface_UpdateRestrictWorkspaceAdminsSetting_Call struct { +// MockSettingsInterface_RestrictWorkspaceAdmins_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RestrictWorkspaceAdmins' +type MockSettingsInterface_RestrictWorkspaceAdmins_Call struct { *mock.Call } -// UpdateRestrictWorkspaceAdminsSetting is a helper method to define mock.On call -// - ctx context.Context -// - request settings.UpdateRestrictWorkspaceAdminsSettingRequest -func (_e *MockSettingsInterface_Expecter) UpdateRestrictWorkspaceAdminsSetting(ctx interface{}, request interface{}) *MockSettingsInterface_UpdateRestrictWorkspaceAdminsSetting_Call { - return &MockSettingsInterface_UpdateRestrictWorkspaceAdminsSetting_Call{Call: _e.mock.On("UpdateRestrictWorkspaceAdminsSetting", ctx, request)} +// RestrictWorkspaceAdmins is a helper method to define mock.On call +func (_e *MockSettingsInterface_Expecter) RestrictWorkspaceAdmins() *MockSettingsInterface_RestrictWorkspaceAdmins_Call { + return &MockSettingsInterface_RestrictWorkspaceAdmins_Call{Call: _e.mock.On("RestrictWorkspaceAdmins")} } -func (_c *MockSettingsInterface_UpdateRestrictWorkspaceAdminsSetting_Call) Run(run func(ctx context.Context, request settings.UpdateRestrictWorkspaceAdminsSettingRequest)) *MockSettingsInterface_UpdateRestrictWorkspaceAdminsSetting_Call { +func (_c *MockSettingsInterface_RestrictWorkspaceAdmins_Call) Run(run func()) *MockSettingsInterface_RestrictWorkspaceAdmins_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(settings.UpdateRestrictWorkspaceAdminsSettingRequest)) + run() }) return _c } -func (_c *MockSettingsInterface_UpdateRestrictWorkspaceAdminsSetting_Call) Return(_a0 *settings.RestrictWorkspaceAdminsSetting, _a1 error) *MockSettingsInterface_UpdateRestrictWorkspaceAdminsSetting_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockSettingsInterface_RestrictWorkspaceAdmins_Call) Return(_a0 settings.RestrictWorkspaceAdminsInterface) *MockSettingsInterface_RestrictWorkspaceAdmins_Call { + _c.Call.Return(_a0) return _c } -func (_c *MockSettingsInterface_UpdateRestrictWorkspaceAdminsSetting_Call) RunAndReturn(run func(context.Context, settings.UpdateRestrictWorkspaceAdminsSettingRequest) (*settings.RestrictWorkspaceAdminsSetting, error)) *MockSettingsInterface_UpdateRestrictWorkspaceAdminsSetting_Call { +func (_c *MockSettingsInterface_RestrictWorkspaceAdmins_Call) RunAndReturn(run func() settings.RestrictWorkspaceAdminsInterface) *MockSettingsInterface_RestrictWorkspaceAdmins_Call { _c.Call.Return(run) return _c } diff --git a/service/compute/model.go b/service/compute/model.go index 7194d4c8c..06674c5f0 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -101,13 +101,17 @@ type AwsAttributes struct { // Please note that if EBS volumes are specified, then the Spark // configuration `spark.local.dir` will be overridden. EbsVolumeCount int `json:"ebs_volume_count,omitempty"` - // + // If using gp3 volumes, what IOPS to use for the disk. If this is not set, + // the maximum performance of a gp2 volume with the same volume size will be + // used. EbsVolumeIops int `json:"ebs_volume_iops,omitempty"` // The size of each EBS volume (in GiB) launched for each instance. For // general purpose SSD, this value must be within the range 100 - 4096. For // throughput optimized HDD, this value must be within the range 500 - 4096. EbsVolumeSize int `json:"ebs_volume_size,omitempty"` - // + // If using gp3 volumes, what throughput to use for the disk. If this is not + // set, the maximum performance of a gp2 volume with the same volume size + // will be used. EbsVolumeThroughput int `json:"ebs_volume_throughput,omitempty"` // The type of EBS volumes that will be launched with this cluster. EbsVolumeType EbsVolumeType `json:"ebs_volume_type,omitempty"` diff --git a/service/iam/api.go b/service/iam/api.go index 49f96d6b3..408c0ba08 100755 --- a/service/iam/api.go +++ b/service/iam/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 Access Control, Account Access Control Proxy, Account Groups, Account Service Principals, Account Users, Current User, Groups, Permissions, Service Principals, Users, Workspace Assignment, etc. +// These APIs allow you to manage Account Access Control, Account Access Control Proxy, Account Groups, Account Service Principals, Account Users, Current User, Groups, Permission Migration, Permissions, Service Principals, Users, Workspace Assignment, etc. package iam import ( @@ -1343,6 +1343,61 @@ func (a *GroupsAPI) Update(ctx context.Context, request Group) error { return a.impl.Update(ctx, request) } +type PermissionMigrationInterface interface { + // WithImpl could be used to override low-level API implementations for unit + // testing purposes with [github.com/golang/mock] or other mocking frameworks. + // Deprecated: use MockPermissionMigrationInterface instead. + WithImpl(impl PermissionMigrationService) PermissionMigrationInterface + + // Impl returns low-level PermissionMigration API implementation + // Deprecated: use MockPermissionMigrationInterface instead. + Impl() PermissionMigrationService + + // Migrate Permissions. + // + // Migrate a batch of permissions from a workspace local group to an account + // group. + MigratePermissions(ctx context.Context, request PermissionMigrationRequest) (*PermissionMigrationResponse, error) +} + +func NewPermissionMigration(client *client.DatabricksClient) *PermissionMigrationAPI { + return &PermissionMigrationAPI{ + impl: &permissionMigrationImpl{ + client: client, + }, + } +} + +// This spec contains undocumented permission migration APIs used in +// https://github.com/databrickslabs/ucx. +type PermissionMigrationAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(PermissionMigrationService) + impl PermissionMigrationService +} + +// WithImpl could be used to override low-level API implementations for unit +// testing purposes with [github.com/golang/mock] or other mocking frameworks. +// Deprecated: use MockPermissionMigrationInterface instead. +func (a *PermissionMigrationAPI) WithImpl(impl PermissionMigrationService) PermissionMigrationInterface { + a.impl = impl + return a +} + +// Impl returns low-level PermissionMigration API implementation +// Deprecated: use MockPermissionMigrationInterface instead. +func (a *PermissionMigrationAPI) Impl() PermissionMigrationService { + return a.impl +} + +// Migrate Permissions. +// +// Migrate a batch of permissions from a workspace local group to an account +// group. +func (a *PermissionMigrationAPI) MigratePermissions(ctx context.Context, request PermissionMigrationRequest) (*PermissionMigrationResponse, error) { + return a.impl.MigratePermissions(ctx, request) +} + type PermissionsInterface interface { // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. diff --git a/service/iam/impl.go b/service/iam/impl.go index 64fda37ba..934fb9669 100755 --- a/service/iam/impl.go +++ b/service/iam/impl.go @@ -334,6 +334,21 @@ func (a *groupsImpl) Update(ctx context.Context, request Group) error { return err } +// unexported type that holds implementations of just PermissionMigration API methods +type permissionMigrationImpl struct { + client *client.DatabricksClient +} + +func (a *permissionMigrationImpl) MigratePermissions(ctx context.Context, request PermissionMigrationRequest) (*PermissionMigrationResponse, error) { + var permissionMigrationResponse PermissionMigrationResponse + path := "/api/2.0/permissionmigration" + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, request, &permissionMigrationResponse) + return &permissionMigrationResponse, err +} + // unexported type that holds implementations of just Permissions API methods type permissionsImpl struct { client *client.DatabricksClient diff --git a/service/iam/interface.go b/service/iam/interface.go index f8efae56d..576ced826 100755 --- a/service/iam/interface.go +++ b/service/iam/interface.go @@ -251,6 +251,17 @@ type GroupsService interface { Update(ctx context.Context, request Group) error } +// This spec contains undocumented permission migration APIs used in +// https://github.com/databrickslabs/ucx. +type PermissionMigrationService interface { + + // Migrate Permissions. + // + // Migrate a batch of permissions from a workspace local group to an account + // group. + MigratePermissions(ctx context.Context, request PermissionMigrationRequest) (*PermissionMigrationResponse, error) +} + // Permissions API are used to create read, write, edit, update and manage // access for various users on different objects and endpoints. // diff --git a/service/iam/model.go b/service/iam/model.go index 434dbada8..6efaa4a3f 100755 --- a/service/iam/model.go +++ b/service/iam/model.go @@ -329,7 +329,7 @@ type Group struct { Groups []ComplexValue `json:"groups,omitempty"` // Databricks group ID - Id string `json:"id,omitempty" url:"-"` + Id string `json:"id,omitempty"` Members []ComplexValue `json:"members,omitempty"` // Container for the group identifier. Workspace local versus account. @@ -1055,6 +1055,44 @@ func (f *PermissionLevel) Type() string { return "PermissionLevel" } +type PermissionMigrationRequest struct { + // The name of the workspace group that permissions will be migrated from. + FromWorkspaceGroupName string `json:"from_workspace_group_name"` + // The maximum number of permissions that will be migrated. + Size int `json:"size,omitempty"` + // The name of the account group that permissions will be migrated to. + ToAccountGroupName string `json:"to_account_group_name"` + // WorkspaceId of the associated workspace where the permission migration + // will occur. Both workspace group and account group must be in this + // workspace. + WorkspaceId int64 `json:"workspace_id"` + + ForceSendFields []string `json:"-"` +} + +func (s *PermissionMigrationRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s PermissionMigrationRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type PermissionMigrationResponse struct { + // Number of permissions migrated. + PermissionsMigrated int `json:"permissions_migrated,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *PermissionMigrationResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s PermissionMigrationResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type PermissionOutput struct { // The results of a permissions query. Description string `json:"description,omitempty"` @@ -1275,7 +1313,7 @@ type User struct { Groups []ComplexValue `json:"groups,omitempty"` // Databricks user ID. This is automatically set by Databricks. Any value // provided by the client will be ignored. - Id string `json:"id,omitempty" url:"-"` + Id string `json:"id,omitempty"` Name *Name `json:"name,omitempty"` // Corresponds to AWS instance profile/arn role. diff --git a/service/jobs/model.go b/service/jobs/model.go index 49010e5be..ffb06e0f3 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -1558,11 +1558,13 @@ type ListJobsResponse struct { // If true, additional jobs matching the provided filter are available for // listing. HasMore bool `json:"has_more,omitempty"` - // The list of jobs. + // The list of jobs. Only included in the response if there are jobs to + // list. Jobs []BaseJob `json:"jobs,omitempty"` - // A token that can be used to list the next page of jobs. + // A token that can be used to list the next page of jobs (if applicable). NextPageToken string `json:"next_page_token,omitempty"` - // A token that can be used to list the previous page of jobs. + // A token that can be used to list the previous page of jobs (if + // applicable). PrevPageToken string `json:"prev_page_token,omitempty"` ForceSendFields []string `json:"-"` @@ -1631,11 +1633,13 @@ type ListRunsResponse struct { // If true, additional runs matching the provided filter are available for // listing. HasMore bool `json:"has_more,omitempty"` - // A token that can be used to list the next page of runs. + // A token that can be used to list the next page of runs (if applicable). NextPageToken string `json:"next_page_token,omitempty"` - // A token that can be used to list the previous page of runs. + // A token that can be used to list the previous page of runs (if + // applicable). PrevPageToken string `json:"prev_page_token,omitempty"` - // A list of runs, from most recently started to least. + // A list of runs, from most recently started to least. Only included in the + // response if there are runs to list. Runs []BaseRun `json:"runs,omitempty"` ForceSendFields []string `json:"-"` diff --git a/service/pkg.go b/service/pkg.go index be43e071a..3e727c6ae 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -10,10 +10,16 @@ // // - [catalog.ArtifactAllowlistsAPI]: In Databricks Runtime 13.3 and above, you can add libraries and init scripts to the `allowlist` in UC so that users can leverage these artifacts on compute configured with shared access mode. // +// - [settings.AutomaticClusterUpdateAPI]: Controls whether automatic cluster update is enabled for the current workspace. +// // - [billing.BillableUsageAPI]: This API allows you to download billable usage logs for the specified account and date range. // // - [billing.BudgetsAPI]: These APIs manage budget configuration including notifications for exceeding a budget for a period. // +// - [settings.CspEnablementAPI]: Controls whether to enable the compliance security profile for the current workspace. +// +// - [settings.CspEnablementAccountAPI]: The compliance security profile settings at the account level control whether to enable it for new workspaces. +// // - [catalog.CatalogsAPI]: A catalog is the first layer of Unity Catalog’s three-level namespace. // // - [sharing.CleanRoomsAPI]: A clean room is a secure, privacy-protecting environment where two or more parties can share sensitive enterprise data, including customer data, for measurements, insights, activation and other use cases. @@ -44,6 +50,12 @@ // // - [sql.DbsqlPermissionsAPI]: The SQL Permissions API is similar to the endpoints of the :method:permissions/set. // +// - [settings.DefaultNamespaceAPI]: The default namespace setting API allows users to configure the default namespace for a Databricks workspace. +// +// - [settings.EsmEnablementAPI]: Controls whether enhanced security monitoring is enabled for the current workspace. +// +// - [settings.EsmEnablementAccountAPI]: The enhanced security monitoring setting at the account level controls whether to enable the feature on new workspaces. +// // - [provisioning.EncryptionKeysAPI]: These APIs manage encryption key configurations for this workspace (optional). // // - [ml.ExperimentsAPI]: Experiments are the primary unit of organization in MLflow; all MLflow runs belong to an experiment. @@ -100,8 +112,12 @@ // // - [catalog.OnlineTablesAPI]: Online tables provide lower latency and higher QPS access to data from Delta tables. // +// - [iam.PermissionMigrationAPI]: This spec contains undocumented permission migration APIs used in https://github.com/databrickslabs/ucx. +// // - [iam.PermissionsAPI]: Permissions API are used to create read, write, edit, update and manage access for various users on different objects and endpoints. // +// - [settings.PersonalComputeAPI]: The Personal Compute enablement setting lets you control which users can use the Personal Compute default policy to create compute resources. +// // - [pipelines.PipelinesAPI]: The Delta Live Tables API allows you to create, edit, delete, start, and view details about pipelines. // // - [compute.PolicyFamiliesAPI]: View available policy families. @@ -126,6 +142,8 @@ // // - [workspace.ReposAPI]: The Repos API allows users to manage their git repos. // +// - [settings.RestrictWorkspaceAdminsAPI]: The Restrict Workspace Admins setting lets you control the capabilities of workspace admins. +// // - [catalog.SchemasAPI]: A schema (also called a database) is the second layer of Unity Catalog’s three-level namespace. // // - [workspace.SecretsAPI]: The Secrets API allows you to manage secrets, secret scopes, and access permissions. @@ -138,9 +156,9 @@ // // - [serving.ServingEndpointsAPI]: The Serving Endpoints API allows you to create, update, and delete model serving endpoints. // -// - [settings.SettingsAPI]: The default namespace setting API allows users to configure the default namespace for a Databricks workspace. +// - [settings.SettingsAPI]: Workspace Settings API allows users to manage settings at the workspace level. // -// - [settings.AccountSettingsAPI]: The Personal Compute enablement setting lets you control which users can use the Personal Compute default policy to create compute resources. +// - [settings.AccountSettingsAPI]: Accounts Settings API allows users to manage settings at the account level. // // - [sharing.SharesAPI]: A share is a container instantiated with :method:shares/create. // @@ -217,8 +235,11 @@ var ( _ *sql.AlertsAPI = nil _ *serving.AppsAPI = nil _ *catalog.ArtifactAllowlistsAPI = nil + _ *settings.AutomaticClusterUpdateAPI = nil _ *billing.BillableUsageAPI = nil _ *billing.BudgetsAPI = nil + _ *settings.CspEnablementAPI = nil + _ *settings.CspEnablementAccountAPI = nil _ *catalog.CatalogsAPI = nil _ *sharing.CleanRoomsAPI = nil _ *compute.ClusterPoliciesAPI = nil @@ -234,6 +255,9 @@ var ( _ *sql.DataSourcesAPI = nil _ *files.DbfsAPI = nil _ *sql.DbsqlPermissionsAPI = nil + _ *settings.DefaultNamespaceAPI = nil + _ *settings.EsmEnablementAPI = nil + _ *settings.EsmEnablementAccountAPI = nil _ *provisioning.EncryptionKeysAPI = nil _ *ml.ExperimentsAPI = nil _ *catalog.ExternalLocationsAPI = nil @@ -262,7 +286,9 @@ var ( _ *provisioning.NetworksAPI = nil _ *oauth2.OAuthPublishedAppsAPI = nil _ *catalog.OnlineTablesAPI = nil + _ *iam.PermissionMigrationAPI = nil _ *iam.PermissionsAPI = nil + _ *settings.PersonalComputeAPI = nil _ *pipelines.PipelinesAPI = nil _ *compute.PolicyFamiliesAPI = nil _ *provisioning.PrivateAccessAPI = nil @@ -275,6 +301,7 @@ var ( _ *sharing.RecipientsAPI = nil _ *catalog.RegisteredModelsAPI = nil _ *workspace.ReposAPI = nil + _ *settings.RestrictWorkspaceAdminsAPI = nil _ *catalog.SchemasAPI = nil _ *workspace.SecretsAPI = nil _ *oauth2.ServicePrincipalSecretsAPI = nil diff --git a/service/provisioning/api.go b/service/provisioning/api.go index 4277836db..447d1fc51 100755 --- a/service/provisioning/api.go +++ b/service/provisioning/api.go @@ -1679,7 +1679,12 @@ type WorkspacesInterface interface { // support for front-end, back-end, or both types of connectivity. You cannot // remove (downgrade) any existing front-end or back-end PrivateLink support on // a workspace. - Custom tags. Given you provide an empty custom tags, the - // update would not be applied. + // update would not be applied. - Network connectivity configuration ID to add + // serverless stable IP support. You can add or update the network connectivity + // configuration ID to ensure the workspace uses the same set of stable IP CIDR + // blocks to access your resources. You cannot remove a network connectivity + // configuration from the workspace once attached, you can only switch to + // another one. // // After calling the `PATCH` operation to update the workspace configuration, // make repeated `GET` requests with the workspace ID and check the workspace @@ -1691,34 +1696,37 @@ type WorkspacesInterface interface { // ### Update a running workspace You can update a Databricks workspace // configuration for running workspaces for some fields, but not all fields. For // a running workspace, this request supports updating the following fields - // only: - Credential configuration ID - // - // - Network configuration ID. Used only if you already use a customer-managed - // VPC. You cannot convert a running workspace from a Databricks-managed VPC to - // a customer-managed VPC. You can use a network configuration update in this - // API for a failed or running workspace to add support for PrivateLink, - // although you also need to add a private access settings object. - // - // - Key configuration ID for managed services (control plane storage, such as - // notebook source and Databricks SQL queries). Databricks does not directly - // encrypt the data with the customer-managed key (CMK). Databricks uses both - // the CMK and the Databricks managed key (DMK) that is unique to your workspace - // to encrypt the Data Encryption Key (DEK). Databricks uses the DEK to encrypt - // your workspace's managed services persisted data. If the workspace does not - // already have a CMK for managed services, adding this ID enables managed - // services encryption for new or updated data. Existing managed services data - // that existed before adding the key remains not encrypted with the DEK until - // it is modified. If the workspace already has customer-managed keys for - // managed services, this request rotates (changes) the CMK keys and the DEK is - // re-encrypted with the DMK and the new CMK. - Key configuration ID for - // workspace storage (root S3 bucket and, optionally, EBS volumes). You can set - // this only if the workspace does not already have a customer-managed key - // configuration for workspace storage. - Private access settings ID to add - // PrivateLink support. You can add or update the private access settings ID to - // upgrade a workspace to add support for front-end, back-end, or both types of - // connectivity. You cannot remove (downgrade) any existing front-end or - // back-end PrivateLink support on a workspace. - Custom tags. Given you provide - // an empty custom tags, the update would not be applied. + // only: - Credential configuration ID - Network configuration ID. Used only if + // you already use a customer-managed VPC. You cannot convert a running + // workspace from a Databricks-managed VPC to a customer-managed VPC. You can + // use a network configuration update in this API for a failed or running + // workspace to add support for PrivateLink, although you also need to add a + // private access settings object. - Key configuration ID for managed services + // (control plane storage, such as notebook source and Databricks SQL queries). + // Databricks does not directly encrypt the data with the customer-managed key + // (CMK). Databricks uses both the CMK and the Databricks managed key (DMK) that + // is unique to your workspace to encrypt the Data Encryption Key (DEK). + // Databricks uses the DEK to encrypt your workspace's managed services + // persisted data. If the workspace does not already have a CMK for managed + // services, adding this ID enables managed services encryption for new or + // updated data. Existing managed services data that existed before adding the + // key remains not encrypted with the DEK until it is modified. If the workspace + // already has customer-managed keys for managed services, this request rotates + // (changes) the CMK keys and the DEK is re-encrypted with the DMK and the new + // CMK. - Key configuration ID for workspace storage (root S3 bucket and, + // optionally, EBS volumes). You can set this only if the workspace does not + // already have a customer-managed key configuration for workspace storage. - + // Private access settings ID to add PrivateLink support. You can add or update + // the private access settings ID to upgrade a workspace to add support for + // front-end, back-end, or both types of connectivity. You cannot remove + // (downgrade) any existing front-end or back-end PrivateLink support on a + // workspace. - Custom tags. Given you provide an empty custom tags, the update + // would not be applied. - Network connectivity configuration ID to add + // serverless stable IP support. You can add or update the network connectivity + // configuration ID to ensure the workspace uses the same set of stable IP CIDR + // blocks to access your resources. You cannot remove a network connectivity + // configuration from the workspace once attached, you can only switch to + // another one. // // **Important**: To update a running workspace, your workspace must have no // running compute resources that run in your workspace's VPC in the Classic @@ -1738,17 +1746,15 @@ type WorkspacesInterface interface { // change. This results in a total of up to 40 minutes in which you cannot // create clusters. If you create or use clusters before this time interval // elapses, clusters do not launch successfully, fail, or could cause other - // unexpected behavior. - // - // * For workspaces with a customer-managed VPC, the workspace status stays at - // status `RUNNING` and the VPC change happens immediately. A change to the - // storage customer-managed key configuration ID might take a few minutes to - // update, so continue to check the workspace until you observe that it has been - // updated. If the update fails, the workspace might revert silently to its - // original configuration. After the workspace has been updated, you cannot use - // or create clusters for another 20 minutes. If you create or use clusters - // before this time interval elapses, clusters do not launch successfully, fail, - // or could cause other unexpected behavior. + // unexpected behavior. * For workspaces with a customer-managed VPC, the + // workspace status stays at status `RUNNING` and the VPC change happens + // immediately. A change to the storage customer-managed key configuration ID + // might take a few minutes to update, so continue to check the workspace until + // you observe that it has been updated. If the update fails, the workspace + // might revert silently to its original configuration. After the workspace has + // been updated, you cannot use or create clusters for another 20 minutes. If + // you create or use clusters before this time interval elapses, clusters do not + // launch successfully, fail, or could cause other unexpected behavior. // // If you update the _storage_ customer-managed key configurations, it takes 20 // minutes for the changes to fully take effect. During the 20 minute wait, it @@ -2087,7 +2093,12 @@ func (a *WorkspacesAPI) GetByWorkspaceName(ctx context.Context, name string) (*W // support for front-end, back-end, or both types of connectivity. You cannot // remove (downgrade) any existing front-end or back-end PrivateLink support on // a workspace. - Custom tags. Given you provide an empty custom tags, the -// update would not be applied. +// update would not be applied. - Network connectivity configuration ID to add +// serverless stable IP support. You can add or update the network connectivity +// configuration ID to ensure the workspace uses the same set of stable IP CIDR +// blocks to access your resources. You cannot remove a network connectivity +// configuration from the workspace once attached, you can only switch to +// another one. // // After calling the `PATCH` operation to update the workspace configuration, // make repeated `GET` requests with the workspace ID and check the workspace @@ -2099,34 +2110,37 @@ func (a *WorkspacesAPI) GetByWorkspaceName(ctx context.Context, name string) (*W // ### Update a running workspace You can update a Databricks workspace // configuration for running workspaces for some fields, but not all fields. For // a running workspace, this request supports updating the following fields -// only: - Credential configuration ID -// -// - Network configuration ID. Used only if you already use a customer-managed -// VPC. You cannot convert a running workspace from a Databricks-managed VPC to -// a customer-managed VPC. You can use a network configuration update in this -// API for a failed or running workspace to add support for PrivateLink, -// although you also need to add a private access settings object. -// -// - Key configuration ID for managed services (control plane storage, such as -// notebook source and Databricks SQL queries). Databricks does not directly -// encrypt the data with the customer-managed key (CMK). Databricks uses both -// the CMK and the Databricks managed key (DMK) that is unique to your workspace -// to encrypt the Data Encryption Key (DEK). Databricks uses the DEK to encrypt -// your workspace's managed services persisted data. If the workspace does not -// already have a CMK for managed services, adding this ID enables managed -// services encryption for new or updated data. Existing managed services data -// that existed before adding the key remains not encrypted with the DEK until -// it is modified. If the workspace already has customer-managed keys for -// managed services, this request rotates (changes) the CMK keys and the DEK is -// re-encrypted with the DMK and the new CMK. - Key configuration ID for -// workspace storage (root S3 bucket and, optionally, EBS volumes). You can set -// this only if the workspace does not already have a customer-managed key -// configuration for workspace storage. - Private access settings ID to add -// PrivateLink support. You can add or update the private access settings ID to -// upgrade a workspace to add support for front-end, back-end, or both types of -// connectivity. You cannot remove (downgrade) any existing front-end or -// back-end PrivateLink support on a workspace. - Custom tags. Given you provide -// an empty custom tags, the update would not be applied. +// only: - Credential configuration ID - Network configuration ID. Used only if +// you already use a customer-managed VPC. You cannot convert a running +// workspace from a Databricks-managed VPC to a customer-managed VPC. You can +// use a network configuration update in this API for a failed or running +// workspace to add support for PrivateLink, although you also need to add a +// private access settings object. - Key configuration ID for managed services +// (control plane storage, such as notebook source and Databricks SQL queries). +// Databricks does not directly encrypt the data with the customer-managed key +// (CMK). Databricks uses both the CMK and the Databricks managed key (DMK) that +// is unique to your workspace to encrypt the Data Encryption Key (DEK). +// Databricks uses the DEK to encrypt your workspace's managed services +// persisted data. If the workspace does not already have a CMK for managed +// services, adding this ID enables managed services encryption for new or +// updated data. Existing managed services data that existed before adding the +// key remains not encrypted with the DEK until it is modified. If the workspace +// already has customer-managed keys for managed services, this request rotates +// (changes) the CMK keys and the DEK is re-encrypted with the DMK and the new +// CMK. - Key configuration ID for workspace storage (root S3 bucket and, +// optionally, EBS volumes). You can set this only if the workspace does not +// already have a customer-managed key configuration for workspace storage. - +// Private access settings ID to add PrivateLink support. You can add or update +// the private access settings ID to upgrade a workspace to add support for +// front-end, back-end, or both types of connectivity. You cannot remove +// (downgrade) any existing front-end or back-end PrivateLink support on a +// workspace. - Custom tags. Given you provide an empty custom tags, the update +// would not be applied. - Network connectivity configuration ID to add +// serverless stable IP support. You can add or update the network connectivity +// configuration ID to ensure the workspace uses the same set of stable IP CIDR +// blocks to access your resources. You cannot remove a network connectivity +// configuration from the workspace once attached, you can only switch to +// another one. // // **Important**: To update a running workspace, your workspace must have no // running compute resources that run in your workspace's VPC in the Classic @@ -2146,17 +2160,15 @@ func (a *WorkspacesAPI) GetByWorkspaceName(ctx context.Context, name string) (*W // change. This results in a total of up to 40 minutes in which you cannot // create clusters. If you create or use clusters before this time interval // elapses, clusters do not launch successfully, fail, or could cause other -// unexpected behavior. -// -// * For workspaces with a customer-managed VPC, the workspace status stays at -// status `RUNNING` and the VPC change happens immediately. A change to the -// storage customer-managed key configuration ID might take a few minutes to -// update, so continue to check the workspace until you observe that it has been -// updated. If the update fails, the workspace might revert silently to its -// original configuration. After the workspace has been updated, you cannot use -// or create clusters for another 20 minutes. If you create or use clusters -// before this time interval elapses, clusters do not launch successfully, fail, -// or could cause other unexpected behavior. +// unexpected behavior. * For workspaces with a customer-managed VPC, the +// workspace status stays at status `RUNNING` and the VPC change happens +// immediately. A change to the storage customer-managed key configuration ID +// might take a few minutes to update, so continue to check the workspace until +// you observe that it has been updated. If the update fails, the workspace +// might revert silently to its original configuration. After the workspace has +// been updated, you cannot use or create clusters for another 20 minutes. If +// you create or use clusters before this time interval elapses, clusters do not +// launch successfully, fail, or could cause other unexpected behavior. // // If you update the _storage_ customer-managed key configurations, it takes 20 // minutes for the changes to fully take effect. During the 20 minute wait, it diff --git a/service/provisioning/interface.go b/service/provisioning/interface.go index da715705e..e0a0cd86e 100755 --- a/service/provisioning/interface.go +++ b/service/provisioning/interface.go @@ -446,7 +446,12 @@ type WorkspacesService interface { // back-end, or both types of connectivity. You cannot remove (downgrade) // any existing front-end or back-end PrivateLink support on a workspace. - // Custom tags. Given you provide an empty custom tags, the update would not - // be applied. + // be applied. - Network connectivity configuration ID to add serverless + // stable IP support. You can add or update the network connectivity + // configuration ID to ensure the workspace uses the same set of stable IP + // CIDR blocks to access your resources. You cannot remove a network + // connectivity configuration from the workspace once attached, you can only + // switch to another one. // // After calling the `PATCH` operation to update the workspace // configuration, make repeated `GET` requests with the workspace ID and @@ -460,36 +465,38 @@ type WorkspacesService interface { // ### Update a running workspace You can update a Databricks workspace // configuration for running workspaces for some fields, but not all fields. // For a running workspace, this request supports updating the following - // fields only: - Credential configuration ID - // - // - Network configuration ID. Used only if you already use a - // customer-managed VPC. You cannot convert a running workspace from a - // Databricks-managed VPC to a customer-managed VPC. You can use a network - // configuration update in this API for a failed or running workspace to add - // support for PrivateLink, although you also need to add a private access - // settings object. - // - // - Key configuration ID for managed services (control plane storage, such - // as notebook source and Databricks SQL queries). Databricks does not - // directly encrypt the data with the customer-managed key (CMK). Databricks - // uses both the CMK and the Databricks managed key (DMK) that is unique to - // your workspace to encrypt the Data Encryption Key (DEK). Databricks uses - // the DEK to encrypt your workspace's managed services persisted data. If - // the workspace does not already have a CMK for managed services, adding - // this ID enables managed services encryption for new or updated data. - // Existing managed services data that existed before adding the key remains - // not encrypted with the DEK until it is modified. If the workspace already - // has customer-managed keys for managed services, this request rotates - // (changes) the CMK keys and the DEK is re-encrypted with the DMK and the - // new CMK. - Key configuration ID for workspace storage (root S3 bucket - // and, optionally, EBS volumes). You can set this only if the workspace - // does not already have a customer-managed key configuration for workspace - // storage. - Private access settings ID to add PrivateLink support. You can - // add or update the private access settings ID to upgrade a workspace to - // add support for front-end, back-end, or both types of connectivity. You + // fields only: - Credential configuration ID - Network configuration ID. + // Used only if you already use a customer-managed VPC. You cannot convert a + // running workspace from a Databricks-managed VPC to a customer-managed + // VPC. You can use a network configuration update in this API for a failed + // or running workspace to add support for PrivateLink, although you also + // need to add a private access settings object. - Key configuration ID for + // managed services (control plane storage, such as notebook source and + // Databricks SQL queries). Databricks does not directly encrypt the data + // with the customer-managed key (CMK). Databricks uses both the CMK and the + // Databricks managed key (DMK) that is unique to your workspace to encrypt + // the Data Encryption Key (DEK). Databricks uses the DEK to encrypt your + // workspace's managed services persisted data. If the workspace does not + // already have a CMK for managed services, adding this ID enables managed + // services encryption for new or updated data. Existing managed services + // data that existed before adding the key remains not encrypted with the + // DEK until it is modified. If the workspace already has customer-managed + // keys for managed services, this request rotates (changes) the CMK keys + // and the DEK is re-encrypted with the DMK and the new CMK. - Key + // configuration ID for workspace storage (root S3 bucket and, optionally, + // EBS volumes). You can set this only if the workspace does not already + // have a customer-managed key configuration for workspace storage. - + // Private access settings ID to add PrivateLink support. You can add or + // update the private access settings ID to upgrade a workspace to add + // support for front-end, back-end, or both types of connectivity. You // cannot remove (downgrade) any existing front-end or back-end PrivateLink // support on a workspace. - Custom tags. Given you provide an empty custom - // tags, the update would not be applied. + // tags, the update would not be applied. - Network connectivity + // configuration ID to add serverless stable IP support. You can add or + // update the network connectivity configuration ID to ensure the workspace + // uses the same set of stable IP CIDR blocks to access your resources. You + // cannot remove a network connectivity configuration from the workspace + // once attached, you can only switch to another one. // // **Important**: To update a running workspace, your workspace must have no // running compute resources that run in your workspace's VPC in the Classic @@ -509,18 +516,17 @@ type WorkspacesService interface { // 20 minutes after that status change. This results in a total of up to 40 // minutes in which you cannot create clusters. If you create or use // clusters before this time interval elapses, clusters do not launch + // successfully, fail, or could cause other unexpected behavior. * For + // workspaces with a customer-managed VPC, the workspace status stays at + // status `RUNNING` and the VPC change happens immediately. A change to the + // storage customer-managed key configuration ID might take a few minutes to + // update, so continue to check the workspace until you observe that it has + // been updated. If the update fails, the workspace might revert silently to + // its original configuration. After the workspace has been updated, you + // cannot use or create clusters for another 20 minutes. If you create or + // use clusters before this time interval elapses, clusters do not launch // successfully, fail, or could cause other unexpected behavior. // - // * For workspaces with a customer-managed VPC, the workspace status stays - // at status `RUNNING` and the VPC change happens immediately. A change to - // the storage customer-managed key configuration ID might take a few - // minutes to update, so continue to check the workspace until you observe - // that it has been updated. If the update fails, the workspace might revert - // silently to its original configuration. After the workspace has been - // updated, you cannot use or create clusters for another 20 minutes. If you - // create or use clusters before this time interval elapses, clusters do not - // launch successfully, fail, or could cause other unexpected behavior. - // // If you update the _storage_ customer-managed key configurations, it takes // 20 minutes for the changes to fully take effect. During the 20 minute // wait, it is important that you stop all REST API calls to the DBFS API. diff --git a/service/provisioning/model.go b/service/provisioning/model.go index 1f75678df..26167aa3c 100755 --- a/service/provisioning/model.go +++ b/service/provisioning/model.go @@ -1003,8 +1003,7 @@ type UpdateWorkspaceRequest struct { // The ID of the workspace's managed services encryption key configuration // object. This parameter is available only for updating failed workspaces. ManagedServicesCustomerManagedKeyId string `json:"managed_services_customer_managed_key_id,omitempty"` - // The ID of the network connectivity configuration object, which is the - // parent resource of this private endpoint rule object. + NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` // The ID of the workspace's network configuration object. Used only if you // already use a customer-managed VPC. For failed workspaces only, you can diff --git a/service/settings/api.go b/service/settings/api.go index a9775abd5..eef0cebc3 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, Credentials Manager, Ip Access Lists, Network Connectivity, Settings, Token Management, Tokens, Workspace Conf, etc. +// These APIs allow you to manage Account Ip Access Lists, Account Settings, Automatic Cluster Update, Credentials Manager, Csp Enablement, Csp Enablement Account, Default Namespace, Esm Enablement, Esm Enablement Account, Ip Access Lists, Network Connectivity, Personal Compute, Restrict Workspace Admins, Settings, Token Management, Tokens, Workspace Conf, etc. package settings import ( @@ -362,42 +362,34 @@ type AccountSettingsInterface interface { // Deprecated: use MockAccountSettingsInterface instead. Impl() AccountSettingsService - // Delete Personal Compute setting. - // - // Reverts back the Personal Compute setting value to default (ON) - DeletePersonalComputeSetting(ctx context.Context, request DeletePersonalComputeSettingRequest) (*DeletePersonalComputeSettingResponse, error) - - // Get the compliance security profile setting for new workspaces. - // - // Gets the compliance security profile setting for new workspaces. - GetCspEnablementAccountSetting(ctx context.Context, request GetCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) - - // Get the enhanced security monitoring setting for new workspaces. - // - // Gets the enhanced security monitoring setting for new workspaces. - GetEsmEnablementAccountSetting(ctx context.Context, request GetEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) - - // Get Personal Compute setting. - // - // Gets the value of the Personal Compute setting. - GetPersonalComputeSetting(ctx context.Context, request GetPersonalComputeSettingRequest) (*PersonalComputeSetting, error) - - // Update the compliance security profile setting for new workspaces. + // The compliance security profile settings at the account level control + // whether to enable it for new workspaces. By default, this account-level + // setting is disabled for new workspaces. After workspace creation, account + // admins can enable the compliance security profile individually for each + // workspace. // - // Updates the value of the compliance security profile setting for new - // workspaces. - UpdateCspEnablementAccountSetting(ctx context.Context, request UpdateCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) + // This settings can be disabled so that new workspaces do not have + // compliance security profile enabled by default. + CspEnablementAccount() CspEnablementAccountInterface - // Update the enhanced security monitoring setting for new workspaces. - // - // Updates the value of the enhanced security monitoring setting for new - // workspaces. - UpdateEsmEnablementAccountSetting(ctx context.Context, request UpdateEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) + // The enhanced security monitoring setting at the account level controls + // whether to enable the feature on new workspaces. By default, this + // account-level setting is disabled for new workspaces. After workspace + // creation, account admins can enable enhanced security monitoring + // individually for each workspace. + EsmEnablementAccount() EsmEnablementAccountInterface - // Update Personal Compute setting. + // The Personal Compute enablement setting lets you control which users can + // use the Personal Compute default policy to create compute resources. By + // default all users in all workspaces have access (ON), but you can change + // the setting to instead let individual workspaces configure access control + // (DELEGATE). // - // Updates the value of the Personal Compute setting. - UpdatePersonalComputeSetting(ctx context.Context, request UpdatePersonalComputeSettingRequest) (*PersonalComputeSetting, error) + // There is only one instance of this setting per account. Since this + // setting has a default value, this setting is present on all accounts even + // though it's never set on a given account. Deletion reverts the value of + // the setting back to the default value. + PersonalCompute() PersonalComputeInterface } func NewAccountSettings(client *client.DatabricksClient) *AccountSettingsAPI { @@ -405,22 +397,61 @@ func NewAccountSettings(client *client.DatabricksClient) *AccountSettingsAPI { impl: &accountSettingsImpl{ client: client, }, + + cspEnablementAccount: NewCspEnablementAccount(client), + + esmEnablementAccount: NewEsmEnablementAccount(client), + + personalCompute: NewPersonalCompute(client), } } -// The Personal Compute enablement setting lets you control which users can use -// the Personal Compute default policy to create compute resources. By default -// all users in all workspaces have access (ON), but you can change the setting -// to instead let individual workspaces configure access control (DELEGATE). -// -// There is only one instance of this setting per account. Since this setting -// has a default value, this setting is present on all accounts even though it's -// never set on a given account. Deletion reverts the value of the setting back -// to the default value. +// Accounts Settings API allows users to manage settings at the account level. type AccountSettingsAPI struct { // impl contains low-level REST API interface, that could be overridden // through WithImpl(AccountSettingsService) impl AccountSettingsService + + // The compliance security profile settings at the account level control + // whether to enable it for new workspaces. By default, this account-level + // setting is disabled for new workspaces. After workspace creation, account + // admins can enable the compliance security profile individually for each + // workspace. + // + // This settings can be disabled so that new workspaces do not have + // compliance security profile enabled by default. + cspEnablementAccount CspEnablementAccountInterface + + // The enhanced security monitoring setting at the account level controls + // whether to enable the feature on new workspaces. By default, this + // account-level setting is disabled for new workspaces. After workspace + // creation, account admins can enable enhanced security monitoring + // individually for each workspace. + esmEnablementAccount EsmEnablementAccountInterface + + // The Personal Compute enablement setting lets you control which users can + // use the Personal Compute default policy to create compute resources. By + // default all users in all workspaces have access (ON), but you can change + // the setting to instead let individual workspaces configure access control + // (DELEGATE). + // + // There is only one instance of this setting per account. Since this + // setting has a default value, this setting is present on all accounts even + // though it's never set on a given account. Deletion reverts the value of + // the setting back to the default value. + personalCompute PersonalComputeInterface +} + +func (a *AccountSettingsAPI) CspEnablementAccount() CspEnablementAccountInterface { + return a.cspEnablementAccount +} + +func (a *AccountSettingsAPI) EsmEnablementAccount() EsmEnablementAccountInterface { + return a.esmEnablementAccount +} + +func (a *AccountSettingsAPI) PersonalCompute() PersonalComputeInterface { + return a.personalCompute } // WithImpl could be used to override low-level API implementations for unit @@ -437,55 +468,77 @@ func (a *AccountSettingsAPI) Impl() AccountSettingsService { return a.impl } -// Delete Personal Compute setting. -// -// Reverts back the Personal Compute setting value to default (ON) -func (a *AccountSettingsAPI) DeletePersonalComputeSetting(ctx context.Context, request DeletePersonalComputeSettingRequest) (*DeletePersonalComputeSettingResponse, error) { - return a.impl.DeletePersonalComputeSetting(ctx, request) +type AutomaticClusterUpdateInterface interface { + // WithImpl could be used to override low-level API implementations for unit + // testing purposes with [github.com/golang/mock] or other mocking frameworks. + // Deprecated: use MockAutomaticClusterUpdateInterface instead. + WithImpl(impl AutomaticClusterUpdateService) AutomaticClusterUpdateInterface + + // Impl returns low-level AutomaticClusterUpdate API implementation + // Deprecated: use MockAutomaticClusterUpdateInterface instead. + Impl() AutomaticClusterUpdateService + + // Get the automatic cluster update setting. + // + // Gets the automatic cluster update setting. + Get(ctx context.Context, request GetAutomaticClusterUpdateRequest) (*AutomaticClusterUpdateSetting, error) + + // Update the automatic cluster update setting. + // + // Updates the automatic cluster update setting for the workspace. A fresh etag + // needs to be provided in `PATCH` requests (as part of the setting field). The + // etag can be retrieved by making a `GET` request before the `PATCH` request. + // If the setting is updated concurrently, `PATCH` fails with 409 and the + // request must be retried by using the fresh etag in the 409 response. + Update(ctx context.Context, request UpdateAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) } -// Get the compliance security profile setting for new workspaces. -// -// Gets the compliance security profile setting for new workspaces. -func (a *AccountSettingsAPI) GetCspEnablementAccountSetting(ctx context.Context, request GetCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) { - return a.impl.GetCspEnablementAccountSetting(ctx, request) +func NewAutomaticClusterUpdate(client *client.DatabricksClient) *AutomaticClusterUpdateAPI { + return &AutomaticClusterUpdateAPI{ + impl: &automaticClusterUpdateImpl{ + client: client, + }, + } } -// Get the enhanced security monitoring setting for new workspaces. -// -// Gets the enhanced security monitoring setting for new workspaces. -func (a *AccountSettingsAPI) GetEsmEnablementAccountSetting(ctx context.Context, request GetEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) { - return a.impl.GetEsmEnablementAccountSetting(ctx, request) +// Controls whether automatic cluster update is enabled for the current +// workspace. By default, it is turned off. +type AutomaticClusterUpdateAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(AutomaticClusterUpdateService) + impl AutomaticClusterUpdateService } -// Get Personal Compute setting. -// -// Gets the value of the Personal Compute setting. -func (a *AccountSettingsAPI) GetPersonalComputeSetting(ctx context.Context, request GetPersonalComputeSettingRequest) (*PersonalComputeSetting, error) { - return a.impl.GetPersonalComputeSetting(ctx, request) +// WithImpl could be used to override low-level API implementations for unit +// testing purposes with [github.com/golang/mock] or other mocking frameworks. +// Deprecated: use MockAutomaticClusterUpdateInterface instead. +func (a *AutomaticClusterUpdateAPI) WithImpl(impl AutomaticClusterUpdateService) AutomaticClusterUpdateInterface { + a.impl = impl + return a } -// Update the compliance security profile setting for new workspaces. -// -// Updates the value of the compliance security profile setting for new -// workspaces. -func (a *AccountSettingsAPI) UpdateCspEnablementAccountSetting(ctx context.Context, request UpdateCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) { - return a.impl.UpdateCspEnablementAccountSetting(ctx, request) +// Impl returns low-level AutomaticClusterUpdate API implementation +// Deprecated: use MockAutomaticClusterUpdateInterface instead. +func (a *AutomaticClusterUpdateAPI) Impl() AutomaticClusterUpdateService { + return a.impl } -// Update the enhanced security monitoring setting for new workspaces. +// Get the automatic cluster update setting. // -// Updates the value of the enhanced security monitoring setting for new -// workspaces. -func (a *AccountSettingsAPI) UpdateEsmEnablementAccountSetting(ctx context.Context, request UpdateEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) { - return a.impl.UpdateEsmEnablementAccountSetting(ctx, request) +// Gets the automatic cluster update setting. +func (a *AutomaticClusterUpdateAPI) Get(ctx context.Context, request GetAutomaticClusterUpdateRequest) (*AutomaticClusterUpdateSetting, error) { + return a.impl.Get(ctx, request) } -// Update Personal Compute setting. +// Update the automatic cluster update setting. // -// Updates the value of the Personal Compute setting. -func (a *AccountSettingsAPI) UpdatePersonalComputeSetting(ctx context.Context, request UpdatePersonalComputeSettingRequest) (*PersonalComputeSetting, error) { - return a.impl.UpdatePersonalComputeSetting(ctx, request) +// Updates the automatic cluster update setting for the workspace. A fresh etag +// needs to be provided in `PATCH` requests (as part of the setting field). The +// etag can be retrieved by making a `GET` request before the `PATCH` request. +// If the setting is updated concurrently, `PATCH` fails with 409 and the +// request must be retried by using the fresh etag in the 409 response. +func (a *AutomaticClusterUpdateAPI) Update(ctx context.Context, request UpdateAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) { + return a.impl.Update(ctx, request) } type CredentialsManagerInterface interface { @@ -543,178 +596,581 @@ func (a *CredentialsManagerAPI) ExchangeToken(ctx context.Context, request Excha return a.impl.ExchangeToken(ctx, request) } -type IpAccessListsInterface interface { +type CspEnablementInterface interface { // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. - // Deprecated: use MockIpAccessListsInterface instead. - WithImpl(impl IpAccessListsService) IpAccessListsInterface - - // Impl returns low-level IpAccessLists API implementation - // Deprecated: use MockIpAccessListsInterface instead. - Impl() IpAccessListsService - - // Create access list. - // - // Creates an IP access list for this workspace. - // - // A list can be an allow list or a block list. See the top of this file for a - // description of how the server treats allow lists and block lists at runtime. - // - // When creating or updating an IP access list: - // - // * For all allow lists and block lists combined, the API supports a maximum of - // 1000 IP/CIDR values, where one CIDR counts as a single value. Attempts to - // exceed that number return error 400 with `error_code` value `QUOTA_EXCEEDED`. - // * If the new list would block the calling user's current IP, error 400 is - // returned with `error_code` value `INVALID_STATE`. - // - // It can take a few minutes for the changes to take effect. **Note**: Your new - // IP access list has no effect until you enable the feature. See - // :method:workspaceconf/setStatus - Create(ctx context.Context, request CreateIpAccessList) (*CreateIpAccessListResponse, error) - - // Delete access list. - // - // Deletes an IP access list, specified by its list ID. - Delete(ctx context.Context, request DeleteIpAccessListRequest) error - - // Delete access list. - // - // Deletes an IP access list, specified by its list ID. - DeleteByIpAccessListId(ctx context.Context, ipAccessListId string) error - - // Get access list. - // - // Gets an IP access list, specified by its list ID. - Get(ctx context.Context, request GetIpAccessListRequest) (*FetchIpAccessListResponse, error) - - // Get access list. - // - // Gets an IP access list, specified by its list ID. - GetByIpAccessListId(ctx context.Context, ipAccessListId string) (*FetchIpAccessListResponse, error) - - // Get access lists. - // - // Gets all IP access lists for the specified workspace. - // - // This method is generated by Databricks SDK Code Generator. - List(ctx context.Context) listing.Iterator[IpAccessListInfo] - - // Get access lists. - // - // Gets all IP access lists for the specified workspace. - // - // This method is generated by Databricks SDK Code Generator. - ListAll(ctx context.Context) ([]IpAccessListInfo, error) - - // IpAccessListInfoLabelToListIdMap calls [IpAccessListsAPI.ListAll] and creates a map of results with [IpAccessListInfo].Label as key and [IpAccessListInfo].ListId as value. - // - // Returns an error if there's more than one [IpAccessListInfo] with the same .Label. - // - // Note: All [IpAccessListInfo] instances are loaded into memory before creating a map. - // - // This method is generated by Databricks SDK Code Generator. - IpAccessListInfoLabelToListIdMap(ctx context.Context) (map[string]string, error) + // Deprecated: use MockCspEnablementInterface instead. + WithImpl(impl CspEnablementService) CspEnablementInterface - // GetByLabel calls [IpAccessListsAPI.IpAccessListInfoLabelToListIdMap] and returns a single [IpAccessListInfo]. - // - // Returns an error if there's more than one [IpAccessListInfo] with the same .Label. - // - // Note: All [IpAccessListInfo] instances are loaded into memory before returning matching by name. - // - // This method is generated by Databricks SDK Code Generator. - GetByLabel(ctx context.Context, name string) (*IpAccessListInfo, error) + // Impl returns low-level CspEnablement API implementation + // Deprecated: use MockCspEnablementInterface instead. + Impl() CspEnablementService - // Replace access list. - // - // Replaces an IP access list, specified by its ID. + // Get the compliance security profile setting. // - // A list can include allow lists and block lists. See the top of this file for - // a description of how the server treats allow lists and block lists at run - // time. When replacing an IP access list: * For all allow lists and block lists - // combined, the API supports a maximum of 1000 IP/CIDR values, where one CIDR - // counts as a single value. Attempts to exceed that number return error 400 - // with `error_code` value `QUOTA_EXCEEDED`. * If the resulting list would block - // the calling user's current IP, error 400 is returned with `error_code` value - // `INVALID_STATE`. It can take a few minutes for the changes to take effect. - // Note that your resulting IP access list has no effect until you enable the - // feature. See :method:workspaceconf/setStatus. - Replace(ctx context.Context, request ReplaceIpAccessList) error + // Gets the compliance security profile setting. + Get(ctx context.Context, request GetCspEnablementRequest) (*CspEnablementSetting, error) - // Update access list. - // - // Updates an existing IP access list, specified by its ID. - // - // A list can include allow lists and block lists. See the top of this file for - // a description of how the server treats allow lists and block lists at run - // time. - // - // When updating an IP access list: - // - // * For all allow lists and block lists combined, the API supports a maximum of - // 1000 IP/CIDR values, where one CIDR counts as a single value. Attempts to - // exceed that number return error 400 with `error_code` value `QUOTA_EXCEEDED`. - // * If the updated list would block the calling user's current IP, error 400 is - // returned with `error_code` value `INVALID_STATE`. + // Update the compliance security profile setting. // - // It can take a few minutes for the changes to take effect. Note that your - // resulting IP access list has no effect until you enable the feature. See - // :method:workspaceconf/setStatus. - Update(ctx context.Context, request UpdateIpAccessList) error + // Updates the compliance security profile setting for the workspace. A fresh + // etag needs to be provided in `PATCH` requests (as part of the setting field). + // The etag can be retrieved by making a `GET` request before the `PATCH` + // request. If the setting is updated concurrently, `PATCH` fails with 409 and + // the request must be retried by using the fresh etag in the 409 response. + Update(ctx context.Context, request UpdateCspEnablementSettingRequest) (*CspEnablementSetting, error) } -func NewIpAccessLists(client *client.DatabricksClient) *IpAccessListsAPI { - return &IpAccessListsAPI{ - impl: &ipAccessListsImpl{ +func NewCspEnablement(client *client.DatabricksClient) *CspEnablementAPI { + return &CspEnablementAPI{ + impl: &cspEnablementImpl{ client: client, }, } } -// IP Access List enables admins to configure IP access lists. -// -// IP access lists affect web application access and REST API access to this -// workspace only. If the feature is disabled for a workspace, all access is -// allowed for this workspace. There is support for allow lists (inclusion) and -// block lists (exclusion). -// -// When a connection is attempted: 1. **First, all block lists are checked.** If -// the connection IP address matches any block list, the connection is rejected. -// 2. **If the connection was not rejected by block lists**, the IP address is -// compared with the allow lists. -// -// If there is at least one allow list for the workspace, the connection is -// allowed only if the IP address matches an allow list. If there are no allow -// lists for the workspace, all IP addresses are allowed. +// Controls whether to enable the compliance security profile for the current +// workspace. Enabling it on a workspace is permanent. By default, it is turned +// off. // -// For all allow lists and block lists combined, the workspace supports a -// maximum of 1000 IP/CIDR values, where one CIDR counts as a single value. -// -// After changes to the IP access list feature, it can take a few minutes for -// changes to take effect. -type IpAccessListsAPI struct { +// This settings can NOT be disabled once it is enabled. +type CspEnablementAPI struct { // impl contains low-level REST API interface, that could be overridden - // through WithImpl(IpAccessListsService) - impl IpAccessListsService + // through WithImpl(CspEnablementService) + impl CspEnablementService } // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. -// Deprecated: use MockIpAccessListsInterface instead. -func (a *IpAccessListsAPI) WithImpl(impl IpAccessListsService) IpAccessListsInterface { +// Deprecated: use MockCspEnablementInterface instead. +func (a *CspEnablementAPI) WithImpl(impl CspEnablementService) CspEnablementInterface { a.impl = impl return a } -// Impl returns low-level IpAccessLists API implementation -// Deprecated: use MockIpAccessListsInterface instead. -func (a *IpAccessListsAPI) Impl() IpAccessListsService { +// Impl returns low-level CspEnablement API implementation +// Deprecated: use MockCspEnablementInterface instead. +func (a *CspEnablementAPI) Impl() CspEnablementService { return a.impl } -// Create access list. +// Get the compliance security profile setting. // -// Creates an IP access list for this workspace. +// Gets the compliance security profile setting. +func (a *CspEnablementAPI) Get(ctx context.Context, request GetCspEnablementRequest) (*CspEnablementSetting, error) { + return a.impl.Get(ctx, request) +} + +// Update the compliance security profile setting. +// +// Updates the compliance security profile setting for the workspace. A fresh +// etag needs to be provided in `PATCH` requests (as part of the setting field). +// The etag can be retrieved by making a `GET` request before the `PATCH` +// request. If the setting is updated concurrently, `PATCH` fails with 409 and +// the request must be retried by using the fresh etag in the 409 response. +func (a *CspEnablementAPI) Update(ctx context.Context, request UpdateCspEnablementSettingRequest) (*CspEnablementSetting, error) { + return a.impl.Update(ctx, request) +} + +type CspEnablementAccountInterface interface { + // WithImpl could be used to override low-level API implementations for unit + // testing purposes with [github.com/golang/mock] or other mocking frameworks. + // Deprecated: use MockCspEnablementAccountInterface instead. + WithImpl(impl CspEnablementAccountService) CspEnablementAccountInterface + + // Impl returns low-level CspEnablementAccount API implementation + // Deprecated: use MockCspEnablementAccountInterface instead. + Impl() CspEnablementAccountService + + // Get the compliance security profile setting for new workspaces. + // + // Gets the compliance security profile setting for new workspaces. + Get(ctx context.Context, request GetCspEnablementAccountRequest) (*CspEnablementAccountSetting, error) + + // Update the compliance security profile setting for new workspaces. + // + // Updates the value of the compliance security profile setting for new + // workspaces. + Update(ctx context.Context, request UpdateCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) +} + +func NewCspEnablementAccount(client *client.DatabricksClient) *CspEnablementAccountAPI { + return &CspEnablementAccountAPI{ + impl: &cspEnablementAccountImpl{ + client: client, + }, + } +} + +// The compliance security profile settings at the account level control whether +// to enable it for new workspaces. By default, this account-level setting is +// disabled for new workspaces. After workspace creation, account admins can +// enable the compliance security profile individually for each workspace. +// +// This settings can be disabled so that new workspaces do not have compliance +// security profile enabled by default. +type CspEnablementAccountAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(CspEnablementAccountService) + impl CspEnablementAccountService +} + +// WithImpl could be used to override low-level API implementations for unit +// testing purposes with [github.com/golang/mock] or other mocking frameworks. +// Deprecated: use MockCspEnablementAccountInterface instead. +func (a *CspEnablementAccountAPI) WithImpl(impl CspEnablementAccountService) CspEnablementAccountInterface { + a.impl = impl + return a +} + +// Impl returns low-level CspEnablementAccount API implementation +// Deprecated: use MockCspEnablementAccountInterface instead. +func (a *CspEnablementAccountAPI) Impl() CspEnablementAccountService { + return a.impl +} + +// Get the compliance security profile setting for new workspaces. +// +// Gets the compliance security profile setting for new workspaces. +func (a *CspEnablementAccountAPI) Get(ctx context.Context, request GetCspEnablementAccountRequest) (*CspEnablementAccountSetting, error) { + return a.impl.Get(ctx, request) +} + +// Update the compliance security profile setting for new workspaces. +// +// Updates the value of the compliance security profile setting for new +// workspaces. +func (a *CspEnablementAccountAPI) Update(ctx context.Context, request UpdateCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) { + return a.impl.Update(ctx, request) +} + +type DefaultNamespaceInterface interface { + // WithImpl could be used to override low-level API implementations for unit + // testing purposes with [github.com/golang/mock] or other mocking frameworks. + // Deprecated: use MockDefaultNamespaceInterface instead. + WithImpl(impl DefaultNamespaceService) DefaultNamespaceInterface + + // Impl returns low-level DefaultNamespace API implementation + // Deprecated: use MockDefaultNamespaceInterface instead. + Impl() DefaultNamespaceService + + // Delete the default namespace setting. + // + // Deletes the default namespace setting for the workspace. A fresh etag needs + // to be provided in `DELETE` requests (as a query parameter). The etag can be + // retrieved by making a `GET` request before the `DELETE` request. If the + // setting is updated/deleted concurrently, `DELETE` fails with 409 and the + // request must be retried by using the fresh etag in the 409 response. + Delete(ctx context.Context, request DeleteDefaultNamespaceRequest) (*DeleteDefaultNamespaceSettingResponse, error) + + // Get the default namespace setting. + // + // Gets the default namespace setting. + Get(ctx context.Context, request GetDefaultNamespaceRequest) (*DefaultNamespaceSetting, error) + + // Update the default namespace setting. + // + // Updates the default namespace setting for the workspace. A fresh etag needs + // to be provided in `PATCH` requests (as part of the setting field). The etag + // can be retrieved by making a `GET` request before the `PATCH` request. Note + // that if the setting does not exist, `GET` returns a NOT_FOUND error and the + // etag is present in the error response, which should be set in the `PATCH` + // request. If the setting is updated concurrently, `PATCH` fails with 409 and + // the request must be retried by using the fresh etag in the 409 response. + Update(ctx context.Context, request UpdateDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) +} + +func NewDefaultNamespace(client *client.DatabricksClient) *DefaultNamespaceAPI { + return &DefaultNamespaceAPI{ + impl: &defaultNamespaceImpl{ + client: client, + }, + } +} + +// The default namespace setting API allows users to configure the default +// namespace for a Databricks workspace. +// +// Through this API, users can retrieve, set, or modify the default namespace +// used when queries do not reference a fully qualified three-level name. For +// example, if you use the API to set 'retail_prod' as the default catalog, then +// a query 'SELECT * FROM myTable' would reference the object +// 'retail_prod.default.myTable' (the schema 'default' is always assumed). +// +// This setting requires a restart of clusters and SQL warehouses to take +// effect. Additionally, the default namespace only applies when using Unity +// Catalog-enabled compute. +type DefaultNamespaceAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(DefaultNamespaceService) + impl DefaultNamespaceService +} + +// WithImpl could be used to override low-level API implementations for unit +// testing purposes with [github.com/golang/mock] or other mocking frameworks. +// Deprecated: use MockDefaultNamespaceInterface instead. +func (a *DefaultNamespaceAPI) WithImpl(impl DefaultNamespaceService) DefaultNamespaceInterface { + a.impl = impl + return a +} + +// Impl returns low-level DefaultNamespace API implementation +// Deprecated: use MockDefaultNamespaceInterface instead. +func (a *DefaultNamespaceAPI) Impl() DefaultNamespaceService { + return a.impl +} + +// Delete the default namespace setting. +// +// Deletes the default namespace setting for the workspace. A fresh etag needs +// to be provided in `DELETE` requests (as a query parameter). The etag can be +// retrieved by making a `GET` request before the `DELETE` request. If the +// setting is updated/deleted concurrently, `DELETE` fails with 409 and the +// request must be retried by using the fresh etag in the 409 response. +func (a *DefaultNamespaceAPI) Delete(ctx context.Context, request DeleteDefaultNamespaceRequest) (*DeleteDefaultNamespaceSettingResponse, error) { + return a.impl.Delete(ctx, request) +} + +// Get the default namespace setting. +// +// Gets the default namespace setting. +func (a *DefaultNamespaceAPI) Get(ctx context.Context, request GetDefaultNamespaceRequest) (*DefaultNamespaceSetting, error) { + return a.impl.Get(ctx, request) +} + +// Update the default namespace setting. +// +// Updates the default namespace setting for the workspace. A fresh etag needs +// to be provided in `PATCH` requests (as part of the setting field). The etag +// can be retrieved by making a `GET` request before the `PATCH` request. Note +// that if the setting does not exist, `GET` returns a NOT_FOUND error and the +// etag is present in the error response, which should be set in the `PATCH` +// request. If the setting is updated concurrently, `PATCH` fails with 409 and +// the request must be retried by using the fresh etag in the 409 response. +func (a *DefaultNamespaceAPI) Update(ctx context.Context, request UpdateDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) { + return a.impl.Update(ctx, request) +} + +type EsmEnablementInterface interface { + // WithImpl could be used to override low-level API implementations for unit + // testing purposes with [github.com/golang/mock] or other mocking frameworks. + // Deprecated: use MockEsmEnablementInterface instead. + WithImpl(impl EsmEnablementService) EsmEnablementInterface + + // Impl returns low-level EsmEnablement API implementation + // Deprecated: use MockEsmEnablementInterface instead. + Impl() EsmEnablementService + + // Get the enhanced security monitoring setting. + // + // Gets the enhanced security monitoring setting. + Get(ctx context.Context, request GetEsmEnablementRequest) (*EsmEnablementSetting, error) + + // Update the enhanced security monitoring setting. + // + // Updates the enhanced security monitoring setting for the workspace. A fresh + // etag needs to be provided in `PATCH` requests (as part of the setting field). + // The etag can be retrieved by making a `GET` request before the `PATCH` + // request. If the setting is updated concurrently, `PATCH` fails with 409 and + // the request must be retried by using the fresh etag in the 409 response. + Update(ctx context.Context, request UpdateEsmEnablementSettingRequest) (*EsmEnablementSetting, error) +} + +func NewEsmEnablement(client *client.DatabricksClient) *EsmEnablementAPI { + return &EsmEnablementAPI{ + impl: &esmEnablementImpl{ + client: client, + }, + } +} + +// Controls whether enhanced security monitoring is enabled for the current +// workspace. If the compliance security profile is enabled, this is +// automatically enabled. By default, it is disabled. However, if the compliance +// security profile is enabled, this is automatically enabled. +// +// If the compliance security profile is disabled, you can enable or disable +// this setting and it is not permanent. +type EsmEnablementAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(EsmEnablementService) + impl EsmEnablementService +} + +// WithImpl could be used to override low-level API implementations for unit +// testing purposes with [github.com/golang/mock] or other mocking frameworks. +// Deprecated: use MockEsmEnablementInterface instead. +func (a *EsmEnablementAPI) WithImpl(impl EsmEnablementService) EsmEnablementInterface { + a.impl = impl + return a +} + +// Impl returns low-level EsmEnablement API implementation +// Deprecated: use MockEsmEnablementInterface instead. +func (a *EsmEnablementAPI) Impl() EsmEnablementService { + return a.impl +} + +// Get the enhanced security monitoring setting. +// +// Gets the enhanced security monitoring setting. +func (a *EsmEnablementAPI) Get(ctx context.Context, request GetEsmEnablementRequest) (*EsmEnablementSetting, error) { + return a.impl.Get(ctx, request) +} + +// Update the enhanced security monitoring setting. +// +// Updates the enhanced security monitoring setting for the workspace. A fresh +// etag needs to be provided in `PATCH` requests (as part of the setting field). +// The etag can be retrieved by making a `GET` request before the `PATCH` +// request. If the setting is updated concurrently, `PATCH` fails with 409 and +// the request must be retried by using the fresh etag in the 409 response. +func (a *EsmEnablementAPI) Update(ctx context.Context, request UpdateEsmEnablementSettingRequest) (*EsmEnablementSetting, error) { + return a.impl.Update(ctx, request) +} + +type EsmEnablementAccountInterface interface { + // WithImpl could be used to override low-level API implementations for unit + // testing purposes with [github.com/golang/mock] or other mocking frameworks. + // Deprecated: use MockEsmEnablementAccountInterface instead. + WithImpl(impl EsmEnablementAccountService) EsmEnablementAccountInterface + + // Impl returns low-level EsmEnablementAccount API implementation + // Deprecated: use MockEsmEnablementAccountInterface instead. + Impl() EsmEnablementAccountService + + // Get the enhanced security monitoring setting for new workspaces. + // + // Gets the enhanced security monitoring setting for new workspaces. + Get(ctx context.Context, request GetEsmEnablementAccountRequest) (*EsmEnablementAccountSetting, error) + + // Update the enhanced security monitoring setting for new workspaces. + // + // Updates the value of the enhanced security monitoring setting for new + // workspaces. + Update(ctx context.Context, request UpdateEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) +} + +func NewEsmEnablementAccount(client *client.DatabricksClient) *EsmEnablementAccountAPI { + return &EsmEnablementAccountAPI{ + impl: &esmEnablementAccountImpl{ + client: client, + }, + } +} + +// The enhanced security monitoring setting at the account level controls +// whether to enable the feature on new workspaces. By default, this +// account-level setting is disabled for new workspaces. After workspace +// creation, account admins can enable enhanced security monitoring individually +// for each workspace. +type EsmEnablementAccountAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(EsmEnablementAccountService) + impl EsmEnablementAccountService +} + +// WithImpl could be used to override low-level API implementations for unit +// testing purposes with [github.com/golang/mock] or other mocking frameworks. +// Deprecated: use MockEsmEnablementAccountInterface instead. +func (a *EsmEnablementAccountAPI) WithImpl(impl EsmEnablementAccountService) EsmEnablementAccountInterface { + a.impl = impl + return a +} + +// Impl returns low-level EsmEnablementAccount API implementation +// Deprecated: use MockEsmEnablementAccountInterface instead. +func (a *EsmEnablementAccountAPI) Impl() EsmEnablementAccountService { + return a.impl +} + +// Get the enhanced security monitoring setting for new workspaces. +// +// Gets the enhanced security monitoring setting for new workspaces. +func (a *EsmEnablementAccountAPI) Get(ctx context.Context, request GetEsmEnablementAccountRequest) (*EsmEnablementAccountSetting, error) { + return a.impl.Get(ctx, request) +} + +// Update the enhanced security monitoring setting for new workspaces. +// +// Updates the value of the enhanced security monitoring setting for new +// workspaces. +func (a *EsmEnablementAccountAPI) Update(ctx context.Context, request UpdateEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) { + return a.impl.Update(ctx, request) +} + +type IpAccessListsInterface interface { + // WithImpl could be used to override low-level API implementations for unit + // testing purposes with [github.com/golang/mock] or other mocking frameworks. + // Deprecated: use MockIpAccessListsInterface instead. + WithImpl(impl IpAccessListsService) IpAccessListsInterface + + // Impl returns low-level IpAccessLists API implementation + // Deprecated: use MockIpAccessListsInterface instead. + Impl() IpAccessListsService + + // Create access list. + // + // Creates an IP access list for this workspace. + // + // A list can be an allow list or a block list. See the top of this file for a + // description of how the server treats allow lists and block lists at runtime. + // + // When creating or updating an IP access list: + // + // * For all allow lists and block lists combined, the API supports a maximum of + // 1000 IP/CIDR values, where one CIDR counts as a single value. Attempts to + // exceed that number return error 400 with `error_code` value `QUOTA_EXCEEDED`. + // * If the new list would block the calling user's current IP, error 400 is + // returned with `error_code` value `INVALID_STATE`. + // + // It can take a few minutes for the changes to take effect. **Note**: Your new + // IP access list has no effect until you enable the feature. See + // :method:workspaceconf/setStatus + Create(ctx context.Context, request CreateIpAccessList) (*CreateIpAccessListResponse, error) + + // Delete access list. + // + // Deletes an IP access list, specified by its list ID. + Delete(ctx context.Context, request DeleteIpAccessListRequest) error + + // Delete access list. + // + // Deletes an IP access list, specified by its list ID. + DeleteByIpAccessListId(ctx context.Context, ipAccessListId string) error + + // Get access list. + // + // Gets an IP access list, specified by its list ID. + Get(ctx context.Context, request GetIpAccessListRequest) (*FetchIpAccessListResponse, error) + + // Get access list. + // + // Gets an IP access list, specified by its list ID. + GetByIpAccessListId(ctx context.Context, ipAccessListId string) (*FetchIpAccessListResponse, error) + + // Get access lists. + // + // Gets all IP access lists for the specified workspace. + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context) listing.Iterator[IpAccessListInfo] + + // Get access lists. + // + // Gets all IP access lists for the specified workspace. + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context) ([]IpAccessListInfo, error) + + // IpAccessListInfoLabelToListIdMap calls [IpAccessListsAPI.ListAll] and creates a map of results with [IpAccessListInfo].Label as key and [IpAccessListInfo].ListId as value. + // + // Returns an error if there's more than one [IpAccessListInfo] with the same .Label. + // + // Note: All [IpAccessListInfo] instances are loaded into memory before creating a map. + // + // This method is generated by Databricks SDK Code Generator. + IpAccessListInfoLabelToListIdMap(ctx context.Context) (map[string]string, error) + + // GetByLabel calls [IpAccessListsAPI.IpAccessListInfoLabelToListIdMap] and returns a single [IpAccessListInfo]. + // + // Returns an error if there's more than one [IpAccessListInfo] with the same .Label. + // + // Note: All [IpAccessListInfo] instances are loaded into memory before returning matching by name. + // + // This method is generated by Databricks SDK Code Generator. + GetByLabel(ctx context.Context, name string) (*IpAccessListInfo, error) + + // Replace access list. + // + // Replaces an IP access list, specified by its ID. + // + // A list can include allow lists and block lists. See the top of this file for + // a description of how the server treats allow lists and block lists at run + // time. When replacing an IP access list: * For all allow lists and block lists + // combined, the API supports a maximum of 1000 IP/CIDR values, where one CIDR + // counts as a single value. Attempts to exceed that number return error 400 + // with `error_code` value `QUOTA_EXCEEDED`. * If the resulting list would block + // the calling user's current IP, error 400 is returned with `error_code` value + // `INVALID_STATE`. It can take a few minutes for the changes to take effect. + // Note that your resulting IP access list has no effect until you enable the + // feature. See :method:workspaceconf/setStatus. + Replace(ctx context.Context, request ReplaceIpAccessList) error + + // Update access list. + // + // Updates an existing IP access list, specified by its ID. + // + // A list can include allow lists and block lists. See the top of this file for + // a description of how the server treats allow lists and block lists at run + // time. + // + // When updating an IP access list: + // + // * For all allow lists and block lists combined, the API supports a maximum of + // 1000 IP/CIDR values, where one CIDR counts as a single value. Attempts to + // exceed that number return error 400 with `error_code` value `QUOTA_EXCEEDED`. + // * If the updated list would block the calling user's current IP, error 400 is + // returned with `error_code` value `INVALID_STATE`. + // + // It can take a few minutes for the changes to take effect. Note that your + // resulting IP access list has no effect until you enable the feature. See + // :method:workspaceconf/setStatus. + Update(ctx context.Context, request UpdateIpAccessList) error +} + +func NewIpAccessLists(client *client.DatabricksClient) *IpAccessListsAPI { + return &IpAccessListsAPI{ + impl: &ipAccessListsImpl{ + client: client, + }, + } +} + +// IP Access List enables admins to configure IP access lists. +// +// IP access lists affect web application access and REST API access to this +// workspace only. If the feature is disabled for a workspace, all access is +// allowed for this workspace. There is support for allow lists (inclusion) and +// block lists (exclusion). +// +// When a connection is attempted: 1. **First, all block lists are checked.** If +// the connection IP address matches any block list, the connection is rejected. +// 2. **If the connection was not rejected by block lists**, the IP address is +// compared with the allow lists. +// +// If there is at least one allow list for the workspace, the connection is +// allowed only if the IP address matches an allow list. If there are no allow +// lists for the workspace, all IP addresses are allowed. +// +// For all allow lists and block lists combined, the workspace supports a +// maximum of 1000 IP/CIDR values, where one CIDR counts as a single value. +// +// After changes to the IP access list feature, it can take a few minutes for +// changes to take effect. +type IpAccessListsAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(IpAccessListsService) + impl IpAccessListsService +} + +// WithImpl could be used to override low-level API implementations for unit +// testing purposes with [github.com/golang/mock] or other mocking frameworks. +// Deprecated: use MockIpAccessListsInterface instead. +func (a *IpAccessListsAPI) WithImpl(impl IpAccessListsService) IpAccessListsInterface { + a.impl = impl + return a +} + +// Impl returns low-level IpAccessLists API implementation +// Deprecated: use MockIpAccessListsInterface instead. +func (a *IpAccessListsAPI) Impl() IpAccessListsService { + return a.impl +} + +// Create access list. +// +// Creates an IP access list for this workspace. // // A list can be an allow list or a block list. See the top of this file for a // description of how the server treats allow lists and block lists at runtime. @@ -905,20 +1361,6 @@ type NetworkConnectivityInterface interface { Impl() NetworkConnectivityService // Create a network connectivity configuration. - // - // Creates a network connectivity configuration (NCC), which provides stable - // Azure service subnets when accessing your Azure Storage accounts. You can - // also use a network connectivity configuration to create Databricks-managed - // private endpoints so that Databricks serverless compute resources privately - // access your resources. - // - // **IMPORTANT**: After you create the network connectivity configuration, you - // must assign one or more workspaces to the new network connectivity - // configuration. You can share one network connectivity configuration with - // multiple workspaces from the same Azure region within the same Databricks - // account. See [configure serverless secure connectivity]. - // - // [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security CreateNetworkConnectivityConfiguration(ctx context.Context, request CreateNetworkConnectivityConfigRequest) (*NetworkConnectivityConfiguration, error) // Create a private endpoint rule. @@ -1026,14 +1468,7 @@ func NewNetworkConnectivity(client *client.DatabricksClient) *NetworkConnectivit } // These APIs provide configurations for the network connectivity of your -// workspaces for serverless compute resources. This API provides stable subnets -// for your workspace so that you can configure your firewalls on your Azure -// Storage accounts to allow access from Databricks. You can also use the API to -// provision private endpoints for Databricks to privately connect serverless -// compute resources to your Azure resources using Azure Private Link. See -// [configure serverless secure connectivity]. -// -// [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security +// workspaces for serverless compute resources. type NetworkConnectivityAPI struct { // impl contains low-level REST API interface, that could be overridden // through WithImpl(NetworkConnectivityService) @@ -1055,20 +1490,6 @@ func (a *NetworkConnectivityAPI) Impl() NetworkConnectivityService { } // Create a network connectivity configuration. -// -// Creates a network connectivity configuration (NCC), which provides stable -// Azure service subnets when accessing your Azure Storage accounts. You can -// also use a network connectivity configuration to create Databricks-managed -// private endpoints so that Databricks serverless compute resources privately -// access your resources. -// -// **IMPORTANT**: After you create the network connectivity configuration, you -// must assign one or more workspaces to the new network connectivity -// configuration. You can share one network connectivity configuration with -// multiple workspaces from the same Azure region within the same Databricks -// account. See [configure serverless secure connectivity]. -// -// [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security func (a *NetworkConnectivityAPI) CreateNetworkConnectivityConfiguration(ctx context.Context, request CreateNetworkConnectivityConfigRequest) (*NetworkConnectivityConfiguration, error) { return a.impl.CreateNetworkConnectivityConfiguration(ctx, request) } @@ -1202,72 +1623,147 @@ func (a *NetworkConnectivityAPI) ListNetworkConnectivityConfigurationsAll(ctx co return listing.ToSlice[NetworkConnectivityConfiguration](ctx, iterator) } -// List private endpoint rules. -// -// Gets an array of private endpoint rules. -// -// This method is generated by Databricks SDK Code Generator. -func (a *NetworkConnectivityAPI) ListPrivateEndpointRules(ctx context.Context, request ListPrivateEndpointRulesRequest) listing.Iterator[NccAzurePrivateEndpointRule] { - - getNextPage := func(ctx context.Context, req ListPrivateEndpointRulesRequest) (*ListNccAzurePrivateEndpointRulesResponse, error) { - ctx = useragent.InContext(ctx, "sdk-feature", "pagination") - return a.impl.ListPrivateEndpointRules(ctx, req) - } - getItems := func(resp *ListNccAzurePrivateEndpointRulesResponse) []NccAzurePrivateEndpointRule { - return resp.Items - } - getNextReq := func(resp *ListNccAzurePrivateEndpointRulesResponse) *ListPrivateEndpointRulesRequest { - if resp.NextPageToken == "" { - return nil - } - request.PageToken = resp.NextPageToken - return &request - } - iterator := listing.NewIterator( - &request, - getNextPage, - getItems, - getNextReq) - return iterator +// List private endpoint rules. +// +// Gets an array of private endpoint rules. +// +// This method is generated by Databricks SDK Code Generator. +func (a *NetworkConnectivityAPI) ListPrivateEndpointRules(ctx context.Context, request ListPrivateEndpointRulesRequest) listing.Iterator[NccAzurePrivateEndpointRule] { + + getNextPage := func(ctx context.Context, req ListPrivateEndpointRulesRequest) (*ListNccAzurePrivateEndpointRulesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.impl.ListPrivateEndpointRules(ctx, req) + } + getItems := func(resp *ListNccAzurePrivateEndpointRulesResponse) []NccAzurePrivateEndpointRule { + return resp.Items + } + getNextReq := func(resp *ListNccAzurePrivateEndpointRulesResponse) *ListPrivateEndpointRulesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List private endpoint rules. +// +// Gets an array of private endpoint rules. +// +// This method is generated by Databricks SDK Code Generator. +func (a *NetworkConnectivityAPI) ListPrivateEndpointRulesAll(ctx context.Context, request ListPrivateEndpointRulesRequest) ([]NccAzurePrivateEndpointRule, error) { + iterator := a.ListPrivateEndpointRules(ctx, request) + return listing.ToSlice[NccAzurePrivateEndpointRule](ctx, iterator) +} + +// List private endpoint rules. +// +// Gets an array of private endpoint rules. +func (a *NetworkConnectivityAPI) ListPrivateEndpointRulesByNetworkConnectivityConfigId(ctx context.Context, networkConnectivityConfigId string) (*ListNccAzurePrivateEndpointRulesResponse, error) { + return a.impl.ListPrivateEndpointRules(ctx, ListPrivateEndpointRulesRequest{ + NetworkConnectivityConfigId: networkConnectivityConfigId, + }) +} + +type PersonalComputeInterface interface { + // WithImpl could be used to override low-level API implementations for unit + // testing purposes with [github.com/golang/mock] or other mocking frameworks. + // Deprecated: use MockPersonalComputeInterface instead. + WithImpl(impl PersonalComputeService) PersonalComputeInterface + + // Impl returns low-level PersonalCompute API implementation + // Deprecated: use MockPersonalComputeInterface instead. + Impl() PersonalComputeService + + // Delete Personal Compute setting. + // + // Reverts back the Personal Compute setting value to default (ON) + Delete(ctx context.Context, request DeletePersonalComputeRequest) (*DeletePersonalComputeSettingResponse, error) + + // Get Personal Compute setting. + // + // Gets the value of the Personal Compute setting. + Get(ctx context.Context, request GetPersonalComputeRequest) (*PersonalComputeSetting, error) + + // Update Personal Compute setting. + // + // Updates the value of the Personal Compute setting. + Update(ctx context.Context, request UpdatePersonalComputeSettingRequest) (*PersonalComputeSetting, error) +} + +func NewPersonalCompute(client *client.DatabricksClient) *PersonalComputeAPI { + return &PersonalComputeAPI{ + impl: &personalComputeImpl{ + client: client, + }, + } +} + +// The Personal Compute enablement setting lets you control which users can use +// the Personal Compute default policy to create compute resources. By default +// all users in all workspaces have access (ON), but you can change the setting +// to instead let individual workspaces configure access control (DELEGATE). +// +// There is only one instance of this setting per account. Since this setting +// has a default value, this setting is present on all accounts even though it's +// never set on a given account. Deletion reverts the value of the setting back +// to the default value. +type PersonalComputeAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(PersonalComputeService) + impl PersonalComputeService +} + +// WithImpl could be used to override low-level API implementations for unit +// testing purposes with [github.com/golang/mock] or other mocking frameworks. +// Deprecated: use MockPersonalComputeInterface instead. +func (a *PersonalComputeAPI) WithImpl(impl PersonalComputeService) PersonalComputeInterface { + a.impl = impl + return a +} + +// Impl returns low-level PersonalCompute API implementation +// Deprecated: use MockPersonalComputeInterface instead. +func (a *PersonalComputeAPI) Impl() PersonalComputeService { + return a.impl } -// List private endpoint rules. +// Delete Personal Compute setting. // -// Gets an array of private endpoint rules. +// Reverts back the Personal Compute setting value to default (ON) +func (a *PersonalComputeAPI) Delete(ctx context.Context, request DeletePersonalComputeRequest) (*DeletePersonalComputeSettingResponse, error) { + return a.impl.Delete(ctx, request) +} + +// Get Personal Compute setting. // -// This method is generated by Databricks SDK Code Generator. -func (a *NetworkConnectivityAPI) ListPrivateEndpointRulesAll(ctx context.Context, request ListPrivateEndpointRulesRequest) ([]NccAzurePrivateEndpointRule, error) { - iterator := a.ListPrivateEndpointRules(ctx, request) - return listing.ToSlice[NccAzurePrivateEndpointRule](ctx, iterator) +// Gets the value of the Personal Compute setting. +func (a *PersonalComputeAPI) Get(ctx context.Context, request GetPersonalComputeRequest) (*PersonalComputeSetting, error) { + return a.impl.Get(ctx, request) } -// List private endpoint rules. +// Update Personal Compute setting. // -// Gets an array of private endpoint rules. -func (a *NetworkConnectivityAPI) ListPrivateEndpointRulesByNetworkConnectivityConfigId(ctx context.Context, networkConnectivityConfigId string) (*ListNccAzurePrivateEndpointRulesResponse, error) { - return a.impl.ListPrivateEndpointRules(ctx, ListPrivateEndpointRulesRequest{ - NetworkConnectivityConfigId: networkConnectivityConfigId, - }) +// Updates the value of the Personal Compute setting. +func (a *PersonalComputeAPI) Update(ctx context.Context, request UpdatePersonalComputeSettingRequest) (*PersonalComputeSetting, error) { + return a.impl.Update(ctx, request) } -type SettingsInterface interface { +type RestrictWorkspaceAdminsInterface interface { // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. - // Deprecated: use MockSettingsInterface instead. - WithImpl(impl SettingsService) SettingsInterface - - // Impl returns low-level Settings API implementation - // Deprecated: use MockSettingsInterface instead. - Impl() SettingsService + // Deprecated: use MockRestrictWorkspaceAdminsInterface instead. + WithImpl(impl RestrictWorkspaceAdminsService) RestrictWorkspaceAdminsInterface - // Delete the default namespace setting. - // - // Deletes the default namespace setting for the workspace. A fresh etag needs - // to be provided in `DELETE` requests (as a query parameter). The etag can be - // retrieved by making a `GET` request before the `DELETE` request. If the - // setting is updated/deleted concurrently, `DELETE` fails with 409 and the - // request must be retried by using the fresh etag in the 409 response. - DeleteDefaultNamespaceSetting(ctx context.Context, request DeleteDefaultNamespaceSettingRequest) (*DeleteDefaultNamespaceSettingResponse, error) + // Impl returns low-level RestrictWorkspaceAdmins API implementation + // Deprecated: use MockRestrictWorkspaceAdminsInterface instead. + Impl() RestrictWorkspaceAdminsService // Delete the restrict workspace admins setting. // @@ -1277,70 +1773,12 @@ type SettingsInterface interface { // request. If the setting is updated/deleted concurrently, `DELETE` fails with // 409 and the request must be retried by using the fresh etag in the 409 // response. - DeleteRestrictWorkspaceAdminsSetting(ctx context.Context, request DeleteRestrictWorkspaceAdminsSettingRequest) (*DeleteRestrictWorkspaceAdminsSettingResponse, error) - - // Get the automatic cluster update setting. - // - // Gets the automatic cluster update setting. - GetAutomaticClusterUpdateSetting(ctx context.Context, request GetAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) - - // Get the compliance security profile setting. - // - // Gets the compliance security profile setting. - GetCspEnablementSetting(ctx context.Context, request GetCspEnablementSettingRequest) (*CspEnablementSetting, error) - - // Get the default namespace setting. - // - // Gets the default namespace setting. - GetDefaultNamespaceSetting(ctx context.Context, request GetDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) - - // Get the enhanced security monitoring setting. - // - // Gets the enhanced security monitoring setting. - GetEsmEnablementSetting(ctx context.Context, request GetEsmEnablementSettingRequest) (*EsmEnablementSetting, error) + Delete(ctx context.Context, request DeleteRestrictWorkspaceAdminRequest) (*DeleteRestrictWorkspaceAdminsSettingResponse, error) // Get the restrict workspace admins setting. // // Gets the restrict workspace admins setting. - GetRestrictWorkspaceAdminsSetting(ctx context.Context, request GetRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) - - // Update the automatic cluster update setting. - // - // Updates the automatic cluster update setting for the workspace. A fresh etag - // needs to be provided in `PATCH` requests (as part of the setting field). The - // etag can be retrieved by making a `GET` request before the `PATCH` request. - // If the setting is updated concurrently, `PATCH` fails with 409 and the - // request must be retried by using the fresh etag in the 409 response. - UpdateAutomaticClusterUpdateSetting(ctx context.Context, request UpdateAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) - - // Update the compliance security profile setting. - // - // Updates the compliance security profile setting for the workspace. A fresh - // etag needs to be provided in `PATCH` requests (as part of the setting field). - // The etag can be retrieved by making a `GET` request before the `PATCH` - // request. If the setting is updated concurrently, `PATCH` fails with 409 and - // the request must be retried by using the fresh etag in the 409 response. - UpdateCspEnablementSetting(ctx context.Context, request UpdateCspEnablementSettingRequest) (*CspEnablementSetting, error) - - // Update the default namespace setting. - // - // Updates the default namespace setting for the workspace. A fresh etag needs - // to be provided in `PATCH` requests (as part of the setting field). The etag - // can be retrieved by making a `GET` request before the `PATCH` request. Note - // that if the setting does not exist, `GET` returns a NOT_FOUND error and the - // etag is present in the error response, which should be set in the `PATCH` - // request. If the setting is updated concurrently, `PATCH` fails with 409 and - // the request must be retried by using the fresh etag in the 409 response. - UpdateDefaultNamespaceSetting(ctx context.Context, request UpdateDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) - - // Update the enhanced security monitoring setting. - // - // Updates the enhanced security monitoring setting for the workspace. A fresh - // etag needs to be provided in `PATCH` requests (as part of the setting field). - // The etag can be retrieved by making a `GET` request before the `PATCH` - // request. If the setting is updated concurrently, `PATCH` fails with 409 and - // the request must be retried by using the fresh etag in the 409 response. - UpdateEsmEnablementSetting(ctx context.Context, request UpdateEsmEnablementSettingRequest) (*EsmEnablementSetting, error) + Get(ctx context.Context, request GetRestrictWorkspaceAdminRequest) (*RestrictWorkspaceAdminsSetting, error) // Update the restrict workspace admins setting. // @@ -1349,60 +1787,49 @@ type SettingsInterface interface { // etag can be retrieved by making a GET request before the `PATCH` request. If // the setting is updated concurrently, `PATCH` fails with 409 and the request // must be retried by using the fresh etag in the 409 response. - UpdateRestrictWorkspaceAdminsSetting(ctx context.Context, request UpdateRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) + Update(ctx context.Context, request UpdateRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) } -func NewSettings(client *client.DatabricksClient) *SettingsAPI { - return &SettingsAPI{ - impl: &settingsImpl{ +func NewRestrictWorkspaceAdmins(client *client.DatabricksClient) *RestrictWorkspaceAdminsAPI { + return &RestrictWorkspaceAdminsAPI{ + impl: &restrictWorkspaceAdminsImpl{ client: client, }, } } -// The default namespace setting API allows users to configure the default -// namespace for a Databricks workspace. -// -// Through this API, users can retrieve, set, or modify the default namespace -// used when queries do not reference a fully qualified three-level name. For -// example, if you use the API to set 'retail_prod' as the default catalog, then -// a query 'SELECT * FROM myTable' would reference the object -// 'retail_prod.default.myTable' (the schema 'default' is always assumed). -// -// This setting requires a restart of clusters and SQL warehouses to take -// effect. Additionally, the default namespace only applies when using Unity -// Catalog-enabled compute. -type SettingsAPI struct { +// The Restrict Workspace Admins setting lets you control the capabilities of +// workspace admins. With the setting status set to ALLOW_ALL, workspace admins +// can create service principal personal access tokens on behalf of any service +// principal in their workspace. Workspace admins can also change a job owner to +// any user in their workspace. And they can change the job run_as setting to +// any user in their workspace or to a service principal on which they have the +// Service Principal User role. With the setting status set to +// RESTRICT_TOKENS_AND_JOB_RUN_AS, workspace admins can only create personal +// access tokens on behalf of service principals they have the Service Principal +// User role on. They can also only change a job owner to themselves. And they +// can change the job run_as setting to themselves or to a service principal on +// which they have the Service Principal User role. +type RestrictWorkspaceAdminsAPI struct { // impl contains low-level REST API interface, that could be overridden - // through WithImpl(SettingsService) - impl SettingsService + // through WithImpl(RestrictWorkspaceAdminsService) + impl RestrictWorkspaceAdminsService } // WithImpl could be used to override low-level API implementations for unit // testing purposes with [github.com/golang/mock] or other mocking frameworks. -// Deprecated: use MockSettingsInterface instead. -func (a *SettingsAPI) WithImpl(impl SettingsService) SettingsInterface { +// Deprecated: use MockRestrictWorkspaceAdminsInterface instead. +func (a *RestrictWorkspaceAdminsAPI) WithImpl(impl RestrictWorkspaceAdminsService) RestrictWorkspaceAdminsInterface { a.impl = impl return a } -// Impl returns low-level Settings API implementation -// Deprecated: use MockSettingsInterface instead. -func (a *SettingsAPI) Impl() SettingsService { +// Impl returns low-level RestrictWorkspaceAdmins API implementation +// Deprecated: use MockRestrictWorkspaceAdminsInterface instead. +func (a *RestrictWorkspaceAdminsAPI) Impl() RestrictWorkspaceAdminsService { return a.impl } -// Delete the default namespace setting. -// -// Deletes the default namespace setting for the workspace. A fresh etag needs -// to be provided in `DELETE` requests (as a query parameter). The etag can be -// retrieved by making a `GET` request before the `DELETE` request. If the -// setting is updated/deleted concurrently, `DELETE` fails with 409 and the -// request must be retried by using the fresh etag in the 409 response. -func (a *SettingsAPI) DeleteDefaultNamespaceSetting(ctx context.Context, request DeleteDefaultNamespaceSettingRequest) (*DeleteDefaultNamespaceSettingResponse, error) { - return a.impl.DeleteDefaultNamespaceSetting(ctx, request) -} - // Delete the restrict workspace admins setting. // // Reverts the restrict workspace admins setting status for the workspace. A @@ -1411,100 +1838,197 @@ func (a *SettingsAPI) DeleteDefaultNamespaceSetting(ctx context.Context, request // request. If the setting is updated/deleted concurrently, `DELETE` fails with // 409 and the request must be retried by using the fresh etag in the 409 // response. -func (a *SettingsAPI) DeleteRestrictWorkspaceAdminsSetting(ctx context.Context, request DeleteRestrictWorkspaceAdminsSettingRequest) (*DeleteRestrictWorkspaceAdminsSettingResponse, error) { - return a.impl.DeleteRestrictWorkspaceAdminsSetting(ctx, request) +func (a *RestrictWorkspaceAdminsAPI) Delete(ctx context.Context, request DeleteRestrictWorkspaceAdminRequest) (*DeleteRestrictWorkspaceAdminsSettingResponse, error) { + return a.impl.Delete(ctx, request) } -// Get the automatic cluster update setting. +// Get the restrict workspace admins setting. // -// Gets the automatic cluster update setting. -func (a *SettingsAPI) GetAutomaticClusterUpdateSetting(ctx context.Context, request GetAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) { - return a.impl.GetAutomaticClusterUpdateSetting(ctx, request) +// Gets the restrict workspace admins setting. +func (a *RestrictWorkspaceAdminsAPI) Get(ctx context.Context, request GetRestrictWorkspaceAdminRequest) (*RestrictWorkspaceAdminsSetting, error) { + return a.impl.Get(ctx, request) } -// Get the compliance security profile setting. +// Update the restrict workspace admins setting. // -// Gets the compliance security profile setting. -func (a *SettingsAPI) GetCspEnablementSetting(ctx context.Context, request GetCspEnablementSettingRequest) (*CspEnablementSetting, error) { - return a.impl.GetCspEnablementSetting(ctx, request) +// Updates the restrict workspace admins setting for the workspace. A fresh etag +// needs to be provided in `PATCH` requests (as part of the setting field). The +// etag can be retrieved by making a GET request before the `PATCH` request. If +// the setting is updated concurrently, `PATCH` fails with 409 and the request +// must be retried by using the fresh etag in the 409 response. +func (a *RestrictWorkspaceAdminsAPI) Update(ctx context.Context, request UpdateRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) { + return a.impl.Update(ctx, request) } -// Get the default namespace setting. -// -// Gets the default namespace setting. -func (a *SettingsAPI) GetDefaultNamespaceSetting(ctx context.Context, request GetDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) { - return a.impl.GetDefaultNamespaceSetting(ctx, request) +type SettingsInterface interface { + // WithImpl could be used to override low-level API implementations for unit + // testing purposes with [github.com/golang/mock] or other mocking frameworks. + // Deprecated: use MockSettingsInterface instead. + WithImpl(impl SettingsService) SettingsInterface + + // Impl returns low-level Settings API implementation + // Deprecated: use MockSettingsInterface instead. + Impl() SettingsService + + // Controls whether automatic cluster update is enabled for the current + // workspace. By default, it is turned off. + AutomaticClusterUpdate() AutomaticClusterUpdateInterface + + // Controls whether to enable the compliance security profile for the + // current workspace. Enabling it on a workspace is permanent. By default, + // it is turned off. + // + // This settings can NOT be disabled once it is enabled. + CspEnablement() CspEnablementInterface + + // The default namespace setting API allows users to configure the default + // namespace for a Databricks workspace. + // + // Through this API, users can retrieve, set, or modify the default + // namespace used when queries do not reference a fully qualified + // three-level name. For example, if you use the API to set 'retail_prod' as + // the default catalog, then a query 'SELECT * FROM myTable' would reference + // the object 'retail_prod.default.myTable' (the schema 'default' is always + // assumed). + // + // This setting requires a restart of clusters and SQL warehouses to take + // effect. Additionally, the default namespace only applies when using Unity + // Catalog-enabled compute. + DefaultNamespace() DefaultNamespaceInterface + + // Controls whether enhanced security monitoring is enabled for the current + // workspace. If the compliance security profile is enabled, this is + // automatically enabled. By default, it is disabled. However, if the + // compliance security profile is enabled, this is automatically enabled. + // + // If the compliance security profile is disabled, you can enable or disable + // this setting and it is not permanent. + EsmEnablement() EsmEnablementInterface + + // The Restrict Workspace Admins setting lets you control the capabilities + // of workspace admins. With the setting status set to ALLOW_ALL, workspace + // admins can create service principal personal access tokens on behalf of + // any service principal in their workspace. Workspace admins can also + // change a job owner to any user in their workspace. And they can change + // the job run_as setting to any user in their workspace or to a service + // principal on which they have the Service Principal User role. With the + // setting status set to RESTRICT_TOKENS_AND_JOB_RUN_AS, workspace admins + // can only create personal access tokens on behalf of service principals + // they have the Service Principal User role on. They can also only change a + // job owner to themselves. And they can change the job run_as setting to + // themselves or to a service principal on which they have the Service + // Principal User role. + RestrictWorkspaceAdmins() RestrictWorkspaceAdminsInterface } -// Get the enhanced security monitoring setting. -// -// Gets the enhanced security monitoring setting. -func (a *SettingsAPI) GetEsmEnablementSetting(ctx context.Context, request GetEsmEnablementSettingRequest) (*EsmEnablementSetting, error) { - return a.impl.GetEsmEnablementSetting(ctx, request) +func NewSettings(client *client.DatabricksClient) *SettingsAPI { + return &SettingsAPI{ + impl: &settingsImpl{ + client: client, + }, + + automaticClusterUpdate: NewAutomaticClusterUpdate(client), + + cspEnablement: NewCspEnablement(client), + + defaultNamespace: NewDefaultNamespace(client), + + esmEnablement: NewEsmEnablement(client), + + restrictWorkspaceAdmins: NewRestrictWorkspaceAdmins(client), + } } -// Get the restrict workspace admins setting. -// -// Gets the restrict workspace admins setting. -func (a *SettingsAPI) GetRestrictWorkspaceAdminsSetting(ctx context.Context, request GetRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) { - return a.impl.GetRestrictWorkspaceAdminsSetting(ctx, request) +// Workspace Settings API allows users to manage settings at the workspace +// level. +type SettingsAPI struct { + // impl contains low-level REST API interface, that could be overridden + // through WithImpl(SettingsService) + impl SettingsService + + // Controls whether automatic cluster update is enabled for the current + // workspace. By default, it is turned off. + automaticClusterUpdate AutomaticClusterUpdateInterface + + // Controls whether to enable the compliance security profile for the + // current workspace. Enabling it on a workspace is permanent. By default, + // it is turned off. + // + // This settings can NOT be disabled once it is enabled. + cspEnablement CspEnablementInterface + + // The default namespace setting API allows users to configure the default + // namespace for a Databricks workspace. + // + // Through this API, users can retrieve, set, or modify the default + // namespace used when queries do not reference a fully qualified + // three-level name. For example, if you use the API to set 'retail_prod' as + // the default catalog, then a query 'SELECT * FROM myTable' would reference + // the object 'retail_prod.default.myTable' (the schema 'default' is always + // assumed). + // + // This setting requires a restart of clusters and SQL warehouses to take + // effect. Additionally, the default namespace only applies when using Unity + // Catalog-enabled compute. + defaultNamespace DefaultNamespaceInterface + + // Controls whether enhanced security monitoring is enabled for the current + // workspace. If the compliance security profile is enabled, this is + // automatically enabled. By default, it is disabled. However, if the + // compliance security profile is enabled, this is automatically enabled. + // + // If the compliance security profile is disabled, you can enable or disable + // this setting and it is not permanent. + esmEnablement EsmEnablementInterface + + // The Restrict Workspace Admins setting lets you control the capabilities + // of workspace admins. With the setting status set to ALLOW_ALL, workspace + // admins can create service principal personal access tokens on behalf of + // any service principal in their workspace. Workspace admins can also + // change a job owner to any user in their workspace. And they can change + // the job run_as setting to any user in their workspace or to a service + // principal on which they have the Service Principal User role. With the + // setting status set to RESTRICT_TOKENS_AND_JOB_RUN_AS, workspace admins + // can only create personal access tokens on behalf of service principals + // they have the Service Principal User role on. They can also only change a + // job owner to themselves. And they can change the job run_as setting to + // themselves or to a service principal on which they have the Service + // Principal User role. + restrictWorkspaceAdmins RestrictWorkspaceAdminsInterface } -// Update the automatic cluster update setting. -// -// Updates the automatic cluster update setting for the workspace. A fresh etag -// needs to be provided in `PATCH` requests (as part of the setting field). The -// etag can be retrieved by making a `GET` request before the `PATCH` request. -// If the setting is updated concurrently, `PATCH` fails with 409 and the -// request must be retried by using the fresh etag in the 409 response. -func (a *SettingsAPI) UpdateAutomaticClusterUpdateSetting(ctx context.Context, request UpdateAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) { - return a.impl.UpdateAutomaticClusterUpdateSetting(ctx, request) +func (a *SettingsAPI) AutomaticClusterUpdate() AutomaticClusterUpdateInterface { + return a.automaticClusterUpdate } -// Update the compliance security profile setting. -// -// Updates the compliance security profile setting for the workspace. A fresh -// etag needs to be provided in `PATCH` requests (as part of the setting field). -// The etag can be retrieved by making a `GET` request before the `PATCH` -// request. If the setting is updated concurrently, `PATCH` fails with 409 and -// the request must be retried by using the fresh etag in the 409 response. -func (a *SettingsAPI) UpdateCspEnablementSetting(ctx context.Context, request UpdateCspEnablementSettingRequest) (*CspEnablementSetting, error) { - return a.impl.UpdateCspEnablementSetting(ctx, request) +func (a *SettingsAPI) CspEnablement() CspEnablementInterface { + return a.cspEnablement } -// Update the default namespace setting. -// -// Updates the default namespace setting for the workspace. A fresh etag needs -// to be provided in `PATCH` requests (as part of the setting field). The etag -// can be retrieved by making a `GET` request before the `PATCH` request. Note -// that if the setting does not exist, `GET` returns a NOT_FOUND error and the -// etag is present in the error response, which should be set in the `PATCH` -// request. If the setting is updated concurrently, `PATCH` fails with 409 and -// the request must be retried by using the fresh etag in the 409 response. -func (a *SettingsAPI) UpdateDefaultNamespaceSetting(ctx context.Context, request UpdateDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) { - return a.impl.UpdateDefaultNamespaceSetting(ctx, request) +func (a *SettingsAPI) DefaultNamespace() DefaultNamespaceInterface { + return a.defaultNamespace } -// Update the enhanced security monitoring setting. -// -// Updates the enhanced security monitoring setting for the workspace. A fresh -// etag needs to be provided in `PATCH` requests (as part of the setting field). -// The etag can be retrieved by making a `GET` request before the `PATCH` -// request. If the setting is updated concurrently, `PATCH` fails with 409 and -// the request must be retried by using the fresh etag in the 409 response. -func (a *SettingsAPI) UpdateEsmEnablementSetting(ctx context.Context, request UpdateEsmEnablementSettingRequest) (*EsmEnablementSetting, error) { - return a.impl.UpdateEsmEnablementSetting(ctx, request) +func (a *SettingsAPI) EsmEnablement() EsmEnablementInterface { + return a.esmEnablement } -// Update the restrict workspace admins setting. -// -// Updates the restrict workspace admins setting for the workspace. A fresh etag -// needs to be provided in `PATCH` requests (as part of the setting field). The -// etag can be retrieved by making a GET request before the `PATCH` request. If -// the setting is updated concurrently, `PATCH` fails with 409 and the request -// must be retried by using the fresh etag in the 409 response. -func (a *SettingsAPI) UpdateRestrictWorkspaceAdminsSetting(ctx context.Context, request UpdateRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) { - return a.impl.UpdateRestrictWorkspaceAdminsSetting(ctx, request) +func (a *SettingsAPI) RestrictWorkspaceAdmins() RestrictWorkspaceAdminsInterface { + return a.restrictWorkspaceAdmins +} + +// WithImpl could be used to override low-level API implementations for unit +// testing purposes with [github.com/golang/mock] or other mocking frameworks. +// Deprecated: use MockSettingsInterface instead. +func (a *SettingsAPI) WithImpl(impl SettingsService) SettingsInterface { + a.impl = impl + return a +} + +// Impl returns low-level Settings API implementation +// Deprecated: use MockSettingsInterface instead. +func (a *SettingsAPI) Impl() SettingsService { + return a.impl } type TokenManagementInterface interface { diff --git a/service/settings/impl.go b/service/settings/impl.go index 76812227b..5251b0229 100755 --- a/service/settings/impl.go +++ b/service/settings/impl.go @@ -77,43 +77,84 @@ type accountSettingsImpl struct { client *client.DatabricksClient } -func (a *accountSettingsImpl) DeletePersonalComputeSetting(ctx context.Context, request DeletePersonalComputeSettingRequest) (*DeletePersonalComputeSettingResponse, error) { - var deletePersonalComputeSettingResponse DeletePersonalComputeSettingResponse - path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/dcp_acct_enable/names/default", a.client.ConfiguredAccountID()) +// unexported type that holds implementations of just AutomaticClusterUpdate API methods +type automaticClusterUpdateImpl struct { + client *client.DatabricksClient +} + +func (a *automaticClusterUpdateImpl) Get(ctx context.Context, request GetAutomaticClusterUpdateRequest) (*AutomaticClusterUpdateSetting, error) { + var automaticClusterUpdateSetting AutomaticClusterUpdateSetting + path := "/api/2.0/settings/types/automatic_cluster_update/names/default" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deletePersonalComputeSettingResponse) - return &deletePersonalComputeSettingResponse, err + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &automaticClusterUpdateSetting) + return &automaticClusterUpdateSetting, err } -func (a *accountSettingsImpl) GetCspEnablementAccountSetting(ctx context.Context, request GetCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) { - var cspEnablementAccountSetting CspEnablementAccountSetting - path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_csp_enablement_ac/names/default", a.client.ConfiguredAccountID()) +func (a *automaticClusterUpdateImpl) Update(ctx context.Context, request UpdateAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) { + var automaticClusterUpdateSetting AutomaticClusterUpdateSetting + path := "/api/2.0/settings/types/automatic_cluster_update/names/default" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &cspEnablementAccountSetting) - return &cspEnablementAccountSetting, err + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &automaticClusterUpdateSetting) + return &automaticClusterUpdateSetting, err } -func (a *accountSettingsImpl) GetEsmEnablementAccountSetting(ctx context.Context, request GetEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) { - var esmEnablementAccountSetting EsmEnablementAccountSetting - path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_esm_enablement_ac/names/default", a.client.ConfiguredAccountID()) +// unexported type that holds implementations of just CredentialsManager API methods +type credentialsManagerImpl struct { + client *client.DatabricksClient +} + +func (a *credentialsManagerImpl) ExchangeToken(ctx context.Context, request ExchangeTokenRequest) (*ExchangeTokenResponse, error) { + var exchangeTokenResponse ExchangeTokenResponse + path := "/api/2.0/credentials-manager/exchange-tokens/token" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &esmEnablementAccountSetting) - return &esmEnablementAccountSetting, err + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, request, &exchangeTokenResponse) + return &exchangeTokenResponse, err } -func (a *accountSettingsImpl) GetPersonalComputeSetting(ctx context.Context, request GetPersonalComputeSettingRequest) (*PersonalComputeSetting, error) { - var personalComputeSetting PersonalComputeSetting - path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/dcp_acct_enable/names/default", a.client.ConfiguredAccountID()) +// unexported type that holds implementations of just CSPEnablement API methods +type cspEnablementImpl struct { + client *client.DatabricksClient +} + +func (a *cspEnablementImpl) Get(ctx context.Context, request GetCspEnablementRequest) (*CspEnablementSetting, error) { + var cspEnablementSetting CspEnablementSetting + path := "/api/2.0/settings/types/shield_csp_enablement_ws_db/names/default" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &personalComputeSetting) - return &personalComputeSetting, err + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &cspEnablementSetting) + return &cspEnablementSetting, err +} + +func (a *cspEnablementImpl) Update(ctx context.Context, request UpdateCspEnablementSettingRequest) (*CspEnablementSetting, error) { + var cspEnablementSetting CspEnablementSetting + path := "/api/2.0/settings/types/shield_csp_enablement_ws_db/names/default" + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &cspEnablementSetting) + return &cspEnablementSetting, err } -func (a *accountSettingsImpl) UpdateCspEnablementAccountSetting(ctx context.Context, request UpdateCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) { +// unexported type that holds implementations of just CSPEnablementAccount API methods +type cspEnablementAccountImpl struct { + client *client.DatabricksClient +} + +func (a *cspEnablementAccountImpl) Get(ctx context.Context, request GetCspEnablementAccountRequest) (*CspEnablementAccountSetting, error) { + var cspEnablementAccountSetting CspEnablementAccountSetting + path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_csp_enablement_ac/names/default", a.client.ConfiguredAccountID()) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &cspEnablementAccountSetting) + return &cspEnablementAccountSetting, err +} + +func (a *cspEnablementAccountImpl) Update(ctx context.Context, request UpdateCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) { var cspEnablementAccountSetting CspEnablementAccountSetting path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_csp_enablement_ac/names/default", a.client.ConfiguredAccountID()) headers := make(map[string]string) @@ -123,39 +164,85 @@ func (a *accountSettingsImpl) UpdateCspEnablementAccountSetting(ctx context.Cont return &cspEnablementAccountSetting, err } -func (a *accountSettingsImpl) UpdateEsmEnablementAccountSetting(ctx context.Context, request UpdateEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) { - var esmEnablementAccountSetting EsmEnablementAccountSetting - path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_esm_enablement_ac/names/default", a.client.ConfiguredAccountID()) +// unexported type that holds implementations of just DefaultNamespace API methods +type defaultNamespaceImpl struct { + client *client.DatabricksClient +} + +func (a *defaultNamespaceImpl) Delete(ctx context.Context, request DeleteDefaultNamespaceRequest) (*DeleteDefaultNamespaceSettingResponse, error) { + var deleteDefaultNamespaceSettingResponse DeleteDefaultNamespaceSettingResponse + path := "/api/2.0/settings/types/default_namespace_ws/names/default" + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deleteDefaultNamespaceSettingResponse) + return &deleteDefaultNamespaceSettingResponse, err +} + +func (a *defaultNamespaceImpl) Get(ctx context.Context, request GetDefaultNamespaceRequest) (*DefaultNamespaceSetting, error) { + var defaultNamespaceSetting DefaultNamespaceSetting + path := "/api/2.0/settings/types/default_namespace_ws/names/default" + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &defaultNamespaceSetting) + return &defaultNamespaceSetting, err +} + +func (a *defaultNamespaceImpl) Update(ctx context.Context, request UpdateDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) { + var defaultNamespaceSetting DefaultNamespaceSetting + path := "/api/2.0/settings/types/default_namespace_ws/names/default" headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &esmEnablementAccountSetting) - return &esmEnablementAccountSetting, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &defaultNamespaceSetting) + return &defaultNamespaceSetting, err } -func (a *accountSettingsImpl) UpdatePersonalComputeSetting(ctx context.Context, request UpdatePersonalComputeSettingRequest) (*PersonalComputeSetting, error) { - var personalComputeSetting PersonalComputeSetting - path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/dcp_acct_enable/names/default", a.client.ConfiguredAccountID()) +// unexported type that holds implementations of just ESMEnablement API methods +type esmEnablementImpl struct { + client *client.DatabricksClient +} + +func (a *esmEnablementImpl) Get(ctx context.Context, request GetEsmEnablementRequest) (*EsmEnablementSetting, error) { + var esmEnablementSetting EsmEnablementSetting + path := "/api/2.0/settings/types/shield_esm_enablement_ws_db/names/default" + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &esmEnablementSetting) + return &esmEnablementSetting, err +} + +func (a *esmEnablementImpl) Update(ctx context.Context, request UpdateEsmEnablementSettingRequest) (*EsmEnablementSetting, error) { + var esmEnablementSetting EsmEnablementSetting + path := "/api/2.0/settings/types/shield_esm_enablement_ws_db/names/default" headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &personalComputeSetting) - return &personalComputeSetting, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &esmEnablementSetting) + return &esmEnablementSetting, err } -// unexported type that holds implementations of just CredentialsManager API methods -type credentialsManagerImpl struct { +// unexported type that holds implementations of just ESMEnablementAccount API methods +type esmEnablementAccountImpl struct { client *client.DatabricksClient } -func (a *credentialsManagerImpl) ExchangeToken(ctx context.Context, request ExchangeTokenRequest) (*ExchangeTokenResponse, error) { - var exchangeTokenResponse ExchangeTokenResponse - path := "/api/2.0/credentials-manager/exchange-tokens/token" +func (a *esmEnablementAccountImpl) Get(ctx context.Context, request GetEsmEnablementAccountRequest) (*EsmEnablementAccountSetting, error) { + var esmEnablementAccountSetting EsmEnablementAccountSetting + path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_esm_enablement_ac/names/default", a.client.ConfiguredAccountID()) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &esmEnablementAccountSetting) + return &esmEnablementAccountSetting, err +} + +func (a *esmEnablementAccountImpl) Update(ctx context.Context, request UpdateEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) { + var esmEnablementAccountSetting EsmEnablementAccountSetting + path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_esm_enablement_ac/names/default", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPost, path, headers, request, &exchangeTokenResponse) - return &exchangeTokenResponse, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &esmEnablementAccountSetting) + return &esmEnablementAccountSetting, err } // unexported type that holds implementations of just IpAccessLists API methods @@ -299,66 +386,54 @@ func (a *networkConnectivityImpl) ListPrivateEndpointRules(ctx context.Context, return &listNccAzurePrivateEndpointRulesResponse, err } -// unexported type that holds implementations of just Settings API methods -type settingsImpl struct { +// unexported type that holds implementations of just PersonalCompute API methods +type personalComputeImpl struct { client *client.DatabricksClient } -func (a *settingsImpl) DeleteDefaultNamespaceSetting(ctx context.Context, request DeleteDefaultNamespaceSettingRequest) (*DeleteDefaultNamespaceSettingResponse, error) { - var deleteDefaultNamespaceSettingResponse DeleteDefaultNamespaceSettingResponse - path := "/api/2.0/settings/types/default_namespace_ws/names/default" - headers := make(map[string]string) - headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deleteDefaultNamespaceSettingResponse) - return &deleteDefaultNamespaceSettingResponse, err -} - -func (a *settingsImpl) DeleteRestrictWorkspaceAdminsSetting(ctx context.Context, request DeleteRestrictWorkspaceAdminsSettingRequest) (*DeleteRestrictWorkspaceAdminsSettingResponse, error) { - var deleteRestrictWorkspaceAdminsSettingResponse DeleteRestrictWorkspaceAdminsSettingResponse - path := "/api/2.0/settings/types/restrict_workspace_admins/names/default" +func (a *personalComputeImpl) Delete(ctx context.Context, request DeletePersonalComputeRequest) (*DeletePersonalComputeSettingResponse, error) { + var deletePersonalComputeSettingResponse DeletePersonalComputeSettingResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/dcp_acct_enable/names/default", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deleteRestrictWorkspaceAdminsSettingResponse) - return &deleteRestrictWorkspaceAdminsSettingResponse, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deletePersonalComputeSettingResponse) + return &deletePersonalComputeSettingResponse, err } -func (a *settingsImpl) GetAutomaticClusterUpdateSetting(ctx context.Context, request GetAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) { - var automaticClusterUpdateSetting AutomaticClusterUpdateSetting - path := "/api/2.0/settings/types/automatic_cluster_update/names/default" +func (a *personalComputeImpl) Get(ctx context.Context, request GetPersonalComputeRequest) (*PersonalComputeSetting, error) { + var personalComputeSetting PersonalComputeSetting + path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/dcp_acct_enable/names/default", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &automaticClusterUpdateSetting) - return &automaticClusterUpdateSetting, err + err := a.client.Do(ctx, http.MethodGet, path, headers, request, &personalComputeSetting) + return &personalComputeSetting, err } -func (a *settingsImpl) GetCspEnablementSetting(ctx context.Context, request GetCspEnablementSettingRequest) (*CspEnablementSetting, error) { - var cspEnablementSetting CspEnablementSetting - path := "/api/2.0/settings/types/shield_csp_enablement_ws_db/names/default" +func (a *personalComputeImpl) Update(ctx context.Context, request UpdatePersonalComputeSettingRequest) (*PersonalComputeSetting, error) { + var personalComputeSetting PersonalComputeSetting + path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/dcp_acct_enable/names/default", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &cspEnablementSetting) - return &cspEnablementSetting, err + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &personalComputeSetting) + return &personalComputeSetting, err } -func (a *settingsImpl) GetDefaultNamespaceSetting(ctx context.Context, request GetDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) { - var defaultNamespaceSetting DefaultNamespaceSetting - path := "/api/2.0/settings/types/default_namespace_ws/names/default" - headers := make(map[string]string) - headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &defaultNamespaceSetting) - return &defaultNamespaceSetting, err +// unexported type that holds implementations of just RestrictWorkspaceAdmins API methods +type restrictWorkspaceAdminsImpl struct { + client *client.DatabricksClient } -func (a *settingsImpl) GetEsmEnablementSetting(ctx context.Context, request GetEsmEnablementSettingRequest) (*EsmEnablementSetting, error) { - var esmEnablementSetting EsmEnablementSetting - path := "/api/2.0/settings/types/shield_esm_enablement_ws_db/names/default" +func (a *restrictWorkspaceAdminsImpl) Delete(ctx context.Context, request DeleteRestrictWorkspaceAdminRequest) (*DeleteRestrictWorkspaceAdminsSettingResponse, error) { + var deleteRestrictWorkspaceAdminsSettingResponse DeleteRestrictWorkspaceAdminsSettingResponse + path := "/api/2.0/settings/types/restrict_workspace_admins/names/default" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do(ctx, http.MethodGet, path, headers, request, &esmEnablementSetting) - return &esmEnablementSetting, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, request, &deleteRestrictWorkspaceAdminsSettingResponse) + return &deleteRestrictWorkspaceAdminsSettingResponse, err } -func (a *settingsImpl) GetRestrictWorkspaceAdminsSetting(ctx context.Context, request GetRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) { +func (a *restrictWorkspaceAdminsImpl) Get(ctx context.Context, request GetRestrictWorkspaceAdminRequest) (*RestrictWorkspaceAdminsSetting, error) { var restrictWorkspaceAdminsSetting RestrictWorkspaceAdminsSetting path := "/api/2.0/settings/types/restrict_workspace_admins/names/default" headers := make(map[string]string) @@ -367,47 +442,7 @@ func (a *settingsImpl) GetRestrictWorkspaceAdminsSetting(ctx context.Context, re return &restrictWorkspaceAdminsSetting, err } -func (a *settingsImpl) UpdateAutomaticClusterUpdateSetting(ctx context.Context, request UpdateAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) { - var automaticClusterUpdateSetting AutomaticClusterUpdateSetting - path := "/api/2.0/settings/types/automatic_cluster_update/names/default" - headers := make(map[string]string) - headers["Accept"] = "application/json" - headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &automaticClusterUpdateSetting) - return &automaticClusterUpdateSetting, err -} - -func (a *settingsImpl) UpdateCspEnablementSetting(ctx context.Context, request UpdateCspEnablementSettingRequest) (*CspEnablementSetting, error) { - var cspEnablementSetting CspEnablementSetting - path := "/api/2.0/settings/types/shield_csp_enablement_ws_db/names/default" - headers := make(map[string]string) - headers["Accept"] = "application/json" - headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &cspEnablementSetting) - return &cspEnablementSetting, err -} - -func (a *settingsImpl) UpdateDefaultNamespaceSetting(ctx context.Context, request UpdateDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) { - var defaultNamespaceSetting DefaultNamespaceSetting - path := "/api/2.0/settings/types/default_namespace_ws/names/default" - headers := make(map[string]string) - headers["Accept"] = "application/json" - headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &defaultNamespaceSetting) - return &defaultNamespaceSetting, err -} - -func (a *settingsImpl) UpdateEsmEnablementSetting(ctx context.Context, request UpdateEsmEnablementSettingRequest) (*EsmEnablementSetting, error) { - var esmEnablementSetting EsmEnablementSetting - path := "/api/2.0/settings/types/shield_esm_enablement_ws_db/names/default" - headers := make(map[string]string) - headers["Accept"] = "application/json" - headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPatch, path, headers, request, &esmEnablementSetting) - return &esmEnablementSetting, err -} - -func (a *settingsImpl) UpdateRestrictWorkspaceAdminsSetting(ctx context.Context, request UpdateRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) { +func (a *restrictWorkspaceAdminsImpl) Update(ctx context.Context, request UpdateRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) { var restrictWorkspaceAdminsSetting RestrictWorkspaceAdminsSetting path := "/api/2.0/settings/types/restrict_workspace_admins/names/default" headers := make(map[string]string) @@ -417,6 +452,11 @@ func (a *settingsImpl) UpdateRestrictWorkspaceAdminsSetting(ctx context.Context, return &restrictWorkspaceAdminsSetting, err } +// unexported type that holds implementations of just Settings API methods +type settingsImpl struct { + client *client.DatabricksClient +} + // unexported type that holds implementations of just TokenManagement API methods type tokenManagementImpl struct { client *client.DatabricksClient diff --git a/service/settings/interface.go b/service/settings/interface.go index 3fcb01dee..dcf847071 100755 --- a/service/settings/interface.go +++ b/service/settings/interface.go @@ -103,64 +103,169 @@ type AccountIpAccessListsService interface { Update(ctx context.Context, request UpdateIpAccessList) error } -// The Personal Compute enablement setting lets you control which users can use -// the Personal Compute default policy to create compute resources. By default -// all users in all workspaces have access (ON), but you can change the setting -// to instead let individual workspaces configure access control (DELEGATE). -// -// There is only one instance of this setting per account. Since this setting -// has a default value, this setting is present on all accounts even though it's -// never set on a given account. Deletion reverts the value of the setting back -// to the default value. +// Accounts Settings API allows users to manage settings at the account level. type AccountSettingsService interface { +} - // Delete Personal Compute setting. +// Controls whether automatic cluster update is enabled for the current +// workspace. By default, it is turned off. +type AutomaticClusterUpdateService interface { + + // Get the automatic cluster update setting. // - // Reverts back the Personal Compute setting value to default (ON) - DeletePersonalComputeSetting(ctx context.Context, request DeletePersonalComputeSettingRequest) (*DeletePersonalComputeSettingResponse, error) + // Gets the automatic cluster update setting. + Get(ctx context.Context, request GetAutomaticClusterUpdateRequest) (*AutomaticClusterUpdateSetting, error) - // Get the compliance security profile setting for new workspaces. + // Update the automatic cluster update setting. // - // Gets the compliance security profile setting for new workspaces. - GetCspEnablementAccountSetting(ctx context.Context, request GetCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) + // Updates the automatic cluster update setting for the workspace. A fresh + // etag needs to be provided in `PATCH` requests (as part of the setting + // field). The etag can be retrieved by making a `GET` request before the + // `PATCH` request. If the setting is updated concurrently, `PATCH` fails + // with 409 and the request must be retried by using the fresh etag in the + // 409 response. + Update(ctx context.Context, request UpdateAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) +} - // Get the enhanced security monitoring setting for new workspaces. +// Credentials manager interacts with with Identity Providers to to perform +// token exchanges using stored credentials and refresh tokens. +type CredentialsManagerService interface { + + // Exchange token. // - // Gets the enhanced security monitoring setting for new workspaces. - GetEsmEnablementAccountSetting(ctx context.Context, request GetEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) + // Exchange tokens with an Identity Provider to get a new access token. It + // allows specifying scopes to determine token permissions. + ExchangeToken(ctx context.Context, request ExchangeTokenRequest) (*ExchangeTokenResponse, error) +} - // Get Personal Compute setting. +// Controls whether to enable the compliance security profile for the current +// workspace. Enabling it on a workspace is permanent. By default, it is turned +// off. +// +// This settings can NOT be disabled once it is enabled. +type CspEnablementService interface { + + // Get the compliance security profile setting. // - // Gets the value of the Personal Compute setting. - GetPersonalComputeSetting(ctx context.Context, request GetPersonalComputeSettingRequest) (*PersonalComputeSetting, error) + // Gets the compliance security profile setting. + Get(ctx context.Context, request GetCspEnablementRequest) (*CspEnablementSetting, error) + + // Update the compliance security profile setting. + // + // Updates the compliance security profile setting for the workspace. A + // fresh etag needs to be provided in `PATCH` requests (as part of the + // setting field). The etag can be retrieved by making a `GET` request + // before the `PATCH` request. If the setting is updated concurrently, + // `PATCH` fails with 409 and the request must be retried by using the fresh + // etag in the 409 response. + Update(ctx context.Context, request UpdateCspEnablementSettingRequest) (*CspEnablementSetting, error) +} + +// The compliance security profile settings at the account level control whether +// to enable it for new workspaces. By default, this account-level setting is +// disabled for new workspaces. After workspace creation, account admins can +// enable the compliance security profile individually for each workspace. +// +// This settings can be disabled so that new workspaces do not have compliance +// security profile enabled by default. +type CspEnablementAccountService interface { + + // Get the compliance security profile setting for new workspaces. + // + // Gets the compliance security profile setting for new workspaces. + Get(ctx context.Context, request GetCspEnablementAccountRequest) (*CspEnablementAccountSetting, error) // Update the compliance security profile setting for new workspaces. // // Updates the value of the compliance security profile setting for new // workspaces. - UpdateCspEnablementAccountSetting(ctx context.Context, request UpdateCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) + Update(ctx context.Context, request UpdateCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) +} - // Update the enhanced security monitoring setting for new workspaces. +// The default namespace setting API allows users to configure the default +// namespace for a Databricks workspace. +// +// Through this API, users can retrieve, set, or modify the default namespace +// used when queries do not reference a fully qualified three-level name. For +// example, if you use the API to set 'retail_prod' as the default catalog, then +// a query 'SELECT * FROM myTable' would reference the object +// 'retail_prod.default.myTable' (the schema 'default' is always assumed). +// +// This setting requires a restart of clusters and SQL warehouses to take +// effect. Additionally, the default namespace only applies when using Unity +// Catalog-enabled compute. +type DefaultNamespaceService interface { + + // Delete the default namespace setting. // - // Updates the value of the enhanced security monitoring setting for new - // workspaces. - UpdateEsmEnablementAccountSetting(ctx context.Context, request UpdateEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) + // Deletes the default namespace setting for the workspace. A fresh etag + // needs to be provided in `DELETE` requests (as a query parameter). The + // etag can be retrieved by making a `GET` request before the `DELETE` + // request. If the setting is updated/deleted concurrently, `DELETE` fails + // with 409 and the request must be retried by using the fresh etag in the + // 409 response. + Delete(ctx context.Context, request DeleteDefaultNamespaceRequest) (*DeleteDefaultNamespaceSettingResponse, error) - // Update Personal Compute setting. + // Get the default namespace setting. // - // Updates the value of the Personal Compute setting. - UpdatePersonalComputeSetting(ctx context.Context, request UpdatePersonalComputeSettingRequest) (*PersonalComputeSetting, error) + // Gets the default namespace setting. + Get(ctx context.Context, request GetDefaultNamespaceRequest) (*DefaultNamespaceSetting, error) + + // Update the default namespace setting. + // + // Updates the default namespace setting for the workspace. A fresh etag + // needs to be provided in `PATCH` requests (as part of the setting field). + // The etag can be retrieved by making a `GET` request before the `PATCH` + // request. Note that if the setting does not exist, `GET` returns a + // NOT_FOUND error and the etag is present in the error response, which + // should be set in the `PATCH` request. If the setting is updated + // concurrently, `PATCH` fails with 409 and the request must be retried by + // using the fresh etag in the 409 response. + Update(ctx context.Context, request UpdateDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) } -// Credentials manager interacts with with Identity Providers to to perform -// token exchanges using stored credentials and refresh tokens. -type CredentialsManagerService interface { +// Controls whether enhanced security monitoring is enabled for the current +// workspace. If the compliance security profile is enabled, this is +// automatically enabled. By default, it is disabled. However, if the compliance +// security profile is enabled, this is automatically enabled. +// +// If the compliance security profile is disabled, you can enable or disable +// this setting and it is not permanent. +type EsmEnablementService interface { - // Exchange token. + // Get the enhanced security monitoring setting. // - // Exchange tokens with an Identity Provider to get a new access token. It - // allows specifying scopes to determine token permissions. - ExchangeToken(ctx context.Context, request ExchangeTokenRequest) (*ExchangeTokenResponse, error) + // Gets the enhanced security monitoring setting. + Get(ctx context.Context, request GetEsmEnablementRequest) (*EsmEnablementSetting, error) + + // Update the enhanced security monitoring setting. + // + // Updates the enhanced security monitoring setting for the workspace. A + // fresh etag needs to be provided in `PATCH` requests (as part of the + // setting field). The etag can be retrieved by making a `GET` request + // before the `PATCH` request. If the setting is updated concurrently, + // `PATCH` fails with 409 and the request must be retried by using the fresh + // etag in the 409 response. + Update(ctx context.Context, request UpdateEsmEnablementSettingRequest) (*EsmEnablementSetting, error) +} + +// The enhanced security monitoring setting at the account level controls +// whether to enable the feature on new workspaces. By default, this +// account-level setting is disabled for new workspaces. After workspace +// creation, account admins can enable enhanced security monitoring individually +// for each workspace. +type EsmEnablementAccountService interface { + + // Get the enhanced security monitoring setting for new workspaces. + // + // Gets the enhanced security monitoring setting for new workspaces. + Get(ctx context.Context, request GetEsmEnablementAccountRequest) (*EsmEnablementAccountSetting, error) + + // Update the enhanced security monitoring setting for new workspaces. + // + // Updates the value of the enhanced security monitoring setting for new + // workspaces. + Update(ctx context.Context, request UpdateEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) } // IP Access List enables admins to configure IP access lists. @@ -266,31 +371,10 @@ type IpAccessListsService interface { } // These APIs provide configurations for the network connectivity of your -// workspaces for serverless compute resources. This API provides stable subnets -// for your workspace so that you can configure your firewalls on your Azure -// Storage accounts to allow access from Databricks. You can also use the API to -// provision private endpoints for Databricks to privately connect serverless -// compute resources to your Azure resources using Azure Private Link. See -// [configure serverless secure connectivity]. -// -// [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security +// workspaces for serverless compute resources. type NetworkConnectivityService interface { // Create a network connectivity configuration. - // - // Creates a network connectivity configuration (NCC), which provides stable - // Azure service subnets when accessing your Azure Storage accounts. You can - // also use a network connectivity configuration to create - // Databricks-managed private endpoints so that Databricks serverless - // compute resources privately access your resources. - // - // **IMPORTANT**: After you create the network connectivity configuration, - // you must assign one or more workspaces to the new network connectivity - // configuration. You can share one network connectivity configuration with - // multiple workspaces from the same Azure region within the same Databricks - // account. See [configure serverless secure connectivity]. - // - // [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security CreateNetworkConnectivityConfiguration(ctx context.Context, request CreateNetworkConnectivityConfigRequest) (*NetworkConnectivityConfiguration, error) // Create a private endpoint rule. @@ -346,29 +430,46 @@ type NetworkConnectivityService interface { ListPrivateEndpointRules(ctx context.Context, request ListPrivateEndpointRulesRequest) (*ListNccAzurePrivateEndpointRulesResponse, error) } -// The default namespace setting API allows users to configure the default -// namespace for a Databricks workspace. -// -// Through this API, users can retrieve, set, or modify the default namespace -// used when queries do not reference a fully qualified three-level name. For -// example, if you use the API to set 'retail_prod' as the default catalog, then -// a query 'SELECT * FROM myTable' would reference the object -// 'retail_prod.default.myTable' (the schema 'default' is always assumed). +// The Personal Compute enablement setting lets you control which users can use +// the Personal Compute default policy to create compute resources. By default +// all users in all workspaces have access (ON), but you can change the setting +// to instead let individual workspaces configure access control (DELEGATE). // -// This setting requires a restart of clusters and SQL warehouses to take -// effect. Additionally, the default namespace only applies when using Unity -// Catalog-enabled compute. -type SettingsService interface { +// There is only one instance of this setting per account. Since this setting +// has a default value, this setting is present on all accounts even though it's +// never set on a given account. Deletion reverts the value of the setting back +// to the default value. +type PersonalComputeService interface { - // Delete the default namespace setting. + // Delete Personal Compute setting. // - // Deletes the default namespace setting for the workspace. A fresh etag - // needs to be provided in `DELETE` requests (as a query parameter). The - // etag can be retrieved by making a `GET` request before the `DELETE` - // request. If the setting is updated/deleted concurrently, `DELETE` fails - // with 409 and the request must be retried by using the fresh etag in the - // 409 response. - DeleteDefaultNamespaceSetting(ctx context.Context, request DeleteDefaultNamespaceSettingRequest) (*DeleteDefaultNamespaceSettingResponse, error) + // Reverts back the Personal Compute setting value to default (ON) + Delete(ctx context.Context, request DeletePersonalComputeRequest) (*DeletePersonalComputeSettingResponse, error) + + // Get Personal Compute setting. + // + // Gets the value of the Personal Compute setting. + Get(ctx context.Context, request GetPersonalComputeRequest) (*PersonalComputeSetting, error) + + // Update Personal Compute setting. + // + // Updates the value of the Personal Compute setting. + Update(ctx context.Context, request UpdatePersonalComputeSettingRequest) (*PersonalComputeSetting, error) +} + +// The Restrict Workspace Admins setting lets you control the capabilities of +// workspace admins. With the setting status set to ALLOW_ALL, workspace admins +// can create service principal personal access tokens on behalf of any service +// principal in their workspace. Workspace admins can also change a job owner to +// any user in their workspace. And they can change the job run_as setting to +// any user in their workspace or to a service principal on which they have the +// Service Principal User role. With the setting status set to +// RESTRICT_TOKENS_AND_JOB_RUN_AS, workspace admins can only create personal +// access tokens on behalf of service principals they have the Service Principal +// User role on. They can also only change a job owner to themselves. And they +// can change the job run_as setting to themselves or to a service principal on +// which they have the Service Principal User role. +type RestrictWorkspaceAdminsService interface { // Delete the restrict workspace admins setting. // @@ -378,74 +479,12 @@ type SettingsService interface { // the DELETE request. If the setting is updated/deleted concurrently, // `DELETE` fails with 409 and the request must be retried by using the // fresh etag in the 409 response. - DeleteRestrictWorkspaceAdminsSetting(ctx context.Context, request DeleteRestrictWorkspaceAdminsSettingRequest) (*DeleteRestrictWorkspaceAdminsSettingResponse, error) - - // Get the automatic cluster update setting. - // - // Gets the automatic cluster update setting. - GetAutomaticClusterUpdateSetting(ctx context.Context, request GetAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) - - // Get the compliance security profile setting. - // - // Gets the compliance security profile setting. - GetCspEnablementSetting(ctx context.Context, request GetCspEnablementSettingRequest) (*CspEnablementSetting, error) - - // Get the default namespace setting. - // - // Gets the default namespace setting. - GetDefaultNamespaceSetting(ctx context.Context, request GetDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) - - // Get the enhanced security monitoring setting. - // - // Gets the enhanced security monitoring setting. - GetEsmEnablementSetting(ctx context.Context, request GetEsmEnablementSettingRequest) (*EsmEnablementSetting, error) + Delete(ctx context.Context, request DeleteRestrictWorkspaceAdminRequest) (*DeleteRestrictWorkspaceAdminsSettingResponse, error) // Get the restrict workspace admins setting. // // Gets the restrict workspace admins setting. - GetRestrictWorkspaceAdminsSetting(ctx context.Context, request GetRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) - - // Update the automatic cluster update setting. - // - // Updates the automatic cluster update setting for the workspace. A fresh - // etag needs to be provided in `PATCH` requests (as part of the setting - // field). The etag can be retrieved by making a `GET` request before the - // `PATCH` request. If the setting is updated concurrently, `PATCH` fails - // with 409 and the request must be retried by using the fresh etag in the - // 409 response. - UpdateAutomaticClusterUpdateSetting(ctx context.Context, request UpdateAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) - - // Update the compliance security profile setting. - // - // Updates the compliance security profile setting for the workspace. A - // fresh etag needs to be provided in `PATCH` requests (as part of the - // setting field). The etag can be retrieved by making a `GET` request - // before the `PATCH` request. If the setting is updated concurrently, - // `PATCH` fails with 409 and the request must be retried by using the fresh - // etag in the 409 response. - UpdateCspEnablementSetting(ctx context.Context, request UpdateCspEnablementSettingRequest) (*CspEnablementSetting, error) - - // Update the default namespace setting. - // - // Updates the default namespace setting for the workspace. A fresh etag - // needs to be provided in `PATCH` requests (as part of the setting field). - // The etag can be retrieved by making a `GET` request before the `PATCH` - // request. Note that if the setting does not exist, `GET` returns a - // NOT_FOUND error and the etag is present in the error response, which - // should be set in the `PATCH` request. If the setting is updated - // concurrently, `PATCH` fails with 409 and the request must be retried by - // using the fresh etag in the 409 response. - UpdateDefaultNamespaceSetting(ctx context.Context, request UpdateDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) - - // Update the enhanced security monitoring setting. - // - // Updates the enhanced security monitoring setting for the workspace. A - // fresh etag needs to be provided in `PATCH` requests (as part of the - // setting field). The etag can be retrieved by making a `GET` request - // before the `PATCH` request. If the setting is updated concurrently, - // `PATCH` fails with 409 and the request must be retried by using the fresh - // etag in the 409 response. - UpdateEsmEnablementSetting(ctx context.Context, request UpdateEsmEnablementSettingRequest) (*EsmEnablementSetting, error) + Get(ctx context.Context, request GetRestrictWorkspaceAdminRequest) (*RestrictWorkspaceAdminsSetting, error) // Update the restrict workspace admins setting. // @@ -455,7 +494,12 @@ type SettingsService interface { // `PATCH` request. If the setting is updated concurrently, `PATCH` fails // with 409 and the request must be retried by using the fresh etag in the // 409 response. - UpdateRestrictWorkspaceAdminsSetting(ctx context.Context, request UpdateRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) + Update(ctx context.Context, request UpdateRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) +} + +// Workspace Settings API allows users to manage settings at the workspace +// level. +type SettingsService interface { } // Enables administrators to get all tokens and delete tokens for other users. diff --git a/service/settings/model.go b/service/settings/model.go index f5f07bffd..f7c027d69 100755 --- a/service/settings/model.go +++ b/service/settings/model.go @@ -263,9 +263,9 @@ type CreateNetworkConnectivityConfigRequest struct { // between 3 and 30 characters. The name must match the regular expression // `^[0-9a-zA-Z-_]{3,30}$`. Name string `json:"name"` - // The Azure region for this network connectivity configuration. Only - // workspaces in the same Azure region can be attached to this network - // connectivity configuration. + // The region for the network connectivity configuration. Only workspaces in + // the same region can be attached to the network connectivity + // configuration. Region string `json:"region"` } @@ -530,7 +530,7 @@ type DeleteAccountIpAccessListRequest struct { } // Delete the default namespace setting -type DeleteDefaultNamespaceSettingRequest struct { +type DeleteDefaultNamespaceRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -543,11 +543,11 @@ type DeleteDefaultNamespaceSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *DeleteDefaultNamespaceSettingRequest) UnmarshalJSON(b []byte) error { +func (s *DeleteDefaultNamespaceRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s DeleteDefaultNamespaceSettingRequest) MarshalJSON() ([]byte, error) { +func (s DeleteDefaultNamespaceRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } @@ -579,7 +579,7 @@ type DeleteNetworkConnectivityConfigurationResponse struct { } // Delete Personal Compute setting -type DeletePersonalComputeSettingRequest struct { +type DeletePersonalComputeRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -592,11 +592,11 @@ type DeletePersonalComputeSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *DeletePersonalComputeSettingRequest) UnmarshalJSON(b []byte) error { +func (s *DeletePersonalComputeRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s DeletePersonalComputeSettingRequest) MarshalJSON() ([]byte, error) { +func (s DeletePersonalComputeRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } @@ -624,7 +624,7 @@ type DeleteResponse struct { } // Delete the restrict workspace admins setting -type DeleteRestrictWorkspaceAdminsSettingRequest struct { +type DeleteRestrictWorkspaceAdminRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -637,11 +637,11 @@ type DeleteRestrictWorkspaceAdminsSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *DeleteRestrictWorkspaceAdminsSettingRequest) UnmarshalJSON(b []byte) error { +func (s *DeleteRestrictWorkspaceAdminRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s DeleteRestrictWorkspaceAdminsSettingRequest) MarshalJSON() ([]byte, error) { +func (s DeleteRestrictWorkspaceAdminRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } @@ -806,7 +806,7 @@ type GetAccountIpAccessListRequest struct { } // Get the automatic cluster update setting -type GetAutomaticClusterUpdateSettingRequest struct { +type GetAutomaticClusterUpdateRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -819,16 +819,16 @@ type GetAutomaticClusterUpdateSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *GetAutomaticClusterUpdateSettingRequest) UnmarshalJSON(b []byte) error { +func (s *GetAutomaticClusterUpdateRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s GetAutomaticClusterUpdateSettingRequest) MarshalJSON() ([]byte, error) { +func (s GetAutomaticClusterUpdateRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } // Get the compliance security profile setting for new workspaces -type GetCspEnablementAccountSettingRequest struct { +type GetCspEnablementAccountRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -841,16 +841,16 @@ type GetCspEnablementAccountSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *GetCspEnablementAccountSettingRequest) UnmarshalJSON(b []byte) error { +func (s *GetCspEnablementAccountRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s GetCspEnablementAccountSettingRequest) MarshalJSON() ([]byte, error) { +func (s GetCspEnablementAccountRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } // Get the compliance security profile setting -type GetCspEnablementSettingRequest struct { +type GetCspEnablementRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -863,16 +863,16 @@ type GetCspEnablementSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *GetCspEnablementSettingRequest) UnmarshalJSON(b []byte) error { +func (s *GetCspEnablementRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s GetCspEnablementSettingRequest) MarshalJSON() ([]byte, error) { +func (s GetCspEnablementRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } // Get the default namespace setting -type GetDefaultNamespaceSettingRequest struct { +type GetDefaultNamespaceRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -885,16 +885,16 @@ type GetDefaultNamespaceSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *GetDefaultNamespaceSettingRequest) UnmarshalJSON(b []byte) error { +func (s *GetDefaultNamespaceRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s GetDefaultNamespaceSettingRequest) MarshalJSON() ([]byte, error) { +func (s GetDefaultNamespaceRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } // Get the enhanced security monitoring setting for new workspaces -type GetEsmEnablementAccountSettingRequest struct { +type GetEsmEnablementAccountRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -907,16 +907,16 @@ type GetEsmEnablementAccountSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *GetEsmEnablementAccountSettingRequest) UnmarshalJSON(b []byte) error { +func (s *GetEsmEnablementAccountRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s GetEsmEnablementAccountSettingRequest) MarshalJSON() ([]byte, error) { +func (s GetEsmEnablementAccountRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } // Get the enhanced security monitoring setting -type GetEsmEnablementSettingRequest struct { +type GetEsmEnablementRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -929,11 +929,11 @@ type GetEsmEnablementSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *GetEsmEnablementSettingRequest) UnmarshalJSON(b []byte) error { +func (s *GetEsmEnablementRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s GetEsmEnablementSettingRequest) MarshalJSON() ([]byte, error) { +func (s GetEsmEnablementRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } @@ -960,7 +960,7 @@ type GetNetworkConnectivityConfigurationRequest struct { } // Get Personal Compute setting -type GetPersonalComputeSettingRequest struct { +type GetPersonalComputeRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -973,11 +973,11 @@ type GetPersonalComputeSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *GetPersonalComputeSettingRequest) UnmarshalJSON(b []byte) error { +func (s *GetPersonalComputeRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s GetPersonalComputeSettingRequest) MarshalJSON() ([]byte, error) { +func (s GetPersonalComputeRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } @@ -990,7 +990,7 @@ type GetPrivateEndpointRuleRequest struct { } // Get the restrict workspace admins setting -type GetRestrictWorkspaceAdminsSettingRequest struct { +type GetRestrictWorkspaceAdminRequest struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -1003,11 +1003,11 @@ type GetRestrictWorkspaceAdminsSettingRequest struct { ForceSendFields []string `json:"-"` } -func (s *GetRestrictWorkspaceAdminsSettingRequest) UnmarshalJSON(b []byte) error { +func (s *GetRestrictWorkspaceAdminRequest) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s GetRestrictWorkspaceAdminsSettingRequest) MarshalJSON() ([]byte, error) { +func (s GetRestrictWorkspaceAdminRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } @@ -1208,6 +1208,14 @@ func (f *ListType) Type() string { return "ListType" } +// The stable AWS IP CIDR blocks. You can use these to configure the firewall of +// your resources to allow traffic from your Databricks workspace. +type NccAwsStableIpRule struct { + // The list of stable IP CIDR blocks from which Databricks network traffic + // originates when accessing your resources. + CidrBlocks []string `json:"cidr_blocks,omitempty"` +} + type NccAzurePrivateEndpointRule struct { // The current status of this private endpoint. The private endpoint rules // are effective only if the connection state is `ESTABLISHED`. Remember @@ -1374,6 +1382,10 @@ type NccEgressConfig struct { // specific configurations. You can find the stable network information of your // serverless compute resources here. type NccEgressDefaultRules struct { + // The stable AWS IP CIDR blocks. You can use these to configure the + // firewall of your resources to allow traffic from your Databricks + // workspace. + AwsStableIpRule *NccAwsStableIpRule `json:"aws_stable_ip_rule,omitempty"` // The stable Azure service endpoints. You can configure the firewall of // your Azure resources to allow traffic from your Databricks serverless // compute resources. @@ -1401,9 +1413,9 @@ type NetworkConnectivityConfiguration struct { Name string `json:"name,omitempty"` // Databricks network connectivity configuration ID. NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` - // The Azure region for this network connectivity configuration. Only - // workspaces in the same Azure region can be attached to this network - // connectivity configuration. + // The region for the network connectivity configuration. Only workspaces in + // the same region can be attached to the network connectivity + // configuration. Region string `json:"region,omitempty"` // Time in epoch milliseconds when this object was updated. UpdatedTime int64 `json:"updated_time,omitempty"` diff --git a/service/vectorsearch/impl.go b/service/vectorsearch/impl.go index de3f132e6..dbb171ab4 100755 --- a/service/vectorsearch/impl.go +++ b/service/vectorsearch/impl.go @@ -68,7 +68,7 @@ func (a *vectorSearchIndexesImpl) CreateIndex(ctx context.Context, request Creat func (a *vectorSearchIndexesImpl) DeleteDataVectorIndex(ctx context.Context, request DeleteDataVectorIndexRequest) (*DeleteDataVectorIndexResponse, error) { var deleteDataVectorIndexResponse DeleteDataVectorIndexResponse - path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/delete-data", request.Name) + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/delete-data", request.IndexName) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" @@ -122,7 +122,7 @@ func (a *vectorSearchIndexesImpl) SyncIndex(ctx context.Context, request SyncInd func (a *vectorSearchIndexesImpl) UpsertDataVectorIndex(ctx context.Context, request UpsertDataVectorIndexRequest) (*UpsertDataVectorIndexResponse, error) { var upsertDataVectorIndexResponse UpsertDataVectorIndexResponse - path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/upsert-data", request.Name) + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/upsert-data", request.IndexName) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" diff --git a/service/vectorsearch/model.go b/service/vectorsearch/model.go index 67c4513a7..33535a17a 100755 --- a/service/vectorsearch/model.go +++ b/service/vectorsearch/model.go @@ -38,7 +38,7 @@ type CreateVectorIndexRequest struct { // `DIRECT_ACCESS`. DirectAccessIndexSpec *DirectAccessVectorIndexSpec `json:"direct_access_index_spec,omitempty"` // Name of the endpoint to be used for serving the index - EndpointName string `json:"endpoint_name,omitempty"` + EndpointName string `json:"endpoint_name"` // There are 2 types of Vector Search indexes: // // - `DELTA_SYNC`: An index that automatically syncs with a source Delta @@ -51,16 +51,6 @@ type CreateVectorIndexRequest struct { Name string `json:"name"` // Primary key of the index PrimaryKey string `json:"primary_key"` - - ForceSendFields []string `json:"-"` -} - -func (s *CreateVectorIndexRequest) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, s) -} - -func (s CreateVectorIndexRequest) MarshalJSON() ([]byte, error) { - return marshal.Marshal(s) } type CreateVectorIndexResponse struct { @@ -119,7 +109,7 @@ func (f *DeleteDataStatus) Type() string { type DeleteDataVectorIndexRequest struct { // Name of the vector index where data is to be deleted. Must be a Direct // Vector Access Index. - Name string `json:"-" url:"-"` + IndexName string `json:"-" url:"-"` // List of primary keys for the data to be deleted. PrimaryKeys []string `json:"primary_keys"` } @@ -136,8 +126,6 @@ type DeleteDataVectorIndexResponse struct { type DeleteEndpointRequest struct { // Name of the endpoint EndpointName string `json:"-" url:"-"` - // Name of the endpoint to delete - Name string `json:"-"` } type DeleteEndpointResponse struct { @@ -655,11 +643,11 @@ func (f *UpsertDataStatus) Type() string { // Request payload for upserting data into a vector index. type UpsertDataVectorIndexRequest struct { - // JSON string representing the data to be upserted. - InputsJson string `json:"inputs_json"` // Name of the vector index where data is to be upserted. Must be a Direct // Vector Access Index. - Name string `json:"-" url:"-"` + IndexName string `json:"-" url:"-"` + // JSON string representing the data to be upserted. + InputsJson string `json:"inputs_json"` } // Response to an upsert data vector index request. diff --git a/workspace_client.go b/workspace_client.go index e69c15edf..da6712d01 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -445,6 +445,10 @@ type WorkspaceClient struct { // Delta tables. OnlineTables catalog.OnlineTablesInterface + // This spec contains undocumented permission migration APIs used in + // https://github.com/databrickslabs/ucx. + PermissionMigration iam.PermissionMigrationInterface + // Permissions API are used to create read, write, edit, update and manage // access for various users on different objects and endpoints. // @@ -665,19 +669,8 @@ type WorkspaceClient struct { // applied to each served entity. ServingEndpoints serving.ServingEndpointsInterface - // The default namespace setting API allows users to configure the default - // namespace for a Databricks workspace. - // - // Through this API, users can retrieve, set, or modify the default - // namespace used when queries do not reference a fully qualified - // three-level name. For example, if you use the API to set 'retail_prod' as - // the default catalog, then a query 'SELECT * FROM myTable' would reference - // the object 'retail_prod.default.myTable' (the schema 'default' is always - // assumed). - // - // This setting requires a restart of clusters and SQL warehouses to take - // effect. Additionally, the default namespace only applies when using Unity - // Catalog-enabled compute. + // Workspace Settings API allows users to manage settings at the workspace + // level. Settings settings.SettingsInterface // A share is a container instantiated with :method:shares/create. Once @@ -1002,6 +995,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { ModelRegistry: ml.NewModelRegistry(databricksClient), ModelVersions: catalog.NewModelVersions(databricksClient), OnlineTables: catalog.NewOnlineTables(databricksClient), + PermissionMigration: iam.NewPermissionMigration(databricksClient), Permissions: iam.NewPermissions(databricksClient), Pipelines: pipelines.NewPipelines(databricksClient), PolicyFamilies: compute.NewPolicyFamilies(databricksClient),