diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 588cf9d63..9a95107e8 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -0be1b914249781b5e903b7676fd02255755bc851 \ No newline at end of file +c72c58f97b950fcb924a90ef164bcb10cfcd5ece \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a156deb1..28fee5466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,39 @@ # Version changelog +## [Release] Release v0.57.0 + +### New Features and Improvements + + * Add support for async OAuth token refreshes ([#1135](https://github.com/databricks/databricks-sdk-go/pull/1135)). + + +### API Changes: + + * Added [a.BudgetPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/billing#BudgetPolicyAPI) account-level service. + * Added [a.EnableIpAccessLists](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/settings#EnableIpAccessListsAPI) account-level service. + * Added [w.LakeviewEmbedded](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#LakeviewEmbeddedAPI) workspace-level service and [w.QueryExecution](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#QueryExecutionAPI) workspace-level service. + * Added [w.RedashConfig](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sql#RedashConfigAPI) workspace-level service. + * Added `GcpOauthToken` field for [catalog.TemporaryCredentials](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#TemporaryCredentials). + * Added `Options` field for [catalog.UpdateCatalog](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#UpdateCatalog). + * Added `StatementId` field for [dashboards.QueryAttachment](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#QueryAttachment). + * Added `EffectivePerformanceTarget` field for [jobs.BaseRun](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#BaseRun). + * Added `PerformanceTarget` field for [jobs.CreateJob](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#CreateJob). + * Added `PerformanceTarget` field for [jobs.JobSettings](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#JobSettings). + * Added `EffectivePerformanceTarget` field for [jobs.Run](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#Run). + * Added `PerformanceTarget` field for [jobs.RunNow](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#RunNow). + * Added `Disabled` and `EffectivePerformanceTarget` fields for [jobs.RunTask](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#RunTask). + * Added `UserAuthorizedScopes` field for [oauth2.CreateCustomAppIntegration](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#CreateCustomAppIntegration). + * Added `UserAuthorizedScopes` field for [oauth2.GetCustomAppIntegrationOutput](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#GetCustomAppIntegrationOutput). + * Added `UserAuthorizedScopes` field for [oauth2.UpdateCustomAppIntegration](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#UpdateCustomAppIntegration). + * Added `Contents` field for [serving.HttpRequestResponse](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/serving#HttpRequestResponse). + * Changed `HttpRequest` method for [w.ServingEndpoints](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/serving#ServingEndpointsAPI) workspace-level service to type `HttpRequest` method for [w.ServingEndpoints](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/serving#ServingEndpointsAPI) workspace-level service. + * Changed `HttpRequest` method for [w.ServingEndpoints](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/serving#ServingEndpointsAPI) workspace-level service to return [serving.HttpRequestResponse](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/serving#HttpRequestResponse). + * Removed `SecurableKind` field for [catalog.CatalogInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#CatalogInfo). + * Removed `SecurableKind` field for [catalog.ConnectionInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#ConnectionInfo). + * Removed `StatusCode` and `Text` fields for [serving.ExternalFunctionResponse](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/serving#ExternalFunctionResponse). + +OpenAPI SHA: c72c58f97b950fcb924a90ef164bcb10cfcd5ece, Date: 2025-02-03 + ## [Release] Release v0.56.1 ### Bug Fixes diff --git a/account_client.go b/account_client.go index 50632e4f8..fb8aca2e6 100755 --- a/account_client.go +++ b/account_client.go @@ -29,6 +29,9 @@ type AccountClient struct { // account and date range. This feature works with all account types. BillableUsage billing.BillableUsageInterface + // A service serves REST API about Budget policies + BudgetPolicy billing.BudgetPolicyInterface + // These APIs manage credential configurations for this workspace. // Databricks needs access to a cross-account service IAM role in your AWS // account so that Databricks can deploy clusters in the appropriate VPC for @@ -414,6 +417,7 @@ func NewAccountClient(c ...*Config) (*AccountClient, error) { AccessControl: iam.NewAccountAccessControl(apiClient), BillableUsage: billing.NewBillableUsage(apiClient), + BudgetPolicy: billing.NewBudgetPolicy(apiClient), Credentials: provisioning.NewCredentials(apiClient), CustomAppIntegration: oauth2.NewCustomAppIntegration(apiClient), EncryptionKeys: provisioning.NewEncryptionKeys(apiClient), diff --git a/experimental/mocks/mock_account_client.go b/experimental/mocks/mock_account_client.go index af59c5a2e..453038368 100755 --- a/experimental/mocks/mock_account_client.go +++ b/experimental/mocks/mock_account_client.go @@ -32,6 +32,7 @@ func NewMockAccountClient(t interface { AccessControl: iam.NewMockAccountAccessControlInterface(t), BillableUsage: billing.NewMockBillableUsageInterface(t), + BudgetPolicy: billing.NewMockBudgetPolicyInterface(t), Credentials: provisioning.NewMockCredentialsInterface(t), CustomAppIntegration: oauth2.NewMockCustomAppIntegrationInterface(t), EncryptionKeys: provisioning.NewMockEncryptionKeysInterface(t), @@ -69,6 +70,9 @@ func NewMockAccountClient(t interface { mockDisableLegacyFeatures := settings.NewMockDisableLegacyFeaturesInterface(t) mockAccountSettingsAPI.On("DisableLegacyFeatures").Return(mockDisableLegacyFeatures).Maybe() + mockEnableIpAccessLists := settings.NewMockEnableIpAccessListsInterface(t) + mockAccountSettingsAPI.On("EnableIpAccessLists").Return(mockEnableIpAccessLists).Maybe() + mockEsmEnablementAccount := settings.NewMockEsmEnablementAccountInterface(t) mockAccountSettingsAPI.On("EsmEnablementAccount").Return(mockEsmEnablementAccount).Maybe() @@ -94,6 +98,14 @@ func (m *MockAccountClient) GetMockDisableLegacyFeaturesAPI() *settings.MockDisa return api } +func (m *MockAccountClient) GetMockEnableIpAccessListsAPI() *settings.MockEnableIpAccessListsInterface { + api, ok := m.GetMockAccountSettingsAPI().EnableIpAccessLists().(*settings.MockEnableIpAccessListsInterface) + if !ok { + panic(fmt.Sprintf("expected EnableIpAccessLists to be *settings.MockEnableIpAccessListsInterface, actual was %T", m.GetMockAccountSettingsAPI().EnableIpAccessLists())) + } + return api +} + func (m *MockAccountClient) GetMockEsmEnablementAccountAPI() *settings.MockEsmEnablementAccountInterface { api, ok := m.GetMockAccountSettingsAPI().EsmEnablementAccount().(*settings.MockEsmEnablementAccountInterface) if !ok { @@ -126,6 +138,14 @@ func (m *MockAccountClient) GetMockBillableUsageAPI() *billing.MockBillableUsage return api } +func (m *MockAccountClient) GetMockBudgetPolicyAPI() *billing.MockBudgetPolicyInterface { + api, ok := m.AccountClient.BudgetPolicy.(*billing.MockBudgetPolicyInterface) + if !ok { + panic(fmt.Sprintf("expected BudgetPolicy to be *billing.MockBudgetPolicyInterface, actual was %T", m.AccountClient.BudgetPolicy)) + } + return api +} + func (m *MockAccountClient) GetMockCredentialsAPI() *provisioning.MockCredentialsInterface { api, ok := m.AccountClient.Credentials.(*provisioning.MockCredentialsInterface) if !ok { diff --git a/experimental/mocks/mock_workspace_client.go b/experimental/mocks/mock_workspace_client.go index c46e8663d..ca2bffb53 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -82,6 +82,7 @@ func NewMockWorkspaceClient(t interface { IpAccessLists: settings.NewMockIpAccessListsInterface(t), Jobs: jobs.NewMockJobsInterface(t), Lakeview: dashboards.NewMockLakeviewInterface(t), + LakeviewEmbedded: dashboards.NewMockLakeviewEmbeddedInterface(t), Libraries: compute.NewMockLibrariesInterface(t), Metastores: catalog.NewMockMetastoresInterface(t), ModelRegistry: ml.NewMockModelRegistryInterface(t), @@ -105,11 +106,13 @@ func NewMockWorkspaceClient(t interface { QualityMonitors: catalog.NewMockQualityMonitorsInterface(t), Queries: sql.NewMockQueriesInterface(t), QueriesLegacy: sql.NewMockQueriesLegacyInterface(t), + QueryExecution: dashboards.NewMockQueryExecutionInterface(t), QueryHistory: sql.NewMockQueryHistoryInterface(t), QueryVisualizations: sql.NewMockQueryVisualizationsInterface(t), QueryVisualizationsLegacy: sql.NewMockQueryVisualizationsLegacyInterface(t), RecipientActivation: sharing.NewMockRecipientActivationInterface(t), Recipients: sharing.NewMockRecipientsInterface(t), + RedashConfig: sql.NewMockRedashConfigInterface(t), RegisteredModels: catalog.NewMockRegisteredModelsInterface(t), Repos: workspace.NewMockReposInterface(t), ResourceQuotas: catalog.NewMockResourceQuotasInterface(t), @@ -571,6 +574,14 @@ func (m *MockWorkspaceClient) GetMockLakeviewAPI() *dashboards.MockLakeviewInter return api } +func (m *MockWorkspaceClient) GetMockLakeviewEmbeddedAPI() *dashboards.MockLakeviewEmbeddedInterface { + api, ok := m.WorkspaceClient.LakeviewEmbedded.(*dashboards.MockLakeviewEmbeddedInterface) + if !ok { + panic(fmt.Sprintf("expected LakeviewEmbedded to be *dashboards.MockLakeviewEmbeddedInterface, actual was %T", m.WorkspaceClient.LakeviewEmbedded)) + } + return api +} + func (m *MockWorkspaceClient) GetMockLibrariesAPI() *compute.MockLibrariesInterface { api, ok := m.WorkspaceClient.Libraries.(*compute.MockLibrariesInterface) if !ok { @@ -755,6 +766,14 @@ func (m *MockWorkspaceClient) GetMockQueriesLegacyAPI() *sql.MockQueriesLegacyIn return api } +func (m *MockWorkspaceClient) GetMockQueryExecutionAPI() *dashboards.MockQueryExecutionInterface { + api, ok := m.WorkspaceClient.QueryExecution.(*dashboards.MockQueryExecutionInterface) + if !ok { + panic(fmt.Sprintf("expected QueryExecution to be *dashboards.MockQueryExecutionInterface, actual was %T", m.WorkspaceClient.QueryExecution)) + } + return api +} + func (m *MockWorkspaceClient) GetMockQueryHistoryAPI() *sql.MockQueryHistoryInterface { api, ok := m.WorkspaceClient.QueryHistory.(*sql.MockQueryHistoryInterface) if !ok { @@ -795,6 +814,14 @@ func (m *MockWorkspaceClient) GetMockRecipientsAPI() *sharing.MockRecipientsInte return api } +func (m *MockWorkspaceClient) GetMockRedashConfigAPI() *sql.MockRedashConfigInterface { + api, ok := m.WorkspaceClient.RedashConfig.(*sql.MockRedashConfigInterface) + if !ok { + panic(fmt.Sprintf("expected RedashConfig to be *sql.MockRedashConfigInterface, actual was %T", m.WorkspaceClient.RedashConfig)) + } + return api +} + func (m *MockWorkspaceClient) GetMockRegisteredModelsAPI() *catalog.MockRegisteredModelsInterface { api, ok := m.WorkspaceClient.RegisteredModels.(*catalog.MockRegisteredModelsInterface) if !ok { diff --git a/experimental/mocks/service/billing/mock_budget_policy_interface.go b/experimental/mocks/service/billing/mock_budget_policy_interface.go new file mode 100644 index 000000000..7028b86fc --- /dev/null +++ b/experimental/mocks/service/billing/mock_budget_policy_interface.go @@ -0,0 +1,478 @@ +// Code generated by mockery v2.43.0. DO NOT EDIT. + +package billing + +import ( + context "context" + + billing "github.com/databricks/databricks-sdk-go/service/billing" + + listing "github.com/databricks/databricks-sdk-go/listing" + + mock "github.com/stretchr/testify/mock" +) + +// MockBudgetPolicyInterface is an autogenerated mock type for the BudgetPolicyInterface type +type MockBudgetPolicyInterface struct { + mock.Mock +} + +type MockBudgetPolicyInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockBudgetPolicyInterface) EXPECT() *MockBudgetPolicyInterface_Expecter { + return &MockBudgetPolicyInterface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockBudgetPolicyInterface) Create(ctx context.Context, request billing.CreateBudgetPolicyRequest) (*billing.BudgetPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *billing.BudgetPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, billing.CreateBudgetPolicyRequest) (*billing.BudgetPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, billing.CreateBudgetPolicyRequest) *billing.BudgetPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*billing.BudgetPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, billing.CreateBudgetPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBudgetPolicyInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockBudgetPolicyInterface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request billing.CreateBudgetPolicyRequest +func (_e *MockBudgetPolicyInterface_Expecter) Create(ctx interface{}, request interface{}) *MockBudgetPolicyInterface_Create_Call { + return &MockBudgetPolicyInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockBudgetPolicyInterface_Create_Call) Run(run func(ctx context.Context, request billing.CreateBudgetPolicyRequest)) *MockBudgetPolicyInterface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.CreateBudgetPolicyRequest)) + }) + return _c +} + +func (_c *MockBudgetPolicyInterface_Create_Call) Return(_a0 *billing.BudgetPolicy, _a1 error) *MockBudgetPolicyInterface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBudgetPolicyInterface_Create_Call) RunAndReturn(run func(context.Context, billing.CreateBudgetPolicyRequest) (*billing.BudgetPolicy, error)) *MockBudgetPolicyInterface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockBudgetPolicyInterface) Delete(ctx context.Context, request billing.DeleteBudgetPolicyRequest) 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, billing.DeleteBudgetPolicyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockBudgetPolicyInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockBudgetPolicyInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request billing.DeleteBudgetPolicyRequest +func (_e *MockBudgetPolicyInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockBudgetPolicyInterface_Delete_Call { + return &MockBudgetPolicyInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockBudgetPolicyInterface_Delete_Call) Run(run func(ctx context.Context, request billing.DeleteBudgetPolicyRequest)) *MockBudgetPolicyInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.DeleteBudgetPolicyRequest)) + }) + return _c +} + +func (_c *MockBudgetPolicyInterface_Delete_Call) Return(_a0 error) *MockBudgetPolicyInterface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockBudgetPolicyInterface_Delete_Call) RunAndReturn(run func(context.Context, billing.DeleteBudgetPolicyRequest) error) *MockBudgetPolicyInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// DeleteByPolicyId provides a mock function with given fields: ctx, policyId +func (_m *MockBudgetPolicyInterface) DeleteByPolicyId(ctx context.Context, policyId string) error { + ret := _m.Called(ctx, policyId) + + if len(ret) == 0 { + panic("no return value specified for DeleteByPolicyId") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, policyId) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockBudgetPolicyInterface_DeleteByPolicyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByPolicyId' +type MockBudgetPolicyInterface_DeleteByPolicyId_Call struct { + *mock.Call +} + +// DeleteByPolicyId is a helper method to define mock.On call +// - ctx context.Context +// - policyId string +func (_e *MockBudgetPolicyInterface_Expecter) DeleteByPolicyId(ctx interface{}, policyId interface{}) *MockBudgetPolicyInterface_DeleteByPolicyId_Call { + return &MockBudgetPolicyInterface_DeleteByPolicyId_Call{Call: _e.mock.On("DeleteByPolicyId", ctx, policyId)} +} + +func (_c *MockBudgetPolicyInterface_DeleteByPolicyId_Call) Run(run func(ctx context.Context, policyId string)) *MockBudgetPolicyInterface_DeleteByPolicyId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockBudgetPolicyInterface_DeleteByPolicyId_Call) Return(_a0 error) *MockBudgetPolicyInterface_DeleteByPolicyId_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockBudgetPolicyInterface_DeleteByPolicyId_Call) RunAndReturn(run func(context.Context, string) error) *MockBudgetPolicyInterface_DeleteByPolicyId_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockBudgetPolicyInterface) Get(ctx context.Context, request billing.GetBudgetPolicyRequest) (*billing.BudgetPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *billing.BudgetPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, billing.GetBudgetPolicyRequest) (*billing.BudgetPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, billing.GetBudgetPolicyRequest) *billing.BudgetPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*billing.BudgetPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, billing.GetBudgetPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBudgetPolicyInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockBudgetPolicyInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request billing.GetBudgetPolicyRequest +func (_e *MockBudgetPolicyInterface_Expecter) Get(ctx interface{}, request interface{}) *MockBudgetPolicyInterface_Get_Call { + return &MockBudgetPolicyInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockBudgetPolicyInterface_Get_Call) Run(run func(ctx context.Context, request billing.GetBudgetPolicyRequest)) *MockBudgetPolicyInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.GetBudgetPolicyRequest)) + }) + return _c +} + +func (_c *MockBudgetPolicyInterface_Get_Call) Return(_a0 *billing.BudgetPolicy, _a1 error) *MockBudgetPolicyInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBudgetPolicyInterface_Get_Call) RunAndReturn(run func(context.Context, billing.GetBudgetPolicyRequest) (*billing.BudgetPolicy, error)) *MockBudgetPolicyInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetByPolicyId provides a mock function with given fields: ctx, policyId +func (_m *MockBudgetPolicyInterface) GetByPolicyId(ctx context.Context, policyId string) (*billing.BudgetPolicy, error) { + ret := _m.Called(ctx, policyId) + + if len(ret) == 0 { + panic("no return value specified for GetByPolicyId") + } + + var r0 *billing.BudgetPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*billing.BudgetPolicy, error)); ok { + return rf(ctx, policyId) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *billing.BudgetPolicy); ok { + r0 = rf(ctx, policyId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*billing.BudgetPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, policyId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBudgetPolicyInterface_GetByPolicyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByPolicyId' +type MockBudgetPolicyInterface_GetByPolicyId_Call struct { + *mock.Call +} + +// GetByPolicyId is a helper method to define mock.On call +// - ctx context.Context +// - policyId string +func (_e *MockBudgetPolicyInterface_Expecter) GetByPolicyId(ctx interface{}, policyId interface{}) *MockBudgetPolicyInterface_GetByPolicyId_Call { + return &MockBudgetPolicyInterface_GetByPolicyId_Call{Call: _e.mock.On("GetByPolicyId", ctx, policyId)} +} + +func (_c *MockBudgetPolicyInterface_GetByPolicyId_Call) Run(run func(ctx context.Context, policyId string)) *MockBudgetPolicyInterface_GetByPolicyId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockBudgetPolicyInterface_GetByPolicyId_Call) Return(_a0 *billing.BudgetPolicy, _a1 error) *MockBudgetPolicyInterface_GetByPolicyId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBudgetPolicyInterface_GetByPolicyId_Call) RunAndReturn(run func(context.Context, string) (*billing.BudgetPolicy, error)) *MockBudgetPolicyInterface_GetByPolicyId_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockBudgetPolicyInterface) List(ctx context.Context, request billing.ListBudgetPoliciesRequest) listing.Iterator[billing.BudgetPolicy] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[billing.BudgetPolicy] + if rf, ok := ret.Get(0).(func(context.Context, billing.ListBudgetPoliciesRequest) listing.Iterator[billing.BudgetPolicy]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[billing.BudgetPolicy]) + } + } + + return r0 +} + +// MockBudgetPolicyInterface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockBudgetPolicyInterface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request billing.ListBudgetPoliciesRequest +func (_e *MockBudgetPolicyInterface_Expecter) List(ctx interface{}, request interface{}) *MockBudgetPolicyInterface_List_Call { + return &MockBudgetPolicyInterface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockBudgetPolicyInterface_List_Call) Run(run func(ctx context.Context, request billing.ListBudgetPoliciesRequest)) *MockBudgetPolicyInterface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.ListBudgetPoliciesRequest)) + }) + return _c +} + +func (_c *MockBudgetPolicyInterface_List_Call) Return(_a0 listing.Iterator[billing.BudgetPolicy]) *MockBudgetPolicyInterface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockBudgetPolicyInterface_List_Call) RunAndReturn(run func(context.Context, billing.ListBudgetPoliciesRequest) listing.Iterator[billing.BudgetPolicy]) *MockBudgetPolicyInterface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockBudgetPolicyInterface) ListAll(ctx context.Context, request billing.ListBudgetPoliciesRequest) ([]billing.BudgetPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []billing.BudgetPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, billing.ListBudgetPoliciesRequest) ([]billing.BudgetPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, billing.ListBudgetPoliciesRequest) []billing.BudgetPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]billing.BudgetPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, billing.ListBudgetPoliciesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBudgetPolicyInterface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockBudgetPolicyInterface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request billing.ListBudgetPoliciesRequest +func (_e *MockBudgetPolicyInterface_Expecter) ListAll(ctx interface{}, request interface{}) *MockBudgetPolicyInterface_ListAll_Call { + return &MockBudgetPolicyInterface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockBudgetPolicyInterface_ListAll_Call) Run(run func(ctx context.Context, request billing.ListBudgetPoliciesRequest)) *MockBudgetPolicyInterface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.ListBudgetPoliciesRequest)) + }) + return _c +} + +func (_c *MockBudgetPolicyInterface_ListAll_Call) Return(_a0 []billing.BudgetPolicy, _a1 error) *MockBudgetPolicyInterface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBudgetPolicyInterface_ListAll_Call) RunAndReturn(run func(context.Context, billing.ListBudgetPoliciesRequest) ([]billing.BudgetPolicy, error)) *MockBudgetPolicyInterface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockBudgetPolicyInterface) Update(ctx context.Context, request billing.UpdateBudgetPolicyRequest) (*billing.BudgetPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *billing.BudgetPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, billing.UpdateBudgetPolicyRequest) (*billing.BudgetPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, billing.UpdateBudgetPolicyRequest) *billing.BudgetPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*billing.BudgetPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, billing.UpdateBudgetPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockBudgetPolicyInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockBudgetPolicyInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request billing.UpdateBudgetPolicyRequest +func (_e *MockBudgetPolicyInterface_Expecter) Update(ctx interface{}, request interface{}) *MockBudgetPolicyInterface_Update_Call { + return &MockBudgetPolicyInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockBudgetPolicyInterface_Update_Call) Run(run func(ctx context.Context, request billing.UpdateBudgetPolicyRequest)) *MockBudgetPolicyInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.UpdateBudgetPolicyRequest)) + }) + return _c +} + +func (_c *MockBudgetPolicyInterface_Update_Call) Return(_a0 *billing.BudgetPolicy, _a1 error) *MockBudgetPolicyInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockBudgetPolicyInterface_Update_Call) RunAndReturn(run func(context.Context, billing.UpdateBudgetPolicyRequest) (*billing.BudgetPolicy, error)) *MockBudgetPolicyInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockBudgetPolicyInterface creates a new instance of MockBudgetPolicyInterface. 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 NewMockBudgetPolicyInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockBudgetPolicyInterface { + mock := &MockBudgetPolicyInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go b/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go new file mode 100644 index 000000000..d606527b0 --- /dev/null +++ b/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go @@ -0,0 +1,131 @@ +// Code generated by mockery v2.43.0. DO NOT EDIT. + +package dashboards + +import ( + context "context" + + dashboards "github.com/databricks/databricks-sdk-go/service/dashboards" + mock "github.com/stretchr/testify/mock" +) + +// MockLakeviewEmbeddedInterface is an autogenerated mock type for the LakeviewEmbeddedInterface type +type MockLakeviewEmbeddedInterface struct { + mock.Mock +} + +type MockLakeviewEmbeddedInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockLakeviewEmbeddedInterface) EXPECT() *MockLakeviewEmbeddedInterface_Expecter { + return &MockLakeviewEmbeddedInterface_Expecter{mock: &_m.Mock} +} + +// GetPublishedDashboardEmbedded provides a mock function with given fields: ctx, request +func (_m *MockLakeviewEmbeddedInterface) GetPublishedDashboardEmbedded(ctx context.Context, request dashboards.GetPublishedDashboardEmbeddedRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetPublishedDashboardEmbedded") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GetPublishedDashboardEmbeddedRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublishedDashboardEmbedded' +type MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call struct { + *mock.Call +} + +// GetPublishedDashboardEmbedded is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GetPublishedDashboardEmbeddedRequest +func (_e *MockLakeviewEmbeddedInterface_Expecter) GetPublishedDashboardEmbedded(ctx interface{}, request interface{}) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call { + return &MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call{Call: _e.mock.On("GetPublishedDashboardEmbedded", ctx, request)} +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call) Run(run func(ctx context.Context, request dashboards.GetPublishedDashboardEmbeddedRequest)) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GetPublishedDashboardEmbeddedRequest)) + }) + return _c +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call) Return(_a0 error) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call) RunAndReturn(run func(context.Context, dashboards.GetPublishedDashboardEmbeddedRequest) error) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbedded_Call { + _c.Call.Return(run) + return _c +} + +// GetPublishedDashboardEmbeddedByDashboardId provides a mock function with given fields: ctx, dashboardId +func (_m *MockLakeviewEmbeddedInterface) GetPublishedDashboardEmbeddedByDashboardId(ctx context.Context, dashboardId string) error { + ret := _m.Called(ctx, dashboardId) + + if len(ret) == 0 { + panic("no return value specified for GetPublishedDashboardEmbeddedByDashboardId") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, dashboardId) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublishedDashboardEmbeddedByDashboardId' +type MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call struct { + *mock.Call +} + +// GetPublishedDashboardEmbeddedByDashboardId is a helper method to define mock.On call +// - ctx context.Context +// - dashboardId string +func (_e *MockLakeviewEmbeddedInterface_Expecter) GetPublishedDashboardEmbeddedByDashboardId(ctx interface{}, dashboardId interface{}) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call { + return &MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call{Call: _e.mock.On("GetPublishedDashboardEmbeddedByDashboardId", ctx, dashboardId)} +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call) Run(run func(ctx context.Context, dashboardId string)) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call) Return(_a0 error) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call) RunAndReturn(run func(context.Context, string) error) *MockLakeviewEmbeddedInterface_GetPublishedDashboardEmbeddedByDashboardId_Call { + _c.Call.Return(run) + return _c +} + +// NewMockLakeviewEmbeddedInterface creates a new instance of MockLakeviewEmbeddedInterface. 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 NewMockLakeviewEmbeddedInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockLakeviewEmbeddedInterface { + mock := &MockLakeviewEmbeddedInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/dashboards/mock_query_execution_interface.go b/experimental/mocks/service/dashboards/mock_query_execution_interface.go new file mode 100644 index 000000000..e3c3b6e90 --- /dev/null +++ b/experimental/mocks/service/dashboards/mock_query_execution_interface.go @@ -0,0 +1,202 @@ +// Code generated by mockery v2.43.0. DO NOT EDIT. + +package dashboards + +import ( + context "context" + + dashboards "github.com/databricks/databricks-sdk-go/service/dashboards" + mock "github.com/stretchr/testify/mock" +) + +// MockQueryExecutionInterface is an autogenerated mock type for the QueryExecutionInterface type +type MockQueryExecutionInterface struct { + mock.Mock +} + +type MockQueryExecutionInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockQueryExecutionInterface) EXPECT() *MockQueryExecutionInterface_Expecter { + return &MockQueryExecutionInterface_Expecter{mock: &_m.Mock} +} + +// CancelPublishedQueryExecution provides a mock function with given fields: ctx, request +func (_m *MockQueryExecutionInterface) CancelPublishedQueryExecution(ctx context.Context, request dashboards.CancelPublishedQueryExecutionRequest) (*dashboards.CancelQueryExecutionResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CancelPublishedQueryExecution") + } + + var r0 *dashboards.CancelQueryExecutionResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.CancelPublishedQueryExecutionRequest) (*dashboards.CancelQueryExecutionResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.CancelPublishedQueryExecutionRequest) *dashboards.CancelQueryExecutionResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.CancelQueryExecutionResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.CancelPublishedQueryExecutionRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQueryExecutionInterface_CancelPublishedQueryExecution_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CancelPublishedQueryExecution' +type MockQueryExecutionInterface_CancelPublishedQueryExecution_Call struct { + *mock.Call +} + +// CancelPublishedQueryExecution is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.CancelPublishedQueryExecutionRequest +func (_e *MockQueryExecutionInterface_Expecter) CancelPublishedQueryExecution(ctx interface{}, request interface{}) *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call { + return &MockQueryExecutionInterface_CancelPublishedQueryExecution_Call{Call: _e.mock.On("CancelPublishedQueryExecution", ctx, request)} +} + +func (_c *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call) Run(run func(ctx context.Context, request dashboards.CancelPublishedQueryExecutionRequest)) *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.CancelPublishedQueryExecutionRequest)) + }) + return _c +} + +func (_c *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call) Return(_a0 *dashboards.CancelQueryExecutionResponse, _a1 error) *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call) RunAndReturn(run func(context.Context, dashboards.CancelPublishedQueryExecutionRequest) (*dashboards.CancelQueryExecutionResponse, error)) *MockQueryExecutionInterface_CancelPublishedQueryExecution_Call { + _c.Call.Return(run) + return _c +} + +// ExecutePublishedDashboardQuery provides a mock function with given fields: ctx, request +func (_m *MockQueryExecutionInterface) ExecutePublishedDashboardQuery(ctx context.Context, request dashboards.ExecutePublishedDashboardQueryRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ExecutePublishedDashboardQuery") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.ExecutePublishedDashboardQueryRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecutePublishedDashboardQuery' +type MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call struct { + *mock.Call +} + +// ExecutePublishedDashboardQuery is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.ExecutePublishedDashboardQueryRequest +func (_e *MockQueryExecutionInterface_Expecter) ExecutePublishedDashboardQuery(ctx interface{}, request interface{}) *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call { + return &MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call{Call: _e.mock.On("ExecutePublishedDashboardQuery", ctx, request)} +} + +func (_c *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call) Run(run func(ctx context.Context, request dashboards.ExecutePublishedDashboardQueryRequest)) *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.ExecutePublishedDashboardQueryRequest)) + }) + return _c +} + +func (_c *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call) Return(_a0 error) *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call) RunAndReturn(run func(context.Context, dashboards.ExecutePublishedDashboardQueryRequest) error) *MockQueryExecutionInterface_ExecutePublishedDashboardQuery_Call { + _c.Call.Return(run) + return _c +} + +// PollPublishedQueryStatus provides a mock function with given fields: ctx, request +func (_m *MockQueryExecutionInterface) PollPublishedQueryStatus(ctx context.Context, request dashboards.PollPublishedQueryStatusRequest) (*dashboards.PollQueryStatusResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for PollPublishedQueryStatus") + } + + var r0 *dashboards.PollQueryStatusResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.PollPublishedQueryStatusRequest) (*dashboards.PollQueryStatusResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.PollPublishedQueryStatusRequest) *dashboards.PollQueryStatusResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.PollQueryStatusResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.PollPublishedQueryStatusRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockQueryExecutionInterface_PollPublishedQueryStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PollPublishedQueryStatus' +type MockQueryExecutionInterface_PollPublishedQueryStatus_Call struct { + *mock.Call +} + +// PollPublishedQueryStatus is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.PollPublishedQueryStatusRequest +func (_e *MockQueryExecutionInterface_Expecter) PollPublishedQueryStatus(ctx interface{}, request interface{}) *MockQueryExecutionInterface_PollPublishedQueryStatus_Call { + return &MockQueryExecutionInterface_PollPublishedQueryStatus_Call{Call: _e.mock.On("PollPublishedQueryStatus", ctx, request)} +} + +func (_c *MockQueryExecutionInterface_PollPublishedQueryStatus_Call) Run(run func(ctx context.Context, request dashboards.PollPublishedQueryStatusRequest)) *MockQueryExecutionInterface_PollPublishedQueryStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.PollPublishedQueryStatusRequest)) + }) + return _c +} + +func (_c *MockQueryExecutionInterface_PollPublishedQueryStatus_Call) Return(_a0 *dashboards.PollQueryStatusResponse, _a1 error) *MockQueryExecutionInterface_PollPublishedQueryStatus_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockQueryExecutionInterface_PollPublishedQueryStatus_Call) RunAndReturn(run func(context.Context, dashboards.PollPublishedQueryStatusRequest) (*dashboards.PollQueryStatusResponse, error)) *MockQueryExecutionInterface_PollPublishedQueryStatus_Call { + _c.Call.Return(run) + return _c +} + +// NewMockQueryExecutionInterface creates a new instance of MockQueryExecutionInterface. 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 NewMockQueryExecutionInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockQueryExecutionInterface { + mock := &MockQueryExecutionInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/serving/mock_serving_endpoints_interface.go b/experimental/mocks/service/serving/mock_serving_endpoints_interface.go index 84c106815..a4cdcf157 100644 --- a/experimental/mocks/service/serving/mock_serving_endpoints_interface.go +++ b/experimental/mocks/service/serving/mock_serving_endpoints_interface.go @@ -965,23 +965,23 @@ func (_c *MockServingEndpointsInterface_GetPermissionsByServingEndpointId_Call) } // HttpRequest provides a mock function with given fields: ctx, request -func (_m *MockServingEndpointsInterface) HttpRequest(ctx context.Context, request serving.ExternalFunctionRequest) (*serving.ExternalFunctionResponse, error) { +func (_m *MockServingEndpointsInterface) HttpRequest(ctx context.Context, request serving.ExternalFunctionRequest) (*serving.HttpRequestResponse, error) { ret := _m.Called(ctx, request) if len(ret) == 0 { panic("no return value specified for HttpRequest") } - var r0 *serving.ExternalFunctionResponse + var r0 *serving.HttpRequestResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, serving.ExternalFunctionRequest) (*serving.ExternalFunctionResponse, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, serving.ExternalFunctionRequest) (*serving.HttpRequestResponse, error)); ok { return rf(ctx, request) } - if rf, ok := ret.Get(0).(func(context.Context, serving.ExternalFunctionRequest) *serving.ExternalFunctionResponse); ok { + if rf, ok := ret.Get(0).(func(context.Context, serving.ExternalFunctionRequest) *serving.HttpRequestResponse); ok { r0 = rf(ctx, request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*serving.ExternalFunctionResponse) + r0 = ret.Get(0).(*serving.HttpRequestResponse) } } @@ -1013,12 +1013,12 @@ func (_c *MockServingEndpointsInterface_HttpRequest_Call) Run(run func(ctx conte return _c } -func (_c *MockServingEndpointsInterface_HttpRequest_Call) Return(_a0 *serving.ExternalFunctionResponse, _a1 error) *MockServingEndpointsInterface_HttpRequest_Call { +func (_c *MockServingEndpointsInterface_HttpRequest_Call) Return(_a0 *serving.HttpRequestResponse, _a1 error) *MockServingEndpointsInterface_HttpRequest_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockServingEndpointsInterface_HttpRequest_Call) RunAndReturn(run func(context.Context, serving.ExternalFunctionRequest) (*serving.ExternalFunctionResponse, error)) *MockServingEndpointsInterface_HttpRequest_Call { +func (_c *MockServingEndpointsInterface_HttpRequest_Call) RunAndReturn(run func(context.Context, serving.ExternalFunctionRequest) (*serving.HttpRequestResponse, error)) *MockServingEndpointsInterface_HttpRequest_Call { _c.Call.Return(run) return _c } diff --git a/experimental/mocks/service/settings/mock_account_settings_interface.go b/experimental/mocks/service/settings/mock_account_settings_interface.go index 978c4cc7e..82c9a3546 100644 --- a/experimental/mocks/service/settings/mock_account_settings_interface.go +++ b/experimental/mocks/service/settings/mock_account_settings_interface.go @@ -114,6 +114,53 @@ func (_c *MockAccountSettingsInterface_DisableLegacyFeatures_Call) RunAndReturn( return _c } +// EnableIpAccessLists provides a mock function with given fields: +func (_m *MockAccountSettingsInterface) EnableIpAccessLists() settings.EnableIpAccessListsInterface { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for EnableIpAccessLists") + } + + var r0 settings.EnableIpAccessListsInterface + if rf, ok := ret.Get(0).(func() settings.EnableIpAccessListsInterface); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(settings.EnableIpAccessListsInterface) + } + } + + return r0 +} + +// MockAccountSettingsInterface_EnableIpAccessLists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableIpAccessLists' +type MockAccountSettingsInterface_EnableIpAccessLists_Call struct { + *mock.Call +} + +// EnableIpAccessLists is a helper method to define mock.On call +func (_e *MockAccountSettingsInterface_Expecter) EnableIpAccessLists() *MockAccountSettingsInterface_EnableIpAccessLists_Call { + return &MockAccountSettingsInterface_EnableIpAccessLists_Call{Call: _e.mock.On("EnableIpAccessLists")} +} + +func (_c *MockAccountSettingsInterface_EnableIpAccessLists_Call) Run(run func()) *MockAccountSettingsInterface_EnableIpAccessLists_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockAccountSettingsInterface_EnableIpAccessLists_Call) Return(_a0 settings.EnableIpAccessListsInterface) *MockAccountSettingsInterface_EnableIpAccessLists_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountSettingsInterface_EnableIpAccessLists_Call) RunAndReturn(run func() settings.EnableIpAccessListsInterface) *MockAccountSettingsInterface_EnableIpAccessLists_Call { + _c.Call.Return(run) + return _c +} + // EsmEnablementAccount provides a mock function with given fields: func (_m *MockAccountSettingsInterface) EsmEnablementAccount() settings.EsmEnablementAccountInterface { ret := _m.Called() diff --git a/experimental/mocks/service/settings/mock_enable_ip_access_lists_interface.go b/experimental/mocks/service/settings/mock_enable_ip_access_lists_interface.go new file mode 100644 index 000000000..54868cbe8 --- /dev/null +++ b/experimental/mocks/service/settings/mock_enable_ip_access_lists_interface.go @@ -0,0 +1,214 @@ +// Code generated by mockery v2.43.0. DO NOT EDIT. + +package settings + +import ( + context "context" + + settings "github.com/databricks/databricks-sdk-go/service/settings" + mock "github.com/stretchr/testify/mock" +) + +// MockEnableIpAccessListsInterface is an autogenerated mock type for the EnableIpAccessListsInterface type +type MockEnableIpAccessListsInterface struct { + mock.Mock +} + +type MockEnableIpAccessListsInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockEnableIpAccessListsInterface) EXPECT() *MockEnableIpAccessListsInterface_Expecter { + return &MockEnableIpAccessListsInterface_Expecter{mock: &_m.Mock} +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockEnableIpAccessListsInterface) Delete(ctx context.Context, request settings.DeleteAccountIpAccessEnableRequest) (*settings.DeleteAccountIpAccessEnableResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 *settings.DeleteAccountIpAccessEnableResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteAccountIpAccessEnableRequest) (*settings.DeleteAccountIpAccessEnableResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.DeleteAccountIpAccessEnableRequest) *settings.DeleteAccountIpAccessEnableResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.DeleteAccountIpAccessEnableResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.DeleteAccountIpAccessEnableRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEnableIpAccessListsInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockEnableIpAccessListsInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request settings.DeleteAccountIpAccessEnableRequest +func (_e *MockEnableIpAccessListsInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockEnableIpAccessListsInterface_Delete_Call { + return &MockEnableIpAccessListsInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockEnableIpAccessListsInterface_Delete_Call) Run(run func(ctx context.Context, request settings.DeleteAccountIpAccessEnableRequest)) *MockEnableIpAccessListsInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.DeleteAccountIpAccessEnableRequest)) + }) + return _c +} + +func (_c *MockEnableIpAccessListsInterface_Delete_Call) Return(_a0 *settings.DeleteAccountIpAccessEnableResponse, _a1 error) *MockEnableIpAccessListsInterface_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEnableIpAccessListsInterface_Delete_Call) RunAndReturn(run func(context.Context, settings.DeleteAccountIpAccessEnableRequest) (*settings.DeleteAccountIpAccessEnableResponse, error)) *MockEnableIpAccessListsInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockEnableIpAccessListsInterface) Get(ctx context.Context, request settings.GetAccountIpAccessEnableRequest) (*settings.AccountIpAccessEnable, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *settings.AccountIpAccessEnable + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.GetAccountIpAccessEnableRequest) (*settings.AccountIpAccessEnable, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.GetAccountIpAccessEnableRequest) *settings.AccountIpAccessEnable); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.AccountIpAccessEnable) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.GetAccountIpAccessEnableRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEnableIpAccessListsInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockEnableIpAccessListsInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request settings.GetAccountIpAccessEnableRequest +func (_e *MockEnableIpAccessListsInterface_Expecter) Get(ctx interface{}, request interface{}) *MockEnableIpAccessListsInterface_Get_Call { + return &MockEnableIpAccessListsInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockEnableIpAccessListsInterface_Get_Call) Run(run func(ctx context.Context, request settings.GetAccountIpAccessEnableRequest)) *MockEnableIpAccessListsInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.GetAccountIpAccessEnableRequest)) + }) + return _c +} + +func (_c *MockEnableIpAccessListsInterface_Get_Call) Return(_a0 *settings.AccountIpAccessEnable, _a1 error) *MockEnableIpAccessListsInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEnableIpAccessListsInterface_Get_Call) RunAndReturn(run func(context.Context, settings.GetAccountIpAccessEnableRequest) (*settings.AccountIpAccessEnable, error)) *MockEnableIpAccessListsInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockEnableIpAccessListsInterface) Update(ctx context.Context, request settings.UpdateAccountIpAccessEnableRequest) (*settings.AccountIpAccessEnable, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *settings.AccountIpAccessEnable + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateAccountIpAccessEnableRequest) (*settings.AccountIpAccessEnable, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, settings.UpdateAccountIpAccessEnableRequest) *settings.AccountIpAccessEnable); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.AccountIpAccessEnable) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, settings.UpdateAccountIpAccessEnableRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEnableIpAccessListsInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockEnableIpAccessListsInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request settings.UpdateAccountIpAccessEnableRequest +func (_e *MockEnableIpAccessListsInterface_Expecter) Update(ctx interface{}, request interface{}) *MockEnableIpAccessListsInterface_Update_Call { + return &MockEnableIpAccessListsInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockEnableIpAccessListsInterface_Update_Call) Run(run func(ctx context.Context, request settings.UpdateAccountIpAccessEnableRequest)) *MockEnableIpAccessListsInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(settings.UpdateAccountIpAccessEnableRequest)) + }) + return _c +} + +func (_c *MockEnableIpAccessListsInterface_Update_Call) Return(_a0 *settings.AccountIpAccessEnable, _a1 error) *MockEnableIpAccessListsInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEnableIpAccessListsInterface_Update_Call) RunAndReturn(run func(context.Context, settings.UpdateAccountIpAccessEnableRequest) (*settings.AccountIpAccessEnable, error)) *MockEnableIpAccessListsInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockEnableIpAccessListsInterface creates a new instance of MockEnableIpAccessListsInterface. 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 NewMockEnableIpAccessListsInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockEnableIpAccessListsInterface { + mock := &MockEnableIpAccessListsInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/sql/mock_redash_config_interface.go b/experimental/mocks/service/sql/mock_redash_config_interface.go new file mode 100644 index 000000000..e96d5957d --- /dev/null +++ b/experimental/mocks/service/sql/mock_redash_config_interface.go @@ -0,0 +1,95 @@ +// Code generated by mockery v2.43.0. DO NOT EDIT. + +package sql + +import ( + context "context" + + sql "github.com/databricks/databricks-sdk-go/service/sql" + mock "github.com/stretchr/testify/mock" +) + +// MockRedashConfigInterface is an autogenerated mock type for the RedashConfigInterface type +type MockRedashConfigInterface struct { + mock.Mock +} + +type MockRedashConfigInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockRedashConfigInterface) EXPECT() *MockRedashConfigInterface_Expecter { + return &MockRedashConfigInterface_Expecter{mock: &_m.Mock} +} + +// GetConfig provides a mock function with given fields: ctx +func (_m *MockRedashConfigInterface) GetConfig(ctx context.Context) (*sql.ClientConfig, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetConfig") + } + + var r0 *sql.ClientConfig + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*sql.ClientConfig, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *sql.ClientConfig); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*sql.ClientConfig) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRedashConfigInterface_GetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConfig' +type MockRedashConfigInterface_GetConfig_Call struct { + *mock.Call +} + +// GetConfig is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockRedashConfigInterface_Expecter) GetConfig(ctx interface{}) *MockRedashConfigInterface_GetConfig_Call { + return &MockRedashConfigInterface_GetConfig_Call{Call: _e.mock.On("GetConfig", ctx)} +} + +func (_c *MockRedashConfigInterface_GetConfig_Call) Run(run func(ctx context.Context)) *MockRedashConfigInterface_GetConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockRedashConfigInterface_GetConfig_Call) Return(_a0 *sql.ClientConfig, _a1 error) *MockRedashConfigInterface_GetConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRedashConfigInterface_GetConfig_Call) RunAndReturn(run func(context.Context) (*sql.ClientConfig, error)) *MockRedashConfigInterface_GetConfig_Call { + _c.Call.Return(run) + return _c +} + +// NewMockRedashConfigInterface creates a new instance of MockRedashConfigInterface. 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 NewMockRedashConfigInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRedashConfigInterface { + mock := &MockRedashConfigInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/service/billing/api.go b/service/billing/api.go index 83e8daff2..ae62bb149 100755 --- a/service/billing/api.go +++ b/service/billing/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Billable Usage, Budgets, Log Delivery, Usage Dashboards, etc. +// These APIs allow you to manage Billable Usage, Budget Policy, Budgets, Log Delivery, Usage Dashboards, etc. package billing import ( @@ -43,6 +43,127 @@ type BillableUsageAPI struct { billableUsageImpl } +type BudgetPolicyInterface interface { + + // Create a budget policy. + // + // Creates a new policy. + Create(ctx context.Context, request CreateBudgetPolicyRequest) (*BudgetPolicy, error) + + // Delete a budget policy. + // + // Deletes a policy + Delete(ctx context.Context, request DeleteBudgetPolicyRequest) error + + // Delete a budget policy. + // + // Deletes a policy + DeleteByPolicyId(ctx context.Context, policyId string) error + + // Get a budget policy. + // + // Retrieves a policy by it's ID. + Get(ctx context.Context, request GetBudgetPolicyRequest) (*BudgetPolicy, error) + + // Get a budget policy. + // + // Retrieves a policy by it's ID. + GetByPolicyId(ctx context.Context, policyId string) (*BudgetPolicy, error) + + // List policies. + // + // Lists all policies. Policies are returned in the alphabetically ascending + // order of their names. + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListBudgetPoliciesRequest) listing.Iterator[BudgetPolicy] + + // List policies. + // + // Lists all policies. Policies are returned in the alphabetically ascending + // order of their names. + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListBudgetPoliciesRequest) ([]BudgetPolicy, error) + + // Update a budget policy. + // + // Updates a policy + Update(ctx context.Context, request UpdateBudgetPolicyRequest) (*BudgetPolicy, error) +} + +func NewBudgetPolicy(client *client.DatabricksClient) *BudgetPolicyAPI { + return &BudgetPolicyAPI{ + budgetPolicyImpl: budgetPolicyImpl{ + client: client, + }, + } +} + +// A service serves REST API about Budget policies +type BudgetPolicyAPI struct { + budgetPolicyImpl +} + +// Delete a budget policy. +// +// Deletes a policy +func (a *BudgetPolicyAPI) DeleteByPolicyId(ctx context.Context, policyId string) error { + return a.budgetPolicyImpl.Delete(ctx, DeleteBudgetPolicyRequest{ + PolicyId: policyId, + }) +} + +// Get a budget policy. +// +// Retrieves a policy by it's ID. +func (a *BudgetPolicyAPI) GetByPolicyId(ctx context.Context, policyId string) (*BudgetPolicy, error) { + return a.budgetPolicyImpl.Get(ctx, GetBudgetPolicyRequest{ + PolicyId: policyId, + }) +} + +// List policies. +// +// Lists all policies. Policies are returned in the alphabetically ascending +// order of their names. +// +// This method is generated by Databricks SDK Code Generator. +func (a *BudgetPolicyAPI) List(ctx context.Context, request ListBudgetPoliciesRequest) listing.Iterator[BudgetPolicy] { + + getNextPage := func(ctx context.Context, req ListBudgetPoliciesRequest) (*ListBudgetPoliciesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.budgetPolicyImpl.List(ctx, req) + } + getItems := func(resp *ListBudgetPoliciesResponse) []BudgetPolicy { + return resp.Policies + } + getNextReq := func(resp *ListBudgetPoliciesResponse) *ListBudgetPoliciesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List policies. +// +// Lists all policies. Policies are returned in the alphabetically ascending +// order of their names. +// +// This method is generated by Databricks SDK Code Generator. +func (a *BudgetPolicyAPI) ListAll(ctx context.Context, request ListBudgetPoliciesRequest) ([]BudgetPolicy, error) { + iterator := a.List(ctx, request) + return listing.ToSlice[BudgetPolicy](ctx, iterator) +} + type BudgetsInterface interface { // Create new budget. diff --git a/service/billing/impl.go b/service/billing/impl.go index 85942be54..330e181ee 100755 --- a/service/billing/impl.go +++ b/service/billing/impl.go @@ -25,6 +25,63 @@ func (a *billableUsageImpl) Download(ctx context.Context, request DownloadReques return &downloadResponse, err } +// unexported type that holds implementations of just BudgetPolicy API methods +type budgetPolicyImpl struct { + client *client.DatabricksClient +} + +func (a *budgetPolicyImpl) Create(ctx context.Context, request CreateBudgetPolicyRequest) (*BudgetPolicy, error) { + var budgetPolicy BudgetPolicy + path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &budgetPolicy) + return &budgetPolicy, err +} + +func (a *budgetPolicyImpl) Delete(ctx context.Context, request DeleteBudgetPolicyRequest) error { + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) + return err +} + +func (a *budgetPolicyImpl) Get(ctx context.Context, request GetBudgetPolicyRequest) (*BudgetPolicy, error) { + var budgetPolicy BudgetPolicy + path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) + 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, &budgetPolicy) + return &budgetPolicy, err +} + +func (a *budgetPolicyImpl) List(ctx context.Context, request ListBudgetPoliciesRequest) (*ListBudgetPoliciesResponse, error) { + var listBudgetPoliciesResponse ListBudgetPoliciesResponse + path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listBudgetPoliciesResponse) + return &listBudgetPoliciesResponse, err +} + +func (a *budgetPolicyImpl) Update(ctx context.Context, request UpdateBudgetPolicyRequest) (*BudgetPolicy, error) { + var budgetPolicy BudgetPolicy + path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) + 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.Policy, &budgetPolicy) + return &budgetPolicy, err +} + // unexported type that holds implementations of just budgets API methods type budgetsImpl struct { client *client.DatabricksClient diff --git a/service/billing/interface.go b/service/billing/interface.go index c67e4d8e8..b5d50594c 100755 --- a/service/billing/interface.go +++ b/service/billing/interface.go @@ -26,6 +26,38 @@ type BillableUsageService interface { Download(ctx context.Context, request DownloadRequest) (*DownloadResponse, error) } +// A service serves REST API about Budget policies +type BudgetPolicyService interface { + + // Create a budget policy. + // + // Creates a new policy. + Create(ctx context.Context, request CreateBudgetPolicyRequest) (*BudgetPolicy, error) + + // Delete a budget policy. + // + // Deletes a policy + Delete(ctx context.Context, request DeleteBudgetPolicyRequest) error + + // Get a budget policy. + // + // Retrieves a policy by it's ID. + Get(ctx context.Context, request GetBudgetPolicyRequest) (*BudgetPolicy, error) + + // List policies. + // + // Lists all policies. Policies are returned in the alphabetically ascending + // order of their names. + // + // Use ListAll() to get all BudgetPolicy instances, which will iterate over every result page. + List(ctx context.Context, request ListBudgetPoliciesRequest) (*ListBudgetPoliciesResponse, error) + + // Update a budget policy. + // + // Updates a policy + Update(ctx context.Context, request UpdateBudgetPolicyRequest) (*BudgetPolicy, error) +} + // These APIs manage budget configurations for this account. Budgets enable you // to monitor usage across your account. You can set up budgets to either track // account-wide spending, or apply filters to track the spending of specific diff --git a/service/billing/model.go b/service/billing/model.go index e1aec066d..1829f9c72 100644 --- a/service/billing/model.go +++ b/service/billing/model.go @@ -7,6 +7,7 @@ import ( "io" "github.com/databricks/databricks-sdk-go/marshal" + "github.com/databricks/databricks-sdk-go/service/compute" ) type ActionConfiguration struct { @@ -250,6 +251,29 @@ type BudgetConfigurationFilterWorkspaceIdClause struct { Values []int64 `json:"values,omitempty"` } +// Contains the BudgetPolicy details. +type BudgetPolicy struct { + // A list of tags defined by the customer. At most 20 entries are allowed + // per policy. + CustomTags []compute.CustomPolicyTag `json:"custom_tags,omitempty"` + // The Id of the policy. This field is generated by Databricks and globally + // unique. + PolicyId string `json:"policy_id"` + // The name of the policy. - Must be unique among active policies. - Can + // contain only characters from the ISO 8859-1 (latin1) set. + PolicyName string `json:"policy_name,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *BudgetPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s BudgetPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type CreateBillingUsageDashboardRequest struct { // Workspace level usage dashboard shows usage data for the specified // workspace ID. Global level usage dashboard shows usage data for all @@ -364,6 +388,31 @@ type CreateBudgetConfigurationResponse struct { Budget *BudgetConfiguration `json:"budget,omitempty"` } +// A request to create a BudgetPolicy. +type CreateBudgetPolicyRequest struct { + // A list of tags defined by the customer. At most 40 entries are allowed + // per policy. + CustomTags []compute.CustomPolicyTag `json:"custom_tags,omitempty"` + // The name of the policy. - Must be unique among active policies. - Can + // contain only characters of 0-9, a-z, A-Z, -, =, ., :, /, @, _, +, + // whitespace. + PolicyName string `json:"policy_name,omitempty"` + // A unique identifier for this request. Restricted to 36 ASCII characters. + // A random UUID is recommended. This request is only idempotent if a + // `request_id` is provided. + RequestId string `json:"request_id,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *CreateBudgetPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateBudgetPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type CreateLogDeliveryConfigurationParams struct { // The optional human-readable name of the log delivery configuration. // Defaults to empty. @@ -455,6 +504,15 @@ type DeleteBudgetConfigurationRequest struct { type DeleteBudgetConfigurationResponse struct { } +// Delete a budget policy +type DeleteBudgetPolicyRequest struct { + // The Id of the policy. + PolicyId string `json:"-" url:"-"` +} + +type DeleteResponse struct { +} + // The status string for log delivery. Possible values are: * `CREATED`: There // were no log delivery attempts since the config was created. * `SUCCEEDED`: // The latest attempt of log delivery has succeeded completely. * @@ -533,6 +591,30 @@ type DownloadResponse struct { Contents io.ReadCloser `json:"-"` } +// Structured representation of a filter to be applied to a list of policies. +// All specified filters will be applied in conjunction. +type Filter struct { + // The policy creator user id to be filtered on. If unspecified, all + // policies will be returned. + CreatorUserId int64 `json:"creator_user_id,omitempty" url:"creator_user_id,omitempty"` + // The policy creator user name to be filtered on. If unspecified, all + // policies will be returned. + CreatorUserName string `json:"creator_user_name,omitempty" url:"creator_user_name,omitempty"` + // The partial name of policies to be filtered on. If unspecified, all + // policies will be returned. + PolicyName string `json:"policy_name,omitempty" url:"policy_name,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *Filter) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Filter) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Get usage dashboard type GetBillingUsageDashboardRequest struct { // Workspace level usage dashboard shows usage data for the specified @@ -581,6 +663,12 @@ type GetBudgetConfigurationResponse struct { Budget *BudgetConfiguration `json:"budget,omitempty"` } +// Get a budget policy +type GetBudgetPolicyRequest struct { + // The Id of the policy. + PolicyId string `json:"-" url:"-"` +} + // Get log delivery configuration type GetLogDeliveryRequest struct { // Databricks log delivery configuration ID @@ -622,6 +710,58 @@ func (s ListBudgetConfigurationsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// List policies +type ListBudgetPoliciesRequest struct { + // A filter to apply to the list of policies. + FilterBy *Filter `json:"-" url:"filter_by,omitempty"` + // The maximum number of budget policies to return. If unspecified, at most + // 100 budget policies 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 `ListServerlessPolicies` call. + // Provide this to retrieve the subsequent page. If unspecified, the first + // page will be returned. + // + // When paginating, all other parameters provided to + // `ListServerlessPoliciesRequest` must match the call that provided the + // page token. + PageToken string `json:"-" url:"page_token,omitempty"` + // The sort specification. + SortSpec *SortSpec `json:"-" url:"sort_spec,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ListBudgetPoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListBudgetPoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// A list of policies. +type ListBudgetPoliciesResponse 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"` + + Policies []BudgetPolicy `json:"policies,omitempty"` + // A token that can be sent as `page_token` to retrieve the previous page. + // In this field is omitted, there are no previous pages. + PreviousPageToken string `json:"previous_page_token,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ListBudgetPoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListBudgetPoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Get all log delivery configurations type ListLogDeliveryRequest struct { // Filter by credential configuration ID. @@ -880,6 +1020,48 @@ func (f *OutputFormat) Type() string { type PatchStatusResponse struct { } +type SortSpec struct { + // Whether to sort in descending order. + Descending bool `json:"descending,omitempty" url:"descending,omitempty"` + // The filed to sort by + Field SortSpecField `json:"field,omitempty" url:"field,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *SortSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SortSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type SortSpecField string + +const SortSpecFieldPolicyName SortSpecField = `POLICY_NAME` + +// String representation for [fmt.Print] +func (f *SortSpecField) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *SortSpecField) Set(v string) error { + switch v { + case `POLICY_NAME`: + *f = SortSpecField(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "POLICY_NAME"`, v) + } +} + +// Type always returns SortSpecField to satisfy [pflag.Value] interface +func (f *SortSpecField) Type() string { + return "SortSpecField" +} + type UpdateBudgetConfigurationBudget struct { // Databricks account ID. AccountId string `json:"account_id,omitempty"` @@ -920,6 +1102,15 @@ type UpdateBudgetConfigurationResponse struct { Budget *BudgetConfiguration `json:"budget,omitempty"` } +// Update a budget policy +type UpdateBudgetPolicyRequest struct { + // Contains the BudgetPolicy details. + Policy *BudgetPolicy `json:"policy,omitempty"` + // The Id of the policy. This field is generated by Databricks and globally + // unique. + PolicyId string `json:"-" url:"-"` +} + type UpdateLogDeliveryConfigurationStatusRequest struct { // Databricks log delivery configuration ID LogDeliveryConfigurationId string `json:"-" url:"-"` diff --git a/service/catalog/model.go b/service/catalog/model.go index 4493e9b3e..010abbdc6 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -378,8 +378,6 @@ type CatalogInfo struct { ProviderName string `json:"provider_name,omitempty"` // Status of an asynchronously provisioned resource. ProvisioningInfo *ProvisioningInfo `json:"provisioning_info,omitempty"` - // Kind of catalog securable. - SecurableKind CatalogInfoSecurableKind `json:"securable_kind,omitempty"` SecurableType string `json:"securable_type,omitempty"` // The name of the share under the share provider. @@ -404,56 +402,6 @@ func (s CatalogInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Kind of catalog securable. -type CatalogInfoSecurableKind string - -const CatalogInfoSecurableKindCatalogDeltasharing CatalogInfoSecurableKind = `CATALOG_DELTASHARING` - -const CatalogInfoSecurableKindCatalogForeignBigquery CatalogInfoSecurableKind = `CATALOG_FOREIGN_BIGQUERY` - -const CatalogInfoSecurableKindCatalogForeignDatabricks CatalogInfoSecurableKind = `CATALOG_FOREIGN_DATABRICKS` - -const CatalogInfoSecurableKindCatalogForeignMysql CatalogInfoSecurableKind = `CATALOG_FOREIGN_MYSQL` - -const CatalogInfoSecurableKindCatalogForeignPostgresql CatalogInfoSecurableKind = `CATALOG_FOREIGN_POSTGRESQL` - -const CatalogInfoSecurableKindCatalogForeignRedshift CatalogInfoSecurableKind = `CATALOG_FOREIGN_REDSHIFT` - -const CatalogInfoSecurableKindCatalogForeignSnowflake CatalogInfoSecurableKind = `CATALOG_FOREIGN_SNOWFLAKE` - -const CatalogInfoSecurableKindCatalogForeignSqldw CatalogInfoSecurableKind = `CATALOG_FOREIGN_SQLDW` - -const CatalogInfoSecurableKindCatalogForeignSqlserver CatalogInfoSecurableKind = `CATALOG_FOREIGN_SQLSERVER` - -const CatalogInfoSecurableKindCatalogInternal CatalogInfoSecurableKind = `CATALOG_INTERNAL` - -const CatalogInfoSecurableKindCatalogStandard CatalogInfoSecurableKind = `CATALOG_STANDARD` - -const CatalogInfoSecurableKindCatalogSystem CatalogInfoSecurableKind = `CATALOG_SYSTEM` - -const CatalogInfoSecurableKindCatalogSystemDeltasharing CatalogInfoSecurableKind = `CATALOG_SYSTEM_DELTASHARING` - -// String representation for [fmt.Print] -func (f *CatalogInfoSecurableKind) String() string { - return string(*f) -} - -// Set raw string value and validate it against allowed values -func (f *CatalogInfoSecurableKind) Set(v string) error { - switch v { - case `CATALOG_DELTASHARING`, `CATALOG_FOREIGN_BIGQUERY`, `CATALOG_FOREIGN_DATABRICKS`, `CATALOG_FOREIGN_MYSQL`, `CATALOG_FOREIGN_POSTGRESQL`, `CATALOG_FOREIGN_REDSHIFT`, `CATALOG_FOREIGN_SNOWFLAKE`, `CATALOG_FOREIGN_SQLDW`, `CATALOG_FOREIGN_SQLSERVER`, `CATALOG_INTERNAL`, `CATALOG_STANDARD`, `CATALOG_SYSTEM`, `CATALOG_SYSTEM_DELTASHARING`: - *f = CatalogInfoSecurableKind(v) - return nil - default: - return fmt.Errorf(`value "%s" is not one of "CATALOG_DELTASHARING", "CATALOG_FOREIGN_BIGQUERY", "CATALOG_FOREIGN_DATABRICKS", "CATALOG_FOREIGN_MYSQL", "CATALOG_FOREIGN_POSTGRESQL", "CATALOG_FOREIGN_REDSHIFT", "CATALOG_FOREIGN_SNOWFLAKE", "CATALOG_FOREIGN_SQLDW", "CATALOG_FOREIGN_SQLSERVER", "CATALOG_INTERNAL", "CATALOG_STANDARD", "CATALOG_SYSTEM", "CATALOG_SYSTEM_DELTASHARING"`, v) - } -} - -// Type always returns CatalogInfoSecurableKind to satisfy [pflag.Value] interface -func (f *CatalogInfoSecurableKind) Type() string { - return "CatalogInfoSecurableKind" -} - // Whether the current securable is accessible from all workspaces or a specific // set of workspaces. type CatalogIsolationMode string @@ -676,8 +624,6 @@ type ConnectionInfo struct { ProvisioningInfo *ProvisioningInfo `json:"provisioning_info,omitempty"` // If the connection is read only. ReadOnly bool `json:"read_only,omitempty"` - // Kind of connection securable. - SecurableKind ConnectionInfoSecurableKind `json:"securable_kind,omitempty"` SecurableType string `json:"securable_type,omitempty"` // Time at which this connection was updated, in epoch milliseconds. @@ -698,56 +644,6 @@ func (s ConnectionInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Kind of connection securable. -type ConnectionInfoSecurableKind string - -const ConnectionInfoSecurableKindConnectionBigquery ConnectionInfoSecurableKind = `CONNECTION_BIGQUERY` - -const ConnectionInfoSecurableKindConnectionBuiltinHiveMetastore ConnectionInfoSecurableKind = `CONNECTION_BUILTIN_HIVE_METASTORE` - -const ConnectionInfoSecurableKindConnectionDatabricks ConnectionInfoSecurableKind = `CONNECTION_DATABRICKS` - -const ConnectionInfoSecurableKindConnectionExternalHiveMetastore ConnectionInfoSecurableKind = `CONNECTION_EXTERNAL_HIVE_METASTORE` - -const ConnectionInfoSecurableKindConnectionGlue ConnectionInfoSecurableKind = `CONNECTION_GLUE` - -const ConnectionInfoSecurableKindConnectionHttpBearer ConnectionInfoSecurableKind = `CONNECTION_HTTP_BEARER` - -const ConnectionInfoSecurableKindConnectionMysql ConnectionInfoSecurableKind = `CONNECTION_MYSQL` - -const ConnectionInfoSecurableKindConnectionOnlineCatalog ConnectionInfoSecurableKind = `CONNECTION_ONLINE_CATALOG` - -const ConnectionInfoSecurableKindConnectionPostgresql ConnectionInfoSecurableKind = `CONNECTION_POSTGRESQL` - -const ConnectionInfoSecurableKindConnectionRedshift ConnectionInfoSecurableKind = `CONNECTION_REDSHIFT` - -const ConnectionInfoSecurableKindConnectionSnowflake ConnectionInfoSecurableKind = `CONNECTION_SNOWFLAKE` - -const ConnectionInfoSecurableKindConnectionSqldw ConnectionInfoSecurableKind = `CONNECTION_SQLDW` - -const ConnectionInfoSecurableKindConnectionSqlserver ConnectionInfoSecurableKind = `CONNECTION_SQLSERVER` - -// String representation for [fmt.Print] -func (f *ConnectionInfoSecurableKind) String() string { - return string(*f) -} - -// Set raw string value and validate it against allowed values -func (f *ConnectionInfoSecurableKind) Set(v string) error { - switch v { - case `CONNECTION_BIGQUERY`, `CONNECTION_BUILTIN_HIVE_METASTORE`, `CONNECTION_DATABRICKS`, `CONNECTION_EXTERNAL_HIVE_METASTORE`, `CONNECTION_GLUE`, `CONNECTION_HTTP_BEARER`, `CONNECTION_MYSQL`, `CONNECTION_ONLINE_CATALOG`, `CONNECTION_POSTGRESQL`, `CONNECTION_REDSHIFT`, `CONNECTION_SNOWFLAKE`, `CONNECTION_SQLDW`, `CONNECTION_SQLSERVER`: - *f = ConnectionInfoSecurableKind(v) - return nil - default: - return fmt.Errorf(`value "%s" is not one of "CONNECTION_BIGQUERY", "CONNECTION_BUILTIN_HIVE_METASTORE", "CONNECTION_DATABRICKS", "CONNECTION_EXTERNAL_HIVE_METASTORE", "CONNECTION_GLUE", "CONNECTION_HTTP_BEARER", "CONNECTION_MYSQL", "CONNECTION_ONLINE_CATALOG", "CONNECTION_POSTGRESQL", "CONNECTION_REDSHIFT", "CONNECTION_SNOWFLAKE", "CONNECTION_SQLDW", "CONNECTION_SQLSERVER"`, v) - } -} - -// Type always returns ConnectionInfoSecurableKind to satisfy [pflag.Value] interface -func (f *ConnectionInfoSecurableKind) Type() string { - return "ConnectionInfoSecurableKind" -} - // The type of connection. type ConnectionType string @@ -4928,33 +4824,35 @@ type SecurablePropertiesMap map[string]string // The type of Unity Catalog securable type SecurableType string -const SecurableTypeCatalog SecurableType = `catalog` +const SecurableTypeCatalog SecurableType = `CATALOG` + +const SecurableTypeCleanRoom SecurableType = `CLEAN_ROOM` -const SecurableTypeConnection SecurableType = `connection` +const SecurableTypeConnection SecurableType = `CONNECTION` -const SecurableTypeCredential SecurableType = `credential` +const SecurableTypeCredential SecurableType = `CREDENTIAL` -const SecurableTypeExternalLocation SecurableType = `external_location` +const SecurableTypeExternalLocation SecurableType = `EXTERNAL_LOCATION` -const SecurableTypeFunction SecurableType = `function` +const SecurableTypeFunction SecurableType = `FUNCTION` -const SecurableTypeMetastore SecurableType = `metastore` +const SecurableTypeMetastore SecurableType = `METASTORE` -const SecurableTypePipeline SecurableType = `pipeline` +const SecurableTypePipeline SecurableType = `PIPELINE` -const SecurableTypeProvider SecurableType = `provider` +const SecurableTypeProvider SecurableType = `PROVIDER` -const SecurableTypeRecipient SecurableType = `recipient` +const SecurableTypeRecipient SecurableType = `RECIPIENT` -const SecurableTypeSchema SecurableType = `schema` +const SecurableTypeSchema SecurableType = `SCHEMA` -const SecurableTypeShare SecurableType = `share` +const SecurableTypeShare SecurableType = `SHARE` -const SecurableTypeStorageCredential SecurableType = `storage_credential` +const SecurableTypeStorageCredential SecurableType = `STORAGE_CREDENTIAL` -const SecurableTypeTable SecurableType = `table` +const SecurableTypeTable SecurableType = `TABLE` -const SecurableTypeVolume SecurableType = `volume` +const SecurableTypeVolume SecurableType = `VOLUME` // String representation for [fmt.Print] func (f *SecurableType) String() string { @@ -4964,11 +4862,11 @@ func (f *SecurableType) String() string { // Set raw string value and validate it against allowed values func (f *SecurableType) Set(v string) error { switch v { - case `catalog`, `connection`, `credential`, `external_location`, `function`, `metastore`, `pipeline`, `provider`, `recipient`, `schema`, `share`, `storage_credential`, `table`, `volume`: + case `CATALOG`, `CLEAN_ROOM`, `CONNECTION`, `CREDENTIAL`, `EXTERNAL_LOCATION`, `FUNCTION`, `METASTORE`, `PIPELINE`, `PROVIDER`, `RECIPIENT`, `SCHEMA`, `SHARE`, `STORAGE_CREDENTIAL`, `TABLE`, `VOLUME`: *f = SecurableType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "catalog", "connection", "credential", "external_location", "function", "metastore", "pipeline", "provider", "recipient", "schema", "share", "storage_credential", "table", "volume"`, v) + return fmt.Errorf(`value "%s" is not one of "CATALOG", "CLEAN_ROOM", "CONNECTION", "CREDENTIAL", "EXTERNAL_LOCATION", "FUNCTION", "METASTORE", "PIPELINE", "PROVIDER", "RECIPIENT", "SCHEMA", "SHARE", "STORAGE_CREDENTIAL", "TABLE", "VOLUME"`, v) } } @@ -5369,6 +5267,9 @@ type TemporaryCredentials struct { // Server time when the credential will expire, in epoch milliseconds. The // API client is advised to cache the credential given this expiration time. ExpirationTime int64 `json:"expiration_time,omitempty"` + // GCP temporary credentials for API authentication. Read more at + // https://developers.google.com/identity/protocols/oauth2/service-account + GcpOauthToken *GcpOauthToken `json:"gcp_oauth_token,omitempty"` ForceSendFields []string `json:"-"` } @@ -5463,6 +5364,8 @@ type UpdateCatalog struct { Name string `json:"-" url:"-"` // New name for the catalog. NewName string `json:"new_name,omitempty"` + // A map of key-value properties attached to the securable. + Options map[string]string `json:"options,omitempty"` // Username of current owner of catalog. Owner string `json:"owner,omitempty"` // A map of key-value properties attached to the securable. diff --git a/service/cleanrooms/api.go b/service/cleanrooms/api.go index 41fe43afd..df4c63937 100755 --- a/service/cleanrooms/api.go +++ b/service/cleanrooms/api.go @@ -230,7 +230,8 @@ type CleanRoomsInterface interface { // Create a new clean room with the specified collaborators. This method is // asynchronous; the returned name field inside the clean_room field can be used // to poll the clean room status, using the :method:cleanrooms/get method. When - // this method returns, the cluster will be in a PROVISIONING state. The cluster + // this method returns, the clean room will be in a PROVISIONING state, with + // only name, owner, comment, created_at and status populated. The clean room // will be usable once it enters an ACTIVE state. // // The caller must be a metastore admin or have the **CREATE_CLEAN_ROOM** diff --git a/service/cleanrooms/interface.go b/service/cleanrooms/interface.go index 6165f4e97..98262d34c 100755 --- a/service/cleanrooms/interface.go +++ b/service/cleanrooms/interface.go @@ -63,8 +63,9 @@ type CleanRoomsService interface { // Create a new clean room with the specified collaborators. This method is // asynchronous; the returned name field inside the clean_room field can be // used to poll the clean room status, using the :method:cleanrooms/get - // method. When this method returns, the cluster will be in a PROVISIONING - // state. The cluster will be usable once it enters an ACTIVE state. + // method. When this method returns, the clean room will be in a + // PROVISIONING state, with only name, owner, comment, created_at and status + // populated. The clean room will be usable once it enters an ACTIVE state. // // The caller must be a metastore admin or have the **CREATE_CLEAN_ROOM** // privilege on the metastore. diff --git a/service/compute/model.go b/service/compute/model.go index 5fe81ced7..fbf873ca2 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -1935,6 +1935,33 @@ func (s Created) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CustomPolicyTag struct { + // The key of the tag. - Must be unique among all custom tags of the same + // policy - Cannot be “budget-policy-name”, “budget-policy-id” or + // "budget-policy-resolution-result" - these tags are preserved. + // + // - Follows the regex pattern defined in + // cluster-common/conf/src/ClusterTagConstraints.scala + // (https://src.dev.databricks.com/databricks/universe@1647196627c8dc7b4152ad098a94b86484b93a6c/-/blob/cluster-common/conf/src/ClusterTagConstraints.scala?L17) + Key string `json:"key"` + // The value of the tag. + // + // - Follows the regex pattern defined in + // cluster-common/conf/src/ClusterTagConstraints.scala + // (https://src.dev.databricks.com/databricks/universe@1647196627c8dc7b4152ad098a94b86484b93a6c/-/blob/cluster-common/conf/src/ClusterTagConstraints.scala?L24) + Value string `json:"value,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *CustomPolicyTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CustomPolicyTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type DataPlaneEventDetails struct { // EventType DataPlaneEventDetailsEventType `json:"event_type,omitempty"` diff --git a/service/dashboards/api.go b/service/dashboards/api.go index 1ec369728..11f706c95 100755 --- a/service/dashboards/api.go +++ b/service/dashboards/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Genie, Lakeview, etc. +// These APIs allow you to manage Genie, Lakeview, Lakeview Embedded, Query Execution, etc. package dashboards import ( @@ -609,3 +609,63 @@ func (a *LakeviewAPI) UnpublishByDashboardId(ctx context.Context, dashboardId st DashboardId: dashboardId, }) } + +type LakeviewEmbeddedInterface interface { + + // Read a published dashboard in an embedded ui. + // + // Get the current published dashboard within an embedded context. + GetPublishedDashboardEmbedded(ctx context.Context, request GetPublishedDashboardEmbeddedRequest) error + + // Read a published dashboard in an embedded ui. + // + // Get the current published dashboard within an embedded context. + GetPublishedDashboardEmbeddedByDashboardId(ctx context.Context, dashboardId string) error +} + +func NewLakeviewEmbedded(client *client.DatabricksClient) *LakeviewEmbeddedAPI { + return &LakeviewEmbeddedAPI{ + lakeviewEmbeddedImpl: lakeviewEmbeddedImpl{ + client: client, + }, + } +} + +// Token-based Lakeview APIs for embedding dashboards in external applications. +type LakeviewEmbeddedAPI struct { + lakeviewEmbeddedImpl +} + +// Read a published dashboard in an embedded ui. +// +// Get the current published dashboard within an embedded context. +func (a *LakeviewEmbeddedAPI) GetPublishedDashboardEmbeddedByDashboardId(ctx context.Context, dashboardId string) error { + return a.lakeviewEmbeddedImpl.GetPublishedDashboardEmbedded(ctx, GetPublishedDashboardEmbeddedRequest{ + DashboardId: dashboardId, + }) +} + +type QueryExecutionInterface interface { + + // Cancel the results for the a query for a published, embedded dashboard. + CancelPublishedQueryExecution(ctx context.Context, request CancelPublishedQueryExecutionRequest) (*CancelQueryExecutionResponse, error) + + // Execute a query for a published dashboard. + ExecutePublishedDashboardQuery(ctx context.Context, request ExecutePublishedDashboardQueryRequest) error + + // Poll the results for the a query for a published, embedded dashboard. + PollPublishedQueryStatus(ctx context.Context, request PollPublishedQueryStatusRequest) (*PollQueryStatusResponse, error) +} + +func NewQueryExecution(client *client.DatabricksClient) *QueryExecutionAPI { + return &QueryExecutionAPI{ + queryExecutionImpl: queryExecutionImpl{ + client: client, + }, + } +} + +// Query execution APIs for AI / BI Dashboards +type QueryExecutionAPI struct { + queryExecutionImpl +} diff --git a/service/dashboards/impl.go b/service/dashboards/impl.go index c23deddd6..cd55850bc 100755 --- a/service/dashboards/impl.go +++ b/service/dashboards/impl.go @@ -258,3 +258,54 @@ func (a *lakeviewImpl) UpdateSchedule(ctx context.Context, request UpdateSchedul err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.Schedule, &schedule) return &schedule, err } + +// unexported type that holds implementations of just LakeviewEmbedded API methods +type lakeviewEmbeddedImpl struct { + client *client.DatabricksClient +} + +func (a *lakeviewEmbeddedImpl) GetPublishedDashboardEmbedded(ctx context.Context, request GetPublishedDashboardEmbeddedRequest) error { + var getPublishedDashboardEmbeddedResponse GetPublishedDashboardEmbeddedResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published/embedded", request.DashboardId) + 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, &getPublishedDashboardEmbeddedResponse) + return err +} + +// unexported type that holds implementations of just QueryExecution API methods +type queryExecutionImpl struct { + client *client.DatabricksClient +} + +func (a *queryExecutionImpl) CancelPublishedQueryExecution(ctx context.Context, request CancelPublishedQueryExecutionRequest) (*CancelQueryExecutionResponse, error) { + var cancelQueryExecutionResponse CancelQueryExecutionResponse + path := "/api/2.0/lakeview-query/query/published" + 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, &cancelQueryExecutionResponse) + return &cancelQueryExecutionResponse, err +} + +func (a *queryExecutionImpl) ExecutePublishedDashboardQuery(ctx context.Context, request ExecutePublishedDashboardQueryRequest) error { + var executeQueryResponse ExecuteQueryResponse + path := "/api/2.0/lakeview-query/query/published" + 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, &executeQueryResponse) + return err +} + +func (a *queryExecutionImpl) PollPublishedQueryStatus(ctx context.Context, request PollPublishedQueryStatusRequest) (*PollQueryStatusResponse, error) { + var pollQueryStatusResponse PollQueryStatusResponse + path := "/api/2.0/lakeview-query/query/published" + 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, &pollQueryStatusResponse) + return &pollQueryStatusResponse, err +} diff --git a/service/dashboards/interface.go b/service/dashboards/interface.go index 76c728fc8..aeff5a93d 100755 --- a/service/dashboards/interface.go +++ b/service/dashboards/interface.go @@ -124,3 +124,25 @@ type LakeviewService interface { // Update dashboard schedule. UpdateSchedule(ctx context.Context, request UpdateScheduleRequest) (*Schedule, error) } + +// Token-based Lakeview APIs for embedding dashboards in external applications. +type LakeviewEmbeddedService interface { + + // Read a published dashboard in an embedded ui. + // + // Get the current published dashboard within an embedded context. + GetPublishedDashboardEmbedded(ctx context.Context, request GetPublishedDashboardEmbeddedRequest) error +} + +// Query execution APIs for AI / BI Dashboards +type QueryExecutionService interface { + + // Cancel the results for the a query for a published, embedded dashboard. + CancelPublishedQueryExecution(ctx context.Context, request CancelPublishedQueryExecutionRequest) (*CancelQueryExecutionResponse, error) + + // Execute a query for a published dashboard. + ExecutePublishedDashboardQuery(ctx context.Context, request ExecutePublishedDashboardQueryRequest) error + + // Poll the results for the a query for a published, embedded dashboard. + PollPublishedQueryStatus(ctx context.Context, request PollPublishedQueryStatusRequest) (*PollQueryStatusResponse, error) +} diff --git a/service/dashboards/model.go b/service/dashboards/model.go index 495e6b8db..7c7fd809e 100755 --- a/service/dashboards/model.go +++ b/service/dashboards/model.go @@ -9,6 +9,32 @@ import ( "github.com/databricks/databricks-sdk-go/service/sql" ) +// Cancel the results for the a query for a published, embedded dashboard +type CancelPublishedQueryExecutionRequest struct { + DashboardName string `json:"-" url:"dashboard_name"` + + DashboardRevisionId string `json:"-" url:"dashboard_revision_id"` + // Example: + // EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ + Tokens []string `json:"-" url:"tokens,omitempty"` +} + +type CancelQueryExecutionResponse struct { + Status []CancelQueryExecutionResponseStatus `json:"status,omitempty"` +} + +type CancelQueryExecutionResponseStatus struct { + // The token to poll for result asynchronously Example: + // EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ + DataToken string `json:"data_token"` + // Represents an empty message, similar to google.protobuf.Empty, which is + // not available in the firm right now. + Pending *Empty `json:"pending,omitempty"` + // Represents an empty message, similar to google.protobuf.Empty, which is + // not available in the firm right now. + Success *Empty `json:"success,omitempty"` +} + // Create dashboard type CreateDashboardRequest struct { Dashboard *Dashboard `json:"dashboard,omitempty"` @@ -223,6 +249,40 @@ func (s DeleteSubscriptionRequest) MarshalJSON() ([]byte, error) { type DeleteSubscriptionResponse struct { } +// Represents an empty message, similar to google.protobuf.Empty, which is not +// available in the firm right now. +type Empty struct { +} + +// Execute query request for published Dashboards. Since published dashboards +// have the option of running as the publisher, the datasets, warehouse_id are +// excluded from the request and instead read from the source (lakeview-config) +// via the additional parameters (dashboardName and dashboardRevisionId) +type ExecutePublishedDashboardQueryRequest struct { + // Dashboard name and revision_id is required to retrieve + // PublishedDatasetDataModel which contains the list of datasets, + // warehouse_id, and embedded_credentials + DashboardName string `json:"dashboard_name"` + + DashboardRevisionId string `json:"dashboard_revision_id"` + // A dashboard schedule can override the warehouse used as compute for + // processing the published dashboard queries + OverrideWarehouseId string `json:"override_warehouse_id,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ExecutePublishedDashboardQueryRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ExecutePublishedDashboardQueryRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ExecuteQueryResponse struct { +} + // Genie AI Response type GenieAttachment struct { Query *QueryAttachment `json:"query,omitempty"` @@ -378,6 +438,15 @@ type GetDashboardRequest struct { DashboardId string `json:"-" url:"-"` } +// Read a published dashboard in an embedded ui. +type GetPublishedDashboardEmbeddedRequest struct { + // UUID identifying the published dashboard. + DashboardId string `json:"-" url:"-"` +} + +type GetPublishedDashboardEmbeddedResponse struct { +} + // Get published dashboard type GetPublishedDashboardRequest struct { // UUID identifying the published dashboard. @@ -771,6 +840,30 @@ func (s MigrateDashboardRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type PendingStatus struct { + // The token to poll for result asynchronously Example: + // EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ + DataToken string `json:"data_token"` +} + +// Poll the results for the a query for a published, embedded dashboard +type PollPublishedQueryStatusRequest struct { + DashboardName string `json:"-" url:"dashboard_name"` + + DashboardRevisionId string `json:"-" url:"dashboard_revision_id"` + // Example: + // EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ + Tokens []string `json:"-" url:"tokens,omitempty"` +} + +type PollQueryStatusResponse struct { + Data []PollQueryStatusResponseData `json:"data,omitempty"` +} + +type PollQueryStatusResponseData struct { + Status QueryResponseStatus `json:"status"` +} + type PublishRequest struct { // UUID identifying the dashboard to be published. DashboardId string `json:"-" url:"-"` @@ -830,6 +923,8 @@ type QueryAttachment struct { LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // AI generated SQL query Query string `json:"query,omitempty"` + + StatementId string `json:"statement_id,omitempty"` // Name of the query Title string `json:"title,omitempty"` @@ -844,6 +939,34 @@ func (s QueryAttachment) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type QueryResponseStatus struct { + // Represents an empty message, similar to google.protobuf.Empty, which is + // not available in the firm right now. + Canceled *Empty `json:"canceled,omitempty"` + // Represents an empty message, similar to google.protobuf.Empty, which is + // not available in the firm right now. + Closed *Empty `json:"closed,omitempty"` + + Pending *PendingStatus `json:"pending,omitempty"` + // The statement id in format(01eef5da-c56e-1f36-bafa-21906587d6ba) The + // statement_id should be identical to data_token in SuccessStatus and + // PendingStatus. This field is created for audit logging purpose to record + // the statement_id of all QueryResponseStatus. + StatementId string `json:"statement_id,omitempty"` + + Success *SuccessStatus `json:"success,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *QueryResponseStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s QueryResponseStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type QuerySchema struct { Columns []QuerySchemaColumn `json:"columns,omitempty"` // Used to determine if the stored query schema is compatible with the @@ -1007,6 +1130,24 @@ type SubscriptionSubscriberUser struct { UserId int64 `json:"user_id"` } +type SuccessStatus struct { + // The token to poll for result asynchronously Example: + // EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ + DataToken string `json:"data_token"` + // Whether the query result is truncated (either by byte limit or row limit) + Truncated bool `json:"truncated,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *SuccessStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s SuccessStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type TextAttachment struct { // AI generated message Content string `json:"content,omitempty"` diff --git a/service/jobs/model.go b/service/jobs/model.go index c94c00d51..f2303f89b 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -72,6 +72,12 @@ type BaseRun struct { CreatorUserName string `json:"creator_user_name,omitempty"` // Description of the run Description string `json:"description,omitempty"` + // effective_performance_target is the actual performance target used by the + // run during execution. effective_performance_target can differ from + // performance_target depending on if the job was eligible to be + // cost-optimized (e.g. contains at least 1 serverless task) or if we + // specifically override the value for the run (ex. RunNow). + EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,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"` @@ -596,6 +602,9 @@ type CreateJob struct { NotificationSettings *JobNotificationSettings `json:"notification_settings,omitempty"` // Job-level parameter definitions Parameters []JobParameterDefinition `json:"parameters,omitempty"` + // PerformanceTarget defines how performant or cost efficient the execution + // of run on serverless should be. + PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` // The queue settings of the job. Queue *QueueSettings `json:"queue,omitempty"` // Write-only setting. Specifies the user or service principal that the job @@ -1661,6 +1670,9 @@ type JobSettings struct { NotificationSettings *JobNotificationSettings `json:"notification_settings,omitempty"` // Job-level parameter definitions Parameters []JobParameterDefinition `json:"parameters,omitempty"` + // PerformanceTarget defines how performant or cost efficient the execution + // of run on serverless should be. + PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` // The queue settings of the job. Queue *QueueSettings `json:"queue,omitempty"` // Write-only setting. Specifies the user or service principal that the job @@ -2171,6 +2183,37 @@ func (f *PauseStatus) Type() string { return "PauseStatus" } +// PerformanceTarget defines how performant (lower latency) or cost efficient +// the execution of run on serverless compute should be. The performance mode on +// the job or pipeline should map to a performance setting that is passed to +// Cluster Manager (see cluster-common PerformanceTarget). +type PerformanceTarget string + +const PerformanceTargetCostOptimized PerformanceTarget = `COST_OPTIMIZED` + +const PerformanceTargetPerformanceOptimized PerformanceTarget = `PERFORMANCE_OPTIMIZED` + +// String representation for [fmt.Print] +func (f *PerformanceTarget) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *PerformanceTarget) Set(v string) error { + switch v { + case `COST_OPTIMIZED`, `PERFORMANCE_OPTIMIZED`: + *f = PerformanceTarget(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "COST_OPTIMIZED", "PERFORMANCE_OPTIMIZED"`, v) + } +} + +// Type always returns PerformanceTarget to satisfy [pflag.Value] interface +func (f *PerformanceTarget) Type() string { + return "PerformanceTarget" +} + type PeriodicTriggerConfiguration struct { // The interval at which the trigger should run. Interval int `json:"interval"` @@ -2618,6 +2661,12 @@ type Run struct { CreatorUserName string `json:"creator_user_name,omitempty"` // Description of the run Description string `json:"description,omitempty"` + // effective_performance_target is the actual performance target used by the + // run during execution. effective_performance_target can differ from + // performance_target depending on if the job was eligible to be + // cost-optimized (e.g. contains at least 1 serverless task) or if we + // specifically override the value for the run (ex. RunNow). + EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,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"` @@ -3129,6 +3178,10 @@ type RunNow struct { // A list of task keys to run inside of the job. If this field is not // provided, all tasks in the job will be run. Only []string `json:"only,omitempty"` + // PerformanceTarget defines how performant or cost efficient the execution + // of run on serverless compute should be. For RunNow request, the run will + // execute with this settings instead of ones defined in job. + PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` // Controls whether the pipeline should perform a full refresh PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` @@ -3490,6 +3543,15 @@ type RunTask struct { DependsOn []TaskDependency `json:"depends_on,omitempty"` // An optional description for this task. Description string `json:"description,omitempty"` + // Denotes whether or not the task was disabled by the user. Disabled tasks + // do not execute and are immediately skipped as soon as they are unblocked. + Disabled bool `json:"disabled,omitempty"` + // effective_performance_target is the actual performance target used by the + // run during execution. effective_performance_target can differ from + // performance_target depending on if the job was eligible to be + // cost-optimized (e.g. contains at least 1 serverless task) or if an + // override was provided for the run (ex. RunNow). + EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` // An optional set of email addresses notified when the task run begins or // completes. The default behavior is to not send any emails. EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` @@ -4581,6 +4643,8 @@ func (s TaskNotificationSettings) MarshalJSON() ([]byte, error) { // [Link]: https://kb.databricks.com/en_US/notebooks/too-many-execution-contexts-are-open-right-now type TerminationCodeCode string +const TerminationCodeCodeBudgetPolicyLimitExceeded TerminationCodeCode = `BUDGET_POLICY_LIMIT_EXCEEDED` + // The run was canceled during execution by the platform; for // example, if the maximum run duration was exceeded. const TerminationCodeCodeCanceled TerminationCodeCode = `CANCELED` @@ -4678,11 +4742,11 @@ func (f *TerminationCodeCode) String() string { // Set raw string value and validate it against allowed values func (f *TerminationCodeCode) Set(v string) error { switch v { - case `CANCELED`, `CLOUD_FAILURE`, `CLUSTER_ERROR`, `CLUSTER_REQUEST_LIMIT_EXCEEDED`, `DRIVER_ERROR`, `FEATURE_DISABLED`, `INTERNAL_ERROR`, `INVALID_CLUSTER_REQUEST`, `INVALID_RUN_CONFIGURATION`, `LIBRARY_INSTALLATION_ERROR`, `MAX_CONCURRENT_RUNS_EXCEEDED`, `MAX_JOB_QUEUE_SIZE_EXCEEDED`, `MAX_SPARK_CONTEXTS_EXCEEDED`, `REPOSITORY_CHECKOUT_FAILED`, `RESOURCE_NOT_FOUND`, `RUN_EXECUTION_ERROR`, `SKIPPED`, `STORAGE_ACCESS_ERROR`, `SUCCESS`, `UNAUTHORIZED_ERROR`, `USER_CANCELED`, `WORKSPACE_RUN_LIMIT_EXCEEDED`: + case `BUDGET_POLICY_LIMIT_EXCEEDED`, `CANCELED`, `CLOUD_FAILURE`, `CLUSTER_ERROR`, `CLUSTER_REQUEST_LIMIT_EXCEEDED`, `DRIVER_ERROR`, `FEATURE_DISABLED`, `INTERNAL_ERROR`, `INVALID_CLUSTER_REQUEST`, `INVALID_RUN_CONFIGURATION`, `LIBRARY_INSTALLATION_ERROR`, `MAX_CONCURRENT_RUNS_EXCEEDED`, `MAX_JOB_QUEUE_SIZE_EXCEEDED`, `MAX_SPARK_CONTEXTS_EXCEEDED`, `REPOSITORY_CHECKOUT_FAILED`, `RESOURCE_NOT_FOUND`, `RUN_EXECUTION_ERROR`, `SKIPPED`, `STORAGE_ACCESS_ERROR`, `SUCCESS`, `UNAUTHORIZED_ERROR`, `USER_CANCELED`, `WORKSPACE_RUN_LIMIT_EXCEEDED`: *f = TerminationCodeCode(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "CANCELED", "CLOUD_FAILURE", "CLUSTER_ERROR", "CLUSTER_REQUEST_LIMIT_EXCEEDED", "DRIVER_ERROR", "FEATURE_DISABLED", "INTERNAL_ERROR", "INVALID_CLUSTER_REQUEST", "INVALID_RUN_CONFIGURATION", "LIBRARY_INSTALLATION_ERROR", "MAX_CONCURRENT_RUNS_EXCEEDED", "MAX_JOB_QUEUE_SIZE_EXCEEDED", "MAX_SPARK_CONTEXTS_EXCEEDED", "REPOSITORY_CHECKOUT_FAILED", "RESOURCE_NOT_FOUND", "RUN_EXECUTION_ERROR", "SKIPPED", "STORAGE_ACCESS_ERROR", "SUCCESS", "UNAUTHORIZED_ERROR", "USER_CANCELED", "WORKSPACE_RUN_LIMIT_EXCEEDED"`, v) + return fmt.Errorf(`value "%s" is not one of "BUDGET_POLICY_LIMIT_EXCEEDED", "CANCELED", "CLOUD_FAILURE", "CLUSTER_ERROR", "CLUSTER_REQUEST_LIMIT_EXCEEDED", "DRIVER_ERROR", "FEATURE_DISABLED", "INTERNAL_ERROR", "INVALID_CLUSTER_REQUEST", "INVALID_RUN_CONFIGURATION", "LIBRARY_INSTALLATION_ERROR", "MAX_CONCURRENT_RUNS_EXCEEDED", "MAX_JOB_QUEUE_SIZE_EXCEEDED", "MAX_SPARK_CONTEXTS_EXCEEDED", "REPOSITORY_CHECKOUT_FAILED", "RESOURCE_NOT_FOUND", "RUN_EXECUTION_ERROR", "SKIPPED", "STORAGE_ACCESS_ERROR", "SUCCESS", "UNAUTHORIZED_ERROR", "USER_CANCELED", "WORKSPACE_RUN_LIMIT_EXCEEDED"`, v) } } diff --git a/service/oauth2/model.go b/service/oauth2/model.go index 80e7d7255..1fa578111 100755 --- a/service/oauth2/model.go +++ b/service/oauth2/model.go @@ -38,6 +38,10 @@ type CreateCustomAppIntegration struct { Scopes []string `json:"scopes,omitempty"` // Token access policy TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` + // Scopes that will need to be consented by end user to mint the access + // token. If the user does not authorize the access token will not be + // minted. Must be a subset of scopes. + UserAuthorizedScopes []string `json:"user_authorized_scopes,omitempty"` ForceSendFields []string `json:"-"` } @@ -256,6 +260,10 @@ type GetCustomAppIntegrationOutput struct { Scopes []string `json:"scopes,omitempty"` // Token access policy TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` + // Scopes that will need to be consented by end user to mint the access + // token. If the user does not authorize the access token will not be + // minted. Must be a subset of scopes. + UserAuthorizedScopes []string `json:"user_authorized_scopes,omitempty"` ForceSendFields []string `json:"-"` } @@ -655,6 +663,10 @@ type UpdateCustomAppIntegration struct { Scopes []string `json:"scopes,omitempty"` // Token access policy to be updated in the custom OAuth app integration TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` + // Scopes that will need to be consented by end user to mint the access + // token. If the user does not authorize the access token will not be + // minted. Must be a subset of scopes. + UserAuthorizedScopes []string `json:"user_authorized_scopes,omitempty"` } type UpdateCustomAppIntegrationOutput struct { diff --git a/service/pkg.go b/service/pkg.go index f26f56eda..0bd4cac58 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -22,6 +22,8 @@ // // - [billing.BillableUsageAPI]: This API allows you to download billable usage logs for the specified account and date range. // +// - [billing.BudgetPolicyAPI]: A service serves REST API about Budget policies. +// // - [catalog.CatalogsAPI]: A catalog is the first layer of Unity Catalog’s three-level namespace. // // - [cleanrooms.CleanRoomAssetsAPI]: Clean room assets are data and code objects — Tables, volumes, and notebooks that are shared with the clean room. @@ -50,10 +52,10 @@ // // - [marketplace.ConsumerProvidersAPI]: Providers are the entities that publish listings to the Marketplace. // -// - [provisioning.CredentialsAPI]: These APIs manage credential configurations for this workspace. -// // - [catalog.CredentialsAPI]: A credential represents an authentication and authorization mechanism for accessing services on your cloud tenant. // +// - [provisioning.CredentialsAPI]: These APIs manage credential configurations for this workspace. +// // - [settings.CredentialsManagerAPI]: Credentials manager interacts with with Identity Providers to to perform token exchanges using stored credentials and refresh tokens. // // - [settings.CspEnablementAccountAPI]: The compliance security profile settings at the account level control whether to enable it for new workspaces. @@ -80,6 +82,8 @@ // // - [settings.DisableLegacyFeaturesAPI]: Disable legacy features for new Databricks workspaces. // +// - [settings.EnableIpAccessListsAPI]: Controls the enforcement of IP access lists for accessing the account console. +// // - [provisioning.EncryptionKeysAPI]: These APIs manage encryption key configurations for this workspace (optional). // // - [settings.EnhancedSecurityMonitoringAPI]: Controls whether enhanced security monitoring is enabled for the current workspace. @@ -120,6 +124,8 @@ // // - [dashboards.LakeviewAPI]: These APIs provide specific management operations for Lakeview dashboards. // +// - [dashboards.LakeviewEmbeddedAPI]: Token-based Lakeview APIs for embedding dashboards in external applications. +// // - [compute.LibrariesAPI]: The Libraries API allows you to install and uninstall libraries and get the status of libraries on a cluster. // // - [billing.LogDeliveryAPI]: These APIs manage log delivery configurations for this account. @@ -184,6 +190,8 @@ // // - [sql.QueriesLegacyAPI]: These endpoints are used for CRUD operations on query definitions. // +// - [dashboards.QueryExecutionAPI]: Query execution APIs for AI / BI Dashboards. +// // - [sql.QueryHistoryAPI]: A service responsible for storing and retrieving the list of queries run against SQL endpoints and serverless compute. // // - [sql.QueryVisualizationsAPI]: This is an evolving API that facilitates the addition and removal of visualizations from existing queries in the Databricks Workspace. @@ -194,6 +202,8 @@ // // - [sharing.RecipientsAPI]: A recipient is an object you create using :method:recipients/create to represent an organization which you want to allow access shares. // +// - [sql.RedashConfigAPI]: Redash V2 service for workspace configurations (internal). +// // - [catalog.RegisteredModelsAPI]: Databricks provides a hosted version of MLflow Model Registry in Unity Catalog. // // - [workspace.ReposAPI]: The Repos API allows users to manage their git repos. @@ -312,6 +322,7 @@ var ( _ *catalog.ArtifactAllowlistsAPI = nil _ *settings.AutomaticClusterUpdateAPI = nil _ *billing.BillableUsageAPI = nil + _ *billing.BudgetPolicyAPI = nil _ *catalog.CatalogsAPI = nil _ *cleanrooms.CleanRoomAssetsAPI = nil _ *cleanrooms.CleanRoomTaskRunsAPI = nil @@ -326,8 +337,8 @@ var ( _ *marketplace.ConsumerListingsAPI = nil _ *marketplace.ConsumerPersonalizationRequestsAPI = nil _ *marketplace.ConsumerProvidersAPI = nil - _ *catalog.CredentialsAPI = nil _ *provisioning.CredentialsAPI = nil + _ *catalog.CredentialsAPI = nil _ *settings.CredentialsManagerAPI = nil _ *settings.CspEnablementAccountAPI = nil _ *iam.CurrentUserAPI = nil @@ -341,6 +352,7 @@ var ( _ *settings.DisableLegacyAccessAPI = nil _ *settings.DisableLegacyDbfsAPI = nil _ *settings.DisableLegacyFeaturesAPI = nil + _ *settings.EnableIpAccessListsAPI = nil _ *provisioning.EncryptionKeysAPI = nil _ *settings.EnhancedSecurityMonitoringAPI = nil _ *settings.EsmEnablementAccountAPI = nil @@ -361,6 +373,7 @@ var ( _ *settings.AccountIpAccessListsAPI = nil _ *jobs.JobsAPI = nil _ *dashboards.LakeviewAPI = nil + _ *dashboards.LakeviewEmbeddedAPI = nil _ *compute.LibrariesAPI = nil _ *billing.LogDeliveryAPI = nil _ *catalog.AccountMetastoreAssignmentsAPI = nil @@ -393,11 +406,13 @@ var ( _ *catalog.QualityMonitorsAPI = nil _ *sql.QueriesAPI = nil _ *sql.QueriesLegacyAPI = nil + _ *dashboards.QueryExecutionAPI = nil _ *sql.QueryHistoryAPI = nil _ *sql.QueryVisualizationsAPI = nil _ *sql.QueryVisualizationsLegacyAPI = nil _ *sharing.RecipientActivationAPI = nil _ *sharing.RecipientsAPI = nil + _ *sql.RedashConfigAPI = nil _ *catalog.RegisteredModelsAPI = nil _ *workspace.ReposAPI = nil _ *catalog.ResourceQuotasAPI = nil diff --git a/service/serving/api.go b/service/serving/api.go index 3e7182827..72274627a 100755 --- a/service/serving/api.go +++ b/service/serving/api.go @@ -106,7 +106,7 @@ type ServingEndpointsInterface interface { GetPermissionsByServingEndpointId(ctx context.Context, servingEndpointId string) (*ServingEndpointPermissions, error) // Make external services call using the credentials stored in UC Connection. - HttpRequest(ctx context.Context, request ExternalFunctionRequest) (*ExternalFunctionResponse, error) + HttpRequest(ctx context.Context, request ExternalFunctionRequest) (*HttpRequestResponse, error) // Get all serving endpoints. // diff --git a/service/serving/impl.go b/service/serving/impl.go index 220d1f3b4..9eda39ef7 100755 --- a/service/serving/impl.go +++ b/service/serving/impl.go @@ -99,15 +99,15 @@ func (a *servingEndpointsImpl) GetPermissions(ctx context.Context, request GetSe return &servingEndpointPermissions, err } -func (a *servingEndpointsImpl) HttpRequest(ctx context.Context, request ExternalFunctionRequest) (*ExternalFunctionResponse, error) { - var externalFunctionResponse ExternalFunctionResponse +func (a *servingEndpointsImpl) HttpRequest(ctx context.Context, request ExternalFunctionRequest) (*HttpRequestResponse, error) { + var httpRequestResponse HttpRequestResponse path := "/api/2.0/external-function" queryParams := make(map[string]any) headers := make(map[string]string) - headers["Accept"] = "application/json" + headers["Accept"] = "text/plain" headers["Content-Type"] = "application/json" - err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &externalFunctionResponse) - return &externalFunctionResponse, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &httpRequestResponse) + return &httpRequestResponse, err } func (a *servingEndpointsImpl) List(ctx context.Context) (*ListEndpointsResponse, error) { diff --git a/service/serving/interface.go b/service/serving/interface.go index 806e0f49f..ae4452c3f 100755 --- a/service/serving/interface.go +++ b/service/serving/interface.go @@ -63,7 +63,7 @@ type ServingEndpointsService interface { // Make external services call using the credentials stored in UC // Connection. - HttpRequest(ctx context.Context, request ExternalFunctionRequest) (*ExternalFunctionResponse, error) + HttpRequest(ctx context.Context, request ExternalFunctionRequest) (*HttpRequestResponse, error) // Get all serving endpoints. // diff --git a/service/serving/model.go b/service/serving/model.go index 6d22239da..1fc96710a 100755 --- a/service/serving/model.go +++ b/service/serving/model.go @@ -845,23 +845,6 @@ func (f *ExternalFunctionRequestHttpMethod) Type() string { return "ExternalFunctionRequestHttpMethod" } -type ExternalFunctionResponse struct { - // The HTTP status code of the response - StatusCode int `json:"status_code,omitempty"` - // The content of the response - Text string `json:"text,omitempty"` - - ForceSendFields []string `json:"-"` -} - -func (s *ExternalFunctionResponse) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, s) -} - -func (s ExternalFunctionResponse) MarshalJSON() ([]byte, error) { - return marshal.Marshal(s) -} - type ExternalModel struct { // AI21Labs Config. Only required if the provider is 'ai21labs'. Ai21labsConfig *Ai21LabsConfig `json:"ai21labs_config,omitempty"` @@ -1049,6 +1032,10 @@ func (s GoogleCloudVertexAiConfig) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type HttpRequestResponse struct { + Contents io.ReadCloser `json:"-"` +} + type ListEndpointsResponse struct { // The list of endpoints. Endpoints []ServingEndpoint `json:"endpoints,omitempty"` diff --git a/service/settings/api.go b/service/settings/api.go index 520214899..a63c584b9 100755 --- a/service/settings/api.go +++ b/service/settings/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Account Ip Access Lists, Account Settings, Aibi Dashboard Embedding Access Policy, Aibi Dashboard Embedding Approved Domains, Automatic Cluster Update, Compliance Security Profile, Credentials Manager, Csp Enablement Account, Default Namespace, Disable Legacy Access, Disable Legacy Dbfs, Disable Legacy Features, Enhanced Security Monitoring, Esm Enablement Account, Ip Access Lists, Network Connectivity, Notification Destinations, Personal Compute, Restrict Workspace Admins, Settings, Token Management, Tokens, Workspace Conf, etc. +// These APIs allow you to manage Account Ip Access Lists, Account Settings, Aibi Dashboard Embedding Access Policy, Aibi Dashboard Embedding Approved Domains, Automatic Cluster Update, Compliance Security Profile, Credentials Manager, Csp Enablement Account, Default Namespace, Disable Legacy Access, Disable Legacy Dbfs, Disable Legacy Features, Enable Ip Access Lists, Enhanced Security Monitoring, Esm Enablement Account, Ip Access Lists, Network Connectivity, Notification Destinations, Personal Compute, Restrict Workspace Admins, Settings, Token Management, Tokens, Workspace Conf, etc. package settings import ( @@ -277,6 +277,11 @@ type AccountSettingsInterface interface { // prior to 13.3LTS. DisableLegacyFeatures() DisableLegacyFeaturesInterface + // Controls the enforcement of IP access lists for accessing the account + // console. Allowing you to enable or disable restricted access based on IP + // addresses. + EnableIpAccessLists() EnableIpAccessListsInterface + // The enhanced security monitoring setting at the account level controls // whether to enable the feature on new workspaces. By default, this // account-level setting is disabled for new workspaces. After workspace @@ -307,6 +312,8 @@ func NewAccountSettings(client *client.DatabricksClient) *AccountSettingsAPI { disableLegacyFeatures: NewDisableLegacyFeatures(client), + enableIpAccessLists: NewEnableIpAccessLists(client), + esmEnablementAccount: NewEsmEnablementAccount(client), personalCompute: NewPersonalCompute(client), @@ -335,6 +342,11 @@ type AccountSettingsAPI struct { // prior to 13.3LTS. disableLegacyFeatures DisableLegacyFeaturesInterface + // Controls the enforcement of IP access lists for accessing the account + // console. Allowing you to enable or disable restricted access based on IP + // addresses. + enableIpAccessLists EnableIpAccessListsInterface + // The enhanced security monitoring setting at the account level controls // whether to enable the feature on new workspaces. By default, this // account-level setting is disabled for new workspaces. After workspace @@ -363,6 +375,10 @@ func (a *AccountSettingsAPI) DisableLegacyFeatures() DisableLegacyFeaturesInterf return a.disableLegacyFeatures } +func (a *AccountSettingsAPI) EnableIpAccessLists() EnableIpAccessListsInterface { + return a.enableIpAccessLists +} + func (a *AccountSettingsAPI) EsmEnablementAccount() EsmEnablementAccountInterface { return a.esmEnablementAccount } @@ -723,6 +739,39 @@ type DisableLegacyFeaturesAPI struct { disableLegacyFeaturesImpl } +type EnableIpAccessListsInterface interface { + + // Delete the account IP access toggle setting. + // + // Reverts the value of the account IP access toggle setting to default (ON) + Delete(ctx context.Context, request DeleteAccountIpAccessEnableRequest) (*DeleteAccountIpAccessEnableResponse, error) + + // Get the account IP access toggle setting. + // + // Gets the value of the account IP access toggle setting. + Get(ctx context.Context, request GetAccountIpAccessEnableRequest) (*AccountIpAccessEnable, error) + + // Update the account IP access toggle setting. + // + // Updates the value of the account IP access toggle setting. + Update(ctx context.Context, request UpdateAccountIpAccessEnableRequest) (*AccountIpAccessEnable, error) +} + +func NewEnableIpAccessLists(client *client.DatabricksClient) *EnableIpAccessListsAPI { + return &EnableIpAccessListsAPI{ + enableIpAccessListsImpl: enableIpAccessListsImpl{ + client: client, + }, + } +} + +// Controls the enforcement of IP access lists for accessing the account +// console. Allowing you to enable or disable restricted access based on IP +// addresses. +type EnableIpAccessListsAPI struct { + enableIpAccessListsImpl +} + type EnhancedSecurityMonitoringInterface interface { // Get the enhanced security monitoring setting. diff --git a/service/settings/impl.go b/service/settings/impl.go index ea0048fc6..77c0312ba 100755 --- a/service/settings/impl.go +++ b/service/settings/impl.go @@ -393,6 +393,42 @@ func (a *disableLegacyFeaturesImpl) Update(ctx context.Context, request UpdateDi return &disableLegacyFeatures, err } +// unexported type that holds implementations of just EnableIpAccessLists API methods +type enableIpAccessListsImpl struct { + client *client.DatabricksClient +} + +func (a *enableIpAccessListsImpl) Delete(ctx context.Context, request DeleteAccountIpAccessEnableRequest) (*DeleteAccountIpAccessEnableResponse, error) { + var deleteAccountIpAccessEnableResponse DeleteAccountIpAccessEnableResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/acct_ip_acl_enable/names/default", a.client.ConfiguredAccountID()) + 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, &deleteAccountIpAccessEnableResponse) + return &deleteAccountIpAccessEnableResponse, err +} + +func (a *enableIpAccessListsImpl) Get(ctx context.Context, request GetAccountIpAccessEnableRequest) (*AccountIpAccessEnable, error) { + var accountIpAccessEnable AccountIpAccessEnable + path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/acct_ip_acl_enable/names/default", 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, &accountIpAccessEnable) + return &accountIpAccessEnable, err +} + +func (a *enableIpAccessListsImpl) Update(ctx context.Context, request UpdateAccountIpAccessEnableRequest) (*AccountIpAccessEnable, error) { + var accountIpAccessEnable AccountIpAccessEnable + path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/acct_ip_acl_enable/names/default", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &accountIpAccessEnable) + return &accountIpAccessEnable, err +} + // unexported type that holds implementations of just EnhancedSecurityMonitoring API methods type enhancedSecurityMonitoringImpl struct { client *client.DatabricksClient diff --git a/service/settings/interface.go b/service/settings/interface.go index d78c38625..cb38b4641 100755 --- a/service/settings/interface.go +++ b/service/settings/interface.go @@ -344,6 +344,27 @@ type DisableLegacyFeaturesService interface { Update(ctx context.Context, request UpdateDisableLegacyFeaturesRequest) (*DisableLegacyFeatures, error) } +// Controls the enforcement of IP access lists for accessing the account +// console. Allowing you to enable or disable restricted access based on IP +// addresses. +type EnableIpAccessListsService interface { + + // Delete the account IP access toggle setting. + // + // Reverts the value of the account IP access toggle setting to default (ON) + Delete(ctx context.Context, request DeleteAccountIpAccessEnableRequest) (*DeleteAccountIpAccessEnableResponse, error) + + // Get the account IP access toggle setting. + // + // Gets the value of the account IP access toggle setting. + Get(ctx context.Context, request GetAccountIpAccessEnableRequest) (*AccountIpAccessEnable, error) + + // Update the account IP access toggle setting. + // + // Updates the value of the account IP access toggle setting. + Update(ctx context.Context, request UpdateAccountIpAccessEnableRequest) (*AccountIpAccessEnable, error) +} + // Controls whether enhanced security monitoring is enabled for the current // workspace. If the compliance security profile is enabled, this is // automatically enabled. By default, it is disabled. However, if the compliance diff --git a/service/settings/model.go b/service/settings/model.go index 66cc47739..c2dded259 100755 --- a/service/settings/model.go +++ b/service/settings/model.go @@ -8,6 +8,34 @@ import ( "github.com/databricks/databricks-sdk-go/marshal" ) +type AccountIpAccessEnable struct { + AcctIpAclEnable BooleanMessage `json:"acct_ip_acl_enable"` + // etag used for versioning. The response is at least as fresh as the eTag + // provided. This is used for optimistic concurrency control as a way to + // help prevent simultaneous writes of a setting overwriting each other. It + // is strongly suggested that systems make use of the etag in the read -> + // update pattern to perform setting updates in order to avoid race + // conditions. That is, get an etag from a GET request, and pass it with the + // PATCH request to identify the setting version you are updating. + Etag string `json:"etag,omitempty"` + // Name of the corresponding setting. This field is populated in the + // response, but it will not be respected even if it's set in the request + // body. The setting name in the path parameter will be respected instead. + // Setting name is required to be 'default' if the setting only has one + // instance per workspace. + SettingName string `json:"setting_name,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *AccountIpAccessEnable) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AccountIpAccessEnable) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type AibiDashboardEmbeddingAccessPolicy struct { AccessPolicyType AibiDashboardEmbeddingAccessPolicyAccessPolicyType `json:"access_policy_type"` } @@ -360,8 +388,12 @@ const ComplianceStandardFedrampModerate ComplianceStandard = `FEDRAMP_MODERATE` const ComplianceStandardHipaa ComplianceStandard = `HIPAA` +const ComplianceStandardHitrust ComplianceStandard = `HITRUST` + const ComplianceStandardIrapProtected ComplianceStandard = `IRAP_PROTECTED` +const ComplianceStandardIsmap ComplianceStandard = `ISMAP` + const ComplianceStandardItarEar ComplianceStandard = `ITAR_EAR` const ComplianceStandardNone ComplianceStandard = `NONE` @@ -376,11 +408,11 @@ func (f *ComplianceStandard) String() string { // Set raw string value and validate it against allowed values func (f *ComplianceStandard) Set(v string) error { switch v { - case `CANADA_PROTECTED_B`, `CYBER_ESSENTIAL_PLUS`, `FEDRAMP_HIGH`, `FEDRAMP_IL5`, `FEDRAMP_MODERATE`, `HIPAA`, `IRAP_PROTECTED`, `ITAR_EAR`, `NONE`, `PCI_DSS`: + case `CANADA_PROTECTED_B`, `CYBER_ESSENTIAL_PLUS`, `FEDRAMP_HIGH`, `FEDRAMP_IL5`, `FEDRAMP_MODERATE`, `HIPAA`, `HITRUST`, `IRAP_PROTECTED`, `ISMAP`, `ITAR_EAR`, `NONE`, `PCI_DSS`: *f = ComplianceStandard(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "CANADA_PROTECTED_B", "CYBER_ESSENTIAL_PLUS", "FEDRAMP_HIGH", "FEDRAMP_IL5", "FEDRAMP_MODERATE", "HIPAA", "IRAP_PROTECTED", "ITAR_EAR", "NONE", "PCI_DSS"`, v) + return fmt.Errorf(`value "%s" is not one of "CANADA_PROTECTED_B", "CYBER_ESSENTIAL_PLUS", "FEDRAMP_HIGH", "FEDRAMP_IL5", "FEDRAMP_MODERATE", "HIPAA", "HITRUST", "IRAP_PROTECTED", "ISMAP", "ITAR_EAR", "NONE", "PCI_DSS"`, v) } } @@ -655,6 +687,40 @@ func (s DefaultNamespaceSetting) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Delete the account IP access toggle setting +type DeleteAccountIpAccessEnableRequest struct { + // etag used for versioning. The response is at least as fresh as the eTag + // provided. This is used for optimistic concurrency control as a way to + // help prevent simultaneous writes of a setting overwriting each other. It + // is strongly suggested that systems make use of the etag in the read -> + // delete pattern to perform setting deletions in order to avoid race + // conditions. That is, get an etag from a GET request, and pass it with the + // DELETE request to identify the rule set version you are deleting. + Etag string `json:"-" url:"etag,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *DeleteAccountIpAccessEnableRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DeleteAccountIpAccessEnableRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// The etag is returned. +type DeleteAccountIpAccessEnableResponse struct { + // etag used for versioning. The response is at least as fresh as the eTag + // provided. This is used for optimistic concurrency control as a way to + // help prevent simultaneous writes of a setting overwriting each other. It + // is strongly suggested that systems make use of the etag in the read -> + // delete pattern to perform setting deletions in order to avoid race + // conditions. That is, get an etag from a GET request, and pass it with the + // DELETE request to identify the rule set version you are deleting. + Etag string `json:"etag"` +} + // Delete access list type DeleteAccountIpAccessListRequest struct { // The ID for the corresponding IP access list @@ -1515,6 +1581,28 @@ func (s GenericWebhookConfig) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Get the account IP access toggle setting +type GetAccountIpAccessEnableRequest struct { + // etag used for versioning. The response is at least as fresh as the eTag + // provided. This is used for optimistic concurrency control as a way to + // help prevent simultaneous writes of a setting overwriting each other. It + // is strongly suggested that systems make use of the etag in the read -> + // delete pattern to perform setting deletions in order to avoid race + // conditions. That is, get an etag from a GET request, and pass it with the + // DELETE request to identify the rule set version you are deleting. + Etag string `json:"-" url:"etag,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *GetAccountIpAccessEnableRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GetAccountIpAccessEnableRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Get IP access list type GetAccountIpAccessListRequest struct { // The ID for the corresponding IP access list @@ -2775,6 +2863,8 @@ type TokenType string const TokenTypeArclightAzureExchangeToken TokenType = `ARCLIGHT_AZURE_EXCHANGE_TOKEN` +const TokenTypeArclightAzureExchangeTokenWithUserDelegationKey TokenType = `ARCLIGHT_AZURE_EXCHANGE_TOKEN_WITH_USER_DELEGATION_KEY` + const TokenTypeAzureActiveDirectoryToken TokenType = `AZURE_ACTIVE_DIRECTORY_TOKEN` // String representation for [fmt.Print] @@ -2785,11 +2875,11 @@ func (f *TokenType) String() string { // Set raw string value and validate it against allowed values func (f *TokenType) Set(v string) error { switch v { - case `ARCLIGHT_AZURE_EXCHANGE_TOKEN`, `AZURE_ACTIVE_DIRECTORY_TOKEN`: + case `ARCLIGHT_AZURE_EXCHANGE_TOKEN`, `ARCLIGHT_AZURE_EXCHANGE_TOKEN_WITH_USER_DELEGATION_KEY`, `AZURE_ACTIVE_DIRECTORY_TOKEN`: *f = TokenType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "ARCLIGHT_AZURE_EXCHANGE_TOKEN", "AZURE_ACTIVE_DIRECTORY_TOKEN"`, v) + return fmt.Errorf(`value "%s" is not one of "ARCLIGHT_AZURE_EXCHANGE_TOKEN", "ARCLIGHT_AZURE_EXCHANGE_TOKEN_WITH_USER_DELEGATION_KEY", "AZURE_ACTIVE_DIRECTORY_TOKEN"`, v) } } @@ -2798,15 +2888,43 @@ func (f *TokenType) Type() string { return "TokenType" } +// Details required to update a setting. +type UpdateAccountIpAccessEnableRequest struct { + // This should always be set to true for Settings API. Added for AIP + // compliance. + AllowMissing bool `json:"allow_missing"` + // 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. + FieldMask string `json:"field_mask"` + + Setting AccountIpAccessEnable `json:"setting"` +} + // Details required to update a setting. type UpdateAibiDashboardEmbeddingAccessPolicySettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting AibiDashboardEmbeddingAccessPolicySetting `json:"setting"` @@ -2817,10 +2935,17 @@ type UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting AibiDashboardEmbeddingApprovedDomainsSetting `json:"setting"` @@ -2831,10 +2956,17 @@ type UpdateAutomaticClusterUpdateSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting AutomaticClusterUpdateSetting `json:"setting"` @@ -2845,10 +2977,17 @@ type UpdateComplianceSecurityProfileSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting ComplianceSecurityProfileSetting `json:"setting"` @@ -2859,10 +2998,17 @@ type UpdateCspEnablementAccountSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting CspEnablementAccountSetting `json:"setting"` @@ -2873,10 +3019,17 @@ type UpdateDefaultNamespaceSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` // This represents the setting configuration for the default namespace in // the Databricks workspace. Setting the default catalog for the workspace @@ -2895,10 +3048,17 @@ type UpdateDisableLegacyAccessRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting DisableLegacyAccess `json:"setting"` @@ -2909,10 +3069,17 @@ type UpdateDisableLegacyDbfsRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting DisableLegacyDbfs `json:"setting"` @@ -2923,10 +3090,17 @@ type UpdateDisableLegacyFeaturesRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting DisableLegacyFeatures `json:"setting"` @@ -2937,10 +3111,17 @@ type UpdateEnhancedSecurityMonitoringSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting EnhancedSecurityMonitoringSetting `json:"setting"` @@ -2951,10 +3132,17 @@ type UpdateEsmEnablementAccountSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting EsmEnablementAccountSetting `json:"setting"` @@ -3014,10 +3202,17 @@ type UpdatePersonalComputeSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting PersonalComputeSetting `json:"setting"` @@ -3031,10 +3226,17 @@ type UpdateRestrictWorkspaceAdminsSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. AllowMissing bool `json:"allow_missing"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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. FieldMask string `json:"field_mask"` Setting RestrictWorkspaceAdminsSetting `json:"setting"` diff --git a/service/sql/api.go b/service/sql/api.go index 784b33de4..e3a899a35 100755 --- a/service/sql/api.go +++ b/service/sql/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Alerts, Alerts Legacy, Dashboard Widgets, Dashboards, Data Sources, Dbsql Permissions, Queries, Queries Legacy, Query History, Query Visualizations, Query Visualizations Legacy, Statement Execution, Warehouses, etc. +// These APIs allow you to manage Alerts, Alerts Legacy, Dashboard Widgets, Dashboards, Data Sources, Dbsql Permissions, Queries, Queries Legacy, Query History, Query Visualizations, Query Visualizations Legacy, Redash Config, Statement Execution, Warehouses, etc. package sql import ( @@ -1627,6 +1627,25 @@ func (a *QueryVisualizationsLegacyAPI) DeleteById(ctx context.Context, id string }) } +type RedashConfigInterface interface { + + // Read workspace configuration for Redash-v2. + GetConfig(ctx context.Context) (*ClientConfig, error) +} + +func NewRedashConfig(client *client.DatabricksClient) *RedashConfigAPI { + return &RedashConfigAPI{ + redashConfigImpl: redashConfigImpl{ + client: client, + }, + } +} + +// Redash V2 service for workspace configurations (internal) +type RedashConfigAPI struct { + redashConfigImpl +} + type StatementExecutionInterface interface { statementExecutionAPIUtilities diff --git a/service/sql/impl.go b/service/sql/impl.go index 5ab751c15..6dd38e9c9 100755 --- a/service/sql/impl.go +++ b/service/sql/impl.go @@ -503,6 +503,21 @@ func (a *queryVisualizationsLegacyImpl) Update(ctx context.Context, request Lega return &legacyVisualization, err } +// unexported type that holds implementations of just RedashConfig API methods +type redashConfigImpl struct { + client *client.DatabricksClient +} + +func (a *redashConfigImpl) GetConfig(ctx context.Context) (*ClientConfig, error) { + var clientConfig ClientConfig + path := "/api/2.0/redash-v2/config" + + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &clientConfig) + return &clientConfig, err +} + // unexported type that holds implementations of just StatementExecution API methods type statementExecutionImpl struct { client *client.DatabricksClient diff --git a/service/sql/interface.go b/service/sql/interface.go index 7e1d2838f..52301cdeb 100755 --- a/service/sql/interface.go +++ b/service/sql/interface.go @@ -479,6 +479,13 @@ type QueryVisualizationsLegacyService interface { Update(ctx context.Context, request LegacyVisualization) (*LegacyVisualization, error) } +// Redash V2 service for workspace configurations (internal) +type RedashConfigService interface { + + // Read workspace configuration for Redash-v2. + GetConfig(ctx context.Context) (*ClientConfig, error) +} + // The Databricks SQL Statement Execution API can be used to execute SQL // statements on a SQL warehouse and fetch the result. // diff --git a/service/sql/model.go b/service/sql/model.go index bf307030c..f74768bba 100755 --- a/service/sql/model.go +++ b/service/sql/model.go @@ -423,6 +423,38 @@ func (f *ChannelName) Type() string { return "ChannelName" } +type ClientConfig struct { + AllowCustomJsVisualizations bool `json:"allow_custom_js_visualizations,omitempty"` + + AllowDownloads bool `json:"allow_downloads,omitempty"` + + AllowExternalShares bool `json:"allow_external_shares,omitempty"` + + AllowSubscriptions bool `json:"allow_subscriptions,omitempty"` + + DateFormat string `json:"date_format,omitempty"` + + DateTimeFormat string `json:"date_time_format,omitempty"` + + DisablePublish bool `json:"disable_publish,omitempty"` + + EnableLegacyAutodetectTypes bool `json:"enable_legacy_autodetect_types,omitempty"` + + FeatureShowPermissionsControl bool `json:"feature_show_permissions_control,omitempty"` + + HidePlotlyModeBar bool `json:"hide_plotly_mode_bar,omitempty"` + + ForceSendFields []string `json:"-"` +} + +func (s *ClientConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ClientConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ColumnInfo struct { // The name of the column. Name string `json:"name,omitempty"` @@ -4323,10 +4355,17 @@ type UpdateAlertRequest struct { Alert *UpdateAlertRequestAlert `json:"alert,omitempty"` Id string `json:"-" url:"-"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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:"update_mask"` } @@ -4373,10 +4412,17 @@ type UpdateQueryRequest struct { Id string `json:"-" url:"-"` Query *UpdateQueryRequestQuery `json:"query,omitempty"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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:"update_mask"` } @@ -4422,10 +4468,17 @@ type UpdateResponse struct { type UpdateVisualizationRequest struct { Id string `json:"-" url:"-"` - // Field mask is required to be passed into the PATCH request. Field mask - // specifies which fields of the setting payload will be updated. The field - // mask needs to be supplied as single string. To specify multiple fields in - // the field mask, use comma as the separator (no space). + // 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:"update_mask"` Visualization *UpdateVisualizationRequestVisualization `json:"visualization,omitempty"` diff --git a/version/version.go b/version/version.go index 61aa3beb4..47e4ca507 100644 --- a/version/version.go +++ b/version/version.go @@ -1,4 +1,4 @@ package version // Version of the SDK, updated manually before every tag -const Version = "0.56.1" +const Version = "0.57.0" diff --git a/workspace_client.go b/workspace_client.go index b129ce30d..1c34bd372 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -443,6 +443,10 @@ type WorkspaceClient struct { // (import, export, get-status, list, delete). Lakeview dashboards.LakeviewInterface + // Token-based Lakeview APIs for embedding dashboards in external + // applications. + LakeviewEmbedded dashboards.LakeviewEmbeddedInterface + // The Libraries API allows you to install and uninstall libraries and get // the status of libraries on a cluster. // @@ -687,6 +691,9 @@ type WorkspaceClient struct { // [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html QueriesLegacy sql.QueriesLegacyInterface + // Query execution APIs for AI / BI Dashboards + QueryExecution dashboards.QueryExecutionInterface + // A service responsible for storing and retrieving the list of queries run // against SQL endpoints and serverless compute. QueryHistory sql.QueryHistoryInterface @@ -737,6 +744,9 @@ type WorkspaceClient struct { // shared data. This sharing mode is called **open sharing**. Recipients sharing.RecipientsInterface + // Redash V2 service for workspace configurations (internal) + RedashConfig sql.RedashConfigInterface + // Databricks provides a hosted version of MLflow Model Registry in Unity // Catalog. Models in Unity Catalog provide centralized access control, // auditing, lineage, and discovery of ML models across Databricks @@ -1199,6 +1209,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { IpAccessLists: settings.NewIpAccessLists(databricksClient), Jobs: jobs.NewJobs(databricksClient), Lakeview: dashboards.NewLakeview(databricksClient), + LakeviewEmbedded: dashboards.NewLakeviewEmbedded(databricksClient), Libraries: compute.NewLibraries(databricksClient), Metastores: catalog.NewMetastores(databricksClient), ModelRegistry: ml.NewModelRegistry(databricksClient), @@ -1222,11 +1233,13 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { QualityMonitors: catalog.NewQualityMonitors(databricksClient), Queries: sql.NewQueries(databricksClient), QueriesLegacy: sql.NewQueriesLegacy(databricksClient), + QueryExecution: dashboards.NewQueryExecution(databricksClient), QueryHistory: sql.NewQueryHistory(databricksClient), QueryVisualizations: sql.NewQueryVisualizations(databricksClient), QueryVisualizationsLegacy: sql.NewQueryVisualizationsLegacy(databricksClient), RecipientActivation: sharing.NewRecipientActivation(databricksClient), Recipients: sharing.NewRecipients(databricksClient), + RedashConfig: sql.NewRedashConfig(databricksClient), RegisteredModels: catalog.NewRegisteredModels(databricksClient), Repos: workspace.NewRepos(databricksClient), ResourceQuotas: catalog.NewResourceQuotas(databricksClient),