diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 9834ec958..3461bf684 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -3ae6f76120079424c8654263eafbc30ec0551854 \ No newline at end of file +6701524136501ef070774942ef5d6e01cfaafb88 \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 7627c02f7..ee0a72c57 100644 --- a/.gitattributes +++ b/.gitattributes @@ -26,6 +26,7 @@ experimental/mocks/service/catalog/mock_grants_interface.go linguist-generated=t experimental/mocks/service/catalog/mock_metastores_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_model_versions_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_online_tables_interface.go linguist-generated=true +experimental/mocks/service/catalog/mock_policies_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_quality_monitors_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_registered_models_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_resource_quotas_interface.go linguist-generated=true @@ -34,6 +35,7 @@ experimental/mocks/service/catalog/mock_storage_credentials_interface.go linguis experimental/mocks/service/catalog/mock_system_schemas_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_table_constraints_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_tables_interface.go linguist-generated=true +experimental/mocks/service/catalog/mock_temporary_path_credentials_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_temporary_table_credentials_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_volumes_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_workspace_bindings_interface.go linguist-generated=true @@ -253,6 +255,10 @@ service/settings/api.go linguist-generated=true service/settings/impl.go linguist-generated=true service/settings/interface.go linguist-generated=true service/settings/model.go linguist-generated=true +service/settingsv2/api.go linguist-generated=true +service/settingsv2/impl.go linguist-generated=true +service/settingsv2/interface.go linguist-generated=true +service/settingsv2/model.go linguist-generated=true service/sharing/api.go linguist-generated=true service/sharing/impl.go linguist-generated=true service/sharing/interface.go linguist-generated=true @@ -261,6 +267,10 @@ service/sql/api.go linguist-generated=true service/sql/impl.go linguist-generated=true service/sql/interface.go linguist-generated=true service/sql/model.go linguist-generated=true +service/tags/api.go linguist-generated=true +service/tags/impl.go linguist-generated=true +service/tags/interface.go linguist-generated=true +service/tags/model.go linguist-generated=true service/vectorsearch/api.go linguist-generated=true service/vectorsearch/impl.go linguist-generated=true service/vectorsearch/interface.go linguist-generated=true diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 346f90ade..5b0eb01ae 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -16,3 +16,23 @@ ### Internal Changes ### API Changes +* Added [settingsv2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settingsv2) and [tags](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/tags) packages. +* Added [w.AppsSettings](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#AppsSettingsAPI) workspace-level service. +* Added [w.EntityTagAssignments](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#EntityTagAssignmentsAPI) workspace-level service and [w.Rfa](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#RfaAPI) workspace-level service. +* Added [a.AccountSettingsV2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settingsv2#AccountSettingsV2API) account-level service and [w.WorkspaceSettingsV2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settingsv2#WorkspaceSettingsV2API) workspace-level service. +* Added [w.TagPolicies](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/tags#TagPoliciesAPI) workspace-level service. +* Added `DeleteConversationMessage`, `ListConversationMessages` and `SendMessageFeedback` methods for [w.Genie](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieAPI) workspace-level service. +* Added `IncludeAll` field for [dashboards.GenieListConversationsRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieListConversationsRequest). +* Added `EffectiveUsagePolicyId` field for [jobs.BaseJob](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#BaseJob). +* Added `EffectiveUsagePolicyId` field for [jobs.BaseRun](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#BaseRun). +* Added `EffectiveUsagePolicyId` field for [jobs.Job](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#Job). +* Added `EffectiveUsagePolicyId` field for [jobs.Run](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#Run). +* Added `Tokens` field for [serving.AiGatewayRateLimit](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/serving#AiGatewayRateLimit). +* Added `UsagePolicyId` field for [serving.ServingEndpoint](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/serving#ServingEndpoint). +* Added `EffectiveRunAs` and `RunAs` fields for [sql.AlertV2](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#AlertV2). +* Added `CacheQueryId` field for [sql.QueryInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#QueryInfo). +* Added `ModelEndpointNameForQuery` field for [vectorsearch.EmbeddingSourceColumn](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/vectorsearch#EmbeddingSourceColumn). +* [Breaking] Removed `EnvironmentSettings` field for [catalog.ConnectionInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ConnectionInfo). +* [Breaking] Removed `EnvironmentSettings` field for [catalog.CreateConnection](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#CreateConnection). +* [Breaking] Removed `EnvironmentSettings` field for [catalog.UpdateConnection](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#UpdateConnection). +* [Breaking] Removed `Comment`, `DisplayName` and `Tags` fields for [sharing.Share](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#Share). \ No newline at end of file diff --git a/account_client.go b/account_client.go index fa466e0f8..0d1552276 100755 --- a/account_client.go +++ b/account_client.go @@ -14,6 +14,7 @@ import ( "github.com/databricks/databricks-sdk-go/service/oauth2" "github.com/databricks/databricks-sdk-go/service/provisioning" "github.com/databricks/databricks-sdk-go/service/settings" + "github.com/databricks/databricks-sdk-go/service/settingsv2" ) type AccountClient struct { @@ -358,6 +359,9 @@ type AccountClient struct { // level. Settings settings.AccountSettingsInterface + // APIs to manage account level settings + SettingsV2 settingsv2.AccountSettingsV2Interface + // These APIs manage storage configurations for this workspace. A root // storage S3 bucket in your account is required to store objects like // cluster logs, notebook revisions, and job results. You can also use the @@ -469,6 +473,7 @@ func NewAccountClient(c ...*Config) (*AccountClient, error) { ServicePrincipalSecrets: oauth2.NewServicePrincipalSecrets(apiClient), ServicePrincipals: iam.NewAccountServicePrincipals(apiClient), Settings: settings.NewAccountSettings(apiClient), + SettingsV2: settingsv2.NewAccountSettingsV2(apiClient), Storage: provisioning.NewStorage(apiClient), StorageCredentials: catalog.NewAccountStorageCredentials(apiClient), UsageDashboards: billing.NewUsageDashboards(apiClient), diff --git a/experimental/mocks/mock_account_client.go b/experimental/mocks/mock_account_client.go index 543978a7b..1cac1ee39 100755 --- a/experimental/mocks/mock_account_client.go +++ b/experimental/mocks/mock_account_client.go @@ -14,6 +14,7 @@ import ( "github.com/databricks/databricks-sdk-go/experimental/mocks/service/oauth2" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/provisioning" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/settings" + "github.com/databricks/databricks-sdk-go/experimental/mocks/service/settingsv2" ) type MockAccountClient struct { @@ -53,6 +54,7 @@ func NewMockAccountClient(t interface { ServicePrincipalSecrets: oauth2.NewMockServicePrincipalSecretsInterface(t), ServicePrincipals: iam.NewMockAccountServicePrincipalsInterface(t), Settings: settings.NewMockAccountSettingsInterface(t), + SettingsV2: settingsv2.NewMockAccountSettingsV2Interface(t), Storage: provisioning.NewMockStorageInterface(t), StorageCredentials: catalog.NewMockAccountStorageCredentialsInterface(t), UsageDashboards: billing.NewMockUsageDashboardsInterface(t), @@ -330,6 +332,14 @@ func (m *MockAccountClient) GetMockAccountSettingsAPI() *settings.MockAccountSet return api } +func (m *MockAccountClient) GetMockAccountSettingsV2API() *settingsv2.MockAccountSettingsV2Interface { + api, ok := m.AccountClient.SettingsV2.(*settingsv2.MockAccountSettingsV2Interface) + if !ok { + panic(fmt.Sprintf("expected SettingsV2 to be *settingsv2.MockAccountSettingsV2Interface, actual was %T", m.AccountClient.SettingsV2)) + } + return api +} + func (m *MockAccountClient) GetMockStorageAPI() *provisioning.MockStorageInterface { api, ok := m.AccountClient.Storage.(*provisioning.MockStorageInterface) if !ok { diff --git a/experimental/mocks/mock_workspace_client.go b/experimental/mocks/mock_workspace_client.go index 874a0a27e..30738afc2 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -25,8 +25,10 @@ import ( "github.com/databricks/databricks-sdk-go/experimental/mocks/service/qualitymonitorv2" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/serving" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/settings" + "github.com/databricks/databricks-sdk-go/experimental/mocks/service/settingsv2" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/sharing" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/sql" + "github.com/databricks/databricks-sdk-go/experimental/mocks/service/tags" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/vectorsearch" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/workspace" ) @@ -52,6 +54,7 @@ func NewMockWorkspaceClient(t interface { AlertsLegacy: sql.NewMockAlertsLegacyInterface(t), AlertsV2: sql.NewMockAlertsV2Interface(t), Apps: apps.NewMockAppsInterface(t), + AppsSettings: apps.NewMockAppsSettingsInterface(t), ArtifactAllowlists: catalog.NewMockArtifactAllowlistsInterface(t), Catalogs: catalog.NewMockCatalogsInterface(t), CleanRoomAssetRevisions: cleanrooms.NewMockCleanRoomAssetRevisionsInterface(t), @@ -77,6 +80,7 @@ func NewMockWorkspaceClient(t interface { Database: database.NewMockDatabaseInterface(t), Dbfs: files.NewMockDbfsInterface(t), DbsqlPermissions: sql.NewMockDbsqlPermissionsInterface(t), + EntityTagAssignments: catalog.NewMockEntityTagAssignmentsInterface(t), Experiments: ml.NewMockExperimentsInterface(t), ExternalLineage: catalog.NewMockExternalLineageInterface(t), ExternalLocations: catalog.NewMockExternalLocationsInterface(t), @@ -132,6 +136,7 @@ func NewMockWorkspaceClient(t interface { RegisteredModels: catalog.NewMockRegisteredModelsInterface(t), Repos: workspace.NewMockReposInterface(t), ResourceQuotas: catalog.NewMockResourceQuotasInterface(t), + Rfa: catalog.NewMockRfaInterface(t), Schemas: catalog.NewMockSchemasInterface(t), Secrets: workspace.NewMockSecretsInterface(t), ServicePrincipalSecretsProxy: oauth2.NewMockServicePrincipalSecretsProxyInterface(t), @@ -145,6 +150,7 @@ func NewMockWorkspaceClient(t interface { SystemSchemas: catalog.NewMockSystemSchemasInterface(t), TableConstraints: catalog.NewMockTableConstraintsInterface(t), Tables: catalog.NewMockTablesInterface(t), + TagPolicies: tags.NewMockTagPoliciesInterface(t), TemporaryPathCredentials: catalog.NewMockTemporaryPathCredentialsInterface(t), TemporaryTableCredentials: catalog.NewMockTemporaryTableCredentialsInterface(t), TokenManagement: settings.NewMockTokenManagementInterface(t), @@ -157,6 +163,7 @@ func NewMockWorkspaceClient(t interface { Workspace: workspace.NewMockWorkspaceInterface(t), WorkspaceBindings: catalog.NewMockWorkspaceBindingsInterface(t), WorkspaceConf: settings.NewMockWorkspaceConfInterface(t), + WorkspaceSettingsV2: settingsv2.NewMockWorkspaceSettingsV2Interface(t), }, } @@ -397,6 +404,14 @@ func (m *MockWorkspaceClient) GetMockAppsAPI() *apps.MockAppsInterface { return api } +func (m *MockWorkspaceClient) GetMockAppsSettingsAPI() *apps.MockAppsSettingsInterface { + api, ok := m.WorkspaceClient.AppsSettings.(*apps.MockAppsSettingsInterface) + if !ok { + panic(fmt.Sprintf("expected AppsSettings to be *apps.MockAppsSettingsInterface, actual was %T", m.WorkspaceClient.AppsSettings)) + } + return api +} + func (m *MockWorkspaceClient) GetMockArtifactAllowlistsAPI() *catalog.MockArtifactAllowlistsInterface { api, ok := m.WorkspaceClient.ArtifactAllowlists.(*catalog.MockArtifactAllowlistsInterface) if !ok { @@ -597,6 +612,14 @@ func (m *MockWorkspaceClient) GetMockDbsqlPermissionsAPI() *sql.MockDbsqlPermiss return api } +func (m *MockWorkspaceClient) GetMockEntityTagAssignmentsAPI() *catalog.MockEntityTagAssignmentsInterface { + api, ok := m.WorkspaceClient.EntityTagAssignments.(*catalog.MockEntityTagAssignmentsInterface) + if !ok { + panic(fmt.Sprintf("expected EntityTagAssignments to be *catalog.MockEntityTagAssignmentsInterface, actual was %T", m.WorkspaceClient.EntityTagAssignments)) + } + return api +} + func (m *MockWorkspaceClient) GetMockExperimentsAPI() *ml.MockExperimentsInterface { api, ok := m.WorkspaceClient.Experiments.(*ml.MockExperimentsInterface) if !ok { @@ -1037,6 +1060,14 @@ func (m *MockWorkspaceClient) GetMockResourceQuotasAPI() *catalog.MockResourceQu return api } +func (m *MockWorkspaceClient) GetMockRfaAPI() *catalog.MockRfaInterface { + api, ok := m.WorkspaceClient.Rfa.(*catalog.MockRfaInterface) + if !ok { + panic(fmt.Sprintf("expected Rfa to be *catalog.MockRfaInterface, actual was %T", m.WorkspaceClient.Rfa)) + } + return api +} + func (m *MockWorkspaceClient) GetMockSchemasAPI() *catalog.MockSchemasInterface { api, ok := m.WorkspaceClient.Schemas.(*catalog.MockSchemasInterface) if !ok { @@ -1141,6 +1172,14 @@ func (m *MockWorkspaceClient) GetMockTablesAPI() *catalog.MockTablesInterface { return api } +func (m *MockWorkspaceClient) GetMockTagPoliciesAPI() *tags.MockTagPoliciesInterface { + api, ok := m.WorkspaceClient.TagPolicies.(*tags.MockTagPoliciesInterface) + if !ok { + panic(fmt.Sprintf("expected TagPolicies to be *tags.MockTagPoliciesInterface, actual was %T", m.WorkspaceClient.TagPolicies)) + } + return api +} + func (m *MockWorkspaceClient) GetMockTemporaryPathCredentialsAPI() *catalog.MockTemporaryPathCredentialsInterface { api, ok := m.WorkspaceClient.TemporaryPathCredentials.(*catalog.MockTemporaryPathCredentialsInterface) if !ok { @@ -1236,3 +1275,11 @@ func (m *MockWorkspaceClient) GetMockWorkspaceConfAPI() *settings.MockWorkspaceC } return api } + +func (m *MockWorkspaceClient) GetMockWorkspaceSettingsV2API() *settingsv2.MockWorkspaceSettingsV2Interface { + api, ok := m.WorkspaceClient.WorkspaceSettingsV2.(*settingsv2.MockWorkspaceSettingsV2Interface) + if !ok { + panic(fmt.Sprintf("expected WorkspaceSettingsV2 to be *settingsv2.MockWorkspaceSettingsV2Interface, actual was %T", m.WorkspaceClient.WorkspaceSettingsV2)) + } + return api +} diff --git a/experimental/mocks/service/apps/mock_apps_settings_interface.go b/experimental/mocks/service/apps/mock_apps_settings_interface.go new file mode 100644 index 000000000..257700f7f --- /dev/null +++ b/experimental/mocks/service/apps/mock_apps_settings_interface.go @@ -0,0 +1,384 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package apps + +import ( + context "context" + + apps "github.com/databricks/databricks-sdk-go/service/apps" + + listing "github.com/databricks/databricks-sdk-go/listing" + + mock "github.com/stretchr/testify/mock" +) + +// MockAppsSettingsInterface is an autogenerated mock type for the AppsSettingsInterface type +type MockAppsSettingsInterface struct { + mock.Mock +} + +type MockAppsSettingsInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAppsSettingsInterface) EXPECT() *MockAppsSettingsInterface_Expecter { + return &MockAppsSettingsInterface_Expecter{mock: &_m.Mock} +} + +// CreateCustomTemplate provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) CreateCustomTemplate(ctx context.Context, request apps.CreateCustomTemplateRequest) (*apps.CustomTemplate, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateCustomTemplate") + } + + var r0 *apps.CustomTemplate + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, apps.CreateCustomTemplateRequest) (*apps.CustomTemplate, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, apps.CreateCustomTemplateRequest) *apps.CustomTemplate); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*apps.CustomTemplate) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, apps.CreateCustomTemplateRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAppsSettingsInterface_CreateCustomTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateCustomTemplate' +type MockAppsSettingsInterface_CreateCustomTemplate_Call struct { + *mock.Call +} + +// CreateCustomTemplate is a helper method to define mock.On call +// - ctx context.Context +// - request apps.CreateCustomTemplateRequest +func (_e *MockAppsSettingsInterface_Expecter) CreateCustomTemplate(ctx interface{}, request interface{}) *MockAppsSettingsInterface_CreateCustomTemplate_Call { + return &MockAppsSettingsInterface_CreateCustomTemplate_Call{Call: _e.mock.On("CreateCustomTemplate", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_CreateCustomTemplate_Call) Run(run func(ctx context.Context, request apps.CreateCustomTemplateRequest)) *MockAppsSettingsInterface_CreateCustomTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.CreateCustomTemplateRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_CreateCustomTemplate_Call) Return(_a0 *apps.CustomTemplate, _a1 error) *MockAppsSettingsInterface_CreateCustomTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAppsSettingsInterface_CreateCustomTemplate_Call) RunAndReturn(run func(context.Context, apps.CreateCustomTemplateRequest) (*apps.CustomTemplate, error)) *MockAppsSettingsInterface_CreateCustomTemplate_Call { + _c.Call.Return(run) + return _c +} + +// DeleteCustomTemplate provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) DeleteCustomTemplate(ctx context.Context, request apps.DeleteCustomTemplateRequest) (*apps.CustomTemplate, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteCustomTemplate") + } + + var r0 *apps.CustomTemplate + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, apps.DeleteCustomTemplateRequest) (*apps.CustomTemplate, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, apps.DeleteCustomTemplateRequest) *apps.CustomTemplate); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*apps.CustomTemplate) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, apps.DeleteCustomTemplateRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAppsSettingsInterface_DeleteCustomTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteCustomTemplate' +type MockAppsSettingsInterface_DeleteCustomTemplate_Call struct { + *mock.Call +} + +// DeleteCustomTemplate is a helper method to define mock.On call +// - ctx context.Context +// - request apps.DeleteCustomTemplateRequest +func (_e *MockAppsSettingsInterface_Expecter) DeleteCustomTemplate(ctx interface{}, request interface{}) *MockAppsSettingsInterface_DeleteCustomTemplate_Call { + return &MockAppsSettingsInterface_DeleteCustomTemplate_Call{Call: _e.mock.On("DeleteCustomTemplate", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_DeleteCustomTemplate_Call) Run(run func(ctx context.Context, request apps.DeleteCustomTemplateRequest)) *MockAppsSettingsInterface_DeleteCustomTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.DeleteCustomTemplateRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_DeleteCustomTemplate_Call) Return(_a0 *apps.CustomTemplate, _a1 error) *MockAppsSettingsInterface_DeleteCustomTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAppsSettingsInterface_DeleteCustomTemplate_Call) RunAndReturn(run func(context.Context, apps.DeleteCustomTemplateRequest) (*apps.CustomTemplate, error)) *MockAppsSettingsInterface_DeleteCustomTemplate_Call { + _c.Call.Return(run) + return _c +} + +// GetCustomTemplate provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) GetCustomTemplate(ctx context.Context, request apps.GetCustomTemplateRequest) (*apps.CustomTemplate, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetCustomTemplate") + } + + var r0 *apps.CustomTemplate + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, apps.GetCustomTemplateRequest) (*apps.CustomTemplate, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, apps.GetCustomTemplateRequest) *apps.CustomTemplate); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*apps.CustomTemplate) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, apps.GetCustomTemplateRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAppsSettingsInterface_GetCustomTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCustomTemplate' +type MockAppsSettingsInterface_GetCustomTemplate_Call struct { + *mock.Call +} + +// GetCustomTemplate is a helper method to define mock.On call +// - ctx context.Context +// - request apps.GetCustomTemplateRequest +func (_e *MockAppsSettingsInterface_Expecter) GetCustomTemplate(ctx interface{}, request interface{}) *MockAppsSettingsInterface_GetCustomTemplate_Call { + return &MockAppsSettingsInterface_GetCustomTemplate_Call{Call: _e.mock.On("GetCustomTemplate", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_GetCustomTemplate_Call) Run(run func(ctx context.Context, request apps.GetCustomTemplateRequest)) *MockAppsSettingsInterface_GetCustomTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.GetCustomTemplateRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_GetCustomTemplate_Call) Return(_a0 *apps.CustomTemplate, _a1 error) *MockAppsSettingsInterface_GetCustomTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAppsSettingsInterface_GetCustomTemplate_Call) RunAndReturn(run func(context.Context, apps.GetCustomTemplateRequest) (*apps.CustomTemplate, error)) *MockAppsSettingsInterface_GetCustomTemplate_Call { + _c.Call.Return(run) + return _c +} + +// ListCustomTemplates provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) ListCustomTemplates(ctx context.Context, request apps.ListCustomTemplatesRequest) listing.Iterator[apps.CustomTemplate] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListCustomTemplates") + } + + var r0 listing.Iterator[apps.CustomTemplate] + if rf, ok := ret.Get(0).(func(context.Context, apps.ListCustomTemplatesRequest) listing.Iterator[apps.CustomTemplate]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[apps.CustomTemplate]) + } + } + + return r0 +} + +// MockAppsSettingsInterface_ListCustomTemplates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCustomTemplates' +type MockAppsSettingsInterface_ListCustomTemplates_Call struct { + *mock.Call +} + +// ListCustomTemplates is a helper method to define mock.On call +// - ctx context.Context +// - request apps.ListCustomTemplatesRequest +func (_e *MockAppsSettingsInterface_Expecter) ListCustomTemplates(ctx interface{}, request interface{}) *MockAppsSettingsInterface_ListCustomTemplates_Call { + return &MockAppsSettingsInterface_ListCustomTemplates_Call{Call: _e.mock.On("ListCustomTemplates", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplates_Call) Run(run func(ctx context.Context, request apps.ListCustomTemplatesRequest)) *MockAppsSettingsInterface_ListCustomTemplates_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.ListCustomTemplatesRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplates_Call) Return(_a0 listing.Iterator[apps.CustomTemplate]) *MockAppsSettingsInterface_ListCustomTemplates_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplates_Call) RunAndReturn(run func(context.Context, apps.ListCustomTemplatesRequest) listing.Iterator[apps.CustomTemplate]) *MockAppsSettingsInterface_ListCustomTemplates_Call { + _c.Call.Return(run) + return _c +} + +// ListCustomTemplatesAll provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) ListCustomTemplatesAll(ctx context.Context, request apps.ListCustomTemplatesRequest) ([]apps.CustomTemplate, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListCustomTemplatesAll") + } + + var r0 []apps.CustomTemplate + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, apps.ListCustomTemplatesRequest) ([]apps.CustomTemplate, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, apps.ListCustomTemplatesRequest) []apps.CustomTemplate); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]apps.CustomTemplate) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, apps.ListCustomTemplatesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAppsSettingsInterface_ListCustomTemplatesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCustomTemplatesAll' +type MockAppsSettingsInterface_ListCustomTemplatesAll_Call struct { + *mock.Call +} + +// ListCustomTemplatesAll is a helper method to define mock.On call +// - ctx context.Context +// - request apps.ListCustomTemplatesRequest +func (_e *MockAppsSettingsInterface_Expecter) ListCustomTemplatesAll(ctx interface{}, request interface{}) *MockAppsSettingsInterface_ListCustomTemplatesAll_Call { + return &MockAppsSettingsInterface_ListCustomTemplatesAll_Call{Call: _e.mock.On("ListCustomTemplatesAll", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplatesAll_Call) Run(run func(ctx context.Context, request apps.ListCustomTemplatesRequest)) *MockAppsSettingsInterface_ListCustomTemplatesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.ListCustomTemplatesRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplatesAll_Call) Return(_a0 []apps.CustomTemplate, _a1 error) *MockAppsSettingsInterface_ListCustomTemplatesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAppsSettingsInterface_ListCustomTemplatesAll_Call) RunAndReturn(run func(context.Context, apps.ListCustomTemplatesRequest) ([]apps.CustomTemplate, error)) *MockAppsSettingsInterface_ListCustomTemplatesAll_Call { + _c.Call.Return(run) + return _c +} + +// UpdateCustomTemplate provides a mock function with given fields: ctx, request +func (_m *MockAppsSettingsInterface) UpdateCustomTemplate(ctx context.Context, request apps.UpdateCustomTemplateRequest) (*apps.CustomTemplate, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateCustomTemplate") + } + + var r0 *apps.CustomTemplate + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, apps.UpdateCustomTemplateRequest) (*apps.CustomTemplate, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, apps.UpdateCustomTemplateRequest) *apps.CustomTemplate); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*apps.CustomTemplate) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, apps.UpdateCustomTemplateRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAppsSettingsInterface_UpdateCustomTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCustomTemplate' +type MockAppsSettingsInterface_UpdateCustomTemplate_Call struct { + *mock.Call +} + +// UpdateCustomTemplate is a helper method to define mock.On call +// - ctx context.Context +// - request apps.UpdateCustomTemplateRequest +func (_e *MockAppsSettingsInterface_Expecter) UpdateCustomTemplate(ctx interface{}, request interface{}) *MockAppsSettingsInterface_UpdateCustomTemplate_Call { + return &MockAppsSettingsInterface_UpdateCustomTemplate_Call{Call: _e.mock.On("UpdateCustomTemplate", ctx, request)} +} + +func (_c *MockAppsSettingsInterface_UpdateCustomTemplate_Call) Run(run func(ctx context.Context, request apps.UpdateCustomTemplateRequest)) *MockAppsSettingsInterface_UpdateCustomTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(apps.UpdateCustomTemplateRequest)) + }) + return _c +} + +func (_c *MockAppsSettingsInterface_UpdateCustomTemplate_Call) Return(_a0 *apps.CustomTemplate, _a1 error) *MockAppsSettingsInterface_UpdateCustomTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAppsSettingsInterface_UpdateCustomTemplate_Call) RunAndReturn(run func(context.Context, apps.UpdateCustomTemplateRequest) (*apps.CustomTemplate, error)) *MockAppsSettingsInterface_UpdateCustomTemplate_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAppsSettingsInterface creates a new instance of MockAppsSettingsInterface. 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 NewMockAppsSettingsInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAppsSettingsInterface { + mock := &MockAppsSettingsInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/catalog/mock_entity_tag_assignments_interface.go b/experimental/mocks/service/catalog/mock_entity_tag_assignments_interface.go new file mode 100644 index 000000000..ce084df78 --- /dev/null +++ b/experimental/mocks/service/catalog/mock_entity_tag_assignments_interface.go @@ -0,0 +1,372 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package catalog + +import ( + context "context" + + catalog "github.com/databricks/databricks-sdk-go/service/catalog" + + listing "github.com/databricks/databricks-sdk-go/listing" + + mock "github.com/stretchr/testify/mock" +) + +// MockEntityTagAssignmentsInterface is an autogenerated mock type for the EntityTagAssignmentsInterface type +type MockEntityTagAssignmentsInterface struct { + mock.Mock +} + +type MockEntityTagAssignmentsInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockEntityTagAssignmentsInterface) EXPECT() *MockEntityTagAssignmentsInterface_Expecter { + return &MockEntityTagAssignmentsInterface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) Create(ctx context.Context, request catalog.CreateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *catalog.EntityTagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.CreateEntityTagAssignmentRequest) *catalog.EntityTagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.EntityTagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.CreateEntityTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEntityTagAssignmentsInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockEntityTagAssignmentsInterface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.CreateEntityTagAssignmentRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) Create(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_Create_Call { + return &MockEntityTagAssignmentsInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_Create_Call) Run(run func(ctx context.Context, request catalog.CreateEntityTagAssignmentRequest)) *MockEntityTagAssignmentsInterface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.CreateEntityTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Create_Call) Return(_a0 *catalog.EntityTagAssignment, _a1 error) *MockEntityTagAssignmentsInterface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Create_Call) RunAndReturn(run func(context.Context, catalog.CreateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)) *MockEntityTagAssignmentsInterface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) Delete(ctx context.Context, request catalog.DeleteEntityTagAssignmentRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.DeleteEntityTagAssignmentRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockEntityTagAssignmentsInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockEntityTagAssignmentsInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.DeleteEntityTagAssignmentRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_Delete_Call { + return &MockEntityTagAssignmentsInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_Delete_Call) Run(run func(ctx context.Context, request catalog.DeleteEntityTagAssignmentRequest)) *MockEntityTagAssignmentsInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.DeleteEntityTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Delete_Call) Return(_a0 error) *MockEntityTagAssignmentsInterface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Delete_Call) RunAndReturn(run func(context.Context, catalog.DeleteEntityTagAssignmentRequest) error) *MockEntityTagAssignmentsInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) Get(ctx context.Context, request catalog.GetEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *catalog.EntityTagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetEntityTagAssignmentRequest) *catalog.EntityTagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.EntityTagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.GetEntityTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEntityTagAssignmentsInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockEntityTagAssignmentsInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.GetEntityTagAssignmentRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) Get(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_Get_Call { + return &MockEntityTagAssignmentsInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_Get_Call) Run(run func(ctx context.Context, request catalog.GetEntityTagAssignmentRequest)) *MockEntityTagAssignmentsInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.GetEntityTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Get_Call) Return(_a0 *catalog.EntityTagAssignment, _a1 error) *MockEntityTagAssignmentsInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Get_Call) RunAndReturn(run func(context.Context, catalog.GetEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)) *MockEntityTagAssignmentsInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) List(ctx context.Context, request catalog.ListEntityTagAssignmentsRequest) listing.Iterator[catalog.EntityTagAssignment] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[catalog.EntityTagAssignment] + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListEntityTagAssignmentsRequest) listing.Iterator[catalog.EntityTagAssignment]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[catalog.EntityTagAssignment]) + } + } + + return r0 +} + +// MockEntityTagAssignmentsInterface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockEntityTagAssignmentsInterface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.ListEntityTagAssignmentsRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) List(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_List_Call { + return &MockEntityTagAssignmentsInterface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_List_Call) Run(run func(ctx context.Context, request catalog.ListEntityTagAssignmentsRequest)) *MockEntityTagAssignmentsInterface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.ListEntityTagAssignmentsRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_List_Call) Return(_a0 listing.Iterator[catalog.EntityTagAssignment]) *MockEntityTagAssignmentsInterface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_List_Call) RunAndReturn(run func(context.Context, catalog.ListEntityTagAssignmentsRequest) listing.Iterator[catalog.EntityTagAssignment]) *MockEntityTagAssignmentsInterface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) ListAll(ctx context.Context, request catalog.ListEntityTagAssignmentsRequest) ([]catalog.EntityTagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []catalog.EntityTagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListEntityTagAssignmentsRequest) ([]catalog.EntityTagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.ListEntityTagAssignmentsRequest) []catalog.EntityTagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]catalog.EntityTagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.ListEntityTagAssignmentsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEntityTagAssignmentsInterface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockEntityTagAssignmentsInterface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.ListEntityTagAssignmentsRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) ListAll(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_ListAll_Call { + return &MockEntityTagAssignmentsInterface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_ListAll_Call) Run(run func(ctx context.Context, request catalog.ListEntityTagAssignmentsRequest)) *MockEntityTagAssignmentsInterface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.ListEntityTagAssignmentsRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_ListAll_Call) Return(_a0 []catalog.EntityTagAssignment, _a1 error) *MockEntityTagAssignmentsInterface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_ListAll_Call) RunAndReturn(run func(context.Context, catalog.ListEntityTagAssignmentsRequest) ([]catalog.EntityTagAssignment, error)) *MockEntityTagAssignmentsInterface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockEntityTagAssignmentsInterface) Update(ctx context.Context, request catalog.UpdateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *catalog.EntityTagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateEntityTagAssignmentRequest) *catalog.EntityTagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.EntityTagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.UpdateEntityTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEntityTagAssignmentsInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockEntityTagAssignmentsInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.UpdateEntityTagAssignmentRequest +func (_e *MockEntityTagAssignmentsInterface_Expecter) Update(ctx interface{}, request interface{}) *MockEntityTagAssignmentsInterface_Update_Call { + return &MockEntityTagAssignmentsInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockEntityTagAssignmentsInterface_Update_Call) Run(run func(ctx context.Context, request catalog.UpdateEntityTagAssignmentRequest)) *MockEntityTagAssignmentsInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.UpdateEntityTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Update_Call) Return(_a0 *catalog.EntityTagAssignment, _a1 error) *MockEntityTagAssignmentsInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEntityTagAssignmentsInterface_Update_Call) RunAndReturn(run func(context.Context, catalog.UpdateEntityTagAssignmentRequest) (*catalog.EntityTagAssignment, error)) *MockEntityTagAssignmentsInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockEntityTagAssignmentsInterface creates a new instance of MockEntityTagAssignmentsInterface. 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 NewMockEntityTagAssignmentsInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockEntityTagAssignmentsInterface { + mock := &MockEntityTagAssignmentsInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/catalog/mock_rfa_interface.go b/experimental/mocks/service/catalog/mock_rfa_interface.go new file mode 100644 index 000000000..aef5a79f9 --- /dev/null +++ b/experimental/mocks/service/catalog/mock_rfa_interface.go @@ -0,0 +1,215 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package catalog + +import ( + context "context" + + catalog "github.com/databricks/databricks-sdk-go/service/catalog" + + mock "github.com/stretchr/testify/mock" +) + +// MockRfaInterface is an autogenerated mock type for the RfaInterface type +type MockRfaInterface struct { + mock.Mock +} + +type MockRfaInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockRfaInterface) EXPECT() *MockRfaInterface_Expecter { + return &MockRfaInterface_Expecter{mock: &_m.Mock} +} + +// BatchCreateAccessRequests provides a mock function with given fields: ctx, request +func (_m *MockRfaInterface) BatchCreateAccessRequests(ctx context.Context, request catalog.BatchCreateAccessRequestsRequest) (*catalog.BatchCreateAccessRequestsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for BatchCreateAccessRequests") + } + + var r0 *catalog.BatchCreateAccessRequestsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.BatchCreateAccessRequestsRequest) (*catalog.BatchCreateAccessRequestsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.BatchCreateAccessRequestsRequest) *catalog.BatchCreateAccessRequestsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.BatchCreateAccessRequestsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.BatchCreateAccessRequestsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRfaInterface_BatchCreateAccessRequests_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchCreateAccessRequests' +type MockRfaInterface_BatchCreateAccessRequests_Call struct { + *mock.Call +} + +// BatchCreateAccessRequests is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.BatchCreateAccessRequestsRequest +func (_e *MockRfaInterface_Expecter) BatchCreateAccessRequests(ctx interface{}, request interface{}) *MockRfaInterface_BatchCreateAccessRequests_Call { + return &MockRfaInterface_BatchCreateAccessRequests_Call{Call: _e.mock.On("BatchCreateAccessRequests", ctx, request)} +} + +func (_c *MockRfaInterface_BatchCreateAccessRequests_Call) Run(run func(ctx context.Context, request catalog.BatchCreateAccessRequestsRequest)) *MockRfaInterface_BatchCreateAccessRequests_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.BatchCreateAccessRequestsRequest)) + }) + return _c +} + +func (_c *MockRfaInterface_BatchCreateAccessRequests_Call) Return(_a0 *catalog.BatchCreateAccessRequestsResponse, _a1 error) *MockRfaInterface_BatchCreateAccessRequests_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRfaInterface_BatchCreateAccessRequests_Call) RunAndReturn(run func(context.Context, catalog.BatchCreateAccessRequestsRequest) (*catalog.BatchCreateAccessRequestsResponse, error)) *MockRfaInterface_BatchCreateAccessRequests_Call { + _c.Call.Return(run) + return _c +} + +// GetAccessRequestDestinations provides a mock function with given fields: ctx, request +func (_m *MockRfaInterface) GetAccessRequestDestinations(ctx context.Context, request catalog.GetAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetAccessRequestDestinations") + } + + var r0 *catalog.AccessRequestDestinations + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.GetAccessRequestDestinationsRequest) *catalog.AccessRequestDestinations); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.AccessRequestDestinations) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.GetAccessRequestDestinationsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRfaInterface_GetAccessRequestDestinations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAccessRequestDestinations' +type MockRfaInterface_GetAccessRequestDestinations_Call struct { + *mock.Call +} + +// GetAccessRequestDestinations is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.GetAccessRequestDestinationsRequest +func (_e *MockRfaInterface_Expecter) GetAccessRequestDestinations(ctx interface{}, request interface{}) *MockRfaInterface_GetAccessRequestDestinations_Call { + return &MockRfaInterface_GetAccessRequestDestinations_Call{Call: _e.mock.On("GetAccessRequestDestinations", ctx, request)} +} + +func (_c *MockRfaInterface_GetAccessRequestDestinations_Call) Run(run func(ctx context.Context, request catalog.GetAccessRequestDestinationsRequest)) *MockRfaInterface_GetAccessRequestDestinations_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.GetAccessRequestDestinationsRequest)) + }) + return _c +} + +func (_c *MockRfaInterface_GetAccessRequestDestinations_Call) Return(_a0 *catalog.AccessRequestDestinations, _a1 error) *MockRfaInterface_GetAccessRequestDestinations_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRfaInterface_GetAccessRequestDestinations_Call) RunAndReturn(run func(context.Context, catalog.GetAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error)) *MockRfaInterface_GetAccessRequestDestinations_Call { + _c.Call.Return(run) + return _c +} + +// UpdateAccessRequestDestinations provides a mock function with given fields: ctx, request +func (_m *MockRfaInterface) UpdateAccessRequestDestinations(ctx context.Context, request catalog.UpdateAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateAccessRequestDestinations") + } + + var r0 *catalog.AccessRequestDestinations + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, catalog.UpdateAccessRequestDestinationsRequest) *catalog.AccessRequestDestinations); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*catalog.AccessRequestDestinations) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, catalog.UpdateAccessRequestDestinationsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRfaInterface_UpdateAccessRequestDestinations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAccessRequestDestinations' +type MockRfaInterface_UpdateAccessRequestDestinations_Call struct { + *mock.Call +} + +// UpdateAccessRequestDestinations is a helper method to define mock.On call +// - ctx context.Context +// - request catalog.UpdateAccessRequestDestinationsRequest +func (_e *MockRfaInterface_Expecter) UpdateAccessRequestDestinations(ctx interface{}, request interface{}) *MockRfaInterface_UpdateAccessRequestDestinations_Call { + return &MockRfaInterface_UpdateAccessRequestDestinations_Call{Call: _e.mock.On("UpdateAccessRequestDestinations", ctx, request)} +} + +func (_c *MockRfaInterface_UpdateAccessRequestDestinations_Call) Run(run func(ctx context.Context, request catalog.UpdateAccessRequestDestinationsRequest)) *MockRfaInterface_UpdateAccessRequestDestinations_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(catalog.UpdateAccessRequestDestinationsRequest)) + }) + return _c +} + +func (_c *MockRfaInterface_UpdateAccessRequestDestinations_Call) Return(_a0 *catalog.AccessRequestDestinations, _a1 error) *MockRfaInterface_UpdateAccessRequestDestinations_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRfaInterface_UpdateAccessRequestDestinations_Call) RunAndReturn(run func(context.Context, catalog.UpdateAccessRequestDestinationsRequest) (*catalog.AccessRequestDestinations, error)) *MockRfaInterface_UpdateAccessRequestDestinations_Call { + _c.Call.Return(run) + return _c +} + +// NewMockRfaInterface creates a new instance of MockRfaInterface. 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 NewMockRfaInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRfaInterface { + mock := &MockRfaInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/dashboards/mock_genie_interface.go b/experimental/mocks/service/dashboards/mock_genie_interface.go index 19af714a6..513cfb0a6 100644 --- a/experimental/mocks/service/dashboards/mock_genie_interface.go +++ b/experimental/mocks/service/dashboards/mock_genie_interface.go @@ -254,6 +254,53 @@ func (_c *MockGenieInterface_DeleteConversationBySpaceIdAndConversationId_Call) return _c } +// DeleteConversationMessage provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) DeleteConversationMessage(ctx context.Context, request dashboards.GenieDeleteConversationMessageRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteConversationMessage") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieDeleteConversationMessageRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockGenieInterface_DeleteConversationMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteConversationMessage' +type MockGenieInterface_DeleteConversationMessage_Call struct { + *mock.Call +} + +// DeleteConversationMessage is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieDeleteConversationMessageRequest +func (_e *MockGenieInterface_Expecter) DeleteConversationMessage(ctx interface{}, request interface{}) *MockGenieInterface_DeleteConversationMessage_Call { + return &MockGenieInterface_DeleteConversationMessage_Call{Call: _e.mock.On("DeleteConversationMessage", ctx, request)} +} + +func (_c *MockGenieInterface_DeleteConversationMessage_Call) Run(run func(ctx context.Context, request dashboards.GenieDeleteConversationMessageRequest)) *MockGenieInterface_DeleteConversationMessage_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieDeleteConversationMessageRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_DeleteConversationMessage_Call) Return(_a0 error) *MockGenieInterface_DeleteConversationMessage_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockGenieInterface_DeleteConversationMessage_Call) RunAndReturn(run func(context.Context, dashboards.GenieDeleteConversationMessageRequest) error) *MockGenieInterface_DeleteConversationMessage_Call { + _c.Call.Return(run) + return _c +} + // ExecuteMessageAttachmentQuery provides a mock function with given fields: ctx, request func (_m *MockGenieInterface) ExecuteMessageAttachmentQuery(ctx context.Context, request dashboards.GenieExecuteMessageAttachmentQueryRequest) (*dashboards.GenieGetMessageQueryResultResponse, error) { ret := _m.Called(ctx, request) @@ -972,6 +1019,65 @@ func (_c *MockGenieInterface_GetSpaceBySpaceId_Call) RunAndReturn(run func(conte return _c } +// ListConversationMessages provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) ListConversationMessages(ctx context.Context, request dashboards.GenieListConversationMessagesRequest) (*dashboards.GenieListConversationMessagesResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListConversationMessages") + } + + var r0 *dashboards.GenieListConversationMessagesResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieListConversationMessagesRequest) (*dashboards.GenieListConversationMessagesResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieListConversationMessagesRequest) *dashboards.GenieListConversationMessagesResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieListConversationMessagesResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GenieListConversationMessagesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_ListConversationMessages_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListConversationMessages' +type MockGenieInterface_ListConversationMessages_Call struct { + *mock.Call +} + +// ListConversationMessages is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieListConversationMessagesRequest +func (_e *MockGenieInterface_Expecter) ListConversationMessages(ctx interface{}, request interface{}) *MockGenieInterface_ListConversationMessages_Call { + return &MockGenieInterface_ListConversationMessages_Call{Call: _e.mock.On("ListConversationMessages", ctx, request)} +} + +func (_c *MockGenieInterface_ListConversationMessages_Call) Run(run func(ctx context.Context, request dashboards.GenieListConversationMessagesRequest)) *MockGenieInterface_ListConversationMessages_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieListConversationMessagesRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_ListConversationMessages_Call) Return(_a0 *dashboards.GenieListConversationMessagesResponse, _a1 error) *MockGenieInterface_ListConversationMessages_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_ListConversationMessages_Call) RunAndReturn(run func(context.Context, dashboards.GenieListConversationMessagesRequest) (*dashboards.GenieListConversationMessagesResponse, error)) *MockGenieInterface_ListConversationMessages_Call { + _c.Call.Return(run) + return _c +} + // ListConversations provides a mock function with given fields: ctx, request func (_m *MockGenieInterface) ListConversations(ctx context.Context, request dashboards.GenieListConversationsRequest) (*dashboards.GenieListConversationsResponse, error) { ret := _m.Called(ctx, request) @@ -1149,6 +1255,53 @@ func (_c *MockGenieInterface_ListSpaces_Call) RunAndReturn(run func(context.Cont return _c } +// SendMessageFeedback provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) SendMessageFeedback(ctx context.Context, request dashboards.GenieSendMessageFeedbackRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for SendMessageFeedback") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieSendMessageFeedbackRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockGenieInterface_SendMessageFeedback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendMessageFeedback' +type MockGenieInterface_SendMessageFeedback_Call struct { + *mock.Call +} + +// SendMessageFeedback is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieSendMessageFeedbackRequest +func (_e *MockGenieInterface_Expecter) SendMessageFeedback(ctx interface{}, request interface{}) *MockGenieInterface_SendMessageFeedback_Call { + return &MockGenieInterface_SendMessageFeedback_Call{Call: _e.mock.On("SendMessageFeedback", ctx, request)} +} + +func (_c *MockGenieInterface_SendMessageFeedback_Call) Run(run func(ctx context.Context, request dashboards.GenieSendMessageFeedbackRequest)) *MockGenieInterface_SendMessageFeedback_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieSendMessageFeedbackRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_SendMessageFeedback_Call) Return(_a0 error) *MockGenieInterface_SendMessageFeedback_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockGenieInterface_SendMessageFeedback_Call) RunAndReturn(run func(context.Context, dashboards.GenieSendMessageFeedbackRequest) error) *MockGenieInterface_SendMessageFeedback_Call { + _c.Call.Return(run) + return _c +} + // StartConversation provides a mock function with given fields: ctx, genieStartConversationMessageRequest func (_m *MockGenieInterface) StartConversation(ctx context.Context, genieStartConversationMessageRequest dashboards.GenieStartConversationMessageRequest) (*dashboards.WaitGetMessageGenieCompleted[dashboards.GenieStartConversationResponse], error) { ret := _m.Called(ctx, genieStartConversationMessageRequest) diff --git a/experimental/mocks/service/settingsv2/mock_account_settings_v2_interface.go b/experimental/mocks/service/settingsv2/mock_account_settings_v2_interface.go new file mode 100644 index 000000000..1ad1f0238 --- /dev/null +++ b/experimental/mocks/service/settingsv2/mock_account_settings_v2_interface.go @@ -0,0 +1,265 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package settingsv2 + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + settingsv2 "github.com/databricks/databricks-sdk-go/service/settingsv2" +) + +// MockAccountSettingsV2Interface is an autogenerated mock type for the AccountSettingsV2Interface type +type MockAccountSettingsV2Interface struct { + mock.Mock +} + +type MockAccountSettingsV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAccountSettingsV2Interface) EXPECT() *MockAccountSettingsV2Interface_Expecter { + return &MockAccountSettingsV2Interface_Expecter{mock: &_m.Mock} +} + +// GetPublicAccountSetting provides a mock function with given fields: ctx, request +func (_m *MockAccountSettingsV2Interface) GetPublicAccountSetting(ctx context.Context, request settingsv2.GetPublicAccountSettingRequest) (*settingsv2.Setting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetPublicAccountSetting") + } + + var r0 *settingsv2.Setting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.GetPublicAccountSettingRequest) (*settingsv2.Setting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.GetPublicAccountSettingRequest) *settingsv2.Setting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settingsv2.Setting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.GetPublicAccountSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountSettingsV2Interface_GetPublicAccountSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublicAccountSetting' +type MockAccountSettingsV2Interface_GetPublicAccountSetting_Call struct { + *mock.Call +} + +// GetPublicAccountSetting is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.GetPublicAccountSettingRequest +func (_e *MockAccountSettingsV2Interface_Expecter) GetPublicAccountSetting(ctx interface{}, request interface{}) *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call { + return &MockAccountSettingsV2Interface_GetPublicAccountSetting_Call{Call: _e.mock.On("GetPublicAccountSetting", ctx, request)} +} + +func (_c *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call) Run(run func(ctx context.Context, request settingsv2.GetPublicAccountSettingRequest)) *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.GetPublicAccountSettingRequest)) + }) + return _c +} + +func (_c *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call) Return(_a0 *settingsv2.Setting, _a1 error) *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call) RunAndReturn(run func(context.Context, settingsv2.GetPublicAccountSettingRequest) (*settingsv2.Setting, error)) *MockAccountSettingsV2Interface_GetPublicAccountSetting_Call { + _c.Call.Return(run) + return _c +} + +// ListAccountSettingsMetadata provides a mock function with given fields: ctx, request +func (_m *MockAccountSettingsV2Interface) ListAccountSettingsMetadata(ctx context.Context, request settingsv2.ListAccountSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAccountSettingsMetadata") + } + + var r0 listing.Iterator[settingsv2.SettingsMetadata] + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[settingsv2.SettingsMetadata]) + } + } + + return r0 +} + +// MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAccountSettingsMetadata' +type MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call struct { + *mock.Call +} + +// ListAccountSettingsMetadata is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.ListAccountSettingsMetadataRequest +func (_e *MockAccountSettingsV2Interface_Expecter) ListAccountSettingsMetadata(ctx interface{}, request interface{}) *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call { + return &MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call{Call: _e.mock.On("ListAccountSettingsMetadata", ctx, request)} +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call) Run(run func(ctx context.Context, request settingsv2.ListAccountSettingsMetadataRequest)) *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.ListAccountSettingsMetadataRequest)) + }) + return _c +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call) Return(_a0 listing.Iterator[settingsv2.SettingsMetadata]) *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call) RunAndReturn(run func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata]) *MockAccountSettingsV2Interface_ListAccountSettingsMetadata_Call { + _c.Call.Return(run) + return _c +} + +// ListAccountSettingsMetadataAll provides a mock function with given fields: ctx, request +func (_m *MockAccountSettingsV2Interface) ListAccountSettingsMetadataAll(ctx context.Context, request settingsv2.ListAccountSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAccountSettingsMetadataAll") + } + + var r0 []settingsv2.SettingsMetadata + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) []settingsv2.SettingsMetadata); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]settingsv2.SettingsMetadata) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAccountSettingsMetadataAll' +type MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call struct { + *mock.Call +} + +// ListAccountSettingsMetadataAll is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.ListAccountSettingsMetadataRequest +func (_e *MockAccountSettingsV2Interface_Expecter) ListAccountSettingsMetadataAll(ctx interface{}, request interface{}) *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call { + return &MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call{Call: _e.mock.On("ListAccountSettingsMetadataAll", ctx, request)} +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call) Run(run func(ctx context.Context, request settingsv2.ListAccountSettingsMetadataRequest)) *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.ListAccountSettingsMetadataRequest)) + }) + return _c +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call) Return(_a0 []settingsv2.SettingsMetadata, _a1 error) *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call) RunAndReturn(run func(context.Context, settingsv2.ListAccountSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error)) *MockAccountSettingsV2Interface_ListAccountSettingsMetadataAll_Call { + _c.Call.Return(run) + return _c +} + +// PatchPublicAccountSetting provides a mock function with given fields: ctx, request +func (_m *MockAccountSettingsV2Interface) PatchPublicAccountSetting(ctx context.Context, request settingsv2.PatchPublicAccountSettingRequest) (*settingsv2.Setting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for PatchPublicAccountSetting") + } + + var r0 *settingsv2.Setting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.PatchPublicAccountSettingRequest) (*settingsv2.Setting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.PatchPublicAccountSettingRequest) *settingsv2.Setting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settingsv2.Setting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.PatchPublicAccountSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PatchPublicAccountSetting' +type MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call struct { + *mock.Call +} + +// PatchPublicAccountSetting is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.PatchPublicAccountSettingRequest +func (_e *MockAccountSettingsV2Interface_Expecter) PatchPublicAccountSetting(ctx interface{}, request interface{}) *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call { + return &MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call{Call: _e.mock.On("PatchPublicAccountSetting", ctx, request)} +} + +func (_c *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call) Run(run func(ctx context.Context, request settingsv2.PatchPublicAccountSettingRequest)) *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.PatchPublicAccountSettingRequest)) + }) + return _c +} + +func (_c *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call) Return(_a0 *settingsv2.Setting, _a1 error) *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call) RunAndReturn(run func(context.Context, settingsv2.PatchPublicAccountSettingRequest) (*settingsv2.Setting, error)) *MockAccountSettingsV2Interface_PatchPublicAccountSetting_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAccountSettingsV2Interface creates a new instance of MockAccountSettingsV2Interface. 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 NewMockAccountSettingsV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAccountSettingsV2Interface { + mock := &MockAccountSettingsV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/settingsv2/mock_workspace_settings_v2_interface.go b/experimental/mocks/service/settingsv2/mock_workspace_settings_v2_interface.go new file mode 100644 index 000000000..f9bce80ec --- /dev/null +++ b/experimental/mocks/service/settingsv2/mock_workspace_settings_v2_interface.go @@ -0,0 +1,265 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package settingsv2 + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + settingsv2 "github.com/databricks/databricks-sdk-go/service/settingsv2" +) + +// MockWorkspaceSettingsV2Interface is an autogenerated mock type for the WorkspaceSettingsV2Interface type +type MockWorkspaceSettingsV2Interface struct { + mock.Mock +} + +type MockWorkspaceSettingsV2Interface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockWorkspaceSettingsV2Interface) EXPECT() *MockWorkspaceSettingsV2Interface_Expecter { + return &MockWorkspaceSettingsV2Interface_Expecter{mock: &_m.Mock} +} + +// GetPublicWorkspaceSetting provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceSettingsV2Interface) GetPublicWorkspaceSetting(ctx context.Context, request settingsv2.GetPublicWorkspaceSettingRequest) (*settingsv2.Setting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetPublicWorkspaceSetting") + } + + var r0 *settingsv2.Setting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.GetPublicWorkspaceSettingRequest) (*settingsv2.Setting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.GetPublicWorkspaceSettingRequest) *settingsv2.Setting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settingsv2.Setting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.GetPublicWorkspaceSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublicWorkspaceSetting' +type MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call struct { + *mock.Call +} + +// GetPublicWorkspaceSetting is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.GetPublicWorkspaceSettingRequest +func (_e *MockWorkspaceSettingsV2Interface_Expecter) GetPublicWorkspaceSetting(ctx interface{}, request interface{}) *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call { + return &MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call{Call: _e.mock.On("GetPublicWorkspaceSetting", ctx, request)} +} + +func (_c *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call) Run(run func(ctx context.Context, request settingsv2.GetPublicWorkspaceSettingRequest)) *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.GetPublicWorkspaceSettingRequest)) + }) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call) Return(_a0 *settingsv2.Setting, _a1 error) *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call) RunAndReturn(run func(context.Context, settingsv2.GetPublicWorkspaceSettingRequest) (*settingsv2.Setting, error)) *MockWorkspaceSettingsV2Interface_GetPublicWorkspaceSetting_Call { + _c.Call.Return(run) + return _c +} + +// ListWorkspaceSettingsMetadata provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceSettingsV2Interface) ListWorkspaceSettingsMetadata(ctx context.Context, request settingsv2.ListWorkspaceSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListWorkspaceSettingsMetadata") + } + + var r0 listing.Iterator[settingsv2.SettingsMetadata] + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[settingsv2.SettingsMetadata]) + } + } + + return r0 +} + +// MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspaceSettingsMetadata' +type MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call struct { + *mock.Call +} + +// ListWorkspaceSettingsMetadata is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.ListWorkspaceSettingsMetadataRequest +func (_e *MockWorkspaceSettingsV2Interface_Expecter) ListWorkspaceSettingsMetadata(ctx interface{}, request interface{}) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call { + return &MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call{Call: _e.mock.On("ListWorkspaceSettingsMetadata", ctx, request)} +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call) Run(run func(ctx context.Context, request settingsv2.ListWorkspaceSettingsMetadataRequest)) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.ListWorkspaceSettingsMetadataRequest)) + }) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call) Return(_a0 listing.Iterator[settingsv2.SettingsMetadata]) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call) RunAndReturn(run func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) listing.Iterator[settingsv2.SettingsMetadata]) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadata_Call { + _c.Call.Return(run) + return _c +} + +// ListWorkspaceSettingsMetadataAll provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceSettingsV2Interface) ListWorkspaceSettingsMetadataAll(ctx context.Context, request settingsv2.ListWorkspaceSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListWorkspaceSettingsMetadataAll") + } + + var r0 []settingsv2.SettingsMetadata + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) []settingsv2.SettingsMetadata); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]settingsv2.SettingsMetadata) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspaceSettingsMetadataAll' +type MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call struct { + *mock.Call +} + +// ListWorkspaceSettingsMetadataAll is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.ListWorkspaceSettingsMetadataRequest +func (_e *MockWorkspaceSettingsV2Interface_Expecter) ListWorkspaceSettingsMetadataAll(ctx interface{}, request interface{}) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call { + return &MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call{Call: _e.mock.On("ListWorkspaceSettingsMetadataAll", ctx, request)} +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call) Run(run func(ctx context.Context, request settingsv2.ListWorkspaceSettingsMetadataRequest)) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.ListWorkspaceSettingsMetadataRequest)) + }) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call) Return(_a0 []settingsv2.SettingsMetadata, _a1 error) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call) RunAndReturn(run func(context.Context, settingsv2.ListWorkspaceSettingsMetadataRequest) ([]settingsv2.SettingsMetadata, error)) *MockWorkspaceSettingsV2Interface_ListWorkspaceSettingsMetadataAll_Call { + _c.Call.Return(run) + return _c +} + +// PatchPublicWorkspaceSetting provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceSettingsV2Interface) PatchPublicWorkspaceSetting(ctx context.Context, request settingsv2.PatchPublicWorkspaceSettingRequest) (*settingsv2.Setting, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for PatchPublicWorkspaceSetting") + } + + var r0 *settingsv2.Setting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.PatchPublicWorkspaceSettingRequest) (*settingsv2.Setting, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settingsv2.PatchPublicWorkspaceSettingRequest) *settingsv2.Setting); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settingsv2.Setting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settingsv2.PatchPublicWorkspaceSettingRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PatchPublicWorkspaceSetting' +type MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call struct { + *mock.Call +} + +// PatchPublicWorkspaceSetting is a helper method to define mock.On call +// - ctx context.Context +// - request settingsv2.PatchPublicWorkspaceSettingRequest +func (_e *MockWorkspaceSettingsV2Interface_Expecter) PatchPublicWorkspaceSetting(ctx interface{}, request interface{}) *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call { + return &MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call{Call: _e.mock.On("PatchPublicWorkspaceSetting", ctx, request)} +} + +func (_c *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call) Run(run func(ctx context.Context, request settingsv2.PatchPublicWorkspaceSettingRequest)) *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settingsv2.PatchPublicWorkspaceSettingRequest)) + }) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call) Return(_a0 *settingsv2.Setting, _a1 error) *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call) RunAndReturn(run func(context.Context, settingsv2.PatchPublicWorkspaceSettingRequest) (*settingsv2.Setting, error)) *MockWorkspaceSettingsV2Interface_PatchPublicWorkspaceSetting_Call { + _c.Call.Return(run) + return _c +} + +// NewMockWorkspaceSettingsV2Interface creates a new instance of MockWorkspaceSettingsV2Interface. 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 NewMockWorkspaceSettingsV2Interface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockWorkspaceSettingsV2Interface { + mock := &MockWorkspaceSettingsV2Interface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/tags/mock_tag_policies_interface.go b/experimental/mocks/service/tags/mock_tag_policies_interface.go new file mode 100644 index 000000000..22f1731fc --- /dev/null +++ b/experimental/mocks/service/tags/mock_tag_policies_interface.go @@ -0,0 +1,371 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package tags + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + tags "github.com/databricks/databricks-sdk-go/service/tags" +) + +// MockTagPoliciesInterface is an autogenerated mock type for the TagPoliciesInterface type +type MockTagPoliciesInterface struct { + mock.Mock +} + +type MockTagPoliciesInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockTagPoliciesInterface) EXPECT() *MockTagPoliciesInterface_Expecter { + return &MockTagPoliciesInterface_Expecter{mock: &_m.Mock} +} + +// CreateTagPolicy provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) CreateTagPolicy(ctx context.Context, request tags.CreateTagPolicyRequest) (*tags.TagPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateTagPolicy") + } + + var r0 *tags.TagPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.CreateTagPolicyRequest) (*tags.TagPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.CreateTagPolicyRequest) *tags.TagPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.CreateTagPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagPoliciesInterface_CreateTagPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateTagPolicy' +type MockTagPoliciesInterface_CreateTagPolicy_Call struct { + *mock.Call +} + +// CreateTagPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request tags.CreateTagPolicyRequest +func (_e *MockTagPoliciesInterface_Expecter) CreateTagPolicy(ctx interface{}, request interface{}) *MockTagPoliciesInterface_CreateTagPolicy_Call { + return &MockTagPoliciesInterface_CreateTagPolicy_Call{Call: _e.mock.On("CreateTagPolicy", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_CreateTagPolicy_Call) Run(run func(ctx context.Context, request tags.CreateTagPolicyRequest)) *MockTagPoliciesInterface_CreateTagPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.CreateTagPolicyRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_CreateTagPolicy_Call) Return(_a0 *tags.TagPolicy, _a1 error) *MockTagPoliciesInterface_CreateTagPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagPoliciesInterface_CreateTagPolicy_Call) RunAndReturn(run func(context.Context, tags.CreateTagPolicyRequest) (*tags.TagPolicy, error)) *MockTagPoliciesInterface_CreateTagPolicy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteTagPolicy provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) DeleteTagPolicy(ctx context.Context, request tags.DeleteTagPolicyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteTagPolicy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, tags.DeleteTagPolicyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockTagPoliciesInterface_DeleteTagPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteTagPolicy' +type MockTagPoliciesInterface_DeleteTagPolicy_Call struct { + *mock.Call +} + +// DeleteTagPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request tags.DeleteTagPolicyRequest +func (_e *MockTagPoliciesInterface_Expecter) DeleteTagPolicy(ctx interface{}, request interface{}) *MockTagPoliciesInterface_DeleteTagPolicy_Call { + return &MockTagPoliciesInterface_DeleteTagPolicy_Call{Call: _e.mock.On("DeleteTagPolicy", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_DeleteTagPolicy_Call) Run(run func(ctx context.Context, request tags.DeleteTagPolicyRequest)) *MockTagPoliciesInterface_DeleteTagPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.DeleteTagPolicyRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_DeleteTagPolicy_Call) Return(_a0 error) *MockTagPoliciesInterface_DeleteTagPolicy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTagPoliciesInterface_DeleteTagPolicy_Call) RunAndReturn(run func(context.Context, tags.DeleteTagPolicyRequest) error) *MockTagPoliciesInterface_DeleteTagPolicy_Call { + _c.Call.Return(run) + return _c +} + +// GetTagPolicy provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) GetTagPolicy(ctx context.Context, request tags.GetTagPolicyRequest) (*tags.TagPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetTagPolicy") + } + + var r0 *tags.TagPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.GetTagPolicyRequest) (*tags.TagPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.GetTagPolicyRequest) *tags.TagPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.GetTagPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagPoliciesInterface_GetTagPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTagPolicy' +type MockTagPoliciesInterface_GetTagPolicy_Call struct { + *mock.Call +} + +// GetTagPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request tags.GetTagPolicyRequest +func (_e *MockTagPoliciesInterface_Expecter) GetTagPolicy(ctx interface{}, request interface{}) *MockTagPoliciesInterface_GetTagPolicy_Call { + return &MockTagPoliciesInterface_GetTagPolicy_Call{Call: _e.mock.On("GetTagPolicy", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_GetTagPolicy_Call) Run(run func(ctx context.Context, request tags.GetTagPolicyRequest)) *MockTagPoliciesInterface_GetTagPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.GetTagPolicyRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_GetTagPolicy_Call) Return(_a0 *tags.TagPolicy, _a1 error) *MockTagPoliciesInterface_GetTagPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagPoliciesInterface_GetTagPolicy_Call) RunAndReturn(run func(context.Context, tags.GetTagPolicyRequest) (*tags.TagPolicy, error)) *MockTagPoliciesInterface_GetTagPolicy_Call { + _c.Call.Return(run) + return _c +} + +// ListTagPolicies provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) ListTagPolicies(ctx context.Context, request tags.ListTagPoliciesRequest) listing.Iterator[tags.TagPolicy] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListTagPolicies") + } + + var r0 listing.Iterator[tags.TagPolicy] + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagPoliciesRequest) listing.Iterator[tags.TagPolicy]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[tags.TagPolicy]) + } + } + + return r0 +} + +// MockTagPoliciesInterface_ListTagPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTagPolicies' +type MockTagPoliciesInterface_ListTagPolicies_Call struct { + *mock.Call +} + +// ListTagPolicies is a helper method to define mock.On call +// - ctx context.Context +// - request tags.ListTagPoliciesRequest +func (_e *MockTagPoliciesInterface_Expecter) ListTagPolicies(ctx interface{}, request interface{}) *MockTagPoliciesInterface_ListTagPolicies_Call { + return &MockTagPoliciesInterface_ListTagPolicies_Call{Call: _e.mock.On("ListTagPolicies", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_ListTagPolicies_Call) Run(run func(ctx context.Context, request tags.ListTagPoliciesRequest)) *MockTagPoliciesInterface_ListTagPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.ListTagPoliciesRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_ListTagPolicies_Call) Return(_a0 listing.Iterator[tags.TagPolicy]) *MockTagPoliciesInterface_ListTagPolicies_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTagPoliciesInterface_ListTagPolicies_Call) RunAndReturn(run func(context.Context, tags.ListTagPoliciesRequest) listing.Iterator[tags.TagPolicy]) *MockTagPoliciesInterface_ListTagPolicies_Call { + _c.Call.Return(run) + return _c +} + +// ListTagPoliciesAll provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) ListTagPoliciesAll(ctx context.Context, request tags.ListTagPoliciesRequest) ([]tags.TagPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListTagPoliciesAll") + } + + var r0 []tags.TagPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagPoliciesRequest) ([]tags.TagPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagPoliciesRequest) []tags.TagPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]tags.TagPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.ListTagPoliciesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagPoliciesInterface_ListTagPoliciesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTagPoliciesAll' +type MockTagPoliciesInterface_ListTagPoliciesAll_Call struct { + *mock.Call +} + +// ListTagPoliciesAll is a helper method to define mock.On call +// - ctx context.Context +// - request tags.ListTagPoliciesRequest +func (_e *MockTagPoliciesInterface_Expecter) ListTagPoliciesAll(ctx interface{}, request interface{}) *MockTagPoliciesInterface_ListTagPoliciesAll_Call { + return &MockTagPoliciesInterface_ListTagPoliciesAll_Call{Call: _e.mock.On("ListTagPoliciesAll", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_ListTagPoliciesAll_Call) Run(run func(ctx context.Context, request tags.ListTagPoliciesRequest)) *MockTagPoliciesInterface_ListTagPoliciesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.ListTagPoliciesRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_ListTagPoliciesAll_Call) Return(_a0 []tags.TagPolicy, _a1 error) *MockTagPoliciesInterface_ListTagPoliciesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagPoliciesInterface_ListTagPoliciesAll_Call) RunAndReturn(run func(context.Context, tags.ListTagPoliciesRequest) ([]tags.TagPolicy, error)) *MockTagPoliciesInterface_ListTagPoliciesAll_Call { + _c.Call.Return(run) + return _c +} + +// UpdateTagPolicy provides a mock function with given fields: ctx, request +func (_m *MockTagPoliciesInterface) UpdateTagPolicy(ctx context.Context, request tags.UpdateTagPolicyRequest) (*tags.TagPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateTagPolicy") + } + + var r0 *tags.TagPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.UpdateTagPolicyRequest) (*tags.TagPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.UpdateTagPolicyRequest) *tags.TagPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.UpdateTagPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagPoliciesInterface_UpdateTagPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateTagPolicy' +type MockTagPoliciesInterface_UpdateTagPolicy_Call struct { + *mock.Call +} + +// UpdateTagPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request tags.UpdateTagPolicyRequest +func (_e *MockTagPoliciesInterface_Expecter) UpdateTagPolicy(ctx interface{}, request interface{}) *MockTagPoliciesInterface_UpdateTagPolicy_Call { + return &MockTagPoliciesInterface_UpdateTagPolicy_Call{Call: _e.mock.On("UpdateTagPolicy", ctx, request)} +} + +func (_c *MockTagPoliciesInterface_UpdateTagPolicy_Call) Run(run func(ctx context.Context, request tags.UpdateTagPolicyRequest)) *MockTagPoliciesInterface_UpdateTagPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.UpdateTagPolicyRequest)) + }) + return _c +} + +func (_c *MockTagPoliciesInterface_UpdateTagPolicy_Call) Return(_a0 *tags.TagPolicy, _a1 error) *MockTagPoliciesInterface_UpdateTagPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagPoliciesInterface_UpdateTagPolicy_Call) RunAndReturn(run func(context.Context, tags.UpdateTagPolicyRequest) (*tags.TagPolicy, error)) *MockTagPoliciesInterface_UpdateTagPolicy_Call { + _c.Call.Return(run) + return _c +} + +// NewMockTagPoliciesInterface creates a new instance of MockTagPoliciesInterface. 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 NewMockTagPoliciesInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockTagPoliciesInterface { + mock := &MockTagPoliciesInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/service/agentbricks/model.go b/service/agentbricks/model.go index e6898b6de..1280551de 100755 --- a/service/agentbricks/model.go +++ b/service/agentbricks/model.go @@ -13,9 +13,10 @@ type CancelCustomLlmOptimizationRunRequest struct { } type CreateCustomLlmRequest struct { - // Optional: UC path for agent artifacts. If you are using a dataset that - // you only have read permissions, please provide a destination path where - // you have write permissions. Please provide this in catalog.schema format. + // This will soon be deprecated!! Optional: UC path for agent artifacts. If + // you are using a dataset that you only have read permissions, please + // provide a destination path where you have write permissions. Please + // provide this in catalog.schema format. AgentArtifactPath string `json:"agent_artifact_path,omitempty"` // Datasets used for training and evaluating the model, not for inference. // Currently, only 1 dataset is accepted. diff --git a/service/apps/api.go b/service/apps/api.go index 5ead2c444..97d13e734 100755 --- a/service/apps/api.go +++ b/service/apps/api.go @@ -1,8 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// Apps run directly on a customer’s Databricks instance, integrate with their -// data, use and extend Databricks services, and enable users to interact -// through single sign-on. +// These APIs allow you to manage Apps, Apps Settings, etc. package apps import ( @@ -553,3 +551,43 @@ func (a *AppsAPI) StopAndWait(ctx context.Context, stopAppRequest StopAppRequest } return wait.Get() } + +type AppsSettingsInterface interface { + + // Creates a custom template. + CreateCustomTemplate(ctx context.Context, request CreateCustomTemplateRequest) (*CustomTemplate, error) + + // Deletes the custom template with the specified name. + DeleteCustomTemplate(ctx context.Context, request DeleteCustomTemplateRequest) (*CustomTemplate, error) + + // Gets the custom template with the specified name. + GetCustomTemplate(ctx context.Context, request GetCustomTemplateRequest) (*CustomTemplate, error) + + // Lists all custom templates in the workspace. + // + // This method is generated by Databricks SDK Code Generator. + ListCustomTemplates(ctx context.Context, request ListCustomTemplatesRequest) listing.Iterator[CustomTemplate] + + // Lists all custom templates in the workspace. + // + // This method is generated by Databricks SDK Code Generator. + ListCustomTemplatesAll(ctx context.Context, request ListCustomTemplatesRequest) ([]CustomTemplate, error) + + // Updates the custom template with the specified name. Note that the template + // name cannot be updated. + UpdateCustomTemplate(ctx context.Context, request UpdateCustomTemplateRequest) (*CustomTemplate, error) +} + +func NewAppsSettings(client *client.DatabricksClient) *AppsSettingsAPI { + return &AppsSettingsAPI{ + appsSettingsImpl: appsSettingsImpl{ + client: client, + }, + } +} + +// Apps Settings manage the settings for the Apps service on a customer's +// Databricks instance. +type AppsSettingsAPI struct { + appsSettingsImpl +} diff --git a/service/apps/impl.go b/service/apps/impl.go index a2f7de3d1..86e0183cc 100755 --- a/service/apps/impl.go +++ b/service/apps/impl.go @@ -229,3 +229,91 @@ func (a *appsImpl) UpdatePermissions(ctx context.Context, request AppPermissions err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &appPermissions) return &appPermissions, err } + +// unexported type that holds implementations of just AppsSettings API methods +type appsSettingsImpl struct { + client *client.DatabricksClient +} + +func (a *appsSettingsImpl) CreateCustomTemplate(ctx context.Context, request CreateCustomTemplateRequest) (*CustomTemplate, error) { + var customTemplate CustomTemplate + path := "/api/2.0/apps-settings/templates" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Template, &customTemplate) + return &customTemplate, err +} + +func (a *appsSettingsImpl) DeleteCustomTemplate(ctx context.Context, request DeleteCustomTemplateRequest) (*CustomTemplate, error) { + var customTemplate CustomTemplate + path := fmt.Sprintf("/api/2.0/apps-settings/templates/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &customTemplate) + return &customTemplate, err +} + +func (a *appsSettingsImpl) GetCustomTemplate(ctx context.Context, request GetCustomTemplateRequest) (*CustomTemplate, error) { + var customTemplate CustomTemplate + path := fmt.Sprintf("/api/2.0/apps-settings/templates/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &customTemplate) + return &customTemplate, err +} + +// Lists all custom templates in the workspace. +func (a *appsSettingsImpl) ListCustomTemplates(ctx context.Context, request ListCustomTemplatesRequest) listing.Iterator[CustomTemplate] { + + getNextPage := func(ctx context.Context, req ListCustomTemplatesRequest) (*ListCustomTemplatesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListCustomTemplates(ctx, req) + } + getItems := func(resp *ListCustomTemplatesResponse) []CustomTemplate { + return resp.Templates + } + getNextReq := func(resp *ListCustomTemplatesResponse) *ListCustomTemplatesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Lists all custom templates in the workspace. +func (a *appsSettingsImpl) ListCustomTemplatesAll(ctx context.Context, request ListCustomTemplatesRequest) ([]CustomTemplate, error) { + iterator := a.ListCustomTemplates(ctx, request) + return listing.ToSlice[CustomTemplate](ctx, iterator) +} + +func (a *appsSettingsImpl) internalListCustomTemplates(ctx context.Context, request ListCustomTemplatesRequest) (*ListCustomTemplatesResponse, error) { + var listCustomTemplatesResponse ListCustomTemplatesResponse + path := "/api/2.0/apps-settings/templates" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCustomTemplatesResponse) + return &listCustomTemplatesResponse, err +} + +func (a *appsSettingsImpl) UpdateCustomTemplate(ctx context.Context, request UpdateCustomTemplateRequest) (*CustomTemplate, error) { + var customTemplate CustomTemplate + path := fmt.Sprintf("/api/2.0/apps-settings/templates/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.Template, &customTemplate) + return &customTemplate, err +} diff --git a/service/apps/interface.go b/service/apps/interface.go index e7398a918..5fcd1289c 100755 --- a/service/apps/interface.go +++ b/service/apps/interface.go @@ -60,3 +60,26 @@ type AppsService interface { // their root object. UpdatePermissions(ctx context.Context, request AppPermissionsRequest) (*AppPermissions, error) } + +// Apps Settings manage the settings for the Apps service on a customer's +// Databricks instance. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type AppsSettingsService interface { + + // Creates a custom template. + CreateCustomTemplate(ctx context.Context, request CreateCustomTemplateRequest) (*CustomTemplate, error) + + // Deletes the custom template with the specified name. + DeleteCustomTemplate(ctx context.Context, request DeleteCustomTemplateRequest) (*CustomTemplate, error) + + // Gets the custom template with the specified name. + GetCustomTemplate(ctx context.Context, request GetCustomTemplateRequest) (*CustomTemplate, error) + + // Lists all custom templates in the workspace. + ListCustomTemplates(ctx context.Context, request ListCustomTemplatesRequest) (*ListCustomTemplatesResponse, error) + + // Updates the custom template with the specified name. Note that the + // template name cannot be updated. + UpdateCustomTemplate(ctx context.Context, request UpdateCustomTemplateRequest) (*CustomTemplate, error) +} diff --git a/service/apps/model.go b/service/apps/model.go index 7f768e864..aec95aaa8 100755 --- a/service/apps/model.go +++ b/service/apps/model.go @@ -264,6 +264,326 @@ func (s AppDeploymentStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// App manifest definition +type AppManifest struct { + // Description of the app defined by manifest author / publisher + Description string `json:"description,omitempty"` + // Name of the app defined by manifest author / publisher + Name string `json:"name"` + + ResourceSpecs []AppManifestAppResourceSpec `json:"resource_specs,omitempty"` + // The manifest schema version, for now only 1 is allowed + Version int `json:"version"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AppManifest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AppManifest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type AppManifestAppResourceJobSpec struct { + // Permissions to grant on the Job. Supported permissions are: "CAN_MANAGE", + // "IS_OWNER", "CAN_MANAGE_RUN", "CAN_VIEW". + Permission AppManifestAppResourceJobSpecJobPermission `json:"permission"` +} + +type AppManifestAppResourceJobSpecJobPermission string + +const AppManifestAppResourceJobSpecJobPermissionCanManage AppManifestAppResourceJobSpecJobPermission = `CAN_MANAGE` + +const AppManifestAppResourceJobSpecJobPermissionCanManageRun AppManifestAppResourceJobSpecJobPermission = `CAN_MANAGE_RUN` + +const AppManifestAppResourceJobSpecJobPermissionCanView AppManifestAppResourceJobSpecJobPermission = `CAN_VIEW` + +const AppManifestAppResourceJobSpecJobPermissionIsOwner AppManifestAppResourceJobSpecJobPermission = `IS_OWNER` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceJobSpecJobPermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceJobSpecJobPermission) Set(v string) error { + switch v { + case `CAN_MANAGE`, `CAN_MANAGE_RUN`, `CAN_VIEW`, `IS_OWNER`: + *f = AppManifestAppResourceJobSpecJobPermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CAN_MANAGE", "CAN_MANAGE_RUN", "CAN_VIEW", "IS_OWNER"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceJobSpecJobPermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceJobSpecJobPermission) Values() []AppManifestAppResourceJobSpecJobPermission { + return []AppManifestAppResourceJobSpecJobPermission{ + AppManifestAppResourceJobSpecJobPermissionCanManage, + AppManifestAppResourceJobSpecJobPermissionCanManageRun, + AppManifestAppResourceJobSpecJobPermissionCanView, + AppManifestAppResourceJobSpecJobPermissionIsOwner, + } +} + +// Type always returns AppManifestAppResourceJobSpecJobPermission to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceJobSpecJobPermission) Type() string { + return "AppManifestAppResourceJobSpecJobPermission" +} + +type AppManifestAppResourceSecretSpec struct { + // Permission to grant on the secret scope. For secrets, only one permission + // is allowed. Permission must be one of: "READ", "WRITE", "MANAGE". + Permission AppManifestAppResourceSecretSpecSecretPermission `json:"permission"` +} + +// Permission to grant on the secret scope. Supported permissions are: "READ", +// "WRITE", "MANAGE". +type AppManifestAppResourceSecretSpecSecretPermission string + +const AppManifestAppResourceSecretSpecSecretPermissionManage AppManifestAppResourceSecretSpecSecretPermission = `MANAGE` + +const AppManifestAppResourceSecretSpecSecretPermissionRead AppManifestAppResourceSecretSpecSecretPermission = `READ` + +const AppManifestAppResourceSecretSpecSecretPermissionWrite AppManifestAppResourceSecretSpecSecretPermission = `WRITE` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceSecretSpecSecretPermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceSecretSpecSecretPermission) Set(v string) error { + switch v { + case `MANAGE`, `READ`, `WRITE`: + *f = AppManifestAppResourceSecretSpecSecretPermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "MANAGE", "READ", "WRITE"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceSecretSpecSecretPermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceSecretSpecSecretPermission) Values() []AppManifestAppResourceSecretSpecSecretPermission { + return []AppManifestAppResourceSecretSpecSecretPermission{ + AppManifestAppResourceSecretSpecSecretPermissionManage, + AppManifestAppResourceSecretSpecSecretPermissionRead, + AppManifestAppResourceSecretSpecSecretPermissionWrite, + } +} + +// Type always returns AppManifestAppResourceSecretSpecSecretPermission to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceSecretSpecSecretPermission) Type() string { + return "AppManifestAppResourceSecretSpecSecretPermission" +} + +type AppManifestAppResourceServingEndpointSpec struct { + // Permission to grant on the serving endpoint. Supported permissions are: + // "CAN_MANAGE", "CAN_QUERY", "CAN_VIEW". + Permission AppManifestAppResourceServingEndpointSpecServingEndpointPermission `json:"permission"` +} + +type AppManifestAppResourceServingEndpointSpecServingEndpointPermission string + +const AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanManage AppManifestAppResourceServingEndpointSpecServingEndpointPermission = `CAN_MANAGE` + +const AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanQuery AppManifestAppResourceServingEndpointSpecServingEndpointPermission = `CAN_QUERY` + +const AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanView AppManifestAppResourceServingEndpointSpecServingEndpointPermission = `CAN_VIEW` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceServingEndpointSpecServingEndpointPermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceServingEndpointSpecServingEndpointPermission) Set(v string) error { + switch v { + case `CAN_MANAGE`, `CAN_QUERY`, `CAN_VIEW`: + *f = AppManifestAppResourceServingEndpointSpecServingEndpointPermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CAN_MANAGE", "CAN_QUERY", "CAN_VIEW"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceServingEndpointSpecServingEndpointPermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceServingEndpointSpecServingEndpointPermission) Values() []AppManifestAppResourceServingEndpointSpecServingEndpointPermission { + return []AppManifestAppResourceServingEndpointSpecServingEndpointPermission{ + AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanManage, + AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanQuery, + AppManifestAppResourceServingEndpointSpecServingEndpointPermissionCanView, + } +} + +// Type always returns AppManifestAppResourceServingEndpointSpecServingEndpointPermission to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceServingEndpointSpecServingEndpointPermission) Type() string { + return "AppManifestAppResourceServingEndpointSpecServingEndpointPermission" +} + +// AppResource related fields are copied from app.proto but excludes resource +// identifiers (e.g. name, id, key, scope, etc.) +type AppManifestAppResourceSpec struct { + // Description of the App Resource. + Description string `json:"description,omitempty"` + + JobSpec *AppManifestAppResourceJobSpec `json:"job_spec,omitempty"` + // Name of the App Resource. + Name string `json:"name"` + + SecretSpec *AppManifestAppResourceSecretSpec `json:"secret_spec,omitempty"` + + ServingEndpointSpec *AppManifestAppResourceServingEndpointSpec `json:"serving_endpoint_spec,omitempty"` + + SqlWarehouseSpec *AppManifestAppResourceSqlWarehouseSpec `json:"sql_warehouse_spec,omitempty"` + + UcSecurableSpec *AppManifestAppResourceUcSecurableSpec `json:"uc_securable_spec,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AppManifestAppResourceSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AppManifestAppResourceSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type AppManifestAppResourceSqlWarehouseSpec struct { + // Permission to grant on the SQL warehouse. Supported permissions are: + // "CAN_MANAGE", "CAN_USE", "IS_OWNER". + Permission AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission `json:"permission"` +} + +type AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission string + +const AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionCanManage AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission = `CAN_MANAGE` + +const AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionCanUse AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission = `CAN_USE` + +const AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionIsOwner AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission = `IS_OWNER` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission) Set(v string) error { + switch v { + case `CAN_MANAGE`, `CAN_USE`, `IS_OWNER`: + *f = AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CAN_MANAGE", "CAN_USE", "IS_OWNER"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission) Values() []AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission { + return []AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission{ + AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionCanManage, + AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionCanUse, + AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermissionIsOwner, + } +} + +// Type always returns AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission) Type() string { + return "AppManifestAppResourceSqlWarehouseSpecSqlWarehousePermission" +} + +type AppManifestAppResourceUcSecurableSpec struct { + Permission AppManifestAppResourceUcSecurableSpecUcSecurablePermission `json:"permission"` + + SecurableType AppManifestAppResourceUcSecurableSpecUcSecurableType `json:"securable_type"` +} + +type AppManifestAppResourceUcSecurableSpecUcSecurablePermission string + +const AppManifestAppResourceUcSecurableSpecUcSecurablePermissionManage AppManifestAppResourceUcSecurableSpecUcSecurablePermission = `MANAGE` + +const AppManifestAppResourceUcSecurableSpecUcSecurablePermissionReadVolume AppManifestAppResourceUcSecurableSpecUcSecurablePermission = `READ_VOLUME` + +const AppManifestAppResourceUcSecurableSpecUcSecurablePermissionWriteVolume AppManifestAppResourceUcSecurableSpecUcSecurablePermission = `WRITE_VOLUME` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceUcSecurableSpecUcSecurablePermission) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceUcSecurableSpecUcSecurablePermission) Set(v string) error { + switch v { + case `MANAGE`, `READ_VOLUME`, `WRITE_VOLUME`: + *f = AppManifestAppResourceUcSecurableSpecUcSecurablePermission(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "MANAGE", "READ_VOLUME", "WRITE_VOLUME"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceUcSecurableSpecUcSecurablePermission. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceUcSecurableSpecUcSecurablePermission) Values() []AppManifestAppResourceUcSecurableSpecUcSecurablePermission { + return []AppManifestAppResourceUcSecurableSpecUcSecurablePermission{ + AppManifestAppResourceUcSecurableSpecUcSecurablePermissionManage, + AppManifestAppResourceUcSecurableSpecUcSecurablePermissionReadVolume, + AppManifestAppResourceUcSecurableSpecUcSecurablePermissionWriteVolume, + } +} + +// Type always returns AppManifestAppResourceUcSecurableSpecUcSecurablePermission to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceUcSecurableSpecUcSecurablePermission) Type() string { + return "AppManifestAppResourceUcSecurableSpecUcSecurablePermission" +} + +type AppManifestAppResourceUcSecurableSpecUcSecurableType string + +const AppManifestAppResourceUcSecurableSpecUcSecurableTypeVolume AppManifestAppResourceUcSecurableSpecUcSecurableType = `VOLUME` + +// String representation for [fmt.Print] +func (f *AppManifestAppResourceUcSecurableSpecUcSecurableType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AppManifestAppResourceUcSecurableSpecUcSecurableType) Set(v string) error { + switch v { + case `VOLUME`: + *f = AppManifestAppResourceUcSecurableSpecUcSecurableType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "VOLUME"`, v) + } +} + +// Values returns all possible values for AppManifestAppResourceUcSecurableSpecUcSecurableType. +// +// There is no guarantee on the order of the values in the slice. +func (f *AppManifestAppResourceUcSecurableSpecUcSecurableType) Values() []AppManifestAppResourceUcSecurableSpecUcSecurableType { + return []AppManifestAppResourceUcSecurableSpecUcSecurableType{ + AppManifestAppResourceUcSecurableSpecUcSecurableTypeVolume, + } +} + +// Type always returns AppManifestAppResourceUcSecurableSpecUcSecurableType to satisfy [pflag.Value] interface +func (f *AppManifestAppResourceUcSecurableSpecUcSecurableType) Type() string { + return "AppManifestAppResourceUcSecurableSpecUcSecurableType" +} + type AppPermission struct { Inherited bool `json:"inherited,omitempty"` @@ -860,11 +1180,49 @@ func (s CreateAppRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateCustomTemplateRequest struct { + Template CustomTemplate `json:"template"` +} + +type CustomTemplate struct { + Creator string `json:"creator,omitempty"` + // The description of the template. + Description string `json:"description,omitempty"` + // The Git provider of the template. + GitProvider string `json:"git_provider"` + // The Git repository URL that the template resides in. + GitRepo string `json:"git_repo"` + // The manifest of the template. It defines fields and default values when + // installing the template. + Manifest AppManifest `json:"manifest"` + // The name of the template. It must contain only alphanumeric characters, + // hyphens, underscores, and whitespaces. It must be unique within the + // workspace. + Name string `json:"name"` + // The path to the template within the Git repository. + Path string `json:"path"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CustomTemplate) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CustomTemplate) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type DeleteAppRequest struct { // The name of the app. Name string `json:"-" url:"-"` } +type DeleteCustomTemplateRequest struct { + // The name of the custom template. + Name string `json:"-" url:"-"` +} + type GetAppDeploymentRequest struct { // The name of the app. AppName string `json:"-" url:"-"` @@ -892,6 +1250,11 @@ type GetAppRequest struct { Name string `json:"-" url:"-"` } +type GetCustomTemplateRequest struct { + // The name of the custom template. + Name string `json:"-" url:"-"` +} + type ListAppDeploymentsRequest struct { // The name of the app. AppName string `json:"-" url:"-"` @@ -963,6 +1326,41 @@ func (s ListAppsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListCustomTemplatesRequest struct { + // Upper bound for items returned. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page of custom templates. Requests + // first page if absent. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListCustomTemplatesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListCustomTemplatesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListCustomTemplatesResponse struct { + // Pagination token to request the next page of custom templates. + NextPageToken string `json:"next_page_token,omitempty"` + + Templates []CustomTemplate `json:"templates,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListCustomTemplatesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListCustomTemplatesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type StartAppRequest struct { // The name of the app. Name string `json:"-" url:"-"` @@ -979,3 +1377,12 @@ type UpdateAppRequest struct { // characters and hyphens. It must be unique within the workspace. Name string `json:"-" url:"-"` } + +type UpdateCustomTemplateRequest struct { + // The name of the template. It must contain only alphanumeric characters, + // hyphens, underscores, and whitespaces. It must be unique within the + // workspace. + Name string `json:"-" url:"-"` + + Template CustomTemplate `json:"template"` +} diff --git a/service/catalog/api.go b/service/catalog/api.go index e887d9891..7ed747a68 100755 --- a/service/catalog/api.go +++ b/service/catalog/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Account Metastore Assignments, Account Metastores, Account Storage Credentials, Artifact Allowlists, Catalogs, Connections, Credentials, External Lineage, External Locations, External Metadata, Functions, Grants, Metastores, Model Versions, Online Tables, Policies, Quality Monitors, Registered Models, Resource Quotas, Schemas, Storage Credentials, System Schemas, Table Constraints, Tables, Temporary Path Credentials, Temporary Table Credentials, Volumes, Workspace Bindings, etc. +// These APIs allow you to manage Account Metastore Assignments, Account Metastores, Account Storage Credentials, Artifact Allowlists, Catalogs, Connections, Credentials, Entity Tag Assignments, External Lineage, External Locations, External Metadata, Functions, Grants, Metastores, Model Versions, Online Tables, Policies, Quality Monitors, Registered Models, Resource Quotas, Rfa, Schemas, Storage Credentials, System Schemas, Table Constraints, Tables, Temporary Path Credentials, Temporary Table Credentials, Volumes, Workspace Bindings, etc. package catalog import ( @@ -596,6 +596,78 @@ func (a *CredentialsAPI) GetCredentialByNameArg(ctx context.Context, nameArg str }) } +type EntityTagAssignmentsInterface interface { + + // Creates a tag assignment for an Unity Catalog entity. + // + // To add tags to Unity Catalog entities, you must own the entity or have the + // following privileges: - **APPLY TAG** on the entity - **USE SCHEMA** on the + // entity's parent schema - **USE CATALOG** on the entity's parent catalog + // + // To add a governed tag to Unity Catalog entities, you must also have the + // **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy + // permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Create(ctx context.Context, request CreateEntityTagAssignmentRequest) (*EntityTagAssignment, error) + + // Deletes a tag assignment for an Unity Catalog entity by its key. + // + // To delete tags from Unity Catalog entities, you must own the entity or have + // the following privileges: - **APPLY TAG** on the entity - **USE_SCHEMA** on + // the entity's parent schema - **USE_CATALOG** on the entity's parent catalog + // + // To delete a governed tag from Unity Catalog entities, you must also have the + // **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy + // permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Delete(ctx context.Context, request DeleteEntityTagAssignmentRequest) error + + // Gets a tag assignment for an Unity Catalog entity by tag key. + Get(ctx context.Context, request GetEntityTagAssignmentRequest) (*EntityTagAssignment, error) + + // List tag assignments for an Unity Catalog entity + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListEntityTagAssignmentsRequest) listing.Iterator[EntityTagAssignment] + + // List tag assignments for an Unity Catalog entity + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListEntityTagAssignmentsRequest) ([]EntityTagAssignment, error) + + // Updates an existing tag assignment for an Unity Catalog entity. + // + // To update tags to Unity Catalog entities, you must own the entity or have the + // following privileges: - **APPLY TAG** on the entity - **USE SCHEMA** on the + // entity's parent schema - **USE CATALOG** on the entity's parent catalog + // + // To update a governed tag to Unity Catalog entities, you must also have the + // **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag policy + // permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Update(ctx context.Context, request UpdateEntityTagAssignmentRequest) (*EntityTagAssignment, error) +} + +func NewEntityTagAssignments(client *client.DatabricksClient) *EntityTagAssignmentsAPI { + return &EntityTagAssignmentsAPI{ + entityTagAssignmentsImpl: entityTagAssignmentsImpl{ + client: client, + }, + } +} + +// Tags are attributes that include keys and optional values that you can use to +// organize and categorize entities in Unity Catalog. Entity tagging is +// currently supported on catalogs, schemas, tables (including views), columns, +// volumes. With these APIs, users can create, update, delete, and list tag +// assignments across Unity Catalog entities +type EntityTagAssignmentsAPI struct { + entityTagAssignmentsImpl +} + type ExternalLineageInterface interface { // Creates an external lineage relationship between a Databricks or external @@ -2002,6 +2074,63 @@ type ResourceQuotasAPI struct { resourceQuotasImpl } +type RfaInterface interface { + + // Creates access requests for Unity Catalog permissions for a specified + // principal on a securable object. This Batch API can take in multiple + // principals, securable objects, and permissions as the input and returns the + // access request destinations for each. Principals must be unique across the + // API call. + // + // The supported securable types are: "metastore", "catalog", "schema", "table", + // "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + BatchCreateAccessRequests(ctx context.Context, request BatchCreateAccessRequestsRequest) (*BatchCreateAccessRequestsResponse, error) + + // Gets an array of access request destinations for the specified securable. Any + // caller can see URL destinations or the destinations on the metastore. + // Otherwise, only those with **BROWSE** permissions on the securable can see + // destinations. + // + // The supported securable types are: "metastore", "catalog", "schema", "table", + // "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + GetAccessRequestDestinations(ctx context.Context, request GetAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) + + // Updates the access request destinations for the given securable. The caller + // must be a metastore admin, the owner of the securable, or a user that has the + // **MANAGE** privilege on the securable in order to assign destinations. + // Destinations cannot be updated for securables underneath schemas (tables, + // volumes, functions, and models). For these securable types, destinations are + // inherited from the parent securable. A maximum of 5 emails and 5 external + // notification destinations (Slack, Microsoft Teams, and Generic Webhook + // destinations) can be assigned to a securable. If a URL destination is + // assigned, no other destinations can be set. + // + // The supported securable types are: "metastore", "catalog", "schema", "table", + // "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + UpdateAccessRequestDestinations(ctx context.Context, request UpdateAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) +} + +func NewRfa(client *client.DatabricksClient) *RfaAPI { + return &RfaAPI{ + rfaImpl: rfaImpl{ + client: client, + }, + } +} + +// Request for Access enables customers to request access to and manage access +// request destinations for Unity Catalog securables. +// +// These APIs provide a standardized way to update, get, and request to access +// request destinations. Fine-grained authorization ensures that only users with +// appropriate permissions can manage access request destinations. +type RfaAPI struct { + rfaImpl +} + type SchemasInterface interface { // Creates a new schema for catalog in the Metastore. The caller must be a diff --git a/service/catalog/impl.go b/service/catalog/impl.go index 22a7067cb..70853eef1 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -586,6 +586,96 @@ func (a *credentialsImpl) ValidateCredential(ctx context.Context, request Valida return &validateCredentialResponse, err } +// unexported type that holds implementations of just EntityTagAssignments API methods +type entityTagAssignmentsImpl struct { + client *client.DatabricksClient +} + +func (a *entityTagAssignmentsImpl) Create(ctx context.Context, request CreateEntityTagAssignmentRequest) (*EntityTagAssignment, error) { + var entityTagAssignment EntityTagAssignment + path := "/api/2.1/unity-catalog/entity-tag-assignments" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.TagAssignment, &entityTagAssignment) + return &entityTagAssignment, err +} + +func (a *entityTagAssignmentsImpl) Delete(ctx context.Context, request DeleteEntityTagAssignmentRequest) error { + path := fmt.Sprintf("/api/2.1/unity-catalog/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityName, request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *entityTagAssignmentsImpl) Get(ctx context.Context, request GetEntityTagAssignmentRequest) (*EntityTagAssignment, error) { + var entityTagAssignment EntityTagAssignment + path := fmt.Sprintf("/api/2.1/unity-catalog/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityName, request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &entityTagAssignment) + return &entityTagAssignment, err +} + +// List tag assignments for an Unity Catalog entity +func (a *entityTagAssignmentsImpl) List(ctx context.Context, request ListEntityTagAssignmentsRequest) listing.Iterator[EntityTagAssignment] { + + getNextPage := func(ctx context.Context, req ListEntityTagAssignmentsRequest) (*ListEntityTagAssignmentsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListEntityTagAssignmentsResponse) []EntityTagAssignment { + return resp.TagAssignments + } + getNextReq := func(resp *ListEntityTagAssignmentsResponse) *ListEntityTagAssignmentsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List tag assignments for an Unity Catalog entity +func (a *entityTagAssignmentsImpl) ListAll(ctx context.Context, request ListEntityTagAssignmentsRequest) ([]EntityTagAssignment, error) { + iterator := a.List(ctx, request) + return listing.ToSlice[EntityTagAssignment](ctx, iterator) +} + +func (a *entityTagAssignmentsImpl) internalList(ctx context.Context, request ListEntityTagAssignmentsRequest) (*ListEntityTagAssignmentsResponse, error) { + var listEntityTagAssignmentsResponse ListEntityTagAssignmentsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/entity-tag-assignments/%v/%v/tags", request.EntityType, request.EntityName) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listEntityTagAssignmentsResponse) + return &listEntityTagAssignmentsResponse, err +} + +func (a *entityTagAssignmentsImpl) Update(ctx context.Context, request UpdateEntityTagAssignmentRequest) (*EntityTagAssignment, error) { + var entityTagAssignment EntityTagAssignment + path := fmt.Sprintf("/api/2.1/unity-catalog/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityName, request.TagKey) + queryParams := make(map[string]any) + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.TagAssignment, &entityTagAssignment) + return &entityTagAssignment, err +} + // unexported type that holds implementations of just ExternalLineage API methods type externalLineageImpl struct { client *client.DatabricksClient @@ -1657,6 +1747,46 @@ func (a *resourceQuotasImpl) internalListQuotas(ctx context.Context, request Lis return &listQuotasResponse, err } +// unexported type that holds implementations of just Rfa API methods +type rfaImpl struct { + client *client.DatabricksClient +} + +func (a *rfaImpl) BatchCreateAccessRequests(ctx context.Context, request BatchCreateAccessRequestsRequest) (*BatchCreateAccessRequestsResponse, error) { + var batchCreateAccessRequestsResponse BatchCreateAccessRequestsResponse + path := "/api/3.0/rfa/requests" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &batchCreateAccessRequestsResponse) + return &batchCreateAccessRequestsResponse, err +} + +func (a *rfaImpl) GetAccessRequestDestinations(ctx context.Context, request GetAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) { + var accessRequestDestinations AccessRequestDestinations + path := fmt.Sprintf("/api/3.0/rfa/destinations/%v/%v", request.SecurableType, request.FullName) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accessRequestDestinations) + return &accessRequestDestinations, err +} + +func (a *rfaImpl) UpdateAccessRequestDestinations(ctx context.Context, request UpdateAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) { + var accessRequestDestinations AccessRequestDestinations + path := "/api/3.0/rfa/destinations" + queryParams := make(map[string]any) + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.AccessRequestDestinations, &accessRequestDestinations) + return &accessRequestDestinations, err +} + // unexported type that holds implementations of just Schemas API methods type schemasImpl struct { client *client.DatabricksClient diff --git a/service/catalog/interface.go b/service/catalog/interface.go index 9a30b3763..811572c6d 100755 --- a/service/catalog/interface.go +++ b/service/catalog/interface.go @@ -251,6 +251,64 @@ type CredentialsService interface { ValidateCredential(ctx context.Context, request ValidateCredentialRequest) (*ValidateCredentialResponse, error) } +// Tags are attributes that include keys and optional values that you can use to +// organize and categorize entities in Unity Catalog. Entity tagging is +// currently supported on catalogs, schemas, tables (including views), columns, +// volumes. With these APIs, users can create, update, delete, and list tag +// assignments across Unity Catalog entities +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type EntityTagAssignmentsService interface { + + // Creates a tag assignment for an Unity Catalog entity. + // + // To add tags to Unity Catalog entities, you must own the entity or have + // the following privileges: - **APPLY TAG** on the entity - **USE SCHEMA** + // on the entity's parent schema - **USE CATALOG** on the entity's parent + // catalog + // + // To add a governed tag to Unity Catalog entities, you must also have the + // **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage tag + // policy permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Create(ctx context.Context, request CreateEntityTagAssignmentRequest) (*EntityTagAssignment, error) + + // Deletes a tag assignment for an Unity Catalog entity by its key. + // + // To delete tags from Unity Catalog entities, you must own the entity or + // have the following privileges: - **APPLY TAG** on the entity - + // **USE_SCHEMA** on the entity's parent schema - **USE_CATALOG** on the + // entity's parent catalog + // + // To delete a governed tag from Unity Catalog entities, you must also have + // the **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage + // tag policy permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Delete(ctx context.Context, request DeleteEntityTagAssignmentRequest) error + + // Gets a tag assignment for an Unity Catalog entity by tag key. + Get(ctx context.Context, request GetEntityTagAssignmentRequest) (*EntityTagAssignment, error) + + // List tag assignments for an Unity Catalog entity + List(ctx context.Context, request ListEntityTagAssignmentsRequest) (*ListEntityTagAssignmentsResponse, error) + + // Updates an existing tag assignment for an Unity Catalog entity. + // + // To update tags to Unity Catalog entities, you must own the entity or have + // the following privileges: - **APPLY TAG** on the entity - **USE SCHEMA** + // on the entity's parent schema - **USE CATALOG** on the entity's parent + // catalog + // + // To update a governed tag to Unity Catalog entities, you must also have + // the **ASSIGN** or **MANAGE** permission on the tag policy. See [Manage + // tag policy permissions]. + // + // [Manage tag policy permissions]: https://docs.databricks.com/aws/en/admin/tag-policies/manage-permissions + Update(ctx context.Context, request UpdateEntityTagAssignmentRequest) (*EntityTagAssignment, error) +} + // External Lineage APIs enable defining and managing lineage relationships // between Databricks objects and external systems. These APIs allow users to // capture data flows connecting Databricks tables, models, and file paths with @@ -886,6 +944,53 @@ type ResourceQuotasService interface { ListQuotas(ctx context.Context, request ListQuotasRequest) (*ListQuotasResponse, error) } +// Request for Access enables customers to request access to and manage access +// request destinations for Unity Catalog securables. +// +// These APIs provide a standardized way to update, get, and request to access +// request destinations. Fine-grained authorization ensures that only users with +// appropriate permissions can manage access request destinations. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type RfaService interface { + + // Creates access requests for Unity Catalog permissions for a specified + // principal on a securable object. This Batch API can take in multiple + // principals, securable objects, and permissions as the input and returns + // the access request destinations for each. Principals must be unique + // across the API call. + // + // The supported securable types are: "metastore", "catalog", "schema", + // "table", "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + BatchCreateAccessRequests(ctx context.Context, request BatchCreateAccessRequestsRequest) (*BatchCreateAccessRequestsResponse, error) + + // Gets an array of access request destinations for the specified securable. + // Any caller can see URL destinations or the destinations on the metastore. + // Otherwise, only those with **BROWSE** permissions on the securable can + // see destinations. + // + // The supported securable types are: "metastore", "catalog", "schema", + // "table", "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + GetAccessRequestDestinations(ctx context.Context, request GetAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) + + // Updates the access request destinations for the given securable. The + // caller must be a metastore admin, the owner of the securable, or a user + // that has the **MANAGE** privilege on the securable in order to assign + // destinations. Destinations cannot be updated for securables underneath + // schemas (tables, volumes, functions, and models). For these securable + // types, destinations are inherited from the parent securable. A maximum of + // 5 emails and 5 external notification destinations (Slack, Microsoft + // Teams, and Generic Webhook destinations) can be assigned to a securable. + // If a URL destination is assigned, no other destinations can be set. + // + // The supported securable types are: "metastore", "catalog", "schema", + // "table", "external_location", "connection", "credential", "function", + // "registered_model", and "volume". + UpdateAccessRequestDestinations(ctx context.Context, request UpdateAccessRequestDestinationsRequest) (*AccessRequestDestinations, error) +} + // A schema (also called a database) is the second layer of Unity Catalog’s // three-level namespace. A schema organizes tables, views and functions. To // access (or list) a table or view in a schema, users must have the USE_SCHEMA diff --git a/service/catalog/model.go b/service/catalog/model.go index cd1050a43..0785a4b01 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -8,6 +8,28 @@ import ( "github.com/databricks/databricks-sdk-go/marshal" ) +type AccessRequestDestinations struct { + // Indicates whether any destinations are hidden from the caller due to a + // lack of permissions. This value is true if the caller does not have + // permission to see all destinations. + AreAnyDestinationsHidden bool `json:"are_any_destinations_hidden,omitempty"` + // The access request destinations for the securable. + Destinations []NotificationDestination `json:"destinations"` + // The securable for which the access request destinations are being + // retrieved. + Securable Securable `json:"securable"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AccessRequestDestinations) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AccessRequestDestinations) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type AccountsCreateMetastore struct { MetastoreInfo *CreateMetastore `json:"metastore_info,omitempty"` } @@ -383,6 +405,21 @@ func (s AzureUserDelegationSas) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type BatchCreateAccessRequestsRequest struct { + // A list of individual access requests, where each request corresponds to a + // set of permissions being requested on a list of securables for a + // specified principal. + // + // At most 30 requests per API call. + Requests []CreateAccessRequest `json:"requests,omitempty"` +} + +type BatchCreateAccessRequestsResponse struct { + // The access request destinations for each securable object the principal + // requested. + Responses []CreateAccessRequestResponse `json:"responses,omitempty"` +} + type CancelRefreshRequest struct { RefreshId int64 `json:"-" url:"-"` // UC table name in format `catalog.schema.table_name`. table_name is case @@ -777,9 +814,6 @@ type ConnectionInfo struct { CreatedBy string `json:"created_by,omitempty"` // The type of credential. CredentialType CredentialType `json:"credential_type,omitempty"` - // [Create,Update:OPT] Connection environment settings as - // EnvironmentSettings object. - EnvironmentSettings *EnvironmentSettings `json:"environment_settings,omitempty"` // Full name of connection. FullName string `json:"full_name,omitempty"` // Unique identifier of parent metastore. @@ -932,6 +966,42 @@ func (s ContinuousUpdateStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateAccessRequest struct { + // Optional. The principal this request is for. Empty `behalf_of` defaults + // to the requester's identity. + // + // Principals must be unique across the API call. + BehalfOf *Principal `json:"behalf_of,omitempty"` + // Optional. Comment associated with the request. + // + // At most 200 characters, can only contain lowercase/uppercase letters + // (a-z, A-Z), numbers (0-9), punctuation, and spaces. + Comment string `json:"comment,omitempty"` + // List of securables and their corresponding requested UC privileges. + // + // At most 30 securables can be requested for a principal per batched call. + // Each securable can only be requested once per principal. + SecurablePermissions []SecurablePermissions `json:"securable_permissions,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateAccessRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateAccessRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateAccessRequestResponse struct { + // The principal the request was made on behalf of. + BehalfOf *Principal `json:"behalf_of,omitempty"` + // The access request destinations for all the securables the principal + // requested. + RequestDestinations []AccessRequestDestinations `json:"request_destinations,omitempty"` +} + type CreateCatalog struct { // User-provided free-form text description. Comment string `json:"comment,omitempty"` @@ -969,9 +1039,6 @@ type CreateConnection struct { Comment string `json:"comment,omitempty"` // The type of connection. ConnectionType ConnectionType `json:"connection_type"` - // [Create,Update:OPT] Connection environment settings as - // EnvironmentSettings object. - EnvironmentSettings *EnvironmentSettings `json:"environment_settings,omitempty"` // Name of the connection. Name string `json:"name"` // A map of key-value properties attached to the securable. @@ -1026,6 +1093,10 @@ func (s CreateCredentialRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateEntityTagAssignmentRequest struct { + TagAssignment EntityTagAssignment `json:"tag_assignment"` +} + type CreateExternalLineageRelationshipRequest struct { ExternalLineageRelationship CreateRequestExternalLineage `json:"external_lineage_relationship"` } @@ -1991,6 +2062,16 @@ func (s DeleteCredentialRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type DeleteEntityTagAssignmentRequest struct { + // The fully qualified name of the entity to which the tag is assigned + EntityName string `json:"-" url:"-"` + // The type of the entity to which the tag is assigned. Allowed values are: + // catalogs, schemas, tables, columns, volumes. + EntityType string `json:"-" url:"-"` + // Required. The key of the tag to delete + TagKey string `json:"-" url:"-"` +} + type DeleteExternalLineageRelationshipRequest struct { ExternalLineageRelationship DeleteRequestExternalLineage `json:"-" url:"external_lineage_relationship"` } @@ -2229,6 +2310,52 @@ type DependencyList struct { Dependencies []Dependency `json:"dependencies,omitempty"` } +type DestinationType string + +const DestinationTypeEmail DestinationType = `EMAIL` + +const DestinationTypeGenericWebhook DestinationType = `GENERIC_WEBHOOK` + +const DestinationTypeMicrosoftTeams DestinationType = `MICROSOFT_TEAMS` + +const DestinationTypeSlack DestinationType = `SLACK` + +const DestinationTypeUrl DestinationType = `URL` + +// String representation for [fmt.Print] +func (f *DestinationType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DestinationType) Set(v string) error { + switch v { + case `EMAIL`, `GENERIC_WEBHOOK`, `MICROSOFT_TEAMS`, `SLACK`, `URL`: + *f = DestinationType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "EMAIL", "GENERIC_WEBHOOK", "MICROSOFT_TEAMS", "SLACK", "URL"`, v) + } +} + +// Values returns all possible values for DestinationType. +// +// There is no guarantee on the order of the values in the slice. +func (f *DestinationType) Values() []DestinationType { + return []DestinationType{ + DestinationTypeEmail, + DestinationTypeGenericWebhook, + DestinationTypeMicrosoftTeams, + DestinationTypeSlack, + DestinationTypeUrl, + } +} + +// Type always returns DestinationType to satisfy [pflag.Value] interface +func (f *DestinationType) Type() string { + return "DestinationType" +} + type DisableRequest struct { // The metastore ID under which the system schema lives. MetastoreId string `json:"-" url:"-"` @@ -2423,19 +2550,26 @@ type EncryptionDetails struct { SseEncryptionDetails *SseEncryptionDetails `json:"sse_encryption_details,omitempty"` } -type EnvironmentSettings struct { - EnvironmentVersion string `json:"environment_version,omitempty"` - - JavaDependencies []string `json:"java_dependencies,omitempty"` +// Represents a tag assignment to an entity +type EntityTagAssignment struct { + // The fully qualified name of the entity to which the tag is assigned + EntityName string `json:"entity_name"` + // The type of the entity to which the tag is assigned. Allowed values are: + // catalogs, schemas, tables, columns, volumes. + EntityType string `json:"entity_type"` + // The key of the tag + TagKey string `json:"tag_key"` + // The value of the tag + TagValue string `json:"tag_value,omitempty"` ForceSendFields []string `json:"-" url:"-"` } -func (s *EnvironmentSettings) UnmarshalJSON(b []byte) error { +func (s *EntityTagAssignment) UnmarshalJSON(b []byte) error { return marshal.Unmarshal(b, s) } -func (s EnvironmentSettings) MarshalJSON() ([]byte, error) { +func (s EntityTagAssignment) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } @@ -3344,6 +3478,13 @@ func (s GenerateTemporaryTableCredentialResponse) MarshalJSON() ([]byte, error) return marshal.Marshal(s) } +type GetAccessRequestDestinationsRequest struct { + // The full name of the securable. + FullName string `json:"-" url:"-"` + // The type of the securable. + SecurableType string `json:"-" url:"-"` +} + type GetAccountMetastoreAssignmentRequest struct { // Workspace ID. WorkspaceId int64 `json:"-" url:"-"` @@ -3481,6 +3622,16 @@ func (s GetEffectiveRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type GetEntityTagAssignmentRequest struct { + // The fully qualified name of the entity to which the tag is assigned + EntityName string `json:"-" url:"-"` + // The type of the entity to which the tag is assigned. Allowed values are: + // catalogs, schemas, tables, columns, volumes. + EntityType string `json:"-" url:"-"` + // Required. The key of the tag + TagKey string `json:"-" url:"-"` +} + type GetExternalLocationRequest struct { // Whether to include external locations in the response for which the // principal can only access selective metadata for @@ -4015,6 +4166,45 @@ func (s ListCredentialsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListEntityTagAssignmentsRequest struct { + // The fully qualified name of the entity to which the tag is assigned + EntityName string `json:"-" url:"-"` + // The type of the entity to which the tag is assigned. Allowed values are: + // catalogs, schemas, tables, columns, volumes. + EntityType string `json:"-" url:"-"` + // Optional. Maximum number of tag assignments to return in a single page + MaxResults int `json:"-" url:"max_results,omitempty"` + // Optional. Pagination token to retrieve the next page of results + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListEntityTagAssignmentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListEntityTagAssignmentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListEntityTagAssignmentsResponse struct { + // Optional. Pagination token for retrieving the next page of results + NextPageToken string `json:"next_page_token,omitempty"` + // The list of tag assignments + TagAssignments []EntityTagAssignment `json:"tag_assignments,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListEntityTagAssignmentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListEntityTagAssignmentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListExternalLineageRelationshipsRequest struct { // The lineage direction to filter on. LineageDirection LineageDirection `json:"-" url:"lineage_direction"` @@ -5434,6 +5624,33 @@ type NamedTableConstraint struct { Name string `json:"name"` } +type NotificationDestination struct { + // The identifier for the destination. This is the email address for EMAIL + // destinations, the URL for URL destinations, or the unique Databricks + // notification destination ID for all other external destinations. + DestinationId string `json:"destination_id,omitempty"` + // The type of the destination. + DestinationType DestinationType `json:"destination_type,omitempty"` + // This field is used to denote whether the destination is the email of the + // owner of the securable object. The special destination cannot be assigned + // to a securable and only represents the default destination of the + // securable. The securable types that support default special destinations + // are: "catalog", "external_location", "connection", "credential", and + // "metastore". The **destination_type** of a **special_destination** is + // always EMAIL. + SpecialDestination SpecialDestination `json:"special_destination,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *NotificationDestination) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s NotificationDestination) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Online Table information. type OnlineTable struct { // Full three-part (catalog, schema, table) name of the table. @@ -5847,24 +6064,24 @@ type PolicyInfo struct { // Optional list of user or group names that should be excluded from the // policy. ExceptPrincipals []string `json:"except_principals,omitempty"` - // Type of securables that the policy should take effect on. Only `table` is + // Type of securables that the policy should take effect on. Only `TABLE` is // supported at this moment. Required on create and optional on update. ForSecurableType SecurableType `json:"for_securable_type"` // Unique identifier of the policy. This field is output only and is // generated by the system. Id string `json:"id,omitempty"` // Optional list of condition expressions used to match table columns. Only - // valid when `for_securable_type` is `table`. When specified, the policy + // valid when `for_securable_type` is `TABLE`. When specified, the policy // only applies to tables whose columns satisfy all match conditions. MatchColumns []MatchColumn `json:"match_columns,omitempty"` - // Name of the policy. Required on create and ignored on update. To update - // the name, use the `new_name` field. + // Name of the policy. Required on create and optional on update. To rename + // the policy, set `name` to a different value on update. Name string `json:"name,omitempty"` // Full name of the securable on which the policy is defined. Required on // create and ignored on update. OnSecurableFullname string `json:"on_securable_fullname,omitempty"` - // Type of the securable on which the policy is defined. Only `catalog`, - // `schema` and `table` are supported at this moment. Required on create and + // Type of the securable on which the policy is defined. Only `CATALOG`, + // `SCHEMA` and `TABLE` are supported at this moment. Required on create and // ignored on update. OnSecurableType SecurableType `json:"on_securable_type,omitempty"` // Type of the policy. Required on create and ignored on update. @@ -5954,6 +6171,63 @@ func (s PrimaryKeyConstraint) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type Principal struct { + // Databricks user, group or service principal ID. + Id string `json:"id,omitempty"` + + PrincipalType PrincipalType `json:"principal_type,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Principal) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Principal) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type PrincipalType string + +const PrincipalTypeGroupPrincipal PrincipalType = `GROUP_PRINCIPAL` + +const PrincipalTypeServicePrincipal PrincipalType = `SERVICE_PRINCIPAL` + +const PrincipalTypeUserPrincipal PrincipalType = `USER_PRINCIPAL` + +// String representation for [fmt.Print] +func (f *PrincipalType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *PrincipalType) Set(v string) error { + switch v { + case `GROUP_PRINCIPAL`, `SERVICE_PRINCIPAL`, `USER_PRINCIPAL`: + *f = PrincipalType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "GROUP_PRINCIPAL", "SERVICE_PRINCIPAL", "USER_PRINCIPAL"`, v) + } +} + +// Values returns all possible values for PrincipalType. +// +// There is no guarantee on the order of the values in the slice. +func (f *PrincipalType) Values() []PrincipalType { + return []PrincipalType{ + PrincipalTypeGroupPrincipal, + PrincipalTypeServicePrincipal, + PrincipalTypeUserPrincipal, + } +} + +// Type always returns PrincipalType to satisfy [pflag.Value] interface +func (f *PrincipalType) Type() string { + return "PrincipalType" +} + type Privilege string const PrivilegeAccess Privilege = `ACCESS` @@ -6448,6 +6722,30 @@ func (s SchemaInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Generic definition of a securable, which is uniquely defined in a metastore +// by its type and full name. +type Securable struct { + // Required. The full name of the catalog/schema/table. Optional if + // resource_name is present. + FullName string `json:"full_name,omitempty"` + // Optional. The name of the Share object that contains the securable when + // the securable is getting shared in D2D Delta Sharing. + ProviderShare string `json:"provider_share,omitempty"` + // Required. The type of securable (catalog/schema/table). Optional if + // resource_name is present. + Type SecurableType `json:"type,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Securable) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Securable) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type SecurableKind string const SecurableKindTableDbStorage SecurableKind = `TABLE_DB_STORAGE` @@ -6673,6 +6971,14 @@ type SecurableKindManifest struct { SecurableType SecurableType `json:"securable_type,omitempty"` } +type SecurablePermissions struct { + // List of requested Unity Catalog permissions. + Permissions []string `json:"permissions,omitempty"` + // The securable for which the access request destinations are being + // requested. + Securable *Securable `json:"securable,omitempty"` +} + // The type of Unity Catalog securable. type SecurableType string @@ -6788,6 +7094,52 @@ type SetRegisteredModelAliasRequest struct { VersionNum int `json:"version_num"` } +type SpecialDestination string + +const SpecialDestinationSpecialDestinationCatalogOwner SpecialDestination = `SPECIAL_DESTINATION_CATALOG_OWNER` + +const SpecialDestinationSpecialDestinationConnectionOwner SpecialDestination = `SPECIAL_DESTINATION_CONNECTION_OWNER` + +const SpecialDestinationSpecialDestinationCredentialOwner SpecialDestination = `SPECIAL_DESTINATION_CREDENTIAL_OWNER` + +const SpecialDestinationSpecialDestinationExternalLocationOwner SpecialDestination = `SPECIAL_DESTINATION_EXTERNAL_LOCATION_OWNER` + +const SpecialDestinationSpecialDestinationMetastoreOwner SpecialDestination = `SPECIAL_DESTINATION_METASTORE_OWNER` + +// String representation for [fmt.Print] +func (f *SpecialDestination) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *SpecialDestination) Set(v string) error { + switch v { + case `SPECIAL_DESTINATION_CATALOG_OWNER`, `SPECIAL_DESTINATION_CONNECTION_OWNER`, `SPECIAL_DESTINATION_CREDENTIAL_OWNER`, `SPECIAL_DESTINATION_EXTERNAL_LOCATION_OWNER`, `SPECIAL_DESTINATION_METASTORE_OWNER`: + *f = SpecialDestination(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "SPECIAL_DESTINATION_CATALOG_OWNER", "SPECIAL_DESTINATION_CONNECTION_OWNER", "SPECIAL_DESTINATION_CREDENTIAL_OWNER", "SPECIAL_DESTINATION_EXTERNAL_LOCATION_OWNER", "SPECIAL_DESTINATION_METASTORE_OWNER"`, v) + } +} + +// Values returns all possible values for SpecialDestination. +// +// There is no guarantee on the order of the values in the slice. +func (f *SpecialDestination) Values() []SpecialDestination { + return []SpecialDestination{ + SpecialDestinationSpecialDestinationCatalogOwner, + SpecialDestinationSpecialDestinationConnectionOwner, + SpecialDestinationSpecialDestinationCredentialOwner, + SpecialDestinationSpecialDestinationExternalLocationOwner, + SpecialDestinationSpecialDestinationMetastoreOwner, + } +} + +// Type always returns SpecialDestination to satisfy [pflag.Value] interface +func (f *SpecialDestination) Type() string { + return "SpecialDestination" +} + // Server-Side Encryption properties for clients communicating with AWS s3. type SseEncryptionDetails struct { // Sets the value of the 'x-amz-server-side-encryption' header in S3 @@ -7322,6 +7674,25 @@ type UnassignRequest struct { WorkspaceId int64 `json:"-" url:"-"` } +type UpdateAccessRequestDestinationsRequest struct { + // The access request destinations to assign to the securable. For each + // destination, a **destination_id** and **destination_type** must be + // defined. + AccessRequestDestinations AccessRequestDestinations `json:"access_request_destinations"` + // The field mask must be a single string, with multiple fields separated by + // commas (no spaces). The field path is relative to the resource object, + // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). + // Specification of elements in sequence or map fields is not allowed, as + // only the entire collection field can be specified. Field names must + // exactly match the resource field names. + // + // A field mask of `*` indicates full replacement. It’s recommended to + // always explicitly list the fields being updated and avoid using `*` + // wildcards, as it can lead to unintended results if the API changes in the + // future. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateCatalog struct { // User-provided free-form text description. Comment string `json:"comment,omitempty"` @@ -7359,9 +7730,6 @@ type UpdateCatalogWorkspaceBindingsResponse struct { } type UpdateConnection struct { - // [Create,Update:OPT] Connection environment settings as - // EnvironmentSettings object. - EnvironmentSettings *EnvironmentSettings `json:"environment_settings,omitempty"` // Name of the connection. Name string `json:"-" url:"-"` // New name for the connection. @@ -7424,6 +7792,30 @@ func (s UpdateCredentialRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateEntityTagAssignmentRequest struct { + // The fully qualified name of the entity to which the tag is assigned + EntityName string `json:"-" url:"-"` + // The type of the entity to which the tag is assigned. Allowed values are: + // catalogs, schemas, tables, columns, volumes. + EntityType string `json:"-" url:"-"` + + TagAssignment EntityTagAssignment `json:"tag_assignment"` + // The key of the tag + TagKey string `json:"-" url:"-"` + // The field mask must be a single string, with multiple fields separated by + // commas (no spaces). The field path is relative to the resource object, + // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). + // Specification of elements in sequence or map fields is not allowed, as + // only the entire collection field can be specified. Field names must + // exactly match the resource field names. + // + // A field mask of `*` indicates full replacement. It’s recommended to + // always explicitly list the fields being updated and avoid using `*` + // wildcards, as it can lead to unintended results if the API changes in the + // future. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateExternalLineageRelationshipRequest struct { ExternalLineageRelationship UpdateRequestExternalLineage `json:"external_lineage_relationship"` // The field mask must be a single string, with multiple fields separated by diff --git a/service/cleanrooms/model.go b/service/cleanrooms/model.go index 3edb63d7c..9fd0bf74e 100755 --- a/service/cleanrooms/model.go +++ b/service/cleanrooms/model.go @@ -32,7 +32,7 @@ type CleanRoom struct { // catalog is manipulated using the separate CreateCleanRoomOutputCatalog // API. OutputCatalog *CleanRoomOutputCatalog `json:"output_catalog,omitempty"` - // This is Databricks username of the owner of the local clean room + // This is the Databricks username of the owner of the local clean room // securable for permission management. Owner string `json:"owner,omitempty"` // Central clean room details. During creation, users need to specify @@ -217,7 +217,7 @@ type CleanRoomAssetNotebook struct { ReviewState CleanRoomNotebookReviewNotebookReviewState `json:"review_state,omitempty"` // All existing approvals or rejections Reviews []CleanRoomNotebookReview `json:"reviews,omitempty"` - // collaborators that can run the notebook + // Aliases of collaborators that can run the notebook. RunnerCollaboratorAliases []string `json:"runner_collaborator_aliases,omitempty"` ForceSendFields []string `json:"-" url:"-"` @@ -379,7 +379,7 @@ type CleanRoomCollaborator struct { // rooms, it is the organization name of the metastore. It is not restricted // to these values and could change in the future DisplayName string `json:"display_name,omitempty"` - // The global Unity Catalog metastore id of the collaborator. The identifier + // The global Unity Catalog metastore ID of the collaborator. The identifier // is of format cloud:region:metastore-uuid. GlobalMetastoreId string `json:"global_metastore_id,omitempty"` // Email of the user who is receiving the clean room "invitation". It should diff --git a/service/dashboards/api.go b/service/dashboards/api.go index ba977b176..2e1ad3b04 100755 --- a/service/dashboards/api.go +++ b/service/dashboards/api.go @@ -39,11 +39,15 @@ type GenieInterface interface { // Delete a conversation. DeleteConversationBySpaceIdAndConversationId(ctx context.Context, spaceId string, conversationId string) error + // Delete a conversation message. + DeleteConversationMessage(ctx context.Context, request GenieDeleteConversationMessageRequest) error + // Execute the SQL for a message query attachment. Use this API when the query // attachment has expired and needs to be re-executed. ExecuteMessageAttachmentQuery(ctx context.Context, request GenieExecuteMessageAttachmentQueryRequest) (*GenieGetMessageQueryResultResponse, error) - // Execute the SQL query in the message. + // DEPRECATED: Use [Execute Message Attachment + // Query](:method:genie/executemessageattachmentquery) instead. ExecuteMessageQuery(ctx context.Context, request GenieExecuteMessageQueryRequest) (*GenieGetMessageQueryResultResponse, error) // Get message from conversation. @@ -62,24 +66,20 @@ type GenieInterface interface { // `EXECUTING_QUERY` OR `COMPLETED`. GetMessageAttachmentQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This is - // only available if a message has a query attachment and the message status is - // `EXECUTING_QUERY`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResult(ctx context.Context, request GenieGetMessageQueryResultRequest) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This is - // only available if a message has a query attachment and the message status is - // `EXECUTING_QUERY`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResultBySpaceIdAndConversationIdAndMessageId(ctx context.Context, spaceId string, conversationId string, messageId string) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This is - // only available if a message has a query attachment and the message status is - // `EXECUTING_QUERY` OR `COMPLETED`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResultByAttachment(ctx context.Context, request GenieGetQueryResultByAttachmentRequest) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This is - // only available if a message has a query attachment and the message status is - // `EXECUTING_QUERY` OR `COMPLETED`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResultByAttachmentBySpaceIdAndConversationIdAndMessageIdAndAttachmentId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string) (*GenieGetMessageQueryResultResponse, error) // Get details of a Genie Space. @@ -88,6 +88,9 @@ type GenieInterface interface { // Get details of a Genie Space. GetSpaceBySpaceId(ctx context.Context, spaceId string) (*GenieSpace, error) + // List messages in a conversation + ListConversationMessages(ctx context.Context, request GenieListConversationMessagesRequest) (*GenieListConversationMessagesResponse, error) + // Get a list of conversations in a Genie Space. ListConversations(ctx context.Context, request GenieListConversationsRequest) (*GenieListConversationsResponse, error) @@ -97,6 +100,9 @@ type GenieInterface interface { // Get list of Genie Spaces. ListSpaces(ctx context.Context, request GenieListSpacesRequest) (*GenieListSpacesResponse, error) + // Send feedback for a message. + SendMessageFeedback(ctx context.Context, request GenieSendMessageFeedbackRequest) error + // Start a new conversation. StartConversation(ctx context.Context, genieStartConversationMessageRequest GenieStartConversationMessageRequest) (*WaitGetMessageGenieCompleted[GenieStartConversationResponse], error) @@ -267,9 +273,8 @@ func (a *GenieAPI) GetMessageAttachmentQueryResultBySpaceIdAndConversationIdAndM }) } -// Get the result of SQL query if the message has a query attachment. This is -// only available if a message has a query attachment and the message status is -// `EXECUTING_QUERY`. +// DEPRECATED: Use [Get Message Attachment Query +// Result](:method:genie/getmessageattachmentqueryresult) instead. func (a *GenieAPI) GetMessageQueryResultBySpaceIdAndConversationIdAndMessageId(ctx context.Context, spaceId string, conversationId string, messageId string) (*GenieGetMessageQueryResultResponse, error) { return a.genieImpl.GetMessageQueryResult(ctx, GenieGetMessageQueryResultRequest{ SpaceId: spaceId, @@ -278,9 +283,8 @@ func (a *GenieAPI) GetMessageQueryResultBySpaceIdAndConversationIdAndMessageId(c }) } -// Get the result of SQL query if the message has a query attachment. This is -// only available if a message has a query attachment and the message status is -// `EXECUTING_QUERY` OR `COMPLETED`. +// DEPRECATED: Use [Get Message Attachment Query +// Result](:method:genie/getmessageattachmentqueryresult) instead. func (a *GenieAPI) GetMessageQueryResultByAttachmentBySpaceIdAndConversationIdAndMessageIdAndAttachmentId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string) (*GenieGetMessageQueryResultResponse, error) { return a.genieImpl.GetMessageQueryResultByAttachment(ctx, GenieGetQueryResultByAttachmentRequest{ SpaceId: spaceId, diff --git a/service/dashboards/impl.go b/service/dashboards/impl.go index 06e76e49e..4e70904a0 100755 --- a/service/dashboards/impl.go +++ b/service/dashboards/impl.go @@ -37,6 +37,15 @@ func (a *genieImpl) DeleteConversation(ctx context.Context, request GenieDeleteC return err } +func (a *genieImpl) DeleteConversationMessage(ctx context.Context, request GenieDeleteConversationMessageRequest) error { + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v", request.SpaceId, request.ConversationId, request.MessageId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + func (a *genieImpl) ExecuteMessageAttachmentQuery(ctx context.Context, request GenieExecuteMessageAttachmentQueryRequest) (*GenieGetMessageQueryResultResponse, error) { var genieGetMessageQueryResultResponse GenieGetMessageQueryResultResponse path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/execute-query", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId) @@ -107,6 +116,16 @@ func (a *genieImpl) GetSpace(ctx context.Context, request GenieGetSpaceRequest) return &genieSpace, err } +func (a *genieImpl) ListConversationMessages(ctx context.Context, request GenieListConversationMessagesRequest) (*GenieListConversationMessagesResponse, error) { + var genieListConversationMessagesResponse GenieListConversationMessagesResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages", request.SpaceId, request.ConversationId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieListConversationMessagesResponse) + return &genieListConversationMessagesResponse, err +} + func (a *genieImpl) ListConversations(ctx context.Context, request GenieListConversationsRequest) (*GenieListConversationsResponse, error) { var genieListConversationsResponse GenieListConversationsResponse path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations", request.SpaceId) @@ -127,6 +146,16 @@ func (a *genieImpl) ListSpaces(ctx context.Context, request GenieListSpacesReque return &genieListSpacesResponse, err } +func (a *genieImpl) SendMessageFeedback(ctx context.Context, request GenieSendMessageFeedbackRequest) error { + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/feedback", request.SpaceId, request.ConversationId, request.MessageId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) + return err +} + func (a *genieImpl) StartConversation(ctx context.Context, request GenieStartConversationMessageRequest) (*GenieStartConversationResponse, error) { var genieStartConversationResponse GenieStartConversationResponse path := fmt.Sprintf("/api/2.0/genie/spaces/%v/start-conversation", request.SpaceId) diff --git a/service/dashboards/interface.go b/service/dashboards/interface.go index 8abc6f1e0..8d97abbc7 100755 --- a/service/dashboards/interface.go +++ b/service/dashboards/interface.go @@ -23,11 +23,15 @@ type GenieService interface { // Delete a conversation. DeleteConversation(ctx context.Context, request GenieDeleteConversationRequest) error + // Delete a conversation message. + DeleteConversationMessage(ctx context.Context, request GenieDeleteConversationMessageRequest) error + // Execute the SQL for a message query attachment. Use this API when the // query attachment has expired and needs to be re-executed. ExecuteMessageAttachmentQuery(ctx context.Context, request GenieExecuteMessageAttachmentQueryRequest) (*GenieGetMessageQueryResultResponse, error) - // Execute the SQL query in the message. + // DEPRECATED: Use [Execute Message Attachment + // Query](:method:genie/executemessageattachmentquery) instead. ExecuteMessageQuery(ctx context.Context, request GenieExecuteMessageQueryRequest) (*GenieGetMessageQueryResultResponse, error) // Get message from conversation. @@ -38,25 +42,29 @@ type GenieService interface { // status is `EXECUTING_QUERY` OR `COMPLETED`. GetMessageAttachmentQueryResult(ctx context.Context, request GenieGetMessageAttachmentQueryResultRequest) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This - // is only available if a message has a query attachment and the message - // status is `EXECUTING_QUERY`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResult(ctx context.Context, request GenieGetMessageQueryResultRequest) (*GenieGetMessageQueryResultResponse, error) - // Get the result of SQL query if the message has a query attachment. This - // is only available if a message has a query attachment and the message - // status is `EXECUTING_QUERY` OR `COMPLETED`. + // DEPRECATED: Use [Get Message Attachment Query + // Result](:method:genie/getmessageattachmentqueryresult) instead. GetMessageQueryResultByAttachment(ctx context.Context, request GenieGetQueryResultByAttachmentRequest) (*GenieGetMessageQueryResultResponse, error) // Get details of a Genie Space. GetSpace(ctx context.Context, request GenieGetSpaceRequest) (*GenieSpace, error) + // List messages in a conversation + ListConversationMessages(ctx context.Context, request GenieListConversationMessagesRequest) (*GenieListConversationMessagesResponse, error) + // Get a list of conversations in a Genie Space. ListConversations(ctx context.Context, request GenieListConversationsRequest) (*GenieListConversationsResponse, error) // Get list of Genie Spaces. ListSpaces(ctx context.Context, request GenieListSpacesRequest) (*GenieListSpacesResponse, error) + // Send feedback for a message. + SendMessageFeedback(ctx context.Context, request GenieSendMessageFeedbackRequest) error + // Start a new conversation. StartConversation(ctx context.Context, request GenieStartConversationMessageRequest) (*GenieStartConversationResponse, error) diff --git a/service/dashboards/model.go b/service/dashboards/model.go index fc9e03ee4..fa600a770 100755 --- a/service/dashboards/model.go +++ b/service/dashboards/model.go @@ -270,6 +270,15 @@ type GenieCreateConversationMessageRequest struct { SpaceId string `json:"-" url:"-"` } +type GenieDeleteConversationMessageRequest struct { + // The ID associated with the conversation. + ConversationId string `json:"-" url:"-"` + // The ID associated with the message to delete. + MessageId string `json:"-" url:"-"` + // The ID associated with the Genie space where the message is located. + SpaceId string `json:"-" url:"-"` +} + type GenieDeleteConversationRequest struct { // The ID of the conversation to delete. ConversationId string `json:"-" url:"-"` @@ -297,6 +306,47 @@ type GenieExecuteMessageQueryRequest struct { SpaceId string `json:"-" url:"-"` } +// Feedback rating for Genie messages +type GenieFeedbackRating string + +const GenieFeedbackRatingNegative GenieFeedbackRating = `NEGATIVE` + +const GenieFeedbackRatingNone GenieFeedbackRating = `NONE` + +const GenieFeedbackRatingPositive GenieFeedbackRating = `POSITIVE` + +// String representation for [fmt.Print] +func (f *GenieFeedbackRating) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *GenieFeedbackRating) Set(v string) error { + switch v { + case `NEGATIVE`, `NONE`, `POSITIVE`: + *f = GenieFeedbackRating(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "NEGATIVE", "NONE", "POSITIVE"`, v) + } +} + +// Values returns all possible values for GenieFeedbackRating. +// +// There is no guarantee on the order of the values in the slice. +func (f *GenieFeedbackRating) Values() []GenieFeedbackRating { + return []GenieFeedbackRating{ + GenieFeedbackRatingNegative, + GenieFeedbackRatingNone, + GenieFeedbackRatingPositive, + } +} + +// Type always returns GenieFeedbackRating to satisfy [pflag.Value] interface +func (f *GenieFeedbackRating) Type() string { + return "GenieFeedbackRating" +} + type GenieGetConversationMessageRequest struct { // The ID associated with the target conversation. ConversationId string `json:"-" url:"-"` @@ -350,7 +400,48 @@ type GenieGetSpaceRequest struct { SpaceId string `json:"-" url:"-"` } +type GenieListConversationMessagesRequest struct { + // The ID of the conversation to list messages from + ConversationId string `json:"-" url:"-"` + // Maximum number of messages to return per page + PageSize int `json:"-" url:"page_size,omitempty"` + // Token to get the next page of results + PageToken string `json:"-" url:"page_token,omitempty"` + // The ID associated with the Genie space where the conversation is located + SpaceId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieListConversationMessagesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieListConversationMessagesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type GenieListConversationMessagesResponse struct { + // List of messages in the conversation. + Messages []GenieMessage `json:"messages,omitempty"` + // The token to use for retrieving the next page of results. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieListConversationMessagesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieListConversationMessagesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GenieListConversationsRequest struct { + // Include all conversations in the space across all users. Requires "Can + // Manage" permission on the space. + IncludeAll bool `json:"-" url:"include_all,omitempty"` // Maximum number of conversations to return per page PageSize int `json:"-" url:"page_size,omitempty"` // Token to get the next page of results @@ -505,6 +596,29 @@ func (s GenieResultMetadata) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type GenieSendMessageFeedbackRequest struct { + // The ID associated with the conversation. + ConversationId string `json:"-" url:"-"` + // The rating (POSITIVE, NEGATIVE, or NONE). + FeedbackRating GenieFeedbackRating `json:"feedback_rating"` + // Optional text feedback that will be stored as a comment. + FeedbackText string `json:"feedback_text,omitempty"` + // The ID associated with the message to provide feedback for. + MessageId string `json:"-" url:"-"` + // The ID associated with the Genie space where the message is located. + SpaceId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieSendMessageFeedbackRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieSendMessageFeedbackRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GenieSpace struct { // Description of the Genie Space Description string `json:"description,omitempty"` diff --git a/service/jobs/model.go b/service/jobs/model.go index 817f9c1bf..eb8e6e3c7 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -60,6 +60,9 @@ type BaseJob struct { // based on accessible budget policies of the run_as identity on job // creation or modification. EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + // The id of the usage policy used by this job for cost attribution + // purposes. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // Indicates if the job has more array properties (`tasks`, `job_clusters`) // that are not shown. They can be accessed via :method:jobs/get endpoint. // It is only relevant for API 2.2 :method:jobs/list requests with @@ -120,6 +123,9 @@ type BaseRun struct { // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` + // The id of the usage policy used by this run for cost attribution + // purposes. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The time at which this run ended in epoch milliseconds (milliseconds // since 1/1/1970 UTC). This field is set to 0 if the job is still running. EndTime int64 `json:"end_time,omitempty"` @@ -744,7 +750,7 @@ type CreateJob struct { Trigger *TriggerSettings `json:"trigger,omitempty"` // The id of the user specified usage policy to use for this job. If not // specified, a default usage policy may be applied when creating or - // modifying the job. See `effective_budget_policy_id` for the budget policy + // modifying the job. See `effective_usage_policy_id` for the usage policy // used by this workload. UsagePolicyId string `json:"usage_policy_id,omitempty"` // A collection of system notification IDs to notify when runs of this job @@ -1605,6 +1611,9 @@ type Job struct { // based on accessible budget policies of the run_as identity on job // creation or modification. EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + // The id of the usage policy used by this job for cost attribution + // purposes. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // Indicates if the job has more array properties (`tasks`, `job_clusters`) // that are not shown. They can be accessed via :method:jobs/get endpoint. // It is only relevant for API 2.2 :method:jobs/list requests with @@ -2150,7 +2159,7 @@ type JobSettings struct { Trigger *TriggerSettings `json:"trigger,omitempty"` // The id of the user specified usage policy to use for this job. If not // specified, a default usage policy may be applied when creating or - // modifying the job. See `effective_budget_policy_id` for the budget policy + // modifying the job. See `effective_usage_policy_id` for the usage policy // used by this workload. UsagePolicyId string `json:"usage_policy_id,omitempty"` // A collection of system notification IDs to notify when runs of this job @@ -3266,6 +3275,9 @@ type Run struct { // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` + // The id of the usage policy used by this run for cost attribution + // purposes. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The time at which this run ended in epoch milliseconds (milliseconds // since 1/1/1970 UTC). This field is set to 0 if the job is still running. EndTime int64 `json:"end_time,omitempty"` diff --git a/service/pkg.go b/service/pkg.go index 975b8fd71..109371b59 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -20,6 +20,8 @@ // // - [apps.AppsAPI]: Apps run directly on a customer’s Databricks instance, integrate with their data, use and extend Databricks services, and enable users to interact through single sign-on. // +// - [apps.AppsSettingsAPI]: Apps Settings manage the settings for the Apps service on a customer's Databricks instance. +// // - [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. @@ -62,10 +64,10 @@ // // - [marketplace.ConsumerProvidersAPI]: Providers are the entities that publish listings to the Marketplace. // -// - [catalog.CredentialsAPI]: A credential represents an authentication and authorization mechanism for accessing services on your cloud tenant. -// // - [provisioning.CredentialsAPI]: These APIs manage credential configurations for this workspace. // +// - [catalog.CredentialsAPI]: A credential represents an authentication and authorization mechanism for accessing services on your cloud tenant. +// // - [settings.CredentialsManagerAPI]: Credentials manager interacts with with Identity Providers to to perform token exchanges using stored credentials and refresh tokens. // // - [settings.CspEnablementAccountAPI]: The compliance security profile settings at the account level control whether to enable it for new workspaces. @@ -110,6 +112,8 @@ // // - [settings.EnhancedSecurityMonitoringAPI]: Controls whether enhanced security monitoring is enabled for the current workspace. // +// - [catalog.EntityTagAssignmentsAPI]: Tags are attributes that include keys and optional values that you can use to organize and categorize entities in Unity Catalog. +// // - [settings.EsmEnablementAccountAPI]: The enhanced security monitoring setting at the account level controls whether to enable the feature on new workspaces. // // - [ml.ExperimentsAPI]: Experiments are the primary unit of organization in MLflow; all MLflow runs belong to an experiment. @@ -256,6 +260,8 @@ // // - [settings.RestrictWorkspaceAdminsAPI]: The Restrict Workspace Admins setting lets you control the capabilities of workspace admins. // +// - [catalog.RfaAPI]: Request for Access enables customers to request access to and manage access request destinations for Unity Catalog securables. +// // - [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. @@ -278,6 +284,8 @@ // // - [settings.AccountSettingsAPI]: Accounts Settings API allows users to manage settings at the account level. // +// - [settingsv2.AccountSettingsV2API]: APIs to manage account level settings. +// // - [sharing.SharesAPI]: A share is a container instantiated with :method:shares/create. // // - [settings.SqlResultsDownloadAPI]: Controls whether users within the workspace are allowed to download results from the SQL Editor and AI/BI Dashboards UIs. @@ -296,6 +304,8 @@ // // - [catalog.TablesAPI]: A table resides in the third layer of Unity Catalog’s three-level namespace. // +// - [tags.TagPoliciesAPI]: The Tag Policy API allows you to manage tag policies in Databricks. +// // - [catalog.TemporaryPathCredentialsAPI]: Temporary Path Credentials refer to short-lived, downscoped credentials used to access external cloud storage locations registered in Databricks. // // - [catalog.TemporaryTableCredentialsAPI]: Temporary Table Credentials refer to short-lived, downscoped credentials used to access cloud storage locations where table data is stored in Databricks. @@ -330,6 +340,8 @@ // // - [settings.WorkspaceNetworkConfigurationAPI]: These APIs allow configuration of network settings for Databricks workspaces by selecting which network policy to associate with the workspace. // +// - [settingsv2.WorkspaceSettingsV2API]: APIs to manage workspace level settings. +// // - [provisioning.WorkspacesAPI]: These APIs manage workspaces for this account. package service @@ -353,8 +365,10 @@ import ( "github.com/databricks/databricks-sdk-go/service/qualitymonitorv2" "github.com/databricks/databricks-sdk-go/service/serving" "github.com/databricks/databricks-sdk-go/service/settings" + "github.com/databricks/databricks-sdk-go/service/settingsv2" "github.com/databricks/databricks-sdk-go/service/sharing" "github.com/databricks/databricks-sdk-go/service/sql" + "github.com/databricks/databricks-sdk-go/service/tags" "github.com/databricks/databricks-sdk-go/service/vectorsearch" "github.com/databricks/databricks-sdk-go/service/workspace" ) @@ -374,6 +388,7 @@ var ( _ *sql.AlertsLegacyAPI = nil _ *sql.AlertsV2API = nil _ *apps.AppsAPI = nil + _ *apps.AppsSettingsAPI = nil _ *catalog.ArtifactAllowlistsAPI = nil _ *settings.AutomaticClusterUpdateAPI = nil _ *billing.BillableUsageAPI = nil @@ -419,6 +434,7 @@ var ( _ *settings.EnableResultsDownloadingAPI = nil _ *provisioning.EncryptionKeysAPI = nil _ *settings.EnhancedSecurityMonitoringAPI = nil + _ *catalog.EntityTagAssignmentsAPI = nil _ *settings.EsmEnablementAccountAPI = nil _ *ml.ExperimentsAPI = nil _ *catalog.ExternalLineageAPI = nil @@ -492,6 +508,7 @@ var ( _ *workspace.ReposAPI = nil _ *catalog.ResourceQuotasAPI = nil _ *settings.RestrictWorkspaceAdminsAPI = nil + _ *catalog.RfaAPI = nil _ *catalog.SchemasAPI = nil _ *workspace.SecretsAPI = nil _ *oauth2.ServicePrincipalFederationPolicyAPI = nil @@ -503,6 +520,7 @@ var ( _ *serving.ServingEndpointsDataPlaneAPI = nil _ *settings.SettingsAPI = nil _ *settings.AccountSettingsAPI = nil + _ *settingsv2.AccountSettingsV2API = nil _ *sharing.SharesAPI = nil _ *settings.SqlResultsDownloadAPI = nil _ *sql.StatementExecutionAPI = nil @@ -512,6 +530,7 @@ var ( _ *catalog.SystemSchemasAPI = nil _ *catalog.TableConstraintsAPI = nil _ *catalog.TablesAPI = nil + _ *tags.TagPoliciesAPI = nil _ *catalog.TemporaryPathCredentialsAPI = nil _ *catalog.TemporaryTableCredentialsAPI = nil _ *settings.TokenManagementAPI = nil @@ -529,5 +548,6 @@ var ( _ *catalog.WorkspaceBindingsAPI = nil _ *settings.WorkspaceConfAPI = nil _ *settings.WorkspaceNetworkConfigurationAPI = nil + _ *settingsv2.WorkspaceSettingsV2API = nil _ *provisioning.WorkspacesAPI = nil ) diff --git a/service/serving/model.go b/service/serving/model.go index 3472ae2c8..f72b19ffa 100755 --- a/service/serving/model.go +++ b/service/serving/model.go @@ -168,6 +168,9 @@ type AiGatewayRateLimit struct { // Renewal period field for a rate limit. Currently, only 'minute' is // supported. RenewalPeriod AiGatewayRateLimitRenewalPeriod `json:"renewal_period"` + // Used to specify how many tokens are allowed for a key within the + // renewal_period. + Tokens int64 `json:"tokens,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -2255,6 +2258,8 @@ type ServingEndpoint struct { Tags []EndpointTag `json:"tags,omitempty"` // The task type of the serving endpoint. Task string `json:"task,omitempty"` + // The usage policy associated with serving endpoint. + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } diff --git a/service/settingsv2/api.go b/service/settingsv2/api.go new file mode 100755 index 000000000..8caef9ecb --- /dev/null +++ b/service/settingsv2/api.go @@ -0,0 +1,95 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +// These APIs allow you to manage Account Settings V2, Workspace Settings V2, etc. +package settingsv2 + +import ( + "context" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" +) + +type AccountSettingsV2Interface interface { + + // Get a setting value at account level + GetPublicAccountSetting(ctx context.Context, request GetPublicAccountSettingRequest) (*Setting, error) + + // List valid setting keys and metadata. These settings are available to + // referenced via [GET + // /api/2.1/settings/{name}](#~1api~1account~1settingsv2~1getpublicaccountsetting) + // and [PATCH + // /api/2.1/settings/{name}](#~1api~1account~1settingsv2~patchpublicaccountsetting) + // APIs + // + // This method is generated by Databricks SDK Code Generator. + ListAccountSettingsMetadata(ctx context.Context, request ListAccountSettingsMetadataRequest) listing.Iterator[SettingsMetadata] + + // List valid setting keys and metadata. These settings are available to + // referenced via [GET + // /api/2.1/settings/{name}](#~1api~1account~1settingsv2~1getpublicaccountsetting) + // and [PATCH + // /api/2.1/settings/{name}](#~1api~1account~1settingsv2~patchpublicaccountsetting) + // APIs + // + // This method is generated by Databricks SDK Code Generator. + ListAccountSettingsMetadataAll(ctx context.Context, request ListAccountSettingsMetadataRequest) ([]SettingsMetadata, error) + + // Patch a setting value at account level + PatchPublicAccountSetting(ctx context.Context, request PatchPublicAccountSettingRequest) (*Setting, error) +} + +func NewAccountSettingsV2(client *client.DatabricksClient) *AccountSettingsV2API { + return &AccountSettingsV2API{ + accountSettingsV2Impl: accountSettingsV2Impl{ + client: client, + }, + } +} + +// APIs to manage account level settings +type AccountSettingsV2API struct { + accountSettingsV2Impl +} + +type WorkspaceSettingsV2Interface interface { + + // Get a setting value at workspace level + GetPublicWorkspaceSetting(ctx context.Context, request GetPublicWorkspaceSettingRequest) (*Setting, error) + + // List valid setting keys and metadata. These settings are available to + // referenced via [GET + // /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~1getpublicworkspacesetting) + // and [PATCH + // /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~patchpublicworkspacesetting) + // APIs + // + // This method is generated by Databricks SDK Code Generator. + ListWorkspaceSettingsMetadata(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) listing.Iterator[SettingsMetadata] + + // List valid setting keys and metadata. These settings are available to + // referenced via [GET + // /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~1getpublicworkspacesetting) + // and [PATCH + // /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~patchpublicworkspacesetting) + // APIs + // + // This method is generated by Databricks SDK Code Generator. + ListWorkspaceSettingsMetadataAll(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) ([]SettingsMetadata, error) + + // Patch a setting value at workspace level + PatchPublicWorkspaceSetting(ctx context.Context, request PatchPublicWorkspaceSettingRequest) (*Setting, error) +} + +func NewWorkspaceSettingsV2(client *client.DatabricksClient) *WorkspaceSettingsV2API { + return &WorkspaceSettingsV2API{ + workspaceSettingsV2Impl: workspaceSettingsV2Impl{ + client: client, + }, + } +} + +// APIs to manage workspace level settings +type WorkspaceSettingsV2API struct { + workspaceSettingsV2Impl +} diff --git a/service/settingsv2/impl.go b/service/settingsv2/impl.go new file mode 100755 index 000000000..3d94ab529 --- /dev/null +++ b/service/settingsv2/impl.go @@ -0,0 +1,167 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package settingsv2 + +import ( + "context" + "fmt" + "net/http" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/useragent" +) + +// unexported type that holds implementations of just AccountSettingsV2 API methods +type accountSettingsV2Impl struct { + client *client.DatabricksClient +} + +func (a *accountSettingsV2Impl) GetPublicAccountSetting(ctx context.Context, request GetPublicAccountSettingRequest) (*Setting, error) { + var setting Setting + path := fmt.Sprintf("/api/2.1/accounts/%v/settings/%v", a.client.ConfiguredAccountID(), request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &setting) + return &setting, err +} + +// List valid setting keys and metadata. These settings are available to +// referenced via [GET +// /api/2.1/settings/{name}](#~1api~1account~1settingsv2~1getpublicaccountsetting) +// and [PATCH +// /api/2.1/settings/{name}](#~1api~1account~1settingsv2~patchpublicaccountsetting) +// APIs +func (a *accountSettingsV2Impl) ListAccountSettingsMetadata(ctx context.Context, request ListAccountSettingsMetadataRequest) listing.Iterator[SettingsMetadata] { + + getNextPage := func(ctx context.Context, req ListAccountSettingsMetadataRequest) (*ListAccountSettingsMetadataResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListAccountSettingsMetadata(ctx, req) + } + getItems := func(resp *ListAccountSettingsMetadataResponse) []SettingsMetadata { + return resp.SettingsMetadata + } + getNextReq := func(resp *ListAccountSettingsMetadataResponse) *ListAccountSettingsMetadataRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List valid setting keys and metadata. These settings are available to +// referenced via [GET +// /api/2.1/settings/{name}](#~1api~1account~1settingsv2~1getpublicaccountsetting) +// and [PATCH +// /api/2.1/settings/{name}](#~1api~1account~1settingsv2~patchpublicaccountsetting) +// APIs +func (a *accountSettingsV2Impl) ListAccountSettingsMetadataAll(ctx context.Context, request ListAccountSettingsMetadataRequest) ([]SettingsMetadata, error) { + iterator := a.ListAccountSettingsMetadata(ctx, request) + return listing.ToSlice[SettingsMetadata](ctx, iterator) +} + +func (a *accountSettingsV2Impl) internalListAccountSettingsMetadata(ctx context.Context, request ListAccountSettingsMetadataRequest) (*ListAccountSettingsMetadataResponse, error) { + var listAccountSettingsMetadataResponse ListAccountSettingsMetadataResponse + path := fmt.Sprintf("/api/2.1/accounts/%v/settings-metadata", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAccountSettingsMetadataResponse) + return &listAccountSettingsMetadataResponse, err +} + +func (a *accountSettingsV2Impl) PatchPublicAccountSetting(ctx context.Context, request PatchPublicAccountSettingRequest) (*Setting, error) { + var setting Setting + path := fmt.Sprintf("/api/2.1/accounts/%v/settings/%v", a.client.ConfiguredAccountID(), request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Setting, &setting) + return &setting, err +} + +// unexported type that holds implementations of just WorkspaceSettingsV2 API methods +type workspaceSettingsV2Impl struct { + client *client.DatabricksClient +} + +func (a *workspaceSettingsV2Impl) GetPublicWorkspaceSetting(ctx context.Context, request GetPublicWorkspaceSettingRequest) (*Setting, error) { + var setting Setting + path := fmt.Sprintf("/api/2.1/settings/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &setting) + return &setting, err +} + +// List valid setting keys and metadata. These settings are available to +// referenced via [GET +// /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~1getpublicworkspacesetting) +// and [PATCH +// /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~patchpublicworkspacesetting) +// APIs +func (a *workspaceSettingsV2Impl) ListWorkspaceSettingsMetadata(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) listing.Iterator[SettingsMetadata] { + + getNextPage := func(ctx context.Context, req ListWorkspaceSettingsMetadataRequest) (*ListWorkspaceSettingsMetadataResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListWorkspaceSettingsMetadata(ctx, req) + } + getItems := func(resp *ListWorkspaceSettingsMetadataResponse) []SettingsMetadata { + return resp.SettingsMetadata + } + getNextReq := func(resp *ListWorkspaceSettingsMetadataResponse) *ListWorkspaceSettingsMetadataRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List valid setting keys and metadata. These settings are available to +// referenced via [GET +// /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~1getpublicworkspacesetting) +// and [PATCH +// /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~patchpublicworkspacesetting) +// APIs +func (a *workspaceSettingsV2Impl) ListWorkspaceSettingsMetadataAll(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) ([]SettingsMetadata, error) { + iterator := a.ListWorkspaceSettingsMetadata(ctx, request) + return listing.ToSlice[SettingsMetadata](ctx, iterator) +} + +func (a *workspaceSettingsV2Impl) internalListWorkspaceSettingsMetadata(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) (*ListWorkspaceSettingsMetadataResponse, error) { + var listWorkspaceSettingsMetadataResponse ListWorkspaceSettingsMetadataResponse + path := "/api/2.1/settings-metadata" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listWorkspaceSettingsMetadataResponse) + return &listWorkspaceSettingsMetadataResponse, err +} + +func (a *workspaceSettingsV2Impl) PatchPublicWorkspaceSetting(ctx context.Context, request PatchPublicWorkspaceSettingRequest) (*Setting, error) { + var setting Setting + path := fmt.Sprintf("/api/2.1/settings/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Setting, &setting) + return &setting, err +} diff --git a/service/settingsv2/interface.go b/service/settingsv2/interface.go new file mode 100755 index 000000000..44887c847 --- /dev/null +++ b/service/settingsv2/interface.go @@ -0,0 +1,47 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package settingsv2 + +import ( + "context" +) + +// APIs to manage account level settings +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type AccountSettingsV2Service interface { + + // Get a setting value at account level + GetPublicAccountSetting(ctx context.Context, request GetPublicAccountSettingRequest) (*Setting, error) + + // List valid setting keys and metadata. These settings are available to + // referenced via [GET + // /api/2.1/settings/{name}](#~1api~1account~1settingsv2~1getpublicaccountsetting) + // and [PATCH + // /api/2.1/settings/{name}](#~1api~1account~1settingsv2~patchpublicaccountsetting) + // APIs + ListAccountSettingsMetadata(ctx context.Context, request ListAccountSettingsMetadataRequest) (*ListAccountSettingsMetadataResponse, error) + + // Patch a setting value at account level + PatchPublicAccountSetting(ctx context.Context, request PatchPublicAccountSettingRequest) (*Setting, error) +} + +// APIs to manage workspace level settings +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type WorkspaceSettingsV2Service interface { + + // Get a setting value at workspace level + GetPublicWorkspaceSetting(ctx context.Context, request GetPublicWorkspaceSettingRequest) (*Setting, error) + + // List valid setting keys and metadata. These settings are available to + // referenced via [GET + // /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~1getpublicworkspacesetting) + // and [PATCH + // /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~patchpublicworkspacesetting) + // APIs + ListWorkspaceSettingsMetadata(ctx context.Context, request ListWorkspaceSettingsMetadataRequest) (*ListWorkspaceSettingsMetadataResponse, error) + + // Patch a setting value at workspace level + PatchPublicWorkspaceSetting(ctx context.Context, request PatchPublicWorkspaceSettingRequest) (*Setting, error) +} diff --git a/service/settingsv2/model.go b/service/settingsv2/model.go new file mode 100755 index 000000000..26c90016f --- /dev/null +++ b/service/settingsv2/model.go @@ -0,0 +1,597 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package settingsv2 + +import ( + "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" +) + +type AibiDashboardEmbeddingAccessPolicy struct { + AccessPolicyType AibiDashboardEmbeddingAccessPolicyAccessPolicyType `json:"access_policy_type"` +} + +type AibiDashboardEmbeddingAccessPolicyAccessPolicyType string + +const AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeAllowAllDomains AibiDashboardEmbeddingAccessPolicyAccessPolicyType = `ALLOW_ALL_DOMAINS` + +const AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeAllowApprovedDomains AibiDashboardEmbeddingAccessPolicyAccessPolicyType = `ALLOW_APPROVED_DOMAINS` + +const AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeDenyAllDomains AibiDashboardEmbeddingAccessPolicyAccessPolicyType = `DENY_ALL_DOMAINS` + +// String representation for [fmt.Print] +func (f *AibiDashboardEmbeddingAccessPolicyAccessPolicyType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AibiDashboardEmbeddingAccessPolicyAccessPolicyType) Set(v string) error { + switch v { + case `ALLOW_ALL_DOMAINS`, `ALLOW_APPROVED_DOMAINS`, `DENY_ALL_DOMAINS`: + *f = AibiDashboardEmbeddingAccessPolicyAccessPolicyType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ALLOW_ALL_DOMAINS", "ALLOW_APPROVED_DOMAINS", "DENY_ALL_DOMAINS"`, v) + } +} + +// Values returns all possible values for AibiDashboardEmbeddingAccessPolicyAccessPolicyType. +// +// There is no guarantee on the order of the values in the slice. +func (f *AibiDashboardEmbeddingAccessPolicyAccessPolicyType) Values() []AibiDashboardEmbeddingAccessPolicyAccessPolicyType { + return []AibiDashboardEmbeddingAccessPolicyAccessPolicyType{ + AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeAllowAllDomains, + AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeAllowApprovedDomains, + AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeDenyAllDomains, + } +} + +// Type always returns AibiDashboardEmbeddingAccessPolicyAccessPolicyType to satisfy [pflag.Value] interface +func (f *AibiDashboardEmbeddingAccessPolicyAccessPolicyType) Type() string { + return "AibiDashboardEmbeddingAccessPolicyAccessPolicyType" +} + +type AibiDashboardEmbeddingApprovedDomains struct { + ApprovedDomains []string `json:"approved_domains,omitempty"` +} + +type BooleanMessage struct { + Value bool `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *BooleanMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s BooleanMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ClusterAutoRestartMessage struct { + CanToggle bool `json:"can_toggle,omitempty"` + + Enabled bool `json:"enabled,omitempty"` + + EnablementDetails *ClusterAutoRestartMessageEnablementDetails `json:"enablement_details,omitempty"` + + MaintenanceWindow *ClusterAutoRestartMessageMaintenanceWindow `json:"maintenance_window,omitempty"` + + RestartEvenIfNoUpdatesAvailable bool `json:"restart_even_if_no_updates_available,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ClusterAutoRestartMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ClusterAutoRestartMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Contains an information about the enablement status judging (e.g. whether the +// enterprise tier is enabled) This is only additional information that MUST NOT +// be used to decide whether the setting is enabled or not. This is intended to +// use only for purposes like showing an error message to the customer with the +// additional details. For example, using these details we can check why exactly +// the feature is disabled for this customer. +type ClusterAutoRestartMessageEnablementDetails struct { + // The feature is force enabled if compliance mode is active + ForcedForComplianceMode bool `json:"forced_for_compliance_mode,omitempty"` + // The feature is unavailable if the corresponding entitlement disabled (see + // getShieldEntitlementEnable) + UnavailableForDisabledEntitlement bool `json:"unavailable_for_disabled_entitlement,omitempty"` + // The feature is unavailable if the customer doesn't have enterprise tier + UnavailableForNonEnterpriseTier bool `json:"unavailable_for_non_enterprise_tier,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ClusterAutoRestartMessageEnablementDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ClusterAutoRestartMessageEnablementDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ClusterAutoRestartMessageMaintenanceWindow struct { + WeekDayBasedSchedule *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule `json:"week_day_based_schedule,omitempty"` +} + +type ClusterAutoRestartMessageMaintenanceWindowDayOfWeek string + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekFriday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `FRIDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekMonday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `MONDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekSaturday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `SATURDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekSunday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `SUNDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekThursday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `THURSDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekTuesday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `TUESDAY` + +const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekWednesday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `WEDNESDAY` + +// String representation for [fmt.Print] +func (f *ClusterAutoRestartMessageMaintenanceWindowDayOfWeek) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ClusterAutoRestartMessageMaintenanceWindowDayOfWeek) Set(v string) error { + switch v { + case `FRIDAY`, `MONDAY`, `SATURDAY`, `SUNDAY`, `THURSDAY`, `TUESDAY`, `WEDNESDAY`: + *f = ClusterAutoRestartMessageMaintenanceWindowDayOfWeek(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "FRIDAY", "MONDAY", "SATURDAY", "SUNDAY", "THURSDAY", "TUESDAY", "WEDNESDAY"`, v) + } +} + +// Values returns all possible values for ClusterAutoRestartMessageMaintenanceWindowDayOfWeek. +// +// There is no guarantee on the order of the values in the slice. +func (f *ClusterAutoRestartMessageMaintenanceWindowDayOfWeek) Values() []ClusterAutoRestartMessageMaintenanceWindowDayOfWeek { + return []ClusterAutoRestartMessageMaintenanceWindowDayOfWeek{ + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekFriday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekMonday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekSaturday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekSunday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekThursday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekTuesday, + ClusterAutoRestartMessageMaintenanceWindowDayOfWeekWednesday, + } +} + +// Type always returns ClusterAutoRestartMessageMaintenanceWindowDayOfWeek to satisfy [pflag.Value] interface +func (f *ClusterAutoRestartMessageMaintenanceWindowDayOfWeek) Type() string { + return "ClusterAutoRestartMessageMaintenanceWindowDayOfWeek" +} + +type ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule struct { + DayOfWeek ClusterAutoRestartMessageMaintenanceWindowDayOfWeek `json:"day_of_week,omitempty"` + + Frequency ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency `json:"frequency,omitempty"` + + WindowStartTime *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime `json:"window_start_time,omitempty"` +} + +type ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency string + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyEveryWeek ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `EVERY_WEEK` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFirstAndThirdOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `FIRST_AND_THIRD_OF_MONTH` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFirstOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `FIRST_OF_MONTH` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFourthOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `FOURTH_OF_MONTH` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencySecondAndFourthOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `SECOND_AND_FOURTH_OF_MONTH` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencySecondOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `SECOND_OF_MONTH` + +const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyThirdOfMonth ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `THIRD_OF_MONTH` + +// String representation for [fmt.Print] +func (f *ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency) Set(v string) error { + switch v { + case `EVERY_WEEK`, `FIRST_AND_THIRD_OF_MONTH`, `FIRST_OF_MONTH`, `FOURTH_OF_MONTH`, `SECOND_AND_FOURTH_OF_MONTH`, `SECOND_OF_MONTH`, `THIRD_OF_MONTH`: + *f = ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "EVERY_WEEK", "FIRST_AND_THIRD_OF_MONTH", "FIRST_OF_MONTH", "FOURTH_OF_MONTH", "SECOND_AND_FOURTH_OF_MONTH", "SECOND_OF_MONTH", "THIRD_OF_MONTH"`, v) + } +} + +// Values returns all possible values for ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency. +// +// There is no guarantee on the order of the values in the slice. +func (f *ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency) Values() []ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency { + return []ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency{ + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyEveryWeek, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFirstAndThirdOfMonth, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFirstOfMonth, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyFourthOfMonth, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencySecondAndFourthOfMonth, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencySecondOfMonth, + ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyThirdOfMonth, + } +} + +// Type always returns ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency to satisfy [pflag.Value] interface +func (f *ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency) Type() string { + return "ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency" +} + +type ClusterAutoRestartMessageMaintenanceWindowWindowStartTime struct { + Hours int `json:"hours,omitempty"` + + Minutes int `json:"minutes,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Changes the behaviour of Jobs service when creating job clusters. +// +// Before this setting is introduced, all workspaces with metastore attached had +// behaviour matching SINGLE_USER setting. +// +// See: - go/defaultdatasecuritymode - go/defaultdatasecuritymode/setting - +// go/datasecuritymode +type DefaultDataSecurityModeMessage struct { + Status DefaultDataSecurityModeMessageStatus `json:"status"` +} + +type DefaultDataSecurityModeMessageStatus string + +const DefaultDataSecurityModeMessageStatusNotSet DefaultDataSecurityModeMessageStatus = `NOT_SET` + +const DefaultDataSecurityModeMessageStatusSingleUser DefaultDataSecurityModeMessageStatus = `SINGLE_USER` + +const DefaultDataSecurityModeMessageStatusUserIsolation DefaultDataSecurityModeMessageStatus = `USER_ISOLATION` + +// String representation for [fmt.Print] +func (f *DefaultDataSecurityModeMessageStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DefaultDataSecurityModeMessageStatus) Set(v string) error { + switch v { + case `NOT_SET`, `SINGLE_USER`, `USER_ISOLATION`: + *f = DefaultDataSecurityModeMessageStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "NOT_SET", "SINGLE_USER", "USER_ISOLATION"`, v) + } +} + +// Values returns all possible values for DefaultDataSecurityModeMessageStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *DefaultDataSecurityModeMessageStatus) Values() []DefaultDataSecurityModeMessageStatus { + return []DefaultDataSecurityModeMessageStatus{ + DefaultDataSecurityModeMessageStatusNotSet, + DefaultDataSecurityModeMessageStatusSingleUser, + DefaultDataSecurityModeMessageStatusUserIsolation, + } +} + +// Type always returns DefaultDataSecurityModeMessageStatus to satisfy [pflag.Value] interface +func (f *DefaultDataSecurityModeMessageStatus) Type() string { + return "DefaultDataSecurityModeMessageStatus" +} + +type GetPublicAccountSettingRequest struct { + Name string `json:"-" url:"-"` +} + +type GetPublicWorkspaceSettingRequest struct { + Name string `json:"-" url:"-"` +} + +type IntegerMessage struct { + Value int `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *IntegerMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s IntegerMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListAccountSettingsMetadataRequest struct { + // The maximum number of settings to return. The service may return fewer + // than this value. If unspecified, at most 200 settings will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous + // `ListAccountSettingsMetadataRequest` call. Provide this to retrieve the + // subsequent page. + // + // When paginating, all other parameters provided to + // `ListAccountSettingsMetadataRequest` must match the call that provided + // the page token. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListAccountSettingsMetadataRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListAccountSettingsMetadataRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListAccountSettingsMetadataResponse struct { + // A token that can be sent as `page_token` to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + // List of all settings available via public APIs and their metadata + SettingsMetadata []SettingsMetadata `json:"settings_metadata,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListAccountSettingsMetadataResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListAccountSettingsMetadataResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListWorkspaceSettingsMetadataRequest struct { + // The maximum number of settings to return. The service may return fewer + // than this value. If unspecified, at most 200 settings will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous + // `ListWorkspaceSettingsMetadataRequest` call. Provide this to retrieve the + // subsequent page. + // + // When paginating, all other parameters provided to + // `ListWorkspaceSettingsMetadataRequest` must match the call that provided + // the page token. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListWorkspaceSettingsMetadataRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListWorkspaceSettingsMetadataRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListWorkspaceSettingsMetadataResponse struct { + // A token that can be sent as `page_token` to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + // List of all settings available via public APIs and their metadata + SettingsMetadata []SettingsMetadata `json:"settings_metadata,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListWorkspaceSettingsMetadataResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListWorkspaceSettingsMetadataResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type PatchPublicAccountSettingRequest struct { + Name string `json:"-" url:"-"` + + Setting Setting `json:"setting"` +} + +type PatchPublicWorkspaceSettingRequest struct { + Name string `json:"-" url:"-"` + + Setting Setting `json:"setting"` +} + +type PersonalComputeMessage struct { + Value PersonalComputeMessagePersonalComputeMessageEnum `json:"value,omitempty"` +} + +// ON: Grants all users in all workspaces access to the Personal Compute default +// policy, allowing all users to create single-machine compute resources. +// DELEGATE: Moves access control for the Personal Compute default policy to +// individual workspaces and requires a workspace’s users or groups to be +// added to the ACLs of that workspace’s Personal Compute default policy +// before they will be able to create compute resources through that policy. +type PersonalComputeMessagePersonalComputeMessageEnum string + +const PersonalComputeMessagePersonalComputeMessageEnumDelegate PersonalComputeMessagePersonalComputeMessageEnum = `DELEGATE` + +const PersonalComputeMessagePersonalComputeMessageEnumOn PersonalComputeMessagePersonalComputeMessageEnum = `ON` + +// String representation for [fmt.Print] +func (f *PersonalComputeMessagePersonalComputeMessageEnum) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *PersonalComputeMessagePersonalComputeMessageEnum) Set(v string) error { + switch v { + case `DELEGATE`, `ON`: + *f = PersonalComputeMessagePersonalComputeMessageEnum(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DELEGATE", "ON"`, v) + } +} + +// Values returns all possible values for PersonalComputeMessagePersonalComputeMessageEnum. +// +// There is no guarantee on the order of the values in the slice. +func (f *PersonalComputeMessagePersonalComputeMessageEnum) Values() []PersonalComputeMessagePersonalComputeMessageEnum { + return []PersonalComputeMessagePersonalComputeMessageEnum{ + PersonalComputeMessagePersonalComputeMessageEnumDelegate, + PersonalComputeMessagePersonalComputeMessageEnumOn, + } +} + +// Type always returns PersonalComputeMessagePersonalComputeMessageEnum to satisfy [pflag.Value] interface +func (f *PersonalComputeMessagePersonalComputeMessageEnum) Type() string { + return "PersonalComputeMessagePersonalComputeMessageEnum" +} + +type RestrictWorkspaceAdminsMessage struct { + Status RestrictWorkspaceAdminsMessageStatus `json:"status"` +} + +type RestrictWorkspaceAdminsMessageStatus string + +const RestrictWorkspaceAdminsMessageStatusAllowAll RestrictWorkspaceAdminsMessageStatus = `ALLOW_ALL` + +const RestrictWorkspaceAdminsMessageStatusRestrictTokensAndJobRunAs RestrictWorkspaceAdminsMessageStatus = `RESTRICT_TOKENS_AND_JOB_RUN_AS` + +// String representation for [fmt.Print] +func (f *RestrictWorkspaceAdminsMessageStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *RestrictWorkspaceAdminsMessageStatus) Set(v string) error { + switch v { + case `ALLOW_ALL`, `RESTRICT_TOKENS_AND_JOB_RUN_AS`: + *f = RestrictWorkspaceAdminsMessageStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ALLOW_ALL", "RESTRICT_TOKENS_AND_JOB_RUN_AS"`, v) + } +} + +// Values returns all possible values for RestrictWorkspaceAdminsMessageStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *RestrictWorkspaceAdminsMessageStatus) Values() []RestrictWorkspaceAdminsMessageStatus { + return []RestrictWorkspaceAdminsMessageStatus{ + RestrictWorkspaceAdminsMessageStatusAllowAll, + RestrictWorkspaceAdminsMessageStatusRestrictTokensAndJobRunAs, + } +} + +// Type always returns RestrictWorkspaceAdminsMessageStatus to satisfy [pflag.Value] interface +func (f *RestrictWorkspaceAdminsMessageStatus) Type() string { + return "RestrictWorkspaceAdminsMessageStatus" +} + +type Setting struct { + AibiDashboardEmbeddingAccessPolicy *AibiDashboardEmbeddingAccessPolicy `json:"aibi_dashboard_embedding_access_policy,omitempty"` + + AibiDashboardEmbeddingApprovedDomains *AibiDashboardEmbeddingApprovedDomains `json:"aibi_dashboard_embedding_approved_domains,omitempty"` + // todo: Mark these Public after onboarded to DSL + AutomaticClusterUpdateWorkspace *ClusterAutoRestartMessage `json:"automatic_cluster_update_workspace,omitempty"` + + BooleanVal *BooleanMessage `json:"boolean_val,omitempty"` + + DefaultDataSecurityMode *DefaultDataSecurityModeMessage `json:"default_data_security_mode,omitempty"` + + EffectiveAibiDashboardEmbeddingAccessPolicy *AibiDashboardEmbeddingAccessPolicy `json:"effective_aibi_dashboard_embedding_access_policy,omitempty"` + + EffectiveAibiDashboardEmbeddingApprovedDomains *AibiDashboardEmbeddingApprovedDomains `json:"effective_aibi_dashboard_embedding_approved_domains,omitempty"` + + EffectiveAutomaticClusterUpdateWorkspace *ClusterAutoRestartMessage `json:"effective_automatic_cluster_update_workspace,omitempty"` + + EffectiveBooleanVal *BooleanMessage `json:"effective_boolean_val,omitempty"` + + EffectiveDefaultDataSecurityMode *DefaultDataSecurityModeMessage `json:"effective_default_data_security_mode,omitempty"` + + EffectiveIntegerVal *IntegerMessage `json:"effective_integer_val,omitempty"` + + EffectivePersonalCompute *PersonalComputeMessage `json:"effective_personal_compute,omitempty"` + + EffectiveRestrictWorkspaceAdmins *RestrictWorkspaceAdminsMessage `json:"effective_restrict_workspace_admins,omitempty"` + + EffectiveStringVal *StringMessage `json:"effective_string_val,omitempty"` + + IntegerVal *IntegerMessage `json:"integer_val,omitempty"` + // Name of the setting. + Name string `json:"name,omitempty"` + + PersonalCompute *PersonalComputeMessage `json:"personal_compute,omitempty"` + + RestrictWorkspaceAdmins *RestrictWorkspaceAdminsMessage `json:"restrict_workspace_admins,omitempty"` + + StringVal *StringMessage `json:"string_val,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Setting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Setting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type SettingsMetadata struct { + // Setting description for what this setting controls + Description string `json:"description,omitempty"` + // Link to databricks documentation for the setting + DocsLink string `json:"docs_link,omitempty"` + // Name of the setting. + Name string `json:"name,omitempty"` + // Type of the setting. To set this setting, the value sent must match this + // type. + Type string `json:"type,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *SettingsMetadata) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SettingsMetadata) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type StringMessage struct { + // Represents a generic string value. + Value string `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *StringMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s StringMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} diff --git a/service/sharing/model.go b/service/sharing/model.go index c25069757..62e801e58 100755 --- a/service/sharing/model.go +++ b/service/sharing/model.go @@ -1381,16 +1381,9 @@ type SecurablePropertiesKvPairs struct { } type Share struct { - // The comment of the share. - Comment string `json:"comment,omitempty"` - // The display name of the share. If defined, it will be shown in the UI. - DisplayName string `json:"display_name,omitempty"` - Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` - // The tags of the share. - Tags []catalog.TagKeyValue `json:"tags,omitempty"` ForceSendFields []string `json:"-" url:"-"` } diff --git a/service/sql/model.go b/service/sql/model.go index 3fc8cb4d3..8212e10d9 100755 --- a/service/sql/model.go +++ b/service/sql/model.go @@ -468,6 +468,10 @@ type AlertV2 struct { CustomSummary string `json:"custom_summary,omitempty"` // The display name of the alert. DisplayName string `json:"display_name,omitempty"` + // The actual identity that will be used to execute the alert. This is an + // output-only field that shows the resolved run-as identity after applying + // permissions and defaults. + EffectiveRunAs *AlertV2RunAs `json:"effective_run_as,omitempty"` Evaluation *AlertV2Evaluation `json:"evaluation,omitempty"` // UUID identifying the alert. @@ -482,9 +486,19 @@ type AlertV2 struct { ParentPath string `json:"parent_path,omitempty"` // Text of the query to be run. QueryText string `json:"query_text,omitempty"` + // Specifies the identity that will be used to run the alert. This field + // allows you to configure alerts to run as a specific user or service + // principal. - For user identity: Set `user_name` to the email of an active + // workspace user. Users can only set this to their own email. - For service + // principal: Set `service_principal_name` to the application ID. Requires + // the `servicePrincipal/user` role. If not specified, the alert will run as + // the request user. + RunAs *AlertV2RunAs `json:"run_as,omitempty"` // The run as username or application ID of service principal. On Create and // Update, this field can be set to application ID of an active service // principal. Setting this field requires the servicePrincipal/user role. + // Deprecated: Use `run_as` field instead. This field will be removed in a + // future release. RunAsUserName string `json:"run_as_user_name,omitempty"` Schedule *CronSchedule `json:"schedule,omitempty"` @@ -594,6 +608,25 @@ func (s AlertV2OperandValue) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type AlertV2RunAs struct { + // Application ID of an active service principal. Setting this field + // requires the `servicePrincipal/user` role. + ServicePrincipalName string `json:"service_principal_name,omitempty"` + // The email of an active workspace user. Can only set this field to their + // own email. + UserName string `json:"user_name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AlertV2RunAs) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AlertV2RunAs) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type AlertV2Subscription struct { DestinationId string `json:"destination_id,omitempty"` @@ -3796,6 +3829,8 @@ type QueryFilter struct { } type QueryInfo struct { + // The ID of the cached query if this result retrieved from cache + CacheQueryId string `json:"cache_query_id,omitempty"` // SQL Warehouse channel information at the time of query execution ChannelUsed *ChannelInfo `json:"channel_used,omitempty"` // Client application that ran the statement. For example: Databricks SQL diff --git a/service/tags/api.go b/service/tags/api.go new file mode 100755 index 000000000..d1c930e87 --- /dev/null +++ b/service/tags/api.go @@ -0,0 +1,49 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +// The Tag Policy API allows you to manage tag policies in Databricks. +package tags + +import ( + "context" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" +) + +type TagPoliciesInterface interface { + + // Creates a new tag policy. + CreateTagPolicy(ctx context.Context, request CreateTagPolicyRequest) (*TagPolicy, error) + + // Deletes a tag policy by its key. + DeleteTagPolicy(ctx context.Context, request DeleteTagPolicyRequest) error + + // Gets a single tag policy by its key. + GetTagPolicy(ctx context.Context, request GetTagPolicyRequest) (*TagPolicy, error) + + // Lists all tag policies in the account. + // + // This method is generated by Databricks SDK Code Generator. + ListTagPolicies(ctx context.Context, request ListTagPoliciesRequest) listing.Iterator[TagPolicy] + + // Lists all tag policies in the account. + // + // This method is generated by Databricks SDK Code Generator. + ListTagPoliciesAll(ctx context.Context, request ListTagPoliciesRequest) ([]TagPolicy, error) + + // Updates an existing tag policy. + UpdateTagPolicy(ctx context.Context, request UpdateTagPolicyRequest) (*TagPolicy, error) +} + +func NewTagPolicies(client *client.DatabricksClient) *TagPoliciesAPI { + return &TagPoliciesAPI{ + tagPoliciesImpl: tagPoliciesImpl{ + client: client, + }, + } +} + +// The Tag Policy API allows you to manage tag policies in Databricks. +type TagPoliciesAPI struct { + tagPoliciesImpl +} diff --git a/service/tags/impl.go b/service/tags/impl.go new file mode 100755 index 000000000..c7a846f0f --- /dev/null +++ b/service/tags/impl.go @@ -0,0 +1,103 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package tags + +import ( + "context" + "fmt" + "net/http" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/useragent" +) + +// unexported type that holds implementations of just TagPolicies API methods +type tagPoliciesImpl struct { + client *client.DatabricksClient +} + +func (a *tagPoliciesImpl) CreateTagPolicy(ctx context.Context, request CreateTagPolicyRequest) (*TagPolicy, error) { + var tagPolicy TagPolicy + path := "/api/2.1/tag-policies" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.TagPolicy, &tagPolicy) + return &tagPolicy, err +} + +func (a *tagPoliciesImpl) DeleteTagPolicy(ctx context.Context, request DeleteTagPolicyRequest) error { + path := fmt.Sprintf("/api/2.1/tag-policies/%v", request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *tagPoliciesImpl) GetTagPolicy(ctx context.Context, request GetTagPolicyRequest) (*TagPolicy, error) { + var tagPolicy TagPolicy + path := fmt.Sprintf("/api/2.1/tag-policies/%v", request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &tagPolicy) + return &tagPolicy, err +} + +// Lists all tag policies in the account. +func (a *tagPoliciesImpl) ListTagPolicies(ctx context.Context, request ListTagPoliciesRequest) listing.Iterator[TagPolicy] { + + getNextPage := func(ctx context.Context, req ListTagPoliciesRequest) (*ListTagPoliciesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListTagPolicies(ctx, req) + } + getItems := func(resp *ListTagPoliciesResponse) []TagPolicy { + return resp.TagPolicies + } + getNextReq := func(resp *ListTagPoliciesResponse) *ListTagPoliciesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Lists all tag policies in the account. +func (a *tagPoliciesImpl) ListTagPoliciesAll(ctx context.Context, request ListTagPoliciesRequest) ([]TagPolicy, error) { + iterator := a.ListTagPolicies(ctx, request) + return listing.ToSlice[TagPolicy](ctx, iterator) +} + +func (a *tagPoliciesImpl) internalListTagPolicies(ctx context.Context, request ListTagPoliciesRequest) (*ListTagPoliciesResponse, error) { + var listTagPoliciesResponse ListTagPoliciesResponse + path := "/api/2.1/tag-policies" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTagPoliciesResponse) + return &listTagPoliciesResponse, err +} + +func (a *tagPoliciesImpl) UpdateTagPolicy(ctx context.Context, request UpdateTagPolicyRequest) (*TagPolicy, error) { + var tagPolicy TagPolicy + path := fmt.Sprintf("/api/2.1/tag-policies/%v", request.TagKey) + queryParams := make(map[string]any) + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.TagPolicy, &tagPolicy) + return &tagPolicy, err +} diff --git a/service/tags/interface.go b/service/tags/interface.go new file mode 100755 index 000000000..0a80a1bf6 --- /dev/null +++ b/service/tags/interface.go @@ -0,0 +1,28 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package tags + +import ( + "context" +) + +// The Tag Policy API allows you to manage tag policies in Databricks. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type TagPoliciesService interface { + + // Creates a new tag policy. + CreateTagPolicy(ctx context.Context, request CreateTagPolicyRequest) (*TagPolicy, error) + + // Deletes a tag policy by its key. + DeleteTagPolicy(ctx context.Context, request DeleteTagPolicyRequest) error + + // Gets a single tag policy by its key. + GetTagPolicy(ctx context.Context, request GetTagPolicyRequest) (*TagPolicy, error) + + // Lists all tag policies in the account. + ListTagPolicies(ctx context.Context, request ListTagPoliciesRequest) (*ListTagPoliciesResponse, error) + + // Updates an existing tag policy. + UpdateTagPolicy(ctx context.Context, request UpdateTagPolicyRequest) (*TagPolicy, error) +} diff --git a/service/tags/model.go b/service/tags/model.go new file mode 100755 index 000000000..8264761a5 --- /dev/null +++ b/service/tags/model.go @@ -0,0 +1,97 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package tags + +import ( + "github.com/databricks/databricks-sdk-go/marshal" +) + +type CreateTagPolicyRequest struct { + TagPolicy TagPolicy `json:"tag_policy"` +} + +type DeleteTagPolicyRequest struct { + TagKey string `json:"-" url:"-"` +} + +type GetTagPolicyRequest struct { + TagKey string `json:"-" url:"-"` +} + +type ListTagPoliciesRequest struct { + // The maximum number of results to return in this request. Fewer results + // may be returned than requested. If unspecified or set to 0, this defaults + // to 1000. The maximum value is 1000; values above 1000 will be coerced + // down to 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // An optional page token received from a previous list tag policies call. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListTagPoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListTagPoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListTagPoliciesResponse struct { + NextPageToken string `json:"next_page_token,omitempty"` + + TagPolicies []TagPolicy `json:"tag_policies,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListTagPoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListTagPoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type TagPolicy struct { + Description string `json:"description,omitempty"` + + Id string `json:"id,omitempty"` + + TagKey string `json:"tag_key"` + + Values []Value `json:"values,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *TagPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s TagPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type UpdateTagPolicyRequest struct { + TagKey string `json:"-" url:"-"` + + TagPolicy TagPolicy `json:"tag_policy"` + // The field mask must be a single string, with multiple fields separated by + // commas (no spaces). The field path is relative to the resource object, + // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). + // Specification of elements in sequence or map fields is not allowed, as + // only the entire collection field can be specified. Field names must + // exactly match the resource field names. + // + // A field mask of `*` indicates full replacement. It’s recommended to + // always explicitly list the fields being updated and avoid using `*` + // wildcards, as it can lead to unintended results if the API changes in the + // future. + UpdateMask string `json:"-" url:"update_mask"` +} + +type Value struct { + Name string `json:"name"` +} diff --git a/service/vectorsearch/model.go b/service/vectorsearch/model.go index 727e80175..9afd655b2 100755 --- a/service/vectorsearch/model.go +++ b/service/vectorsearch/model.go @@ -249,8 +249,12 @@ func (s DirectAccessVectorIndexSpec) MarshalJSON() ([]byte, error) { } type EmbeddingSourceColumn struct { - // Name of the embedding model endpoint + // Name of the embedding model endpoint, used by default for both ingestion + // and querying. EmbeddingModelEndpointName string `json:"embedding_model_endpoint_name,omitempty"` + // Name of the embedding model endpoint which, if specified, is used for + // querying (not ingestion). + ModelEndpointNameForQuery string `json:"model_endpoint_name_for_query,omitempty"` // Name of the column Name string `json:"name,omitempty"` diff --git a/workspace_client.go b/workspace_client.go index 728698a03..896d74284 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -26,8 +26,10 @@ import ( "github.com/databricks/databricks-sdk-go/service/qualitymonitorv2" "github.com/databricks/databricks-sdk-go/service/serving" "github.com/databricks/databricks-sdk-go/service/settings" + "github.com/databricks/databricks-sdk-go/service/settingsv2" "github.com/databricks/databricks-sdk-go/service/sharing" "github.com/databricks/databricks-sdk-go/service/sql" + "github.com/databricks/databricks-sdk-go/service/tags" "github.com/databricks/databricks-sdk-go/service/vectorsearch" "github.com/databricks/databricks-sdk-go/service/workspace" ) @@ -78,6 +80,10 @@ type WorkspaceClient struct { // interact through single sign-on. Apps apps.AppsInterface + // Apps Settings manage the settings for the Apps service on a customer's + // Databricks instance. + AppsSettings apps.AppsSettingsInterface + // 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. @@ -283,6 +289,13 @@ type WorkspaceClient struct { // [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html DbsqlPermissions sql.DbsqlPermissionsInterface + // Tags are attributes that include keys and optional values that you can + // use to organize and categorize entities in Unity Catalog. Entity tagging + // is currently supported on catalogs, schemas, tables (including views), + // columns, volumes. With these APIs, users can create, update, delete, and + // list tag assignments across Unity Catalog entities + EntityTagAssignments catalog.EntityTagAssignmentsInterface + // Experiments are the primary unit of organization in MLflow; all MLflow // runs belong to an experiment. Each experiment lets you visualize, search, // and compare runs, as well as download run artifacts or metadata for @@ -880,6 +893,15 @@ type WorkspaceClient struct { // [Unity Catalog documentation]: https://docs.databricks.com/en/data-governance/unity-catalog/index.html#resource-quotas ResourceQuotas catalog.ResourceQuotasInterface + // Request for Access enables customers to request access to and manage + // access request destinations for Unity Catalog securables. + // + // These APIs provide a standardized way to update, get, and request to + // access request destinations. Fine-grained authorization ensures that only + // users with appropriate permissions can manage access request + // destinations. + Rfa catalog.RfaInterface + // A schema (also called a database) is the second layer of Unity // Catalog’s three-level namespace. A schema organizes tables, views and // functions. To access (or list) a table or view in a schema, users must @@ -1119,6 +1141,9 @@ type WorkspaceClient struct { // is a particular kind of table (rather than a managed or external table). Tables catalog.TablesInterface + // The Tag Policy API allows you to manage tag policies in Databricks. + TagPolicies tags.TagPoliciesInterface + // Temporary Path Credentials refer to short-lived, downscoped credentials // used to access external cloud storage locations registered in Databricks. // These credentials are employed to provide secure and time-limited access @@ -1257,6 +1282,9 @@ type WorkspaceClient struct { // This API allows updating known workspace settings for advanced users. WorkspaceConf settings.WorkspaceConfInterface + + // APIs to manage workspace level settings + WorkspaceSettingsV2 settingsv2.WorkspaceSettingsV2Interface } var ErrNotWorkspaceClient = errors.New("invalid Databricks Workspace configuration") @@ -1300,6 +1328,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { AlertsLegacy: sql.NewAlertsLegacy(databricksClient), AlertsV2: sql.NewAlertsV2(databricksClient), Apps: apps.NewApps(databricksClient), + AppsSettings: apps.NewAppsSettings(databricksClient), ArtifactAllowlists: catalog.NewArtifactAllowlists(databricksClient), Catalogs: catalog.NewCatalogs(databricksClient), CleanRoomAssetRevisions: cleanrooms.NewCleanRoomAssetRevisions(databricksClient), @@ -1325,6 +1354,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { Database: database.NewDatabase(databricksClient), Dbfs: files.NewDbfs(databricksClient), DbsqlPermissions: sql.NewDbsqlPermissions(databricksClient), + EntityTagAssignments: catalog.NewEntityTagAssignments(databricksClient), Experiments: ml.NewExperiments(databricksClient), ExternalLineage: catalog.NewExternalLineage(databricksClient), ExternalLocations: catalog.NewExternalLocations(databricksClient), @@ -1380,6 +1410,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { RegisteredModels: catalog.NewRegisteredModels(databricksClient), Repos: workspace.NewRepos(databricksClient), ResourceQuotas: catalog.NewResourceQuotas(databricksClient), + Rfa: catalog.NewRfa(databricksClient), Schemas: catalog.NewSchemas(databricksClient), Secrets: workspace.NewSecrets(databricksClient), ServicePrincipalSecretsProxy: oauth2.NewServicePrincipalSecretsProxy(databricksClient), @@ -1393,6 +1424,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { SystemSchemas: catalog.NewSystemSchemas(databricksClient), TableConstraints: catalog.NewTableConstraints(databricksClient), Tables: catalog.NewTables(databricksClient), + TagPolicies: tags.NewTagPolicies(databricksClient), TemporaryPathCredentials: catalog.NewTemporaryPathCredentials(databricksClient), TemporaryTableCredentials: catalog.NewTemporaryTableCredentials(databricksClient), TokenManagement: settings.NewTokenManagement(databricksClient), @@ -1405,5 +1437,6 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { Workspace: workspace.NewWorkspace(databricksClient), WorkspaceBindings: catalog.NewWorkspaceBindings(databricksClient), WorkspaceConf: settings.NewWorkspaceConf(databricksClient), + WorkspaceSettingsV2: settingsv2.NewWorkspaceSettingsV2(databricksClient), }, nil }