From 877178998aa1a33719f50b6cf8b97de76d861af4 Mon Sep 17 00:00:00 2001 From: Parth Bansal Date: Tue, 21 Oct 2025 11:39:50 +0000 Subject: [PATCH] update --- .codegen/_openapi_sha | 2 +- .gitattributes | 8 + account_client.go | 4 + experimental/mocks/mock_account_client.go | 9 + experimental/mocks/mock_workspace_client.go | 27 + .../billing/mock_usage_policy_interface.go | 478 +++++++ .../compute/mock_libraries_interface.go | 532 ++++++++ .../dashboards/mock_genie_interface.go | 299 +++++ .../mock_lakeview_embedded_interface.go | 94 ++ .../mock_query_execution_interface.go | 202 +++ .../database/mock_database_interface.go | 118 ++ .../mock_database_project_interface.go | 1094 ++++++++++++++++ .../iamv2/mock_account_iam_v2_interface.go | 1105 ++++++++++++++++- .../iamv2/mock_workspace_iam_v2_interface.go | 1105 ++++++++++++++++- .../service/ml/mock_experiments_interface.go | 59 + .../ml/mock_feature_engineering_interface.go | 332 +++++ .../pipelines/mock_pipelines_interface.go | 118 ++ .../tags/mock_tag_assignments_interface.go | 371 ++++++ .../mock_vector_search_indexes_interface.go | 59 + .../generatedtests/idempotency_call_test.go | 147 +++ .../service/idempotencytesting/api.go | 27 + .../service/idempotencytesting/impl.go | 35 + .../service/idempotencytesting/model.go | 39 + internal/testspecs/service/lrotesting/api.go | 177 ++- internal/testspecs/service/lrotesting/impl.go | 10 + .../testspecs/service/lrotesting/model.go | 5 + service/apps/model.go | 25 + service/billing/api.go | 62 +- service/billing/impl.go | 107 +- service/billing/interface.go | 22 + service/billing/model.go | 119 ++ service/catalog/model.go | 175 ++- service/compute/api.go | 68 + service/compute/impl.go | 109 ++ service/compute/interface.go | 32 + service/compute/model.go | 349 +++++- service/dashboards/api.go | 99 +- service/dashboards/impl.go | 86 ++ service/dashboards/interface.go | 45 + service/dashboards/model.go | 242 ++++ service/database/api.go | 95 +- service/database/impl.go | 304 +++++ service/database/interface.go | 62 + service/database/model.go | 600 +++++++++ service/dataquality/api.go | 156 ++- service/dataquality/impl.go | 38 +- service/dataquality/interface.go | 151 ++- service/dataquality/model.go | 232 +++- service/iamv2/api.go | 114 ++ service/iamv2/impl.go | 420 +++++++ service/iamv2/interface.go | 114 ++ service/iamv2/model.go | 420 +++++++ service/jobs/model.go | 229 +++- service/marketplace/impl.go | 4 + service/ml/api.go | 25 + service/ml/impl.go | 96 ++ service/ml/interface.go | 18 + service/ml/model.go | 155 +++ service/oauth2/model.go | 19 +- service/pipelines/api.go | 8 + service/pipelines/impl.go | 20 + service/pipelines/interface.go | 9 + service/pipelines/model.go | 102 +- service/pkg.go | 12 + service/provisioning/model.go | 6 +- service/qualitymonitorv2/model.go | 39 + service/serving/impl.go | 1 - service/settings/model.go | 55 +- service/sharing/model.go | 22 + service/sql/model.go | 63 +- service/tags/api.go | 44 +- service/tags/impl.go | 91 ++ service/tags/interface.go | 21 + service/tags/model.go | 114 ++ service/vectorsearch/api.go | 3 + service/vectorsearch/impl.go | 10 + service/vectorsearch/interface.go | 3 + service/vectorsearch/model.go | 18 + service/workspace/model.go | 43 + workspace_client.go | 13 + 80 files changed, 11683 insertions(+), 262 deletions(-) create mode 100644 experimental/mocks/service/billing/mock_usage_policy_interface.go create mode 100644 experimental/mocks/service/dashboards/mock_query_execution_interface.go create mode 100644 experimental/mocks/service/database/mock_database_project_interface.go create mode 100644 experimental/mocks/service/tags/mock_tag_assignments_interface.go create mode 100755 internal/generatedtests/idempotency_call_test.go create mode 100755 internal/testspecs/service/idempotencytesting/api.go create mode 100755 internal/testspecs/service/idempotencytesting/impl.go create mode 100755 internal/testspecs/service/idempotencytesting/model.go diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 20842dced..fe9f54bb2 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -c4784cea599325a13472b1455e7434d639362d8b \ No newline at end of file +universe:/home/parth.bansal/vn1/universe \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 3f53f15f5..ba26a3e37 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,6 +12,7 @@ experimental/mocks/service/billing/mock_budget_policy_interface.go linguist-gene experimental/mocks/service/billing/mock_budgets_interface.go linguist-generated=true experimental/mocks/service/billing/mock_log_delivery_interface.go linguist-generated=true experimental/mocks/service/billing/mock_usage_dashboards_interface.go linguist-generated=true +experimental/mocks/service/billing/mock_usage_policy_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_account_metastore_assignments_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_account_metastores_interface.go linguist-generated=true experimental/mocks/service/catalog/mock_account_storage_credentials_interface.go linguist-generated=true @@ -59,7 +60,9 @@ experimental/mocks/service/compute/mock_policy_families_interface.go linguist-ge experimental/mocks/service/dashboards/mock_genie_interface.go linguist-generated=true experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go linguist-generated=true experimental/mocks/service/dashboards/mock_lakeview_interface.go linguist-generated=true +experimental/mocks/service/dashboards/mock_query_execution_interface.go linguist-generated=true experimental/mocks/service/database/mock_database_interface.go linguist-generated=true +experimental/mocks/service/database/mock_database_project_interface.go linguist-generated=true experimental/mocks/service/dataquality/mock_data_quality_interface.go linguist-generated=true experimental/mocks/service/files/mock_dbfs_interface.go linguist-generated=true experimental/mocks/service/files/mock_files_interface.go linguist-generated=true @@ -179,6 +182,7 @@ experimental/mocks/service/sql/mock_query_visualizations_legacy_interface.go lin experimental/mocks/service/sql/mock_redash_config_interface.go linguist-generated=true experimental/mocks/service/sql/mock_statement_execution_interface.go linguist-generated=true experimental/mocks/service/sql/mock_warehouses_interface.go linguist-generated=true +experimental/mocks/service/tags/mock_tag_assignments_interface.go linguist-generated=true experimental/mocks/service/tags/mock_tag_policies_interface.go linguist-generated=true experimental/mocks/service/vectorsearch/mock_vector_search_endpoints_interface.go linguist-generated=true experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go linguist-generated=true @@ -187,11 +191,15 @@ experimental/mocks/service/workspace/mock_repos_interface.go linguist-generated= experimental/mocks/service/workspace/mock_secrets_interface.go linguist-generated=true experimental/mocks/service/workspace/mock_workspace_interface.go linguist-generated=true internal/generatedtests/http_call_test.go linguist-generated=true +internal/generatedtests/idempotency_call_test.go linguist-generated=true internal/generatedtests/json_marshall_test.go linguist-generated=true internal/generatedtests/lro_call_test.go linguist-generated=true internal/testspecs/service/httpcallv2/api.go linguist-generated=true internal/testspecs/service/httpcallv2/impl.go linguist-generated=true internal/testspecs/service/httpcallv2/model.go linguist-generated=true +internal/testspecs/service/idempotencytesting/api.go linguist-generated=true +internal/testspecs/service/idempotencytesting/impl.go linguist-generated=true +internal/testspecs/service/idempotencytesting/model.go linguist-generated=true internal/testspecs/service/jsonmarshallv2/api.go linguist-generated=true internal/testspecs/service/jsonmarshallv2/impl.go linguist-generated=true internal/testspecs/service/jsonmarshallv2/model.go linguist-generated=true diff --git a/account_client.go b/account_client.go index 74c73798e..ebc728a91 100755 --- a/account_client.go +++ b/account_client.go @@ -384,6 +384,9 @@ type AccountClient struct { // drivers. UsageDashboards billing.UsageDashboardsInterface + // A service serves REST API about Usage policies + UsagePolicy billing.UsagePolicyInterface + // User identities recognized by Databricks and represented by email // addresses. // @@ -521,6 +524,7 @@ func NewAccountClient(c ...*Config) (*AccountClient, error) { Storage: provisioning.NewStorage(apiClient), StorageCredentials: catalog.NewAccountStorageCredentials(apiClient), UsageDashboards: billing.NewUsageDashboards(apiClient), + UsagePolicy: billing.NewUsagePolicy(apiClient), UsersV2: iam.NewAccountUsersV2(apiClient), VpcEndpoints: provisioning.NewVpcEndpoints(apiClient), WorkspaceAssignment: iam.NewWorkspaceAssignment(apiClient), diff --git a/experimental/mocks/mock_account_client.go b/experimental/mocks/mock_account_client.go index 347e94b5c..a2eb1a6a4 100755 --- a/experimental/mocks/mock_account_client.go +++ b/experimental/mocks/mock_account_client.go @@ -60,6 +60,7 @@ func NewMockAccountClient(t interface { Storage: provisioning.NewMockStorageInterface(t), StorageCredentials: catalog.NewMockAccountStorageCredentialsInterface(t), UsageDashboards: billing.NewMockUsageDashboardsInterface(t), + UsagePolicy: billing.NewMockUsagePolicyInterface(t), UsersV2: iam.NewMockAccountUsersV2Interface(t), VpcEndpoints: provisioning.NewMockVpcEndpointsInterface(t), WorkspaceAssignment: iam.NewMockWorkspaceAssignmentInterface(t), @@ -377,6 +378,14 @@ func (m *MockAccountClient) GetMockUsageDashboardsAPI() *billing.MockUsageDashbo return api } +func (m *MockAccountClient) GetMockUsagePolicyAPI() *billing.MockUsagePolicyInterface { + api, ok := m.AccountClient.UsagePolicy.(*billing.MockUsagePolicyInterface) + if !ok { + panic(fmt.Sprintf("expected UsagePolicy to be *billing.MockUsagePolicyInterface, actual was %T", m.AccountClient.UsagePolicy)) + } + return api +} + func (m *MockAccountClient) GetMockAccountUsersV2API() *iam.MockAccountUsersV2Interface { api, ok := m.AccountClient.UsersV2.(*iam.MockAccountUsersV2Interface) if !ok { diff --git a/experimental/mocks/mock_workspace_client.go b/experimental/mocks/mock_workspace_client.go index c56df3da5..f9d6ce1f5 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -81,6 +81,7 @@ func NewMockWorkspaceClient(t interface { DataQuality: dataquality.NewMockDataQualityInterface(t), DataSources: sql.NewMockDataSourcesInterface(t), Database: database.NewMockDatabaseInterface(t), + DatabaseProject: database.NewMockDatabaseProjectInterface(t), Dbfs: files.NewMockDbfsInterface(t), DbsqlPermissions: sql.NewMockDbsqlPermissionsInterface(t), EntityTagAssignments: catalog.NewMockEntityTagAssignmentsInterface(t), @@ -130,6 +131,7 @@ 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), @@ -154,6 +156,7 @@ func NewMockWorkspaceClient(t interface { SystemSchemas: catalog.NewMockSystemSchemasInterface(t), TableConstraints: catalog.NewMockTableConstraintsInterface(t), Tables: catalog.NewMockTablesInterface(t), + TagAssignments: tags.NewMockTagAssignmentsInterface(t), TagPolicies: tags.NewMockTagPoliciesInterface(t), TemporaryPathCredentials: catalog.NewMockTemporaryPathCredentialsInterface(t), TemporaryTableCredentials: catalog.NewMockTemporaryTableCredentialsInterface(t), @@ -612,6 +615,14 @@ func (m *MockWorkspaceClient) GetMockDatabaseAPI() *database.MockDatabaseInterfa return api } +func (m *MockWorkspaceClient) GetMockDatabaseProjectAPI() *database.MockDatabaseProjectInterface { + api, ok := m.WorkspaceClient.DatabaseProject.(*database.MockDatabaseProjectInterface) + if !ok { + panic(fmt.Sprintf("expected DatabaseProject to be *database.MockDatabaseProjectInterface, actual was %T", m.WorkspaceClient.DatabaseProject)) + } + return api +} + func (m *MockWorkspaceClient) GetMockDbfsAPI() *files.MockDbfsInterface { api, ok := m.WorkspaceClient.Dbfs.(*files.MockDbfsInterface) if !ok { @@ -1004,6 +1015,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 { @@ -1196,6 +1215,14 @@ func (m *MockWorkspaceClient) GetMockTablesAPI() *catalog.MockTablesInterface { return api } +func (m *MockWorkspaceClient) GetMockTagAssignmentsAPI() *tags.MockTagAssignmentsInterface { + api, ok := m.WorkspaceClient.TagAssignments.(*tags.MockTagAssignmentsInterface) + if !ok { + panic(fmt.Sprintf("expected TagAssignments to be *tags.MockTagAssignmentsInterface, actual was %T", m.WorkspaceClient.TagAssignments)) + } + return api +} + func (m *MockWorkspaceClient) GetMockTagPoliciesAPI() *tags.MockTagPoliciesInterface { api, ok := m.WorkspaceClient.TagPolicies.(*tags.MockTagPoliciesInterface) if !ok { diff --git a/experimental/mocks/service/billing/mock_usage_policy_interface.go b/experimental/mocks/service/billing/mock_usage_policy_interface.go new file mode 100644 index 000000000..0265b2844 --- /dev/null +++ b/experimental/mocks/service/billing/mock_usage_policy_interface.go @@ -0,0 +1,478 @@ +// Code generated by mockery v2.53.2. 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" +) + +// MockUsagePolicyInterface is an autogenerated mock type for the UsagePolicyInterface type +type MockUsagePolicyInterface struct { + mock.Mock +} + +type MockUsagePolicyInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockUsagePolicyInterface) EXPECT() *MockUsagePolicyInterface_Expecter { + return &MockUsagePolicyInterface_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, request +func (_m *MockUsagePolicyInterface) Create(ctx context.Context, request billing.CreateUsagePolicyRequest) (*billing.UsagePolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *billing.UsagePolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, billing.CreateUsagePolicyRequest) (*billing.UsagePolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, billing.CreateUsagePolicyRequest) *billing.UsagePolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*billing.UsagePolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, billing.CreateUsagePolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsagePolicyInterface_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockUsagePolicyInterface_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - request billing.CreateUsagePolicyRequest +func (_e *MockUsagePolicyInterface_Expecter) Create(ctx interface{}, request interface{}) *MockUsagePolicyInterface_Create_Call { + return &MockUsagePolicyInterface_Create_Call{Call: _e.mock.On("Create", ctx, request)} +} + +func (_c *MockUsagePolicyInterface_Create_Call) Run(run func(ctx context.Context, request billing.CreateUsagePolicyRequest)) *MockUsagePolicyInterface_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.CreateUsagePolicyRequest)) + }) + return _c +} + +func (_c *MockUsagePolicyInterface_Create_Call) Return(_a0 *billing.UsagePolicy, _a1 error) *MockUsagePolicyInterface_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsagePolicyInterface_Create_Call) RunAndReturn(run func(context.Context, billing.CreateUsagePolicyRequest) (*billing.UsagePolicy, error)) *MockUsagePolicyInterface_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, request +func (_m *MockUsagePolicyInterface) Delete(ctx context.Context, request billing.DeleteUsagePolicyRequest) 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.DeleteUsagePolicyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockUsagePolicyInterface_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockUsagePolicyInterface_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - request billing.DeleteUsagePolicyRequest +func (_e *MockUsagePolicyInterface_Expecter) Delete(ctx interface{}, request interface{}) *MockUsagePolicyInterface_Delete_Call { + return &MockUsagePolicyInterface_Delete_Call{Call: _e.mock.On("Delete", ctx, request)} +} + +func (_c *MockUsagePolicyInterface_Delete_Call) Run(run func(ctx context.Context, request billing.DeleteUsagePolicyRequest)) *MockUsagePolicyInterface_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.DeleteUsagePolicyRequest)) + }) + return _c +} + +func (_c *MockUsagePolicyInterface_Delete_Call) Return(_a0 error) *MockUsagePolicyInterface_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockUsagePolicyInterface_Delete_Call) RunAndReturn(run func(context.Context, billing.DeleteUsagePolicyRequest) error) *MockUsagePolicyInterface_Delete_Call { + _c.Call.Return(run) + return _c +} + +// DeleteByPolicyId provides a mock function with given fields: ctx, policyId +func (_m *MockUsagePolicyInterface) 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 +} + +// MockUsagePolicyInterface_DeleteByPolicyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByPolicyId' +type MockUsagePolicyInterface_DeleteByPolicyId_Call struct { + *mock.Call +} + +// DeleteByPolicyId is a helper method to define mock.On call +// - ctx context.Context +// - policyId string +func (_e *MockUsagePolicyInterface_Expecter) DeleteByPolicyId(ctx interface{}, policyId interface{}) *MockUsagePolicyInterface_DeleteByPolicyId_Call { + return &MockUsagePolicyInterface_DeleteByPolicyId_Call{Call: _e.mock.On("DeleteByPolicyId", ctx, policyId)} +} + +func (_c *MockUsagePolicyInterface_DeleteByPolicyId_Call) Run(run func(ctx context.Context, policyId string)) *MockUsagePolicyInterface_DeleteByPolicyId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockUsagePolicyInterface_DeleteByPolicyId_Call) Return(_a0 error) *MockUsagePolicyInterface_DeleteByPolicyId_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockUsagePolicyInterface_DeleteByPolicyId_Call) RunAndReturn(run func(context.Context, string) error) *MockUsagePolicyInterface_DeleteByPolicyId_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, request +func (_m *MockUsagePolicyInterface) Get(ctx context.Context, request billing.GetUsagePolicyRequest) (*billing.UsagePolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *billing.UsagePolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, billing.GetUsagePolicyRequest) (*billing.UsagePolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, billing.GetUsagePolicyRequest) *billing.UsagePolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*billing.UsagePolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, billing.GetUsagePolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsagePolicyInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockUsagePolicyInterface_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - request billing.GetUsagePolicyRequest +func (_e *MockUsagePolicyInterface_Expecter) Get(ctx interface{}, request interface{}) *MockUsagePolicyInterface_Get_Call { + return &MockUsagePolicyInterface_Get_Call{Call: _e.mock.On("Get", ctx, request)} +} + +func (_c *MockUsagePolicyInterface_Get_Call) Run(run func(ctx context.Context, request billing.GetUsagePolicyRequest)) *MockUsagePolicyInterface_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.GetUsagePolicyRequest)) + }) + return _c +} + +func (_c *MockUsagePolicyInterface_Get_Call) Return(_a0 *billing.UsagePolicy, _a1 error) *MockUsagePolicyInterface_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsagePolicyInterface_Get_Call) RunAndReturn(run func(context.Context, billing.GetUsagePolicyRequest) (*billing.UsagePolicy, error)) *MockUsagePolicyInterface_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetByPolicyId provides a mock function with given fields: ctx, policyId +func (_m *MockUsagePolicyInterface) GetByPolicyId(ctx context.Context, policyId string) (*billing.UsagePolicy, error) { + ret := _m.Called(ctx, policyId) + + if len(ret) == 0 { + panic("no return value specified for GetByPolicyId") + } + + var r0 *billing.UsagePolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*billing.UsagePolicy, error)); ok { + return rf(ctx, policyId) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *billing.UsagePolicy); ok { + r0 = rf(ctx, policyId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*billing.UsagePolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, policyId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsagePolicyInterface_GetByPolicyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByPolicyId' +type MockUsagePolicyInterface_GetByPolicyId_Call struct { + *mock.Call +} + +// GetByPolicyId is a helper method to define mock.On call +// - ctx context.Context +// - policyId string +func (_e *MockUsagePolicyInterface_Expecter) GetByPolicyId(ctx interface{}, policyId interface{}) *MockUsagePolicyInterface_GetByPolicyId_Call { + return &MockUsagePolicyInterface_GetByPolicyId_Call{Call: _e.mock.On("GetByPolicyId", ctx, policyId)} +} + +func (_c *MockUsagePolicyInterface_GetByPolicyId_Call) Run(run func(ctx context.Context, policyId string)) *MockUsagePolicyInterface_GetByPolicyId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockUsagePolicyInterface_GetByPolicyId_Call) Return(_a0 *billing.UsagePolicy, _a1 error) *MockUsagePolicyInterface_GetByPolicyId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsagePolicyInterface_GetByPolicyId_Call) RunAndReturn(run func(context.Context, string) (*billing.UsagePolicy, error)) *MockUsagePolicyInterface_GetByPolicyId_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, request +func (_m *MockUsagePolicyInterface) List(ctx context.Context, request billing.ListUsagePoliciesRequest) listing.Iterator[billing.UsagePolicy] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 listing.Iterator[billing.UsagePolicy] + if rf, ok := ret.Get(0).(func(context.Context, billing.ListUsagePoliciesRequest) listing.Iterator[billing.UsagePolicy]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[billing.UsagePolicy]) + } + } + + return r0 +} + +// MockUsagePolicyInterface_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockUsagePolicyInterface_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - request billing.ListUsagePoliciesRequest +func (_e *MockUsagePolicyInterface_Expecter) List(ctx interface{}, request interface{}) *MockUsagePolicyInterface_List_Call { + return &MockUsagePolicyInterface_List_Call{Call: _e.mock.On("List", ctx, request)} +} + +func (_c *MockUsagePolicyInterface_List_Call) Run(run func(ctx context.Context, request billing.ListUsagePoliciesRequest)) *MockUsagePolicyInterface_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.ListUsagePoliciesRequest)) + }) + return _c +} + +func (_c *MockUsagePolicyInterface_List_Call) Return(_a0 listing.Iterator[billing.UsagePolicy]) *MockUsagePolicyInterface_List_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockUsagePolicyInterface_List_Call) RunAndReturn(run func(context.Context, billing.ListUsagePoliciesRequest) listing.Iterator[billing.UsagePolicy]) *MockUsagePolicyInterface_List_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with given fields: ctx, request +func (_m *MockUsagePolicyInterface) ListAll(ctx context.Context, request billing.ListUsagePoliciesRequest) ([]billing.UsagePolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []billing.UsagePolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, billing.ListUsagePoliciesRequest) ([]billing.UsagePolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, billing.ListUsagePoliciesRequest) []billing.UsagePolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]billing.UsagePolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, billing.ListUsagePoliciesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsagePolicyInterface_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type MockUsagePolicyInterface_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +// - ctx context.Context +// - request billing.ListUsagePoliciesRequest +func (_e *MockUsagePolicyInterface_Expecter) ListAll(ctx interface{}, request interface{}) *MockUsagePolicyInterface_ListAll_Call { + return &MockUsagePolicyInterface_ListAll_Call{Call: _e.mock.On("ListAll", ctx, request)} +} + +func (_c *MockUsagePolicyInterface_ListAll_Call) Run(run func(ctx context.Context, request billing.ListUsagePoliciesRequest)) *MockUsagePolicyInterface_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.ListUsagePoliciesRequest)) + }) + return _c +} + +func (_c *MockUsagePolicyInterface_ListAll_Call) Return(_a0 []billing.UsagePolicy, _a1 error) *MockUsagePolicyInterface_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsagePolicyInterface_ListAll_Call) RunAndReturn(run func(context.Context, billing.ListUsagePoliciesRequest) ([]billing.UsagePolicy, error)) *MockUsagePolicyInterface_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, request +func (_m *MockUsagePolicyInterface) Update(ctx context.Context, request billing.UpdateUsagePolicyRequest) (*billing.UsagePolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *billing.UsagePolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, billing.UpdateUsagePolicyRequest) (*billing.UsagePolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, billing.UpdateUsagePolicyRequest) *billing.UsagePolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*billing.UsagePolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, billing.UpdateUsagePolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUsagePolicyInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockUsagePolicyInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request billing.UpdateUsagePolicyRequest +func (_e *MockUsagePolicyInterface_Expecter) Update(ctx interface{}, request interface{}) *MockUsagePolicyInterface_Update_Call { + return &MockUsagePolicyInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockUsagePolicyInterface_Update_Call) Run(run func(ctx context.Context, request billing.UpdateUsagePolicyRequest)) *MockUsagePolicyInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(billing.UpdateUsagePolicyRequest)) + }) + return _c +} + +func (_c *MockUsagePolicyInterface_Update_Call) Return(_a0 *billing.UsagePolicy, _a1 error) *MockUsagePolicyInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUsagePolicyInterface_Update_Call) RunAndReturn(run func(context.Context, billing.UpdateUsagePolicyRequest) (*billing.UsagePolicy, error)) *MockUsagePolicyInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockUsagePolicyInterface creates a new instance of MockUsagePolicyInterface. 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 NewMockUsagePolicyInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockUsagePolicyInterface { + mock := &MockUsagePolicyInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/compute/mock_libraries_interface.go b/experimental/mocks/service/compute/mock_libraries_interface.go index 23304e2d5..bc98492c9 100644 --- a/experimental/mocks/service/compute/mock_libraries_interface.go +++ b/experimental/mocks/service/compute/mock_libraries_interface.go @@ -300,6 +300,218 @@ func (_c *MockLibrariesInterface_ClusterStatusByClusterId_Call) RunAndReturn(run return _c } +// CreateDefaultBaseEnvironment provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) CreateDefaultBaseEnvironment(ctx context.Context, request compute.CreateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDefaultBaseEnvironment") + } + + var r0 *compute.DefaultBaseEnvironment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, compute.CreateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, compute.CreateDefaultBaseEnvironmentRequest) *compute.DefaultBaseEnvironment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*compute.DefaultBaseEnvironment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, compute.CreateDefaultBaseEnvironmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLibrariesInterface_CreateDefaultBaseEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDefaultBaseEnvironment' +type MockLibrariesInterface_CreateDefaultBaseEnvironment_Call struct { + *mock.Call +} + +// CreateDefaultBaseEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request compute.CreateDefaultBaseEnvironmentRequest +func (_e *MockLibrariesInterface_Expecter) CreateDefaultBaseEnvironment(ctx interface{}, request interface{}) *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call { + return &MockLibrariesInterface_CreateDefaultBaseEnvironment_Call{Call: _e.mock.On("CreateDefaultBaseEnvironment", ctx, request)} +} + +func (_c *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call) Run(run func(ctx context.Context, request compute.CreateDefaultBaseEnvironmentRequest)) *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.CreateDefaultBaseEnvironmentRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call) Return(_a0 *compute.DefaultBaseEnvironment, _a1 error) *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call) RunAndReturn(run func(context.Context, compute.CreateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)) *MockLibrariesInterface_CreateDefaultBaseEnvironment_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDefaultBaseEnvironment provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) DeleteDefaultBaseEnvironment(ctx context.Context, request compute.DeleteDefaultBaseEnvironmentRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteDefaultBaseEnvironment") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, compute.DeleteDefaultBaseEnvironmentRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDefaultBaseEnvironment' +type MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call struct { + *mock.Call +} + +// DeleteDefaultBaseEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request compute.DeleteDefaultBaseEnvironmentRequest +func (_e *MockLibrariesInterface_Expecter) DeleteDefaultBaseEnvironment(ctx interface{}, request interface{}) *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call { + return &MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call{Call: _e.mock.On("DeleteDefaultBaseEnvironment", ctx, request)} +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call) Run(run func(ctx context.Context, request compute.DeleteDefaultBaseEnvironmentRequest)) *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.DeleteDefaultBaseEnvironmentRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call) Return(_a0 error) *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call) RunAndReturn(run func(context.Context, compute.DeleteDefaultBaseEnvironmentRequest) error) *MockLibrariesInterface_DeleteDefaultBaseEnvironment_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDefaultBaseEnvironmentById provides a mock function with given fields: ctx, id +func (_m *MockLibrariesInterface) DeleteDefaultBaseEnvironmentById(ctx context.Context, id string) error { + ret := _m.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for DeleteDefaultBaseEnvironmentById") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDefaultBaseEnvironmentById' +type MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call struct { + *mock.Call +} + +// DeleteDefaultBaseEnvironmentById is a helper method to define mock.On call +// - ctx context.Context +// - id string +func (_e *MockLibrariesInterface_Expecter) DeleteDefaultBaseEnvironmentById(ctx interface{}, id interface{}) *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call { + return &MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call{Call: _e.mock.On("DeleteDefaultBaseEnvironmentById", ctx, id)} +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call) Run(run func(ctx context.Context, id string)) *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call) Return(_a0 error) *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call) RunAndReturn(run func(context.Context, string) error) *MockLibrariesInterface_DeleteDefaultBaseEnvironmentById_Call { + _c.Call.Return(run) + return _c +} + +// GetDefaultBaseEnvironment provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) GetDefaultBaseEnvironment(ctx context.Context, request compute.GetDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDefaultBaseEnvironment") + } + + var r0 *compute.DefaultBaseEnvironment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, compute.GetDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, compute.GetDefaultBaseEnvironmentRequest) *compute.DefaultBaseEnvironment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*compute.DefaultBaseEnvironment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, compute.GetDefaultBaseEnvironmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLibrariesInterface_GetDefaultBaseEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDefaultBaseEnvironment' +type MockLibrariesInterface_GetDefaultBaseEnvironment_Call struct { + *mock.Call +} + +// GetDefaultBaseEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request compute.GetDefaultBaseEnvironmentRequest +func (_e *MockLibrariesInterface_Expecter) GetDefaultBaseEnvironment(ctx interface{}, request interface{}) *MockLibrariesInterface_GetDefaultBaseEnvironment_Call { + return &MockLibrariesInterface_GetDefaultBaseEnvironment_Call{Call: _e.mock.On("GetDefaultBaseEnvironment", ctx, request)} +} + +func (_c *MockLibrariesInterface_GetDefaultBaseEnvironment_Call) Run(run func(ctx context.Context, request compute.GetDefaultBaseEnvironmentRequest)) *MockLibrariesInterface_GetDefaultBaseEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.GetDefaultBaseEnvironmentRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_GetDefaultBaseEnvironment_Call) Return(_a0 *compute.DefaultBaseEnvironment, _a1 error) *MockLibrariesInterface_GetDefaultBaseEnvironment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLibrariesInterface_GetDefaultBaseEnvironment_Call) RunAndReturn(run func(context.Context, compute.GetDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)) *MockLibrariesInterface_GetDefaultBaseEnvironment_Call { + _c.Call.Return(run) + return _c +} + // Install provides a mock function with given fields: ctx, request func (_m *MockLibrariesInterface) Install(ctx context.Context, request compute.InstallLibraries) error { ret := _m.Called(ctx, request) @@ -347,6 +559,208 @@ func (_c *MockLibrariesInterface_Install_Call) RunAndReturn(run func(context.Con return _c } +// ListDefaultBaseEnvironments provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) ListDefaultBaseEnvironments(ctx context.Context, request compute.ListDefaultBaseEnvironmentsRequest) listing.Iterator[compute.DefaultBaseEnvironment] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDefaultBaseEnvironments") + } + + var r0 listing.Iterator[compute.DefaultBaseEnvironment] + if rf, ok := ret.Get(0).(func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) listing.Iterator[compute.DefaultBaseEnvironment]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[compute.DefaultBaseEnvironment]) + } + } + + return r0 +} + +// MockLibrariesInterface_ListDefaultBaseEnvironments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDefaultBaseEnvironments' +type MockLibrariesInterface_ListDefaultBaseEnvironments_Call struct { + *mock.Call +} + +// ListDefaultBaseEnvironments is a helper method to define mock.On call +// - ctx context.Context +// - request compute.ListDefaultBaseEnvironmentsRequest +func (_e *MockLibrariesInterface_Expecter) ListDefaultBaseEnvironments(ctx interface{}, request interface{}) *MockLibrariesInterface_ListDefaultBaseEnvironments_Call { + return &MockLibrariesInterface_ListDefaultBaseEnvironments_Call{Call: _e.mock.On("ListDefaultBaseEnvironments", ctx, request)} +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironments_Call) Run(run func(ctx context.Context, request compute.ListDefaultBaseEnvironmentsRequest)) *MockLibrariesInterface_ListDefaultBaseEnvironments_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.ListDefaultBaseEnvironmentsRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironments_Call) Return(_a0 listing.Iterator[compute.DefaultBaseEnvironment]) *MockLibrariesInterface_ListDefaultBaseEnvironments_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironments_Call) RunAndReturn(run func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) listing.Iterator[compute.DefaultBaseEnvironment]) *MockLibrariesInterface_ListDefaultBaseEnvironments_Call { + _c.Call.Return(run) + return _c +} + +// ListDefaultBaseEnvironmentsAll provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) ListDefaultBaseEnvironmentsAll(ctx context.Context, request compute.ListDefaultBaseEnvironmentsRequest) ([]compute.DefaultBaseEnvironment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDefaultBaseEnvironmentsAll") + } + + var r0 []compute.DefaultBaseEnvironment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) ([]compute.DefaultBaseEnvironment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) []compute.DefaultBaseEnvironment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]compute.DefaultBaseEnvironment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDefaultBaseEnvironmentsAll' +type MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call struct { + *mock.Call +} + +// ListDefaultBaseEnvironmentsAll is a helper method to define mock.On call +// - ctx context.Context +// - request compute.ListDefaultBaseEnvironmentsRequest +func (_e *MockLibrariesInterface_Expecter) ListDefaultBaseEnvironmentsAll(ctx interface{}, request interface{}) *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call { + return &MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call{Call: _e.mock.On("ListDefaultBaseEnvironmentsAll", ctx, request)} +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call) Run(run func(ctx context.Context, request compute.ListDefaultBaseEnvironmentsRequest)) *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.ListDefaultBaseEnvironmentsRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call) Return(_a0 []compute.DefaultBaseEnvironment, _a1 error) *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call) RunAndReturn(run func(context.Context, compute.ListDefaultBaseEnvironmentsRequest) ([]compute.DefaultBaseEnvironment, error)) *MockLibrariesInterface_ListDefaultBaseEnvironmentsAll_Call { + _c.Call.Return(run) + return _c +} + +// RefreshDefaultBaseEnvironments provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) RefreshDefaultBaseEnvironments(ctx context.Context, request compute.RefreshDefaultBaseEnvironmentsRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for RefreshDefaultBaseEnvironments") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, compute.RefreshDefaultBaseEnvironmentsRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshDefaultBaseEnvironments' +type MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call struct { + *mock.Call +} + +// RefreshDefaultBaseEnvironments is a helper method to define mock.On call +// - ctx context.Context +// - request compute.RefreshDefaultBaseEnvironmentsRequest +func (_e *MockLibrariesInterface_Expecter) RefreshDefaultBaseEnvironments(ctx interface{}, request interface{}) *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call { + return &MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call{Call: _e.mock.On("RefreshDefaultBaseEnvironments", ctx, request)} +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call) Run(run func(ctx context.Context, request compute.RefreshDefaultBaseEnvironmentsRequest)) *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.RefreshDefaultBaseEnvironmentsRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call) Return(_a0 error) *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call) RunAndReturn(run func(context.Context, compute.RefreshDefaultBaseEnvironmentsRequest) error) *MockLibrariesInterface_RefreshDefaultBaseEnvironments_Call { + _c.Call.Return(run) + return _c +} + +// RefreshDefaultBaseEnvironmentsByIds provides a mock function with given fields: ctx, ids +func (_m *MockLibrariesInterface) RefreshDefaultBaseEnvironmentsByIds(ctx context.Context, ids []string) error { + ret := _m.Called(ctx, ids) + + if len(ret) == 0 { + panic("no return value specified for RefreshDefaultBaseEnvironmentsByIds") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok { + r0 = rf(ctx, ids) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshDefaultBaseEnvironmentsByIds' +type MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call struct { + *mock.Call +} + +// RefreshDefaultBaseEnvironmentsByIds is a helper method to define mock.On call +// - ctx context.Context +// - ids []string +func (_e *MockLibrariesInterface_Expecter) RefreshDefaultBaseEnvironmentsByIds(ctx interface{}, ids interface{}) *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call { + return &MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call{Call: _e.mock.On("RefreshDefaultBaseEnvironmentsByIds", ctx, ids)} +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call) Run(run func(ctx context.Context, ids []string)) *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]string)) + }) + return _c +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call) Return(_a0 error) *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call) RunAndReturn(run func(context.Context, []string) error) *MockLibrariesInterface_RefreshDefaultBaseEnvironmentsByIds_Call { + _c.Call.Return(run) + return _c +} + // Uninstall provides a mock function with given fields: ctx, request func (_m *MockLibrariesInterface) Uninstall(ctx context.Context, request compute.UninstallLibraries) error { ret := _m.Called(ctx, request) @@ -456,6 +870,124 @@ func (_c *MockLibrariesInterface_UpdateAndWait_Call) RunAndReturn(run func(conte return _c } +// UpdateDefaultBaseEnvironment provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) UpdateDefaultBaseEnvironment(ctx context.Context, request compute.UpdateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDefaultBaseEnvironment") + } + + var r0 *compute.DefaultBaseEnvironment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, compute.UpdateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, compute.UpdateDefaultBaseEnvironmentRequest) *compute.DefaultBaseEnvironment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*compute.DefaultBaseEnvironment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, compute.UpdateDefaultBaseEnvironmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDefaultBaseEnvironment' +type MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call struct { + *mock.Call +} + +// UpdateDefaultBaseEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request compute.UpdateDefaultBaseEnvironmentRequest +func (_e *MockLibrariesInterface_Expecter) UpdateDefaultBaseEnvironment(ctx interface{}, request interface{}) *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call { + return &MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call{Call: _e.mock.On("UpdateDefaultBaseEnvironment", ctx, request)} +} + +func (_c *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call) Run(run func(ctx context.Context, request compute.UpdateDefaultBaseEnvironmentRequest)) *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.UpdateDefaultBaseEnvironmentRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call) Return(_a0 *compute.DefaultBaseEnvironment, _a1 error) *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call) RunAndReturn(run func(context.Context, compute.UpdateDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)) *MockLibrariesInterface_UpdateDefaultBaseEnvironment_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDefaultDefaultBaseEnvironment provides a mock function with given fields: ctx, request +func (_m *MockLibrariesInterface) UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request compute.UpdateDefaultDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDefaultDefaultBaseEnvironment") + } + + var r0 *compute.DefaultBaseEnvironment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, compute.UpdateDefaultDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, compute.UpdateDefaultDefaultBaseEnvironmentRequest) *compute.DefaultBaseEnvironment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*compute.DefaultBaseEnvironment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, compute.UpdateDefaultDefaultBaseEnvironmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDefaultDefaultBaseEnvironment' +type MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call struct { + *mock.Call +} + +// UpdateDefaultDefaultBaseEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request compute.UpdateDefaultDefaultBaseEnvironmentRequest +func (_e *MockLibrariesInterface_Expecter) UpdateDefaultDefaultBaseEnvironment(ctx interface{}, request interface{}) *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call { + return &MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call{Call: _e.mock.On("UpdateDefaultDefaultBaseEnvironment", ctx, request)} +} + +func (_c *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call) Run(run func(ctx context.Context, request compute.UpdateDefaultDefaultBaseEnvironmentRequest)) *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(compute.UpdateDefaultDefaultBaseEnvironmentRequest)) + }) + return _c +} + +func (_c *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call) Return(_a0 *compute.DefaultBaseEnvironment, _a1 error) *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call) RunAndReturn(run func(context.Context, compute.UpdateDefaultDefaultBaseEnvironmentRequest) (*compute.DefaultBaseEnvironment, error)) *MockLibrariesInterface_UpdateDefaultDefaultBaseEnvironment_Call { + _c.Call.Return(run) + return _c +} + // NewMockLibrariesInterface creates a new instance of MockLibrariesInterface. 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 NewMockLibrariesInterface(t interface { diff --git a/experimental/mocks/service/dashboards/mock_genie_interface.go b/experimental/mocks/service/dashboards/mock_genie_interface.go index 513cfb0a6..d38fdacdf 100644 --- a/experimental/mocks/service/dashboards/mock_genie_interface.go +++ b/experimental/mocks/service/dashboards/mock_genie_interface.go @@ -159,6 +159,65 @@ func (_c *MockGenieInterface_CreateMessageAndWait_Call) RunAndReturn(run func(co return _c } +// CreateSpace provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) CreateSpace(ctx context.Context, request dashboards.GenieCreateSpaceRequest) (*dashboards.GenieSpace, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateSpace") + } + + var r0 *dashboards.GenieSpace + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieCreateSpaceRequest) (*dashboards.GenieSpace, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieCreateSpaceRequest) *dashboards.GenieSpace); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieSpace) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GenieCreateSpaceRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_CreateSpace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateSpace' +type MockGenieInterface_CreateSpace_Call struct { + *mock.Call +} + +// CreateSpace is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieCreateSpaceRequest +func (_e *MockGenieInterface_Expecter) CreateSpace(ctx interface{}, request interface{}) *MockGenieInterface_CreateSpace_Call { + return &MockGenieInterface_CreateSpace_Call{Call: _e.mock.On("CreateSpace", ctx, request)} +} + +func (_c *MockGenieInterface_CreateSpace_Call) Run(run func(ctx context.Context, request dashboards.GenieCreateSpaceRequest)) *MockGenieInterface_CreateSpace_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieCreateSpaceRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_CreateSpace_Call) Return(_a0 *dashboards.GenieSpace, _a1 error) *MockGenieInterface_CreateSpace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_CreateSpace_Call) RunAndReturn(run func(context.Context, dashboards.GenieCreateSpaceRequest) (*dashboards.GenieSpace, error)) *MockGenieInterface_CreateSpace_Call { + _c.Call.Return(run) + return _c +} + // DeleteConversation provides a mock function with given fields: ctx, request func (_m *MockGenieInterface) DeleteConversation(ctx context.Context, request dashboards.GenieDeleteConversationRequest) error { ret := _m.Called(ctx, request) @@ -419,6 +478,187 @@ func (_c *MockGenieInterface_ExecuteMessageQuery_Call) RunAndReturn(run func(con return _c } +// GenerateDownloadFullQueryResult provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) GenerateDownloadFullQueryResult(ctx context.Context, request dashboards.GenieGenerateDownloadFullQueryResultRequest) (*dashboards.GenieGenerateDownloadFullQueryResultResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GenerateDownloadFullQueryResult") + } + + var r0 *dashboards.GenieGenerateDownloadFullQueryResultResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieGenerateDownloadFullQueryResultRequest) (*dashboards.GenieGenerateDownloadFullQueryResultResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieGenerateDownloadFullQueryResultRequest) *dashboards.GenieGenerateDownloadFullQueryResultResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieGenerateDownloadFullQueryResultResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GenieGenerateDownloadFullQueryResultRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_GenerateDownloadFullQueryResult_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GenerateDownloadFullQueryResult' +type MockGenieInterface_GenerateDownloadFullQueryResult_Call struct { + *mock.Call +} + +// GenerateDownloadFullQueryResult is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieGenerateDownloadFullQueryResultRequest +func (_e *MockGenieInterface_Expecter) GenerateDownloadFullQueryResult(ctx interface{}, request interface{}) *MockGenieInterface_GenerateDownloadFullQueryResult_Call { + return &MockGenieInterface_GenerateDownloadFullQueryResult_Call{Call: _e.mock.On("GenerateDownloadFullQueryResult", ctx, request)} +} + +func (_c *MockGenieInterface_GenerateDownloadFullQueryResult_Call) Run(run func(ctx context.Context, request dashboards.GenieGenerateDownloadFullQueryResultRequest)) *MockGenieInterface_GenerateDownloadFullQueryResult_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieGenerateDownloadFullQueryResultRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_GenerateDownloadFullQueryResult_Call) Return(_a0 *dashboards.GenieGenerateDownloadFullQueryResultResponse, _a1 error) *MockGenieInterface_GenerateDownloadFullQueryResult_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_GenerateDownloadFullQueryResult_Call) RunAndReturn(run func(context.Context, dashboards.GenieGenerateDownloadFullQueryResultRequest) (*dashboards.GenieGenerateDownloadFullQueryResultResponse, error)) *MockGenieInterface_GenerateDownloadFullQueryResult_Call { + _c.Call.Return(run) + return _c +} + +// GetDownloadFullQueryResult provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) GetDownloadFullQueryResult(ctx context.Context, request dashboards.GenieGetDownloadFullQueryResultRequest) (*dashboards.GenieGetDownloadFullQueryResultResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDownloadFullQueryResult") + } + + var r0 *dashboards.GenieGetDownloadFullQueryResultResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieGetDownloadFullQueryResultRequest) (*dashboards.GenieGetDownloadFullQueryResultResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieGetDownloadFullQueryResultRequest) *dashboards.GenieGetDownloadFullQueryResultResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieGetDownloadFullQueryResultResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GenieGetDownloadFullQueryResultRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_GetDownloadFullQueryResult_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDownloadFullQueryResult' +type MockGenieInterface_GetDownloadFullQueryResult_Call struct { + *mock.Call +} + +// GetDownloadFullQueryResult is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieGetDownloadFullQueryResultRequest +func (_e *MockGenieInterface_Expecter) GetDownloadFullQueryResult(ctx interface{}, request interface{}) *MockGenieInterface_GetDownloadFullQueryResult_Call { + return &MockGenieInterface_GetDownloadFullQueryResult_Call{Call: _e.mock.On("GetDownloadFullQueryResult", ctx, request)} +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResult_Call) Run(run func(ctx context.Context, request dashboards.GenieGetDownloadFullQueryResultRequest)) *MockGenieInterface_GetDownloadFullQueryResult_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieGetDownloadFullQueryResultRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResult_Call) Return(_a0 *dashboards.GenieGetDownloadFullQueryResultResponse, _a1 error) *MockGenieInterface_GetDownloadFullQueryResult_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResult_Call) RunAndReturn(run func(context.Context, dashboards.GenieGetDownloadFullQueryResultRequest) (*dashboards.GenieGetDownloadFullQueryResultResponse, error)) *MockGenieInterface_GetDownloadFullQueryResult_Call { + _c.Call.Return(run) + return _c +} + +// GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId provides a mock function with given fields: ctx, spaceId, conversationId, messageId, attachmentId, downloadId +func (_m *MockGenieInterface) GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string, downloadId string) (*dashboards.GenieGetDownloadFullQueryResultResponse, error) { + ret := _m.Called(ctx, spaceId, conversationId, messageId, attachmentId, downloadId) + + if len(ret) == 0 { + panic("no return value specified for GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId") + } + + var r0 *dashboards.GenieGetDownloadFullQueryResultResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, string) (*dashboards.GenieGetDownloadFullQueryResultResponse, error)); ok { + return rf(ctx, spaceId, conversationId, messageId, attachmentId, downloadId) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, string) *dashboards.GenieGetDownloadFullQueryResultResponse); ok { + r0 = rf(ctx, spaceId, conversationId, messageId, attachmentId, downloadId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieGetDownloadFullQueryResultResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, string) error); ok { + r1 = rf(ctx, spaceId, conversationId, messageId, attachmentId, downloadId) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId' +type MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call struct { + *mock.Call +} + +// GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId is a helper method to define mock.On call +// - ctx context.Context +// - spaceId string +// - conversationId string +// - messageId string +// - attachmentId string +// - downloadId string +func (_e *MockGenieInterface_Expecter) GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId(ctx interface{}, spaceId interface{}, conversationId interface{}, messageId interface{}, attachmentId interface{}, downloadId interface{}) *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call { + return &MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call{Call: _e.mock.On("GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId", ctx, spaceId, conversationId, messageId, attachmentId, downloadId)} +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call) Run(run func(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string, downloadId string)) *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(string), args[4].(string), args[5].(string)) + }) + return _c +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call) Return(_a0 *dashboards.GenieGetDownloadFullQueryResultResponse, _a1 error) *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call) RunAndReturn(run func(context.Context, string, string, string, string, string) (*dashboards.GenieGetDownloadFullQueryResultResponse, error)) *MockGenieInterface_GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId_Call { + _c.Call.Return(run) + return _c +} + // GetMessage provides a mock function with given fields: ctx, request func (_m *MockGenieInterface) GetMessage(ctx context.Context, request dashboards.GenieGetConversationMessageRequest) (*dashboards.GenieMessage, error) { ret := _m.Called(ctx, request) @@ -1529,6 +1769,65 @@ func (_c *MockGenieInterface_TrashSpaceBySpaceId_Call) RunAndReturn(run func(con return _c } +// UpdateSpace provides a mock function with given fields: ctx, request +func (_m *MockGenieInterface) UpdateSpace(ctx context.Context, request dashboards.GenieUpdateSpaceRequest) (*dashboards.GenieSpace, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateSpace") + } + + var r0 *dashboards.GenieSpace + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieUpdateSpaceRequest) (*dashboards.GenieSpace, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, dashboards.GenieUpdateSpaceRequest) *dashboards.GenieSpace); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dashboards.GenieSpace) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, dashboards.GenieUpdateSpaceRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockGenieInterface_UpdateSpace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateSpace' +type MockGenieInterface_UpdateSpace_Call struct { + *mock.Call +} + +// UpdateSpace is a helper method to define mock.On call +// - ctx context.Context +// - request dashboards.GenieUpdateSpaceRequest +func (_e *MockGenieInterface_Expecter) UpdateSpace(ctx interface{}, request interface{}) *MockGenieInterface_UpdateSpace_Call { + return &MockGenieInterface_UpdateSpace_Call{Call: _e.mock.On("UpdateSpace", ctx, request)} +} + +func (_c *MockGenieInterface_UpdateSpace_Call) Run(run func(ctx context.Context, request dashboards.GenieUpdateSpaceRequest)) *MockGenieInterface_UpdateSpace_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(dashboards.GenieUpdateSpaceRequest)) + }) + return _c +} + +func (_c *MockGenieInterface_UpdateSpace_Call) Return(_a0 *dashboards.GenieSpace, _a1 error) *MockGenieInterface_UpdateSpace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockGenieInterface_UpdateSpace_Call) RunAndReturn(run func(context.Context, dashboards.GenieUpdateSpaceRequest) (*dashboards.GenieSpace, error)) *MockGenieInterface_UpdateSpace_Call { + _c.Call.Return(run) + return _c +} + // WaitGetMessageGenieCompleted provides a mock function with given fields: ctx, conversationId, messageId, spaceId, timeout, callback func (_m *MockGenieInterface) WaitGetMessageGenieCompleted(ctx context.Context, conversationId string, messageId string, spaceId string, timeout time.Duration, callback func(*dashboards.GenieMessage)) (*dashboards.GenieMessage, error) { ret := _m.Called(ctx, conversationId, messageId, spaceId, timeout, callback) diff --git a/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go b/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go index eea99e9b6..51479c6ef 100644 --- a/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go +++ b/experimental/mocks/service/dashboards/mock_lakeview_embedded_interface.go @@ -22,6 +22,100 @@ func (_m *MockLakeviewEmbeddedInterface) EXPECT() *MockLakeviewEmbeddedInterface 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 +} + // GetPublishedDashboardTokenInfo provides a mock function with given fields: ctx, request func (_m *MockLakeviewEmbeddedInterface) GetPublishedDashboardTokenInfo(ctx context.Context, request dashboards.GetPublishedDashboardTokenInfoRequest) (*dashboards.GetPublishedDashboardTokenInfoResponse, error) { ret := _m.Called(ctx, request) 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..ead40a712 --- /dev/null +++ b/experimental/mocks/service/dashboards/mock_query_execution_interface.go @@ -0,0 +1,202 @@ +// Code generated by mockery v2.53.2. 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/database/mock_database_interface.go b/experimental/mocks/service/database/mock_database_interface.go index d9ec59217..89e845e40 100644 --- a/experimental/mocks/service/database/mock_database_interface.go +++ b/experimental/mocks/service/database/mock_database_interface.go @@ -868,6 +868,65 @@ func (_c *MockDatabaseInterface_DeleteSyncedDatabaseTableByName_Call) RunAndRetu return _c } +// FailoverDatabaseInstance provides a mock function with given fields: ctx, request +func (_m *MockDatabaseInterface) FailoverDatabaseInstance(ctx context.Context, request database.FailoverDatabaseInstanceRequest) (*database.DatabaseInstance, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for FailoverDatabaseInstance") + } + + var r0 *database.DatabaseInstance + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.FailoverDatabaseInstanceRequest) (*database.DatabaseInstance, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.FailoverDatabaseInstanceRequest) *database.DatabaseInstance); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseInstance) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.FailoverDatabaseInstanceRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseInterface_FailoverDatabaseInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FailoverDatabaseInstance' +type MockDatabaseInterface_FailoverDatabaseInstance_Call struct { + *mock.Call +} + +// FailoverDatabaseInstance is a helper method to define mock.On call +// - ctx context.Context +// - request database.FailoverDatabaseInstanceRequest +func (_e *MockDatabaseInterface_Expecter) FailoverDatabaseInstance(ctx interface{}, request interface{}) *MockDatabaseInterface_FailoverDatabaseInstance_Call { + return &MockDatabaseInterface_FailoverDatabaseInstance_Call{Call: _e.mock.On("FailoverDatabaseInstance", ctx, request)} +} + +func (_c *MockDatabaseInterface_FailoverDatabaseInstance_Call) Run(run func(ctx context.Context, request database.FailoverDatabaseInstanceRequest)) *MockDatabaseInterface_FailoverDatabaseInstance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.FailoverDatabaseInstanceRequest)) + }) + return _c +} + +func (_c *MockDatabaseInterface_FailoverDatabaseInstance_Call) Return(_a0 *database.DatabaseInstance, _a1 error) *MockDatabaseInterface_FailoverDatabaseInstance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseInterface_FailoverDatabaseInstance_Call) RunAndReturn(run func(context.Context, database.FailoverDatabaseInstanceRequest) (*database.DatabaseInstance, error)) *MockDatabaseInterface_FailoverDatabaseInstance_Call { + _c.Call.Return(run) + return _c +} + // FindDatabaseInstanceByUid provides a mock function with given fields: ctx, request func (_m *MockDatabaseInterface) FindDatabaseInstanceByUid(ctx context.Context, request database.FindDatabaseInstanceByUidRequest) (*database.DatabaseInstance, error) { ret := _m.Called(ctx, request) @@ -2304,6 +2363,65 @@ func (_c *MockDatabaseInterface_UpdateDatabaseInstance_Call) RunAndReturn(run fu return _c } +// UpdateDatabaseInstanceRole provides a mock function with given fields: ctx, request +func (_m *MockDatabaseInterface) UpdateDatabaseInstanceRole(ctx context.Context, request database.UpdateDatabaseInstanceRoleRequest) (*database.DatabaseInstanceRole, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseInstanceRole") + } + + var r0 *database.DatabaseInstanceRole + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseInstanceRoleRequest) (*database.DatabaseInstanceRole, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseInstanceRoleRequest) *database.DatabaseInstanceRole); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseInstanceRole) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.UpdateDatabaseInstanceRoleRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseInterface_UpdateDatabaseInstanceRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseInstanceRole' +type MockDatabaseInterface_UpdateDatabaseInstanceRole_Call struct { + *mock.Call +} + +// UpdateDatabaseInstanceRole is a helper method to define mock.On call +// - ctx context.Context +// - request database.UpdateDatabaseInstanceRoleRequest +func (_e *MockDatabaseInterface_Expecter) UpdateDatabaseInstanceRole(ctx interface{}, request interface{}) *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call { + return &MockDatabaseInterface_UpdateDatabaseInstanceRole_Call{Call: _e.mock.On("UpdateDatabaseInstanceRole", ctx, request)} +} + +func (_c *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call) Run(run func(ctx context.Context, request database.UpdateDatabaseInstanceRoleRequest)) *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.UpdateDatabaseInstanceRoleRequest)) + }) + return _c +} + +func (_c *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call) Return(_a0 *database.DatabaseInstanceRole, _a1 error) *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call) RunAndReturn(run func(context.Context, database.UpdateDatabaseInstanceRoleRequest) (*database.DatabaseInstanceRole, error)) *MockDatabaseInterface_UpdateDatabaseInstanceRole_Call { + _c.Call.Return(run) + return _c +} + // UpdateSyncedDatabaseTable provides a mock function with given fields: ctx, request func (_m *MockDatabaseInterface) UpdateSyncedDatabaseTable(ctx context.Context, request database.UpdateSyncedDatabaseTableRequest) (*database.SyncedDatabaseTable, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/database/mock_database_project_interface.go b/experimental/mocks/service/database/mock_database_project_interface.go new file mode 100644 index 000000000..505951593 --- /dev/null +++ b/experimental/mocks/service/database/mock_database_project_interface.go @@ -0,0 +1,1094 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package database + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + database "github.com/databricks/databricks-sdk-go/service/database" + + mock "github.com/stretchr/testify/mock" +) + +// MockDatabaseProjectInterface is an autogenerated mock type for the DatabaseProjectInterface type +type MockDatabaseProjectInterface struct { + mock.Mock +} + +type MockDatabaseProjectInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockDatabaseProjectInterface) EXPECT() *MockDatabaseProjectInterface_Expecter { + return &MockDatabaseProjectInterface_Expecter{mock: &_m.Mock} +} + +// CreateDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) CreateDatabaseBranch(ctx context.Context, request database.CreateDatabaseBranchRequest) (*database.DatabaseBranch, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDatabaseBranch") + } + + var r0 *database.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseBranchRequest) (*database.DatabaseBranch, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseBranchRequest) *database.DatabaseBranch); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.CreateDatabaseBranchRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_CreateDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDatabaseBranch' +type MockDatabaseProjectInterface_CreateDatabaseBranch_Call struct { + *mock.Call +} + +// CreateDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request database.CreateDatabaseBranchRequest +func (_e *MockDatabaseProjectInterface_Expecter) CreateDatabaseBranch(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_CreateDatabaseBranch_Call { + return &MockDatabaseProjectInterface_CreateDatabaseBranch_Call{Call: _e.mock.On("CreateDatabaseBranch", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseBranch_Call) Run(run func(ctx context.Context, request database.CreateDatabaseBranchRequest)) *MockDatabaseProjectInterface_CreateDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.CreateDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseBranch_Call) Return(_a0 *database.DatabaseBranch, _a1 error) *MockDatabaseProjectInterface_CreateDatabaseBranch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseBranch_Call) RunAndReturn(run func(context.Context, database.CreateDatabaseBranchRequest) (*database.DatabaseBranch, error)) *MockDatabaseProjectInterface_CreateDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// CreateDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) CreateDatabaseEndpoint(ctx context.Context, request database.CreateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDatabaseEndpoint") + } + + var r0 *database.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseEndpointRequest) *database.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.CreateDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDatabaseEndpoint' +type MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call struct { + *mock.Call +} + +// CreateDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request database.CreateDatabaseEndpointRequest +func (_e *MockDatabaseProjectInterface_Expecter) CreateDatabaseEndpoint(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call { + return &MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call{Call: _e.mock.On("CreateDatabaseEndpoint", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call) Run(run func(ctx context.Context, request database.CreateDatabaseEndpointRequest)) *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.CreateDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call) Return(_a0 *database.DatabaseEndpoint, _a1 error) *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, database.CreateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)) *MockDatabaseProjectInterface_CreateDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// CreateDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) CreateDatabaseProject(ctx context.Context, request database.CreateDatabaseProjectRequest) (*database.DatabaseProject, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDatabaseProject") + } + + var r0 *database.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseProjectRequest) (*database.DatabaseProject, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.CreateDatabaseProjectRequest) *database.DatabaseProject); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.CreateDatabaseProjectRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_CreateDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDatabaseProject' +type MockDatabaseProjectInterface_CreateDatabaseProject_Call struct { + *mock.Call +} + +// CreateDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request database.CreateDatabaseProjectRequest +func (_e *MockDatabaseProjectInterface_Expecter) CreateDatabaseProject(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_CreateDatabaseProject_Call { + return &MockDatabaseProjectInterface_CreateDatabaseProject_Call{Call: _e.mock.On("CreateDatabaseProject", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseProject_Call) Run(run func(ctx context.Context, request database.CreateDatabaseProjectRequest)) *MockDatabaseProjectInterface_CreateDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.CreateDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseProject_Call) Return(_a0 *database.DatabaseProject, _a1 error) *MockDatabaseProjectInterface_CreateDatabaseProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_CreateDatabaseProject_Call) RunAndReturn(run func(context.Context, database.CreateDatabaseProjectRequest) (*database.DatabaseProject, error)) *MockDatabaseProjectInterface_CreateDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) DeleteDatabaseBranch(ctx context.Context, request database.DeleteDatabaseBranchRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteDatabaseBranch") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, database.DeleteDatabaseBranchRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockDatabaseProjectInterface_DeleteDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseBranch' +type MockDatabaseProjectInterface_DeleteDatabaseBranch_Call struct { + *mock.Call +} + +// DeleteDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request database.DeleteDatabaseBranchRequest +func (_e *MockDatabaseProjectInterface_Expecter) DeleteDatabaseBranch(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call { + return &MockDatabaseProjectInterface_DeleteDatabaseBranch_Call{Call: _e.mock.On("DeleteDatabaseBranch", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call) Run(run func(ctx context.Context, request database.DeleteDatabaseBranchRequest)) *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.DeleteDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call) Return(_a0 error) *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call) RunAndReturn(run func(context.Context, database.DeleteDatabaseBranchRequest) error) *MockDatabaseProjectInterface_DeleteDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) DeleteDatabaseEndpoint(ctx context.Context, request database.DeleteDatabaseEndpointRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteDatabaseEndpoint") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, database.DeleteDatabaseEndpointRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseEndpoint' +type MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call struct { + *mock.Call +} + +// DeleteDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request database.DeleteDatabaseEndpointRequest +func (_e *MockDatabaseProjectInterface_Expecter) DeleteDatabaseEndpoint(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call { + return &MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call{Call: _e.mock.On("DeleteDatabaseEndpoint", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call) Run(run func(ctx context.Context, request database.DeleteDatabaseEndpointRequest)) *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.DeleteDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call) Return(_a0 error) *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, database.DeleteDatabaseEndpointRequest) error) *MockDatabaseProjectInterface_DeleteDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) DeleteDatabaseProject(ctx context.Context, request database.DeleteDatabaseProjectRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteDatabaseProject") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, database.DeleteDatabaseProjectRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockDatabaseProjectInterface_DeleteDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseProject' +type MockDatabaseProjectInterface_DeleteDatabaseProject_Call struct { + *mock.Call +} + +// DeleteDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request database.DeleteDatabaseProjectRequest +func (_e *MockDatabaseProjectInterface_Expecter) DeleteDatabaseProject(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_DeleteDatabaseProject_Call { + return &MockDatabaseProjectInterface_DeleteDatabaseProject_Call{Call: _e.mock.On("DeleteDatabaseProject", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseProject_Call) Run(run func(ctx context.Context, request database.DeleteDatabaseProjectRequest)) *MockDatabaseProjectInterface_DeleteDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.DeleteDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseProject_Call) Return(_a0 error) *MockDatabaseProjectInterface_DeleteDatabaseProject_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_DeleteDatabaseProject_Call) RunAndReturn(run func(context.Context, database.DeleteDatabaseProjectRequest) error) *MockDatabaseProjectInterface_DeleteDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) GetDatabaseBranch(ctx context.Context, request database.GetDatabaseBranchRequest) (*database.DatabaseBranch, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDatabaseBranch") + } + + var r0 *database.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseBranchRequest) (*database.DatabaseBranch, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseBranchRequest) *database.DatabaseBranch); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.GetDatabaseBranchRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_GetDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseBranch' +type MockDatabaseProjectInterface_GetDatabaseBranch_Call struct { + *mock.Call +} + +// GetDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request database.GetDatabaseBranchRequest +func (_e *MockDatabaseProjectInterface_Expecter) GetDatabaseBranch(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_GetDatabaseBranch_Call { + return &MockDatabaseProjectInterface_GetDatabaseBranch_Call{Call: _e.mock.On("GetDatabaseBranch", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseBranch_Call) Run(run func(ctx context.Context, request database.GetDatabaseBranchRequest)) *MockDatabaseProjectInterface_GetDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.GetDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseBranch_Call) Return(_a0 *database.DatabaseBranch, _a1 error) *MockDatabaseProjectInterface_GetDatabaseBranch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseBranch_Call) RunAndReturn(run func(context.Context, database.GetDatabaseBranchRequest) (*database.DatabaseBranch, error)) *MockDatabaseProjectInterface_GetDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) GetDatabaseEndpoint(ctx context.Context, request database.GetDatabaseEndpointRequest) (*database.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDatabaseEndpoint") + } + + var r0 *database.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseEndpointRequest) *database.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.GetDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_GetDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseEndpoint' +type MockDatabaseProjectInterface_GetDatabaseEndpoint_Call struct { + *mock.Call +} + +// GetDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request database.GetDatabaseEndpointRequest +func (_e *MockDatabaseProjectInterface_Expecter) GetDatabaseEndpoint(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call { + return &MockDatabaseProjectInterface_GetDatabaseEndpoint_Call{Call: _e.mock.On("GetDatabaseEndpoint", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call) Run(run func(ctx context.Context, request database.GetDatabaseEndpointRequest)) *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.GetDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call) Return(_a0 *database.DatabaseEndpoint, _a1 error) *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, database.GetDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)) *MockDatabaseProjectInterface_GetDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) GetDatabaseProject(ctx context.Context, request database.GetDatabaseProjectRequest) (*database.DatabaseProject, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDatabaseProject") + } + + var r0 *database.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseProjectRequest) (*database.DatabaseProject, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.GetDatabaseProjectRequest) *database.DatabaseProject); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.GetDatabaseProjectRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_GetDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseProject' +type MockDatabaseProjectInterface_GetDatabaseProject_Call struct { + *mock.Call +} + +// GetDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request database.GetDatabaseProjectRequest +func (_e *MockDatabaseProjectInterface_Expecter) GetDatabaseProject(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_GetDatabaseProject_Call { + return &MockDatabaseProjectInterface_GetDatabaseProject_Call{Call: _e.mock.On("GetDatabaseProject", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseProject_Call) Run(run func(ctx context.Context, request database.GetDatabaseProjectRequest)) *MockDatabaseProjectInterface_GetDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.GetDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseProject_Call) Return(_a0 *database.DatabaseProject, _a1 error) *MockDatabaseProjectInterface_GetDatabaseProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_GetDatabaseProject_Call) RunAndReturn(run func(context.Context, database.GetDatabaseProjectRequest) (*database.DatabaseProject, error)) *MockDatabaseProjectInterface_GetDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseBranches provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseBranches(ctx context.Context, request database.ListDatabaseBranchesRequest) listing.Iterator[database.DatabaseBranch] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseBranches") + } + + var r0 listing.Iterator[database.DatabaseBranch] + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseBranchesRequest) listing.Iterator[database.DatabaseBranch]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[database.DatabaseBranch]) + } + } + + return r0 +} + +// MockDatabaseProjectInterface_ListDatabaseBranches_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseBranches' +type MockDatabaseProjectInterface_ListDatabaseBranches_Call struct { + *mock.Call +} + +// ListDatabaseBranches is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseBranchesRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseBranches(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseBranches_Call { + return &MockDatabaseProjectInterface_ListDatabaseBranches_Call{Call: _e.mock.On("ListDatabaseBranches", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranches_Call) Run(run func(ctx context.Context, request database.ListDatabaseBranchesRequest)) *MockDatabaseProjectInterface_ListDatabaseBranches_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseBranchesRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranches_Call) Return(_a0 listing.Iterator[database.DatabaseBranch]) *MockDatabaseProjectInterface_ListDatabaseBranches_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranches_Call) RunAndReturn(run func(context.Context, database.ListDatabaseBranchesRequest) listing.Iterator[database.DatabaseBranch]) *MockDatabaseProjectInterface_ListDatabaseBranches_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseBranchesAll provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseBranchesAll(ctx context.Context, request database.ListDatabaseBranchesRequest) ([]database.DatabaseBranch, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseBranchesAll") + } + + var r0 []database.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseBranchesRequest) ([]database.DatabaseBranch, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseBranchesRequest) []database.DatabaseBranch); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]database.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.ListDatabaseBranchesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseBranchesAll' +type MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call struct { + *mock.Call +} + +// ListDatabaseBranchesAll is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseBranchesRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseBranchesAll(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call { + return &MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call{Call: _e.mock.On("ListDatabaseBranchesAll", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call) Run(run func(ctx context.Context, request database.ListDatabaseBranchesRequest)) *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseBranchesRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call) Return(_a0 []database.DatabaseBranch, _a1 error) *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call) RunAndReturn(run func(context.Context, database.ListDatabaseBranchesRequest) ([]database.DatabaseBranch, error)) *MockDatabaseProjectInterface_ListDatabaseBranchesAll_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseEndpoints provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseEndpoints(ctx context.Context, request database.ListDatabaseEndpointsRequest) listing.Iterator[database.DatabaseEndpoint] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseEndpoints") + } + + var r0 listing.Iterator[database.DatabaseEndpoint] + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseEndpointsRequest) listing.Iterator[database.DatabaseEndpoint]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[database.DatabaseEndpoint]) + } + } + + return r0 +} + +// MockDatabaseProjectInterface_ListDatabaseEndpoints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseEndpoints' +type MockDatabaseProjectInterface_ListDatabaseEndpoints_Call struct { + *mock.Call +} + +// ListDatabaseEndpoints is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseEndpointsRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseEndpoints(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call { + return &MockDatabaseProjectInterface_ListDatabaseEndpoints_Call{Call: _e.mock.On("ListDatabaseEndpoints", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call) Run(run func(ctx context.Context, request database.ListDatabaseEndpointsRequest)) *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseEndpointsRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call) Return(_a0 listing.Iterator[database.DatabaseEndpoint]) *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call) RunAndReturn(run func(context.Context, database.ListDatabaseEndpointsRequest) listing.Iterator[database.DatabaseEndpoint]) *MockDatabaseProjectInterface_ListDatabaseEndpoints_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseEndpointsAll provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseEndpointsAll(ctx context.Context, request database.ListDatabaseEndpointsRequest) ([]database.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseEndpointsAll") + } + + var r0 []database.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseEndpointsRequest) ([]database.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseEndpointsRequest) []database.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]database.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.ListDatabaseEndpointsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseEndpointsAll' +type MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call struct { + *mock.Call +} + +// ListDatabaseEndpointsAll is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseEndpointsRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseEndpointsAll(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call { + return &MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call{Call: _e.mock.On("ListDatabaseEndpointsAll", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call) Run(run func(ctx context.Context, request database.ListDatabaseEndpointsRequest)) *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseEndpointsRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call) Return(_a0 []database.DatabaseEndpoint, _a1 error) *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call) RunAndReturn(run func(context.Context, database.ListDatabaseEndpointsRequest) ([]database.DatabaseEndpoint, error)) *MockDatabaseProjectInterface_ListDatabaseEndpointsAll_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseProjects provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseProjects(ctx context.Context, request database.ListDatabaseProjectsRequest) listing.Iterator[database.DatabaseProject] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseProjects") + } + + var r0 listing.Iterator[database.DatabaseProject] + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseProjectsRequest) listing.Iterator[database.DatabaseProject]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[database.DatabaseProject]) + } + } + + return r0 +} + +// MockDatabaseProjectInterface_ListDatabaseProjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseProjects' +type MockDatabaseProjectInterface_ListDatabaseProjects_Call struct { + *mock.Call +} + +// ListDatabaseProjects is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseProjectsRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseProjects(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseProjects_Call { + return &MockDatabaseProjectInterface_ListDatabaseProjects_Call{Call: _e.mock.On("ListDatabaseProjects", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjects_Call) Run(run func(ctx context.Context, request database.ListDatabaseProjectsRequest)) *MockDatabaseProjectInterface_ListDatabaseProjects_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseProjectsRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjects_Call) Return(_a0 listing.Iterator[database.DatabaseProject]) *MockDatabaseProjectInterface_ListDatabaseProjects_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjects_Call) RunAndReturn(run func(context.Context, database.ListDatabaseProjectsRequest) listing.Iterator[database.DatabaseProject]) *MockDatabaseProjectInterface_ListDatabaseProjects_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseProjectsAll provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) ListDatabaseProjectsAll(ctx context.Context, request database.ListDatabaseProjectsRequest) ([]database.DatabaseProject, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseProjectsAll") + } + + var r0 []database.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseProjectsRequest) ([]database.DatabaseProject, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.ListDatabaseProjectsRequest) []database.DatabaseProject); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]database.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.ListDatabaseProjectsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseProjectsAll' +type MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call struct { + *mock.Call +} + +// ListDatabaseProjectsAll is a helper method to define mock.On call +// - ctx context.Context +// - request database.ListDatabaseProjectsRequest +func (_e *MockDatabaseProjectInterface_Expecter) ListDatabaseProjectsAll(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call { + return &MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call{Call: _e.mock.On("ListDatabaseProjectsAll", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call) Run(run func(ctx context.Context, request database.ListDatabaseProjectsRequest)) *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.ListDatabaseProjectsRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call) Return(_a0 []database.DatabaseProject, _a1 error) *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call) RunAndReturn(run func(context.Context, database.ListDatabaseProjectsRequest) ([]database.DatabaseProject, error)) *MockDatabaseProjectInterface_ListDatabaseProjectsAll_Call { + _c.Call.Return(run) + return _c +} + +// RestartDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) RestartDatabaseEndpoint(ctx context.Context, request database.RestartDatabaseEndpointRequest) (*database.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for RestartDatabaseEndpoint") + } + + var r0 *database.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.RestartDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.RestartDatabaseEndpointRequest) *database.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.RestartDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RestartDatabaseEndpoint' +type MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call struct { + *mock.Call +} + +// RestartDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request database.RestartDatabaseEndpointRequest +func (_e *MockDatabaseProjectInterface_Expecter) RestartDatabaseEndpoint(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call { + return &MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call{Call: _e.mock.On("RestartDatabaseEndpoint", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call) Run(run func(ctx context.Context, request database.RestartDatabaseEndpointRequest)) *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.RestartDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call) Return(_a0 *database.DatabaseEndpoint, _a1 error) *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, database.RestartDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)) *MockDatabaseProjectInterface_RestartDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) UpdateDatabaseBranch(ctx context.Context, request database.UpdateDatabaseBranchRequest) (*database.DatabaseBranch, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseBranch") + } + + var r0 *database.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseBranchRequest) (*database.DatabaseBranch, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseBranchRequest) *database.DatabaseBranch); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.UpdateDatabaseBranchRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_UpdateDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseBranch' +type MockDatabaseProjectInterface_UpdateDatabaseBranch_Call struct { + *mock.Call +} + +// UpdateDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request database.UpdateDatabaseBranchRequest +func (_e *MockDatabaseProjectInterface_Expecter) UpdateDatabaseBranch(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call { + return &MockDatabaseProjectInterface_UpdateDatabaseBranch_Call{Call: _e.mock.On("UpdateDatabaseBranch", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call) Run(run func(ctx context.Context, request database.UpdateDatabaseBranchRequest)) *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.UpdateDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call) Return(_a0 *database.DatabaseBranch, _a1 error) *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call) RunAndReturn(run func(context.Context, database.UpdateDatabaseBranchRequest) (*database.DatabaseBranch, error)) *MockDatabaseProjectInterface_UpdateDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) UpdateDatabaseEndpoint(ctx context.Context, request database.UpdateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseEndpoint") + } + + var r0 *database.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseEndpointRequest) *database.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.UpdateDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseEndpoint' +type MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call struct { + *mock.Call +} + +// UpdateDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request database.UpdateDatabaseEndpointRequest +func (_e *MockDatabaseProjectInterface_Expecter) UpdateDatabaseEndpoint(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call { + return &MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call{Call: _e.mock.On("UpdateDatabaseEndpoint", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call) Run(run func(ctx context.Context, request database.UpdateDatabaseEndpointRequest)) *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.UpdateDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call) Return(_a0 *database.DatabaseEndpoint, _a1 error) *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, database.UpdateDatabaseEndpointRequest) (*database.DatabaseEndpoint, error)) *MockDatabaseProjectInterface_UpdateDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockDatabaseProjectInterface) UpdateDatabaseProject(ctx context.Context, request database.UpdateDatabaseProjectRequest) (*database.DatabaseProject, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseProject") + } + + var r0 *database.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseProjectRequest) (*database.DatabaseProject, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, database.UpdateDatabaseProjectRequest) *database.DatabaseProject); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*database.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, database.UpdateDatabaseProjectRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDatabaseProjectInterface_UpdateDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseProject' +type MockDatabaseProjectInterface_UpdateDatabaseProject_Call struct { + *mock.Call +} + +// UpdateDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request database.UpdateDatabaseProjectRequest +func (_e *MockDatabaseProjectInterface_Expecter) UpdateDatabaseProject(ctx interface{}, request interface{}) *MockDatabaseProjectInterface_UpdateDatabaseProject_Call { + return &MockDatabaseProjectInterface_UpdateDatabaseProject_Call{Call: _e.mock.On("UpdateDatabaseProject", ctx, request)} +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseProject_Call) Run(run func(ctx context.Context, request database.UpdateDatabaseProjectRequest)) *MockDatabaseProjectInterface_UpdateDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(database.UpdateDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseProject_Call) Return(_a0 *database.DatabaseProject, _a1 error) *MockDatabaseProjectInterface_UpdateDatabaseProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDatabaseProjectInterface_UpdateDatabaseProject_Call) RunAndReturn(run func(context.Context, database.UpdateDatabaseProjectRequest) (*database.DatabaseProject, error)) *MockDatabaseProjectInterface_UpdateDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// NewMockDatabaseProjectInterface creates a new instance of MockDatabaseProjectInterface. 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 NewMockDatabaseProjectInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockDatabaseProjectInterface { + mock := &MockDatabaseProjectInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/iamv2/mock_account_iam_v2_interface.go b/experimental/mocks/service/iamv2/mock_account_iam_v2_interface.go index 7cff9c711..7f850afd0 100644 --- a/experimental/mocks/service/iamv2/mock_account_iam_v2_interface.go +++ b/experimental/mocks/service/iamv2/mock_account_iam_v2_interface.go @@ -22,28 +22,806 @@ func (_m *MockAccountIamV2Interface) EXPECT() *MockAccountIamV2Interface_Expecte return &MockAccountIamV2Interface_Expecter{mock: &_m.Mock} } +// CreateGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateGroup(ctx context.Context, request iamv2.CreateGroupRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateGroup") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGroup' +type MockAccountIamV2Interface_CreateGroup_Call struct { + *mock.Call +} + +// CreateGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateGroup_Call { + return &MockAccountIamV2Interface_CreateGroup_Call{Call: _e.mock.On("CreateGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateGroup_Call) Run(run func(ctx context.Context, request iamv2.CreateGroupRequest)) *MockAccountIamV2Interface_CreateGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateGroup_Call) Return(_a0 *iamv2.Group, _a1 error) *MockAccountIamV2Interface_CreateGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateGroup_Call) RunAndReturn(run func(context.Context, iamv2.CreateGroupRequest) (*iamv2.Group, error)) *MockAccountIamV2Interface_CreateGroup_Call { + _c.Call.Return(run) + return _c +} + +// CreateServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateServicePrincipal(ctx context.Context, request iamv2.CreateServicePrincipalRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateServicePrincipal") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateServicePrincipal' +type MockAccountIamV2Interface_CreateServicePrincipal_Call struct { + *mock.Call +} + +// CreateServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + return &MockAccountIamV2Interface_CreateServicePrincipal_Call{Call: _e.mock.On("CreateServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.CreateServicePrincipalRequest)) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateServicePrincipal_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.CreateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// CreateUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateUser(ctx context.Context, request iamv2.CreateUserRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateUser") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUser' +type MockAccountIamV2Interface_CreateUser_Call struct { + *mock.Call +} + +// CreateUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateUserRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateUser_Call { + return &MockAccountIamV2Interface_CreateUser_Call{Call: _e.mock.On("CreateUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateUser_Call) Run(run func(ctx context.Context, request iamv2.CreateUserRequest)) *MockAccountIamV2Interface_CreateUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateUser_Call) Return(_a0 *iamv2.User, _a1 error) *MockAccountIamV2Interface_CreateUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateUser_Call) RunAndReturn(run func(context.Context, iamv2.CreateUserRequest) (*iamv2.User, error)) *MockAccountIamV2Interface_CreateUser_Call { + _c.Call.Return(run) + return _c +} + +// CreateWorkspaceAccessDetail provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateWorkspaceAccessDetail(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateWorkspaceAccessDetail") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateWorkspaceAccessDetail' +type MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// CreateWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call{Call: _e.mock.On("CreateWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + +// DeleteGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteGroup(ctx context.Context, request iamv2.DeleteGroupRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteGroup") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteGroupRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGroup' +type MockAccountIamV2Interface_DeleteGroup_Call struct { + *mock.Call +} + +// DeleteGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteGroup_Call { + return &MockAccountIamV2Interface_DeleteGroup_Call{Call: _e.mock.On("DeleteGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteGroup_Call) Run(run func(ctx context.Context, request iamv2.DeleteGroupRequest)) *MockAccountIamV2Interface_DeleteGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteGroup_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteGroup_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteGroup_Call) RunAndReturn(run func(context.Context, iamv2.DeleteGroupRequest) error) *MockAccountIamV2Interface_DeleteGroup_Call { + _c.Call.Return(run) + return _c +} + +// DeleteServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteServicePrincipal(ctx context.Context, request iamv2.DeleteServicePrincipalRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteServicePrincipal") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteServicePrincipalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteServicePrincipal' +type MockAccountIamV2Interface_DeleteServicePrincipal_Call struct { + *mock.Call +} + +// DeleteServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + return &MockAccountIamV2Interface_DeleteServicePrincipal_Call{Call: _e.mock.On("DeleteServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.DeleteServicePrincipalRequest)) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteServicePrincipal_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.DeleteServicePrincipalRequest) error) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// DeleteUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteUser(ctx context.Context, request iamv2.DeleteUserRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteUser") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteUserRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUser' +type MockAccountIamV2Interface_DeleteUser_Call struct { + *mock.Call +} + +// DeleteUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteUserRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteUser_Call { + return &MockAccountIamV2Interface_DeleteUser_Call{Call: _e.mock.On("DeleteUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteUser_Call) Run(run func(ctx context.Context, request iamv2.DeleteUserRequest)) *MockAccountIamV2Interface_DeleteUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteUser_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteUser_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteUser_Call) RunAndReturn(run func(context.Context, iamv2.DeleteUserRequest) error) *MockAccountIamV2Interface_DeleteUser_Call { + _c.Call.Return(run) + return _c +} + +// DeleteWorkspaceAccessDetail provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteWorkspaceAccessDetail(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteWorkspaceAccessDetail") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteWorkspaceAccessDetailRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteWorkspaceAccessDetail' +type MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// DeleteWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call{Call: _e.mock.On("DeleteWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.DeleteWorkspaceAccessDetailRequest) error) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + +// GetGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) GetGroup(ctx context.Context, request iamv2.GetGroupRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetGroup") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroup' +type MockAccountIamV2Interface_GetGroup_Call struct { + *mock.Call +} + +// GetGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) GetGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetGroup_Call { + return &MockAccountIamV2Interface_GetGroup_Call{Call: _e.mock.On("GetGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetGroup_Call) Run(run func(ctx context.Context, request iamv2.GetGroupRequest)) *MockAccountIamV2Interface_GetGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetGroup_Call) Return(_a0 *iamv2.Group, _a1 error) *MockAccountIamV2Interface_GetGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetGroup_Call) RunAndReturn(run func(context.Context, iamv2.GetGroupRequest) (*iamv2.Group, error)) *MockAccountIamV2Interface_GetGroup_Call { + _c.Call.Return(run) + return _c +} + +// GetServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) GetServicePrincipal(ctx context.Context, request iamv2.GetServicePrincipalRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetServicePrincipal") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetServicePrincipal' +type MockAccountIamV2Interface_GetServicePrincipal_Call struct { + *mock.Call +} + +// GetServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) GetServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetServicePrincipal_Call { + return &MockAccountIamV2Interface_GetServicePrincipal_Call{Call: _e.mock.On("GetServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.GetServicePrincipalRequest)) *MockAccountIamV2Interface_GetServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetServicePrincipal_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockAccountIamV2Interface_GetServicePrincipal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.GetServicePrincipalRequest) (*iamv2.ServicePrincipal, error)) *MockAccountIamV2Interface_GetServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// GetUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) GetUser(ctx context.Context, request iamv2.GetUserRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetUser") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUser' +type MockAccountIamV2Interface_GetUser_Call struct { + *mock.Call +} + +// GetUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetUserRequest +func (_e *MockAccountIamV2Interface_Expecter) GetUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetUser_Call { + return &MockAccountIamV2Interface_GetUser_Call{Call: _e.mock.On("GetUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetUser_Call) Run(run func(ctx context.Context, request iamv2.GetUserRequest)) *MockAccountIamV2Interface_GetUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetUser_Call) Return(_a0 *iamv2.User, _a1 error) *MockAccountIamV2Interface_GetUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetUser_Call) RunAndReturn(run func(context.Context, iamv2.GetUserRequest) (*iamv2.User, error)) *MockAccountIamV2Interface_GetUser_Call { + _c.Call.Return(run) + return _c +} + // GetWorkspaceAccessDetail provides a mock function with given fields: ctx, request func (_m *MockAccountIamV2Interface) GetWorkspaceAccessDetail(ctx context.Context, request iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error) { ret := _m.Called(ctx, request) if len(ret) == 0 { - panic("no return value specified for GetWorkspaceAccessDetail") + panic("no return value specified for GetWorkspaceAccessDetail") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceAccessDetail' +type MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// GetWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) GetWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call{Call: _e.mock.On("GetWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.GetWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + +// ListGroups provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListGroups(ctx context.Context, request iamv2.ListGroupsRequest) (*iamv2.ListGroupsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListGroups") + } + + var r0 *iamv2.ListGroupsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsRequest) (*iamv2.ListGroupsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsRequest) *iamv2.ListGroupsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListGroupsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListGroupsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ListGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGroups' +type MockAccountIamV2Interface_ListGroups_Call struct { + *mock.Call +} + +// ListGroups is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListGroupsRequest +func (_e *MockAccountIamV2Interface_Expecter) ListGroups(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListGroups_Call { + return &MockAccountIamV2Interface_ListGroups_Call{Call: _e.mock.On("ListGroups", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ListGroups_Call) Run(run func(ctx context.Context, request iamv2.ListGroupsRequest)) *MockAccountIamV2Interface_ListGroups_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListGroupsRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ListGroups_Call) Return(_a0 *iamv2.ListGroupsResponse, _a1 error) *MockAccountIamV2Interface_ListGroups_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ListGroups_Call) RunAndReturn(run func(context.Context, iamv2.ListGroupsRequest) (*iamv2.ListGroupsResponse, error)) *MockAccountIamV2Interface_ListGroups_Call { + _c.Call.Return(run) + return _c +} + +// ListServicePrincipals provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListServicePrincipals(ctx context.Context, request iamv2.ListServicePrincipalsRequest) (*iamv2.ListServicePrincipalsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListServicePrincipals") + } + + var r0 *iamv2.ListServicePrincipalsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsRequest) (*iamv2.ListServicePrincipalsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsRequest) *iamv2.ListServicePrincipalsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListServicePrincipalsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListServicePrincipalsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ListServicePrincipals_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListServicePrincipals' +type MockAccountIamV2Interface_ListServicePrincipals_Call struct { + *mock.Call +} + +// ListServicePrincipals is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListServicePrincipalsRequest +func (_e *MockAccountIamV2Interface_Expecter) ListServicePrincipals(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListServicePrincipals_Call { + return &MockAccountIamV2Interface_ListServicePrincipals_Call{Call: _e.mock.On("ListServicePrincipals", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ListServicePrincipals_Call) Run(run func(ctx context.Context, request iamv2.ListServicePrincipalsRequest)) *MockAccountIamV2Interface_ListServicePrincipals_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListServicePrincipalsRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ListServicePrincipals_Call) Return(_a0 *iamv2.ListServicePrincipalsResponse, _a1 error) *MockAccountIamV2Interface_ListServicePrincipals_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ListServicePrincipals_Call) RunAndReturn(run func(context.Context, iamv2.ListServicePrincipalsRequest) (*iamv2.ListServicePrincipalsResponse, error)) *MockAccountIamV2Interface_ListServicePrincipals_Call { + _c.Call.Return(run) + return _c +} + +// ListUsers provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListUsers(ctx context.Context, request iamv2.ListUsersRequest) (*iamv2.ListUsersResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListUsers") } - var r0 *iamv2.WorkspaceAccessDetail + var r0 *iamv2.ListUsersResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersRequest) (*iamv2.ListUsersResponse, error)); ok { return rf(ctx, request) } - if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersRequest) *iamv2.ListUsersResponse); ok { r0 = rf(ctx, request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + r0 = ret.Get(0).(*iamv2.ListUsersResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListUsersRequest) error); ok { r1 = rf(ctx, request) } else { r1 = ret.Error(1) @@ -52,31 +830,90 @@ func (_m *MockAccountIamV2Interface) GetWorkspaceAccessDetail(ctx context.Contex return r0, r1 } -// MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceAccessDetail' -type MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call struct { +// MockAccountIamV2Interface_ListUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUsers' +type MockAccountIamV2Interface_ListUsers_Call struct { *mock.Call } -// GetWorkspaceAccessDetail is a helper method to define mock.On call +// ListUsers is a helper method to define mock.On call // - ctx context.Context -// - request iamv2.GetWorkspaceAccessDetailRequest -func (_e *MockAccountIamV2Interface_Expecter) GetWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { - return &MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call{Call: _e.mock.On("GetWorkspaceAccessDetail", ctx, request)} +// - request iamv2.ListUsersRequest +func (_e *MockAccountIamV2Interface_Expecter) ListUsers(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListUsers_Call { + return &MockAccountIamV2Interface_ListUsers_Call{Call: _e.mock.On("ListUsers", ctx, request)} } -func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.GetWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { +func (_c *MockAccountIamV2Interface_ListUsers_Call) Run(run func(ctx context.Context, request iamv2.ListUsersRequest)) *MockAccountIamV2Interface_ListUsers_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(iamv2.GetWorkspaceAccessDetailRequest)) + run(args[0].(context.Context), args[1].(iamv2.ListUsersRequest)) }) return _c } -func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { +func (_c *MockAccountIamV2Interface_ListUsers_Call) Return(_a0 *iamv2.ListUsersResponse, _a1 error) *MockAccountIamV2Interface_ListUsers_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { +func (_c *MockAccountIamV2Interface_ListUsers_Call) RunAndReturn(run func(context.Context, iamv2.ListUsersRequest) (*iamv2.ListUsersResponse, error)) *MockAccountIamV2Interface_ListUsers_Call { + _c.Call.Return(run) + return _c +} + +// ListWorkspaceAccessDetails provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListWorkspaceAccessDetails(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListWorkspaceAccessDetails") + } + + var r0 *iamv2.ListWorkspaceAccessDetailsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) *iamv2.ListWorkspaceAccessDetailsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListWorkspaceAccessDetailsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspaceAccessDetails' +type MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call struct { + *mock.Call +} + +// ListWorkspaceAccessDetails is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListWorkspaceAccessDetailsRequest +func (_e *MockAccountIamV2Interface_Expecter) ListWorkspaceAccessDetails(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { + return &MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call{Call: _e.mock.On("ListWorkspaceAccessDetails", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call) Run(run func(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsRequest)) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListWorkspaceAccessDetailsRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call) Return(_a0 *iamv2.ListWorkspaceAccessDetailsResponse, _a1 error) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call) RunAndReturn(run func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { _c.Call.Return(run) return _c } @@ -258,6 +1095,242 @@ func (_c *MockAccountIamV2Interface_ResolveUser_Call) RunAndReturn(run func(cont return _c } +// UpdateGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateGroup(ctx context.Context, request iamv2.UpdateGroupRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateGroup") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroup' +type MockAccountIamV2Interface_UpdateGroup_Call struct { + *mock.Call +} + +// UpdateGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateGroup_Call { + return &MockAccountIamV2Interface_UpdateGroup_Call{Call: _e.mock.On("UpdateGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateGroup_Call) Run(run func(ctx context.Context, request iamv2.UpdateGroupRequest)) *MockAccountIamV2Interface_UpdateGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateGroup_Call) Return(_a0 *iamv2.Group, _a1 error) *MockAccountIamV2Interface_UpdateGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateGroup_Call) RunAndReturn(run func(context.Context, iamv2.UpdateGroupRequest) (*iamv2.Group, error)) *MockAccountIamV2Interface_UpdateGroup_Call { + _c.Call.Return(run) + return _c +} + +// UpdateServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateServicePrincipal(ctx context.Context, request iamv2.UpdateServicePrincipalRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateServicePrincipal") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateServicePrincipal' +type MockAccountIamV2Interface_UpdateServicePrincipal_Call struct { + *mock.Call +} + +// UpdateServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + return &MockAccountIamV2Interface_UpdateServicePrincipal_Call{Call: _e.mock.On("UpdateServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.UpdateServicePrincipalRequest)) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateServicePrincipal_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.UpdateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// UpdateUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateUser(ctx context.Context, request iamv2.UpdateUserRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateUser") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUser' +type MockAccountIamV2Interface_UpdateUser_Call struct { + *mock.Call +} + +// UpdateUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateUserRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateUser_Call { + return &MockAccountIamV2Interface_UpdateUser_Call{Call: _e.mock.On("UpdateUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateUser_Call) Run(run func(ctx context.Context, request iamv2.UpdateUserRequest)) *MockAccountIamV2Interface_UpdateUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateUser_Call) Return(_a0 *iamv2.User, _a1 error) *MockAccountIamV2Interface_UpdateUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateUser_Call) RunAndReturn(run func(context.Context, iamv2.UpdateUserRequest) (*iamv2.User, error)) *MockAccountIamV2Interface_UpdateUser_Call { + _c.Call.Return(run) + return _c +} + +// UpdateWorkspaceAccessDetail provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateWorkspaceAccessDetail(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateWorkspaceAccessDetail") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateWorkspaceAccessDetail' +type MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// UpdateWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call{Call: _e.mock.On("UpdateWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + // NewMockAccountIamV2Interface creates a new instance of MockAccountIamV2Interface. 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 NewMockAccountIamV2Interface(t interface { diff --git a/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go b/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go index 4cdf0af8a..a696d842a 100644 --- a/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go +++ b/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go @@ -22,28 +22,806 @@ func (_m *MockWorkspaceIamV2Interface) EXPECT() *MockWorkspaceIamV2Interface_Exp return &MockWorkspaceIamV2Interface_Expecter{mock: &_m.Mock} } +// CreateGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateGroupProxy(ctx context.Context, request iamv2.CreateGroupProxyRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateGroupProxy") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupProxyRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupProxyRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateGroupProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGroupProxy' +type MockWorkspaceIamV2Interface_CreateGroupProxy_Call struct { + *mock.Call +} + +// CreateGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + return &MockWorkspaceIamV2Interface_CreateGroupProxy_Call{Call: _e.mock.On("CreateGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.CreateGroupProxyRequest)) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateGroupProxy_Call) Return(_a0 *iamv2.Group, _a1 error) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.CreateGroupProxyRequest) (*iamv2.Group, error)) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// CreateServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateServicePrincipalProxy(ctx context.Context, request iamv2.CreateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateServicePrincipalProxy") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalProxyRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateServicePrincipalProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateServicePrincipalProxy' +type MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call struct { + *mock.Call +} + +// CreateServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call{Call: _e.mock.On("CreateServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.CreateServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.CreateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// CreateUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateUserProxy(ctx context.Context, request iamv2.CreateUserProxyRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateUserProxy") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserProxyRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserProxyRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateUserProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUserProxy' +type MockWorkspaceIamV2Interface_CreateUserProxy_Call struct { + *mock.Call +} + +// CreateUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + return &MockWorkspaceIamV2Interface_CreateUserProxy_Call{Call: _e.mock.On("CreateUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateUserProxy_Call) Run(run func(ctx context.Context, request iamv2.CreateUserProxyRequest)) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateUserProxy_Call) Return(_a0 *iamv2.User, _a1 error) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.CreateUserProxyRequest) (*iamv2.User, error)) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// CreateWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateWorkspaceAccessDetailLocal") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// CreateWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("CreateWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + +// DeleteGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteGroupProxy(ctx context.Context, request iamv2.DeleteGroupProxyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteGroupProxy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteGroupProxyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGroupProxy' +type MockWorkspaceIamV2Interface_DeleteGroupProxy_Call struct { + *mock.Call +} + +// DeleteGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + return &MockWorkspaceIamV2Interface_DeleteGroupProxy_Call{Call: _e.mock.On("DeleteGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.DeleteGroupProxyRequest)) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.DeleteGroupProxyRequest) error) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteServicePrincipalProxy(ctx context.Context, request iamv2.DeleteServicePrincipalProxyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteServicePrincipalProxy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteServicePrincipalProxyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteServicePrincipalProxy' +type MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call struct { + *mock.Call +} + +// DeleteServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call{Call: _e.mock.On("DeleteServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.DeleteServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.DeleteServicePrincipalProxyRequest) error) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteUserProxy(ctx context.Context, request iamv2.DeleteUserProxyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteUserProxy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteUserProxyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUserProxy' +type MockWorkspaceIamV2Interface_DeleteUserProxy_Call struct { + *mock.Call +} + +// DeleteUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + return &MockWorkspaceIamV2Interface_DeleteUserProxy_Call{Call: _e.mock.On("DeleteUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteUserProxy_Call) Run(run func(ctx context.Context, request iamv2.DeleteUserProxyRequest)) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteUserProxy_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.DeleteUserProxyRequest) error) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailLocalRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteWorkspaceAccessDetailLocal") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteWorkspaceAccessDetailLocalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// DeleteWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("DeleteWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.DeleteWorkspaceAccessDetailLocalRequest) error) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + +// GetGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) GetGroupProxy(ctx context.Context, request iamv2.GetGroupProxyRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetGroupProxy") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupProxyRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupProxyRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetGroupProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroupProxy' +type MockWorkspaceIamV2Interface_GetGroupProxy_Call struct { + *mock.Call +} + +// GetGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + return &MockWorkspaceIamV2Interface_GetGroupProxy_Call{Call: _e.mock.On("GetGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.GetGroupProxyRequest)) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetGroupProxy_Call) Return(_a0 *iamv2.Group, _a1 error) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.GetGroupProxyRequest) (*iamv2.Group, error)) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// GetServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) GetServicePrincipalProxy(ctx context.Context, request iamv2.GetServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetServicePrincipalProxy") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalProxyRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetServicePrincipalProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetServicePrincipalProxy' +type MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call struct { + *mock.Call +} + +// GetServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call{Call: _e.mock.On("GetServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.GetServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.GetServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// GetUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) GetUserProxy(ctx context.Context, request iamv2.GetUserProxyRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetUserProxy") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserProxyRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserProxyRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetUserProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUserProxy' +type MockWorkspaceIamV2Interface_GetUserProxy_Call struct { + *mock.Call +} + +// GetUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + return &MockWorkspaceIamV2Interface_GetUserProxy_Call{Call: _e.mock.On("GetUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetUserProxy_Call) Run(run func(ctx context.Context, request iamv2.GetUserProxyRequest)) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetUserProxy_Call) Return(_a0 *iamv2.User, _a1 error) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.GetUserProxyRequest) (*iamv2.User, error)) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + _c.Call.Return(run) + return _c +} + // GetWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request func (_m *MockWorkspaceIamV2Interface) GetWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error) { ret := _m.Called(ctx, request) if len(ret) == 0 { - panic("no return value specified for GetWorkspaceAccessDetailLocal") + panic("no return value specified for GetWorkspaceAccessDetailLocal") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// GetWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("GetWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.GetWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + +// ListGroupsProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListGroupsProxy(ctx context.Context, request iamv2.ListGroupsProxyRequest) (*iamv2.ListGroupsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListGroupsProxy") + } + + var r0 *iamv2.ListGroupsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsProxyRequest) (*iamv2.ListGroupsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsProxyRequest) *iamv2.ListGroupsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListGroupsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListGroupsProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ListGroupsProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGroupsProxy' +type MockWorkspaceIamV2Interface_ListGroupsProxy_Call struct { + *mock.Call +} + +// ListGroupsProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListGroupsProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListGroupsProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + return &MockWorkspaceIamV2Interface_ListGroupsProxy_Call{Call: _e.mock.On("ListGroupsProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ListGroupsProxy_Call) Run(run func(ctx context.Context, request iamv2.ListGroupsProxyRequest)) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListGroupsProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListGroupsProxy_Call) Return(_a0 *iamv2.ListGroupsResponse, _a1 error) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListGroupsProxy_Call) RunAndReturn(run func(context.Context, iamv2.ListGroupsProxyRequest) (*iamv2.ListGroupsResponse, error)) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + _c.Call.Return(run) + return _c +} + +// ListServicePrincipalsProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListServicePrincipalsProxy(ctx context.Context, request iamv2.ListServicePrincipalsProxyRequest) (*iamv2.ListServicePrincipalsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListServicePrincipalsProxy") + } + + var r0 *iamv2.ListServicePrincipalsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsProxyRequest) (*iamv2.ListServicePrincipalsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsProxyRequest) *iamv2.ListServicePrincipalsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListServicePrincipalsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListServicePrincipalsProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListServicePrincipalsProxy' +type MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call struct { + *mock.Call +} + +// ListServicePrincipalsProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListServicePrincipalsProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListServicePrincipalsProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + return &MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call{Call: _e.mock.On("ListServicePrincipalsProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call) Run(run func(ctx context.Context, request iamv2.ListServicePrincipalsProxyRequest)) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListServicePrincipalsProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call) Return(_a0 *iamv2.ListServicePrincipalsResponse, _a1 error) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call) RunAndReturn(run func(context.Context, iamv2.ListServicePrincipalsProxyRequest) (*iamv2.ListServicePrincipalsResponse, error)) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + _c.Call.Return(run) + return _c +} + +// ListUsersProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListUsersProxy(ctx context.Context, request iamv2.ListUsersProxyRequest) (*iamv2.ListUsersResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListUsersProxy") } - var r0 *iamv2.WorkspaceAccessDetail + var r0 *iamv2.ListUsersResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersProxyRequest) (*iamv2.ListUsersResponse, error)); ok { return rf(ctx, request) } - if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersProxyRequest) *iamv2.ListUsersResponse); ok { r0 = rf(ctx, request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + r0 = ret.Get(0).(*iamv2.ListUsersResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListUsersProxyRequest) error); ok { r1 = rf(ctx, request) } else { r1 = ret.Error(1) @@ -52,31 +830,90 @@ func (_m *MockWorkspaceIamV2Interface) GetWorkspaceAccessDetailLocal(ctx context return r0, r1 } -// MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceAccessDetailLocal' -type MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call struct { +// MockWorkspaceIamV2Interface_ListUsersProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUsersProxy' +type MockWorkspaceIamV2Interface_ListUsersProxy_Call struct { *mock.Call } -// GetWorkspaceAccessDetailLocal is a helper method to define mock.On call +// ListUsersProxy is a helper method to define mock.On call // - ctx context.Context -// - request iamv2.GetWorkspaceAccessDetailLocalRequest -func (_e *MockWorkspaceIamV2Interface_Expecter) GetWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { - return &MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("GetWorkspaceAccessDetailLocal", ctx, request)} +// - request iamv2.ListUsersProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListUsersProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { + return &MockWorkspaceIamV2Interface_ListUsersProxy_Call{Call: _e.mock.On("ListUsersProxy", ctx, request)} } -func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.GetWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { +func (_c *MockWorkspaceIamV2Interface_ListUsersProxy_Call) Run(run func(ctx context.Context, request iamv2.ListUsersProxyRequest)) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(iamv2.GetWorkspaceAccessDetailLocalRequest)) + run(args[0].(context.Context), args[1].(iamv2.ListUsersProxyRequest)) }) return _c } -func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { +func (_c *MockWorkspaceIamV2Interface_ListUsersProxy_Call) Return(_a0 *iamv2.ListUsersResponse, _a1 error) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { +func (_c *MockWorkspaceIamV2Interface_ListUsersProxy_Call) RunAndReturn(run func(context.Context, iamv2.ListUsersProxyRequest) (*iamv2.ListUsersResponse, error)) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { + _c.Call.Return(run) + return _c +} + +// ListWorkspaceAccessDetailsLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListWorkspaceAccessDetailsLocal(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsLocalRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListWorkspaceAccessDetailsLocal") + } + + var r0 *iamv2.ListWorkspaceAccessDetailsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) *iamv2.ListWorkspaceAccessDetailsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListWorkspaceAccessDetailsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspaceAccessDetailsLocal' +type MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call struct { + *mock.Call +} + +// ListWorkspaceAccessDetailsLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListWorkspaceAccessDetailsLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListWorkspaceAccessDetailsLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { + return &MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call{Call: _e.mock.On("ListWorkspaceAccessDetailsLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call) Run(run func(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsLocalRequest)) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListWorkspaceAccessDetailsLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call) Return(_a0 *iamv2.ListWorkspaceAccessDetailsResponse, _a1 error) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call) RunAndReturn(run func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { _c.Call.Return(run) return _c } @@ -258,6 +1095,242 @@ func (_c *MockWorkspaceIamV2Interface_ResolveUserProxy_Call) RunAndReturn(run fu return _c } +// UpdateGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateGroupProxy(ctx context.Context, request iamv2.UpdateGroupProxyRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateGroupProxy") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupProxyRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupProxyRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateGroupProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroupProxy' +type MockWorkspaceIamV2Interface_UpdateGroupProxy_Call struct { + *mock.Call +} + +// UpdateGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + return &MockWorkspaceIamV2Interface_UpdateGroupProxy_Call{Call: _e.mock.On("UpdateGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.UpdateGroupProxyRequest)) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call) Return(_a0 *iamv2.Group, _a1 error) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.UpdateGroupProxyRequest) (*iamv2.Group, error)) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// UpdateServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateServicePrincipalProxy(ctx context.Context, request iamv2.UpdateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateServicePrincipalProxy") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateServicePrincipalProxy' +type MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call struct { + *mock.Call +} + +// UpdateServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call{Call: _e.mock.On("UpdateServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.UpdateServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// UpdateUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateUserProxy(ctx context.Context, request iamv2.UpdateUserProxyRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateUserProxy") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserProxyRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserProxyRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateUserProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUserProxy' +type MockWorkspaceIamV2Interface_UpdateUserProxy_Call struct { + *mock.Call +} + +// UpdateUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + return &MockWorkspaceIamV2Interface_UpdateUserProxy_Call{Call: _e.mock.On("UpdateUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateUserProxy_Call) Run(run func(ctx context.Context, request iamv2.UpdateUserProxyRequest)) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateUserProxy_Call) Return(_a0 *iamv2.User, _a1 error) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.UpdateUserProxyRequest) (*iamv2.User, error)) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// UpdateWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateWorkspaceAccessDetailLocal") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// UpdateWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("UpdateWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + // NewMockWorkspaceIamV2Interface creates a new instance of MockWorkspaceIamV2Interface. 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 NewMockWorkspaceIamV2Interface(t interface { diff --git a/experimental/mocks/service/ml/mock_experiments_interface.go b/experimental/mocks/service/ml/mock_experiments_interface.go index 20e4fce27..89a70eefa 100644 --- a/experimental/mocks/service/ml/mock_experiments_interface.go +++ b/experimental/mocks/service/ml/mock_experiments_interface.go @@ -993,6 +993,65 @@ func (_c *MockExperimentsInterface_GetLoggedModelByModelId_Call) RunAndReturn(ru return _c } +// GetLoggedModels provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) GetLoggedModels(ctx context.Context, request ml.GetLoggedModelsRequest) (*ml.GetLoggedModelsRequestResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetLoggedModels") + } + + var r0 *ml.GetLoggedModelsRequestResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.GetLoggedModelsRequest) (*ml.GetLoggedModelsRequestResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.GetLoggedModelsRequest) *ml.GetLoggedModelsRequestResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.GetLoggedModelsRequestResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.GetLoggedModelsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExperimentsInterface_GetLoggedModels_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLoggedModels' +type MockExperimentsInterface_GetLoggedModels_Call struct { + *mock.Call +} + +// GetLoggedModels is a helper method to define mock.On call +// - ctx context.Context +// - request ml.GetLoggedModelsRequest +func (_e *MockExperimentsInterface_Expecter) GetLoggedModels(ctx interface{}, request interface{}) *MockExperimentsInterface_GetLoggedModels_Call { + return &MockExperimentsInterface_GetLoggedModels_Call{Call: _e.mock.On("GetLoggedModels", ctx, request)} +} + +func (_c *MockExperimentsInterface_GetLoggedModels_Call) Run(run func(ctx context.Context, request ml.GetLoggedModelsRequest)) *MockExperimentsInterface_GetLoggedModels_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.GetLoggedModelsRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_GetLoggedModels_Call) Return(_a0 *ml.GetLoggedModelsRequestResponse, _a1 error) *MockExperimentsInterface_GetLoggedModels_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExperimentsInterface_GetLoggedModels_Call) RunAndReturn(run func(context.Context, ml.GetLoggedModelsRequest) (*ml.GetLoggedModelsRequestResponse, error)) *MockExperimentsInterface_GetLoggedModels_Call { + _c.Call.Return(run) + return _c +} + // GetPermissionLevels provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) GetPermissionLevels(ctx context.Context, request ml.GetExperimentPermissionLevelsRequest) (*ml.GetExperimentPermissionLevelsResponse, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/ml/mock_feature_engineering_interface.go b/experimental/mocks/service/ml/mock_feature_engineering_interface.go index aa2cc7bc1..478f94fff 100644 --- a/experimental/mocks/service/ml/mock_feature_engineering_interface.go +++ b/experimental/mocks/service/ml/mock_feature_engineering_interface.go @@ -83,6 +83,65 @@ func (_c *MockFeatureEngineeringInterface_CreateFeature_Call) RunAndReturn(run f return _c } +// CreateMaterializedFeature provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) CreateMaterializedFeature(ctx context.Context, request ml.CreateMaterializedFeatureRequest) (*ml.MaterializedFeature, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateMaterializedFeature") + } + + var r0 *ml.MaterializedFeature + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.CreateMaterializedFeatureRequest) (*ml.MaterializedFeature, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.CreateMaterializedFeatureRequest) *ml.MaterializedFeature); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.MaterializedFeature) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.CreateMaterializedFeatureRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockFeatureEngineeringInterface_CreateMaterializedFeature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateMaterializedFeature' +type MockFeatureEngineeringInterface_CreateMaterializedFeature_Call struct { + *mock.Call +} + +// CreateMaterializedFeature is a helper method to define mock.On call +// - ctx context.Context +// - request ml.CreateMaterializedFeatureRequest +func (_e *MockFeatureEngineeringInterface_Expecter) CreateMaterializedFeature(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_CreateMaterializedFeature_Call { + return &MockFeatureEngineeringInterface_CreateMaterializedFeature_Call{Call: _e.mock.On("CreateMaterializedFeature", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_CreateMaterializedFeature_Call) Run(run func(ctx context.Context, request ml.CreateMaterializedFeatureRequest)) *MockFeatureEngineeringInterface_CreateMaterializedFeature_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.CreateMaterializedFeatureRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_CreateMaterializedFeature_Call) Return(_a0 *ml.MaterializedFeature, _a1 error) *MockFeatureEngineeringInterface_CreateMaterializedFeature_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockFeatureEngineeringInterface_CreateMaterializedFeature_Call) RunAndReturn(run func(context.Context, ml.CreateMaterializedFeatureRequest) (*ml.MaterializedFeature, error)) *MockFeatureEngineeringInterface_CreateMaterializedFeature_Call { + _c.Call.Return(run) + return _c +} + // DeleteFeature provides a mock function with given fields: ctx, request func (_m *MockFeatureEngineeringInterface) DeleteFeature(ctx context.Context, request ml.DeleteFeatureRequest) error { ret := _m.Called(ctx, request) @@ -130,6 +189,53 @@ func (_c *MockFeatureEngineeringInterface_DeleteFeature_Call) RunAndReturn(run f return _c } +// DeleteMaterializedFeature provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) DeleteMaterializedFeature(ctx context.Context, request ml.DeleteMaterializedFeatureRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteMaterializedFeature") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, ml.DeleteMaterializedFeatureRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockFeatureEngineeringInterface_DeleteMaterializedFeature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteMaterializedFeature' +type MockFeatureEngineeringInterface_DeleteMaterializedFeature_Call struct { + *mock.Call +} + +// DeleteMaterializedFeature is a helper method to define mock.On call +// - ctx context.Context +// - request ml.DeleteMaterializedFeatureRequest +func (_e *MockFeatureEngineeringInterface_Expecter) DeleteMaterializedFeature(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_DeleteMaterializedFeature_Call { + return &MockFeatureEngineeringInterface_DeleteMaterializedFeature_Call{Call: _e.mock.On("DeleteMaterializedFeature", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_DeleteMaterializedFeature_Call) Run(run func(ctx context.Context, request ml.DeleteMaterializedFeatureRequest)) *MockFeatureEngineeringInterface_DeleteMaterializedFeature_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.DeleteMaterializedFeatureRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_DeleteMaterializedFeature_Call) Return(_a0 error) *MockFeatureEngineeringInterface_DeleteMaterializedFeature_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockFeatureEngineeringInterface_DeleteMaterializedFeature_Call) RunAndReturn(run func(context.Context, ml.DeleteMaterializedFeatureRequest) error) *MockFeatureEngineeringInterface_DeleteMaterializedFeature_Call { + _c.Call.Return(run) + return _c +} + // GetFeature provides a mock function with given fields: ctx, request func (_m *MockFeatureEngineeringInterface) GetFeature(ctx context.Context, request ml.GetFeatureRequest) (*ml.Feature, error) { ret := _m.Called(ctx, request) @@ -189,6 +295,65 @@ func (_c *MockFeatureEngineeringInterface_GetFeature_Call) RunAndReturn(run func return _c } +// GetMaterializedFeature provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) GetMaterializedFeature(ctx context.Context, request ml.GetMaterializedFeatureRequest) (*ml.MaterializedFeature, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetMaterializedFeature") + } + + var r0 *ml.MaterializedFeature + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.GetMaterializedFeatureRequest) (*ml.MaterializedFeature, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.GetMaterializedFeatureRequest) *ml.MaterializedFeature); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.MaterializedFeature) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.GetMaterializedFeatureRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockFeatureEngineeringInterface_GetMaterializedFeature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMaterializedFeature' +type MockFeatureEngineeringInterface_GetMaterializedFeature_Call struct { + *mock.Call +} + +// GetMaterializedFeature is a helper method to define mock.On call +// - ctx context.Context +// - request ml.GetMaterializedFeatureRequest +func (_e *MockFeatureEngineeringInterface_Expecter) GetMaterializedFeature(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_GetMaterializedFeature_Call { + return &MockFeatureEngineeringInterface_GetMaterializedFeature_Call{Call: _e.mock.On("GetMaterializedFeature", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_GetMaterializedFeature_Call) Run(run func(ctx context.Context, request ml.GetMaterializedFeatureRequest)) *MockFeatureEngineeringInterface_GetMaterializedFeature_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.GetMaterializedFeatureRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_GetMaterializedFeature_Call) Return(_a0 *ml.MaterializedFeature, _a1 error) *MockFeatureEngineeringInterface_GetMaterializedFeature_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockFeatureEngineeringInterface_GetMaterializedFeature_Call) RunAndReturn(run func(context.Context, ml.GetMaterializedFeatureRequest) (*ml.MaterializedFeature, error)) *MockFeatureEngineeringInterface_GetMaterializedFeature_Call { + _c.Call.Return(run) + return _c +} + // ListFeatures provides a mock function with given fields: ctx, request func (_m *MockFeatureEngineeringInterface) ListFeatures(ctx context.Context, request ml.ListFeaturesRequest) listing.Iterator[ml.Feature] { ret := _m.Called(ctx, request) @@ -297,6 +462,114 @@ func (_c *MockFeatureEngineeringInterface_ListFeaturesAll_Call) RunAndReturn(run return _c } +// ListMaterializedFeatures provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) ListMaterializedFeatures(ctx context.Context, request ml.ListMaterializedFeaturesRequest) listing.Iterator[ml.MaterializedFeature] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListMaterializedFeatures") + } + + var r0 listing.Iterator[ml.MaterializedFeature] + if rf, ok := ret.Get(0).(func(context.Context, ml.ListMaterializedFeaturesRequest) listing.Iterator[ml.MaterializedFeature]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[ml.MaterializedFeature]) + } + } + + return r0 +} + +// MockFeatureEngineeringInterface_ListMaterializedFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListMaterializedFeatures' +type MockFeatureEngineeringInterface_ListMaterializedFeatures_Call struct { + *mock.Call +} + +// ListMaterializedFeatures is a helper method to define mock.On call +// - ctx context.Context +// - request ml.ListMaterializedFeaturesRequest +func (_e *MockFeatureEngineeringInterface_Expecter) ListMaterializedFeatures(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_ListMaterializedFeatures_Call { + return &MockFeatureEngineeringInterface_ListMaterializedFeatures_Call{Call: _e.mock.On("ListMaterializedFeatures", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_ListMaterializedFeatures_Call) Run(run func(ctx context.Context, request ml.ListMaterializedFeaturesRequest)) *MockFeatureEngineeringInterface_ListMaterializedFeatures_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.ListMaterializedFeaturesRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_ListMaterializedFeatures_Call) Return(_a0 listing.Iterator[ml.MaterializedFeature]) *MockFeatureEngineeringInterface_ListMaterializedFeatures_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockFeatureEngineeringInterface_ListMaterializedFeatures_Call) RunAndReturn(run func(context.Context, ml.ListMaterializedFeaturesRequest) listing.Iterator[ml.MaterializedFeature]) *MockFeatureEngineeringInterface_ListMaterializedFeatures_Call { + _c.Call.Return(run) + return _c +} + +// ListMaterializedFeaturesAll provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) ListMaterializedFeaturesAll(ctx context.Context, request ml.ListMaterializedFeaturesRequest) ([]ml.MaterializedFeature, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListMaterializedFeaturesAll") + } + + var r0 []ml.MaterializedFeature + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.ListMaterializedFeaturesRequest) ([]ml.MaterializedFeature, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.ListMaterializedFeaturesRequest) []ml.MaterializedFeature); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]ml.MaterializedFeature) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.ListMaterializedFeaturesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockFeatureEngineeringInterface_ListMaterializedFeaturesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListMaterializedFeaturesAll' +type MockFeatureEngineeringInterface_ListMaterializedFeaturesAll_Call struct { + *mock.Call +} + +// ListMaterializedFeaturesAll is a helper method to define mock.On call +// - ctx context.Context +// - request ml.ListMaterializedFeaturesRequest +func (_e *MockFeatureEngineeringInterface_Expecter) ListMaterializedFeaturesAll(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_ListMaterializedFeaturesAll_Call { + return &MockFeatureEngineeringInterface_ListMaterializedFeaturesAll_Call{Call: _e.mock.On("ListMaterializedFeaturesAll", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_ListMaterializedFeaturesAll_Call) Run(run func(ctx context.Context, request ml.ListMaterializedFeaturesRequest)) *MockFeatureEngineeringInterface_ListMaterializedFeaturesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.ListMaterializedFeaturesRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_ListMaterializedFeaturesAll_Call) Return(_a0 []ml.MaterializedFeature, _a1 error) *MockFeatureEngineeringInterface_ListMaterializedFeaturesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockFeatureEngineeringInterface_ListMaterializedFeaturesAll_Call) RunAndReturn(run func(context.Context, ml.ListMaterializedFeaturesRequest) ([]ml.MaterializedFeature, error)) *MockFeatureEngineeringInterface_ListMaterializedFeaturesAll_Call { + _c.Call.Return(run) + return _c +} + // UpdateFeature provides a mock function with given fields: ctx, request func (_m *MockFeatureEngineeringInterface) UpdateFeature(ctx context.Context, request ml.UpdateFeatureRequest) (*ml.Feature, error) { ret := _m.Called(ctx, request) @@ -356,6 +629,65 @@ func (_c *MockFeatureEngineeringInterface_UpdateFeature_Call) RunAndReturn(run f return _c } +// UpdateMaterializedFeature provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) UpdateMaterializedFeature(ctx context.Context, request ml.UpdateMaterializedFeatureRequest) (*ml.MaterializedFeature, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateMaterializedFeature") + } + + var r0 *ml.MaterializedFeature + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.UpdateMaterializedFeatureRequest) (*ml.MaterializedFeature, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.UpdateMaterializedFeatureRequest) *ml.MaterializedFeature); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.MaterializedFeature) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.UpdateMaterializedFeatureRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockFeatureEngineeringInterface_UpdateMaterializedFeature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateMaterializedFeature' +type MockFeatureEngineeringInterface_UpdateMaterializedFeature_Call struct { + *mock.Call +} + +// UpdateMaterializedFeature is a helper method to define mock.On call +// - ctx context.Context +// - request ml.UpdateMaterializedFeatureRequest +func (_e *MockFeatureEngineeringInterface_Expecter) UpdateMaterializedFeature(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_UpdateMaterializedFeature_Call { + return &MockFeatureEngineeringInterface_UpdateMaterializedFeature_Call{Call: _e.mock.On("UpdateMaterializedFeature", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_UpdateMaterializedFeature_Call) Run(run func(ctx context.Context, request ml.UpdateMaterializedFeatureRequest)) *MockFeatureEngineeringInterface_UpdateMaterializedFeature_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.UpdateMaterializedFeatureRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_UpdateMaterializedFeature_Call) Return(_a0 *ml.MaterializedFeature, _a1 error) *MockFeatureEngineeringInterface_UpdateMaterializedFeature_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockFeatureEngineeringInterface_UpdateMaterializedFeature_Call) RunAndReturn(run func(context.Context, ml.UpdateMaterializedFeatureRequest) (*ml.MaterializedFeature, error)) *MockFeatureEngineeringInterface_UpdateMaterializedFeature_Call { + _c.Call.Return(run) + return _c +} + // NewMockFeatureEngineeringInterface creates a new instance of MockFeatureEngineeringInterface. 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 NewMockFeatureEngineeringInterface(t interface { diff --git a/experimental/mocks/service/pipelines/mock_pipelines_interface.go b/experimental/mocks/service/pipelines/mock_pipelines_interface.go index 0ac64dd7a..c8abba99e 100644 --- a/experimental/mocks/service/pipelines/mock_pipelines_interface.go +++ b/experimental/mocks/service/pipelines/mock_pipelines_interface.go @@ -28,6 +28,65 @@ func (_m *MockPipelinesInterface) EXPECT() *MockPipelinesInterface_Expecter { return &MockPipelinesInterface_Expecter{mock: &_m.Mock} } +// ApplyEnvironment provides a mock function with given fields: ctx, request +func (_m *MockPipelinesInterface) ApplyEnvironment(ctx context.Context, request pipelines.ApplyEnvironmentRequest) (*pipelines.ApplyEnvironmentRequestResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ApplyEnvironment") + } + + var r0 *pipelines.ApplyEnvironmentRequestResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, pipelines.ApplyEnvironmentRequest) (*pipelines.ApplyEnvironmentRequestResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, pipelines.ApplyEnvironmentRequest) *pipelines.ApplyEnvironmentRequestResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*pipelines.ApplyEnvironmentRequestResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, pipelines.ApplyEnvironmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPipelinesInterface_ApplyEnvironment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyEnvironment' +type MockPipelinesInterface_ApplyEnvironment_Call struct { + *mock.Call +} + +// ApplyEnvironment is a helper method to define mock.On call +// - ctx context.Context +// - request pipelines.ApplyEnvironmentRequest +func (_e *MockPipelinesInterface_Expecter) ApplyEnvironment(ctx interface{}, request interface{}) *MockPipelinesInterface_ApplyEnvironment_Call { + return &MockPipelinesInterface_ApplyEnvironment_Call{Call: _e.mock.On("ApplyEnvironment", ctx, request)} +} + +func (_c *MockPipelinesInterface_ApplyEnvironment_Call) Run(run func(ctx context.Context, request pipelines.ApplyEnvironmentRequest)) *MockPipelinesInterface_ApplyEnvironment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(pipelines.ApplyEnvironmentRequest)) + }) + return _c +} + +func (_c *MockPipelinesInterface_ApplyEnvironment_Call) Return(_a0 *pipelines.ApplyEnvironmentRequestResponse, _a1 error) *MockPipelinesInterface_ApplyEnvironment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPipelinesInterface_ApplyEnvironment_Call) RunAndReturn(run func(context.Context, pipelines.ApplyEnvironmentRequest) (*pipelines.ApplyEnvironmentRequestResponse, error)) *MockPipelinesInterface_ApplyEnvironment_Call { + _c.Call.Return(run) + return _c +} + // Create provides a mock function with given fields: ctx, request func (_m *MockPipelinesInterface) Create(ctx context.Context, request pipelines.CreatePipeline) (*pipelines.CreatePipelineResponse, error) { ret := _m.Called(ctx, request) @@ -1165,6 +1224,65 @@ func (_c *MockPipelinesInterface_PipelineStateInfoNameToPipelineIdMap_Call) RunA return _c } +// RestorePipeline provides a mock function with given fields: ctx, request +func (_m *MockPipelinesInterface) RestorePipeline(ctx context.Context, request pipelines.RestorePipelineRequest) (*pipelines.RestorePipelineRequestResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for RestorePipeline") + } + + var r0 *pipelines.RestorePipelineRequestResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, pipelines.RestorePipelineRequest) (*pipelines.RestorePipelineRequestResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, pipelines.RestorePipelineRequest) *pipelines.RestorePipelineRequestResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*pipelines.RestorePipelineRequestResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, pipelines.RestorePipelineRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPipelinesInterface_RestorePipeline_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RestorePipeline' +type MockPipelinesInterface_RestorePipeline_Call struct { + *mock.Call +} + +// RestorePipeline is a helper method to define mock.On call +// - ctx context.Context +// - request pipelines.RestorePipelineRequest +func (_e *MockPipelinesInterface_Expecter) RestorePipeline(ctx interface{}, request interface{}) *MockPipelinesInterface_RestorePipeline_Call { + return &MockPipelinesInterface_RestorePipeline_Call{Call: _e.mock.On("RestorePipeline", ctx, request)} +} + +func (_c *MockPipelinesInterface_RestorePipeline_Call) Run(run func(ctx context.Context, request pipelines.RestorePipelineRequest)) *MockPipelinesInterface_RestorePipeline_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(pipelines.RestorePipelineRequest)) + }) + return _c +} + +func (_c *MockPipelinesInterface_RestorePipeline_Call) Return(_a0 *pipelines.RestorePipelineRequestResponse, _a1 error) *MockPipelinesInterface_RestorePipeline_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPipelinesInterface_RestorePipeline_Call) RunAndReturn(run func(context.Context, pipelines.RestorePipelineRequest) (*pipelines.RestorePipelineRequestResponse, error)) *MockPipelinesInterface_RestorePipeline_Call { + _c.Call.Return(run) + return _c +} + // SetPermissions provides a mock function with given fields: ctx, request func (_m *MockPipelinesInterface) SetPermissions(ctx context.Context, request pipelines.PipelinePermissionsRequest) (*pipelines.PipelinePermissions, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/tags/mock_tag_assignments_interface.go b/experimental/mocks/service/tags/mock_tag_assignments_interface.go new file mode 100644 index 000000000..089d8e50c --- /dev/null +++ b/experimental/mocks/service/tags/mock_tag_assignments_interface.go @@ -0,0 +1,371 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package tags + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + tags "github.com/databricks/databricks-sdk-go/service/tags" +) + +// MockTagAssignmentsInterface is an autogenerated mock type for the TagAssignmentsInterface type +type MockTagAssignmentsInterface struct { + mock.Mock +} + +type MockTagAssignmentsInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockTagAssignmentsInterface) EXPECT() *MockTagAssignmentsInterface_Expecter { + return &MockTagAssignmentsInterface_Expecter{mock: &_m.Mock} +} + +// CreateTagAssignment provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) CreateTagAssignment(ctx context.Context, request tags.CreateTagAssignmentRequest) (*tags.TagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateTagAssignment") + } + + var r0 *tags.TagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.CreateTagAssignmentRequest) (*tags.TagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.CreateTagAssignmentRequest) *tags.TagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.CreateTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagAssignmentsInterface_CreateTagAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateTagAssignment' +type MockTagAssignmentsInterface_CreateTagAssignment_Call struct { + *mock.Call +} + +// CreateTagAssignment is a helper method to define mock.On call +// - ctx context.Context +// - request tags.CreateTagAssignmentRequest +func (_e *MockTagAssignmentsInterface_Expecter) CreateTagAssignment(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_CreateTagAssignment_Call { + return &MockTagAssignmentsInterface_CreateTagAssignment_Call{Call: _e.mock.On("CreateTagAssignment", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_CreateTagAssignment_Call) Run(run func(ctx context.Context, request tags.CreateTagAssignmentRequest)) *MockTagAssignmentsInterface_CreateTagAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.CreateTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_CreateTagAssignment_Call) Return(_a0 *tags.TagAssignment, _a1 error) *MockTagAssignmentsInterface_CreateTagAssignment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagAssignmentsInterface_CreateTagAssignment_Call) RunAndReturn(run func(context.Context, tags.CreateTagAssignmentRequest) (*tags.TagAssignment, error)) *MockTagAssignmentsInterface_CreateTagAssignment_Call { + _c.Call.Return(run) + return _c +} + +// DeleteTagAssignment provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) DeleteTagAssignment(ctx context.Context, request tags.DeleteTagAssignmentRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteTagAssignment") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, tags.DeleteTagAssignmentRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockTagAssignmentsInterface_DeleteTagAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteTagAssignment' +type MockTagAssignmentsInterface_DeleteTagAssignment_Call struct { + *mock.Call +} + +// DeleteTagAssignment is a helper method to define mock.On call +// - ctx context.Context +// - request tags.DeleteTagAssignmentRequest +func (_e *MockTagAssignmentsInterface_Expecter) DeleteTagAssignment(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_DeleteTagAssignment_Call { + return &MockTagAssignmentsInterface_DeleteTagAssignment_Call{Call: _e.mock.On("DeleteTagAssignment", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_DeleteTagAssignment_Call) Run(run func(ctx context.Context, request tags.DeleteTagAssignmentRequest)) *MockTagAssignmentsInterface_DeleteTagAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.DeleteTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_DeleteTagAssignment_Call) Return(_a0 error) *MockTagAssignmentsInterface_DeleteTagAssignment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTagAssignmentsInterface_DeleteTagAssignment_Call) RunAndReturn(run func(context.Context, tags.DeleteTagAssignmentRequest) error) *MockTagAssignmentsInterface_DeleteTagAssignment_Call { + _c.Call.Return(run) + return _c +} + +// GetTagAssignment provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) GetTagAssignment(ctx context.Context, request tags.GetTagAssignmentRequest) (*tags.TagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetTagAssignment") + } + + var r0 *tags.TagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.GetTagAssignmentRequest) (*tags.TagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.GetTagAssignmentRequest) *tags.TagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.GetTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagAssignmentsInterface_GetTagAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTagAssignment' +type MockTagAssignmentsInterface_GetTagAssignment_Call struct { + *mock.Call +} + +// GetTagAssignment is a helper method to define mock.On call +// - ctx context.Context +// - request tags.GetTagAssignmentRequest +func (_e *MockTagAssignmentsInterface_Expecter) GetTagAssignment(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_GetTagAssignment_Call { + return &MockTagAssignmentsInterface_GetTagAssignment_Call{Call: _e.mock.On("GetTagAssignment", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_GetTagAssignment_Call) Run(run func(ctx context.Context, request tags.GetTagAssignmentRequest)) *MockTagAssignmentsInterface_GetTagAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.GetTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_GetTagAssignment_Call) Return(_a0 *tags.TagAssignment, _a1 error) *MockTagAssignmentsInterface_GetTagAssignment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagAssignmentsInterface_GetTagAssignment_Call) RunAndReturn(run func(context.Context, tags.GetTagAssignmentRequest) (*tags.TagAssignment, error)) *MockTagAssignmentsInterface_GetTagAssignment_Call { + _c.Call.Return(run) + return _c +} + +// ListTagAssignments provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) ListTagAssignments(ctx context.Context, request tags.ListTagAssignmentsRequest) listing.Iterator[tags.TagAssignment] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListTagAssignments") + } + + var r0 listing.Iterator[tags.TagAssignment] + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagAssignmentsRequest) listing.Iterator[tags.TagAssignment]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[tags.TagAssignment]) + } + } + + return r0 +} + +// MockTagAssignmentsInterface_ListTagAssignments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTagAssignments' +type MockTagAssignmentsInterface_ListTagAssignments_Call struct { + *mock.Call +} + +// ListTagAssignments is a helper method to define mock.On call +// - ctx context.Context +// - request tags.ListTagAssignmentsRequest +func (_e *MockTagAssignmentsInterface_Expecter) ListTagAssignments(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_ListTagAssignments_Call { + return &MockTagAssignmentsInterface_ListTagAssignments_Call{Call: _e.mock.On("ListTagAssignments", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignments_Call) Run(run func(ctx context.Context, request tags.ListTagAssignmentsRequest)) *MockTagAssignmentsInterface_ListTagAssignments_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.ListTagAssignmentsRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignments_Call) Return(_a0 listing.Iterator[tags.TagAssignment]) *MockTagAssignmentsInterface_ListTagAssignments_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignments_Call) RunAndReturn(run func(context.Context, tags.ListTagAssignmentsRequest) listing.Iterator[tags.TagAssignment]) *MockTagAssignmentsInterface_ListTagAssignments_Call { + _c.Call.Return(run) + return _c +} + +// ListTagAssignmentsAll provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) ListTagAssignmentsAll(ctx context.Context, request tags.ListTagAssignmentsRequest) ([]tags.TagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListTagAssignmentsAll") + } + + var r0 []tags.TagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagAssignmentsRequest) ([]tags.TagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.ListTagAssignmentsRequest) []tags.TagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]tags.TagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.ListTagAssignmentsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagAssignmentsInterface_ListTagAssignmentsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTagAssignmentsAll' +type MockTagAssignmentsInterface_ListTagAssignmentsAll_Call struct { + *mock.Call +} + +// ListTagAssignmentsAll is a helper method to define mock.On call +// - ctx context.Context +// - request tags.ListTagAssignmentsRequest +func (_e *MockTagAssignmentsInterface_Expecter) ListTagAssignmentsAll(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call { + return &MockTagAssignmentsInterface_ListTagAssignmentsAll_Call{Call: _e.mock.On("ListTagAssignmentsAll", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call) Run(run func(ctx context.Context, request tags.ListTagAssignmentsRequest)) *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.ListTagAssignmentsRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call) Return(_a0 []tags.TagAssignment, _a1 error) *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call) RunAndReturn(run func(context.Context, tags.ListTagAssignmentsRequest) ([]tags.TagAssignment, error)) *MockTagAssignmentsInterface_ListTagAssignmentsAll_Call { + _c.Call.Return(run) + return _c +} + +// UpdateTagAssignment provides a mock function with given fields: ctx, request +func (_m *MockTagAssignmentsInterface) UpdateTagAssignment(ctx context.Context, request tags.UpdateTagAssignmentRequest) (*tags.TagAssignment, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateTagAssignment") + } + + var r0 *tags.TagAssignment + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, tags.UpdateTagAssignmentRequest) (*tags.TagAssignment, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, tags.UpdateTagAssignmentRequest) *tags.TagAssignment); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tags.TagAssignment) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, tags.UpdateTagAssignmentRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTagAssignmentsInterface_UpdateTagAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateTagAssignment' +type MockTagAssignmentsInterface_UpdateTagAssignment_Call struct { + *mock.Call +} + +// UpdateTagAssignment is a helper method to define mock.On call +// - ctx context.Context +// - request tags.UpdateTagAssignmentRequest +func (_e *MockTagAssignmentsInterface_Expecter) UpdateTagAssignment(ctx interface{}, request interface{}) *MockTagAssignmentsInterface_UpdateTagAssignment_Call { + return &MockTagAssignmentsInterface_UpdateTagAssignment_Call{Call: _e.mock.On("UpdateTagAssignment", ctx, request)} +} + +func (_c *MockTagAssignmentsInterface_UpdateTagAssignment_Call) Run(run func(ctx context.Context, request tags.UpdateTagAssignmentRequest)) *MockTagAssignmentsInterface_UpdateTagAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(tags.UpdateTagAssignmentRequest)) + }) + return _c +} + +func (_c *MockTagAssignmentsInterface_UpdateTagAssignment_Call) Return(_a0 *tags.TagAssignment, _a1 error) *MockTagAssignmentsInterface_UpdateTagAssignment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTagAssignmentsInterface_UpdateTagAssignment_Call) RunAndReturn(run func(context.Context, tags.UpdateTagAssignmentRequest) (*tags.TagAssignment, error)) *MockTagAssignmentsInterface_UpdateTagAssignment_Call { + _c.Call.Return(run) + return _c +} + +// NewMockTagAssignmentsInterface creates a new instance of MockTagAssignmentsInterface. 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 NewMockTagAssignmentsInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockTagAssignmentsInterface { + mock := &MockTagAssignmentsInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go b/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go index b396a28a5..06dde493b 100644 --- a/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go +++ b/experimental/mocks/service/vectorsearch/mock_vector_search_indexes_interface.go @@ -745,6 +745,65 @@ func (_c *MockVectorSearchIndexesInterface_SyncIndex_Call) RunAndReturn(run func return _c } +// UpdateIndexBudgetPolicy provides a mock function with given fields: ctx, request +func (_m *MockVectorSearchIndexesInterface) UpdateIndexBudgetPolicy(ctx context.Context, request vectorsearch.UpdateVectorIndexUsagePolicyRequest) (*vectorsearch.UpdateVectorIndexUsagePolicyResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateIndexBudgetPolicy") + } + + var r0 *vectorsearch.UpdateVectorIndexUsagePolicyResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, vectorsearch.UpdateVectorIndexUsagePolicyRequest) (*vectorsearch.UpdateVectorIndexUsagePolicyResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, vectorsearch.UpdateVectorIndexUsagePolicyRequest) *vectorsearch.UpdateVectorIndexUsagePolicyResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vectorsearch.UpdateVectorIndexUsagePolicyResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, vectorsearch.UpdateVectorIndexUsagePolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateIndexBudgetPolicy' +type MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call struct { + *mock.Call +} + +// UpdateIndexBudgetPolicy is a helper method to define mock.On call +// - ctx context.Context +// - request vectorsearch.UpdateVectorIndexUsagePolicyRequest +func (_e *MockVectorSearchIndexesInterface_Expecter) UpdateIndexBudgetPolicy(ctx interface{}, request interface{}) *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call { + return &MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call{Call: _e.mock.On("UpdateIndexBudgetPolicy", ctx, request)} +} + +func (_c *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call) Run(run func(ctx context.Context, request vectorsearch.UpdateVectorIndexUsagePolicyRequest)) *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(vectorsearch.UpdateVectorIndexUsagePolicyRequest)) + }) + return _c +} + +func (_c *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call) Return(_a0 *vectorsearch.UpdateVectorIndexUsagePolicyResponse, _a1 error) *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call) RunAndReturn(run func(context.Context, vectorsearch.UpdateVectorIndexUsagePolicyRequest) (*vectorsearch.UpdateVectorIndexUsagePolicyResponse, error)) *MockVectorSearchIndexesInterface_UpdateIndexBudgetPolicy_Call { + _c.Call.Return(run) + return _c +} + // UpsertDataVectorIndex provides a mock function with given fields: ctx, request func (_m *MockVectorSearchIndexesInterface) UpsertDataVectorIndex(ctx context.Context, request vectorsearch.UpsertDataVectorIndexRequest) (*vectorsearch.UpsertDataVectorIndexResponse, error) { ret := _m.Called(ctx, request) diff --git a/internal/generatedtests/idempotency_call_test.go b/internal/generatedtests/idempotency_call_test.go new file mode 100755 index 000000000..d350844ca --- /dev/null +++ b/internal/generatedtests/idempotency_call_test.go @@ -0,0 +1,147 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +package generated_tests + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "testing" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/config" + "github.com/databricks/databricks-sdk-go/internal/testspecs/service/idempotencytesting" + "github.com/databricks/databricks-sdk-go/qa" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" +) + +func TestIdempotency_CreateTestResource_WithRequestID(t *testing.T) { + testCases := []struct { + name string + fixtures qa.HTTPFixtures + wantResult *idempotencytesting.TestResource + wantErr bool + }{ + + { + name: "RetryWithProvidedRequestID", + fixtures: qa.HTTPFixtures{{ + Method: "POST", + Resource: "/api/2.0/idempotency-testing/resources?request_id=test-request-id-12345", + ExpectedRequest: idempotencytesting.TestResource{}, + Response: map[string]interface{}{"error_code": "TEMPORARILY_UNAVAILABLE", "message": "Service temporarily unavailable"}, + Status: 503, + }, { + Method: "POST", + Resource: "/api/2.0/idempotency-testing/resources?request_id=test-request-id-12345", + ExpectedRequest: idempotencytesting.TestResource{}, + Response: idempotencytesting.TestResource{ + Id: "test-resource-123", + Name: "test-resource", + }, + Status: 200, + }}, + wantResult: &idempotencytesting.TestResource{ + Id: "test-resource-123", + Name: "test-resource", + }, + wantErr: false, + }, + } + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + tt.fixtures.ApplyClient(t, func(ctx context.Context, client *client.DatabricksClient) { + service := idempotencytesting.NewIdempotencyTesting(client) + + request := idempotencytesting.CreateTestResourceRequest{ + TestResource: idempotencytesting.TestResource{}, + RequestId: "test-request-id-12345", + } + + result, err := service.CreateTestResource(ctx, request) + if diff := cmp.Diff(tt.wantResult, result, cmpopts.IgnoreFields(idempotencytesting.TestResource{}, "ForceSendFields")); diff != "" { + t.Errorf("result mismatch (-expected +actual):\n%s", diff) + } + if tt.wantErr && err == nil { + t.Fatalf("expected error, got nil") + } + if !tt.wantErr && err != nil { + t.Fatalf("expected no error, got: %v", err) + } + }) + }) + } +} + +func TestIdempotency_CreateTestResource_AutoGeneratedRequestID(t *testing.T) { + + t.Run("RetryWithAutoGeneratedRequestID", func(t *testing.T) { + var capturedRequestID string + callCount := 0 + + server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { + callCount++ + + // Extract request_id from query parameters + requestID := request.URL.Query().Get("request_id") + + if callCount == 1 { + // First call: capture request_id and return 503 + capturedRequestID = requestID + if capturedRequestID == "" { + t.Fatal("First request should have auto-generated request_id") + } + writer.WriteHeader(503) + json.NewEncoder(writer).Encode(map[string]string{ + "error_code": "TEMPORARILY_UNAVAILABLE", + "message": "Service temporarily unavailable", + }) + } else if callCount == 2 { + // Second call: validate same request_id and return 200 + if requestID != capturedRequestID { + t.Fatalf("Second request request_id %q != first request request_id %q", + requestID, capturedRequestID) + } + writer.WriteHeader(200) + json.NewEncoder(writer).Encode(idempotencytesting.TestResource{ + Id: "test-resource-123", + Name: "test-resource", + }) + } + })) + defer server.Close() + + // Create client with custom server + cfg := &config.Config{Host: server.URL, Token: "x"} + client, err := client.New(cfg) + if err != nil { + t.Fatalf("failed to create client: %v", err) + } + service := idempotencytesting.NewIdempotencyTesting(client) + + request := idempotencytesting.CreateTestResourceRequest{ + TestResource: idempotencytesting.TestResource{}, + // RequestID is not set, SDK should generate one + } + + result, err := service.CreateTestResource(context.Background(), request) + + // Verify the operation succeeded + if err != nil { + t.Fatalf("expected no error, got: %v", err) + } + if result == nil { + t.Fatal("expected result, got nil") + } + if result.Id == "" { + t.Error("expected result to have an ID") + } + + // Verify exactly 2 calls were made (initial + retry) + if callCount != 2 { + t.Fatalf("expected 2 calls to create test resource, got %d", callCount) + } + }) + +} diff --git a/internal/testspecs/service/idempotencytesting/api.go b/internal/testspecs/service/idempotencytesting/api.go new file mode 100755 index 000000000..2e397ad43 --- /dev/null +++ b/internal/testspecs/service/idempotencytesting/api.go @@ -0,0 +1,27 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +// Test service for Idempotency of Operations +package idempotencytesting + +import ( + "context" + + "github.com/databricks/databricks-sdk-go/client" +) + +type IdempotencyTestingInterface interface { + CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (*TestResource, error) +} + +func NewIdempotencyTesting(client *client.DatabricksClient) *IdempotencyTestingAPI { + return &IdempotencyTestingAPI{ + idempotencyTestingImpl: idempotencyTestingImpl{ + client: client, + }, + } +} + +// Test service for Idempotency of Operations +type IdempotencyTestingAPI struct { + idempotencyTestingImpl +} diff --git a/internal/testspecs/service/idempotencytesting/impl.go b/internal/testspecs/service/idempotencytesting/impl.go new file mode 100755 index 000000000..23a0506d4 --- /dev/null +++ b/internal/testspecs/service/idempotencytesting/impl.go @@ -0,0 +1,35 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package idempotencytesting + +import ( + "context" + "net/http" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/google/uuid" + "golang.org/x/exp/slices" +) + +// unexported type that holds implementations of just IdempotencyTesting API methods +type idempotencyTestingImpl struct { + client *client.DatabricksClient +} + +func (a *idempotencyTestingImpl) CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (*TestResource, error) { + var testResource TestResource + if request.RequestId == "" { + request.RequestId = uuid.New().String() + } + path := "/api/2.0/idempotency-testing/resources" + queryParams := make(map[string]any) + + if request.RequestId != "" || slices.Contains(request.ForceSendFields, "RequestId") { + queryParams["request_id"] = request.RequestId + } + 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.TestResource, &testResource) + return &testResource, err +} diff --git a/internal/testspecs/service/idempotencytesting/model.go b/internal/testspecs/service/idempotencytesting/model.go new file mode 100755 index 000000000..64d874e17 --- /dev/null +++ b/internal/testspecs/service/idempotencytesting/model.go @@ -0,0 +1,39 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package idempotencytesting + +import ( + "github.com/databricks/databricks-sdk-go/marshal" +) + +type CreateTestResourceRequest struct { + RequestId string `json:"-" url:"request_id,omitempty"` + + TestResource TestResource `json:"test_resource"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateTestResourceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateTestResourceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type TestResource struct { + Id string `json:"id,omitempty"` + + Name string `json:"name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *TestResource) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s TestResource) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} diff --git a/internal/testspecs/service/lrotesting/api.go b/internal/testspecs/service/lrotesting/api.go index 4b6fb3839..cfd8fd1ea 100755 --- a/internal/testspecs/service/lrotesting/api.go +++ b/internal/testspecs/service/lrotesting/api.go @@ -18,7 +18,9 @@ import ( type LroTestingInterface interface { CancelOperation(ctx context.Context, request CancelOperationRequest) error - CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (*CreateTestResourceOperation, error) + CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (CreateTestResourceOperationInterface, error) + + DeleteTestResource(ctx context.Context, request DeleteTestResourceRequest) (DeleteTestResourceOperationInterface, error) GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error) @@ -39,7 +41,7 @@ type LroTestingAPI struct { lroTestingImpl } -func (a *LroTestingAPI) CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (*CreateTestResourceOperation, error) { +func (a *LroTestingAPI) CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (CreateTestResourceOperationInterface, error) { operation, err := a.lroTestingImpl.CreateTestResource(ctx, request) if err != nil { return nil, err @@ -50,6 +52,29 @@ func (a *LroTestingAPI) CreateTestResource(ctx context.Context, request CreateTe }, nil } +type CreateTestResourceOperationInterface interface { + // Wait blocks until the long-running operation is completed with default 20 min + // timeout, the timeout can be overridden in the opts. If the operation didn't + // finished within the timeout, this function will through an error of type + // ErrTimedOut, otherwise successful response and any errors encountered. + Wait(ctx context.Context, opts *lro.LroOptions) (*TestResource, error) + + // Starts asynchronous cancellation on a long-running operation. The server + // makes a best effort to cancel the operation, but success is not guaranteed. + Cancel(ctx context.Context) error + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*TestResourceOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + type CreateTestResourceOperation struct { impl *lroTestingImpl operation *Operation @@ -66,7 +91,7 @@ func (a *CreateTestResourceOperation) Wait(ctx context.Context, opts *lro.LroOpt } ctx = useragent.InContext(ctx, "sdk-feature", "long-running") - return retries.Poll[TestResource](ctx, timeout, func() (*TestResource, *retries.Err) { + val, err := retries.Poll[TestResource](ctx, timeout, func() (*TestResource, *retries.Err) { operation, err := a.impl.GetOperation(ctx, GetOperationRequest{ Name: a.operation.Name, }) @@ -108,7 +133,14 @@ func (a *CreateTestResourceOperation) Wait(ctx context.Context, opts *lro.LroOpt } return &testResource, nil + }) + + if err != nil { + return nil, err + } + return val, nil + } // Starts asynchronous cancellation on a long-running operation. The server @@ -156,3 +188,142 @@ func (a *CreateTestResourceOperation) Done() (bool, error) { return operation.Done, nil } + +func (a *LroTestingAPI) DeleteTestResource(ctx context.Context, request DeleteTestResourceRequest) (DeleteTestResourceOperationInterface, error) { + operation, err := a.lroTestingImpl.DeleteTestResource(ctx, request) + if err != nil { + return nil, err + } + return &DeleteTestResourceOperation{ + impl: &a.lroTestingImpl, + operation: operation, + }, nil +} + +type DeleteTestResourceOperationInterface interface { + // Wait blocks until the long-running operation is completed with default 20 min + // timeout, the timeout can be overridden in the opts. If the operation didn't + // finished within the timeout, this function will through an error of type + // ErrTimedOut, otherwise successful response and any errors encountered. + Wait(ctx context.Context, opts *lro.LroOptions) error + + // Starts asynchronous cancellation on a long-running operation. The server + // makes a best effort to cancel the operation, but success is not guaranteed. + Cancel(ctx context.Context) error + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*TestResourceOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + +type DeleteTestResourceOperation struct { + impl *lroTestingImpl + operation *Operation +} + +// Wait blocks until the long-running operation is completed with default 20 min +// timeout, the timeout can be overridden in the opts. If the operation didn't +// finished within the timeout, this function will through an error of type +// ErrTimedOut, otherwise successful response and any errors encountered. +func (a *DeleteTestResourceOperation) Wait(ctx context.Context, opts *lro.LroOptions) error { + timeout := 20 * time.Minute // default timeout per LRO spec + if opts != nil && opts.Timeout > 0 { + timeout = opts.Timeout + } + + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + _, err := retries.Poll[struct{}](ctx, timeout, func() (*struct{}, *retries.Err) { + operation, err := a.impl.GetOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return nil, retries.Halt(err) + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return nil, retries.Continues("operation still in progress") + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + } + + return &struct{}{}, nil + + }) + + return err + +} + +// Starts asynchronous cancellation on a long-running operation. The server +// makes a best effort to cancel the operation, but success is not guaranteed. +func (a *DeleteTestResourceOperation) Cancel(ctx context.Context) error { + return a.impl.CancelOperation(ctx, CancelOperationRequest{ + Name: a.operation.Name, + }) +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *DeleteTestResourceOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *DeleteTestResourceOperation) Metadata() (*TestResourceOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata TestResourceOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *DeleteTestResourceOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} diff --git a/internal/testspecs/service/lrotesting/impl.go b/internal/testspecs/service/lrotesting/impl.go index 28ca322d2..c66490967 100755 --- a/internal/testspecs/service/lrotesting/impl.go +++ b/internal/testspecs/service/lrotesting/impl.go @@ -35,6 +35,16 @@ func (a *lroTestingImpl) CreateTestResource(ctx context.Context, request CreateT return &operation, err } +func (a *lroTestingImpl) DeleteTestResource(ctx context.Context, request DeleteTestResourceRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/lro-testing/resources/%v", request.ResourceId) + 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, &operation) + return &operation, err +} + func (a *lroTestingImpl) GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error) { var operation Operation path := fmt.Sprintf("/api/2.0/lro-testing/operations/%v", request.Name) diff --git a/internal/testspecs/service/lrotesting/model.go b/internal/testspecs/service/lrotesting/model.go index 2f8fdba19..805c57808 100755 --- a/internal/testspecs/service/lrotesting/model.go +++ b/internal/testspecs/service/lrotesting/model.go @@ -46,6 +46,11 @@ func (s DatabricksServiceExceptionWithDetailsProto) MarshalJSON() ([]byte, error return marshal.Marshal(s) } +type DeleteTestResourceRequest struct { + // Resource ID to delete + ResourceId string `json:"-" url:"-"` +} + // Legacy definition of the ErrorCode enum. Please keep in sync with // api-base/proto/error_code.proto (except status code mapping annotations as // this file doesn't have them). Will be removed eventually, pending the ScalaPB diff --git a/service/apps/model.go b/service/apps/model.go index fa12507a9..a8f461005 100755 --- a/service/apps/model.go +++ b/service/apps/model.go @@ -32,6 +32,8 @@ type App struct { Description string `json:"description,omitempty"` EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The effective api scopes granted to the user access token. EffectiveUserApiScopes []string `json:"effective_user_api_scopes,omitempty"` // The unique identifier of the app. @@ -61,6 +63,8 @@ type App struct { // The URL of the app once it is deployed. Url string `json:"url,omitempty"` + UsagePolicyId string `json:"usage_policy_id,omitempty"` + UserApiScopes []string `json:"user_api_scopes,omitempty"` ForceSendFields []string `json:"-" url:"-"` @@ -119,6 +123,7 @@ func (s AppAccessControlResponse) MarshalJSON() ([]byte, error) { } type AppDeployment struct { + Command []string `json:"command,omitempty"` // The creation time of the deployment. Formatted timestamp in ISO 6801. CreateTime string `json:"create_time,omitempty"` // The email of the user creates the deployment. @@ -127,6 +132,8 @@ type AppDeployment struct { DeploymentArtifacts *AppDeploymentArtifacts `json:"deployment_artifacts,omitempty"` // The unique id of the deployment. DeploymentId string `json:"deployment_id,omitempty"` + + EnvVars []EnvVar `json:"env_vars,omitempty"` // The mode of which the deployment will manage the source code. Mode AppDeploymentMode `json:"mode,omitempty"` // The workspace file system path of the source code used to create the app @@ -1421,6 +1428,24 @@ type DeleteCustomTemplateRequest struct { Name string `json:"-" url:"-"` } +type EnvVar struct { + Name string `json:"name,omitempty"` + + Value string `json:"value,omitempty"` + + ValueFrom string `json:"value_from,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *EnvVar) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s EnvVar) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GetAppDeploymentRequest struct { // The name of the app. AppName string `json:"-" url:"-"` diff --git a/service/billing/api.go b/service/billing/api.go index 55af38059..418513ea2 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, Budget Policy, Budgets, Log Delivery, Usage Dashboards, etc. +// These APIs allow you to manage Billable Usage, Budget Policy, Budgets, Log Delivery, Usage Dashboards, Usage Policy, etc. package billing import ( @@ -412,3 +412,63 @@ func NewUsageDashboards(client *client.DatabricksClient) *UsageDashboardsAPI { type UsageDashboardsAPI struct { usageDashboardsImpl } + +type UsagePolicyInterface interface { + + // Creates a new usage policy. + Create(ctx context.Context, request CreateUsagePolicyRequest) (*UsagePolicy, error) + + // Deletes a usage policy + Delete(ctx context.Context, request DeleteUsagePolicyRequest) error + + // Deletes a usage policy + DeleteByPolicyId(ctx context.Context, policyId string) error + + // Retrieves a usage policy by it's ID. + Get(ctx context.Context, request GetUsagePolicyRequest) (*UsagePolicy, error) + + // Retrieves a usage policy by it's ID. + GetByPolicyId(ctx context.Context, policyId string) (*UsagePolicy, error) + + // Lists all usage 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 ListUsagePoliciesRequest) listing.Iterator[UsagePolicy] + + // Lists all usage 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 ListUsagePoliciesRequest) ([]UsagePolicy, error) + + // Updates a usage policy + Update(ctx context.Context, request UpdateUsagePolicyRequest) (*UsagePolicy, error) +} + +func NewUsagePolicy(client *client.DatabricksClient) *UsagePolicyAPI { + return &UsagePolicyAPI{ + usagePolicyImpl: usagePolicyImpl{ + client: client, + }, + } +} + +// A service serves REST API about Usage policies +type UsagePolicyAPI struct { + usagePolicyImpl +} + +// Deletes a usage policy +func (a *UsagePolicyAPI) DeleteByPolicyId(ctx context.Context, policyId string) error { + return a.usagePolicyImpl.Delete(ctx, DeleteUsagePolicyRequest{ + PolicyId: policyId, + }) +} + +// Retrieves a usage policy by it's ID. +func (a *UsagePolicyAPI) GetByPolicyId(ctx context.Context, policyId string) (*UsagePolicy, error) { + return a.usagePolicyImpl.Get(ctx, GetUsagePolicyRequest{ + PolicyId: policyId, + }) +} diff --git a/service/billing/impl.go b/service/billing/impl.go index 87443851a..412d7c9f8 100755 --- a/service/billing/impl.go +++ b/service/billing/impl.go @@ -10,6 +10,8 @@ import ( "github.com/databricks/databricks-sdk-go/client" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" + "github.com/google/uuid" + "golang.org/x/exp/slices" ) // unexported type that holds implementations of just BillableUsage API methods @@ -34,6 +36,9 @@ type budgetPolicyImpl struct { func (a *budgetPolicyImpl) Create(ctx context.Context, request CreateBudgetPolicyRequest) (*BudgetPolicy, error) { var budgetPolicy BudgetPolicy + if request.RequestId == "" { + request.RequestId = uuid.New().String() + } path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) @@ -110,9 +115,13 @@ func (a *budgetPolicyImpl) Update(ctx context.Context, request UpdateBudgetPolic path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) queryParams := make(map[string]any) - if request.LimitConfig != nil { + if request.LimitConfig != nil || slices.Contains(request.ForceSendFields, "LimitConfig") { queryParams["limit_config"] = request.LimitConfig } + + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { + queryParams["update_mask"] = request.UpdateMask + } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" @@ -311,3 +320,99 @@ func (a *usageDashboardsImpl) Get(ctx context.Context, request GetBillingUsageDa err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getBillingUsageDashboardResponse) return &getBillingUsageDashboardResponse, err } + +// unexported type that holds implementations of just UsagePolicy API methods +type usagePolicyImpl struct { + client *client.DatabricksClient +} + +func (a *usagePolicyImpl) Create(ctx context.Context, request CreateUsagePolicyRequest) (*UsagePolicy, error) { + var usagePolicy UsagePolicy + if request.RequestId == "" { + request.RequestId = uuid.New().String() + } + path := fmt.Sprintf("/api/2.1/accounts/%v/usage-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, &usagePolicy) + return &usagePolicy, err +} + +func (a *usagePolicyImpl) Delete(ctx context.Context, request DeleteUsagePolicyRequest) error { + path := fmt.Sprintf("/api/2.1/accounts/%v/usage-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, nil) + return err +} + +func (a *usagePolicyImpl) Get(ctx context.Context, request GetUsagePolicyRequest) (*UsagePolicy, error) { + var usagePolicy UsagePolicy + path := fmt.Sprintf("/api/2.1/accounts/%v/usage-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, &usagePolicy) + return &usagePolicy, err +} + +// Lists all usage policies. Policies are returned in the alphabetically +// ascending order of their names. +func (a *usagePolicyImpl) List(ctx context.Context, request ListUsagePoliciesRequest) listing.Iterator[UsagePolicy] { + + getNextPage := func(ctx context.Context, req ListUsagePoliciesRequest) (*ListUsagePoliciesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListUsagePoliciesResponse) []UsagePolicy { + return resp.Policies + } + getNextReq := func(resp *ListUsagePoliciesResponse) *ListUsagePoliciesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Lists all usage policies. Policies are returned in the alphabetically +// ascending order of their names. +func (a *usagePolicyImpl) ListAll(ctx context.Context, request ListUsagePoliciesRequest) ([]UsagePolicy, error) { + iterator := a.List(ctx, request) + return listing.ToSlice[UsagePolicy](ctx, iterator) +} + +func (a *usagePolicyImpl) internalList(ctx context.Context, request ListUsagePoliciesRequest) (*ListUsagePoliciesResponse, error) { + var listUsagePoliciesResponse ListUsagePoliciesResponse + path := fmt.Sprintf("/api/2.1/accounts/%v/usage-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, &listUsagePoliciesResponse) + return &listUsagePoliciesResponse, err +} + +func (a *usagePolicyImpl) Update(ctx context.Context, request UpdateUsagePolicyRequest) (*UsagePolicy, error) { + var usagePolicy UsagePolicy + path := fmt.Sprintf("/api/2.1/accounts/%v/usage-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) + queryParams := make(map[string]any) + + if request.LimitConfig != nil { + queryParams["limit_config"] = request.LimitConfig + } + 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, &usagePolicy) + return &usagePolicy, err +} diff --git a/service/billing/interface.go b/service/billing/interface.go index e251dd3df..4cbd4cb9f 100755 --- a/service/billing/interface.go +++ b/service/billing/interface.go @@ -208,3 +208,25 @@ type UsageDashboardsService interface { // type. Get(ctx context.Context, request GetBillingUsageDashboardRequest) (*GetBillingUsageDashboardResponse, error) } + +// A service serves REST API about Usage policies +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type UsagePolicyService interface { + + // Creates a new usage policy. + Create(ctx context.Context, request CreateUsagePolicyRequest) (*UsagePolicy, error) + + // Deletes a usage policy + Delete(ctx context.Context, request DeleteUsagePolicyRequest) error + + // Retrieves a usage policy by it's ID. + Get(ctx context.Context, request GetUsagePolicyRequest) (*UsagePolicy, error) + + // Lists all usage policies. Policies are returned in the alphabetically + // ascending order of their names. + List(ctx context.Context, request ListUsagePoliciesRequest) (*ListUsagePoliciesResponse, error) + + // Updates a usage policy + Update(ctx context.Context, request UpdateUsagePolicyRequest) (*UsagePolicy, error) +} diff --git a/service/billing/model.go b/service/billing/model.go index 720b1b671..e518222b6 100644 --- a/service/billing/model.go +++ b/service/billing/model.go @@ -539,6 +539,25 @@ func (s CreateLogDeliveryConfigurationParams) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// A request to create a UsagePolicy. +type CreateUsagePolicyRequest struct { + // The policy to create. `policy_id` needs to be empty as it will be + // generated + Policy *UsagePolicy `json:"policy,omitempty"` + // A unique identifier for this request. Restricted to 36 ASCII characters. + RequestId string `json:"request_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateUsagePolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateUsagePolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type DeleteBudgetConfigurationRequest struct { // The Databricks budget configuration ID. BudgetId string `json:"-" url:"-"` @@ -549,6 +568,11 @@ type DeleteBudgetPolicyRequest struct { PolicyId string `json:"-" url:"-"` } +type DeleteUsagePolicyRequest struct { + // The Id of the policy. + PolicyId string `json:"-" url:"-"` +} + // * 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. `USER_FAILURE`: The @@ -718,6 +742,11 @@ type GetLogDeliveryRequest struct { LogDeliveryConfigurationId string `json:"-" url:"-"` } +type GetUsagePolicyRequest struct { + // The Id of the policy. + PolicyId string `json:"-" url:"-"` +} + // The limit configuration of the policy. Limit configuration provide a budget // policy level cost control by enforcing the limit. type LimitConfig struct { @@ -831,6 +860,47 @@ func (s ListLogDeliveryRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListUsagePoliciesRequest struct { + // A filter to apply to the list of policies. + FilterBy *Filter `json:"-" url:"filter_by,omitempty"` + // The maximum number of usage policies to return. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous `ListUsagePolicies` call. + PageToken string `json:"-" url:"page_token,omitempty"` + // The sort specification. + SortSpec *SortSpec `json:"-" url:"sort_spec,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListUsagePoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListUsagePoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// A list of usage policies. +type ListUsagePoliciesResponse struct { + // A token that can be sent as `page_token` to retrieve the next page. + NextPageToken string `json:"next_page_token,omitempty"` + + Policies []UsagePolicy `json:"policies,omitempty"` + // A token that can be sent as `page_token` to retrieve the previous page. + PreviousPageToken string `json:"previous_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListUsagePoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListUsagePoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // * Log Delivery Status // // `ENABLED`: All dependencies have executed and succeeded `DISABLED`: At least @@ -1173,6 +1243,19 @@ type UpdateBudgetPolicyRequest struct { // The Id of the policy. This field is generated by Databricks and globally // unique. PolicyId string `json:"-" url:"-"` + // Field mask specifying which fields to update. When not provided, all + // fields are updated. + UpdateMask string `json:"-" url:"update_mask,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateBudgetPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateBudgetPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // * Update Log Delivery Configuration @@ -1187,6 +1270,18 @@ type UpdateLogDeliveryConfigurationStatusRequest struct { Status LogDeliveryConfigStatus `json:"status"` } +type UpdateUsagePolicyRequest struct { + // DEPRECATED. This is redundant field as LimitConfig is part of the + // UsagePolicy + LimitConfig *LimitConfig `json:"-" url:"limit_config,omitempty"` + // The policy to update. `creator_user_id` cannot be specified in the + // request. + Policy UsagePolicy `json:"policy"` + // The Id of the policy. This field is generated by Databricks and globally + // unique. + PolicyId string `json:"-" url:"-"` +} + type UsageDashboardType string const UsageDashboardTypeUsageDashboardTypeGlobal UsageDashboardType = `USAGE_DASHBOARD_TYPE_GLOBAL` @@ -1224,6 +1319,30 @@ func (f *UsageDashboardType) Type() string { return "UsageDashboardType" } +// Contains the UsagePolicy details (same structure as BudgetPolicy) +type UsagePolicy struct { + // List of workspaces that this usage policy will be exclusively bound to. + BindingWorkspaceIds []int64 `json:"binding_workspace_ids,omitempty"` + // 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,omitempty"` + // The name of the policy. + PolicyName string `json:"policy_name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UsagePolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UsagePolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // * Properties of the new log delivery configuration. type WrappedCreateLogDeliveryConfiguration struct { LogDeliveryConfiguration CreateLogDeliveryConfigurationParams `json:"log_delivery_configuration"` diff --git a/service/catalog/model.go b/service/catalog/model.go index a5468c58a..8d2b2195c 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -516,10 +516,14 @@ type CatalogInfo struct { Comment string `json:"comment,omitempty"` // The name of the connection to an external data source. ConnectionName string `json:"connection_name,omitempty"` + // Status of conversion of FOREIGN catalog to UC Native catalog. + ConversionInfo *ConversionInfo `json:"conversion_info,omitempty"` // Time at which this catalog was created, in epoch milliseconds. CreatedAt int64 `json:"created_at,omitempty"` // Username of catalog creator. CreatedBy string `json:"created_by,omitempty"` + // Disaster Recovery replication state snapshot. + DrReplicationInfo *DrReplicationInfo `json:"dr_replication_info,omitempty"` EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` // Whether predictive optimization should be enabled for this object and @@ -892,6 +896,9 @@ type ConnectionInfo struct { CreatedBy string `json:"created_by,omitempty"` // The type of credential. CredentialType CredentialType `json:"credential_type,omitempty"` + // [Create,Update:OPT] Connection environment settings as + // EnvironmentSettings object. + EnvironmentSettings *EnvironmentSettings `json:"environment_settings,omitempty"` // Full name of connection. FullName string `json:"full_name,omitempty"` // Unique identifier of parent metastore. @@ -928,7 +935,7 @@ func (s ConnectionInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Next Id: 38 +// Next Id: 46 type ConnectionType string const ConnectionTypeBigquery ConnectionType = `BIGQUERY` @@ -1047,6 +1054,49 @@ func (s ContinuousUpdateStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Status of conversion of FOREIGN entity into UC Native entity. +type ConversionInfo struct { + // The conversion state of the resource. + State ConversionInfoState `json:"state,omitempty"` +} + +type ConversionInfoState string + +const ConversionInfoStateCompleted ConversionInfoState = `COMPLETED` + +const ConversionInfoStateInProgress ConversionInfoState = `IN_PROGRESS` + +// String representation for [fmt.Print] +func (f *ConversionInfoState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ConversionInfoState) Set(v string) error { + switch v { + case `COMPLETED`, `IN_PROGRESS`: + *f = ConversionInfoState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "COMPLETED", "IN_PROGRESS"`, v) + } +} + +// Values returns all possible values for ConversionInfoState. +// +// There is no guarantee on the order of the values in the slice. +func (f *ConversionInfoState) Values() []ConversionInfoState { + return []ConversionInfoState{ + ConversionInfoStateCompleted, + ConversionInfoStateInProgress, + } +} + +// Type always returns ConversionInfoState to satisfy [pflag.Value] interface +func (f *ConversionInfoState) Type() string { + return "ConversionInfoState" +} + type CreateAccessRequest struct { // Optional. The principal this request is for. Empty `behalf_of` defaults // to the requester's identity. @@ -1138,6 +1188,10 @@ type CreateCatalog struct { Comment string `json:"comment,omitempty"` // The name of the connection to an external data source. ConnectionName string `json:"connection_name,omitempty"` + // Status of conversion of FOREIGN catalog to UC Native catalog. + ConversionInfo *ConversionInfo `json:"conversion_info,omitempty"` + // Disaster Recovery replication state snapshot. + DrReplicationInfo *DrReplicationInfo `json:"dr_replication_info,omitempty"` // Name of catalog. Name string `json:"name"` // A map of key-value properties attached to the securable. @@ -1170,6 +1224,9 @@ type CreateConnection struct { Comment string `json:"comment,omitempty"` // The type of connection. ConnectionType ConnectionType `json:"connection_type"` + // [Create,Update:OPT] Connection environment settings as + // EnvironmentSettings object. + EnvironmentSettings *EnvironmentSettings `json:"environment_settings,omitempty"` // Name of the connection. Name string `json:"name"` // A map of key-value properties attached to the securable. @@ -1867,7 +1924,7 @@ func (f *CredentialPurpose) Type() string { return "CredentialPurpose" } -// Next Id: 13 +// Next Id: 14 type CredentialType string const CredentialTypeAnyStaticCredential CredentialType = `ANY_STATIC_CREDENTIAL` @@ -1878,6 +1935,8 @@ const CredentialTypeOauthAccessToken CredentialType = `OAUTH_ACCESS_TOKEN` const CredentialTypeOauthM2m CredentialType = `OAUTH_M2M` +const CredentialTypeOauthMtls CredentialType = `OAUTH_MTLS` + const CredentialTypeOauthRefreshToken CredentialType = `OAUTH_REFRESH_TOKEN` const CredentialTypeOauthResourceOwnerPassword CredentialType = `OAUTH_RESOURCE_OWNER_PASSWORD` @@ -1904,11 +1963,11 @@ func (f *CredentialType) String() string { // Set raw string value and validate it against allowed values func (f *CredentialType) Set(v string) error { switch v { - case `ANY_STATIC_CREDENTIAL`, `BEARER_TOKEN`, `OAUTH_ACCESS_TOKEN`, `OAUTH_M2M`, `OAUTH_REFRESH_TOKEN`, `OAUTH_RESOURCE_OWNER_PASSWORD`, `OAUTH_U2M`, `OAUTH_U2M_MAPPING`, `OIDC_TOKEN`, `PEM_PRIVATE_KEY`, `SERVICE_CREDENTIAL`, `UNKNOWN_CREDENTIAL_TYPE`, `USERNAME_PASSWORD`: + case `ANY_STATIC_CREDENTIAL`, `BEARER_TOKEN`, `OAUTH_ACCESS_TOKEN`, `OAUTH_M2M`, `OAUTH_MTLS`, `OAUTH_REFRESH_TOKEN`, `OAUTH_RESOURCE_OWNER_PASSWORD`, `OAUTH_U2M`, `OAUTH_U2M_MAPPING`, `OIDC_TOKEN`, `PEM_PRIVATE_KEY`, `SERVICE_CREDENTIAL`, `UNKNOWN_CREDENTIAL_TYPE`, `USERNAME_PASSWORD`: *f = CredentialType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "ANY_STATIC_CREDENTIAL", "BEARER_TOKEN", "OAUTH_ACCESS_TOKEN", "OAUTH_M2M", "OAUTH_REFRESH_TOKEN", "OAUTH_RESOURCE_OWNER_PASSWORD", "OAUTH_U2M", "OAUTH_U2M_MAPPING", "OIDC_TOKEN", "PEM_PRIVATE_KEY", "SERVICE_CREDENTIAL", "UNKNOWN_CREDENTIAL_TYPE", "USERNAME_PASSWORD"`, v) + return fmt.Errorf(`value "%s" is not one of "ANY_STATIC_CREDENTIAL", "BEARER_TOKEN", "OAUTH_ACCESS_TOKEN", "OAUTH_M2M", "OAUTH_MTLS", "OAUTH_REFRESH_TOKEN", "OAUTH_RESOURCE_OWNER_PASSWORD", "OAUTH_U2M", "OAUTH_U2M_MAPPING", "OIDC_TOKEN", "PEM_PRIVATE_KEY", "SERVICE_CREDENTIAL", "UNKNOWN_CREDENTIAL_TYPE", "USERNAME_PASSWORD"`, v) } } @@ -1921,6 +1980,7 @@ func (f *CredentialType) Values() []CredentialType { CredentialTypeBearerToken, CredentialTypeOauthAccessToken, CredentialTypeOauthM2m, + CredentialTypeOauthMtls, CredentialTypeOauthRefreshToken, CredentialTypeOauthResourceOwnerPassword, CredentialTypeOauthU2m, @@ -2515,6 +2575,48 @@ type DisableRequest struct { SchemaName string `json:"-" url:"-"` } +// Metadata related to Disaster Recovery. +type DrReplicationInfo struct { + Status DrReplicationStatus `json:"status,omitempty"` +} + +type DrReplicationStatus string + +const DrReplicationStatusDrReplicationStatusPrimary DrReplicationStatus = `DR_REPLICATION_STATUS_PRIMARY` + +const DrReplicationStatusDrReplicationStatusSecondary DrReplicationStatus = `DR_REPLICATION_STATUS_SECONDARY` + +// String representation for [fmt.Print] +func (f *DrReplicationStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DrReplicationStatus) Set(v string) error { + switch v { + case `DR_REPLICATION_STATUS_PRIMARY`, `DR_REPLICATION_STATUS_SECONDARY`: + *f = DrReplicationStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DR_REPLICATION_STATUS_PRIMARY", "DR_REPLICATION_STATUS_SECONDARY"`, v) + } +} + +// Values returns all possible values for DrReplicationStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *DrReplicationStatus) Values() []DrReplicationStatus { + return []DrReplicationStatus{ + DrReplicationStatusDrReplicationStatusPrimary, + DrReplicationStatusDrReplicationStatusSecondary, + } +} + +// Type always returns DrReplicationStatus to satisfy [pflag.Value] interface +func (f *DrReplicationStatus) Type() string { + return "DrReplicationStatus" +} + type EffectivePermissionsList struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next @@ -2723,6 +2825,22 @@ func (s EntityTagAssignment) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type EnvironmentSettings struct { + EnvironmentVersion string `json:"environment_version,omitempty"` + + JavaDependencies []string `json:"java_dependencies,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *EnvironmentSettings) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s EnvironmentSettings) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ExistsRequest struct { // Full name of the table. FullName string `json:"-" url:"-"` @@ -3533,6 +3651,8 @@ type GenerateTemporaryPathCredentialResponse struct { GcpOauthToken *GcpOauthToken `json:"gcp_oauth_token,omitempty"` R2TempCredentials *R2Credentials `json:"r2_temp_credentials,omitempty"` + + UcEncryptedToken *UcEncryptedToken `json:"uc_encrypted_token,omitempty"` // The URL of the storage path accessible by the temporary credential. Url string `json:"url,omitempty"` @@ -3604,6 +3724,8 @@ type GenerateTemporaryTableCredentialResponse struct { GcpOauthToken *GcpOauthToken `json:"gcp_oauth_token,omitempty"` R2TempCredentials *R2Credentials `json:"r2_temp_credentials,omitempty"` + + UcEncryptedToken *UcEncryptedToken `json:"uc_encrypted_token,omitempty"` // The URL of the storage path accessible by the temporary credential. Url string `json:"url,omitempty"` @@ -3816,6 +3938,9 @@ func (s GetFunctionRequest) MarshalJSON() ([]byte, error) { type GetGrantRequest struct { // Full name of securable. FullName string `json:"-" url:"-"` + // Optional. If true, also return privilege assignments whose principals + // have been deleted. + IncludeDeletedPrincipals bool `json:"-" url:"include_deleted_principals,omitempty"` // Specifies the maximum number of privileges to return (page length). Every // PrivilegeAssignment present in a single page response is guaranteed to // contain all the privileges granted on the requested Securable for the @@ -6160,6 +6285,16 @@ type PermissionsChange struct { // The principal whose privileges we are changing. Only one of principal or // principal_id should be specified, never both at the same time. Principal string `json:"principal,omitempty"` + // An opaque internal ID that identifies the principal whose privileges + // should be removed. + // + // This field is intended for removing privileges associated with a deleted + // user. When set, only the entries specified in the remove field are + // processed; any entries in the add field will be rejected. + // + // Only one of principal or principal_id should be specified, never both at + // the same time. + PrincipalId int64 `json:"principal_id,omitempty"` // The set of privileges to remove. Remove []Privilege `json:"remove,omitempty"` @@ -6564,6 +6699,9 @@ type PrivilegeAssignment struct { // The principal (user email address or group name). For deleted principals, // `principal` is empty while `principal_id` is populated. Principal string `json:"principal,omitempty"` + // Unique identifier of the principal. For active principals, both + // `principal` and `principal_id` are present. + PrincipalId int64 `json:"principal_id,omitempty"` // The privileges assigned to the principal. Privileges []Privilege `json:"privileges,omitempty"` @@ -6832,7 +6970,7 @@ type RunRefreshRequest struct { TableName string `json:"-" url:"-"` } -// Next ID: 40 +// Next ID: 42 type SchemaInfo struct { // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is @@ -6909,7 +7047,7 @@ func (s Securable) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Latest kind: CONNECTION_REDSHIFT_IAM = 265; Next id:266 +// Latest kind: CONNECTION_SALESFORCE_OAUTH_MTLS = 268; Next id:269 type SecurableKind string const SecurableKindTableDbStorage SecurableKind = `TABLE_DB_STORAGE` @@ -7843,6 +7981,24 @@ func (s TriggeredUpdateStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Encrypted token used when we cannot downscope the cloud provider token +// appropriately See: +// https://docs.google.com/document/d/1hEKDnSckuU5PIS798CtfqBElrMR6OJuR2wgz_BjhMSY +type UcEncryptedToken struct { + // Stores encrypted ScopedCloudToken + EncryptedPayload string `json:"encrypted_payload,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UcEncryptedToken) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UcEncryptedToken) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type UnassignRequest struct { // Query for the ID of the metastore to delete. MetastoreId string `json:"-" url:"metastore_id"` @@ -7932,6 +8088,10 @@ func (s UpdateAccountsStorageCredential) MarshalJSON() ([]byte, error) { type UpdateCatalog struct { // User-provided free-form text description. Comment string `json:"comment,omitempty"` + // Status of conversion of FOREIGN catalog to UC Native catalog. + ConversionInfo *ConversionInfo `json:"conversion_info,omitempty"` + // Disaster Recovery replication state snapshot. + DrReplicationInfo *DrReplicationInfo `json:"dr_replication_info,omitempty"` // Whether predictive optimization should be enabled for this object and // objects under it. EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` @@ -7966,6 +8126,9 @@ type UpdateCatalogWorkspaceBindingsResponse struct { } type UpdateConnection struct { + // [Create,Update:OPT] Connection environment settings as + // EnvironmentSettings object. + EnvironmentSettings *EnvironmentSettings `json:"environment_settings,omitempty"` // Name of the connection. Name string `json:"-" url:"-"` // New name for the connection. diff --git a/service/compute/api.go b/service/compute/api.go index ec56e450a..57a2714d4 100755 --- a/service/compute/api.go +++ b/service/compute/api.go @@ -1999,14 +1999,64 @@ type LibrariesInterface interface { // particular order, are returned last. ClusterStatusByClusterId(ctx context.Context, clusterId string) (*ClusterLibraryStatuses, error) + // Create a default base environment within workspaces to define the environment + // version and a list of dependencies to be used in serverless notebooks and + // jobs. This process will asynchronously generate a cache to optimize + // dependency resolution. + CreateDefaultBaseEnvironment(ctx context.Context, request CreateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Delete the default base environment given an ID. The default base environment + // may be used by downstream workloads. Please ensure that the deletion is + // intentional. + DeleteDefaultBaseEnvironment(ctx context.Context, request DeleteDefaultBaseEnvironmentRequest) error + + // Delete the default base environment given an ID. The default base environment + // may be used by downstream workloads. Please ensure that the deletion is + // intentional. + DeleteDefaultBaseEnvironmentById(ctx context.Context, id string) error + + // Return the default base environment details for a given ID. + GetDefaultBaseEnvironment(ctx context.Context, request GetDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + // Add libraries to install on a cluster. The installation is asynchronous; it // happens in the background after the completion of this request. Install(ctx context.Context, request InstallLibraries) error + // List default base environments defined in the workspaces for the requested + // user. + // + // This method is generated by Databricks SDK Code Generator. + ListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) listing.Iterator[DefaultBaseEnvironment] + + // List default base environments defined in the workspaces for the requested + // user. + // + // This method is generated by Databricks SDK Code Generator. + ListDefaultBaseEnvironmentsAll(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) ([]DefaultBaseEnvironment, error) + + // Refresh the cached default base environments for the given IDs. This process + // will asynchronously regenerate the caches. The existing caches remains + // available until it expires. + RefreshDefaultBaseEnvironments(ctx context.Context, request RefreshDefaultBaseEnvironmentsRequest) error + + // Refresh the cached default base environments for the given IDs. This process + // will asynchronously regenerate the caches. The existing caches remains + // available until it expires. + RefreshDefaultBaseEnvironmentsByIds(ctx context.Context, ids []string) error + // Set libraries to uninstall from a cluster. The libraries won't be uninstalled // until the cluster is restarted. A request to uninstall a library that is not // currently installed is ignored. Uninstall(ctx context.Context, request UninstallLibraries) error + + // Update the default base environment for the given ID. This process will + // asynchronously regenerate the cache. The existing cache remains available + // until it expires. + UpdateDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Set the default base environment for the workspace. This marks the specified + // DBE as the workspace default. + UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) } func NewLibraries(client *client.DatabricksClient) *LibrariesAPI { @@ -2050,6 +2100,24 @@ func (a *LibrariesAPI) ClusterStatusByClusterId(ctx context.Context, clusterId s }) } +// Delete the default base environment given an ID. The default base environment +// may be used by downstream workloads. Please ensure that the deletion is +// intentional. +func (a *LibrariesAPI) DeleteDefaultBaseEnvironmentById(ctx context.Context, id string) error { + return a.librariesImpl.DeleteDefaultBaseEnvironment(ctx, DeleteDefaultBaseEnvironmentRequest{ + Id: id, + }) +} + +// Refresh the cached default base environments for the given IDs. This process +// will asynchronously regenerate the caches. The existing caches remains +// available until it expires. +func (a *LibrariesAPI) RefreshDefaultBaseEnvironmentsByIds(ctx context.Context, ids []string) error { + return a.librariesImpl.RefreshDefaultBaseEnvironments(ctx, RefreshDefaultBaseEnvironmentsRequest{ + Ids: ids, + }) +} + type PolicyComplianceForClustersInterface interface { // Updates a cluster to be compliant with the current version of its policy. A diff --git a/service/compute/impl.go b/service/compute/impl.go index d41f7f64c..cce75a8d4 100755 --- a/service/compute/impl.go +++ b/service/compute/impl.go @@ -10,6 +10,7 @@ import ( "github.com/databricks/databricks-sdk-go/client" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" + "github.com/google/uuid" ) // unexported type that holds implementations of just ClusterPolicies API methods @@ -869,6 +870,39 @@ func (a *librariesImpl) internalClusterStatus(ctx context.Context, request Clust return &clusterLibraryStatuses, err } +func (a *librariesImpl) CreateDefaultBaseEnvironment(ctx context.Context, request CreateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + if request.RequestId == "" { + request.RequestId = uuid.New().String() + } + path := "/api/2.0/default-base-environments" + 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, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + +func (a *librariesImpl) DeleteDefaultBaseEnvironment(ctx context.Context, request DeleteDefaultBaseEnvironmentRequest) error { + path := fmt.Sprintf("/api/2.0/default-base-environments/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *librariesImpl) GetDefaultBaseEnvironment(ctx context.Context, request GetDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + path := "/api/2.0/default-base-environments:getDefaultBaseEnvironment" + 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, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + func (a *librariesImpl) Install(ctx context.Context, request InstallLibraries) error { path := "/api/2.0/libraries/install" queryParams := make(map[string]any) @@ -879,6 +913,59 @@ func (a *librariesImpl) Install(ctx context.Context, request InstallLibraries) e return err } +// List default base environments defined in the workspaces for the requested +// user. +func (a *librariesImpl) ListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) listing.Iterator[DefaultBaseEnvironment] { + + getNextPage := func(ctx context.Context, req ListDefaultBaseEnvironmentsRequest) (*ListDefaultBaseEnvironmentsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListDefaultBaseEnvironments(ctx, req) + } + getItems := func(resp *ListDefaultBaseEnvironmentsResponse) []DefaultBaseEnvironment { + return resp.DefaultBaseEnvironments + } + getNextReq := func(resp *ListDefaultBaseEnvironmentsResponse) *ListDefaultBaseEnvironmentsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List default base environments defined in the workspaces for the requested +// user. +func (a *librariesImpl) ListDefaultBaseEnvironmentsAll(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) ([]DefaultBaseEnvironment, error) { + iterator := a.ListDefaultBaseEnvironments(ctx, request) + return listing.ToSlice[DefaultBaseEnvironment](ctx, iterator) +} + +func (a *librariesImpl) internalListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) (*ListDefaultBaseEnvironmentsResponse, error) { + var listDefaultBaseEnvironmentsResponse ListDefaultBaseEnvironmentsResponse + path := "/api/2.0/default-base-environments" + 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, &listDefaultBaseEnvironmentsResponse) + return &listDefaultBaseEnvironmentsResponse, err +} + +func (a *librariesImpl) RefreshDefaultBaseEnvironments(ctx context.Context, request RefreshDefaultBaseEnvironmentsRequest) error { + path := "/api/2.0/default-base-environments/refresh" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) + return err +} + func (a *librariesImpl) Uninstall(ctx context.Context, request UninstallLibraries) error { path := "/api/2.0/libraries/uninstall" queryParams := make(map[string]any) @@ -889,6 +976,28 @@ func (a *librariesImpl) Uninstall(ctx context.Context, request UninstallLibrarie return err } +func (a *librariesImpl) UpdateDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + path := fmt.Sprintf("/api/2.0/default-base-environments/%v", request.Id) + 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, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + +func (a *librariesImpl) UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + path := "/api/2.0/default-base-environments:setDefault" + 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, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + // unexported type that holds implementations of just PolicyComplianceForClusters API methods type policyComplianceForClustersImpl struct { client *client.DatabricksClient diff --git a/service/compute/interface.go b/service/compute/interface.go index 71a8405b4..aec7ea425 100755 --- a/service/compute/interface.go +++ b/service/compute/interface.go @@ -442,14 +442,46 @@ type LibrariesService interface { // removal, in no particular order, are returned last. ClusterStatus(ctx context.Context, request ClusterStatus) (*ClusterLibraryStatuses, error) + // Create a default base environment within workspaces to define the + // environment version and a list of dependencies to be used in serverless + // notebooks and jobs. This process will asynchronously generate a cache to + // optimize dependency resolution. + CreateDefaultBaseEnvironment(ctx context.Context, request CreateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Delete the default base environment given an ID. The default base + // environment may be used by downstream workloads. Please ensure that the + // deletion is intentional. + DeleteDefaultBaseEnvironment(ctx context.Context, request DeleteDefaultBaseEnvironmentRequest) error + + // Return the default base environment details for a given ID. + GetDefaultBaseEnvironment(ctx context.Context, request GetDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + // Add libraries to install on a cluster. The installation is asynchronous; // it happens in the background after the completion of this request. Install(ctx context.Context, request InstallLibraries) error + // List default base environments defined in the workspaces for the + // requested user. + ListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) (*ListDefaultBaseEnvironmentsResponse, error) + + // Refresh the cached default base environments for the given IDs. This + // process will asynchronously regenerate the caches. The existing caches + // remains available until it expires. + RefreshDefaultBaseEnvironments(ctx context.Context, request RefreshDefaultBaseEnvironmentsRequest) error + // Set libraries to uninstall from a cluster. The libraries won't be // uninstalled until the cluster is restarted. A request to uninstall a // library that is not currently installed is ignored. Uninstall(ctx context.Context, request UninstallLibraries) error + + // Update the default base environment for the given ID. This process will + // asynchronously regenerate the cache. The existing cache remains available + // until it expires. + UpdateDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Set the default base environment for the workspace. This marks the + // specified DBE as the workspace default. + UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) } // The policy compliance APIs allow you to view and manage the policy compliance diff --git a/service/compute/model.go b/service/compute/model.go index 2dbf4d5ed..a0cce5418 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -287,6 +287,45 @@ func (f *AzureAvailability) Type() string { return "AzureAvailability" } +// If changed, also update +// estore/namespaces/defaultbaseenvironments/latest.proto +type BaseEnvironmentType string + +const BaseEnvironmentTypeCpu BaseEnvironmentType = `CPU` + +const BaseEnvironmentTypeGpu BaseEnvironmentType = `GPU` + +// String representation for [fmt.Print] +func (f *BaseEnvironmentType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *BaseEnvironmentType) Set(v string) error { + switch v { + case `CPU`, `GPU`: + *f = BaseEnvironmentType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CPU", "GPU"`, v) + } +} + +// Values returns all possible values for BaseEnvironmentType. +// +// There is no guarantee on the order of the values in the slice. +func (f *BaseEnvironmentType) Values() []BaseEnvironmentType { + return []BaseEnvironmentType{ + BaseEnvironmentTypeCpu, + BaseEnvironmentTypeGpu, + } +} + +// Type always returns BaseEnvironmentType to satisfy [pflag.Value] interface +func (f *BaseEnvironmentType) Type() string { + return "BaseEnvironmentType" +} + type CancelCommand struct { ClusterId string `json:"clusterId,omitempty"` @@ -1762,6 +1801,23 @@ func (s CreateContext) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateDefaultBaseEnvironmentRequest struct { + DefaultBaseEnvironment DefaultBaseEnvironment `json:"default_base_environment"` + // A unique identifier for this request. 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:"-" url:"-"` +} + +func (s *CreateDefaultBaseEnvironmentRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateDefaultBaseEnvironmentRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type CreateInstancePool struct { // Attributes related to instance pools running on Amazon Web Services. If // not specified at pool creation, a set of default values will be used. @@ -1778,6 +1834,10 @@ type CreateInstancePool struct { // Defines the specification of the disks that will be attached to all spark // containers. DiskSpec *DiskSpec `json:"disk_spec,omitempty"` + // For pools with node type flexibility (Fleet-V2), whether auto generated + // alternate node type ids are enabled. This field should not be true if + // node_type_flexibility is set. + EnableAutoAlternateNodeTypes bool `json:"enable_auto_alternate_node_types,omitempty"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS @@ -1804,6 +1864,11 @@ type CreateInstancePool struct { MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool MinIdleInstances int `json:"min_idle_instances,omitempty"` + // For pools with node type flexibility (Fleet-V2), this object contains the + // information about the alternate node type ids to use when attempting to + // launch a cluster if the node type id is not available. This field should + // not be set if enable_auto_alternate_node_types is true. + NodeTypeFlexibility *NodeTypeFlexibility `json:"node_type_flexibility,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -2131,11 +2196,125 @@ type DbfsStorageInfo struct { Destination string `json:"destination"` } +type DefaultBaseEnvironment struct { + BaseEnvironmentCache []DefaultBaseEnvironmentCache `json:"base_environment_cache,omitempty"` + + BaseEnvironmentType BaseEnvironmentType `json:"base_environment_type,omitempty"` + + CreatedTimestamp int64 `json:"created_timestamp,omitempty"` + + CreatorUserId int64 `json:"creator_user_id,omitempty"` + // Note: we made `environment` non-internal because we need to expose its + // `client` field. All other fields should be treated as internal. + Environment *Environment `json:"environment,omitempty"` + + Filepath string `json:"filepath,omitempty"` + + Id string `json:"id,omitempty"` + + IsDefault bool `json:"is_default,omitempty"` + + LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` + + LastUpdatedUserId int64 `json:"last_updated_user_id,omitempty"` + + Message string `json:"message,omitempty"` + + Name string `json:"name,omitempty"` + + PrincipalIds []int64 `json:"principal_ids,omitempty"` + + Status DefaultBaseEnvironmentCacheStatus `json:"status,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DefaultBaseEnvironment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DefaultBaseEnvironment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DefaultBaseEnvironmentCache struct { + IndefiniteMaterializedEnvironment *MaterializedEnvironment `json:"indefinite_materialized_environment,omitempty"` + + MaterializedEnvironment *MaterializedEnvironment `json:"materialized_environment,omitempty"` + + Message string `json:"message,omitempty"` + + Status DefaultBaseEnvironmentCacheStatus `json:"status,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DefaultBaseEnvironmentCache) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DefaultBaseEnvironmentCache) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DefaultBaseEnvironmentCacheStatus string + +const DefaultBaseEnvironmentCacheStatusCreated DefaultBaseEnvironmentCacheStatus = `CREATED` + +const DefaultBaseEnvironmentCacheStatusExpired DefaultBaseEnvironmentCacheStatus = `EXPIRED` + +const DefaultBaseEnvironmentCacheStatusFailed DefaultBaseEnvironmentCacheStatus = `FAILED` + +const DefaultBaseEnvironmentCacheStatusInvalid DefaultBaseEnvironmentCacheStatus = `INVALID` + +const DefaultBaseEnvironmentCacheStatusPending DefaultBaseEnvironmentCacheStatus = `PENDING` + +const DefaultBaseEnvironmentCacheStatusRefreshing DefaultBaseEnvironmentCacheStatus = `REFRESHING` + +// String representation for [fmt.Print] +func (f *DefaultBaseEnvironmentCacheStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DefaultBaseEnvironmentCacheStatus) Set(v string) error { + switch v { + case `CREATED`, `EXPIRED`, `FAILED`, `INVALID`, `PENDING`, `REFRESHING`: + *f = DefaultBaseEnvironmentCacheStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CREATED", "EXPIRED", "FAILED", "INVALID", "PENDING", "REFRESHING"`, v) + } +} + +// Values returns all possible values for DefaultBaseEnvironmentCacheStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *DefaultBaseEnvironmentCacheStatus) Values() []DefaultBaseEnvironmentCacheStatus { + return []DefaultBaseEnvironmentCacheStatus{ + DefaultBaseEnvironmentCacheStatusCreated, + DefaultBaseEnvironmentCacheStatusExpired, + DefaultBaseEnvironmentCacheStatusFailed, + DefaultBaseEnvironmentCacheStatusInvalid, + DefaultBaseEnvironmentCacheStatusPending, + DefaultBaseEnvironmentCacheStatusRefreshing, + } +} + +// Type always returns DefaultBaseEnvironmentCacheStatus to satisfy [pflag.Value] interface +func (f *DefaultBaseEnvironmentCacheStatus) Type() string { + return "DefaultBaseEnvironmentCacheStatus" +} + type DeleteCluster struct { // The cluster to be terminated. ClusterId string `json:"cluster_id"` } +type DeleteDefaultBaseEnvironmentRequest struct { + Id string `json:"-" url:"-"` +} + type DeleteGlobalInitScriptRequest struct { // The ID of the global init script. ScriptId string `json:"-" url:"-"` @@ -2541,6 +2720,10 @@ type EditInstancePool struct { // // - Currently, Databricks allows at most 45 custom tags CustomTags map[string]string `json:"custom_tags,omitempty"` + // For pools with node type flexibility (Fleet-V2), whether auto generated + // alternate node type ids are enabled. This field should not be true if + // node_type_flexibility is set. + EnableAutoAlternateNodeTypes bool `json:"enable_auto_alternate_node_types,omitempty"` // Automatically terminates the extra instances in the pool cache after they // are inactive for this time in minutes if min_idle_instances requirement // is already met. If not set, the extra pool instances will be @@ -2560,6 +2743,11 @@ type EditInstancePool struct { MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool MinIdleInstances int `json:"min_idle_instances,omitempty"` + // For pools with node type flexibility (Fleet-V2), this object contains the + // information about the alternate node type ids to use when attempting to + // launch a cluster if the node type id is not available. This field should + // not be set if enable_auto_alternate_node_types is true. + NodeTypeFlexibility *NodeTypeFlexibility `json:"node_type_flexibility,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -3099,6 +3287,22 @@ type GetClusterRequest struct { ClusterId string `json:"-" url:"cluster_id"` } +type GetDefaultBaseEnvironmentRequest struct { + Id string `json:"-" url:"id"` + // Deprecated: use ctx.requestId instead + TraceId string `json:"-" url:"trace_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GetDefaultBaseEnvironmentRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GetDefaultBaseEnvironmentRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GetEvents struct { // The ID of the cluster to retrieve events about. ClusterId string `json:"cluster_id"` @@ -3247,6 +3451,10 @@ type GetInstancePool struct { // Defines the specification of the disks that will be attached to all spark // containers. DiskSpec *DiskSpec `json:"disk_spec,omitempty"` + // For pools with node type flexibility (Fleet-V2), whether auto generated + // alternate node type ids are enabled. This field should not be true if + // node_type_flexibility is set. + EnableAutoAlternateNodeTypes bool `json:"enable_auto_alternate_node_types,omitempty"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS @@ -3275,6 +3483,11 @@ type GetInstancePool struct { MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool MinIdleInstances int `json:"min_idle_instances,omitempty"` + // For pools with node type flexibility (Fleet-V2), this object contains the + // information about the alternate node type ids to use when attempting to + // launch a cluster if the node type id is not available. This field should + // not be set if enable_auto_alternate_node_types is true. + NodeTypeFlexibility *NodeTypeFlexibility `json:"node_type_flexibility,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -3714,6 +3927,10 @@ type InstancePoolAndStats struct { // Defines the specification of the disks that will be attached to all spark // containers. DiskSpec *DiskSpec `json:"disk_spec,omitempty"` + // For pools with node type flexibility (Fleet-V2), whether auto generated + // alternate node type ids are enabled. This field should not be true if + // node_type_flexibility is set. + EnableAutoAlternateNodeTypes bool `json:"enable_auto_alternate_node_types,omitempty"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS @@ -3742,6 +3959,11 @@ type InstancePoolAndStats struct { MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool MinIdleInstances int `json:"min_idle_instances,omitempty"` + // For pools with node type flexibility (Fleet-V2), this object contains the + // information about the alternate node type ids to use when attempting to + // launch a cluster if the node type id is not available. This field should + // not be set if enable_auto_alternate_node_types is true. + NodeTypeFlexibility *NodeTypeFlexibility `json:"node_type_flexibility,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -3784,6 +4006,17 @@ func (s InstancePoolAndStats) MarshalJSON() ([]byte, error) { type InstancePoolAwsAttributes struct { // Availability type used for the spot nodes. Availability InstancePoolAwsAttributesAvailability `json:"availability,omitempty"` + // All AWS instances belonging to the instance pool will have this instance + // profile. If omitted, instances will initially be launched with the + // workspace's default instance profile. If defined, clusters that use the + // pool will inherit the instance profile, and must not specify their own + // instance profile on cluster creation or update. If the pool does not + // specify an instance profile, clusters using the pool may specify any + // instance profile. The instance profile must have previously been added to + // the Databricks environment by an account administrator. + // + // This feature may only be available to certain customer plans. + InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // Calculates the bid price for AWS spot instances, as a percentage of the // corresponding instance type's on-demand price. For example, if this field // is set to 50, and the cluster needs a new `r3.xlarge` spot instance, then @@ -4603,6 +4836,38 @@ func (f *ListClustersSortByField) Type() string { return "ListClustersSortByField" } +type ListDefaultBaseEnvironmentsRequest struct { + PageSize int `json:"-" url:"page_size,omitempty"` + + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDefaultBaseEnvironmentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDefaultBaseEnvironmentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListDefaultBaseEnvironmentsResponse struct { + DefaultBaseEnvironments []DefaultBaseEnvironment `json:"default_base_environments,omitempty"` + + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDefaultBaseEnvironmentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDefaultBaseEnvironmentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListGlobalInitScriptsResponse struct { Scripts []GlobalInitScriptDetails `json:"scripts,omitempty"` } @@ -4778,6 +5043,36 @@ func (s LogSyncStatus) MarshalJSON() ([]byte, error) { type MapAny map[string]any +// Materialized Environment information enables environment sharing and reuse +// via Environment Caching during library installations. Currently this feature +// is only supported for Python libraries. +// +// - If the env cache entry in LMv2 DB doesn't exist or invalid, library +// installations and environment materialization will occur. A new Materialized +// Environment metadata will be sent from DP upon successful library +// installations and env materialization, and is persisted into database by +// LMv2. - If the env cache entry in LMv2 DB is valid, the Materialized +// Environment will be sent to DP by LMv2, and DP will restore the cached +// environment from a store instead of reinstalling libraries from scratch. +// +// If changed, also update +// estore/namespaces/defaultbaseenvironments/latest.proto with new version +type MaterializedEnvironment struct { + // The timestamp (in epoch milliseconds) when the materialized env is + // updated. + LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *MaterializedEnvironment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s MaterializedEnvironment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type MavenLibrary struct { // Gradle-style maven coordinates. For example: "org.jsoup:jsoup:1.7.2". Coordinates string `json:"coordinates"` @@ -4894,6 +5189,12 @@ func (s NodeType) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// For Fleet-V2 using classic clusters, this object contains the information +// about the alternate node type ids to use when attempting to launch a cluster. +// It can be used with both the driver and worker node types. +type NodeTypeFlexibility struct { +} + // Error message of a failed pending instances type PendingInstanceError struct { InstanceId string `json:"instance_id,omitempty"` @@ -5041,6 +5342,10 @@ func (s RCranLibrary) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type RefreshDefaultBaseEnvironmentsRequest struct { + Ids []string `json:"ids"` +} + type RemoveInstanceProfile struct { // The ARN of the instance profile to remove. This field is required. InstanceProfileArn string `json:"instance_profile_arn"` @@ -5664,16 +5969,28 @@ const TerminationReasonCodeNetvisorSetupTimeout TerminationReasonCode = `NETVISO const TerminationReasonCodeNetworkCheckControlPlaneFailure TerminationReasonCode = `NETWORK_CHECK_CONTROL_PLANE_FAILURE` +const TerminationReasonCodeNetworkCheckControlPlaneFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_CONTROL_PLANE_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkCheckDnsServerFailure TerminationReasonCode = `NETWORK_CHECK_DNS_SERVER_FAILURE` +const TerminationReasonCodeNetworkCheckDnsServerFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_DNS_SERVER_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkCheckMetadataEndpointFailure TerminationReasonCode = `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE` +const TerminationReasonCodeNetworkCheckMetadataEndpointFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkCheckMultipleComponentsFailure TerminationReasonCode = `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE` +const TerminationReasonCodeNetworkCheckMultipleComponentsFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkCheckNicFailure TerminationReasonCode = `NETWORK_CHECK_NIC_FAILURE` +const TerminationReasonCodeNetworkCheckNicFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_NIC_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkCheckStorageFailure TerminationReasonCode = `NETWORK_CHECK_STORAGE_FAILURE` +const TerminationReasonCodeNetworkCheckStorageFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_STORAGE_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkConfigurationFailure TerminationReasonCode = `NETWORK_CONFIGURATION_FAILURE` const TerminationReasonCodeNfsMountFailure TerminationReasonCode = `NFS_MOUNT_FAILURE` @@ -5780,11 +6097,11 @@ func (f *TerminationReasonCode) String() string { // Set raw string value and validate it against allowed values func (f *TerminationReasonCode) Set(v string) error { switch v { - case `ABUSE_DETECTED`, `ACCESS_TOKEN_FAILURE`, `ALLOCATION_TIMEOUT`, `ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY`, `ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_READY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS`, `ATTACH_PROJECT_FAILURE`, `AWS_AUTHORIZATION_FAILURE`, `AWS_INACCESSIBLE_KMS_KEY_FAILURE`, `AWS_INSTANCE_PROFILE_UPDATE_FAILURE`, `AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE`, `AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE`, `AWS_INVALID_KEY_PAIR`, `AWS_INVALID_KMS_KEY_STATE`, `AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE`, `AWS_REQUEST_LIMIT_EXCEEDED`, `AWS_RESOURCE_QUOTA_EXCEEDED`, `AWS_UNSUPPORTED_FAILURE`, `AZURE_BYOK_KEY_PERMISSION_FAILURE`, `AZURE_EPHEMERAL_DISK_FAILURE`, `AZURE_INVALID_DEPLOYMENT_TEMPLATE`, `AZURE_OPERATION_NOT_ALLOWED_EXCEPTION`, `AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE`, `AZURE_QUOTA_EXCEEDED_EXCEPTION`, `AZURE_RESOURCE_MANAGER_THROTTLING`, `AZURE_RESOURCE_PROVIDER_THROTTLING`, `AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE`, `AZURE_VM_EXTENSION_FAILURE`, `AZURE_VNET_CONFIGURATION_FAILURE`, `BOOTSTRAP_TIMEOUT`, `BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION`, `BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG`, `BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED`, `BUDGET_POLICY_RESOLUTION_FAILURE`, `CLOUD_ACCOUNT_POD_QUOTA_EXCEEDED`, `CLOUD_ACCOUNT_SETUP_FAILURE`, `CLOUD_OPERATION_CANCELLED`, `CLOUD_PROVIDER_DISK_SETUP_FAILURE`, `CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED`, `CLOUD_PROVIDER_LAUNCH_FAILURE`, `CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_SHUTDOWN`, `CLUSTER_OPERATION_THROTTLED`, `CLUSTER_OPERATION_TIMEOUT`, `COMMUNICATION_LOST`, `CONTAINER_LAUNCH_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG`, `DATABASE_CONNECTION_FAILURE`, `DATA_ACCESS_CONFIG_CHANGED`, `DBFS_COMPONENT_UNHEALTHY`, `DISASTER_RECOVERY_REPLICATION`, `DNS_RESOLUTION_ERROR`, `DOCKER_CONTAINER_CREATION_EXCEPTION`, `DOCKER_IMAGE_PULL_FAILURE`, `DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION`, `DOCKER_INVALID_OS_EXCEPTION`, `DRIVER_DNS_RESOLUTION_FAILURE`, `DRIVER_EVICTION`, `DRIVER_LAUNCH_TIMEOUT`, `DRIVER_NODE_UNREACHABLE`, `DRIVER_OUT_OF_DISK`, `DRIVER_OUT_OF_MEMORY`, `DRIVER_POD_CREATION_FAILURE`, `DRIVER_UNEXPECTED_FAILURE`, `DRIVER_UNHEALTHY`, `DRIVER_UNREACHABLE`, `DRIVER_UNRESPONSIVE`, `DYNAMIC_SPARK_CONF_SIZE_EXCEEDED`, `EOS_SPARK_IMAGE`, `EXECUTION_COMPONENT_UNHEALTHY`, `EXECUTOR_POD_UNSCHEDULED`, `GCP_API_RATE_QUOTA_EXCEEDED`, `GCP_DENIED_BY_ORG_POLICY`, `GCP_FORBIDDEN`, `GCP_IAM_TIMEOUT`, `GCP_INACCESSIBLE_KMS_KEY_FAILURE`, `GCP_INSUFFICIENT_CAPACITY`, `GCP_IP_SPACE_EXHAUSTED`, `GCP_KMS_KEY_PERMISSION_DENIED`, `GCP_NOT_FOUND`, `GCP_QUOTA_EXCEEDED`, `GCP_RESOURCE_QUOTA_EXCEEDED`, `GCP_SERVICE_ACCOUNT_ACCESS_DENIED`, `GCP_SERVICE_ACCOUNT_DELETED`, `GCP_SERVICE_ACCOUNT_NOT_FOUND`, `GCP_SUBNET_NOT_READY`, `GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED`, `GKE_BASED_CLUSTER_TERMINATION`, `GLOBAL_INIT_SCRIPT_FAILURE`, `HIVE_METASTORE_PROVISIONING_FAILURE`, `IMAGE_PULL_PERMISSION_DENIED`, `INACTIVITY`, `INIT_CONTAINER_NOT_FINISHED`, `INIT_SCRIPT_FAILURE`, `INSTANCE_POOL_CLUSTER_FAILURE`, `INSTANCE_POOL_MAX_CAPACITY_REACHED`, `INSTANCE_POOL_NOT_FOUND`, `INSTANCE_UNREACHABLE`, `INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG`, `INTERNAL_CAPACITY_FAILURE`, `INTERNAL_ERROR`, `INVALID_ARGUMENT`, `INVALID_AWS_PARAMETER`, `INVALID_INSTANCE_PLACEMENT_PROTOCOL`, `INVALID_SPARK_IMAGE`, `INVALID_WORKER_IMAGE_FAILURE`, `IN_PENALTY_BOX`, `IP_EXHAUSTION_FAILURE`, `JOB_FINISHED`, `K8S_ACTIVE_POD_QUOTA_EXCEEDED`, `K8S_AUTOSCALING_FAILURE`, `K8S_DBR_CLUSTER_LAUNCH_TIMEOUT`, `LAZY_ALLOCATION_TIMEOUT`, `MAINTENANCE_MODE`, `METASTORE_COMPONENT_UNHEALTHY`, `NEPHOS_RESOURCE_MANAGEMENT`, `NETVISOR_SETUP_TIMEOUT`, `NETWORK_CHECK_CONTROL_PLANE_FAILURE`, `NETWORK_CHECK_DNS_SERVER_FAILURE`, `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE`, `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE`, `NETWORK_CHECK_NIC_FAILURE`, `NETWORK_CHECK_STORAGE_FAILURE`, `NETWORK_CONFIGURATION_FAILURE`, `NFS_MOUNT_FAILURE`, `NO_ACTIVATED_K8S`, `NO_ACTIVATED_K8S_TESTING_TAG`, `NO_MATCHED_K8S`, `NO_MATCHED_K8S_TESTING_TAG`, `NPIP_TUNNEL_SETUP_FAILURE`, `NPIP_TUNNEL_TOKEN_FAILURE`, `POD_ASSIGNMENT_FAILURE`, `POD_SCHEDULING_FAILURE`, `REQUEST_REJECTED`, `REQUEST_THROTTLED`, `RESOURCE_USAGE_BLOCKED`, `SECRET_CREATION_FAILURE`, `SECRET_PERMISSION_DENIED`, `SECRET_RESOLUTION_ERROR`, `SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION`, `SECURITY_DAEMON_REGISTRATION_EXCEPTION`, `SELF_BOOTSTRAP_FAILURE`, `SERVERLESS_LONG_RUNNING_TERMINATED`, `SKIPPED_SLOW_NODES`, `SLOW_IMAGE_DOWNLOAD`, `SPARK_ERROR`, `SPARK_IMAGE_DOWNLOAD_FAILURE`, `SPARK_IMAGE_DOWNLOAD_THROTTLED`, `SPARK_IMAGE_NOT_FOUND`, `SPARK_STARTUP_FAILURE`, `SPOT_INSTANCE_TERMINATION`, `SSH_BOOTSTRAP_FAILURE`, `STORAGE_DOWNLOAD_FAILURE`, `STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG`, `STORAGE_DOWNLOAD_FAILURE_SLOW`, `STORAGE_DOWNLOAD_FAILURE_THROTTLED`, `STS_CLIENT_SETUP_FAILURE`, `SUBNET_EXHAUSTED_FAILURE`, `TEMPORARILY_UNAVAILABLE`, `TRIAL_EXPIRED`, `UNEXPECTED_LAUNCH_FAILURE`, `UNEXPECTED_POD_RECREATION`, `UNKNOWN`, `UNSUPPORTED_INSTANCE_TYPE`, `UPDATE_INSTANCE_PROFILE_FAILURE`, `USAGE_POLICY_ENTITLEMENT_DENIED`, `USER_INITIATED_VM_TERMINATION`, `USER_REQUEST`, `WORKER_SETUP_FAILURE`, `WORKSPACE_CANCELLED_ERROR`, `WORKSPACE_CONFIGURATION_ERROR`, `WORKSPACE_UPDATE`: + case `ABUSE_DETECTED`, `ACCESS_TOKEN_FAILURE`, `ALLOCATION_TIMEOUT`, `ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY`, `ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_READY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS`, `ATTACH_PROJECT_FAILURE`, `AWS_AUTHORIZATION_FAILURE`, `AWS_INACCESSIBLE_KMS_KEY_FAILURE`, `AWS_INSTANCE_PROFILE_UPDATE_FAILURE`, `AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE`, `AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE`, `AWS_INVALID_KEY_PAIR`, `AWS_INVALID_KMS_KEY_STATE`, `AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE`, `AWS_REQUEST_LIMIT_EXCEEDED`, `AWS_RESOURCE_QUOTA_EXCEEDED`, `AWS_UNSUPPORTED_FAILURE`, `AZURE_BYOK_KEY_PERMISSION_FAILURE`, `AZURE_EPHEMERAL_DISK_FAILURE`, `AZURE_INVALID_DEPLOYMENT_TEMPLATE`, `AZURE_OPERATION_NOT_ALLOWED_EXCEPTION`, `AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE`, `AZURE_QUOTA_EXCEEDED_EXCEPTION`, `AZURE_RESOURCE_MANAGER_THROTTLING`, `AZURE_RESOURCE_PROVIDER_THROTTLING`, `AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE`, `AZURE_VM_EXTENSION_FAILURE`, `AZURE_VNET_CONFIGURATION_FAILURE`, `BOOTSTRAP_TIMEOUT`, `BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION`, `BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG`, `BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED`, `BUDGET_POLICY_RESOLUTION_FAILURE`, `CLOUD_ACCOUNT_POD_QUOTA_EXCEEDED`, `CLOUD_ACCOUNT_SETUP_FAILURE`, `CLOUD_OPERATION_CANCELLED`, `CLOUD_PROVIDER_DISK_SETUP_FAILURE`, `CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED`, `CLOUD_PROVIDER_LAUNCH_FAILURE`, `CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_SHUTDOWN`, `CLUSTER_OPERATION_THROTTLED`, `CLUSTER_OPERATION_TIMEOUT`, `COMMUNICATION_LOST`, `CONTAINER_LAUNCH_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG`, `DATABASE_CONNECTION_FAILURE`, `DATA_ACCESS_CONFIG_CHANGED`, `DBFS_COMPONENT_UNHEALTHY`, `DISASTER_RECOVERY_REPLICATION`, `DNS_RESOLUTION_ERROR`, `DOCKER_CONTAINER_CREATION_EXCEPTION`, `DOCKER_IMAGE_PULL_FAILURE`, `DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION`, `DOCKER_INVALID_OS_EXCEPTION`, `DRIVER_DNS_RESOLUTION_FAILURE`, `DRIVER_EVICTION`, `DRIVER_LAUNCH_TIMEOUT`, `DRIVER_NODE_UNREACHABLE`, `DRIVER_OUT_OF_DISK`, `DRIVER_OUT_OF_MEMORY`, `DRIVER_POD_CREATION_FAILURE`, `DRIVER_UNEXPECTED_FAILURE`, `DRIVER_UNHEALTHY`, `DRIVER_UNREACHABLE`, `DRIVER_UNRESPONSIVE`, `DYNAMIC_SPARK_CONF_SIZE_EXCEEDED`, `EOS_SPARK_IMAGE`, `EXECUTION_COMPONENT_UNHEALTHY`, `EXECUTOR_POD_UNSCHEDULED`, `GCP_API_RATE_QUOTA_EXCEEDED`, `GCP_DENIED_BY_ORG_POLICY`, `GCP_FORBIDDEN`, `GCP_IAM_TIMEOUT`, `GCP_INACCESSIBLE_KMS_KEY_FAILURE`, `GCP_INSUFFICIENT_CAPACITY`, `GCP_IP_SPACE_EXHAUSTED`, `GCP_KMS_KEY_PERMISSION_DENIED`, `GCP_NOT_FOUND`, `GCP_QUOTA_EXCEEDED`, `GCP_RESOURCE_QUOTA_EXCEEDED`, `GCP_SERVICE_ACCOUNT_ACCESS_DENIED`, `GCP_SERVICE_ACCOUNT_DELETED`, `GCP_SERVICE_ACCOUNT_NOT_FOUND`, `GCP_SUBNET_NOT_READY`, `GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED`, `GKE_BASED_CLUSTER_TERMINATION`, `GLOBAL_INIT_SCRIPT_FAILURE`, `HIVE_METASTORE_PROVISIONING_FAILURE`, `IMAGE_PULL_PERMISSION_DENIED`, `INACTIVITY`, `INIT_CONTAINER_NOT_FINISHED`, `INIT_SCRIPT_FAILURE`, `INSTANCE_POOL_CLUSTER_FAILURE`, `INSTANCE_POOL_MAX_CAPACITY_REACHED`, `INSTANCE_POOL_NOT_FOUND`, `INSTANCE_UNREACHABLE`, `INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG`, `INTERNAL_CAPACITY_FAILURE`, `INTERNAL_ERROR`, `INVALID_ARGUMENT`, `INVALID_AWS_PARAMETER`, `INVALID_INSTANCE_PLACEMENT_PROTOCOL`, `INVALID_SPARK_IMAGE`, `INVALID_WORKER_IMAGE_FAILURE`, `IN_PENALTY_BOX`, `IP_EXHAUSTION_FAILURE`, `JOB_FINISHED`, `K8S_ACTIVE_POD_QUOTA_EXCEEDED`, `K8S_AUTOSCALING_FAILURE`, `K8S_DBR_CLUSTER_LAUNCH_TIMEOUT`, `LAZY_ALLOCATION_TIMEOUT`, `MAINTENANCE_MODE`, `METASTORE_COMPONENT_UNHEALTHY`, `NEPHOS_RESOURCE_MANAGEMENT`, `NETVISOR_SETUP_TIMEOUT`, `NETWORK_CHECK_CONTROL_PLANE_FAILURE`, `NETWORK_CHECK_CONTROL_PLANE_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CHECK_DNS_SERVER_FAILURE`, `NETWORK_CHECK_DNS_SERVER_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE`, `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE`, `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CHECK_NIC_FAILURE`, `NETWORK_CHECK_NIC_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CHECK_STORAGE_FAILURE`, `NETWORK_CHECK_STORAGE_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CONFIGURATION_FAILURE`, `NFS_MOUNT_FAILURE`, `NO_ACTIVATED_K8S`, `NO_ACTIVATED_K8S_TESTING_TAG`, `NO_MATCHED_K8S`, `NO_MATCHED_K8S_TESTING_TAG`, `NPIP_TUNNEL_SETUP_FAILURE`, `NPIP_TUNNEL_TOKEN_FAILURE`, `POD_ASSIGNMENT_FAILURE`, `POD_SCHEDULING_FAILURE`, `REQUEST_REJECTED`, `REQUEST_THROTTLED`, `RESOURCE_USAGE_BLOCKED`, `SECRET_CREATION_FAILURE`, `SECRET_PERMISSION_DENIED`, `SECRET_RESOLUTION_ERROR`, `SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION`, `SECURITY_DAEMON_REGISTRATION_EXCEPTION`, `SELF_BOOTSTRAP_FAILURE`, `SERVERLESS_LONG_RUNNING_TERMINATED`, `SKIPPED_SLOW_NODES`, `SLOW_IMAGE_DOWNLOAD`, `SPARK_ERROR`, `SPARK_IMAGE_DOWNLOAD_FAILURE`, `SPARK_IMAGE_DOWNLOAD_THROTTLED`, `SPARK_IMAGE_NOT_FOUND`, `SPARK_STARTUP_FAILURE`, `SPOT_INSTANCE_TERMINATION`, `SSH_BOOTSTRAP_FAILURE`, `STORAGE_DOWNLOAD_FAILURE`, `STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG`, `STORAGE_DOWNLOAD_FAILURE_SLOW`, `STORAGE_DOWNLOAD_FAILURE_THROTTLED`, `STS_CLIENT_SETUP_FAILURE`, `SUBNET_EXHAUSTED_FAILURE`, `TEMPORARILY_UNAVAILABLE`, `TRIAL_EXPIRED`, `UNEXPECTED_LAUNCH_FAILURE`, `UNEXPECTED_POD_RECREATION`, `UNKNOWN`, `UNSUPPORTED_INSTANCE_TYPE`, `UPDATE_INSTANCE_PROFILE_FAILURE`, `USAGE_POLICY_ENTITLEMENT_DENIED`, `USER_INITIATED_VM_TERMINATION`, `USER_REQUEST`, `WORKER_SETUP_FAILURE`, `WORKSPACE_CANCELLED_ERROR`, `WORKSPACE_CONFIGURATION_ERROR`, `WORKSPACE_UPDATE`: *f = TerminationReasonCode(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "ABUSE_DETECTED", "ACCESS_TOKEN_FAILURE", "ALLOCATION_TIMEOUT", "ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY", "ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS", "ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_READY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS", "ATTACH_PROJECT_FAILURE", "AWS_AUTHORIZATION_FAILURE", "AWS_INACCESSIBLE_KMS_KEY_FAILURE", "AWS_INSTANCE_PROFILE_UPDATE_FAILURE", "AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE", "AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE", "AWS_INVALID_KEY_PAIR", "AWS_INVALID_KMS_KEY_STATE", "AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE", "AWS_REQUEST_LIMIT_EXCEEDED", "AWS_RESOURCE_QUOTA_EXCEEDED", "AWS_UNSUPPORTED_FAILURE", "AZURE_BYOK_KEY_PERMISSION_FAILURE", "AZURE_EPHEMERAL_DISK_FAILURE", "AZURE_INVALID_DEPLOYMENT_TEMPLATE", "AZURE_OPERATION_NOT_ALLOWED_EXCEPTION", "AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE", "AZURE_QUOTA_EXCEEDED_EXCEPTION", "AZURE_RESOURCE_MANAGER_THROTTLING", "AZURE_RESOURCE_PROVIDER_THROTTLING", "AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE", "AZURE_VM_EXTENSION_FAILURE", "AZURE_VNET_CONFIGURATION_FAILURE", "BOOTSTRAP_TIMEOUT", "BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION", "BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG", "BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED", "BUDGET_POLICY_RESOLUTION_FAILURE", "CLOUD_ACCOUNT_POD_QUOTA_EXCEEDED", "CLOUD_ACCOUNT_SETUP_FAILURE", "CLOUD_OPERATION_CANCELLED", "CLOUD_PROVIDER_DISK_SETUP_FAILURE", "CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED", "CLOUD_PROVIDER_LAUNCH_FAILURE", "CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_RESOURCE_STOCKOUT", "CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_SHUTDOWN", "CLUSTER_OPERATION_THROTTLED", "CLUSTER_OPERATION_TIMEOUT", "COMMUNICATION_LOST", "CONTAINER_LAUNCH_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG", "DATABASE_CONNECTION_FAILURE", "DATA_ACCESS_CONFIG_CHANGED", "DBFS_COMPONENT_UNHEALTHY", "DISASTER_RECOVERY_REPLICATION", "DNS_RESOLUTION_ERROR", "DOCKER_CONTAINER_CREATION_EXCEPTION", "DOCKER_IMAGE_PULL_FAILURE", "DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION", "DOCKER_INVALID_OS_EXCEPTION", "DRIVER_DNS_RESOLUTION_FAILURE", "DRIVER_EVICTION", "DRIVER_LAUNCH_TIMEOUT", "DRIVER_NODE_UNREACHABLE", "DRIVER_OUT_OF_DISK", "DRIVER_OUT_OF_MEMORY", "DRIVER_POD_CREATION_FAILURE", "DRIVER_UNEXPECTED_FAILURE", "DRIVER_UNHEALTHY", "DRIVER_UNREACHABLE", "DRIVER_UNRESPONSIVE", "DYNAMIC_SPARK_CONF_SIZE_EXCEEDED", "EOS_SPARK_IMAGE", "EXECUTION_COMPONENT_UNHEALTHY", "EXECUTOR_POD_UNSCHEDULED", "GCP_API_RATE_QUOTA_EXCEEDED", "GCP_DENIED_BY_ORG_POLICY", "GCP_FORBIDDEN", "GCP_IAM_TIMEOUT", "GCP_INACCESSIBLE_KMS_KEY_FAILURE", "GCP_INSUFFICIENT_CAPACITY", "GCP_IP_SPACE_EXHAUSTED", "GCP_KMS_KEY_PERMISSION_DENIED", "GCP_NOT_FOUND", "GCP_QUOTA_EXCEEDED", "GCP_RESOURCE_QUOTA_EXCEEDED", "GCP_SERVICE_ACCOUNT_ACCESS_DENIED", "GCP_SERVICE_ACCOUNT_DELETED", "GCP_SERVICE_ACCOUNT_NOT_FOUND", "GCP_SUBNET_NOT_READY", "GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED", "GKE_BASED_CLUSTER_TERMINATION", "GLOBAL_INIT_SCRIPT_FAILURE", "HIVE_METASTORE_PROVISIONING_FAILURE", "IMAGE_PULL_PERMISSION_DENIED", "INACTIVITY", "INIT_CONTAINER_NOT_FINISHED", "INIT_SCRIPT_FAILURE", "INSTANCE_POOL_CLUSTER_FAILURE", "INSTANCE_POOL_MAX_CAPACITY_REACHED", "INSTANCE_POOL_NOT_FOUND", "INSTANCE_UNREACHABLE", "INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG", "INTERNAL_CAPACITY_FAILURE", "INTERNAL_ERROR", "INVALID_ARGUMENT", "INVALID_AWS_PARAMETER", "INVALID_INSTANCE_PLACEMENT_PROTOCOL", "INVALID_SPARK_IMAGE", "INVALID_WORKER_IMAGE_FAILURE", "IN_PENALTY_BOX", "IP_EXHAUSTION_FAILURE", "JOB_FINISHED", "K8S_ACTIVE_POD_QUOTA_EXCEEDED", "K8S_AUTOSCALING_FAILURE", "K8S_DBR_CLUSTER_LAUNCH_TIMEOUT", "LAZY_ALLOCATION_TIMEOUT", "MAINTENANCE_MODE", "METASTORE_COMPONENT_UNHEALTHY", "NEPHOS_RESOURCE_MANAGEMENT", "NETVISOR_SETUP_TIMEOUT", "NETWORK_CHECK_CONTROL_PLANE_FAILURE", "NETWORK_CHECK_DNS_SERVER_FAILURE", "NETWORK_CHECK_METADATA_ENDPOINT_FAILURE", "NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE", "NETWORK_CHECK_NIC_FAILURE", "NETWORK_CHECK_STORAGE_FAILURE", "NETWORK_CONFIGURATION_FAILURE", "NFS_MOUNT_FAILURE", "NO_ACTIVATED_K8S", "NO_ACTIVATED_K8S_TESTING_TAG", "NO_MATCHED_K8S", "NO_MATCHED_K8S_TESTING_TAG", "NPIP_TUNNEL_SETUP_FAILURE", "NPIP_TUNNEL_TOKEN_FAILURE", "POD_ASSIGNMENT_FAILURE", "POD_SCHEDULING_FAILURE", "REQUEST_REJECTED", "REQUEST_THROTTLED", "RESOURCE_USAGE_BLOCKED", "SECRET_CREATION_FAILURE", "SECRET_PERMISSION_DENIED", "SECRET_RESOLUTION_ERROR", "SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION", "SECURITY_DAEMON_REGISTRATION_EXCEPTION", "SELF_BOOTSTRAP_FAILURE", "SERVERLESS_LONG_RUNNING_TERMINATED", "SKIPPED_SLOW_NODES", "SLOW_IMAGE_DOWNLOAD", "SPARK_ERROR", "SPARK_IMAGE_DOWNLOAD_FAILURE", "SPARK_IMAGE_DOWNLOAD_THROTTLED", "SPARK_IMAGE_NOT_FOUND", "SPARK_STARTUP_FAILURE", "SPOT_INSTANCE_TERMINATION", "SSH_BOOTSTRAP_FAILURE", "STORAGE_DOWNLOAD_FAILURE", "STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG", "STORAGE_DOWNLOAD_FAILURE_SLOW", "STORAGE_DOWNLOAD_FAILURE_THROTTLED", "STS_CLIENT_SETUP_FAILURE", "SUBNET_EXHAUSTED_FAILURE", "TEMPORARILY_UNAVAILABLE", "TRIAL_EXPIRED", "UNEXPECTED_LAUNCH_FAILURE", "UNEXPECTED_POD_RECREATION", "UNKNOWN", "UNSUPPORTED_INSTANCE_TYPE", "UPDATE_INSTANCE_PROFILE_FAILURE", "USAGE_POLICY_ENTITLEMENT_DENIED", "USER_INITIATED_VM_TERMINATION", "USER_REQUEST", "WORKER_SETUP_FAILURE", "WORKSPACE_CANCELLED_ERROR", "WORKSPACE_CONFIGURATION_ERROR", "WORKSPACE_UPDATE"`, v) + return fmt.Errorf(`value "%s" is not one of "ABUSE_DETECTED", "ACCESS_TOKEN_FAILURE", "ALLOCATION_TIMEOUT", "ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY", "ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS", "ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_READY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS", "ATTACH_PROJECT_FAILURE", "AWS_AUTHORIZATION_FAILURE", "AWS_INACCESSIBLE_KMS_KEY_FAILURE", "AWS_INSTANCE_PROFILE_UPDATE_FAILURE", "AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE", "AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE", "AWS_INVALID_KEY_PAIR", "AWS_INVALID_KMS_KEY_STATE", "AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE", "AWS_REQUEST_LIMIT_EXCEEDED", "AWS_RESOURCE_QUOTA_EXCEEDED", "AWS_UNSUPPORTED_FAILURE", "AZURE_BYOK_KEY_PERMISSION_FAILURE", "AZURE_EPHEMERAL_DISK_FAILURE", "AZURE_INVALID_DEPLOYMENT_TEMPLATE", "AZURE_OPERATION_NOT_ALLOWED_EXCEPTION", "AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE", "AZURE_QUOTA_EXCEEDED_EXCEPTION", "AZURE_RESOURCE_MANAGER_THROTTLING", "AZURE_RESOURCE_PROVIDER_THROTTLING", "AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE", "AZURE_VM_EXTENSION_FAILURE", "AZURE_VNET_CONFIGURATION_FAILURE", "BOOTSTRAP_TIMEOUT", "BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION", "BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG", "BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED", "BUDGET_POLICY_RESOLUTION_FAILURE", "CLOUD_ACCOUNT_POD_QUOTA_EXCEEDED", "CLOUD_ACCOUNT_SETUP_FAILURE", "CLOUD_OPERATION_CANCELLED", "CLOUD_PROVIDER_DISK_SETUP_FAILURE", "CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED", "CLOUD_PROVIDER_LAUNCH_FAILURE", "CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_RESOURCE_STOCKOUT", "CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_SHUTDOWN", "CLUSTER_OPERATION_THROTTLED", "CLUSTER_OPERATION_TIMEOUT", "COMMUNICATION_LOST", "CONTAINER_LAUNCH_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG", "DATABASE_CONNECTION_FAILURE", "DATA_ACCESS_CONFIG_CHANGED", "DBFS_COMPONENT_UNHEALTHY", "DISASTER_RECOVERY_REPLICATION", "DNS_RESOLUTION_ERROR", "DOCKER_CONTAINER_CREATION_EXCEPTION", "DOCKER_IMAGE_PULL_FAILURE", "DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION", "DOCKER_INVALID_OS_EXCEPTION", "DRIVER_DNS_RESOLUTION_FAILURE", "DRIVER_EVICTION", "DRIVER_LAUNCH_TIMEOUT", "DRIVER_NODE_UNREACHABLE", "DRIVER_OUT_OF_DISK", "DRIVER_OUT_OF_MEMORY", "DRIVER_POD_CREATION_FAILURE", "DRIVER_UNEXPECTED_FAILURE", "DRIVER_UNHEALTHY", "DRIVER_UNREACHABLE", "DRIVER_UNRESPONSIVE", "DYNAMIC_SPARK_CONF_SIZE_EXCEEDED", "EOS_SPARK_IMAGE", "EXECUTION_COMPONENT_UNHEALTHY", "EXECUTOR_POD_UNSCHEDULED", "GCP_API_RATE_QUOTA_EXCEEDED", "GCP_DENIED_BY_ORG_POLICY", "GCP_FORBIDDEN", "GCP_IAM_TIMEOUT", "GCP_INACCESSIBLE_KMS_KEY_FAILURE", "GCP_INSUFFICIENT_CAPACITY", "GCP_IP_SPACE_EXHAUSTED", "GCP_KMS_KEY_PERMISSION_DENIED", "GCP_NOT_FOUND", "GCP_QUOTA_EXCEEDED", "GCP_RESOURCE_QUOTA_EXCEEDED", "GCP_SERVICE_ACCOUNT_ACCESS_DENIED", "GCP_SERVICE_ACCOUNT_DELETED", "GCP_SERVICE_ACCOUNT_NOT_FOUND", "GCP_SUBNET_NOT_READY", "GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED", "GKE_BASED_CLUSTER_TERMINATION", "GLOBAL_INIT_SCRIPT_FAILURE", "HIVE_METASTORE_PROVISIONING_FAILURE", "IMAGE_PULL_PERMISSION_DENIED", "INACTIVITY", "INIT_CONTAINER_NOT_FINISHED", "INIT_SCRIPT_FAILURE", "INSTANCE_POOL_CLUSTER_FAILURE", "INSTANCE_POOL_MAX_CAPACITY_REACHED", "INSTANCE_POOL_NOT_FOUND", "INSTANCE_UNREACHABLE", "INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG", "INTERNAL_CAPACITY_FAILURE", "INTERNAL_ERROR", "INVALID_ARGUMENT", "INVALID_AWS_PARAMETER", "INVALID_INSTANCE_PLACEMENT_PROTOCOL", "INVALID_SPARK_IMAGE", "INVALID_WORKER_IMAGE_FAILURE", "IN_PENALTY_BOX", "IP_EXHAUSTION_FAILURE", "JOB_FINISHED", "K8S_ACTIVE_POD_QUOTA_EXCEEDED", "K8S_AUTOSCALING_FAILURE", "K8S_DBR_CLUSTER_LAUNCH_TIMEOUT", "LAZY_ALLOCATION_TIMEOUT", "MAINTENANCE_MODE", "METASTORE_COMPONENT_UNHEALTHY", "NEPHOS_RESOURCE_MANAGEMENT", "NETVISOR_SETUP_TIMEOUT", "NETWORK_CHECK_CONTROL_PLANE_FAILURE", "NETWORK_CHECK_CONTROL_PLANE_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CHECK_DNS_SERVER_FAILURE", "NETWORK_CHECK_DNS_SERVER_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CHECK_METADATA_ENDPOINT_FAILURE", "NETWORK_CHECK_METADATA_ENDPOINT_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE", "NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CHECK_NIC_FAILURE", "NETWORK_CHECK_NIC_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CHECK_STORAGE_FAILURE", "NETWORK_CHECK_STORAGE_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CONFIGURATION_FAILURE", "NFS_MOUNT_FAILURE", "NO_ACTIVATED_K8S", "NO_ACTIVATED_K8S_TESTING_TAG", "NO_MATCHED_K8S", "NO_MATCHED_K8S_TESTING_TAG", "NPIP_TUNNEL_SETUP_FAILURE", "NPIP_TUNNEL_TOKEN_FAILURE", "POD_ASSIGNMENT_FAILURE", "POD_SCHEDULING_FAILURE", "REQUEST_REJECTED", "REQUEST_THROTTLED", "RESOURCE_USAGE_BLOCKED", "SECRET_CREATION_FAILURE", "SECRET_PERMISSION_DENIED", "SECRET_RESOLUTION_ERROR", "SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION", "SECURITY_DAEMON_REGISTRATION_EXCEPTION", "SELF_BOOTSTRAP_FAILURE", "SERVERLESS_LONG_RUNNING_TERMINATED", "SKIPPED_SLOW_NODES", "SLOW_IMAGE_DOWNLOAD", "SPARK_ERROR", "SPARK_IMAGE_DOWNLOAD_FAILURE", "SPARK_IMAGE_DOWNLOAD_THROTTLED", "SPARK_IMAGE_NOT_FOUND", "SPARK_STARTUP_FAILURE", "SPOT_INSTANCE_TERMINATION", "SSH_BOOTSTRAP_FAILURE", "STORAGE_DOWNLOAD_FAILURE", "STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG", "STORAGE_DOWNLOAD_FAILURE_SLOW", "STORAGE_DOWNLOAD_FAILURE_THROTTLED", "STS_CLIENT_SETUP_FAILURE", "SUBNET_EXHAUSTED_FAILURE", "TEMPORARILY_UNAVAILABLE", "TRIAL_EXPIRED", "UNEXPECTED_LAUNCH_FAILURE", "UNEXPECTED_POD_RECREATION", "UNKNOWN", "UNSUPPORTED_INSTANCE_TYPE", "UPDATE_INSTANCE_PROFILE_FAILURE", "USAGE_POLICY_ENTITLEMENT_DENIED", "USER_INITIATED_VM_TERMINATION", "USER_REQUEST", "WORKER_SETUP_FAILURE", "WORKSPACE_CANCELLED_ERROR", "WORKSPACE_CONFIGURATION_ERROR", "WORKSPACE_UPDATE"`, v) } } @@ -5918,11 +6235,17 @@ func (f *TerminationReasonCode) Values() []TerminationReasonCode { TerminationReasonCodeNephosResourceManagement, TerminationReasonCodeNetvisorSetupTimeout, TerminationReasonCodeNetworkCheckControlPlaneFailure, + TerminationReasonCodeNetworkCheckControlPlaneFailureDueToMisconfig, TerminationReasonCodeNetworkCheckDnsServerFailure, + TerminationReasonCodeNetworkCheckDnsServerFailureDueToMisconfig, TerminationReasonCodeNetworkCheckMetadataEndpointFailure, + TerminationReasonCodeNetworkCheckMetadataEndpointFailureDueToMisconfig, TerminationReasonCodeNetworkCheckMultipleComponentsFailure, + TerminationReasonCodeNetworkCheckMultipleComponentsFailureDueToMisconfig, TerminationReasonCodeNetworkCheckNicFailure, + TerminationReasonCodeNetworkCheckNicFailureDueToMisconfig, TerminationReasonCodeNetworkCheckStorageFailure, + TerminationReasonCodeNetworkCheckStorageFailureDueToMisconfig, TerminationReasonCodeNetworkConfigurationFailure, TerminationReasonCodeNfsMountFailure, TerminationReasonCodeNoActivatedK8s, @@ -6221,6 +6544,28 @@ func (s UpdateClusterResource) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateDefaultBaseEnvironmentRequest struct { + DefaultBaseEnvironment DefaultBaseEnvironment `json:"default_base_environment"` + + Id string `json:"-" url:"-"` +} + +type UpdateDefaultDefaultBaseEnvironmentRequest struct { + BaseEnvironmentType BaseEnvironmentType `json:"base_environment_type,omitempty"` + + Id string `json:"id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateDefaultDefaultBaseEnvironmentRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateDefaultDefaultBaseEnvironmentRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // A storage location back by UC Volumes. type VolumesStorageInfo struct { // UC Volumes destination, e.g. diff --git a/service/dashboards/api.go b/service/dashboards/api.go index 2e1ad3b04..1254d1629 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, Lakeview Embedded, etc. +// These APIs allow you to manage Genie, Lakeview, Lakeview Embedded, Query Execution, etc. package dashboards import ( @@ -33,6 +33,9 @@ type GenieInterface interface { // Deprecated: use [GenieAPIInterface.CreateMessage].Get() or [GenieAPIInterface.WaitGetMessageGenieCompleted] CreateMessageAndWait(ctx context.Context, genieCreateConversationMessageRequest GenieCreateConversationMessageRequest, options ...retries.Option[GenieMessage]) (*GenieMessage, error) + // Creates a Genie space from a serialized payload. + CreateSpace(ctx context.Context, request GenieCreateSpaceRequest) (*GenieSpace, error) + // Delete a conversation. DeleteConversation(ctx context.Context, request GenieDeleteConversationRequest) error @@ -50,6 +53,39 @@ type GenieInterface interface { // Query](:method:genie/executemessageattachmentquery) instead. ExecuteMessageQuery(ctx context.Context, request GenieExecuteMessageQueryRequest) (*GenieGetMessageQueryResultResponse, error) + // Initiates a new SQL execution and returns a `download_id` that you can use to + // track the progress of the download. The query result is stored in an external + // link and can be retrieved using the [Get Download Full Query + // Result](:method:genie/getdownloadfullqueryresult) API. Warning: Databricks + // strongly recommends that you protect the URLs that are returned by the + // `EXTERNAL_LINKS` disposition. See [Execute + // Statement](:method:statementexecution/executestatement) for more details. + GenerateDownloadFullQueryResult(ctx context.Context, request GenieGenerateDownloadFullQueryResultRequest) (*GenieGenerateDownloadFullQueryResultResponse, error) + + // After [Generating a Full Query Result + // Download](:method:genie/getdownloadfullqueryresult) and successfully + // receiving a `download_id`, use this API to poll the download progress. When + // the download is complete, the API returns one or more external links to the + // query result files. Warning: Databricks strongly recommends that you protect + // the URLs that are returned by the `EXTERNAL_LINKS` disposition. You must not + // set an Authorization header in download requests. When using the + // `EXTERNAL_LINKS` disposition, Databricks returns presigned URLs that grant + // temporary access to data. See [Execute + // Statement](:method:statementexecution/executestatement) for more details. + GetDownloadFullQueryResult(ctx context.Context, request GenieGetDownloadFullQueryResultRequest) (*GenieGetDownloadFullQueryResultResponse, error) + + // After [Generating a Full Query Result + // Download](:method:genie/getdownloadfullqueryresult) and successfully + // receiving a `download_id`, use this API to poll the download progress. When + // the download is complete, the API returns one or more external links to the + // query result files. Warning: Databricks strongly recommends that you protect + // the URLs that are returned by the `EXTERNAL_LINKS` disposition. You must not + // set an Authorization header in download requests. When using the + // `EXTERNAL_LINKS` disposition, Databricks returns presigned URLs that grant + // temporary access to data. See [Execute + // Statement](:method:statementexecution/executestatement) for more details. + GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string, downloadId string) (*GenieGetDownloadFullQueryResultResponse, error) + // Get message from conversation. GetMessage(ctx context.Context, request GenieGetConversationMessageRequest) (*GenieMessage, error) @@ -119,6 +155,9 @@ type GenieInterface interface { // Move a Genie Space to the trash. TrashSpaceBySpaceId(ctx context.Context, spaceId string) error + + // Updates a Genie space with a serialized payload. + UpdateSpace(ctx context.Context, request GenieUpdateSpaceRequest) (*GenieSpace, error) } func NewGenie(client *client.DatabricksClient) *GenieAPI { @@ -252,6 +291,26 @@ func (a *GenieAPI) DeleteConversationBySpaceIdAndConversationId(ctx context.Cont }) } +// After [Generating a Full Query Result +// Download](:method:genie/getdownloadfullqueryresult) and successfully +// receiving a `download_id`, use this API to poll the download progress. When +// the download is complete, the API returns one or more external links to the +// query result files. Warning: Databricks strongly recommends that you protect +// the URLs that are returned by the `EXTERNAL_LINKS` disposition. You must not +// set an Authorization header in download requests. When using the +// `EXTERNAL_LINKS` disposition, Databricks returns presigned URLs that grant +// temporary access to data. See [Execute +// Statement](:method:statementexecution/executestatement) for more details. +func (a *GenieAPI) GetDownloadFullQueryResultBySpaceIdAndConversationIdAndMessageIdAndAttachmentIdAndDownloadId(ctx context.Context, spaceId string, conversationId string, messageId string, attachmentId string, downloadId string) (*GenieGetDownloadFullQueryResultResponse, error) { + return a.genieImpl.GetDownloadFullQueryResult(ctx, GenieGetDownloadFullQueryResultRequest{ + SpaceId: spaceId, + ConversationId: conversationId, + MessageId: messageId, + AttachmentId: attachmentId, + DownloadId: downloadId, + }) +} + // Get message from conversation. func (a *GenieAPI) GetMessageBySpaceIdAndConversationIdAndMessageId(ctx context.Context, spaceId string, conversationId string, messageId string) (*GenieMessage, error) { return a.genieImpl.GetMessage(ctx, GenieGetConversationMessageRequest{ @@ -563,6 +622,12 @@ func (a *LakeviewAPI) UnpublishByDashboardId(ctx context.Context, dashboardId st type LakeviewEmbeddedInterface interface { + // Get the current published dashboard within an embedded context. + GetPublishedDashboardEmbedded(ctx context.Context, request GetPublishedDashboardEmbeddedRequest) error + + // Get the current published dashboard within an embedded context. + GetPublishedDashboardEmbeddedByDashboardId(ctx context.Context, dashboardId string) error + // Get a required authorization details and scopes of a published dashboard to // mint an OAuth token. GetPublishedDashboardTokenInfo(ctx context.Context, request GetPublishedDashboardTokenInfoRequest) (*GetPublishedDashboardTokenInfoResponse, error) @@ -585,6 +650,13 @@ type LakeviewEmbeddedAPI struct { lakeviewEmbeddedImpl } +// 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, + }) +} + // Get a required authorization details and scopes of a published dashboard to // mint an OAuth token. func (a *LakeviewEmbeddedAPI) GetPublishedDashboardTokenInfoByDashboardId(ctx context.Context, dashboardId string) (*GetPublishedDashboardTokenInfoResponse, error) { @@ -592,3 +664,28 @@ func (a *LakeviewEmbeddedAPI) GetPublishedDashboardTokenInfoByDashboardId(ctx co 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 4e70904a0..42635847d 100755 --- a/service/dashboards/impl.go +++ b/service/dashboards/impl.go @@ -28,6 +28,17 @@ func (a *genieImpl) CreateMessage(ctx context.Context, request GenieCreateConver return &genieMessage, err } +func (a *genieImpl) CreateSpace(ctx context.Context, request GenieCreateSpaceRequest) (*GenieSpace, error) { + var genieSpace GenieSpace + path := "/api/2.0/genie/spaces" + 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, &genieSpace) + return &genieSpace, err +} + func (a *genieImpl) DeleteConversation(ctx context.Context, request GenieDeleteConversationRequest) error { path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v", request.SpaceId, request.ConversationId) queryParams := make(map[string]any) @@ -66,6 +77,26 @@ func (a *genieImpl) ExecuteMessageQuery(ctx context.Context, request GenieExecut return &genieGetMessageQueryResultResponse, err } +func (a *genieImpl) GenerateDownloadFullQueryResult(ctx context.Context, request GenieGenerateDownloadFullQueryResultRequest) (*GenieGenerateDownloadFullQueryResultResponse, error) { + var genieGenerateDownloadFullQueryResultResponse GenieGenerateDownloadFullQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/downloads", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &genieGenerateDownloadFullQueryResultResponse) + return &genieGenerateDownloadFullQueryResultResponse, err +} + +func (a *genieImpl) GetDownloadFullQueryResult(ctx context.Context, request GenieGetDownloadFullQueryResultRequest) (*GenieGetDownloadFullQueryResultResponse, error) { + var genieGetDownloadFullQueryResultResponse GenieGetDownloadFullQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/downloads/%v", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId, request.DownloadId) + 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, &genieGetDownloadFullQueryResultResponse) + return &genieGetDownloadFullQueryResultResponse, err +} + func (a *genieImpl) GetMessage(ctx context.Context, request GenieGetConversationMessageRequest) (*GenieMessage, error) { var genieMessage GenieMessage path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v", request.SpaceId, request.ConversationId, request.MessageId) @@ -176,6 +207,17 @@ func (a *genieImpl) TrashSpace(ctx context.Context, request GenieTrashSpaceReque return err } +func (a *genieImpl) UpdateSpace(ctx context.Context, request GenieUpdateSpaceRequest) (*GenieSpace, error) { + var genieSpace GenieSpace + path := fmt.Sprintf("/api/2.0/genie/spaces/%v", request.SpaceId) + 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, &genieSpace) + return &genieSpace, err +} + // unexported type that holds implementations of just Lakeview API methods type lakeviewImpl struct { client *client.DatabricksClient @@ -462,6 +504,15 @@ type lakeviewEmbeddedImpl struct { client *client.DatabricksClient } +func (a *lakeviewEmbeddedImpl) GetPublishedDashboardEmbedded(ctx context.Context, request GetPublishedDashboardEmbeddedRequest) error { + 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, nil) + return err +} + func (a *lakeviewEmbeddedImpl) GetPublishedDashboardTokenInfo(ctx context.Context, request GetPublishedDashboardTokenInfoRequest) (*GetPublishedDashboardTokenInfoResponse, error) { var getPublishedDashboardTokenInfoResponse GetPublishedDashboardTokenInfoResponse path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published/tokeninfo", request.DashboardId) @@ -471,3 +522,38 @@ func (a *lakeviewEmbeddedImpl) GetPublishedDashboardTokenInfo(ctx context.Contex err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPublishedDashboardTokenInfoResponse) return &getPublishedDashboardTokenInfoResponse, 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 { + 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, nil) + 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 8d97abbc7..1faa37374 100755 --- a/service/dashboards/interface.go +++ b/service/dashboards/interface.go @@ -20,6 +20,9 @@ type GenieService interface { // to respond. CreateMessage(ctx context.Context, request GenieCreateConversationMessageRequest) (*GenieMessage, error) + // Creates a Genie space from a serialized payload. + CreateSpace(ctx context.Context, request GenieCreateSpaceRequest) (*GenieSpace, error) + // Delete a conversation. DeleteConversation(ctx context.Context, request GenieDeleteConversationRequest) error @@ -34,6 +37,27 @@ type GenieService interface { // Query](:method:genie/executemessageattachmentquery) instead. ExecuteMessageQuery(ctx context.Context, request GenieExecuteMessageQueryRequest) (*GenieGetMessageQueryResultResponse, error) + // Initiates a new SQL execution and returns a `download_id` that you can + // use to track the progress of the download. The query result is stored in + // an external link and can be retrieved using the [Get Download Full Query + // Result](:method:genie/getdownloadfullqueryresult) API. Warning: + // Databricks strongly recommends that you protect the URLs that are + // returned by the `EXTERNAL_LINKS` disposition. See [Execute + // Statement](:method:statementexecution/executestatement) for more details. + GenerateDownloadFullQueryResult(ctx context.Context, request GenieGenerateDownloadFullQueryResultRequest) (*GenieGenerateDownloadFullQueryResultResponse, error) + + // After [Generating a Full Query Result + // Download](:method:genie/getdownloadfullqueryresult) and successfully + // receiving a `download_id`, use this API to poll the download progress. + // When the download is complete, the API returns one or more external links + // to the query result files. Warning: Databricks strongly recommends that + // you protect the URLs that are returned by the `EXTERNAL_LINKS` + // disposition. You must not set an Authorization header in download + // requests. When using the `EXTERNAL_LINKS` disposition, Databricks returns + // presigned URLs that grant temporary access to data. See [Execute + // Statement](:method:statementexecution/executestatement) for more details. + GetDownloadFullQueryResult(ctx context.Context, request GenieGetDownloadFullQueryResultRequest) (*GenieGetDownloadFullQueryResultResponse, error) + // Get message from conversation. GetMessage(ctx context.Context, request GenieGetConversationMessageRequest) (*GenieMessage, error) @@ -70,6 +94,9 @@ type GenieService interface { // Move a Genie Space to the trash. TrashSpace(ctx context.Context, request GenieTrashSpaceRequest) error + + // Updates a Genie space with a serialized payload. + UpdateSpace(ctx context.Context, request GenieUpdateSpaceRequest) (*GenieSpace, error) } // These APIs provide specific management operations for Lakeview dashboards. @@ -139,7 +166,25 @@ type LakeviewService interface { // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. type LakeviewEmbeddedService interface { + // Get the current published dashboard within an embedded context. + GetPublishedDashboardEmbedded(ctx context.Context, request GetPublishedDashboardEmbeddedRequest) error + // Get a required authorization details and scopes of a published dashboard // to mint an OAuth token. GetPublishedDashboardTokenInfo(ctx context.Context, request GetPublishedDashboardTokenInfoRequest) (*GetPublishedDashboardTokenInfoResponse, error) } + +// Query execution APIs for AI / BI Dashboards +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +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 10f1b0605..22862b197 100755 --- a/service/dashboards/model.go +++ b/service/dashboards/model.go @@ -51,6 +51,29 @@ func (s AuthorizationDetailsGrantRule) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +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"` + + Pending *Empty `json:"pending,omitempty"` + + Success *Empty `json:"success,omitempty"` +} + type CreateDashboardRequest struct { Dashboard Dashboard `json:"dashboard"` } @@ -206,6 +229,37 @@ func (s DeleteSubscriptionRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// 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:"-" url:"-"` +} + +func (s *ExecutePublishedDashboardQueryRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ExecutePublishedDashboardQueryRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Genie AI Response type GenieAttachment struct { // Attachment ID @@ -272,6 +326,29 @@ type GenieCreateConversationMessageRequest struct { SpaceId string `json:"-" url:"-"` } +type GenieCreateSpaceRequest struct { + // Optional description + Description string `json:"description,omitempty"` + // Parent folder path where the space will be registered + ParentPath string `json:"parent_path,omitempty"` + // Serialized export model for the space contents + SerializedSpace string `json:"serialized_space"` + // Optional title override + Title string `json:"title,omitempty"` + // Warehouse to associate with the new space + WarehouseId string `json:"warehouse_id"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieCreateSpaceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieCreateSpaceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GenieDeleteConversationMessageRequest struct { // The ID associated with the conversation. ConversationId string `json:"-" url:"-"` @@ -310,8 +387,20 @@ type GenieExecuteMessageQueryRequest struct { // Feedback containing rating and optional comment type GenieFeedback struct { + // Optional feedback comment text + Comment string `json:"comment,omitempty"` // The feedback rating Rating GenieFeedbackRating `json:"rating,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieFeedback) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieFeedback) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Feedback rating for Genie messages @@ -355,6 +444,33 @@ func (f *GenieFeedbackRating) Type() string { return "GenieFeedbackRating" } +type GenieGenerateDownloadFullQueryResultRequest struct { + // Attachment ID + AttachmentId string `json:"-" url:"-"` + // Conversation ID + ConversationId string `json:"-" url:"-"` + // Message ID + MessageId string `json:"-" url:"-"` + // Genie space ID + SpaceId string `json:"-" url:"-"` +} + +type GenieGenerateDownloadFullQueryResultResponse struct { + // Download ID. Use this ID to track the download request in subsequent + // polling calls + DownloadId string `json:"download_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieGenerateDownloadFullQueryResultResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieGenerateDownloadFullQueryResultResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GenieGetConversationMessageRequest struct { // The ID associated with the target conversation. ConversationId string `json:"-" url:"-"` @@ -366,6 +482,26 @@ type GenieGetConversationMessageRequest struct { SpaceId string `json:"-" url:"-"` } +type GenieGetDownloadFullQueryResultRequest struct { + // Attachment ID + AttachmentId string `json:"-" url:"-"` + // Conversation ID + ConversationId string `json:"-" url:"-"` + // Download ID. This ID is provided by the [Generate Download + // endpoint](:method:genie/generateDownloadFullQueryResult) + DownloadId string `json:"-" url:"-"` + // Message ID + MessageId string `json:"-" url:"-"` + // Genie space ID + SpaceId string `json:"-" url:"-"` +} + +type GenieGetDownloadFullQueryResultResponse struct { + // SQL Statement Execution response. See [Get status, manifest, and result + // first chunk](:method:statementexecution/getstatement) for more details. + StatementResponse *sql.StatementResponse `json:"statement_response,omitempty"` +} + type GenieGetMessageAttachmentQueryResultRequest struct { // Attachment ID AttachmentId string `json:"-" url:"-"` @@ -609,6 +745,8 @@ func (s GenieResultMetadata) MarshalJSON() ([]byte, error) { } type GenieSendMessageFeedbackRequest struct { + // Optional text feedback that will be stored as a comment. + Comment string `json:"comment,omitempty"` // The ID associated with the conversation. ConversationId string `json:"-" url:"-"` // The ID associated with the message to provide feedback for. @@ -617,6 +755,16 @@ type GenieSendMessageFeedbackRequest struct { Rating GenieFeedbackRating `json:"rating"` // The ID associated with the Genie space where the message is located. SpaceId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieSendMessageFeedbackRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieSendMessageFeedbackRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GenieSpace struct { @@ -669,11 +817,39 @@ type GenieTrashSpaceRequest struct { SpaceId string `json:"-" url:"-"` } +type GenieUpdateSpaceRequest struct { + // Optional description + Description string `json:"description,omitempty"` + // Serialized export model for the space contents (full replacement) + SerializedSpace string `json:"serialized_space,omitempty"` + // Genie space ID + SpaceId string `json:"-" url:"-"` + // Optional title override + Title string `json:"title,omitempty"` + // Optional warehouse override + WarehouseId string `json:"warehouse_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GenieUpdateSpaceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GenieUpdateSpaceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GetDashboardRequest struct { // UUID identifying the dashboard. DashboardId string `json:"-" url:"-"` } +type GetPublishedDashboardEmbeddedRequest struct { + // UUID identifying the published dashboard. + DashboardId string `json:"-" url:"-"` +} + type GetPublishedDashboardRequest struct { // UUID identifying the published dashboard. DashboardId string `json:"-" url:"-"` @@ -1240,6 +1416,29 @@ 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"` +} + +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:"-"` @@ -1301,6 +1500,31 @@ func (s QueryAttachmentParameter) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type QueryResponseStatus struct { + Canceled *Empty `json:"canceled,omitempty"` + + 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:"-" url:"-"` +} + +func (s *QueryResponseStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s QueryResponseStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type Result struct { // If result is truncated IsTruncated bool `json:"is_truncated,omitempty"` @@ -1448,6 +1672,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:"-" url:"-"` +} + +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/database/api.go b/service/database/api.go index 60788f020..c5dd9cdf5 100755 --- a/service/database/api.go +++ b/service/database/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// Database Instances provide access to a database via REST API or direct SQL. +// These APIs allow you to manage Database, Database Project, etc. package database import ( @@ -75,6 +75,9 @@ type DatabaseInterface interface { // Delete a Synced Database Table. DeleteSyncedDatabaseTableByName(ctx context.Context, name string) error + // Failover the primary node of a Database Instance to a secondary. + FailoverDatabaseInstance(ctx context.Context, request FailoverDatabaseInstanceRequest) (*DatabaseInstance, error) + // Find a Database Instance by uid. FindDatabaseInstanceByUid(ctx context.Context, request FindDatabaseInstanceByUidRequest) (*DatabaseInstance, error) @@ -178,6 +181,9 @@ type DatabaseInterface interface { // Update a Database Instance. UpdateDatabaseInstance(ctx context.Context, request UpdateDatabaseInstanceRequest) (*DatabaseInstance, error) + // Update a role for a Database Instance. + UpdateDatabaseInstanceRole(ctx context.Context, request UpdateDatabaseInstanceRoleRequest) (*DatabaseInstanceRole, error) + // This API is currently unimplemented, but exposed for Terraform support. UpdateSyncedDatabaseTable(ctx context.Context, request UpdateSyncedDatabaseTableRequest) (*SyncedDatabaseTable, error) } @@ -385,3 +391,90 @@ func (a *DatabaseAPI) ListSyncedDatabaseTablesByInstanceName(ctx context.Context InstanceName: instanceName, }) } + +type DatabaseProjectInterface interface { + + // Create a Database Branch. + CreateDatabaseBranch(ctx context.Context, request CreateDatabaseBranchRequest) (*DatabaseBranch, error) + + // Create a Database Endpoint. + CreateDatabaseEndpoint(ctx context.Context, request CreateDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Create a Database Project. + CreateDatabaseProject(ctx context.Context, request CreateDatabaseProjectRequest) (*DatabaseProject, error) + + // Delete a Database Branch. + DeleteDatabaseBranch(ctx context.Context, request DeleteDatabaseBranchRequest) error + + // Delete a Database Endpoint. + DeleteDatabaseEndpoint(ctx context.Context, request DeleteDatabaseEndpointRequest) error + + // Delete a Database Project. + DeleteDatabaseProject(ctx context.Context, request DeleteDatabaseProjectRequest) error + + // Get a Database Branch. + GetDatabaseBranch(ctx context.Context, request GetDatabaseBranchRequest) (*DatabaseBranch, error) + + // Get a Database Endpoint. + GetDatabaseEndpoint(ctx context.Context, request GetDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Get a Database Project. + GetDatabaseProject(ctx context.Context, request GetDatabaseProjectRequest) (*DatabaseProject, error) + + // List Database Branches. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseBranches(ctx context.Context, request ListDatabaseBranchesRequest) listing.Iterator[DatabaseBranch] + + // List Database Branches. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseBranchesAll(ctx context.Context, request ListDatabaseBranchesRequest) ([]DatabaseBranch, error) + + // List Database Endpoints. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseEndpoints(ctx context.Context, request ListDatabaseEndpointsRequest) listing.Iterator[DatabaseEndpoint] + + // List Database Endpoints. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseEndpointsAll(ctx context.Context, request ListDatabaseEndpointsRequest) ([]DatabaseEndpoint, error) + + // List Database Instances. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) listing.Iterator[DatabaseProject] + + // List Database Instances. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseProjectsAll(ctx context.Context, request ListDatabaseProjectsRequest) ([]DatabaseProject, error) + + // Restart a Database Endpoint. TODO: should return + // databricks.longrunning.Operation + RestartDatabaseEndpoint(ctx context.Context, request RestartDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Update a Database Branch. + UpdateDatabaseBranch(ctx context.Context, request UpdateDatabaseBranchRequest) (*DatabaseBranch, error) + + // Update a Database Endpoint. TODO: should return + // databricks.longrunning.Operation { + UpdateDatabaseEndpoint(ctx context.Context, request UpdateDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Update a Database Project. + UpdateDatabaseProject(ctx context.Context, request UpdateDatabaseProjectRequest) (*DatabaseProject, error) +} + +func NewDatabaseProject(client *client.DatabricksClient) *DatabaseProjectAPI { + return &DatabaseProjectAPI{ + databaseProjectImpl: databaseProjectImpl{ + client: client, + }, + } +} + +// Database Projects provide access to a database via REST API or direct SQL. +type DatabaseProjectAPI struct { + databaseProjectImpl +} diff --git a/service/database/impl.go b/service/database/impl.go index 7976a50c6..36102eab2 100755 --- a/service/database/impl.go +++ b/service/database/impl.go @@ -10,6 +10,7 @@ import ( "github.com/databricks/databricks-sdk-go/client" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" + "github.com/google/uuid" "golang.org/x/exp/slices" ) @@ -122,6 +123,17 @@ func (a *databaseImpl) DeleteSyncedDatabaseTable(ctx context.Context, request De return err } +func (a *databaseImpl) FailoverDatabaseInstance(ctx context.Context, request FailoverDatabaseInstanceRequest) (*DatabaseInstance, error) { + var databaseInstance DatabaseInstance + path := fmt.Sprintf("/api/2.0/database/instances/%v/failover", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &databaseInstance) + return &databaseInstance, err +} + func (a *databaseImpl) FindDatabaseInstanceByUid(ctx context.Context, request FindDatabaseInstanceByUidRequest) (*DatabaseInstance, error) { var databaseInstance DatabaseInstance path := "/api/2.0/database/instances:findByUid" @@ -134,6 +146,9 @@ func (a *databaseImpl) FindDatabaseInstanceByUid(ctx context.Context, request Fi func (a *databaseImpl) GenerateDatabaseCredential(ctx context.Context, request GenerateDatabaseCredentialRequest) (*DatabaseCredential, error) { var databaseCredential DatabaseCredential + if request.RequestId == "" { + request.RequestId = uuid.New().String() + } path := "/api/2.0/database/credentials" queryParams := make(map[string]any) headers := make(map[string]string) @@ -395,6 +410,21 @@ func (a *databaseImpl) UpdateDatabaseInstance(ctx context.Context, request Updat return &databaseInstance, err } +func (a *databaseImpl) UpdateDatabaseInstanceRole(ctx context.Context, request UpdateDatabaseInstanceRoleRequest) (*DatabaseInstanceRole, error) { + var databaseInstanceRole DatabaseInstanceRole + path := fmt.Sprintf("/api/2.0/database/instances/%v/roles/%v", request.InstanceName, request.Name) + queryParams := make(map[string]any) + + if request.DatabaseInstanceName != "" || slices.Contains(request.ForceSendFields, "DatabaseInstanceName") { + queryParams["database_instance_name"] = request.DatabaseInstanceName + } + 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.DatabaseInstanceRole, &databaseInstanceRole) + return &databaseInstanceRole, err +} + func (a *databaseImpl) UpdateSyncedDatabaseTable(ctx context.Context, request UpdateSyncedDatabaseTableRequest) (*SyncedDatabaseTable, error) { var syncedDatabaseTable SyncedDatabaseTable path := fmt.Sprintf("/api/2.0/database/synced_tables/%v", request.Name) @@ -409,3 +439,277 @@ func (a *databaseImpl) UpdateSyncedDatabaseTable(ctx context.Context, request Up err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.SyncedTable, &syncedDatabaseTable) return &syncedDatabaseTable, err } + +// unexported type that holds implementations of just DatabaseProject API methods +type databaseProjectImpl struct { + client *client.DatabricksClient +} + +func (a *databaseProjectImpl) CreateDatabaseBranch(ctx context.Context, request CreateDatabaseBranchRequest) (*DatabaseBranch, error) { + var databaseBranch DatabaseBranch + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches", request.ProjectId) + 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.DatabaseBranch, &databaseBranch) + return &databaseBranch, err +} + +func (a *databaseProjectImpl) CreateDatabaseEndpoint(ctx context.Context, request CreateDatabaseEndpointRequest) (*DatabaseEndpoint, error) { + var databaseEndpoint DatabaseEndpoint + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints", request.ProjectId, request.BranchId) + 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.DatabaseEndpoint, &databaseEndpoint) + return &databaseEndpoint, err +} + +func (a *databaseProjectImpl) CreateDatabaseProject(ctx context.Context, request CreateDatabaseProjectRequest) (*DatabaseProject, error) { + var databaseProject DatabaseProject + path := "/api/2.0/database/projects" + 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.DatabaseProject, &databaseProject) + return &databaseProject, err +} + +func (a *databaseProjectImpl) DeleteDatabaseBranch(ctx context.Context, request DeleteDatabaseBranchRequest) error { + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v", request.ProjectId, request.BranchId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *databaseProjectImpl) DeleteDatabaseEndpoint(ctx context.Context, request DeleteDatabaseEndpointRequest) error { + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints/%v", request.ProjectId, request.BranchId, request.EndpointId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *databaseProjectImpl) DeleteDatabaseProject(ctx context.Context, request DeleteDatabaseProjectRequest) error { + path := fmt.Sprintf("/api/2.0/database/projects/%v", request.ProjectId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *databaseProjectImpl) GetDatabaseBranch(ctx context.Context, request GetDatabaseBranchRequest) (*DatabaseBranch, error) { + var databaseBranch DatabaseBranch + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v", request.ProjectId, request.BranchId) + 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, &databaseBranch) + return &databaseBranch, err +} + +func (a *databaseProjectImpl) GetDatabaseEndpoint(ctx context.Context, request GetDatabaseEndpointRequest) (*DatabaseEndpoint, error) { + var databaseEndpoint DatabaseEndpoint + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints/%v", request.ProjectId, request.BranchId, request.EndpointId) + 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, &databaseEndpoint) + return &databaseEndpoint, err +} + +func (a *databaseProjectImpl) GetDatabaseProject(ctx context.Context, request GetDatabaseProjectRequest) (*DatabaseProject, error) { + var databaseProject DatabaseProject + path := fmt.Sprintf("/api/2.0/database/projects/%v", request.ProjectId) + 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, &databaseProject) + return &databaseProject, err +} + +// List Database Branches. +func (a *databaseProjectImpl) ListDatabaseBranches(ctx context.Context, request ListDatabaseBranchesRequest) listing.Iterator[DatabaseBranch] { + + getNextPage := func(ctx context.Context, req ListDatabaseBranchesRequest) (*ListDatabaseBranchesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListDatabaseBranches(ctx, req) + } + getItems := func(resp *ListDatabaseBranchesResponse) []DatabaseBranch { + return resp.DatabaseBranches + } + getNextReq := func(resp *ListDatabaseBranchesResponse) *ListDatabaseBranchesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List Database Branches. +func (a *databaseProjectImpl) ListDatabaseBranchesAll(ctx context.Context, request ListDatabaseBranchesRequest) ([]DatabaseBranch, error) { + iterator := a.ListDatabaseBranches(ctx, request) + return listing.ToSlice[DatabaseBranch](ctx, iterator) +} + +func (a *databaseProjectImpl) internalListDatabaseBranches(ctx context.Context, request ListDatabaseBranchesRequest) (*ListDatabaseBranchesResponse, error) { + var listDatabaseBranchesResponse ListDatabaseBranchesResponse + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches", request.ProjectId) + 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, &listDatabaseBranchesResponse) + return &listDatabaseBranchesResponse, err +} + +// List Database Endpoints. +func (a *databaseProjectImpl) ListDatabaseEndpoints(ctx context.Context, request ListDatabaseEndpointsRequest) listing.Iterator[DatabaseEndpoint] { + + getNextPage := func(ctx context.Context, req ListDatabaseEndpointsRequest) (*ListDatabaseEndpointsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListDatabaseEndpoints(ctx, req) + } + getItems := func(resp *ListDatabaseEndpointsResponse) []DatabaseEndpoint { + return resp.DatabaseEndpoints + } + getNextReq := func(resp *ListDatabaseEndpointsResponse) *ListDatabaseEndpointsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List Database Endpoints. +func (a *databaseProjectImpl) ListDatabaseEndpointsAll(ctx context.Context, request ListDatabaseEndpointsRequest) ([]DatabaseEndpoint, error) { + iterator := a.ListDatabaseEndpoints(ctx, request) + return listing.ToSlice[DatabaseEndpoint](ctx, iterator) +} + +func (a *databaseProjectImpl) internalListDatabaseEndpoints(ctx context.Context, request ListDatabaseEndpointsRequest) (*ListDatabaseEndpointsResponse, error) { + var listDatabaseEndpointsResponse ListDatabaseEndpointsResponse + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints", request.ProjectId, request.BranchId) + 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, &listDatabaseEndpointsResponse) + return &listDatabaseEndpointsResponse, err +} + +// List Database Instances. +func (a *databaseProjectImpl) ListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) listing.Iterator[DatabaseProject] { + + getNextPage := func(ctx context.Context, req ListDatabaseProjectsRequest) (*ListDatabaseProjectsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListDatabaseProjects(ctx, req) + } + getItems := func(resp *ListDatabaseProjectsResponse) []DatabaseProject { + return resp.DatabaseProjects + } + getNextReq := func(resp *ListDatabaseProjectsResponse) *ListDatabaseProjectsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List Database Instances. +func (a *databaseProjectImpl) ListDatabaseProjectsAll(ctx context.Context, request ListDatabaseProjectsRequest) ([]DatabaseProject, error) { + iterator := a.ListDatabaseProjects(ctx, request) + return listing.ToSlice[DatabaseProject](ctx, iterator) +} + +func (a *databaseProjectImpl) internalListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) (*ListDatabaseProjectsResponse, error) { + var listDatabaseProjectsResponse ListDatabaseProjectsResponse + path := "/api/2.0/database/projects" + 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, &listDatabaseProjectsResponse) + return &listDatabaseProjectsResponse, err +} + +func (a *databaseProjectImpl) RestartDatabaseEndpoint(ctx context.Context, request RestartDatabaseEndpointRequest) (*DatabaseEndpoint, error) { + var databaseEndpoint DatabaseEndpoint + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints/%v/restart", request.ProjectId, request.BranchId, request.EndpointId) + 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, &databaseEndpoint) + return &databaseEndpoint, err +} + +func (a *databaseProjectImpl) UpdateDatabaseBranch(ctx context.Context, request UpdateDatabaseBranchRequest) (*DatabaseBranch, error) { + var databaseBranch DatabaseBranch + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v", request.ProjectId, request.BranchId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseBranch, &databaseBranch) + return &databaseBranch, err +} + +func (a *databaseProjectImpl) UpdateDatabaseEndpoint(ctx context.Context, request UpdateDatabaseEndpointRequest) (*DatabaseEndpoint, error) { + var databaseEndpoint DatabaseEndpoint + path := fmt.Sprintf("/api/2.0/database/projects/%v/branches/%v/endpoints/%v", request.ProjectId, request.BranchId, request.EndpointId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseEndpoint, &databaseEndpoint) + return &databaseEndpoint, err +} + +func (a *databaseProjectImpl) UpdateDatabaseProject(ctx context.Context, request UpdateDatabaseProjectRequest) (*DatabaseProject, error) { + var databaseProject DatabaseProject + path := fmt.Sprintf("/api/2.0/database/projects/%v", request.ProjectId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseProject, &databaseProject) + return &databaseProject, err +} diff --git a/service/database/interface.go b/service/database/interface.go index 38e9aa038..c9369374e 100755 --- a/service/database/interface.go +++ b/service/database/interface.go @@ -43,6 +43,9 @@ type DatabaseService interface { // Delete a Synced Database Table. DeleteSyncedDatabaseTable(ctx context.Context, request DeleteSyncedDatabaseTableRequest) error + // Failover the primary node of a Database Instance to a secondary. + FailoverDatabaseInstance(ctx context.Context, request FailoverDatabaseInstanceRequest) (*DatabaseInstance, error) + // Find a Database Instance by uid. FindDatabaseInstanceByUid(ctx context.Context, request FindDatabaseInstanceByUidRequest) (*DatabaseInstance, error) @@ -86,6 +89,65 @@ type DatabaseService interface { // Update a Database Instance. UpdateDatabaseInstance(ctx context.Context, request UpdateDatabaseInstanceRequest) (*DatabaseInstance, error) + // Update a role for a Database Instance. + UpdateDatabaseInstanceRole(ctx context.Context, request UpdateDatabaseInstanceRoleRequest) (*DatabaseInstanceRole, error) + // This API is currently unimplemented, but exposed for Terraform support. UpdateSyncedDatabaseTable(ctx context.Context, request UpdateSyncedDatabaseTableRequest) (*SyncedDatabaseTable, error) } + +// Database Projects provide access to a database via REST API or direct SQL. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type DatabaseProjectService interface { + + // Create a Database Branch. + CreateDatabaseBranch(ctx context.Context, request CreateDatabaseBranchRequest) (*DatabaseBranch, error) + + // Create a Database Endpoint. + CreateDatabaseEndpoint(ctx context.Context, request CreateDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Create a Database Project. + CreateDatabaseProject(ctx context.Context, request CreateDatabaseProjectRequest) (*DatabaseProject, error) + + // Delete a Database Branch. + DeleteDatabaseBranch(ctx context.Context, request DeleteDatabaseBranchRequest) error + + // Delete a Database Endpoint. + DeleteDatabaseEndpoint(ctx context.Context, request DeleteDatabaseEndpointRequest) error + + // Delete a Database Project. + DeleteDatabaseProject(ctx context.Context, request DeleteDatabaseProjectRequest) error + + // Get a Database Branch. + GetDatabaseBranch(ctx context.Context, request GetDatabaseBranchRequest) (*DatabaseBranch, error) + + // Get a Database Endpoint. + GetDatabaseEndpoint(ctx context.Context, request GetDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Get a Database Project. + GetDatabaseProject(ctx context.Context, request GetDatabaseProjectRequest) (*DatabaseProject, error) + + // List Database Branches. + ListDatabaseBranches(ctx context.Context, request ListDatabaseBranchesRequest) (*ListDatabaseBranchesResponse, error) + + // List Database Endpoints. + ListDatabaseEndpoints(ctx context.Context, request ListDatabaseEndpointsRequest) (*ListDatabaseEndpointsResponse, error) + + // List Database Instances. + ListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) (*ListDatabaseProjectsResponse, error) + + // Restart a Database Endpoint. TODO: should return + // databricks.longrunning.Operation + RestartDatabaseEndpoint(ctx context.Context, request RestartDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Update a Database Branch. + UpdateDatabaseBranch(ctx context.Context, request UpdateDatabaseBranchRequest) (*DatabaseBranch, error) + + // Update a Database Endpoint. TODO: should return + // databricks.longrunning.Operation { + UpdateDatabaseEndpoint(ctx context.Context, request UpdateDatabaseEndpointRequest) (*DatabaseEndpoint, error) + + // Update a Database Project. + UpdateDatabaseProject(ctx context.Context, request UpdateDatabaseProjectRequest) (*DatabaseProject, error) +} diff --git a/service/database/model.go b/service/database/model.go index fdf21c58b..4d3468a2e 100755 --- a/service/database/model.go +++ b/service/database/model.go @@ -8,10 +8,24 @@ import ( "github.com/databricks/databricks-sdk-go/marshal" ) +type CreateDatabaseBranchRequest struct { + DatabaseBranch DatabaseBranch `json:"database_branch"` + + ProjectId string `json:"-" url:"-"` +} + type CreateDatabaseCatalogRequest struct { Catalog DatabaseCatalog `json:"catalog"` } +type CreateDatabaseEndpointRequest struct { + BranchId string `json:"-" url:"-"` + + DatabaseEndpoint DatabaseEndpoint `json:"database_endpoint"` + + ProjectId string `json:"-" url:"-"` +} + type CreateDatabaseInstanceRequest struct { // Instance to create. DatabaseInstance DatabaseInstance `json:"database_instance"` @@ -35,6 +49,10 @@ func (s CreateDatabaseInstanceRoleRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type CreateDatabaseProjectRequest struct { + DatabaseProject DatabaseProject `json:"database_project"` +} + type CreateDatabaseTableRequest struct { Table DatabaseTable `json:"table"` } @@ -60,12 +78,63 @@ func (s CustomTag) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type DatabaseBranch struct { + BranchId string `json:"branch_id,omitempty"` + // A timestamp indicating when the branch was created. + CreateTime string `json:"create_time,omitempty"` + // The branch’s state, indicating if it is initializing, ready for use, or + // archived. + CurrentState string `json:"current_state,omitempty"` + // Whether the branch is the project's default branch. This field is only + // returned on create/update responses. See effective_default for the value + // that is actually applied to the database branch. + Default bool `json:"default,omitempty"` + // Whether the branch is the project's default branch. + EffectiveDefault bool `json:"effective_default,omitempty"` + // Whether the branch is protected. + IsProtected bool `json:"is_protected,omitempty"` + // The logical size of the branch. + LogicalSizeBytes int64 `json:"logical_size_bytes,omitempty"` + // The id of the parent branch + ParentId string `json:"parent_id,omitempty"` + // The Log Sequence Number (LSN) on the parent branch from which this branch + // was created. When restoring a branch using the Restore Database Branch + // endpoint, this value isn’t finalized until all operations related to + // the restore have completed successfully. + ParentLsn string `json:"parent_lsn,omitempty"` + // The point in time on the parent branch from which this branch was + // created. + ParentTime string `json:"parent_time,omitempty"` + + PendingState string `json:"pending_state,omitempty"` + + ProjectId string `json:"project_id"` + // A timestamp indicating when the `current_state` began. + StateChangeTime string `json:"state_change_time,omitempty"` + // A timestamp indicating when the branch was last updated. + UpdateTime string `json:"update_time,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseBranch) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseBranch) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type DatabaseCatalog struct { CreateDatabaseIfNotExists bool `json:"create_database_if_not_exists,omitempty"` + // The branch_id of the database branch associated with the catalog. + DatabaseBranchId string `json:"database_branch_id,omitempty"` // The name of the DatabaseInstance housing the database. DatabaseInstanceName string `json:"database_instance_name"` // The name of the database (in a instance) associated with the catalog. DatabaseName string `json:"database_name"` + // The project_id of the database project associated with the catalog. + DatabaseProjectId string `json:"database_project_id,omitempty"` // The name of the catalog in UC. Name string `json:"name"` @@ -98,6 +167,183 @@ func (s DatabaseCredential) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type DatabaseEndpoint struct { + // The maximum number of Compute Units. + AutoscalingLimitMaxCu float64 `json:"autoscaling_limit_max_cu,omitempty"` + // The minimum number of Compute Units. + AutoscalingLimitMinCu float64 `json:"autoscaling_limit_min_cu,omitempty"` + + BranchId string `json:"branch_id"` + // A timestamp indicating when the compute endpoint was created. + CreateTime string `json:"create_time,omitempty"` + + CurrentState DatabaseEndpointState `json:"current_state,omitempty"` + // Whether to restrict connections to the compute endpoint. Enabling this + // option schedules a suspend compute operation. A disabled compute endpoint + // cannot be enabled by a connection or console action. + Disabled bool `json:"disabled,omitempty"` + + EndpointId string `json:"endpoint_id,omitempty"` + // The hostname of the compute endpoint. This is the hostname specified when + // connecting to a database. + Host string `json:"host,omitempty"` + // A timestamp indicating when the compute endpoint was last active. + LastActiveTime string `json:"last_active_time,omitempty"` + + PendingState DatabaseEndpointState `json:"pending_state,omitempty"` + + PoolerMode DatabaseEndpointPoolerMode `json:"pooler_mode,omitempty"` + + ProjectId string `json:"project_id"` + + Settings *DatabaseEndpointSettings `json:"settings,omitempty"` + // A timestamp indicating when the compute endpoint was last started. + StartTime string `json:"start_time,omitempty"` + // A timestamp indicating when the compute endpoint was last suspended. + SuspendTime string `json:"suspend_time,omitempty"` + // Duration of inactivity after which the compute endpoint is automatically + // suspended. + SuspendTimeoutDuration string `json:"suspend_timeout_duration,omitempty"` + // NOTE: if want type to default to some value set the server then an + // effective_type field OR make this field REQUIRED + Type DatabaseEndpointType `json:"type,omitempty"` + // A timestamp indicating when the compute endpoint was last updated. + UpdateTime string `json:"update_time,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseEndpoint) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseEndpoint) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// The connection pooler mode. Lakebase supports PgBouncer in `transaction` mode +// only. +type DatabaseEndpointPoolerMode string + +const DatabaseEndpointPoolerModeTransaction DatabaseEndpointPoolerMode = `TRANSACTION` + +// String representation for [fmt.Print] +func (f *DatabaseEndpointPoolerMode) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DatabaseEndpointPoolerMode) Set(v string) error { + switch v { + case `TRANSACTION`: + *f = DatabaseEndpointPoolerMode(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "TRANSACTION"`, v) + } +} + +// Values returns all possible values for DatabaseEndpointPoolerMode. +// +// There is no guarantee on the order of the values in the slice. +func (f *DatabaseEndpointPoolerMode) Values() []DatabaseEndpointPoolerMode { + return []DatabaseEndpointPoolerMode{ + DatabaseEndpointPoolerModeTransaction, + } +} + +// Type always returns DatabaseEndpointPoolerMode to satisfy [pflag.Value] interface +func (f *DatabaseEndpointPoolerMode) Type() string { + return "DatabaseEndpointPoolerMode" +} + +// A collection of settings for a compute endpoint +type DatabaseEndpointSettings struct { + // A raw representation of Postgres settings. + PgSettings map[string]string `json:"pg_settings,omitempty"` + // A raw representation of PgBouncer settings. + PgbouncerSettings map[string]string `json:"pgbouncer_settings,omitempty"` +} + +// The state of the compute endpoint +type DatabaseEndpointState string + +const DatabaseEndpointStateActive DatabaseEndpointState = `ACTIVE` + +const DatabaseEndpointStateIdle DatabaseEndpointState = `IDLE` + +const DatabaseEndpointStateInit DatabaseEndpointState = `INIT` + +// String representation for [fmt.Print] +func (f *DatabaseEndpointState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DatabaseEndpointState) Set(v string) error { + switch v { + case `ACTIVE`, `IDLE`, `INIT`: + *f = DatabaseEndpointState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ACTIVE", "IDLE", "INIT"`, v) + } +} + +// Values returns all possible values for DatabaseEndpointState. +// +// There is no guarantee on the order of the values in the slice. +func (f *DatabaseEndpointState) Values() []DatabaseEndpointState { + return []DatabaseEndpointState{ + DatabaseEndpointStateActive, + DatabaseEndpointStateIdle, + DatabaseEndpointStateInit, + } +} + +// Type always returns DatabaseEndpointState to satisfy [pflag.Value] interface +func (f *DatabaseEndpointState) Type() string { + return "DatabaseEndpointState" +} + +// The compute endpoint type. Either `read_write` or `read_only`. +type DatabaseEndpointType string + +const DatabaseEndpointTypeReadOnly DatabaseEndpointType = `READ_ONLY` + +const DatabaseEndpointTypeReadWrite DatabaseEndpointType = `READ_WRITE` + +// String representation for [fmt.Print] +func (f *DatabaseEndpointType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DatabaseEndpointType) Set(v string) error { + switch v { + case `READ_ONLY`, `READ_WRITE`: + *f = DatabaseEndpointType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "READ_ONLY", "READ_WRITE"`, v) + } +} + +// Values returns all possible values for DatabaseEndpointType. +// +// There is no guarantee on the order of the values in the slice. +func (f *DatabaseEndpointType) Values() []DatabaseEndpointType { + return []DatabaseEndpointType{ + DatabaseEndpointTypeReadOnly, + DatabaseEndpointTypeReadWrite, + } +} + +// Type always returns DatabaseEndpointType to satisfy [pflag.Value] interface +func (f *DatabaseEndpointType) Type() string { + return "DatabaseEndpointType" +} + // A DatabaseInstance represents a logical Postgres instance, comprised of both // compute and storage. type DatabaseInstance struct { @@ -402,6 +648,122 @@ func (f *DatabaseInstanceState) Type() string { return "DatabaseInstanceState" } +type DatabaseProject struct { + // The logical size limit for a branch. + BranchLogicalSizeLimitBytes int64 `json:"branch_logical_size_limit_bytes,omitempty"` + // The desired budget policy to associate with the instance. This field is + // only returned on create/update responses, and represents the customer + // provided budget policy. See effective_budget_policy_id for the policy + // that is actually applied to the instance. + BudgetPolicyId string `json:"budget_policy_id,omitempty"` + // The most recent time when any endpoint of this project was active. + ComputeLastActiveTime string `json:"compute_last_active_time,omitempty"` + // A timestamp indicating when the project was created. + CreateTime string `json:"create_time,omitempty"` + // Custom tags associated with the instance. + CustomTags []DatabaseProjectCustomTag `json:"custom_tags,omitempty"` + + DefaultEndpointSettings *DatabaseProjectDefaultEndpointSettings `json:"default_endpoint_settings,omitempty"` + // Human-readable project name. + DisplayName string `json:"display_name,omitempty"` + // The policy that is applied to the instance. + EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + + EffectiveDefaultEndpointSettings *DatabaseProjectDefaultEndpointSettings `json:"effective_default_endpoint_settings,omitempty"` + + EffectiveDisplayName string `json:"effective_display_name,omitempty"` + + EffectiveHistoryRetentionDuration string `json:"effective_history_retention_duration,omitempty"` + + EffectivePgVersion int `json:"effective_pg_version,omitempty"` + + EffectiveSettings *DatabaseProjectSettings `json:"effective_settings,omitempty"` + // The number of seconds to retain the shared history for point in time + // recovery for all branches in this project. + HistoryRetentionDuration string `json:"history_retention_duration,omitempty"` + // The major Postgres version number. + PgVersion int `json:"pg_version,omitempty"` + + ProjectId string `json:"project_id,omitempty"` + + Settings *DatabaseProjectSettings `json:"settings,omitempty"` + // The current space occupied by the project in storage. Synthetic storage + // size combines the logical data size and Write-Ahead Log (WAL) size for + // all branches in a project. + SyntheticStorageSizeBytes int64 `json:"synthetic_storage_size_bytes,omitempty"` + // A timestamp indicating when the project was last updated. + UpdateTime string `json:"update_time,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseProject) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseProject) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DatabaseProjectCustomTag struct { + // The key of the custom tag. + Key string `json:"key,omitempty"` + // The value of the custom tag. + Value string `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseProjectCustomTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseProjectCustomTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// A collection of settings for a database endpoint. +type DatabaseProjectDefaultEndpointSettings struct { + // The maximum number of Compute Units. + AutoscalingLimitMaxCu float64 `json:"autoscaling_limit_max_cu,omitempty"` + // The minimum number of Compute Units. + AutoscalingLimitMinCu float64 `json:"autoscaling_limit_min_cu,omitempty"` + // A raw representation of Postgres settings. + PgSettings map[string]string `json:"pg_settings,omitempty"` + // A raw representation of PgBouncer settings. + PgbouncerSettings map[string]string `json:"pgbouncer_settings,omitempty"` + // Duration of inactivity after which the compute endpoint is automatically + // suspended. + SuspendTimeoutDuration string `json:"suspend_timeout_duration,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseProjectDefaultEndpointSettings) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseProjectDefaultEndpointSettings) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DatabaseProjectSettings struct { + // Sets wal_level=logical for all compute endpoints in this project. All + // active endpoints will be suspended. Once enabled, logical replication + // cannot be disabled. + EnableLogicalReplication bool `json:"enable_logical_replication,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabaseProjectSettings) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabaseProjectSettings) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Next field marker: 13 type DatabaseTable struct { // Name of the target database instance. This is required when creating @@ -425,6 +787,8 @@ type DatabaseTable struct { LogicalDatabaseName string `json:"logical_database_name,omitempty"` // Full three-part (catalog, schema, table) name of the table. Name string `json:"name"` + // Data serving REST API URL for this table + TableServingUrl string `json:"table_serving_url,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -437,10 +801,24 @@ func (s DatabaseTable) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type DeleteDatabaseBranchRequest struct { + BranchId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` +} + type DeleteDatabaseCatalogRequest struct { Name string `json:"-" url:"-"` } +type DeleteDatabaseEndpointRequest struct { + BranchId string `json:"-" url:"-"` + + EndpointId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` +} + type DeleteDatabaseInstanceRequest struct { // By default, a instance cannot be deleted if it has descendant instances // created via PITR. If this flag is specified as true, all descendent @@ -486,6 +864,10 @@ func (s DeleteDatabaseInstanceRoleRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type DeleteDatabaseProjectRequest struct { + ProjectId string `json:"-" url:"-"` +} + type DeleteDatabaseTableRequest struct { Name string `json:"-" url:"-"` } @@ -513,6 +895,22 @@ func (s DeltaTableSyncInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type FailoverDatabaseInstanceRequest struct { + FailoverTargetDatabaseInstanceName string `json:"failover_target_database_instance_name,omitempty"` + // Name of the instance to failover. + Name string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *FailoverDatabaseInstanceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s FailoverDatabaseInstanceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type FindDatabaseInstanceByUidRequest struct { // UID of the cluster to get. Uid string `json:"-" url:"uid,omitempty"` @@ -550,10 +948,24 @@ func (s GenerateDatabaseCredentialRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type GetDatabaseBranchRequest struct { + BranchId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` +} + type GetDatabaseCatalogRequest struct { Name string `json:"-" url:"-"` } +type GetDatabaseEndpointRequest struct { + BranchId string `json:"-" url:"-"` + + EndpointId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` +} + type GetDatabaseInstanceRequest struct { // Name of the cluster to get. Name string `json:"-" url:"-"` @@ -565,6 +977,10 @@ type GetDatabaseInstanceRoleRequest struct { Name string `json:"-" url:"-"` } +type GetDatabaseProjectRequest struct { + ProjectId string `json:"-" url:"-"` +} + type GetDatabaseTableRequest struct { Name string `json:"-" url:"-"` } @@ -573,6 +989,43 @@ type GetSyncedDatabaseTableRequest struct { Name string `json:"-" url:"-"` } +type ListDatabaseBranchesRequest struct { + // Upper bound for items returned. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page of Database Branches. Requests + // first page if absent. + PageToken string `json:"-" url:"page_token,omitempty"` + + ProjectId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseBranchesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseBranchesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListDatabaseBranchesResponse struct { + // List of branches. + DatabaseBranches []DatabaseBranch `json:"database_branches,omitempty"` + // Pagination token to request the next page of instances. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseBranchesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseBranchesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListDatabaseCatalogsRequest struct { // Name of the instance to get database catalogs for. InstanceName string `json:"-" url:"-"` @@ -609,6 +1062,44 @@ func (s ListDatabaseCatalogsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListDatabaseEndpointsRequest struct { + BranchId string `json:"-" url:"-"` + // Upper bound for items returned. If specified must be at least 10. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page of Database Endpoints. Requests + // first page if absent. + PageToken string `json:"-" url:"page_token,omitempty"` + + ProjectId string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseEndpointsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseEndpointsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListDatabaseEndpointsResponse struct { + // List of endpoints. + DatabaseEndpoints []DatabaseEndpoint `json:"database_endpoints,omitempty"` + // Pagination token to request the next page of instances. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseEndpointsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseEndpointsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListDatabaseInstanceRolesRequest struct { InstanceName string `json:"-" url:"-"` // Upper bound for items returned. @@ -680,6 +1171,41 @@ func (s ListDatabaseInstancesResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListDatabaseProjectsRequest struct { + // Upper bound for items returned. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page of Database Projects. Requests + // first page if absent. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseProjectsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseProjectsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListDatabaseProjectsResponse struct { + // List of projects. + DatabaseProjects []DatabaseProject `json:"database_projects,omitempty"` + // Pagination token to request the next page of instances. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListDatabaseProjectsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListDatabaseProjectsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListSyncedDatabaseTablesRequest struct { // Name of the instance to get synced tables for. InstanceName string `json:"-" url:"-"` @@ -721,6 +1247,8 @@ func (s ListSyncedDatabaseTablesResponse) MarshalJSON() ([]byte, error) { // SyncedDatabaseTable. Note that other fields of pipeline are still inferred by // table def internally type NewPipelineSpec struct { + // Budget policy of this pipeline. + BudgetPolicyId string `json:"budget_policy_id,omitempty"` // This field needs to be specified if the destination catalog is a managed // postgres catalog. // @@ -893,10 +1421,20 @@ func (s RequestedResource) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type RestartDatabaseEndpointRequest struct { + BranchId string `json:"-" url:"-"` + + EndpointId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` +} + // Next field marker: 18 type SyncedDatabaseTable struct { // Synced Table data synchronization status DataSynchronizationStatus *SyncedTableStatus `json:"data_synchronization_status,omitempty"` + // The branch_id of the database branch associated with the table. + DatabaseBranchId string `json:"database_branch_id,omitempty"` // Name of the target database instance. This is required when creating // synced database tables in standard catalogs. This is optional when // creating synced database tables in registered catalogs. If this field is @@ -904,10 +1442,16 @@ type SyncedDatabaseTable struct { // the database instance name MUST match that of the registered catalog (or // the request will be rejected). DatabaseInstanceName string `json:"database_instance_name,omitempty"` + // The project_id of the database project associated with the table. + DatabaseProjectId string `json:"database_project_id,omitempty"` + // The branch_id of the database branch associated with the table. + EffectiveDatabaseBranchId string `json:"effective_database_branch_id,omitempty"` // The name of the database instance that this table is registered to. This // field is always returned, and for tables inside database catalogs is // inferred database instance associated with the catalog. EffectiveDatabaseInstanceName string `json:"effective_database_instance_name,omitempty"` + // The project_id of the database project associated with the table. + EffectiveDatabaseProjectId string `json:"effective_database_project_id,omitempty"` // The name of the logical database that this table is registered to. EffectiveLogicalDatabaseName string `json:"effective_logical_database_name,omitempty"` // Target Postgres database object (logical database) name for this table. @@ -927,6 +1471,8 @@ type SyncedDatabaseTable struct { Name string `json:"name"` Spec *SyncedTableSpec `json:"spec,omitempty"` + // Data serving REST API URL for this table + TableServingUrl string `json:"table_serving_url,omitempty"` // The provisioning state of the synced table entity in Unity Catalog. This // is distinct from the state of the data synchronization pipeline (i.e. the // table may be in "ACTIVE" but the pipeline may be in "PROVISIONING" as it @@ -1267,6 +1813,17 @@ func (s SyncedTableTriggeredUpdateStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateDatabaseBranchRequest struct { + BranchId string `json:"-" url:"-"` + + DatabaseBranch DatabaseBranch `json:"database_branch"` + + ProjectId string `json:"-" url:"-"` + // The list of fields to update. If unspecified, all fields will be updated + // when possible. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateDatabaseCatalogRequest struct { // Note that updating a database catalog is not yet supported. DatabaseCatalog DatabaseCatalog `json:"database_catalog"` @@ -1276,6 +1833,19 @@ type UpdateDatabaseCatalogRequest struct { UpdateMask string `json:"-" url:"update_mask"` } +type UpdateDatabaseEndpointRequest struct { + BranchId string `json:"-" url:"-"` + + DatabaseEndpoint DatabaseEndpoint `json:"database_endpoint"` + + EndpointId string `json:"-" url:"-"` + + ProjectId string `json:"-" url:"-"` + // The list of fields to update. If unspecified, all fields will be updated + // when possible. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateDatabaseInstanceRequest struct { DatabaseInstance DatabaseInstance `json:"database_instance"` // The name of the instance. This is the unique identifier for the instance. @@ -1286,6 +1856,36 @@ type UpdateDatabaseInstanceRequest struct { UpdateMask string `json:"-" url:"update_mask"` } +type UpdateDatabaseInstanceRoleRequest struct { + DatabaseInstanceName string `json:"-" url:"database_instance_name,omitempty"` + + DatabaseInstanceRole DatabaseInstanceRole `json:"database_instance_role"` + + InstanceName string `json:"-" url:"-"` + // The name of the role. This is the unique identifier for the role in an + // instance. + Name string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateDatabaseInstanceRoleRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateDatabaseInstanceRoleRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type UpdateDatabaseProjectRequest struct { + DatabaseProject DatabaseProject `json:"database_project"` + + ProjectId string `json:"-" url:"-"` + // The list of fields to update. If unspecified, all fields will be updated + // when possible. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateSyncedDatabaseTableRequest struct { // Full three-part (catalog, schema, table) name of the table. Name string `json:"-" url:"-"` diff --git a/service/dataquality/api.go b/service/dataquality/api.go index fde2f9a7c..4f3f5675b 100755 --- a/service/dataquality/api.go +++ b/service/dataquality/api.go @@ -14,70 +14,104 @@ import ( type DataQualityInterface interface { // Cancels a data quality monitor refresh. Currently only supported for the - // `table` `object_type`. + // `table` `object_type`. The call must be made in the same workspace as where + // the monitor was created. + // + // The caller must have either of the following sets of permissions: 1. + // **MANAGE** and **USE_CATALOG** on the table's parent catalog. 2. + // **USE_CATALOG** on the table's parent catalog, and **MANAGE** and + // **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the + // table's parent catalog, **USE_SCHEMA** on the table's parent schema, and + // **MANAGE** on the table. CancelRefresh(ctx context.Context, request CancelRefreshRequest) (*CancelRefreshResponse, error) // Create a data quality monitor on a Unity Catalog object. The caller must // provide either `anomaly_detection_config` for a schema monitor or // `data_profiling_config` for a table monitor. // - // For the `table` `object_type`, the caller must either: 1. be an owner of the - // table's parent catalog, have **USE_SCHEMA** on the table's parent schema, and - // have **SELECT** access on the table 2. have **USE_CATALOG** on the table's - // parent catalog, be an owner of the table's parent schema, and have **SELECT** - // access on the table. 3. have the following permissions: - **USE_CATALOG** on - // the table's parent catalog - **USE_SCHEMA** on the table's parent schema - be - // an owner of the table. + // For the `table` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the table's parent + // catalog, **USE_SCHEMA** on the table's parent schema, and **SELECT** on the + // table 2. **USE_CATALOG** on the table's parent catalog, **MANAGE** and + // **USE_SCHEMA** on the table's parent schema, and **SELECT** on the table. 3. + // **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's + // parent schema, and **MANAGE** and **SELECT** on the table. // // Workspace assets, such as the dashboard, will be created in the workspace // where this call was made. + // + // For the `schema` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the schema's parent + // catalog. 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** + // and **USE_SCHEMA** on the schema. CreateMonitor(ctx context.Context, request CreateMonitorRequest) (*Monitor, error) // Creates a refresh. Currently only supported for the `table` `object_type`. + // The call must be made in the same workspace as where the monitor was created. // - // The caller must either: 1. be an owner of the table's parent catalog 2. have - // **USE_CATALOG** on the table's parent catalog and be an owner of the table's - // parent schema 3. have the following permissions: - **USE_CATALOG** on the - // table's parent catalog - **USE_SCHEMA** on the table's parent schema - be an - // owner of the table + // The caller must have either of the following sets of permissions: 1. + // **MANAGE** and **USE_CATALOG** on the table's parent catalog. 2. + // **USE_CATALOG** on the table's parent catalog, and **MANAGE** and + // **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the + // table's parent catalog, **USE_SCHEMA** on the table's parent schema, and + // **MANAGE** on the table. CreateRefresh(ctx context.Context, request CreateRefreshRequest) (*Refresh, error) // Delete a data quality monitor on Unity Catalog object. // - // For the `table` `object_type`, the caller must either: 1. be an owner of the - // table's parent catalog 2. have **USE_CATALOG** on the table's parent catalog - // and be an owner of the table's parent schema 3. have the following - // permissions: - **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** - // on the table's parent schema - be an owner of the table. + // For the `table` `object_type`, the caller must have either of the following + // sets of permissions: **MANAGE** and **USE_CATALOG** on the table's parent + // catalog. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and + // **USE_SCHEMA** on the table's parent schema. **USE_CATALOG** on the table's + // parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** + // on the table. // // Note that the metric tables and dashboard will not be deleted as part of this // call; those assets must be manually cleaned up (if desired). + // + // For the `schema` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the schema's parent + // catalog. 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** + // and **USE_SCHEMA** on the schema. DeleteMonitor(ctx context.Context, request DeleteMonitorRequest) error // (Unimplemented) Delete a refresh DeleteRefresh(ctx context.Context, request DeleteRefreshRequest) error - // Read a data quality monitor on Unity Catalog object. + // Read a data quality monitor on a Unity Catalog object. + // + // For the `table` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the table's parent + // catalog. 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and + // **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the + // table's parent catalog, **USE_SCHEMA** on the table's parent schema, and + // **SELECT** on the table. // - // For the `table` `object_type`, the caller must either: 1. be an owner of the - // table's parent catalog 2. have **USE_CATALOG** on the table's parent catalog - // and be an owner of the table's parent schema. 3. have the following - // permissions: - **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** - // on the table's parent schema - **SELECT** privilege on the table. + // For the `schema` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the schema's parent + // catalog. 2. **USE_CATALOG** on the schema's parent catalog, and + // **USE_SCHEMA** on the schema. // - // The returned information includes configuration values, as well as - // information on assets created by the monitor. Some information (e.g., - // dashboard) may be filtered out if the caller is in a different workspace than - // where the monitor was created. + // The returned information includes configuration values on the entity and + // parent entity as well as information on assets created by the monitor. Some + // information (e.g. dashboard) may be filtered out if the caller is in a + // different workspace than where the monitor was created. GetMonitor(ctx context.Context, request GetMonitorRequest) (*Monitor, error) - // Get data quality monitor refresh. + // Get data quality monitor refresh. The call must be made in the same workspace + // as where the monitor was created. // - // For the `table` `object_type`, the caller must either: 1. be an owner of the - // table's parent catalog 2. have **USE_CATALOG** on the table's parent catalog - // and be an owner of the table's parent schema 3. have the following - // permissions: - **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** - // on the table's parent schema - **SELECT** privilege on the table. + // For the `table` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the table's parent + // catalog. 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and + // **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the + // table's parent catalog, **USE_SCHEMA** on the table's parent schema, and + // **SELECT** on the table. + // + // For the `schema` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the schema's parent + // catalog. 2. **USE_CATALOG** on the schema's parent catalog, and + // **USE_SCHEMA** on the schema. GetRefresh(ctx context.Context, request GetRefreshRequest) (*Refresh, error) // (Unimplemented) List data quality monitors. @@ -90,35 +124,55 @@ type DataQualityInterface interface { // This method is generated by Databricks SDK Code Generator. ListMonitorAll(ctx context.Context, request ListMonitorRequest) ([]Monitor, error) - // List data quality monitor refreshes. + // List data quality monitor refreshes. The call must be made in the same + // workspace as where the monitor was created. + // + // For the `table` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the table's parent + // catalog. 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and + // **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the + // table's parent catalog, **USE_SCHEMA** on the table's parent schema, and + // **SELECT** on the table. // - // For the `table` `object_type`, the caller must either: 1. be an owner of the - // table's parent catalog 2. have **USE_CATALOG** on the table's parent catalog - // and be an owner of the table's parent schema 3. have the following - // permissions: - **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** - // on the table's parent schema - **SELECT** privilege on the table. + // For the `schema` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the schema's parent + // catalog. 2. **USE_CATALOG** on the schema's parent catalog, and + // **USE_SCHEMA** on the schema. // // This method is generated by Databricks SDK Code Generator. ListRefresh(ctx context.Context, request ListRefreshRequest) listing.Iterator[Refresh] - // List data quality monitor refreshes. + // List data quality monitor refreshes. The call must be made in the same + // workspace as where the monitor was created. // - // For the `table` `object_type`, the caller must either: 1. be an owner of the - // table's parent catalog 2. have **USE_CATALOG** on the table's parent catalog - // and be an owner of the table's parent schema 3. have the following - // permissions: - **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** - // on the table's parent schema - **SELECT** privilege on the table. + // For the `table` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the table's parent + // catalog. 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and + // **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the + // table's parent catalog, **USE_SCHEMA** on the table's parent schema, and + // **SELECT** on the table. + // + // For the `schema` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the schema's parent + // catalog. 2. **USE_CATALOG** on the schema's parent catalog, and + // **USE_SCHEMA** on the schema. // // This method is generated by Databricks SDK Code Generator. ListRefreshAll(ctx context.Context, request ListRefreshRequest) ([]Refresh, error) // Update a data quality monitor on Unity Catalog object. // - // For the `table` `object_type`, The caller must either: 1. be an owner of the - // table's parent catalog 2. have **USE_CATALOG** on the table's parent catalog - // and be an owner of the table's parent schema 3. have the following - // permissions: - **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** - // on the table's parent schema - be an owner of the table. + // For the `table` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the table's parent + // catalog. 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and + // **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the + // table's parent catalog, **USE_SCHEMA** on the table's parent schema, and + // **MANAGE** on the table. + // + // For the `schema` `object_type`, the caller must have either of the following + // sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the schema's parent + // catalog. 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** + // and **USE_SCHEMA** on the schema. UpdateMonitor(ctx context.Context, request UpdateMonitorRequest) (*Monitor, error) // (Unimplemented) Update a refresh diff --git a/service/dataquality/impl.go b/service/dataquality/impl.go index 70cb23d66..86a8865d2 100755 --- a/service/dataquality/impl.go +++ b/service/dataquality/impl.go @@ -129,13 +129,20 @@ func (a *dataQualityImpl) internalListMonitor(ctx context.Context, request ListM return &listMonitorResponse, err } -// List data quality monitor refreshes. +// List data quality monitor refreshes. The call must be made in the same +// workspace as where the monitor was created. // -// For the `table` `object_type`, the caller must either: 1. be an owner of the -// table's parent catalog 2. have **USE_CATALOG** on the table's parent catalog -// and be an owner of the table's parent schema 3. have the following -// permissions: - **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** -// on the table's parent schema - **SELECT** privilege on the table. +// For the `table` `object_type`, the caller must have either of the following +// sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the table's parent +// catalog. 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and +// **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the +// table's parent catalog, **USE_SCHEMA** on the table's parent schema, and +// **SELECT** on the table. +// +// For the `schema` `object_type`, the caller must have either of the following +// sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the schema's parent +// catalog. 2. **USE_CATALOG** on the schema's parent catalog, and +// **USE_SCHEMA** on the schema. func (a *dataQualityImpl) ListRefresh(ctx context.Context, request ListRefreshRequest) listing.Iterator[Refresh] { getNextPage := func(ctx context.Context, req ListRefreshRequest) (*ListRefreshResponse, error) { @@ -160,13 +167,20 @@ func (a *dataQualityImpl) ListRefresh(ctx context.Context, request ListRefreshRe return iterator } -// List data quality monitor refreshes. +// List data quality monitor refreshes. The call must be made in the same +// workspace as where the monitor was created. +// +// For the `table` `object_type`, the caller must have either of the following +// sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the table's parent +// catalog. 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and +// **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the +// table's parent catalog, **USE_SCHEMA** on the table's parent schema, and +// **SELECT** on the table. // -// For the `table` `object_type`, the caller must either: 1. be an owner of the -// table's parent catalog 2. have **USE_CATALOG** on the table's parent catalog -// and be an owner of the table's parent schema 3. have the following -// permissions: - **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** -// on the table's parent schema - **SELECT** privilege on the table. +// For the `schema` `object_type`, the caller must have either of the following +// sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the schema's parent +// catalog. 2. **USE_CATALOG** on the schema's parent catalog, and +// **USE_SCHEMA** on the schema. func (a *dataQualityImpl) ListRefreshAll(ctx context.Context, request ListRefreshRequest) ([]Refresh, error) { iterator := a.ListRefresh(ctx, request) return listing.ToSlice[Refresh](ctx, iterator) diff --git a/service/dataquality/interface.go b/service/dataquality/interface.go index 160377390..3167b4a83 100755 --- a/service/dataquality/interface.go +++ b/service/dataquality/interface.go @@ -13,95 +13,140 @@ import ( type DataQualityService interface { // Cancels a data quality monitor refresh. Currently only supported for the - // `table` `object_type`. + // `table` `object_type`. The call must be made in the same workspace as + // where the monitor was created. + // + // The caller must have either of the following sets of permissions: 1. + // **MANAGE** and **USE_CATALOG** on the table's parent catalog. 2. + // **USE_CATALOG** on the table's parent catalog, and **MANAGE** and + // **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the + // table's parent catalog, **USE_SCHEMA** on the table's parent schema, and + // **MANAGE** on the table. CancelRefresh(ctx context.Context, request CancelRefreshRequest) (*CancelRefreshResponse, error) // Create a data quality monitor on a Unity Catalog object. The caller must // provide either `anomaly_detection_config` for a schema monitor or // `data_profiling_config` for a table monitor. // - // For the `table` `object_type`, the caller must either: 1. be an owner of - // the table's parent catalog, have **USE_SCHEMA** on the table's parent - // schema, and have **SELECT** access on the table 2. have **USE_CATALOG** - // on the table's parent catalog, be an owner of the table's parent schema, - // and have **SELECT** access on the table. 3. have the following - // permissions: - **USE_CATALOG** on the table's parent catalog - - // **USE_SCHEMA** on the table's parent schema - be an owner of the table. + // For the `table` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // table's parent catalog, **USE_SCHEMA** on the table's parent schema, and + // **SELECT** on the table 2. **USE_CATALOG** on the table's parent catalog, + // **MANAGE** and **USE_SCHEMA** on the table's parent schema, and + // **SELECT** on the table. 3. **USE_CATALOG** on the table's parent + // catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** and + // **SELECT** on the table. // // Workspace assets, such as the dashboard, will be created in the workspace // where this call was made. + // + // For the `schema` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // schema's parent catalog. 2. **USE_CATALOG** on the schema's parent + // catalog, and **MANAGE** and **USE_SCHEMA** on the schema. CreateMonitor(ctx context.Context, request CreateMonitorRequest) (*Monitor, error) // Creates a refresh. Currently only supported for the `table` - // `object_type`. + // `object_type`. The call must be made in the same workspace as where the + // monitor was created. // - // The caller must either: 1. be an owner of the table's parent catalog 2. - // have **USE_CATALOG** on the table's parent catalog and be an owner of the - // table's parent schema 3. have the following permissions: - - // **USE_CATALOG** on the table's parent catalog - **USE_SCHEMA** on the - // table's parent schema - be an owner of the table + // The caller must have either of the following sets of permissions: 1. + // **MANAGE** and **USE_CATALOG** on the table's parent catalog. 2. + // **USE_CATALOG** on the table's parent catalog, and **MANAGE** and + // **USE_SCHEMA** on the table's parent schema. 3. **USE_CATALOG** on the + // table's parent catalog, **USE_SCHEMA** on the table's parent schema, and + // **MANAGE** on the table. CreateRefresh(ctx context.Context, request CreateRefreshRequest) (*Refresh, error) // Delete a data quality monitor on Unity Catalog object. // - // For the `table` `object_type`, the caller must either: 1. be an owner of - // the table's parent catalog 2. have **USE_CATALOG** on the table's parent - // catalog and be an owner of the table's parent schema 3. have the - // following permissions: - **USE_CATALOG** on the table's parent catalog - - // **USE_SCHEMA** on the table's parent schema - be an owner of the table. + // For the `table` `object_type`, the caller must have either of the + // following sets of permissions: **MANAGE** and **USE_CATALOG** on the + // table's parent catalog. **USE_CATALOG** on the table's parent catalog, + // and **MANAGE** and **USE_SCHEMA** on the table's parent schema. + // **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the + // table's parent schema, and **MANAGE** on the table. // // Note that the metric tables and dashboard will not be deleted as part of // this call; those assets must be manually cleaned up (if desired). + // + // For the `schema` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // schema's parent catalog. 2. **USE_CATALOG** on the schema's parent + // catalog, and **MANAGE** and **USE_SCHEMA** on the schema. DeleteMonitor(ctx context.Context, request DeleteMonitorRequest) error // (Unimplemented) Delete a refresh DeleteRefresh(ctx context.Context, request DeleteRefreshRequest) error - // Read a data quality monitor on Unity Catalog object. - // - // For the `table` `object_type`, the caller must either: 1. be an owner of - // the table's parent catalog 2. have **USE_CATALOG** on the table's parent - // catalog and be an owner of the table's parent schema. 3. have the - // following permissions: - **USE_CATALOG** on the table's parent catalog - - // **USE_SCHEMA** on the table's parent schema - **SELECT** privilege on the - // table. - // - // The returned information includes configuration values, as well as - // information on assets created by the monitor. Some information (e.g., - // dashboard) may be filtered out if the caller is in a different workspace - // than where the monitor was created. + // Read a data quality monitor on a Unity Catalog object. + // + // For the `table` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // table's parent catalog. 2. **USE_CATALOG** on the table's parent catalog, + // and **MANAGE** and **USE_SCHEMA** on the table's parent schema. 3. + // **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the + // table's parent schema, and **SELECT** on the table. + // + // For the `schema` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // schema's parent catalog. 2. **USE_CATALOG** on the schema's parent + // catalog, and **USE_SCHEMA** on the schema. + // + // The returned information includes configuration values on the entity and + // parent entity as well as information on assets created by the monitor. + // Some information (e.g. dashboard) may be filtered out if the caller is in + // a different workspace than where the monitor was created. GetMonitor(ctx context.Context, request GetMonitorRequest) (*Monitor, error) - // Get data quality monitor refresh. - // - // For the `table` `object_type`, the caller must either: 1. be an owner of - // the table's parent catalog 2. have **USE_CATALOG** on the table's parent - // catalog and be an owner of the table's parent schema 3. have the - // following permissions: - **USE_CATALOG** on the table's parent catalog - - // **USE_SCHEMA** on the table's parent schema - **SELECT** privilege on the - // table. + // Get data quality monitor refresh. The call must be made in the same + // workspace as where the monitor was created. + // + // For the `table` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // table's parent catalog. 2. **USE_CATALOG** on the table's parent catalog, + // and **MANAGE** and **USE_SCHEMA** on the table's parent schema. 3. + // **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the + // table's parent schema, and **SELECT** on the table. + // + // For the `schema` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // schema's parent catalog. 2. **USE_CATALOG** on the schema's parent + // catalog, and **USE_SCHEMA** on the schema. GetRefresh(ctx context.Context, request GetRefreshRequest) (*Refresh, error) // (Unimplemented) List data quality monitors. ListMonitor(ctx context.Context, request ListMonitorRequest) (*ListMonitorResponse, error) - // List data quality monitor refreshes. - // - // For the `table` `object_type`, the caller must either: 1. be an owner of - // the table's parent catalog 2. have **USE_CATALOG** on the table's parent - // catalog and be an owner of the table's parent schema 3. have the - // following permissions: - **USE_CATALOG** on the table's parent catalog - - // **USE_SCHEMA** on the table's parent schema - **SELECT** privilege on the - // table. + // List data quality monitor refreshes. The call must be made in the same + // workspace as where the monitor was created. + // + // For the `table` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // table's parent catalog. 2. **USE_CATALOG** on the table's parent catalog, + // and **MANAGE** and **USE_SCHEMA** on the table's parent schema. 3. + // **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the + // table's parent schema, and **SELECT** on the table. + // + // For the `schema` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // schema's parent catalog. 2. **USE_CATALOG** on the schema's parent + // catalog, and **USE_SCHEMA** on the schema. ListRefresh(ctx context.Context, request ListRefreshRequest) (*ListRefreshResponse, error) // Update a data quality monitor on Unity Catalog object. // - // For the `table` `object_type`, The caller must either: 1. be an owner of - // the table's parent catalog 2. have **USE_CATALOG** on the table's parent - // catalog and be an owner of the table's parent schema 3. have the - // following permissions: - **USE_CATALOG** on the table's parent catalog - - // **USE_SCHEMA** on the table's parent schema - be an owner of the table. + // For the `table` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // table's parent catalog. 2. **USE_CATALOG** on the table's parent catalog, + // and **MANAGE** and **USE_SCHEMA** on the table's parent schema. 3. + // **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the + // table's parent schema, and **MANAGE** on the table. + // + // For the `schema` `object_type`, the caller must have either of the + // following sets of permissions: 1. **MANAGE** and **USE_CATALOG** on the + // schema's parent catalog. 2. **USE_CATALOG** on the schema's parent + // catalog, and **MANAGE** and **USE_SCHEMA** on the schema. UpdateMonitor(ctx context.Context, request UpdateMonitorRequest) (*Monitor, error) // (Unimplemented) Update a refresh diff --git a/service/dataquality/model.go b/service/dataquality/model.go index b4bac2ecb..ef325add9 100755 --- a/service/dataquality/model.go +++ b/service/dataquality/model.go @@ -73,11 +73,80 @@ func (f *AggregationGranularity) Type() string { // Anomaly Detection Configurations. type AnomalyDetectionConfig struct { + // The id of the workflow that detects the anomaly. This field will only be + // returned in the Get/Update response, if the request comes from the + // workspace where this anomaly detection job is created. + AnomalyDetectionWorkflowId int64 `json:"anomaly_detection_workflow_id,omitempty"` + // The type of the last run of the workflow. + JobType AnomalyDetectionJobType `json:"job_type,omitempty"` + // If the health indicator should be shown. + PublishHealthIndicator bool `json:"publish_health_indicator,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AnomalyDetectionConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AnomalyDetectionConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Anomaly Detection job type. +type AnomalyDetectionJobType string + +const AnomalyDetectionJobTypeAnomalyDetectionJobTypeInternalHidden AnomalyDetectionJobType = `ANOMALY_DETECTION_JOB_TYPE_INTERNAL_HIDDEN` + +const AnomalyDetectionJobTypeAnomalyDetectionJobTypeNormal AnomalyDetectionJobType = `ANOMALY_DETECTION_JOB_TYPE_NORMAL` + +// String representation for [fmt.Print] +func (f *AnomalyDetectionJobType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AnomalyDetectionJobType) Set(v string) error { + switch v { + case `ANOMALY_DETECTION_JOB_TYPE_INTERNAL_HIDDEN`, `ANOMALY_DETECTION_JOB_TYPE_NORMAL`: + *f = AnomalyDetectionJobType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ANOMALY_DETECTION_JOB_TYPE_INTERNAL_HIDDEN", "ANOMALY_DETECTION_JOB_TYPE_NORMAL"`, v) + } +} + +// Values returns all possible values for AnomalyDetectionJobType. +// +// There is no guarantee on the order of the values in the slice. +func (f *AnomalyDetectionJobType) Values() []AnomalyDetectionJobType { + return []AnomalyDetectionJobType{ + AnomalyDetectionJobTypeAnomalyDetectionJobTypeInternalHidden, + AnomalyDetectionJobTypeAnomalyDetectionJobTypeNormal, + } +} + +// Type always returns AnomalyDetectionJobType to satisfy [pflag.Value] interface +func (f *AnomalyDetectionJobType) Type() string { + return "AnomalyDetectionJobType" } // Request to cancel a refresh. type CancelRefreshRequest struct { - // The UUID of the request object. For example, schema id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: `schema` // or `table`. @@ -98,7 +167,20 @@ type CreateMonitorRequest struct { } type CreateRefreshRequest struct { - // The UUID of the request object. For example, table id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: `schema`or // `table`. @@ -181,7 +263,7 @@ type DataProfilingConfig struct { DriftMetricsTableName string `json:"drift_metrics_table_name,omitempty"` // The warehouse for dashboard creation EffectiveWarehouseId string `json:"effective_warehouse_id,omitempty"` - // Configuration for monitoring inference log tables. + // `Analysis Configuration` for monitoring inference log tables. InferenceLog *InferenceLogConfig `json:"inference_log,omitempty"` // The latest error message for a monitor failure. LatestMonitorFailureMessage string `json:"latest_monitor_failure_message,omitempty"` @@ -212,11 +294,11 @@ type DataProfilingConfig struct { // slice per unique value in `col1`. For high-cardinality columns, only the // top 100 unique values by frequency will generate slices. SlicingExprs []string `json:"slicing_exprs,omitempty"` - // Configuration for monitoring snapshot tables. + // `Analysis Configuration` for monitoring snapshot tables. Snapshot *SnapshotConfig `json:"snapshot,omitempty"` // The data profiling monitor status. Status DataProfilingStatus `json:"status,omitempty"` - // Configuration for monitoring time series tables. + // `Analysis Configuration` for monitoring time series tables. TimeSeries *TimeSeriesConfig `json:"time_series,omitempty"` // Optional argument to specify the warehouse for dashboard creation. If not // specified, the first running warehouse will be used. @@ -341,7 +423,20 @@ func (f *DataProfilingStatus) Type() string { } type DeleteMonitorRequest struct { - // The UUID of the request object. For example, schema id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: `schema` // or `table`. @@ -349,7 +444,20 @@ type DeleteMonitorRequest struct { } type DeleteRefreshRequest struct { - // The UUID of the request object. For example, schema id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: `schema` // or `table`. @@ -359,7 +467,20 @@ type DeleteRefreshRequest struct { } type GetMonitorRequest struct { - // The UUID of the request object. For example, schema id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: `schema` // or `table`. @@ -367,7 +488,20 @@ type GetMonitorRequest struct { } type GetRefreshRequest struct { - // The UUID of the request object. For example, schema id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: `schema` // or `table`. @@ -387,6 +521,8 @@ type InferenceLogConfig struct { ModelIdColumn string `json:"model_id_column"` // Column for the prediction. PredictionColumn string `json:"prediction_column"` + // Column for prediction probabilities + PredictionProbabilityColumn string `json:"prediction_probability_column,omitempty"` // Problem type the model aims to solve. ProblemType InferenceProblemType `json:"problem_type"` // Column for the timestamp. @@ -475,7 +611,20 @@ func (s ListMonitorResponse) MarshalJSON() ([]byte, error) { } type ListRefreshRequest struct { - // The UUID of the request object. For example, schema id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: `schema` // or `table`. @@ -518,9 +667,23 @@ func (s ListRefreshResponse) MarshalJSON() ([]byte, error) { type Monitor struct { // Anomaly Detection Configuration, applicable to `schema` object types. AnomalyDetectionConfig *AnomalyDetectionConfig `json:"anomaly_detection_config,omitempty"` - // Data Profiling Configuration, applicable to `table` object types + // Data Profiling Configuration, applicable to `table` object types. Exactly + // one `Analysis Configuration` must be present. DataProfilingConfig *DataProfilingConfig `json:"data_profiling_config,omitempty"` - // The UUID of the request object. For example, schema id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"object_id"` // The type of the monitored object. Can be one of the following: `schema` // or `table`. @@ -548,7 +711,20 @@ type Refresh struct { // An optional message to give insight into the current state of the refresh // (e.g. FAILURE messages). Message string `json:"message,omitempty"` - // The UUID of the request object. For example, table id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"object_id"` // The type of the monitored object. Can be one of the following: `schema`or // `table`. @@ -683,7 +859,20 @@ type TimeSeriesConfig struct { type UpdateMonitorRequest struct { // The monitor to update. Monitor Monitor `json:"monitor"` - // The UUID of the request object. For example, schema id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: `schema` // or `table`. @@ -695,7 +884,20 @@ type UpdateMonitorRequest struct { } type UpdateRefreshRequest struct { - // The UUID of the request object. For example, schema id. + // The UUID of the request object. It is `schema_id` for `schema`, and + // `table_id` for `table`. + // + // Find the `schema_id` from either: 1. The [schema_id] of the `Schemas` + // resource. 2. In [Catalog Explorer] > select the `schema` > go to the + // `Details` tab > the `Schema ID` field. + // + // Find the `table_id` from either: 1. The [table_id] of the `Tables` + // resource. 2. In [Catalog Explorer] > select the `table` > go to the + // `Details` tab > the `Table ID` field. + // + // [Catalog Explorer]: https://docs.databricks.com/aws/en/catalog-explorer/ + // [schema_id]: https://docs.databricks.com/api/workspace/schemas/get#schema_id + // [table_id]: https://docs.databricks.com/api/workspace/tables/get#table_id ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: `schema` // or `table`. diff --git a/service/iamv2/api.go b/service/iamv2/api.go index 6710d65b4..67bccd4f7 100755 --- a/service/iamv2/api.go +++ b/service/iamv2/api.go @@ -11,6 +11,39 @@ import ( type AccountIamV2Interface interface { + // TODO: Write description later when this method is implemented + CreateGroup(ctx context.Context, request CreateGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + CreateServicePrincipal(ctx context.Context, request CreateServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + CreateUser(ctx context.Context, request CreateUserRequest) (*User, error) + + // TODO: Write description later when this method is implemented + CreateWorkspaceAccessDetail(ctx context.Context, request CreateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + DeleteGroup(ctx context.Context, request DeleteGroupRequest) error + + // TODO: Write description later when this method is implemented + DeleteServicePrincipal(ctx context.Context, request DeleteServicePrincipalRequest) error + + // TODO: Write description later when this method is implemented + DeleteUser(ctx context.Context, request DeleteUserRequest) error + + // TODO: Write description later when this method is implemented + DeleteWorkspaceAccessDetail(ctx context.Context, request DeleteWorkspaceAccessDetailRequest) error + + // TODO: Write description later when this method is implemented + GetGroup(ctx context.Context, request GetGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + GetServicePrincipal(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + GetUser(ctx context.Context, request GetUserRequest) (*User, error) + // Returns the access details for a principal in a workspace. Allows for // checking access details for any provisioned principal (user, service // principal, or group) in a workspace. * Provisioned principal here refers to @@ -19,6 +52,18 @@ type AccountIamV2Interface interface { // parameter to control what fields are returned (BASIC by default or FULL). GetWorkspaceAccessDetail(ctx context.Context, request GetWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) + // TODO: Write description later when this method is implemented + ListGroups(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) + + // TODO: Write description later when this method is implemented + ListServicePrincipals(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalsResponse, error) + + // TODO: Write description later when this method is implemented + ListUsers(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) + + // TODO: Write description later when this method is implemented + ListWorkspaceAccessDetails(ctx context.Context, request ListWorkspaceAccessDetailsRequest) (*ListWorkspaceAccessDetailsResponse, error) + // Resolves a group with the given external ID from the customer's IdP. If the // group does not exist, it will be created in the account. If the customer is // not onboarded onto Automatic Identity Management (AIM), this will return an @@ -34,6 +79,18 @@ type AccountIamV2Interface interface { // user does not exist, it will be created. If the customer is not onboarded // onto Automatic Identity Management (AIM), this will return an error. ResolveUser(ctx context.Context, request ResolveUserRequest) (*ResolveUserResponse, error) + + // TODO: Write description later when this method is implemented + UpdateGroup(ctx context.Context, request UpdateGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + UpdateServicePrincipal(ctx context.Context, request UpdateServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + UpdateUser(ctx context.Context, request UpdateUserRequest) (*User, error) + + // TODO: Write description later when this method is implemented + UpdateWorkspaceAccessDetail(ctx context.Context, request UpdateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) } func NewAccountIamV2(client *client.DatabricksClient) *AccountIamV2API { @@ -52,6 +109,39 @@ type AccountIamV2API struct { type WorkspaceIamV2Interface interface { + // TODO: Write description later when this method is implemented + CreateGroupProxy(ctx context.Context, request CreateGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + CreateServicePrincipalProxy(ctx context.Context, request CreateServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + CreateUserProxy(ctx context.Context, request CreateUserProxyRequest) (*User, error) + + // TODO: Write description later when this method is implemented + CreateWorkspaceAccessDetailLocal(ctx context.Context, request CreateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + DeleteGroupProxy(ctx context.Context, request DeleteGroupProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteServicePrincipalProxy(ctx context.Context, request DeleteServicePrincipalProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteUserProxy(ctx context.Context, request DeleteUserProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteWorkspaceAccessDetailLocal(ctx context.Context, request DeleteWorkspaceAccessDetailLocalRequest) error + + // TODO: Write description later when this method is implemented + GetGroupProxy(ctx context.Context, request GetGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + GetServicePrincipalProxy(ctx context.Context, request GetServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + GetUserProxy(ctx context.Context, request GetUserProxyRequest) (*User, error) + // Returns the access details for a principal in the current workspace. Allows // for checking access details for any provisioned principal (user, service // principal, or group) in the current workspace. * Provisioned principal here @@ -60,6 +150,18 @@ type WorkspaceIamV2Interface interface { // parameter to control what fields are returned (BASIC by default or FULL). GetWorkspaceAccessDetailLocal(ctx context.Context, request GetWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) + // TODO: Write description later when this method is implemented + ListGroupsProxy(ctx context.Context, request ListGroupsProxyRequest) (*ListGroupsResponse, error) + + // TODO: Write description later when this method is implemented + ListServicePrincipalsProxy(ctx context.Context, request ListServicePrincipalsProxyRequest) (*ListServicePrincipalsResponse, error) + + // TODO: Write description later when this method is implemented + ListUsersProxy(ctx context.Context, request ListUsersProxyRequest) (*ListUsersResponse, error) + + // TODO: Write description later when this method is implemented + ListWorkspaceAccessDetailsLocal(ctx context.Context, request ListWorkspaceAccessDetailsLocalRequest) (*ListWorkspaceAccessDetailsResponse, error) + // Resolves a group with the given external ID from the customer's IdP. If the // group does not exist, it will be created in the account. If the customer is // not onboarded onto Automatic Identity Management (AIM), this will return an @@ -75,6 +177,18 @@ type WorkspaceIamV2Interface interface { // user does not exist, it will be created. If the customer is not onboarded // onto Automatic Identity Management (AIM), this will return an error. ResolveUserProxy(ctx context.Context, request ResolveUserProxyRequest) (*ResolveUserResponse, error) + + // TODO: Write description later when this method is implemented + UpdateGroupProxy(ctx context.Context, request UpdateGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + UpdateServicePrincipalProxy(ctx context.Context, request UpdateServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + UpdateUserProxy(ctx context.Context, request UpdateUserProxyRequest) (*User, error) + + // TODO: Write description later when this method is implemented + UpdateWorkspaceAccessDetailLocal(ctx context.Context, request UpdateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) } func NewWorkspaceIamV2(client *client.DatabricksClient) *WorkspaceIamV2API { diff --git a/service/iamv2/impl.go b/service/iamv2/impl.go index 4d8dfe846..beb16d1f7 100755 --- a/service/iamv2/impl.go +++ b/service/iamv2/impl.go @@ -15,6 +15,116 @@ type accountIamV2Impl struct { client *client.DatabricksClient } +func (a *accountIamV2Impl) CreateGroup(ctx context.Context, request CreateGroupRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups", 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.Group, &group) + return &group, err +} + +func (a *accountIamV2Impl) CreateServicePrincipal(ctx context.Context, request CreateServicePrincipalRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals", 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.ServicePrincipal, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *accountIamV2Impl) CreateUser(ctx context.Context, request CreateUserRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users", 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.User, &user) + return &user, err +} + +func (a *accountIamV2Impl) CreateWorkspaceAccessDetail(ctx context.Context, request CreateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) { + var workspaceAccessDetail WorkspaceAccessDetail + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/workspaces/%v/workspaceAccessDetails", a.client.ConfiguredAccountID(), request.Parent) + 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.WorkspaceAccessDetail, &workspaceAccessDetail) + return &workspaceAccessDetail, err +} + +func (a *accountIamV2Impl) DeleteGroup(ctx context.Context, request DeleteGroupRequest) error { + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountIamV2Impl) DeleteServicePrincipal(ctx context.Context, request DeleteServicePrincipalRequest) error { + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountIamV2Impl) DeleteUser(ctx context.Context, request DeleteUserRequest) error { + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountIamV2Impl) DeleteWorkspaceAccessDetail(ctx context.Context, request DeleteWorkspaceAccessDetailRequest) error { + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/workspaces/%v/workspaceAccessDetails/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.PrincipalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *accountIamV2Impl) GetGroup(ctx context.Context, request GetGroupRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups/%v", a.client.ConfiguredAccountID(), request.InternalId) + 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, &group) + return &group, err +} + +func (a *accountIamV2Impl) GetServicePrincipal(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals/%v", a.client.ConfiguredAccountID(), request.InternalId) + 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, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *accountIamV2Impl) GetUser(ctx context.Context, request GetUserRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users/%v", a.client.ConfiguredAccountID(), request.InternalId) + 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, &user) + return &user, err +} + func (a *accountIamV2Impl) GetWorkspaceAccessDetail(ctx context.Context, request GetWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) { var workspaceAccessDetail WorkspaceAccessDetail path := fmt.Sprintf("/api/2.0/identity/accounts/%v/workspaces/%v/workspaceAccessDetails/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.PrincipalId) @@ -25,6 +135,46 @@ func (a *accountIamV2Impl) GetWorkspaceAccessDetail(ctx context.Context, request return &workspaceAccessDetail, err } +func (a *accountIamV2Impl) ListGroups(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) { + var listGroupsResponse ListGroupsResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups", 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, &listGroupsResponse) + return &listGroupsResponse, err +} + +func (a *accountIamV2Impl) ListServicePrincipals(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalsResponse, error) { + var listServicePrincipalsResponse ListServicePrincipalsResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals", 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, &listServicePrincipalsResponse) + return &listServicePrincipalsResponse, err +} + +func (a *accountIamV2Impl) ListUsers(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) { + var listUsersResponse ListUsersResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users", 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, &listUsersResponse) + return &listUsersResponse, err +} + +func (a *accountIamV2Impl) ListWorkspaceAccessDetails(ctx context.Context, request ListWorkspaceAccessDetailsRequest) (*ListWorkspaceAccessDetailsResponse, error) { + var listWorkspaceAccessDetailsResponse ListWorkspaceAccessDetailsResponse + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/workspaces/%v/workspaceAccessDetails", a.client.ConfiguredAccountID(), request.WorkspaceId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listWorkspaceAccessDetailsResponse) + return &listWorkspaceAccessDetailsResponse, err +} + func (a *accountIamV2Impl) ResolveGroup(ctx context.Context, request ResolveGroupRequest) (*ResolveGroupResponse, error) { var resolveGroupResponse ResolveGroupResponse path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups/resolveByExternalId", a.client.ConfiguredAccountID()) @@ -58,11 +208,181 @@ func (a *accountIamV2Impl) ResolveUser(ctx context.Context, request ResolveUserR return &resolveUserResponse, err } +func (a *accountIamV2Impl) UpdateGroup(ctx context.Context, request UpdateGroupRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/groups/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Group, &group) + return &group, err +} + +func (a *accountIamV2Impl) UpdateServicePrincipal(ctx context.Context, request UpdateServicePrincipalRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/servicePrincipals/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.ServicePrincipal, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *accountIamV2Impl) UpdateUser(ctx context.Context, request UpdateUserRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/users/%v", a.client.ConfiguredAccountID(), request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.User, &user) + return &user, err +} + +func (a *accountIamV2Impl) UpdateWorkspaceAccessDetail(ctx context.Context, request UpdateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) { + var workspaceAccessDetail WorkspaceAccessDetail + path := fmt.Sprintf("/api/2.0/identity/accounts/%v/workspaces/%v/workspaceAccessDetails/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.PrincipalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.WorkspaceAccessDetail, &workspaceAccessDetail) + return &workspaceAccessDetail, err +} + // unexported type that holds implementations of just WorkspaceIamV2 API methods type workspaceIamV2Impl struct { client *client.DatabricksClient } +func (a *workspaceIamV2Impl) CreateGroupProxy(ctx context.Context, request CreateGroupProxyRequest) (*Group, error) { + var group Group + path := "/api/2.0/identity/groups" + 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.Group, &group) + return &group, err +} + +func (a *workspaceIamV2Impl) CreateServicePrincipalProxy(ctx context.Context, request CreateServicePrincipalProxyRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := "/api/2.0/identity/servicePrincipals" + 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.ServicePrincipal, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *workspaceIamV2Impl) CreateUserProxy(ctx context.Context, request CreateUserProxyRequest) (*User, error) { + var user User + path := "/api/2.0/identity/users" + 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.User, &user) + return &user, err +} + +func (a *workspaceIamV2Impl) CreateWorkspaceAccessDetailLocal(ctx context.Context, request CreateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) { + var workspaceAccessDetail WorkspaceAccessDetail + path := "/api/2.0/identity/workspaceAccessDetails" + 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.WorkspaceAccessDetail, &workspaceAccessDetail) + return &workspaceAccessDetail, err +} + +func (a *workspaceIamV2Impl) DeleteGroupProxy(ctx context.Context, request DeleteGroupProxyRequest) error { + path := fmt.Sprintf("/api/2.0/identity/groups/%v", request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *workspaceIamV2Impl) DeleteServicePrincipalProxy(ctx context.Context, request DeleteServicePrincipalProxyRequest) error { + path := fmt.Sprintf("/api/2.0/identity/servicePrincipals/%v", request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *workspaceIamV2Impl) DeleteUserProxy(ctx context.Context, request DeleteUserProxyRequest) error { + path := fmt.Sprintf("/api/2.0/identity/users/%v", request.InternalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *workspaceIamV2Impl) DeleteWorkspaceAccessDetailLocal(ctx context.Context, request DeleteWorkspaceAccessDetailLocalRequest) error { + path := fmt.Sprintf("/api/2.0/identity/workspaceAccessDetails/%v", request.PrincipalId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *workspaceIamV2Impl) GetGroupProxy(ctx context.Context, request GetGroupProxyRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/identity/groups/%v", request.InternalId) + 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, &group) + return &group, err +} + +func (a *workspaceIamV2Impl) GetServicePrincipalProxy(ctx context.Context, request GetServicePrincipalProxyRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/identity/servicePrincipals/%v", request.InternalId) + 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, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *workspaceIamV2Impl) GetUserProxy(ctx context.Context, request GetUserProxyRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/identity/users/%v", request.InternalId) + 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, &user) + return &user, err +} + func (a *workspaceIamV2Impl) GetWorkspaceAccessDetailLocal(ctx context.Context, request GetWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) { var workspaceAccessDetail WorkspaceAccessDetail path := fmt.Sprintf("/api/2.0/identity/workspaceAccessDetails/%v", request.PrincipalId) @@ -73,6 +393,46 @@ func (a *workspaceIamV2Impl) GetWorkspaceAccessDetailLocal(ctx context.Context, return &workspaceAccessDetail, err } +func (a *workspaceIamV2Impl) ListGroupsProxy(ctx context.Context, request ListGroupsProxyRequest) (*ListGroupsResponse, error) { + var listGroupsResponse ListGroupsResponse + path := "/api/2.0/identity/groups" + 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, &listGroupsResponse) + return &listGroupsResponse, err +} + +func (a *workspaceIamV2Impl) ListServicePrincipalsProxy(ctx context.Context, request ListServicePrincipalsProxyRequest) (*ListServicePrincipalsResponse, error) { + var listServicePrincipalsResponse ListServicePrincipalsResponse + path := "/api/2.0/identity/servicePrincipals" + 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, &listServicePrincipalsResponse) + return &listServicePrincipalsResponse, err +} + +func (a *workspaceIamV2Impl) ListUsersProxy(ctx context.Context, request ListUsersProxyRequest) (*ListUsersResponse, error) { + var listUsersResponse ListUsersResponse + path := "/api/2.0/identity/users" + 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, &listUsersResponse) + return &listUsersResponse, err +} + +func (a *workspaceIamV2Impl) ListWorkspaceAccessDetailsLocal(ctx context.Context, request ListWorkspaceAccessDetailsLocalRequest) (*ListWorkspaceAccessDetailsResponse, error) { + var listWorkspaceAccessDetailsResponse ListWorkspaceAccessDetailsResponse + path := "/api/2.0/identity/workspaceAccessDetails" + 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, &listWorkspaceAccessDetailsResponse) + return &listWorkspaceAccessDetailsResponse, err +} + func (a *workspaceIamV2Impl) ResolveGroupProxy(ctx context.Context, request ResolveGroupProxyRequest) (*ResolveGroupResponse, error) { var resolveGroupResponse ResolveGroupResponse path := "/api/2.0/identity/groups/resolveByExternalId" @@ -105,3 +465,63 @@ func (a *workspaceIamV2Impl) ResolveUserProxy(ctx context.Context, request Resol err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resolveUserResponse) return &resolveUserResponse, err } + +func (a *workspaceIamV2Impl) UpdateGroupProxy(ctx context.Context, request UpdateGroupProxyRequest) (*Group, error) { + var group Group + path := fmt.Sprintf("/api/2.0/identity/groups/%v", request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Group, &group) + return &group, err +} + +func (a *workspaceIamV2Impl) UpdateServicePrincipalProxy(ctx context.Context, request UpdateServicePrincipalProxyRequest) (*ServicePrincipal, error) { + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/identity/servicePrincipals/%v", request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.ServicePrincipal, &servicePrincipal) + return &servicePrincipal, err +} + +func (a *workspaceIamV2Impl) UpdateUserProxy(ctx context.Context, request UpdateUserProxyRequest) (*User, error) { + var user User + path := fmt.Sprintf("/api/2.0/identity/users/%v", request.InternalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.User, &user) + return &user, err +} + +func (a *workspaceIamV2Impl) UpdateWorkspaceAccessDetailLocal(ctx context.Context, request UpdateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) { + var workspaceAccessDetail WorkspaceAccessDetail + path := fmt.Sprintf("/api/2.0/identity/workspaceAccessDetails/%v", request.PrincipalId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.WorkspaceAccessDetail, &workspaceAccessDetail) + return &workspaceAccessDetail, err +} diff --git a/service/iamv2/interface.go b/service/iamv2/interface.go index ec3768fa1..dcb422147 100755 --- a/service/iamv2/interface.go +++ b/service/iamv2/interface.go @@ -12,6 +12,39 @@ import ( // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. type AccountIamV2Service interface { + // TODO: Write description later when this method is implemented + CreateGroup(ctx context.Context, request CreateGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + CreateServicePrincipal(ctx context.Context, request CreateServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + CreateUser(ctx context.Context, request CreateUserRequest) (*User, error) + + // TODO: Write description later when this method is implemented + CreateWorkspaceAccessDetail(ctx context.Context, request CreateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + DeleteGroup(ctx context.Context, request DeleteGroupRequest) error + + // TODO: Write description later when this method is implemented + DeleteServicePrincipal(ctx context.Context, request DeleteServicePrincipalRequest) error + + // TODO: Write description later when this method is implemented + DeleteUser(ctx context.Context, request DeleteUserRequest) error + + // TODO: Write description later when this method is implemented + DeleteWorkspaceAccessDetail(ctx context.Context, request DeleteWorkspaceAccessDetailRequest) error + + // TODO: Write description later when this method is implemented + GetGroup(ctx context.Context, request GetGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + GetServicePrincipal(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + GetUser(ctx context.Context, request GetUserRequest) (*User, error) + // Returns the access details for a principal in a workspace. Allows for // checking access details for any provisioned principal (user, service // principal, or group) in a workspace. * Provisioned principal here refers @@ -21,6 +54,18 @@ type AccountIamV2Service interface { // FULL). GetWorkspaceAccessDetail(ctx context.Context, request GetWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) + // TODO: Write description later when this method is implemented + ListGroups(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) + + // TODO: Write description later when this method is implemented + ListServicePrincipals(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalsResponse, error) + + // TODO: Write description later when this method is implemented + ListUsers(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) + + // TODO: Write description later when this method is implemented + ListWorkspaceAccessDetails(ctx context.Context, request ListWorkspaceAccessDetailsRequest) (*ListWorkspaceAccessDetailsResponse, error) + // Resolves a group with the given external ID from the customer's IdP. If // the group does not exist, it will be created in the account. If the // customer is not onboarded onto Automatic Identity Management (AIM), this @@ -37,6 +82,18 @@ type AccountIamV2Service interface { // onboarded onto Automatic Identity Management (AIM), this will return an // error. ResolveUser(ctx context.Context, request ResolveUserRequest) (*ResolveUserResponse, error) + + // TODO: Write description later when this method is implemented + UpdateGroup(ctx context.Context, request UpdateGroupRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + UpdateServicePrincipal(ctx context.Context, request UpdateServicePrincipalRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + UpdateUser(ctx context.Context, request UpdateUserRequest) (*User, error) + + // TODO: Write description later when this method is implemented + UpdateWorkspaceAccessDetail(ctx context.Context, request UpdateWorkspaceAccessDetailRequest) (*WorkspaceAccessDetail, error) } // These APIs are used to manage identities and the workspace access of these @@ -45,6 +102,39 @@ type AccountIamV2Service interface { // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. type WorkspaceIamV2Service interface { + // TODO: Write description later when this method is implemented + CreateGroupProxy(ctx context.Context, request CreateGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + CreateServicePrincipalProxy(ctx context.Context, request CreateServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + CreateUserProxy(ctx context.Context, request CreateUserProxyRequest) (*User, error) + + // TODO: Write description later when this method is implemented + CreateWorkspaceAccessDetailLocal(ctx context.Context, request CreateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) + + // TODO: Write description later when this method is implemented + DeleteGroupProxy(ctx context.Context, request DeleteGroupProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteServicePrincipalProxy(ctx context.Context, request DeleteServicePrincipalProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteUserProxy(ctx context.Context, request DeleteUserProxyRequest) error + + // TODO: Write description later when this method is implemented + DeleteWorkspaceAccessDetailLocal(ctx context.Context, request DeleteWorkspaceAccessDetailLocalRequest) error + + // TODO: Write description later when this method is implemented + GetGroupProxy(ctx context.Context, request GetGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + GetServicePrincipalProxy(ctx context.Context, request GetServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + GetUserProxy(ctx context.Context, request GetUserProxyRequest) (*User, error) + // Returns the access details for a principal in the current workspace. // Allows for checking access details for any provisioned principal (user, // service principal, or group) in the current workspace. * Provisioned @@ -54,6 +144,18 @@ type WorkspaceIamV2Service interface { // (BASIC by default or FULL). GetWorkspaceAccessDetailLocal(ctx context.Context, request GetWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) + // TODO: Write description later when this method is implemented + ListGroupsProxy(ctx context.Context, request ListGroupsProxyRequest) (*ListGroupsResponse, error) + + // TODO: Write description later when this method is implemented + ListServicePrincipalsProxy(ctx context.Context, request ListServicePrincipalsProxyRequest) (*ListServicePrincipalsResponse, error) + + // TODO: Write description later when this method is implemented + ListUsersProxy(ctx context.Context, request ListUsersProxyRequest) (*ListUsersResponse, error) + + // TODO: Write description later when this method is implemented + ListWorkspaceAccessDetailsLocal(ctx context.Context, request ListWorkspaceAccessDetailsLocalRequest) (*ListWorkspaceAccessDetailsResponse, error) + // Resolves a group with the given external ID from the customer's IdP. If // the group does not exist, it will be created in the account. If the // customer is not onboarded onto Automatic Identity Management (AIM), this @@ -70,4 +172,16 @@ type WorkspaceIamV2Service interface { // onboarded onto Automatic Identity Management (AIM), this will return an // error. ResolveUserProxy(ctx context.Context, request ResolveUserProxyRequest) (*ResolveUserResponse, error) + + // TODO: Write description later when this method is implemented + UpdateGroupProxy(ctx context.Context, request UpdateGroupProxyRequest) (*Group, error) + + // TODO: Write description later when this method is implemented + UpdateServicePrincipalProxy(ctx context.Context, request UpdateServicePrincipalProxyRequest) (*ServicePrincipal, error) + + // TODO: Write description later when this method is implemented + UpdateUserProxy(ctx context.Context, request UpdateUserProxyRequest) (*User, error) + + // TODO: Write description later when this method is implemented + UpdateWorkspaceAccessDetailLocal(ctx context.Context, request UpdateWorkspaceAccessDetailLocalRequest) (*WorkspaceAccessDetail, error) } diff --git a/service/iamv2/model.go b/service/iamv2/model.go index a2353ad54..4fe8774cf 100755 --- a/service/iamv2/model.go +++ b/service/iamv2/model.go @@ -8,6 +8,121 @@ import ( "github.com/databricks/databricks-sdk-go/marshal" ) +type CreateGroupProxyRequest struct { + // Required. Group to be created in + Group Group `json:"group"` +} + +type CreateGroupRequest struct { + // Required. Group to be created in + Group Group `json:"group"` +} + +type CreateServicePrincipalProxyRequest struct { + // Required. Service principal to be created in + ServicePrincipal ServicePrincipal `json:"service_principal"` +} + +type CreateServicePrincipalRequest struct { + // Required. Service principal to be created in + ServicePrincipal ServicePrincipal `json:"service_principal"` +} + +type CreateUserProxyRequest struct { + // Required. User to be created in + User User `json:"user"` +} + +type CreateUserRequest struct { + // Required. User to be created in + User User `json:"user"` +} + +type CreateWorkspaceAccessDetailLocalRequest struct { + // Required. Workspace access detail to be created in . + WorkspaceAccessDetail WorkspaceAccessDetail `json:"workspace_access_detail"` +} + +type CreateWorkspaceAccessDetailRequest struct { + // Required. The parent path for workspace access detail. + Parent string `json:"-" url:"-"` + // Required. Workspace access detail to be created in . + WorkspaceAccessDetail WorkspaceAccessDetail `json:"workspace_access_detail"` +} + +type DeleteGroupProxyRequest struct { + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteGroupRequest struct { + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteServicePrincipalProxyRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteServicePrincipalRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteUserProxyRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteUserRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type DeleteWorkspaceAccessDetailLocalRequest struct { + // Required. ID of the principal in Databricks. + PrincipalId int64 `json:"-" url:"-"` +} + +type DeleteWorkspaceAccessDetailRequest struct { + // Required. ID of the principal in Databricks to delete workspace access + // for. + PrincipalId int64 `json:"-" url:"-"` + // The workspace ID where the principal has access. + WorkspaceId int64 `json:"-" url:"-"` +} + +type GetGroupProxyRequest struct { + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetGroupRequest struct { + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetServicePrincipalProxyRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetServicePrincipalRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetUserProxyRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` +} + +type GetUserRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` +} + type GetWorkspaceAccessDetailLocalRequest struct { // Required. The internal ID of the principal (user/sp/group) for which the // access details are being requested. @@ -49,6 +164,236 @@ func (s Group) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListGroupsProxyRequest struct { + // The maximum number of groups to return. The service may return fewer than + // this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListGroups call. Provide this to + // retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListGroupsProxyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListGroupsProxyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListGroupsRequest struct { + // The maximum number of groups to return. The service may return fewer than + // this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListGroups call. Provide this to + // retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListGroupsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListGroupsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// TODO: Write description later when this method is implemented +type ListGroupsResponse struct { + Groups []Group `json:"groups,omitempty"` + // A token, which can be sent as page_token to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListGroupsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListGroupsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListServicePrincipalsProxyRequest struct { + // The maximum number of SPs to return. The service may return fewer than + // this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListServicePrincipals call. + // Provide this to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListServicePrincipalsProxyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListServicePrincipalsProxyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListServicePrincipalsRequest struct { + // The maximum number of service principals to return. The service may + // return fewer than this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListServicePrincipals call. + // Provide this to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListServicePrincipalsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListServicePrincipalsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// TODO: Write description later when this method is implemented +type ListServicePrincipalsResponse struct { + // A token, which can be sent as page_token to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + + ServicePrincipals []ServicePrincipal `json:"service_principals,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListServicePrincipalsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListServicePrincipalsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListUsersProxyRequest struct { + // The maximum number of users to return. The service may return fewer than + // this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListUsers call. Provide this to + // retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListUsersProxyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListUsersProxyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListUsersRequest struct { + // The maximum number of users to return. The service may return fewer than + // this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListUsers call. Provide this to + // retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListUsersRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListUsersRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// TODO: Write description later when this method is implemented +type ListUsersResponse struct { + // A token, which can be sent as page_token to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + + Users []User `json:"users,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListUsersResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListUsersResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListWorkspaceAccessDetailsLocalRequest struct { + // The maximum number of workspace access details to return. The service may + // return fewer than this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListWorkspaceAccessDetails call. + // Provide this to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListWorkspaceAccessDetailsLocalRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListWorkspaceAccessDetailsLocalRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListWorkspaceAccessDetailsRequest struct { + // The maximum number of workspace access details to return. The service may + // return fewer than this value. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous ListWorkspaceAccessDetails call. + // Provide this to retrieve the subsequent page. + PageToken string `json:"-" url:"page_token,omitempty"` + // The workspace ID for which the workspace access details are being + // fetched. + WorkspaceId int64 `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListWorkspaceAccessDetailsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListWorkspaceAccessDetailsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// TODO: Write description later when this method is implemented +type ListWorkspaceAccessDetailsResponse struct { + // A token, which can be sent as page_token to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + NextPageToken string `json:"next_page_token,omitempty"` + + WorkspaceAccessDetails []WorkspaceAccessDetail `json:"workspace_access_details,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListWorkspaceAccessDetailsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListWorkspaceAccessDetailsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // The type of the principal (user/sp/group). type PrincipalType string @@ -218,6 +563,81 @@ func (f *State) Type() string { return "State" } +type UpdateGroupProxyRequest struct { + // Required. Group to be updated in + Group Group `json:"group"` + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` +} + +type UpdateGroupRequest struct { + // Required. Group to be updated in + Group Group `json:"group"` + // Required. Internal ID of the group in Databricks. + InternalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` +} + +type UpdateServicePrincipalProxyRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` + // Required. Service principal to be updated in + ServicePrincipal ServicePrincipal `json:"service_principal"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` +} + +type UpdateServicePrincipalRequest struct { + // Required. Internal ID of the service principal in Databricks. + InternalId int64 `json:"-" url:"-"` + // Required. Service Principal to be updated in + ServicePrincipal ServicePrincipal `json:"service_principal"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` +} + +type UpdateUserProxyRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` + // Required. User to be updated in + User User `json:"user"` +} + +type UpdateUserRequest struct { + // Required. Internal ID of the user in Databricks. + InternalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` + // Required. User to be updated in + User User `json:"user"` +} + +type UpdateWorkspaceAccessDetailLocalRequest struct { + // Required. ID of the principal in Databricks. + PrincipalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` + // Required. WorkspaceAccessDetail to be updated in + WorkspaceAccessDetail WorkspaceAccessDetail `json:"workspace_access_detail"` +} + +type UpdateWorkspaceAccessDetailRequest struct { + // Required. ID of the principal in Databricks. + PrincipalId int64 `json:"-" url:"-"` + // Optional. The list of fields to update. + UpdateMask string `json:"-" url:"update_mask"` + // Required. Workspace access detail to be updated in + WorkspaceAccessDetail WorkspaceAccessDetail `json:"workspace_access_detail"` + // Required. The workspace ID for which the workspace access detail is being + // updated. + WorkspaceId int64 `json:"-" url:"-"` +} + // The details of a User resource. type User struct { // The accountId parent of the user in Databricks. diff --git a/service/jobs/model.go b/service/jobs/model.go index 64f3e7591..a13d3b5fc 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -70,6 +70,10 @@ type BaseJob struct { HasMore bool `json:"has_more,omitempty"` // The canonical identifier for this job. JobId int64 `json:"job_id,omitempty"` + // Path of the job object in workspace file tree, including file extension. + // If absent, the job doesn't have a workspace object. Example: + // /Workspace/user@example.com/my_project/my_job.job.json + Path string `json:"path,omitempty"` // Settings for this job and all of its runs. These settings can be updated // using the `resetJob` method. Settings *JobSettings `json:"settings,omitempty"` @@ -713,6 +717,9 @@ type CreateJob struct { NotificationSettings *JobNotificationSettings `json:"notification_settings,omitempty"` // Job-level parameter definitions Parameters []JobParameterDefinition `json:"parameters,omitempty"` + // Path of the job parent folder in workspace file tree. If absent, the job + // doesn't have a workspace object. + ParentPath string `json:"parent_path,omitempty"` // The performance mode on a serverless job. This field determines the level // of compute performance or cost-efficiency for the run. // @@ -1624,6 +1631,10 @@ type Job struct { JobId int64 `json:"job_id,omitempty"` // A token that can be used to list the next page of array properties. NextPageToken string `json:"next_page_token,omitempty"` + // Path of the job object in workspace file tree, including file extension. + // If absent, the job doesn't have a workspace object. Example: + // /Workspace/user@example.com/my_project/my_job.job.json + Path string `json:"path,omitempty"` // The email of an active workspace user or the application ID of a service // principal that the job runs as. This value can be changed by setting the // `run_as` field when creating or updating a job. @@ -2120,6 +2131,9 @@ type JobSettings struct { NotificationSettings *JobNotificationSettings `json:"notification_settings,omitempty"` // Job-level parameter definitions Parameters []JobParameterDefinition `json:"parameters,omitempty"` + // Path of the job parent folder in workspace file tree. If absent, the job + // doesn't have a workspace object. + ParentPath string `json:"parent_path,omitempty"` // The performance mode on a serverless job. This field determines the level // of compute performance or cost-efficiency for the run. // @@ -2539,6 +2553,77 @@ func (s ListRunsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ModelTriggerConfiguration struct { + // Aliases of the model versions to monitor. Can only be used in conjunction + // with condition MODEL_ALIAS_SET. + Aliases []string `json:"aliases,omitempty"` + // The condition based on which to trigger a job run. + Condition ModelTriggerConfigurationCondition `json:"condition"` + // If set, the trigger starts a run only after the specified amount of time + // has passed since the last time the trigger fired. The minimum allowed + // value is 60 seconds. + MinTimeBetweenTriggersSeconds int `json:"min_time_between_triggers_seconds,omitempty"` + // Name of the securable to monitor ("mycatalog.myschema.mymodel" in the + // case of model-level triggers, "mycatalog.myschema" in the case of + // schema-level triggers) or empty in the case of metastore-level triggers. + SecurableName string `json:"securable_name,omitempty"` + // If set, the trigger starts a run only after no model updates have + // occurred for the specified time and can be used to wait for a series of + // model updates before triggering a run. The minimum allowed value is 60 + // seconds. + WaitAfterLastChangeSeconds int `json:"wait_after_last_change_seconds,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ModelTriggerConfiguration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ModelTriggerConfiguration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ModelTriggerConfigurationCondition string + +const ModelTriggerConfigurationConditionModelAliasSet ModelTriggerConfigurationCondition = `MODEL_ALIAS_SET` + +const ModelTriggerConfigurationConditionModelCreated ModelTriggerConfigurationCondition = `MODEL_CREATED` + +const ModelTriggerConfigurationConditionModelVersionReady ModelTriggerConfigurationCondition = `MODEL_VERSION_READY` + +// String representation for [fmt.Print] +func (f *ModelTriggerConfigurationCondition) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ModelTriggerConfigurationCondition) Set(v string) error { + switch v { + case `MODEL_ALIAS_SET`, `MODEL_CREATED`, `MODEL_VERSION_READY`: + *f = ModelTriggerConfigurationCondition(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "MODEL_ALIAS_SET", "MODEL_CREATED", "MODEL_VERSION_READY"`, v) + } +} + +// Values returns all possible values for ModelTriggerConfigurationCondition. +// +// There is no guarantee on the order of the values in the slice. +func (f *ModelTriggerConfigurationCondition) Values() []ModelTriggerConfigurationCondition { + return []ModelTriggerConfigurationCondition{ + ModelTriggerConfigurationConditionModelAliasSet, + ModelTriggerConfigurationConditionModelCreated, + ModelTriggerConfigurationConditionModelVersionReady, + } +} + +// Type always returns ModelTriggerConfigurationCondition to satisfy [pflag.Value] interface +func (f *ModelTriggerConfigurationCondition) Type() string { + return "ModelTriggerConfigurationCondition" +} + type NotebookOutput struct { // The value passed to // [dbutils.notebook.exit()](/notebooks/notebook-workflows.html#notebook-workflows-exit). @@ -3027,6 +3112,11 @@ type RepairRun struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` + // + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. + // + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown DbtCommands []string `json:"dbt_commands,omitempty"` // A list of parameters for jobs with Spark JAR tasks, for example // `"jar_params": ["john doe", "35"]`. The parameters are used to invoke the @@ -3036,10 +3126,10 @@ type RepairRun struct { // of this field (for example `{"jar_params":["john doe","35"]}`) cannot // exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown JarParams []string `json:"jar_params,omitempty"` // Job-level parameters used in the run. for example `"param": // "overriding_val"` @@ -3058,15 +3148,15 @@ type RepairRun struct { // // notebook_params cannot be specified in conjunction with jar_params. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // The JSON representation of this field (for example // `{"notebook_params":{"name":"john doe","age":"35"}}`) cannot exceed // 10,000 bytes. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown NotebookParams map[string]string `json:"notebook_params,omitempty"` // The performance mode on a serverless job. The performance target // determines the level of compute performance or cost-efficiency for the @@ -3088,8 +3178,8 @@ type RepairRun struct { // representation of this field (for example `{"python_params":["john // doe","35"]}`) cannot exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // Important // @@ -3097,7 +3187,7 @@ type RepairRun struct { // Using non-ASCII characters returns an error. Examples of invalid, // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown PythonParams []string `json:"python_params,omitempty"` // If true, repair all failed tasks. Only one of `rerun_tasks` or // `rerun_all_failed_tasks` can be used. @@ -3118,8 +3208,8 @@ type RepairRun struct { // The JSON representation of this field (for example // `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // Important // @@ -3127,11 +3217,16 @@ type RepairRun struct { // Using non-ASCII characters returns an error. Examples of invalid, // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown SparkSubmitParams []string `json:"spark_submit_params,omitempty"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. + // + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. + // + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown SqlParams map[string]string `json:"sql_params,omitempty"` ForceSendFields []string `json:"-" url:"-"` @@ -3535,6 +3630,11 @@ type RunJobTask struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` + // + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. + // + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown DbtCommands []string `json:"dbt_commands,omitempty"` // A list of parameters for jobs with Spark JAR tasks, for example // `"jar_params": ["john doe", "35"]`. The parameters are used to invoke the @@ -3544,10 +3644,10 @@ type RunJobTask struct { // of this field (for example `{"jar_params":["john doe","35"]}`) cannot // exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown JarParams []string `json:"jar_params,omitempty"` // ID of the job to trigger. JobId int64 `json:"job_id"` @@ -3563,15 +3663,15 @@ type RunJobTask struct { // // notebook_params cannot be specified in conjunction with jar_params. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // The JSON representation of this field (for example // `{"notebook_params":{"name":"john doe","age":"35"}}`) cannot exceed // 10,000 bytes. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown NotebookParams map[string]string `json:"notebook_params,omitempty"` // Controls whether the pipeline should perform a full refresh PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` @@ -3584,8 +3684,8 @@ type RunJobTask struct { // representation of this field (for example `{"python_params":["john // doe","35"]}`) cannot exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // Important // @@ -3593,7 +3693,7 @@ type RunJobTask struct { // Using non-ASCII characters returns an error. Examples of invalid, // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown PythonParams []string `json:"python_params,omitempty"` // A list of parameters for jobs with spark submit task, for example // `"spark_submit_params": ["--class", @@ -3603,8 +3703,8 @@ type RunJobTask struct { // The JSON representation of this field (for example // `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // Important // @@ -3612,11 +3712,16 @@ type RunJobTask struct { // Using non-ASCII characters returns an error. Examples of invalid, // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown SparkSubmitParams []string `json:"spark_submit_params,omitempty"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. + // + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. + // + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown SqlParams map[string]string `json:"sql_params,omitempty"` } @@ -3765,6 +3870,11 @@ type RunNow struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` + // + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. + // + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown DbtCommands []string `json:"dbt_commands,omitempty"` // An optional token to guarantee the idempotency of job run requests. If a // run with the provided token already exists, the request does not create a @@ -3789,10 +3899,10 @@ type RunNow struct { // of this field (for example `{"jar_params":["john doe","35"]}`) cannot // exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown JarParams []string `json:"jar_params,omitempty"` // The ID of the job to be executed JobId int64 `json:"job_id"` @@ -3809,15 +3919,15 @@ type RunNow struct { // // notebook_params cannot be specified in conjunction with jar_params. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // The JSON representation of this field (for example // `{"notebook_params":{"name":"john doe","age":"35"}}`) cannot exceed // 10,000 bytes. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown NotebookParams map[string]string `json:"notebook_params,omitempty"` // 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. @@ -3842,8 +3952,8 @@ type RunNow struct { // representation of this field (for example `{"python_params":["john // doe","35"]}`) cannot exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // Important // @@ -3851,7 +3961,7 @@ type RunNow struct { // Using non-ASCII characters returns an error. Examples of invalid, // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown PythonParams []string `json:"python_params,omitempty"` // The queue settings of the run. Queue *QueueSettings `json:"queue,omitempty"` @@ -3863,8 +3973,8 @@ type RunNow struct { // The JSON representation of this field (for example // `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // Important // @@ -3872,11 +3982,16 @@ type RunNow struct { // Using non-ASCII characters returns an error. Examples of invalid, // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown SparkSubmitParams []string `json:"spark_submit_params,omitempty"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. + // + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. + // + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown SqlParams map[string]string `json:"sql_params,omitempty"` ForceSendFields []string `json:"-" url:"-"` @@ -3971,6 +4086,11 @@ type RunParameters struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` + // + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. + // + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown DbtCommands []string `json:"dbt_commands,omitempty"` // A list of parameters for jobs with Spark JAR tasks, for example // `"jar_params": ["john doe", "35"]`. The parameters are used to invoke the @@ -3980,10 +4100,10 @@ type RunParameters struct { // of this field (for example `{"jar_params":["john doe","35"]}`) cannot // exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown JarParams []string `json:"jar_params,omitempty"` // A map from keys to values for jobs with notebook task, for example // `"notebook_params": {"name": "john doe", "age": "35"}`. The map is passed @@ -3995,15 +4115,15 @@ type RunParameters struct { // // notebook_params cannot be specified in conjunction with jar_params. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // The JSON representation of this field (for example // `{"notebook_params":{"name":"john doe","age":"35"}}`) cannot exceed // 10,000 bytes. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown NotebookParams map[string]string `json:"notebook_params,omitempty"` // Controls whether the pipeline should perform a full refresh PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` @@ -4016,8 +4136,8 @@ type RunParameters struct { // representation of this field (for example `{"python_params":["john // doe","35"]}`) cannot exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs. + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // Important // @@ -4025,7 +4145,7 @@ type RunParameters struct { // Using non-ASCII characters returns an error. Examples of invalid, // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown PythonParams []string `json:"python_params,omitempty"` // A list of parameters for jobs with spark submit task, for example // `"spark_submit_params": ["--class", @@ -4035,8 +4155,8 @@ type RunParameters struct { // The JSON representation of this field (for example // `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. // - // Use [Task parameter variables] to set parameters containing information - // about job runs + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. // // Important // @@ -4044,11 +4164,16 @@ type RunParameters struct { // Using non-ASCII characters returns an error. Examples of invalid, // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // - // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown SparkSubmitParams []string `json:"spark_submit_params,omitempty"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. + // + // ⚠ **Deprecation note** Use [job parameters] to pass information down to + // tasks. + // + // [job parameters]: https://docs.databricks.com/jobs/job-parameters.html#job-parameter-pushdown SqlParams map[string]string `json:"sql_params,omitempty"` } @@ -4225,6 +4350,9 @@ type RunTask struct { DependsOn []TaskDependency `json:"depends_on,omitempty"` // An optional description for this task. Description string `json:"description,omitempty"` + // An optional flag to disable the task. If set to true, the task will not + // run even if it is part of a job. + Disabled bool `json:"disabled,omitempty"` // The actual performance target used by the serverless run during // execution. This can differ from the client-set performance target on the // request depending on whether the performance mode is supported by the job @@ -5014,6 +5142,9 @@ type SubmitTask struct { DependsOn []TaskDependency `json:"depends_on,omitempty"` // An optional description for this task. Description string `json:"description,omitempty"` + // An optional flag to disable the task. If set to true, the task will not + // run even if it is part of a job. + Disabled bool `json:"disabled,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"` @@ -5763,6 +5894,8 @@ func (s TriggerInfo) MarshalJSON() ([]byte, error) { type TriggerSettings struct { // File arrival trigger settings. FileArrival *FileArrivalTriggerConfiguration `json:"file_arrival,omitempty"` + + Model *ModelTriggerConfiguration `json:"model,omitempty"` // Whether this trigger is paused or not. PauseStatus PauseStatus `json:"pause_status,omitempty"` // Periodic trigger settings. diff --git a/service/marketplace/impl.go b/service/marketplace/impl.go index 87f640ad0..459257581 100755 --- a/service/marketplace/impl.go +++ b/service/marketplace/impl.go @@ -10,6 +10,7 @@ import ( "github.com/databricks/databricks-sdk-go/client" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" + "github.com/google/uuid" ) // unexported type that holds implementations of just ConsumerFulfillments API methods @@ -952,6 +953,9 @@ func (a *providerPersonalizationRequestsImpl) internalList(ctx context.Context, func (a *providerPersonalizationRequestsImpl) Update(ctx context.Context, request UpdatePersonalizationRequestRequest) (*UpdatePersonalizationRequestResponse, error) { var updatePersonalizationRequestResponse UpdatePersonalizationRequestResponse + if request.RequestId == "" { + request.RequestId = uuid.New().String() + } path := fmt.Sprintf("/api/2.0/marketplace-provider/listings/%v/personalization-requests/%v/request-status", request.ListingId, request.RequestId) queryParams := make(map[string]any) headers := make(map[string]string) diff --git a/service/ml/api.go b/service/ml/api.go index 77b61c824..cff510d46 100755 --- a/service/ml/api.go +++ b/service/ml/api.go @@ -95,6 +95,9 @@ type ExperimentsInterface interface { // Get a logged model. GetLoggedModelByModelId(ctx context.Context, modelId string) (*GetLoggedModelResponse, error) + // Batch endpoint for getting logged models from a list of model IDs + GetLoggedModels(ctx context.Context, request GetLoggedModelsRequest) (*GetLoggedModelsRequestResponse, error) + // Gets the permission levels that a user can have on an object. GetPermissionLevels(ctx context.Context, request GetExperimentPermissionLevelsRequest) (*GetExperimentPermissionLevelsResponse, error) @@ -359,12 +362,21 @@ type FeatureEngineeringInterface interface { // Create a Feature. CreateFeature(ctx context.Context, request CreateFeatureRequest) (*Feature, error) + // Create a materialized feature. + CreateMaterializedFeature(ctx context.Context, request CreateMaterializedFeatureRequest) (*MaterializedFeature, error) + // Delete a Feature. DeleteFeature(ctx context.Context, request DeleteFeatureRequest) error + // Delete a materialized feature. + DeleteMaterializedFeature(ctx context.Context, request DeleteMaterializedFeatureRequest) error + // Get a Feature. GetFeature(ctx context.Context, request GetFeatureRequest) (*Feature, error) + // Get a materialized feature. + GetMaterializedFeature(ctx context.Context, request GetMaterializedFeatureRequest) (*MaterializedFeature, error) + // List Features. // // This method is generated by Databricks SDK Code Generator. @@ -375,8 +387,21 @@ type FeatureEngineeringInterface interface { // This method is generated by Databricks SDK Code Generator. ListFeaturesAll(ctx context.Context, request ListFeaturesRequest) ([]Feature, error) + // List materialized features. + // + // This method is generated by Databricks SDK Code Generator. + ListMaterializedFeatures(ctx context.Context, request ListMaterializedFeaturesRequest) listing.Iterator[MaterializedFeature] + + // List materialized features. + // + // This method is generated by Databricks SDK Code Generator. + ListMaterializedFeaturesAll(ctx context.Context, request ListMaterializedFeaturesRequest) ([]MaterializedFeature, error) + // Update a Feature. UpdateFeature(ctx context.Context, request UpdateFeatureRequest) (*Feature, error) + + // Update a materialized feature (pause/resume). + UpdateMaterializedFeature(ctx context.Context, request UpdateMaterializedFeatureRequest) (*MaterializedFeature, error) } func NewFeatureEngineering(client *client.DatabricksClient) *FeatureEngineeringAPI { diff --git a/service/ml/impl.go b/service/ml/impl.go index 78690920b..db93862ec 100755 --- a/service/ml/impl.go +++ b/service/ml/impl.go @@ -192,6 +192,16 @@ func (a *experimentsImpl) GetLoggedModel(ctx context.Context, request GetLoggedM return &getLoggedModelResponse, err } +func (a *experimentsImpl) GetLoggedModels(ctx context.Context, request GetLoggedModelsRequest) (*GetLoggedModelsRequestResponse, error) { + var getLoggedModelsRequestResponse GetLoggedModelsRequestResponse + path := "/api/2.0/mlflow/logged-models:batchGet" + 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, &getLoggedModelsRequestResponse) + return &getLoggedModelsRequestResponse, err +} + func (a *experimentsImpl) GetPermissionLevels(ctx context.Context, request GetExperimentPermissionLevelsRequest) (*GetExperimentPermissionLevelsResponse, error) { var getExperimentPermissionLevelsResponse GetExperimentPermissionLevelsResponse path := fmt.Sprintf("/api/2.0/permissions/experiments/%v/permissionLevels", request.ExperimentId) @@ -603,6 +613,17 @@ func (a *featureEngineeringImpl) CreateFeature(ctx context.Context, request Crea return &feature, err } +func (a *featureEngineeringImpl) CreateMaterializedFeature(ctx context.Context, request CreateMaterializedFeatureRequest) (*MaterializedFeature, error) { + var materializedFeature MaterializedFeature + path := "/api/2.0/feature-engineering/materialized-features" + 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.MaterializedFeature, &materializedFeature) + return &materializedFeature, err +} + func (a *featureEngineeringImpl) DeleteFeature(ctx context.Context, request DeleteFeatureRequest) error { path := fmt.Sprintf("/api/2.0/feature-engineering/features/%v", request.FullName) queryParams := make(map[string]any) @@ -612,6 +633,15 @@ func (a *featureEngineeringImpl) DeleteFeature(ctx context.Context, request Dele return err } +func (a *featureEngineeringImpl) DeleteMaterializedFeature(ctx context.Context, request DeleteMaterializedFeatureRequest) error { + path := fmt.Sprintf("/api/2.0/feature-engineering/materialized-features/%v", request.MaterializedFeatureId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + func (a *featureEngineeringImpl) GetFeature(ctx context.Context, request GetFeatureRequest) (*Feature, error) { var feature Feature path := fmt.Sprintf("/api/2.0/feature-engineering/features/%v", request.FullName) @@ -622,6 +652,16 @@ func (a *featureEngineeringImpl) GetFeature(ctx context.Context, request GetFeat return &feature, err } +func (a *featureEngineeringImpl) GetMaterializedFeature(ctx context.Context, request GetMaterializedFeatureRequest) (*MaterializedFeature, error) { + var materializedFeature MaterializedFeature + path := fmt.Sprintf("/api/2.0/feature-engineering/materialized-features/%v", request.MaterializedFeatureId) + 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, &materializedFeature) + return &materializedFeature, err +} + // List Features. func (a *featureEngineeringImpl) ListFeatures(ctx context.Context, request ListFeaturesRequest) listing.Iterator[Feature] { @@ -663,6 +703,47 @@ func (a *featureEngineeringImpl) internalListFeatures(ctx context.Context, reque return &listFeaturesResponse, err } +// List materialized features. +func (a *featureEngineeringImpl) ListMaterializedFeatures(ctx context.Context, request ListMaterializedFeaturesRequest) listing.Iterator[MaterializedFeature] { + + getNextPage := func(ctx context.Context, req ListMaterializedFeaturesRequest) (*ListMaterializedFeaturesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListMaterializedFeatures(ctx, req) + } + getItems := func(resp *ListMaterializedFeaturesResponse) []MaterializedFeature { + return resp.MaterializedFeatures + } + getNextReq := func(resp *ListMaterializedFeaturesResponse) *ListMaterializedFeaturesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List materialized features. +func (a *featureEngineeringImpl) ListMaterializedFeaturesAll(ctx context.Context, request ListMaterializedFeaturesRequest) ([]MaterializedFeature, error) { + iterator := a.ListMaterializedFeatures(ctx, request) + return listing.ToSlice[MaterializedFeature](ctx, iterator) +} + +func (a *featureEngineeringImpl) internalListMaterializedFeatures(ctx context.Context, request ListMaterializedFeaturesRequest) (*ListMaterializedFeaturesResponse, error) { + var listMaterializedFeaturesResponse ListMaterializedFeaturesResponse + path := "/api/2.0/feature-engineering/materialized-features" + 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, &listMaterializedFeaturesResponse) + return &listMaterializedFeaturesResponse, err +} + func (a *featureEngineeringImpl) UpdateFeature(ctx context.Context, request UpdateFeatureRequest) (*Feature, error) { var feature Feature path := fmt.Sprintf("/api/2.0/feature-engineering/features/%v", request.FullName) @@ -678,6 +759,21 @@ func (a *featureEngineeringImpl) UpdateFeature(ctx context.Context, request Upda return &feature, err } +func (a *featureEngineeringImpl) UpdateMaterializedFeature(ctx context.Context, request UpdateMaterializedFeatureRequest) (*MaterializedFeature, error) { + var materializedFeature MaterializedFeature + path := fmt.Sprintf("/api/2.0/feature-engineering/materialized-features/%v", request.MaterializedFeatureId) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.MaterializedFeature, &materializedFeature) + return &materializedFeature, err +} + // unexported type that holds implementations of just FeatureStore API methods type featureStoreImpl struct { client *client.DatabricksClient diff --git a/service/ml/interface.go b/service/ml/interface.go index 2a8499f0e..27a06dfbe 100755 --- a/service/ml/interface.go +++ b/service/ml/interface.go @@ -85,6 +85,9 @@ type ExperimentsService interface { // Get a logged model. GetLoggedModel(ctx context.Context, request GetLoggedModelRequest) (*GetLoggedModelResponse, error) + // Batch endpoint for getting logged models from a list of model IDs + GetLoggedModels(ctx context.Context, request GetLoggedModelsRequest) (*GetLoggedModelsRequestResponse, error) + // Gets the permission levels that a user can have on an object. GetPermissionLevels(ctx context.Context, request GetExperimentPermissionLevelsRequest) (*GetExperimentPermissionLevelsResponse, error) @@ -260,17 +263,32 @@ type FeatureEngineeringService interface { // Create a Feature. CreateFeature(ctx context.Context, request CreateFeatureRequest) (*Feature, error) + // Create a materialized feature. + CreateMaterializedFeature(ctx context.Context, request CreateMaterializedFeatureRequest) (*MaterializedFeature, error) + // Delete a Feature. DeleteFeature(ctx context.Context, request DeleteFeatureRequest) error + // Delete a materialized feature. + DeleteMaterializedFeature(ctx context.Context, request DeleteMaterializedFeatureRequest) error + // Get a Feature. GetFeature(ctx context.Context, request GetFeatureRequest) (*Feature, error) + // Get a materialized feature. + GetMaterializedFeature(ctx context.Context, request GetMaterializedFeatureRequest) (*MaterializedFeature, error) + // List Features. ListFeatures(ctx context.Context, request ListFeaturesRequest) (*ListFeaturesResponse, error) + // List materialized features. + ListMaterializedFeatures(ctx context.Context, request ListMaterializedFeaturesRequest) (*ListMaterializedFeaturesResponse, error) + // Update a Feature. UpdateFeature(ctx context.Context, request UpdateFeatureRequest) (*Feature, error) + + // Update a materialized feature (pause/resume). + UpdateMaterializedFeature(ctx context.Context, request UpdateMaterializedFeatureRequest) (*MaterializedFeature, error) } // A feature store is a centralized repository that enables data scientists to diff --git a/service/ml/model.go b/service/ml/model.go index a9b1f0327..2a3d3414a 100755 --- a/service/ml/model.go +++ b/service/ml/model.go @@ -516,6 +516,11 @@ type CreateLoggedModelResponse struct { Model *LoggedModel `json:"model,omitempty"` } +type CreateMaterializedFeatureRequest struct { + // The materialized feature to create. + MaterializedFeature MaterializedFeature `json:"materialized_feature"` +} + type CreateModelRequest struct { // Optional description for registered model. Description string `json:"description,omitempty"` @@ -796,6 +801,11 @@ type DeleteLoggedModelTagRequest struct { TagKey string `json:"-" url:"-"` } +type DeleteMaterializedFeatureRequest struct { + // The ID of the materialized feature to delete. + MaterializedFeatureId string `json:"-" url:"-"` +} + type DeleteModelRequest struct { // Registered model unique name identifier. Name string `json:"-" url:"name"` @@ -1522,6 +1532,21 @@ type GetLoggedModelResponse struct { Model *LoggedModel `json:"model,omitempty"` } +type GetLoggedModelsRequest struct { + // The IDs of the logged models to retrieve. Max threshold is 100. + ModelIds []string `json:"-" url:"model_ids,omitempty"` +} + +type GetLoggedModelsRequestResponse struct { + // The retrieved logged models. + Models []LoggedModel `json:"models,omitempty"` +} + +type GetMaterializedFeatureRequest struct { + // The ID of the materialized feature. + MaterializedFeatureId string `json:"-" url:"-"` +} + type GetMetricHistoryResponse struct { // All logged values for this metric if `max_results` is not specified in // the request or if the total count of metrics returned is less than the @@ -1914,6 +1939,44 @@ func (s ListFeaturesResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListMaterializedFeaturesRequest struct { + // Filter by feature name. If specified, only materialized features + // materialized from this feature will be returned. + FeatureName string `json:"-" url:"feature_name,omitempty"` + // The maximum number of results to return. Defaults to 100 if not + // specified. Cannot be greater than 1000. + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page based on a previous query. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListMaterializedFeaturesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListMaterializedFeaturesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListMaterializedFeaturesResponse struct { + // List of materialized features. + MaterializedFeatures []MaterializedFeature `json:"materialized_features,omitempty"` + // Pagination token to request the next page of results for this query. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListMaterializedFeaturesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListMaterializedFeaturesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListModelsRequest struct { // Maximum number of registered models desired. Max threshold is 1000. MaxResults int64 `json:"-" url:"max_results,omitempty"` @@ -2326,6 +2389,77 @@ func (s LoggedModelTag) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// A materialized feature represents a feature that is continuously computed and +// stored. +type MaterializedFeature struct { + // The full name of the feature in Unity Catalog. + FeatureName string `json:"feature_name"` + // The timestamp when the pipeline last ran and updated the materialized + // feature values. If the pipeline has not run yet, this field will be null. + LastMaterializationTime string `json:"last_materialization_time,omitempty"` + // Unique identifier for the materialized feature. + MaterializedFeatureId string `json:"materialized_feature_id,omitempty"` + + OfflineStoreConfig OfflineStoreConfig `json:"offline_store_config"` + + OnlineStoreConfig OnlineStore `json:"online_store_config"` + // The schedule state of the materialization pipeline. + PipelineScheduleState MaterializedFeaturePipelineScheduleState `json:"pipeline_schedule_state,omitempty"` + // The fully qualified Unity Catalog path to the table containing the + // materialized feature (Delta table or Lakebase table). Output only. + TableName string `json:"table_name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *MaterializedFeature) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s MaterializedFeature) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type MaterializedFeaturePipelineScheduleState string + +const MaterializedFeaturePipelineScheduleStateActive MaterializedFeaturePipelineScheduleState = `ACTIVE` + +const MaterializedFeaturePipelineScheduleStatePaused MaterializedFeaturePipelineScheduleState = `PAUSED` + +const MaterializedFeaturePipelineScheduleStateSnapshot MaterializedFeaturePipelineScheduleState = `SNAPSHOT` + +// String representation for [fmt.Print] +func (f *MaterializedFeaturePipelineScheduleState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *MaterializedFeaturePipelineScheduleState) Set(v string) error { + switch v { + case `ACTIVE`, `PAUSED`, `SNAPSHOT`: + *f = MaterializedFeaturePipelineScheduleState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ACTIVE", "PAUSED", "SNAPSHOT"`, v) + } +} + +// Values returns all possible values for MaterializedFeaturePipelineScheduleState. +// +// There is no guarantee on the order of the values in the slice. +func (f *MaterializedFeaturePipelineScheduleState) Values() []MaterializedFeaturePipelineScheduleState { + return []MaterializedFeaturePipelineScheduleState{ + MaterializedFeaturePipelineScheduleStateActive, + MaterializedFeaturePipelineScheduleStatePaused, + MaterializedFeaturePipelineScheduleStateSnapshot, + } +} + +// Type always returns MaterializedFeaturePipelineScheduleState to satisfy [pflag.Value] interface +func (f *MaterializedFeaturePipelineScheduleState) Type() string { + return "MaterializedFeaturePipelineScheduleState" +} + // Metric associated with a run, represented as a key-value pair. type Metric struct { // The dataset digest of the dataset associated with the metric, e.g. an md5 @@ -2617,6 +2751,17 @@ func (s ModelVersionTag) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Configuration for offline store destination. +type OfflineStoreConfig struct { + // The Unity Catalog catalog name. + CatalogName string `json:"catalog_name"` + // The Unity Catalog schema name. + SchemaName string `json:"schema_name"` + // Prefix for Unity Catalog table name. The materialized feature will be + // stored in a table with this prefix and a generated postfix. + TableNamePrefix string `json:"table_name_prefix"` +} + // An OnlineStore is a logical database instance that stores and serves features // online. type OnlineStore struct { @@ -4045,6 +4190,16 @@ func (s UpdateFeatureTagRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateMaterializedFeatureRequest struct { + // The materialized feature to update. + MaterializedFeature MaterializedFeature `json:"materialized_feature"` + // Unique identifier for the materialized feature. + MaterializedFeatureId string `json:"-" url:"-"` + // Provide the materialization feature fields which should be updated. + // Currently, only the pipeline_state field can be updated. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateModelRequest struct { // If provided, updates the description for this `registered_model`. Description string `json:"description,omitempty"` diff --git a/service/oauth2/model.go b/service/oauth2/model.go index 6ff4d56da..2cff62c0f 100755 --- a/service/oauth2/model.go +++ b/service/oauth2/model.go @@ -617,9 +617,26 @@ func (s SecretInfo) MarshalJSON() ([]byte, error) { } type TokenAccessPolicy struct { + // Absolute OAuth session TTL in minutes. Effective only when the single-use + // refresh token feature is enabled. This is the absolute TTL of all refresh + // tokens issued in one OAuth session. When a new refresh token is issued + // during refresh token rotation, it will inherit the same absolute TTL as + // the old refresh token. In other words, this represents the maximum amount + // of time a user can stay logged in without re-authenticating. + AbsoluteSessionLifetimeInMinutes int `json:"absolute_session_lifetime_in_minutes,omitempty"` // access token time to live in minutes AccessTokenTtlInMinutes int `json:"access_token_ttl_in_minutes,omitempty"` - // refresh token time to live in minutes + // Whether to enable single-use refresh tokens (refresh token rotation). If + // this feature is enabled, upon successfully getting a new access token + // using a refresh token, Databricks will issue a new refresh token along + // with the access token in the response and invalidate the old refresh + // token. The client should use the new refresh token to get access tokens + // in future requests. + EnableSingleUseRefreshTokens bool `json:"enable_single_use_refresh_tokens,omitempty"` + // Refresh token time to live in minutes. When single-use refresh tokens are + // enabled, this represents the TTL of an individual refresh token. If the + // refresh token is used before it expires, a new one is issued with a + // renewed individual TTL. RefreshTokenTtlInMinutes int `json:"refresh_token_ttl_in_minutes,omitempty"` ForceSendFields []string `json:"-" url:"-"` diff --git a/service/pipelines/api.go b/service/pipelines/api.go index d843e562a..71bfd699b 100755 --- a/service/pipelines/api.go +++ b/service/pipelines/api.go @@ -33,6 +33,10 @@ type PipelinesInterface interface { WaitGetPipelineIdle(ctx context.Context, pipelineId string, timeout time.Duration, callback func(*GetPipelineResponse)) (*GetPipelineResponse, error) + // * Applies the current pipeline environment onto the pipeline compute. The + // environment applied can be used by subsequent dev-mode updates. + ApplyEnvironment(ctx context.Context, request ApplyEnvironmentRequest) (*ApplyEnvironmentRequestResponse, error) + // Creates a new data processing pipeline based on the requested configuration. // If successful, this method returns the ID of the new pipeline. Create(ctx context.Context, request CreatePipeline) (*CreatePipelineResponse, error) @@ -118,6 +122,10 @@ type PipelinesInterface interface { // List updates for an active pipeline. ListUpdatesByPipelineId(ctx context.Context, pipelineId string) (*ListUpdatesResponse, error) + // * Restores a pipeline that was previously deleted, if within the restoration + // window. All tables deleted at pipeline deletion will be undropped as well. + RestorePipeline(ctx context.Context, request RestorePipelineRequest) (*RestorePipelineRequestResponse, error) + // Sets permissions on an object, replacing existing permissions if they exist. // Deletes all direct permissions if none are specified. Objects can inherit // permissions from their root object. diff --git a/service/pipelines/impl.go b/service/pipelines/impl.go index 1147be7b8..fe3438e2a 100755 --- a/service/pipelines/impl.go +++ b/service/pipelines/impl.go @@ -17,6 +17,16 @@ type pipelinesImpl struct { client *client.DatabricksClient } +func (a *pipelinesImpl) ApplyEnvironment(ctx context.Context, request ApplyEnvironmentRequest) (*ApplyEnvironmentRequestResponse, error) { + var applyEnvironmentRequestResponse ApplyEnvironmentRequestResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v/environment/apply", request.PipelineId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &applyEnvironmentRequestResponse) + return &applyEnvironmentRequestResponse, err +} + func (a *pipelinesImpl) Create(ctx context.Context, request CreatePipeline) (*CreatePipelineResponse, error) { var createPipelineResponse CreatePipelineResponse path := "/api/2.0/pipelines" @@ -169,6 +179,16 @@ func (a *pipelinesImpl) ListUpdates(ctx context.Context, request ListUpdatesRequ return &listUpdatesResponse, err } +func (a *pipelinesImpl) RestorePipeline(ctx context.Context, request RestorePipelineRequest) (*RestorePipelineRequestResponse, error) { + var restorePipelineRequestResponse RestorePipelineRequestResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v/restore", request.PipelineId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &restorePipelineRequestResponse) + return &restorePipelineRequestResponse, err +} + func (a *pipelinesImpl) SetPermissions(ctx context.Context, request PipelinePermissionsRequest) (*PipelinePermissions, error) { var pipelinePermissions PipelinePermissions path := fmt.Sprintf("/api/2.0/permissions/pipelines/%v", request.PipelineId) diff --git a/service/pipelines/interface.go b/service/pipelines/interface.go index 31816b10d..961f3780f 100755 --- a/service/pipelines/interface.go +++ b/service/pipelines/interface.go @@ -24,6 +24,10 @@ import ( // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. type PipelinesService interface { + // * Applies the current pipeline environment onto the pipeline compute. The + // environment applied can be used by subsequent dev-mode updates. + ApplyEnvironment(ctx context.Context, request ApplyEnvironmentRequest) (*ApplyEnvironmentRequestResponse, error) + // Creates a new data processing pipeline based on the requested // configuration. If successful, this method returns the ID of the new // pipeline. @@ -55,6 +59,11 @@ type PipelinesService interface { // List updates for an active pipeline. ListUpdates(ctx context.Context, request ListUpdatesRequest) (*ListUpdatesResponse, error) + // * Restores a pipeline that was previously deleted, if within the + // restoration window. All tables deleted at pipeline deletion will be + // undropped as well. + RestorePipeline(ctx context.Context, request RestorePipelineRequest) (*RestorePipelineRequestResponse, error) + // Sets permissions on an object, replacing existing permissions if they // exist. Deletes all direct permissions if none are specified. Objects can // inherit permissions from their root object. diff --git a/service/pipelines/model.go b/service/pipelines/model.go index 18ff8f415..33c4bba3b 100755 --- a/service/pipelines/model.go +++ b/service/pipelines/model.go @@ -9,6 +9,31 @@ import ( "github.com/databricks/databricks-sdk-go/service/compute" ) +type ApplyEnvironmentRequest struct { + PipelineId string `json:"-" url:"-"` +} + +type ApplyEnvironmentRequestResponse struct { +} + +type ConnectionParameters struct { + // Source catalog for initial connection. This is necessary for schema + // exploration in some database systems like Oracle, and optional but + // nice-to-have in some other database systems like Postgres. For Oracle + // databases, this maps to a service name. + SourceCatalog string `json:"source_catalog,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ConnectionParameters) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ConnectionParameters) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type CreatePipeline struct { // If false, deployment will fail if name conflicts with that of another // pipeline. @@ -83,6 +108,8 @@ type CreatePipeline struct { Target string `json:"target,omitempty"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. Trigger *PipelineTrigger `json:"trigger,omitempty"` + // Usage policy of this pipeline. + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -146,9 +173,8 @@ func (s DataPlaneId) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Days of week in which the restart is allowed to happen (within a five-hour -// window starting at start_hour). If not specified all days of the week will be -// used. +// Days of week in which the window is allowed to happen. If not specified all +// days of the week will be used. type DayOfWeek string const DayOfWeekFriday DayOfWeek = `FRIDAY` @@ -319,6 +345,8 @@ type EditPipeline struct { Target string `json:"target,omitempty"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. Trigger *PipelineTrigger `json:"trigger,omitempty"` + // Usage policy of this pipeline. + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -462,6 +490,8 @@ type GetPipelineResponse struct { CreatorUserName string `json:"creator_user_name,omitempty"` // Serverless budget policy ID of this pipeline. EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + // Serverless usage policy ID of the pipeline. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The health of a pipeline. Health GetPipelineResponseHealth `json:"health,omitempty"` // The last time the pipeline settings were modified or created. @@ -564,6 +594,9 @@ type IngestionGatewayPipelineDefinition struct { // Immutable. The Unity Catalog connection that this gateway pipeline uses // to communicate with the source. ConnectionName string `json:"connection_name"` + // Optional, Internal. Parameters required to establish an initial + // connection with the source. + ConnectionParameters *ConnectionParameters `json:"connection_parameters,omitempty"` // Required, Immutable. The name of the catalog for the gateway pipeline's // storage location. GatewayStorageCatalog string `json:"gateway_storage_catalog"` @@ -592,6 +625,12 @@ type IngestionPipelineDefinition struct { // to communicate with the source. This is used with connectors for // applications like Salesforce, Workday, and so on. ConnectionName string `json:"connection_name,omitempty"` + // Immutable. If set to true, the pipeline will ingest tables from the UC + // foreign catalogs directly without the need to specify a UC connection or + // ingestion gateway. The `source_catalog` fields in objects of + // IngestionConfig are interpreted as the UC foreign catalogs to ingest + // from. + IngestFromUcForeignCatalog bool `json:"ingest_from_uc_foreign_catalog,omitempty"` // Immutable. Identifier for the gateway that is used by this ingestion // pipeline to communicate with the source database. This is used with // connectors to databases like SQL Server. @@ -1033,6 +1072,9 @@ type Origin struct { FlowId string `json:"flow_id,omitempty"` // The name of the flow. Not unique. FlowName string `json:"flow_name,omitempty"` + // The UUID of the graph associated with this event, corresponding to a + // GRAPH_UPDATED event. + GraphId string `json:"graph_id,omitempty"` // The optional host name where the event was triggered Host string `json:"host,omitempty"` // The id of a maintenance run. Globally unique. @@ -1537,6 +1579,8 @@ type PipelineSpec struct { Target string `json:"target,omitempty"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. Trigger *PipelineTrigger `json:"trigger,omitempty"` + // Usage policy of this pipeline. + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -1772,6 +1816,14 @@ func (s RestartWindow) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type RestorePipelineRequest struct { + // The ID of the pipeline to restore + PipelineId string `json:"-" url:"-"` +} + +type RestorePipelineRequestResponse struct { +} + // Write-only setting, available only in Create/Update calls. Specifies the user // or service principal that the pipeline runs as. If not specified, the // pipeline runs as the user who created the pipeline. @@ -2056,6 +2108,10 @@ type TableSpecificConfig struct { PrimaryKeys []string `json:"primary_keys,omitempty"` QueryBasedConnectorConfig *IngestionPipelineDefinitionTableSpecificConfigQueryBasedConnectorConfig `json:"query_based_connector_config,omitempty"` + // (Optional, Immutable) The row filter condition to be applied to the + // table. It must not contain the WHERE keyword, only the actual filter + // condition. It must be in DBSQL format. + RowFilter string `json:"row_filter,omitempty"` // If true, formula fields defined in the table are included in the // ingestion. This setting is only valid for the Salesforce connector SalesforceIncludeFormulaFields bool `json:"salesforce_include_formula_fields,omitempty"` @@ -2137,6 +2193,9 @@ type UpdateInfo struct { // Refresh on a table means that the states of the table will be reset // before the refresh. FullRefreshSelection []string `json:"full_refresh_selection,omitempty"` + // Indicates whether the update is either part of a continuous job run, or + // running in legacy continuous pipeline mode. + Mode UpdateMode `json:"mode,omitempty"` // The ID of the pipeline. PipelineId string `json:"pipeline_id,omitempty"` // A list of tables to update without fullRefresh. If both refresh_selection @@ -2281,6 +2340,43 @@ func (f *UpdateInfoState) Type() string { return "UpdateInfoState" } +type UpdateMode string + +const UpdateModeContinuous UpdateMode = `CONTINUOUS` + +const UpdateModeDefault UpdateMode = `DEFAULT` + +// String representation for [fmt.Print] +func (f *UpdateMode) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *UpdateMode) Set(v string) error { + switch v { + case `CONTINUOUS`, `DEFAULT`: + *f = UpdateMode(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CONTINUOUS", "DEFAULT"`, v) + } +} + +// Values returns all possible values for UpdateMode. +// +// There is no guarantee on the order of the values in the slice. +func (f *UpdateMode) Values() []UpdateMode { + return []UpdateMode{ + UpdateModeContinuous, + UpdateModeDefault, + } +} + +// Type always returns UpdateMode to satisfy [pflag.Value] interface +func (f *UpdateMode) Type() string { + return "UpdateMode" +} + type UpdateStateInfo struct { CreationTime string `json:"creation_time,omitempty"` diff --git a/service/pkg.go b/service/pkg.go index 9b190ca93..cb0f5ed1f 100755 --- a/service/pkg.go +++ b/service/pkg.go @@ -88,6 +88,8 @@ // // - [database.DatabaseAPI]: Database Instances provide access to a database via REST API or direct SQL. // +// - [database.DatabaseProjectAPI]: Database Projects provide access to a database via REST API or direct SQL. +// // - [files.DbfsAPI]: DBFS API makes it simple to interact with various data sources without having to include a users credentials every time to read a file. // // - [sql.DbsqlPermissionsAPI]: The SQL Permissions API is similar to the endpoints of the :method:permissions/set. @@ -244,6 +246,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. @@ -310,6 +314,8 @@ // // - [catalog.TablesAPI]: A table resides in the third layer of Unity Catalog’s three-level namespace. // +// - [tags.TagAssignmentsAPI]: Manage tag assignments on workspace-scoped objects. +// // - [tags.TagPoliciesAPI]: The Tag Policy API allows you to manage policies for governed tags in Databricks. // // - [catalog.TemporaryPathCredentialsAPI]: Temporary Path Credentials refer to short-lived, downscoped credentials used to access external cloud storage locations registered in Databricks. @@ -322,6 +328,8 @@ // // - [billing.UsageDashboardsAPI]: These APIs manage usage dashboards for this account. // +// - [billing.UsagePolicyAPI]: A service serves REST API about Usage policies. +// // - [iam.UsersV2API]: User identities recognized by Databricks and represented by email addresses. // // - [iam.AccountUsersV2API]: User identities recognized by Databricks and represented by email addresses. @@ -432,6 +440,7 @@ var ( _ *dataquality.DataQualityAPI = nil _ *sql.DataSourcesAPI = nil _ *database.DatabaseAPI = nil + _ *database.DatabaseProjectAPI = nil _ *files.DbfsAPI = nil _ *sql.DbsqlPermissionsAPI = nil _ *settings.DefaultNamespaceAPI = nil @@ -510,6 +519,7 @@ var ( _ *catalog.QualityMonitorsAPI = nil _ *sql.QueriesAPI = nil _ *sql.QueriesLegacyAPI = nil + _ *dashboards.QueryExecutionAPI = nil _ *sql.QueryHistoryAPI = nil _ *sql.QueryVisualizationsAPI = nil _ *sql.QueryVisualizationsLegacyAPI = nil @@ -543,12 +553,14 @@ var ( _ *catalog.SystemSchemasAPI = nil _ *catalog.TableConstraintsAPI = nil _ *catalog.TablesAPI = nil + _ *tags.TagAssignmentsAPI = nil _ *tags.TagPoliciesAPI = nil _ *catalog.TemporaryPathCredentialsAPI = nil _ *catalog.TemporaryTableCredentialsAPI = nil _ *settings.TokenManagementAPI = nil _ *settings.TokensAPI = nil _ *billing.UsageDashboardsAPI = nil + _ *billing.UsagePolicyAPI = nil _ *iam.UsersV2API = nil _ *iam.AccountUsersV2API = nil _ *vectorsearch.VectorSearchEndpointsAPI = nil diff --git a/service/provisioning/model.go b/service/provisioning/model.go index 3acbbb0d1..54b00ad2b 100755 --- a/service/provisioning/model.go +++ b/service/provisioning/model.go @@ -316,6 +316,10 @@ type CreateWorkspaceRequest struct { // history. The provided key configuration object property use_cases must // contain MANAGED_SERVICES. ManagedServicesCustomerManagedKeyId string `json:"managed_services_customer_managed_key_id,omitempty"` + // The object ID of network connectivity config. Once assigned, the + // workspace serverless compute resources use the same set of stable IP CIDR + // blocks and optional private link to access your resources. + NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` // The ID of the workspace's network configuration object. To use AWS // PrivateLink, this field is required. NetworkId string `json:"network_id,omitempty"` @@ -1301,7 +1305,7 @@ type Workspace struct { AwsRegion string `json:"aws_region,omitempty"` AzureWorkspaceInfo *AzureWorkspaceInfo `json:"azure_workspace_info,omitempty"` - // The cloud name. This field always has the value `gcp`. + // The cloud name. This field can have values like `azure`, `gcp`. Cloud string `json:"cloud,omitempty"` CloudResourceContainer *CloudResourceContainer `json:"cloud_resource_container,omitempty"` diff --git a/service/qualitymonitorv2/model.go b/service/qualitymonitorv2/model.go index b7a13ee2f..091dd0c82 100755 --- a/service/qualitymonitorv2/model.go +++ b/service/qualitymonitorv2/model.go @@ -9,6 +9,8 @@ import ( ) type AnomalyDetectionConfig struct { + // The type of the last run of the workflow. + JobType AnomalyDetectionJobType `json:"job_type,omitempty"` // Run id of the last run of the workflow LastRunId string `json:"last_run_id,omitempty"` // The status of the last run of the workflow. @@ -25,6 +27,43 @@ func (s AnomalyDetectionConfig) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type AnomalyDetectionJobType string + +const AnomalyDetectionJobTypeAnomalyDetectionJobTypeInternalHidden AnomalyDetectionJobType = `ANOMALY_DETECTION_JOB_TYPE_INTERNAL_HIDDEN` + +const AnomalyDetectionJobTypeAnomalyDetectionJobTypeNormal AnomalyDetectionJobType = `ANOMALY_DETECTION_JOB_TYPE_NORMAL` + +// String representation for [fmt.Print] +func (f *AnomalyDetectionJobType) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *AnomalyDetectionJobType) Set(v string) error { + switch v { + case `ANOMALY_DETECTION_JOB_TYPE_INTERNAL_HIDDEN`, `ANOMALY_DETECTION_JOB_TYPE_NORMAL`: + *f = AnomalyDetectionJobType(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ANOMALY_DETECTION_JOB_TYPE_INTERNAL_HIDDEN", "ANOMALY_DETECTION_JOB_TYPE_NORMAL"`, v) + } +} + +// Values returns all possible values for AnomalyDetectionJobType. +// +// There is no guarantee on the order of the values in the slice. +func (f *AnomalyDetectionJobType) Values() []AnomalyDetectionJobType { + return []AnomalyDetectionJobType{ + AnomalyDetectionJobTypeAnomalyDetectionJobTypeInternalHidden, + AnomalyDetectionJobTypeAnomalyDetectionJobTypeNormal, + } +} + +// Type always returns AnomalyDetectionJobType to satisfy [pflag.Value] interface +func (f *AnomalyDetectionJobType) Type() string { + return "AnomalyDetectionJobType" +} + // Status of Anomaly Detection Job Run type AnomalyDetectionRunStatus string diff --git a/service/serving/impl.go b/service/serving/impl.go index 0e31333e2..f262bf593 100755 --- a/service/serving/impl.go +++ b/service/serving/impl.go @@ -303,7 +303,6 @@ func (a *servingEndpointsDataPlaneImpl) Query(ctx context.Context, request Query if err != nil { return nil, err } - headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" diff --git a/service/settings/model.go b/service/settings/model.go index e4693938b..95e949bb2 100755 --- a/service/settings/model.go +++ b/service/settings/model.go @@ -620,6 +620,10 @@ type CreatePrivateEndpointRule struct { // The full target AWS endpoint service name that connects to the // destination resources of the private endpoint. EndpointService string `json:"endpoint_service,omitempty"` + + ErrorMessage string `json:"error_message,omitempty"` + + GcpEndpointSpec *GcpEndpointSpec `json:"gcp_endpoint_spec,omitempty"` // Not used by customer-managed private endpoint services. // // The sub-resource type (group ID) of the target resource. Note that to @@ -661,6 +665,8 @@ type CreateTokenRequest struct { // // If the lifetime is not specified, this token remains valid indefinitely. LifetimeSeconds int64 `json:"lifetime_seconds,omitempty"` + // Optional scopes of the token. + Scopes []string `json:"scopes,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -2350,6 +2356,24 @@ type FetchIpAccessListResponse struct { IpAccessList *IpAccessListInfo `json:"ip_access_list,omitempty"` } +type GcpEndpointSpec struct { + // Output only. The URI of the created PSC endpoint. + PscEndpointUri string `json:"psc_endpoint_uri,omitempty"` + // The full url of the target service attachment. Example: + // projects/my-gcp-project/regions/us-east4/serviceAttachments/my-service-attachment + ServiceAttachment string `json:"service_attachment,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GcpEndpointSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GcpEndpointSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GenericWebhookConfig struct { // [Input-Only][Optional] Password for webhook. Password string `json:"password,omitempty"` @@ -3393,6 +3417,8 @@ type NccEgressDefaultRules struct { AwsStableIpRule *NccAwsStableIpRule `json:"aws_stable_ip_rule,omitempty"` AzureServiceEndpointRule *NccAzureServiceEndpointRule `json:"azure_service_endpoint_rule,omitempty"` + + GcpProjectIdRule *NetworkConnectivityConfigEgressConfigDefaultRuleGcpProjectIdRule `json:"gcp_project_id_rule,omitempty"` } // Target rule controls the egress rules that are dedicated to specific @@ -3445,6 +3471,10 @@ type NccPrivateEndpointRule struct { // The full target AWS endpoint service name that connects to the // destination resources of the private endpoint. EndpointService string `json:"endpoint_service,omitempty"` + + ErrorMessage string `json:"error_message,omitempty"` + + GcpEndpointSpec *GcpEndpointSpec `json:"gcp_endpoint_spec,omitempty"` // Not used by customer-managed private endpoint services. // // The sub-resource type (group ID) of the target resource. Note that to @@ -3484,6 +3514,10 @@ func (s NccPrivateEndpointRule) MarshalJSON() ([]byte, error) { type NccPrivateEndpointRulePrivateLinkConnectionState string +const NccPrivateEndpointRulePrivateLinkConnectionStateCreateFailed NccPrivateEndpointRulePrivateLinkConnectionState = `CREATE_FAILED` + +const NccPrivateEndpointRulePrivateLinkConnectionStateCreating NccPrivateEndpointRulePrivateLinkConnectionState = `CREATING` + const NccPrivateEndpointRulePrivateLinkConnectionStateDisconnected NccPrivateEndpointRulePrivateLinkConnectionState = `DISCONNECTED` const NccPrivateEndpointRulePrivateLinkConnectionStateEstablished NccPrivateEndpointRulePrivateLinkConnectionState = `ESTABLISHED` @@ -3502,11 +3536,11 @@ func (f *NccPrivateEndpointRulePrivateLinkConnectionState) String() string { // Set raw string value and validate it against allowed values func (f *NccPrivateEndpointRulePrivateLinkConnectionState) Set(v string) error { switch v { - case `DISCONNECTED`, `ESTABLISHED`, `EXPIRED`, `PENDING`, `REJECTED`: + case `CREATE_FAILED`, `CREATING`, `DISCONNECTED`, `ESTABLISHED`, `EXPIRED`, `PENDING`, `REJECTED`: *f = NccPrivateEndpointRulePrivateLinkConnectionState(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "DISCONNECTED", "ESTABLISHED", "EXPIRED", "PENDING", "REJECTED"`, v) + return fmt.Errorf(`value "%s" is not one of "CREATE_FAILED", "CREATING", "DISCONNECTED", "ESTABLISHED", "EXPIRED", "PENDING", "REJECTED"`, v) } } @@ -3515,6 +3549,8 @@ func (f *NccPrivateEndpointRulePrivateLinkConnectionState) Set(v string) error { // There is no guarantee on the order of the values in the slice. func (f *NccPrivateEndpointRulePrivateLinkConnectionState) Values() []NccPrivateEndpointRulePrivateLinkConnectionState { return []NccPrivateEndpointRulePrivateLinkConnectionState{ + NccPrivateEndpointRulePrivateLinkConnectionStateCreateFailed, + NccPrivateEndpointRulePrivateLinkConnectionStateCreating, NccPrivateEndpointRulePrivateLinkConnectionStateDisconnected, NccPrivateEndpointRulePrivateLinkConnectionStateEstablished, NccPrivateEndpointRulePrivateLinkConnectionStateExpired, @@ -3528,6 +3564,13 @@ func (f *NccPrivateEndpointRulePrivateLinkConnectionState) Type() string { return "NccPrivateEndpointRulePrivateLinkConnectionState" } +type NetworkConnectivityConfigEgressConfigDefaultRuleGcpProjectIdRule struct { + // A list of Databricks internal project IDs from where network access + // originates for serverless DBSQL, This list is stable and will not change + // once the NCC object is created. + ProjectIds []string `json:"project_ids,omitempty"` +} + // Properties of the new network connectivity configuration. type NetworkConnectivityConfiguration struct { // Your Databricks account ID. You can find your account ID in your @@ -3716,6 +3759,8 @@ type PublicTokenInfo struct { // Server time (in epoch milliseconds) when the token will expire, or -1 if // not applicable. ExpiryTime int64 `json:"expiry_time,omitempty"` + // Scope of the token was created with, if applicable. + Scopes []string `json:"scopes,omitempty"` // The ID of this token. TokenId string `json:"token_id,omitempty"` @@ -3948,6 +3993,8 @@ type TokenInfo struct { LastUsedDay int64 `json:"last_used_day,omitempty"` // User ID of the user that owns the token. OwnerId int64 `json:"owner_id,omitempty"` + // Scope of the token was created with, if applicable. + Scopes []string `json:"scopes,omitempty"` // ID of the token. TokenId string `json:"token_id,omitempty"` // If applicable, the ID of the workspace that the token was created in. @@ -4626,6 +4673,10 @@ type UpdatePrivateEndpointRule struct { // Update this field to activate/deactivate this private endpoint to allow // egress access from serverless compute resources. Enabled bool `json:"enabled,omitempty"` + + ErrorMessage string `json:"error_message,omitempty"` + + GcpEndpointSpec *GcpEndpointSpec `json:"gcp_endpoint_spec,omitempty"` // Only used by private endpoints towards AWS S3 service. // // The globally unique S3 bucket names that will be accessed via the VPC diff --git a/service/sharing/model.go b/service/sharing/model.go index cf3023ab2..ec2ef3174 100755 --- a/service/sharing/model.go +++ b/service/sharing/model.go @@ -223,6 +223,9 @@ type CreateShare struct { Comment string `json:"comment,omitempty"` // Name of the share. Name string `json:"name"` + // Serverless budget policy id (can only be created/updated when calling + // data-sharing service) [Create,Update:IGN] + ServerlessBudgetPolicyId string `json:"serverless_budget_policy_id,omitempty"` // Storage root URL for the share. StorageRoot string `json:"storage_root,omitempty"` @@ -950,6 +953,16 @@ type PermissionsChange struct { // The principal whose privileges we are changing. Only one of principal or // principal_id should be specified, never both at the same time. Principal string `json:"principal,omitempty"` + // An opaque internal ID that identifies the principal whose privileges + // should be removed. + // + // This field is intended for removing privileges associated with a deleted + // user. When set, only the entries specified in the remove field are + // processed; any entries in the add field will be rejected. + // + // Only one of principal or principal_id should be specified, never both at + // the same time. + PrincipalId int64 `json:"principal_id,omitempty"` // The set of privileges to remove. Remove []string `json:"remove,omitempty"` @@ -1134,6 +1147,9 @@ type PrivilegeAssignment struct { // The principal (user email address or group name). For deleted principals, // `principal` is empty while `principal_id` is populated. Principal string `json:"principal,omitempty"` + // Unique identifier of the principal. For active principals, both + // `principal` and `principal_id` are present. + PrincipalId int64 `json:"principal_id,omitempty"` // The privileges assigned to the principal. Privileges []Privilege `json:"privileges,omitempty"` @@ -1409,6 +1425,9 @@ type ShareInfo struct { Objects []SharedDataObject `json:"objects,omitempty"` // Username of current owner of share. Owner string `json:"owner,omitempty"` + // Serverless budget policy id (can only be created/updated when calling + // data-sharing service) [Create,Update:IGN] + ServerlessBudgetPolicyId string `json:"serverless_budget_policy_id,omitempty"` // Storage Location URL (full path) for the share. StorageLocation string `json:"storage_location,omitempty"` // Storage root URL for the share. @@ -1995,6 +2014,9 @@ type UpdateShare struct { NewName string `json:"new_name,omitempty"` // Username of current owner of share. Owner string `json:"owner,omitempty"` + // Serverless budget policy id (can only be created/updated when calling + // data-sharing service) [Create,Update:IGN] + ServerlessBudgetPolicyId string `json:"serverless_budget_policy_id,omitempty"` // Storage root URL for the share. StorageRoot string `json:"storage_root,omitempty"` // Array of shared data object updates. diff --git a/service/sql/model.go b/service/sql/model.go index 21d0189df..ebaf3702f 100755 --- a/service/sql/model.go +++ b/service/sql/model.go @@ -467,13 +467,16 @@ type AlertV2 struct { // Custom summary for the alert. support mustache template. CustomSummary string `json:"custom_summary,omitempty"` // The display name of the alert. - DisplayName string `json:"display_name,omitempty"` + DisplayName string `json:"display_name"` + // The actual workspace path of the folder containing the alert. This is an + // output-only field. + EffectiveParentPath string `json:"effective_parent_path,omitempty"` // The actual identity that will be used to execute the alert. This is an // output-only field that shows the resolved run-as identity after applying // permissions and defaults. EffectiveRunAs *AlertV2RunAs `json:"effective_run_as,omitempty"` - Evaluation *AlertV2Evaluation `json:"evaluation,omitempty"` + Evaluation AlertV2Evaluation `json:"evaluation"` // UUID identifying the alert. Id string `json:"id,omitempty"` // Indicates whether the query is trashed. @@ -485,7 +488,7 @@ type AlertV2 struct { // create, and cannot be updated. ParentPath string `json:"parent_path,omitempty"` // Text of the query to be run. - QueryText string `json:"query_text,omitempty"` + QueryText string `json:"query_text"` // Specifies the identity that will be used to run the alert. This field // allows you to configure alerts to run as a specific user or service // principal. - For user identity: Set `user_name` to the email of an active @@ -501,11 +504,11 @@ type AlertV2 struct { // future release. RunAsUserName string `json:"run_as_user_name,omitempty"` - Schedule *CronSchedule `json:"schedule,omitempty"` + Schedule CronSchedule `json:"schedule"` // The timestamp indicating when the alert was updated. UpdateTime string `json:"update_time,omitempty"` // ID of the SQL warehouse attached to the alert. - WarehouseId string `json:"warehouse_id,omitempty"` + WarehouseId string `json:"warehouse_id"` ForceSendFields []string `json:"-" url:"-"` } @@ -520,7 +523,7 @@ func (s AlertV2) MarshalJSON() ([]byte, error) { type AlertV2Evaluation struct { // Operator used for comparison in alert evaluation. - ComparisonOperator ComparisonOperator `json:"comparison_operator,omitempty"` + ComparisonOperator ComparisonOperator `json:"comparison_operator"` // Alert state if result is empty. Please avoid setting this field to be // `UNKNOWN` because `UNKNOWN` state is planned to be deprecated. EmptyResultState AlertEvaluationState `json:"empty_result_state,omitempty"` @@ -529,7 +532,7 @@ type AlertV2Evaluation struct { // User or Notification Destination to notify when alert is triggered. Notification *AlertV2Notification `json:"notification,omitempty"` // Source column from result to use to evaluate alert - Source *AlertV2OperandColumn `json:"source,omitempty"` + Source AlertV2OperandColumn `json:"source"` // Latest state of alert evaluation. State AlertEvaluationState `json:"state,omitempty"` // Threshold to user for alert evaluation, can be a column or a value. @@ -547,6 +550,12 @@ func (s AlertV2Evaluation) MarshalJSON() ([]byte, error) { } type AlertV2Notification struct { + // The actual behavior of whether to notify alert subscribers when alert + // returns back to normal. This is an output-only field. + EffectiveNotifyOnOk bool `json:"effective_notify_on_ok,omitempty"` + // The actual number of seconds an alert must wait after being triggered to + // rearm itself. This is an output-only field. + EffectiveRetriggerSeconds int `json:"effective_retrigger_seconds,omitempty"` // Whether to notify alert subscribers when alert returns back to normal. NotifyOnOk bool `json:"notify_on_ok,omitempty"` // Number of seconds an alert must wait after being triggered to rearm @@ -578,7 +587,7 @@ type AlertV2OperandColumn struct { Display string `json:"display,omitempty"` - Name string `json:"name,omitempty"` + Name string `json:"name"` ForceSendFields []string `json:"-" url:"-"` } @@ -1312,28 +1321,20 @@ func (s CreateWidget) MarshalJSON() ([]byte, error) { } type CronSchedule struct { + // The actual pause status of the schedule. This is an output-only field. + EffectivePauseStatus SchedulePauseStatus `json:"effective_pause_status,omitempty"` // Indicate whether this schedule is paused or not. PauseStatus SchedulePauseStatus `json:"pause_status,omitempty"` // A cron expression using quartz syntax that specifies the schedule for // this pipeline. Should use the quartz format described here: // http://www.quartz-scheduler.org/documentation/quartz-2.1.7/tutorials/tutorial-lesson-06.html - QuartzCronSchedule string `json:"quartz_cron_schedule,omitempty"` + QuartzCronSchedule string `json:"quartz_cron_schedule"` // A Java timezone id. The schedule will be resolved using this timezone. // This will be combined with the quartz_cron_schedule to determine the // schedule. See // https://docs.databricks.com/sql/language-manual/sql-ref-syntax-aux-conf-mgmt-set-timezone.html // for details. - TimezoneId string `json:"timezone_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func (s *CronSchedule) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, s) -} - -func (s CronSchedule) MarshalJSON() ([]byte, error) { - return marshal.Marshal(s) + TimezoneId string `json:"timezone_id"` } // A JSON representing a dashboard containing widgets of visualizations and text @@ -5334,16 +5335,28 @@ const TerminationReasonCodeNetvisorSetupTimeout TerminationReasonCode = `NETVISO const TerminationReasonCodeNetworkCheckControlPlaneFailure TerminationReasonCode = `NETWORK_CHECK_CONTROL_PLANE_FAILURE` +const TerminationReasonCodeNetworkCheckControlPlaneFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_CONTROL_PLANE_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkCheckDnsServerFailure TerminationReasonCode = `NETWORK_CHECK_DNS_SERVER_FAILURE` +const TerminationReasonCodeNetworkCheckDnsServerFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_DNS_SERVER_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkCheckMetadataEndpointFailure TerminationReasonCode = `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE` +const TerminationReasonCodeNetworkCheckMetadataEndpointFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkCheckMultipleComponentsFailure TerminationReasonCode = `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE` +const TerminationReasonCodeNetworkCheckMultipleComponentsFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkCheckNicFailure TerminationReasonCode = `NETWORK_CHECK_NIC_FAILURE` +const TerminationReasonCodeNetworkCheckNicFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_NIC_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkCheckStorageFailure TerminationReasonCode = `NETWORK_CHECK_STORAGE_FAILURE` +const TerminationReasonCodeNetworkCheckStorageFailureDueToMisconfig TerminationReasonCode = `NETWORK_CHECK_STORAGE_FAILURE_DUE_TO_MISCONFIG` + const TerminationReasonCodeNetworkConfigurationFailure TerminationReasonCode = `NETWORK_CONFIGURATION_FAILURE` const TerminationReasonCodeNfsMountFailure TerminationReasonCode = `NFS_MOUNT_FAILURE` @@ -5450,11 +5463,11 @@ func (f *TerminationReasonCode) String() string { // Set raw string value and validate it against allowed values func (f *TerminationReasonCode) Set(v string) error { switch v { - case `ABUSE_DETECTED`, `ACCESS_TOKEN_FAILURE`, `ALLOCATION_TIMEOUT`, `ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY`, `ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_READY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS`, `ATTACH_PROJECT_FAILURE`, `AWS_AUTHORIZATION_FAILURE`, `AWS_INACCESSIBLE_KMS_KEY_FAILURE`, `AWS_INSTANCE_PROFILE_UPDATE_FAILURE`, `AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE`, `AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE`, `AWS_INVALID_KEY_PAIR`, `AWS_INVALID_KMS_KEY_STATE`, `AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE`, `AWS_REQUEST_LIMIT_EXCEEDED`, `AWS_RESOURCE_QUOTA_EXCEEDED`, `AWS_UNSUPPORTED_FAILURE`, `AZURE_BYOK_KEY_PERMISSION_FAILURE`, `AZURE_EPHEMERAL_DISK_FAILURE`, `AZURE_INVALID_DEPLOYMENT_TEMPLATE`, `AZURE_OPERATION_NOT_ALLOWED_EXCEPTION`, `AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE`, `AZURE_QUOTA_EXCEEDED_EXCEPTION`, `AZURE_RESOURCE_MANAGER_THROTTLING`, `AZURE_RESOURCE_PROVIDER_THROTTLING`, `AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE`, `AZURE_VM_EXTENSION_FAILURE`, `AZURE_VNET_CONFIGURATION_FAILURE`, `BOOTSTRAP_TIMEOUT`, `BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION`, `BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG`, `BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED`, `BUDGET_POLICY_RESOLUTION_FAILURE`, `CLOUD_ACCOUNT_POD_QUOTA_EXCEEDED`, `CLOUD_ACCOUNT_SETUP_FAILURE`, `CLOUD_OPERATION_CANCELLED`, `CLOUD_PROVIDER_DISK_SETUP_FAILURE`, `CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED`, `CLOUD_PROVIDER_LAUNCH_FAILURE`, `CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_SHUTDOWN`, `CLUSTER_OPERATION_THROTTLED`, `CLUSTER_OPERATION_TIMEOUT`, `COMMUNICATION_LOST`, `CONTAINER_LAUNCH_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG`, `DATABASE_CONNECTION_FAILURE`, `DATA_ACCESS_CONFIG_CHANGED`, `DBFS_COMPONENT_UNHEALTHY`, `DISASTER_RECOVERY_REPLICATION`, `DNS_RESOLUTION_ERROR`, `DOCKER_CONTAINER_CREATION_EXCEPTION`, `DOCKER_IMAGE_PULL_FAILURE`, `DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION`, `DOCKER_INVALID_OS_EXCEPTION`, `DRIVER_DNS_RESOLUTION_FAILURE`, `DRIVER_EVICTION`, `DRIVER_LAUNCH_TIMEOUT`, `DRIVER_NODE_UNREACHABLE`, `DRIVER_OUT_OF_DISK`, `DRIVER_OUT_OF_MEMORY`, `DRIVER_POD_CREATION_FAILURE`, `DRIVER_UNEXPECTED_FAILURE`, `DRIVER_UNHEALTHY`, `DRIVER_UNREACHABLE`, `DRIVER_UNRESPONSIVE`, `DYNAMIC_SPARK_CONF_SIZE_EXCEEDED`, `EOS_SPARK_IMAGE`, `EXECUTION_COMPONENT_UNHEALTHY`, `EXECUTOR_POD_UNSCHEDULED`, `GCP_API_RATE_QUOTA_EXCEEDED`, `GCP_DENIED_BY_ORG_POLICY`, `GCP_FORBIDDEN`, `GCP_IAM_TIMEOUT`, `GCP_INACCESSIBLE_KMS_KEY_FAILURE`, `GCP_INSUFFICIENT_CAPACITY`, `GCP_IP_SPACE_EXHAUSTED`, `GCP_KMS_KEY_PERMISSION_DENIED`, `GCP_NOT_FOUND`, `GCP_QUOTA_EXCEEDED`, `GCP_RESOURCE_QUOTA_EXCEEDED`, `GCP_SERVICE_ACCOUNT_ACCESS_DENIED`, `GCP_SERVICE_ACCOUNT_DELETED`, `GCP_SERVICE_ACCOUNT_NOT_FOUND`, `GCP_SUBNET_NOT_READY`, `GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED`, `GKE_BASED_CLUSTER_TERMINATION`, `GLOBAL_INIT_SCRIPT_FAILURE`, `HIVE_METASTORE_PROVISIONING_FAILURE`, `IMAGE_PULL_PERMISSION_DENIED`, `INACTIVITY`, `INIT_CONTAINER_NOT_FINISHED`, `INIT_SCRIPT_FAILURE`, `INSTANCE_POOL_CLUSTER_FAILURE`, `INSTANCE_POOL_MAX_CAPACITY_REACHED`, `INSTANCE_POOL_NOT_FOUND`, `INSTANCE_UNREACHABLE`, `INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG`, `INTERNAL_CAPACITY_FAILURE`, `INTERNAL_ERROR`, `INVALID_ARGUMENT`, `INVALID_AWS_PARAMETER`, `INVALID_INSTANCE_PLACEMENT_PROTOCOL`, `INVALID_SPARK_IMAGE`, `INVALID_WORKER_IMAGE_FAILURE`, `IN_PENALTY_BOX`, `IP_EXHAUSTION_FAILURE`, `JOB_FINISHED`, `K8S_ACTIVE_POD_QUOTA_EXCEEDED`, `K8S_AUTOSCALING_FAILURE`, `K8S_DBR_CLUSTER_LAUNCH_TIMEOUT`, `LAZY_ALLOCATION_TIMEOUT`, `MAINTENANCE_MODE`, `METASTORE_COMPONENT_UNHEALTHY`, `NEPHOS_RESOURCE_MANAGEMENT`, `NETVISOR_SETUP_TIMEOUT`, `NETWORK_CHECK_CONTROL_PLANE_FAILURE`, `NETWORK_CHECK_DNS_SERVER_FAILURE`, `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE`, `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE`, `NETWORK_CHECK_NIC_FAILURE`, `NETWORK_CHECK_STORAGE_FAILURE`, `NETWORK_CONFIGURATION_FAILURE`, `NFS_MOUNT_FAILURE`, `NO_ACTIVATED_K8S`, `NO_ACTIVATED_K8S_TESTING_TAG`, `NO_MATCHED_K8S`, `NO_MATCHED_K8S_TESTING_TAG`, `NPIP_TUNNEL_SETUP_FAILURE`, `NPIP_TUNNEL_TOKEN_FAILURE`, `POD_ASSIGNMENT_FAILURE`, `POD_SCHEDULING_FAILURE`, `REQUEST_REJECTED`, `REQUEST_THROTTLED`, `RESOURCE_USAGE_BLOCKED`, `SECRET_CREATION_FAILURE`, `SECRET_PERMISSION_DENIED`, `SECRET_RESOLUTION_ERROR`, `SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION`, `SECURITY_DAEMON_REGISTRATION_EXCEPTION`, `SELF_BOOTSTRAP_FAILURE`, `SERVERLESS_LONG_RUNNING_TERMINATED`, `SKIPPED_SLOW_NODES`, `SLOW_IMAGE_DOWNLOAD`, `SPARK_ERROR`, `SPARK_IMAGE_DOWNLOAD_FAILURE`, `SPARK_IMAGE_DOWNLOAD_THROTTLED`, `SPARK_IMAGE_NOT_FOUND`, `SPARK_STARTUP_FAILURE`, `SPOT_INSTANCE_TERMINATION`, `SSH_BOOTSTRAP_FAILURE`, `STORAGE_DOWNLOAD_FAILURE`, `STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG`, `STORAGE_DOWNLOAD_FAILURE_SLOW`, `STORAGE_DOWNLOAD_FAILURE_THROTTLED`, `STS_CLIENT_SETUP_FAILURE`, `SUBNET_EXHAUSTED_FAILURE`, `TEMPORARILY_UNAVAILABLE`, `TRIAL_EXPIRED`, `UNEXPECTED_LAUNCH_FAILURE`, `UNEXPECTED_POD_RECREATION`, `UNKNOWN`, `UNSUPPORTED_INSTANCE_TYPE`, `UPDATE_INSTANCE_PROFILE_FAILURE`, `USAGE_POLICY_ENTITLEMENT_DENIED`, `USER_INITIATED_VM_TERMINATION`, `USER_REQUEST`, `WORKER_SETUP_FAILURE`, `WORKSPACE_CANCELLED_ERROR`, `WORKSPACE_CONFIGURATION_ERROR`, `WORKSPACE_UPDATE`: + case `ABUSE_DETECTED`, `ACCESS_TOKEN_FAILURE`, `ALLOCATION_TIMEOUT`, `ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY`, `ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_READY_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS`, `ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS`, `ATTACH_PROJECT_FAILURE`, `AWS_AUTHORIZATION_FAILURE`, `AWS_INACCESSIBLE_KMS_KEY_FAILURE`, `AWS_INSTANCE_PROFILE_UPDATE_FAILURE`, `AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE`, `AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE`, `AWS_INVALID_KEY_PAIR`, `AWS_INVALID_KMS_KEY_STATE`, `AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE`, `AWS_REQUEST_LIMIT_EXCEEDED`, `AWS_RESOURCE_QUOTA_EXCEEDED`, `AWS_UNSUPPORTED_FAILURE`, `AZURE_BYOK_KEY_PERMISSION_FAILURE`, `AZURE_EPHEMERAL_DISK_FAILURE`, `AZURE_INVALID_DEPLOYMENT_TEMPLATE`, `AZURE_OPERATION_NOT_ALLOWED_EXCEPTION`, `AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE`, `AZURE_QUOTA_EXCEEDED_EXCEPTION`, `AZURE_RESOURCE_MANAGER_THROTTLING`, `AZURE_RESOURCE_PROVIDER_THROTTLING`, `AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE`, `AZURE_VM_EXTENSION_FAILURE`, `AZURE_VNET_CONFIGURATION_FAILURE`, `BOOTSTRAP_TIMEOUT`, `BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION`, `BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG`, `BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED`, `BUDGET_POLICY_RESOLUTION_FAILURE`, `CLOUD_ACCOUNT_POD_QUOTA_EXCEEDED`, `CLOUD_ACCOUNT_SETUP_FAILURE`, `CLOUD_OPERATION_CANCELLED`, `CLOUD_PROVIDER_DISK_SETUP_FAILURE`, `CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED`, `CLOUD_PROVIDER_LAUNCH_FAILURE`, `CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT`, `CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG`, `CLOUD_PROVIDER_SHUTDOWN`, `CLUSTER_OPERATION_THROTTLED`, `CLUSTER_OPERATION_TIMEOUT`, `COMMUNICATION_LOST`, `CONTAINER_LAUNCH_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE`, `CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG`, `DATABASE_CONNECTION_FAILURE`, `DATA_ACCESS_CONFIG_CHANGED`, `DBFS_COMPONENT_UNHEALTHY`, `DISASTER_RECOVERY_REPLICATION`, `DNS_RESOLUTION_ERROR`, `DOCKER_CONTAINER_CREATION_EXCEPTION`, `DOCKER_IMAGE_PULL_FAILURE`, `DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION`, `DOCKER_INVALID_OS_EXCEPTION`, `DRIVER_DNS_RESOLUTION_FAILURE`, `DRIVER_EVICTION`, `DRIVER_LAUNCH_TIMEOUT`, `DRIVER_NODE_UNREACHABLE`, `DRIVER_OUT_OF_DISK`, `DRIVER_OUT_OF_MEMORY`, `DRIVER_POD_CREATION_FAILURE`, `DRIVER_UNEXPECTED_FAILURE`, `DRIVER_UNHEALTHY`, `DRIVER_UNREACHABLE`, `DRIVER_UNRESPONSIVE`, `DYNAMIC_SPARK_CONF_SIZE_EXCEEDED`, `EOS_SPARK_IMAGE`, `EXECUTION_COMPONENT_UNHEALTHY`, `EXECUTOR_POD_UNSCHEDULED`, `GCP_API_RATE_QUOTA_EXCEEDED`, `GCP_DENIED_BY_ORG_POLICY`, `GCP_FORBIDDEN`, `GCP_IAM_TIMEOUT`, `GCP_INACCESSIBLE_KMS_KEY_FAILURE`, `GCP_INSUFFICIENT_CAPACITY`, `GCP_IP_SPACE_EXHAUSTED`, `GCP_KMS_KEY_PERMISSION_DENIED`, `GCP_NOT_FOUND`, `GCP_QUOTA_EXCEEDED`, `GCP_RESOURCE_QUOTA_EXCEEDED`, `GCP_SERVICE_ACCOUNT_ACCESS_DENIED`, `GCP_SERVICE_ACCOUNT_DELETED`, `GCP_SERVICE_ACCOUNT_NOT_FOUND`, `GCP_SUBNET_NOT_READY`, `GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED`, `GKE_BASED_CLUSTER_TERMINATION`, `GLOBAL_INIT_SCRIPT_FAILURE`, `HIVE_METASTORE_PROVISIONING_FAILURE`, `IMAGE_PULL_PERMISSION_DENIED`, `INACTIVITY`, `INIT_CONTAINER_NOT_FINISHED`, `INIT_SCRIPT_FAILURE`, `INSTANCE_POOL_CLUSTER_FAILURE`, `INSTANCE_POOL_MAX_CAPACITY_REACHED`, `INSTANCE_POOL_NOT_FOUND`, `INSTANCE_UNREACHABLE`, `INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG`, `INTERNAL_CAPACITY_FAILURE`, `INTERNAL_ERROR`, `INVALID_ARGUMENT`, `INVALID_AWS_PARAMETER`, `INVALID_INSTANCE_PLACEMENT_PROTOCOL`, `INVALID_SPARK_IMAGE`, `INVALID_WORKER_IMAGE_FAILURE`, `IN_PENALTY_BOX`, `IP_EXHAUSTION_FAILURE`, `JOB_FINISHED`, `K8S_ACTIVE_POD_QUOTA_EXCEEDED`, `K8S_AUTOSCALING_FAILURE`, `K8S_DBR_CLUSTER_LAUNCH_TIMEOUT`, `LAZY_ALLOCATION_TIMEOUT`, `MAINTENANCE_MODE`, `METASTORE_COMPONENT_UNHEALTHY`, `NEPHOS_RESOURCE_MANAGEMENT`, `NETVISOR_SETUP_TIMEOUT`, `NETWORK_CHECK_CONTROL_PLANE_FAILURE`, `NETWORK_CHECK_CONTROL_PLANE_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CHECK_DNS_SERVER_FAILURE`, `NETWORK_CHECK_DNS_SERVER_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE`, `NETWORK_CHECK_METADATA_ENDPOINT_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE`, `NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CHECK_NIC_FAILURE`, `NETWORK_CHECK_NIC_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CHECK_STORAGE_FAILURE`, `NETWORK_CHECK_STORAGE_FAILURE_DUE_TO_MISCONFIG`, `NETWORK_CONFIGURATION_FAILURE`, `NFS_MOUNT_FAILURE`, `NO_ACTIVATED_K8S`, `NO_ACTIVATED_K8S_TESTING_TAG`, `NO_MATCHED_K8S`, `NO_MATCHED_K8S_TESTING_TAG`, `NPIP_TUNNEL_SETUP_FAILURE`, `NPIP_TUNNEL_TOKEN_FAILURE`, `POD_ASSIGNMENT_FAILURE`, `POD_SCHEDULING_FAILURE`, `REQUEST_REJECTED`, `REQUEST_THROTTLED`, `RESOURCE_USAGE_BLOCKED`, `SECRET_CREATION_FAILURE`, `SECRET_PERMISSION_DENIED`, `SECRET_RESOLUTION_ERROR`, `SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION`, `SECURITY_DAEMON_REGISTRATION_EXCEPTION`, `SELF_BOOTSTRAP_FAILURE`, `SERVERLESS_LONG_RUNNING_TERMINATED`, `SKIPPED_SLOW_NODES`, `SLOW_IMAGE_DOWNLOAD`, `SPARK_ERROR`, `SPARK_IMAGE_DOWNLOAD_FAILURE`, `SPARK_IMAGE_DOWNLOAD_THROTTLED`, `SPARK_IMAGE_NOT_FOUND`, `SPARK_STARTUP_FAILURE`, `SPOT_INSTANCE_TERMINATION`, `SSH_BOOTSTRAP_FAILURE`, `STORAGE_DOWNLOAD_FAILURE`, `STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG`, `STORAGE_DOWNLOAD_FAILURE_SLOW`, `STORAGE_DOWNLOAD_FAILURE_THROTTLED`, `STS_CLIENT_SETUP_FAILURE`, `SUBNET_EXHAUSTED_FAILURE`, `TEMPORARILY_UNAVAILABLE`, `TRIAL_EXPIRED`, `UNEXPECTED_LAUNCH_FAILURE`, `UNEXPECTED_POD_RECREATION`, `UNKNOWN`, `UNSUPPORTED_INSTANCE_TYPE`, `UPDATE_INSTANCE_PROFILE_FAILURE`, `USAGE_POLICY_ENTITLEMENT_DENIED`, `USER_INITIATED_VM_TERMINATION`, `USER_REQUEST`, `WORKER_SETUP_FAILURE`, `WORKSPACE_CANCELLED_ERROR`, `WORKSPACE_CONFIGURATION_ERROR`, `WORKSPACE_UPDATE`: *f = TerminationReasonCode(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "ABUSE_DETECTED", "ACCESS_TOKEN_FAILURE", "ALLOCATION_TIMEOUT", "ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY", "ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS", "ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_READY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS", "ATTACH_PROJECT_FAILURE", "AWS_AUTHORIZATION_FAILURE", "AWS_INACCESSIBLE_KMS_KEY_FAILURE", "AWS_INSTANCE_PROFILE_UPDATE_FAILURE", "AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE", "AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE", "AWS_INVALID_KEY_PAIR", "AWS_INVALID_KMS_KEY_STATE", "AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE", "AWS_REQUEST_LIMIT_EXCEEDED", "AWS_RESOURCE_QUOTA_EXCEEDED", "AWS_UNSUPPORTED_FAILURE", "AZURE_BYOK_KEY_PERMISSION_FAILURE", "AZURE_EPHEMERAL_DISK_FAILURE", "AZURE_INVALID_DEPLOYMENT_TEMPLATE", "AZURE_OPERATION_NOT_ALLOWED_EXCEPTION", "AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE", "AZURE_QUOTA_EXCEEDED_EXCEPTION", "AZURE_RESOURCE_MANAGER_THROTTLING", "AZURE_RESOURCE_PROVIDER_THROTTLING", "AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE", "AZURE_VM_EXTENSION_FAILURE", "AZURE_VNET_CONFIGURATION_FAILURE", "BOOTSTRAP_TIMEOUT", "BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION", "BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG", "BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED", "BUDGET_POLICY_RESOLUTION_FAILURE", "CLOUD_ACCOUNT_POD_QUOTA_EXCEEDED", "CLOUD_ACCOUNT_SETUP_FAILURE", "CLOUD_OPERATION_CANCELLED", "CLOUD_PROVIDER_DISK_SETUP_FAILURE", "CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED", "CLOUD_PROVIDER_LAUNCH_FAILURE", "CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_RESOURCE_STOCKOUT", "CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_SHUTDOWN", "CLUSTER_OPERATION_THROTTLED", "CLUSTER_OPERATION_TIMEOUT", "COMMUNICATION_LOST", "CONTAINER_LAUNCH_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG", "DATABASE_CONNECTION_FAILURE", "DATA_ACCESS_CONFIG_CHANGED", "DBFS_COMPONENT_UNHEALTHY", "DISASTER_RECOVERY_REPLICATION", "DNS_RESOLUTION_ERROR", "DOCKER_CONTAINER_CREATION_EXCEPTION", "DOCKER_IMAGE_PULL_FAILURE", "DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION", "DOCKER_INVALID_OS_EXCEPTION", "DRIVER_DNS_RESOLUTION_FAILURE", "DRIVER_EVICTION", "DRIVER_LAUNCH_TIMEOUT", "DRIVER_NODE_UNREACHABLE", "DRIVER_OUT_OF_DISK", "DRIVER_OUT_OF_MEMORY", "DRIVER_POD_CREATION_FAILURE", "DRIVER_UNEXPECTED_FAILURE", "DRIVER_UNHEALTHY", "DRIVER_UNREACHABLE", "DRIVER_UNRESPONSIVE", "DYNAMIC_SPARK_CONF_SIZE_EXCEEDED", "EOS_SPARK_IMAGE", "EXECUTION_COMPONENT_UNHEALTHY", "EXECUTOR_POD_UNSCHEDULED", "GCP_API_RATE_QUOTA_EXCEEDED", "GCP_DENIED_BY_ORG_POLICY", "GCP_FORBIDDEN", "GCP_IAM_TIMEOUT", "GCP_INACCESSIBLE_KMS_KEY_FAILURE", "GCP_INSUFFICIENT_CAPACITY", "GCP_IP_SPACE_EXHAUSTED", "GCP_KMS_KEY_PERMISSION_DENIED", "GCP_NOT_FOUND", "GCP_QUOTA_EXCEEDED", "GCP_RESOURCE_QUOTA_EXCEEDED", "GCP_SERVICE_ACCOUNT_ACCESS_DENIED", "GCP_SERVICE_ACCOUNT_DELETED", "GCP_SERVICE_ACCOUNT_NOT_FOUND", "GCP_SUBNET_NOT_READY", "GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED", "GKE_BASED_CLUSTER_TERMINATION", "GLOBAL_INIT_SCRIPT_FAILURE", "HIVE_METASTORE_PROVISIONING_FAILURE", "IMAGE_PULL_PERMISSION_DENIED", "INACTIVITY", "INIT_CONTAINER_NOT_FINISHED", "INIT_SCRIPT_FAILURE", "INSTANCE_POOL_CLUSTER_FAILURE", "INSTANCE_POOL_MAX_CAPACITY_REACHED", "INSTANCE_POOL_NOT_FOUND", "INSTANCE_UNREACHABLE", "INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG", "INTERNAL_CAPACITY_FAILURE", "INTERNAL_ERROR", "INVALID_ARGUMENT", "INVALID_AWS_PARAMETER", "INVALID_INSTANCE_PLACEMENT_PROTOCOL", "INVALID_SPARK_IMAGE", "INVALID_WORKER_IMAGE_FAILURE", "IN_PENALTY_BOX", "IP_EXHAUSTION_FAILURE", "JOB_FINISHED", "K8S_ACTIVE_POD_QUOTA_EXCEEDED", "K8S_AUTOSCALING_FAILURE", "K8S_DBR_CLUSTER_LAUNCH_TIMEOUT", "LAZY_ALLOCATION_TIMEOUT", "MAINTENANCE_MODE", "METASTORE_COMPONENT_UNHEALTHY", "NEPHOS_RESOURCE_MANAGEMENT", "NETVISOR_SETUP_TIMEOUT", "NETWORK_CHECK_CONTROL_PLANE_FAILURE", "NETWORK_CHECK_DNS_SERVER_FAILURE", "NETWORK_CHECK_METADATA_ENDPOINT_FAILURE", "NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE", "NETWORK_CHECK_NIC_FAILURE", "NETWORK_CHECK_STORAGE_FAILURE", "NETWORK_CONFIGURATION_FAILURE", "NFS_MOUNT_FAILURE", "NO_ACTIVATED_K8S", "NO_ACTIVATED_K8S_TESTING_TAG", "NO_MATCHED_K8S", "NO_MATCHED_K8S_TESTING_TAG", "NPIP_TUNNEL_SETUP_FAILURE", "NPIP_TUNNEL_TOKEN_FAILURE", "POD_ASSIGNMENT_FAILURE", "POD_SCHEDULING_FAILURE", "REQUEST_REJECTED", "REQUEST_THROTTLED", "RESOURCE_USAGE_BLOCKED", "SECRET_CREATION_FAILURE", "SECRET_PERMISSION_DENIED", "SECRET_RESOLUTION_ERROR", "SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION", "SECURITY_DAEMON_REGISTRATION_EXCEPTION", "SELF_BOOTSTRAP_FAILURE", "SERVERLESS_LONG_RUNNING_TERMINATED", "SKIPPED_SLOW_NODES", "SLOW_IMAGE_DOWNLOAD", "SPARK_ERROR", "SPARK_IMAGE_DOWNLOAD_FAILURE", "SPARK_IMAGE_DOWNLOAD_THROTTLED", "SPARK_IMAGE_NOT_FOUND", "SPARK_STARTUP_FAILURE", "SPOT_INSTANCE_TERMINATION", "SSH_BOOTSTRAP_FAILURE", "STORAGE_DOWNLOAD_FAILURE", "STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG", "STORAGE_DOWNLOAD_FAILURE_SLOW", "STORAGE_DOWNLOAD_FAILURE_THROTTLED", "STS_CLIENT_SETUP_FAILURE", "SUBNET_EXHAUSTED_FAILURE", "TEMPORARILY_UNAVAILABLE", "TRIAL_EXPIRED", "UNEXPECTED_LAUNCH_FAILURE", "UNEXPECTED_POD_RECREATION", "UNKNOWN", "UNSUPPORTED_INSTANCE_TYPE", "UPDATE_INSTANCE_PROFILE_FAILURE", "USAGE_POLICY_ENTITLEMENT_DENIED", "USER_INITIATED_VM_TERMINATION", "USER_REQUEST", "WORKER_SETUP_FAILURE", "WORKSPACE_CANCELLED_ERROR", "WORKSPACE_CONFIGURATION_ERROR", "WORKSPACE_UPDATE"`, v) + return fmt.Errorf(`value "%s" is not one of "ABUSE_DETECTED", "ACCESS_TOKEN_FAILURE", "ALLOCATION_TIMEOUT", "ALLOCATION_TIMEOUT_NODE_DAEMON_NOT_READY", "ALLOCATION_TIMEOUT_NO_HEALTHY_AND_WARMED_UP_CLUSTERS", "ALLOCATION_TIMEOUT_NO_HEALTHY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_MATCHED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_READY_CLUSTERS", "ALLOCATION_TIMEOUT_NO_UNALLOCATED_CLUSTERS", "ALLOCATION_TIMEOUT_NO_WARMED_UP_CLUSTERS", "ATTACH_PROJECT_FAILURE", "AWS_AUTHORIZATION_FAILURE", "AWS_INACCESSIBLE_KMS_KEY_FAILURE", "AWS_INSTANCE_PROFILE_UPDATE_FAILURE", "AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE", "AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE", "AWS_INVALID_KEY_PAIR", "AWS_INVALID_KMS_KEY_STATE", "AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED_FAILURE", "AWS_REQUEST_LIMIT_EXCEEDED", "AWS_RESOURCE_QUOTA_EXCEEDED", "AWS_UNSUPPORTED_FAILURE", "AZURE_BYOK_KEY_PERMISSION_FAILURE", "AZURE_EPHEMERAL_DISK_FAILURE", "AZURE_INVALID_DEPLOYMENT_TEMPLATE", "AZURE_OPERATION_NOT_ALLOWED_EXCEPTION", "AZURE_PACKED_DEPLOYMENT_PARTIAL_FAILURE", "AZURE_QUOTA_EXCEEDED_EXCEPTION", "AZURE_RESOURCE_MANAGER_THROTTLING", "AZURE_RESOURCE_PROVIDER_THROTTLING", "AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE", "AZURE_VM_EXTENSION_FAILURE", "AZURE_VNET_CONFIGURATION_FAILURE", "BOOTSTRAP_TIMEOUT", "BOOTSTRAP_TIMEOUT_CLOUD_PROVIDER_EXCEPTION", "BOOTSTRAP_TIMEOUT_DUE_TO_MISCONFIG", "BUDGET_POLICY_LIMIT_ENFORCEMENT_ACTIVATED", "BUDGET_POLICY_RESOLUTION_FAILURE", "CLOUD_ACCOUNT_POD_QUOTA_EXCEEDED", "CLOUD_ACCOUNT_SETUP_FAILURE", "CLOUD_OPERATION_CANCELLED", "CLOUD_PROVIDER_DISK_SETUP_FAILURE", "CLOUD_PROVIDER_INSTANCE_NOT_LAUNCHED", "CLOUD_PROVIDER_LAUNCH_FAILURE", "CLOUD_PROVIDER_LAUNCH_FAILURE_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_RESOURCE_STOCKOUT", "CLOUD_PROVIDER_RESOURCE_STOCKOUT_DUE_TO_MISCONFIG", "CLOUD_PROVIDER_SHUTDOWN", "CLUSTER_OPERATION_THROTTLED", "CLUSTER_OPERATION_TIMEOUT", "COMMUNICATION_LOST", "CONTAINER_LAUNCH_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE", "CONTROL_PLANE_REQUEST_FAILURE_DUE_TO_MISCONFIG", "DATABASE_CONNECTION_FAILURE", "DATA_ACCESS_CONFIG_CHANGED", "DBFS_COMPONENT_UNHEALTHY", "DISASTER_RECOVERY_REPLICATION", "DNS_RESOLUTION_ERROR", "DOCKER_CONTAINER_CREATION_EXCEPTION", "DOCKER_IMAGE_PULL_FAILURE", "DOCKER_IMAGE_TOO_LARGE_FOR_INSTANCE_EXCEPTION", "DOCKER_INVALID_OS_EXCEPTION", "DRIVER_DNS_RESOLUTION_FAILURE", "DRIVER_EVICTION", "DRIVER_LAUNCH_TIMEOUT", "DRIVER_NODE_UNREACHABLE", "DRIVER_OUT_OF_DISK", "DRIVER_OUT_OF_MEMORY", "DRIVER_POD_CREATION_FAILURE", "DRIVER_UNEXPECTED_FAILURE", "DRIVER_UNHEALTHY", "DRIVER_UNREACHABLE", "DRIVER_UNRESPONSIVE", "DYNAMIC_SPARK_CONF_SIZE_EXCEEDED", "EOS_SPARK_IMAGE", "EXECUTION_COMPONENT_UNHEALTHY", "EXECUTOR_POD_UNSCHEDULED", "GCP_API_RATE_QUOTA_EXCEEDED", "GCP_DENIED_BY_ORG_POLICY", "GCP_FORBIDDEN", "GCP_IAM_TIMEOUT", "GCP_INACCESSIBLE_KMS_KEY_FAILURE", "GCP_INSUFFICIENT_CAPACITY", "GCP_IP_SPACE_EXHAUSTED", "GCP_KMS_KEY_PERMISSION_DENIED", "GCP_NOT_FOUND", "GCP_QUOTA_EXCEEDED", "GCP_RESOURCE_QUOTA_EXCEEDED", "GCP_SERVICE_ACCOUNT_ACCESS_DENIED", "GCP_SERVICE_ACCOUNT_DELETED", "GCP_SERVICE_ACCOUNT_NOT_FOUND", "GCP_SUBNET_NOT_READY", "GCP_TRUSTED_IMAGE_PROJECTS_VIOLATED", "GKE_BASED_CLUSTER_TERMINATION", "GLOBAL_INIT_SCRIPT_FAILURE", "HIVE_METASTORE_PROVISIONING_FAILURE", "IMAGE_PULL_PERMISSION_DENIED", "INACTIVITY", "INIT_CONTAINER_NOT_FINISHED", "INIT_SCRIPT_FAILURE", "INSTANCE_POOL_CLUSTER_FAILURE", "INSTANCE_POOL_MAX_CAPACITY_REACHED", "INSTANCE_POOL_NOT_FOUND", "INSTANCE_UNREACHABLE", "INSTANCE_UNREACHABLE_DUE_TO_MISCONFIG", "INTERNAL_CAPACITY_FAILURE", "INTERNAL_ERROR", "INVALID_ARGUMENT", "INVALID_AWS_PARAMETER", "INVALID_INSTANCE_PLACEMENT_PROTOCOL", "INVALID_SPARK_IMAGE", "INVALID_WORKER_IMAGE_FAILURE", "IN_PENALTY_BOX", "IP_EXHAUSTION_FAILURE", "JOB_FINISHED", "K8S_ACTIVE_POD_QUOTA_EXCEEDED", "K8S_AUTOSCALING_FAILURE", "K8S_DBR_CLUSTER_LAUNCH_TIMEOUT", "LAZY_ALLOCATION_TIMEOUT", "MAINTENANCE_MODE", "METASTORE_COMPONENT_UNHEALTHY", "NEPHOS_RESOURCE_MANAGEMENT", "NETVISOR_SETUP_TIMEOUT", "NETWORK_CHECK_CONTROL_PLANE_FAILURE", "NETWORK_CHECK_CONTROL_PLANE_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CHECK_DNS_SERVER_FAILURE", "NETWORK_CHECK_DNS_SERVER_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CHECK_METADATA_ENDPOINT_FAILURE", "NETWORK_CHECK_METADATA_ENDPOINT_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE", "NETWORK_CHECK_MULTIPLE_COMPONENTS_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CHECK_NIC_FAILURE", "NETWORK_CHECK_NIC_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CHECK_STORAGE_FAILURE", "NETWORK_CHECK_STORAGE_FAILURE_DUE_TO_MISCONFIG", "NETWORK_CONFIGURATION_FAILURE", "NFS_MOUNT_FAILURE", "NO_ACTIVATED_K8S", "NO_ACTIVATED_K8S_TESTING_TAG", "NO_MATCHED_K8S", "NO_MATCHED_K8S_TESTING_TAG", "NPIP_TUNNEL_SETUP_FAILURE", "NPIP_TUNNEL_TOKEN_FAILURE", "POD_ASSIGNMENT_FAILURE", "POD_SCHEDULING_FAILURE", "REQUEST_REJECTED", "REQUEST_THROTTLED", "RESOURCE_USAGE_BLOCKED", "SECRET_CREATION_FAILURE", "SECRET_PERMISSION_DENIED", "SECRET_RESOLUTION_ERROR", "SECURITY_AGENTS_FAILED_INITIAL_VERIFICATION", "SECURITY_DAEMON_REGISTRATION_EXCEPTION", "SELF_BOOTSTRAP_FAILURE", "SERVERLESS_LONG_RUNNING_TERMINATED", "SKIPPED_SLOW_NODES", "SLOW_IMAGE_DOWNLOAD", "SPARK_ERROR", "SPARK_IMAGE_DOWNLOAD_FAILURE", "SPARK_IMAGE_DOWNLOAD_THROTTLED", "SPARK_IMAGE_NOT_FOUND", "SPARK_STARTUP_FAILURE", "SPOT_INSTANCE_TERMINATION", "SSH_BOOTSTRAP_FAILURE", "STORAGE_DOWNLOAD_FAILURE", "STORAGE_DOWNLOAD_FAILURE_DUE_TO_MISCONFIG", "STORAGE_DOWNLOAD_FAILURE_SLOW", "STORAGE_DOWNLOAD_FAILURE_THROTTLED", "STS_CLIENT_SETUP_FAILURE", "SUBNET_EXHAUSTED_FAILURE", "TEMPORARILY_UNAVAILABLE", "TRIAL_EXPIRED", "UNEXPECTED_LAUNCH_FAILURE", "UNEXPECTED_POD_RECREATION", "UNKNOWN", "UNSUPPORTED_INSTANCE_TYPE", "UPDATE_INSTANCE_PROFILE_FAILURE", "USAGE_POLICY_ENTITLEMENT_DENIED", "USER_INITIATED_VM_TERMINATION", "USER_REQUEST", "WORKER_SETUP_FAILURE", "WORKSPACE_CANCELLED_ERROR", "WORKSPACE_CONFIGURATION_ERROR", "WORKSPACE_UPDATE"`, v) } } @@ -5588,11 +5601,17 @@ func (f *TerminationReasonCode) Values() []TerminationReasonCode { TerminationReasonCodeNephosResourceManagement, TerminationReasonCodeNetvisorSetupTimeout, TerminationReasonCodeNetworkCheckControlPlaneFailure, + TerminationReasonCodeNetworkCheckControlPlaneFailureDueToMisconfig, TerminationReasonCodeNetworkCheckDnsServerFailure, + TerminationReasonCodeNetworkCheckDnsServerFailureDueToMisconfig, TerminationReasonCodeNetworkCheckMetadataEndpointFailure, + TerminationReasonCodeNetworkCheckMetadataEndpointFailureDueToMisconfig, TerminationReasonCodeNetworkCheckMultipleComponentsFailure, + TerminationReasonCodeNetworkCheckMultipleComponentsFailureDueToMisconfig, TerminationReasonCodeNetworkCheckNicFailure, + TerminationReasonCodeNetworkCheckNicFailureDueToMisconfig, TerminationReasonCodeNetworkCheckStorageFailure, + TerminationReasonCodeNetworkCheckStorageFailureDueToMisconfig, TerminationReasonCodeNetworkConfigurationFailure, TerminationReasonCodeNfsMountFailure, TerminationReasonCodeNoActivatedK8s, diff --git a/service/tags/api.go b/service/tags/api.go index a26dbb150..780395e66 100755 --- a/service/tags/api.go +++ b/service/tags/api.go @@ -1,10 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// The Tag Policy API allows you to manage policies for governed tags in -// Databricks. Permissions for tag policies can be managed using the [Account -// Access Control Proxy API]. -// -// [Account Access Control Proxy API]: https://docs.databricks.com/api/workspace/accountaccesscontrolproxy +// These APIs allow you to manage Tag Assignments, Tag Policies, etc. package tags import ( @@ -14,6 +10,44 @@ import ( "github.com/databricks/databricks-sdk-go/listing" ) +type TagAssignmentsInterface interface { + + // Create a tag assignment + CreateTagAssignment(ctx context.Context, request CreateTagAssignmentRequest) (*TagAssignment, error) + + // Delete a tag assignment + DeleteTagAssignment(ctx context.Context, request DeleteTagAssignmentRequest) error + + // Get a tag assignment + GetTagAssignment(ctx context.Context, request GetTagAssignmentRequest) (*TagAssignment, error) + + // List the tag assignments for an entity + // + // This method is generated by Databricks SDK Code Generator. + ListTagAssignments(ctx context.Context, request ListTagAssignmentsRequest) listing.Iterator[TagAssignment] + + // List the tag assignments for an entity + // + // This method is generated by Databricks SDK Code Generator. + ListTagAssignmentsAll(ctx context.Context, request ListTagAssignmentsRequest) ([]TagAssignment, error) + + // Update a tag assignment + UpdateTagAssignment(ctx context.Context, request UpdateTagAssignmentRequest) (*TagAssignment, error) +} + +func NewTagAssignments(client *client.DatabricksClient) *TagAssignmentsAPI { + return &TagAssignmentsAPI{ + tagAssignmentsImpl: tagAssignmentsImpl{ + client: client, + }, + } +} + +// Manage tag assignments on workspace-scoped objects. +type TagAssignmentsAPI struct { + tagAssignmentsImpl +} + type TagPoliciesInterface interface { // Creates a new tag policy, making the associated tag key governed. diff --git a/service/tags/impl.go b/service/tags/impl.go index bd69be12a..be5774d83 100755 --- a/service/tags/impl.go +++ b/service/tags/impl.go @@ -12,6 +12,97 @@ import ( "github.com/databricks/databricks-sdk-go/useragent" ) +// unexported type that holds implementations of just TagAssignments API methods +type tagAssignmentsImpl struct { + client *client.DatabricksClient +} + +func (a *tagAssignmentsImpl) CreateTagAssignment(ctx context.Context, request CreateTagAssignmentRequest) (*TagAssignment, error) { + var tagAssignment TagAssignment + path := "/api/2.0/entity-tag-assignments" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.TagAssignment, &tagAssignment) + return &tagAssignment, err +} + +func (a *tagAssignmentsImpl) DeleteTagAssignment(ctx context.Context, request DeleteTagAssignmentRequest) error { + path := fmt.Sprintf("/api/2.0/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityId, request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *tagAssignmentsImpl) GetTagAssignment(ctx context.Context, request GetTagAssignmentRequest) (*TagAssignment, error) { + var tagAssignment TagAssignment + path := fmt.Sprintf("/api/2.0/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityId, request.TagKey) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &tagAssignment) + return &tagAssignment, err +} + +// List the tag assignments for an entity +func (a *tagAssignmentsImpl) ListTagAssignments(ctx context.Context, request ListTagAssignmentsRequest) listing.Iterator[TagAssignment] { + + getNextPage := func(ctx context.Context, req ListTagAssignmentsRequest) (*ListTagAssignmentsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListTagAssignments(ctx, req) + } + getItems := func(resp *ListTagAssignmentsResponse) []TagAssignment { + return resp.TagAssignments + } + getNextReq := func(resp *ListTagAssignmentsResponse) *ListTagAssignmentsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List the tag assignments for an entity +func (a *tagAssignmentsImpl) ListTagAssignmentsAll(ctx context.Context, request ListTagAssignmentsRequest) ([]TagAssignment, error) { + iterator := a.ListTagAssignments(ctx, request) + return listing.ToSlice[TagAssignment](ctx, iterator) +} + +func (a *tagAssignmentsImpl) internalListTagAssignments(ctx context.Context, request ListTagAssignmentsRequest) (*ListTagAssignmentsResponse, error) { + var listTagAssignmentsResponse ListTagAssignmentsResponse + path := fmt.Sprintf("/api/2.0/entity-tag-assignments/%v/%v/tags", request.EntityType, request.EntityId) + 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, &listTagAssignmentsResponse) + return &listTagAssignmentsResponse, err +} + +func (a *tagAssignmentsImpl) UpdateTagAssignment(ctx context.Context, request UpdateTagAssignmentRequest) (*TagAssignment, error) { + var tagAssignment TagAssignment + path := fmt.Sprintf("/api/2.0/entity-tag-assignments/%v/%v/tags/%v", request.EntityType, request.EntityId, request.TagKey) + queryParams := make(map[string]any) + + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.TagAssignment, &tagAssignment) + return &tagAssignment, err +} + // unexported type that holds implementations of just TagPolicies API methods type tagPoliciesImpl struct { client *client.DatabricksClient diff --git a/service/tags/interface.go b/service/tags/interface.go index eb6576c20..6fea50aa2 100755 --- a/service/tags/interface.go +++ b/service/tags/interface.go @@ -6,6 +6,27 @@ import ( "context" ) +// Manage tag assignments on workspace-scoped objects. +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type TagAssignmentsService interface { + + // Create a tag assignment + CreateTagAssignment(ctx context.Context, request CreateTagAssignmentRequest) (*TagAssignment, error) + + // Delete a tag assignment + DeleteTagAssignment(ctx context.Context, request DeleteTagAssignmentRequest) error + + // Get a tag assignment + GetTagAssignment(ctx context.Context, request GetTagAssignmentRequest) (*TagAssignment, error) + + // List the tag assignments for an entity + ListTagAssignments(ctx context.Context, request ListTagAssignmentsRequest) (*ListTagAssignmentsResponse, error) + + // Update a tag assignment + UpdateTagAssignment(ctx context.Context, request UpdateTagAssignmentRequest) (*TagAssignment, error) +} + // The Tag Policy API allows you to manage policies for governed tags in // Databricks. Permissions for tag policies can be managed using the [Account // Access Control Proxy API]. diff --git a/service/tags/model.go b/service/tags/model.go index 85566339c..9050fcc90 100755 --- a/service/tags/model.go +++ b/service/tags/model.go @@ -6,18 +6,84 @@ import ( "github.com/databricks/databricks-sdk-go/marshal" ) +type CreateTagAssignmentRequest struct { + TagAssignment TagAssignment `json:"tag_assignment"` +} + type CreateTagPolicyRequest struct { TagPolicy TagPolicy `json:"tag_policy"` } +type DeleteTagAssignmentRequest struct { + // The identifier of the entity to which the tag is assigned + EntityId string `json:"-" url:"-"` + // The type of entity to which the tag is assigned. Allowed value is + // dashboards + EntityType string `json:"-" url:"-"` + // The key of the tag. The characters , . : / - = and leading/trailing + // spaces are not allowed + TagKey string `json:"-" url:"-"` +} + type DeleteTagPolicyRequest struct { TagKey string `json:"-" url:"-"` } +type GetTagAssignmentRequest struct { + // The identifier of the entity to which the tag is assigned + EntityId string `json:"-" url:"-"` + // The type of entity to which the tag is assigned. Allowed value is + // dashboards + EntityType string `json:"-" url:"-"` + // The key of the tag. The characters , . : / - = and leading/trailing + // spaces are not allowed + TagKey string `json:"-" url:"-"` +} + type GetTagPolicyRequest struct { TagKey string `json:"-" url:"-"` } +type ListTagAssignmentsRequest struct { + // The identifier of the entity to which the tag is assigned + EntityId string `json:"-" url:"-"` + // The type of entity to which the tag is assigned. Allowed value is + // dashboards + EntityType string `json:"-" url:"-"` + // Optional. Maximum number of tag assignments to return in a single page + PageSize int `json:"-" url:"page_size,omitempty"` + // Pagination token to go to the next page of tag assignments. Requests + // first page if absent. + PageToken string `json:"-" url:"page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListTagAssignmentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListTagAssignmentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type ListTagAssignmentsResponse struct { + // Pagination token to request the next page of tag assignments + NextPageToken string `json:"next_page_token,omitempty"` + + TagAssignments []TagAssignment `json:"tag_assignments,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListTagAssignmentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListTagAssignmentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListTagPoliciesRequest struct { // The maximum number of results to return in this request. Fewer results // may be returned than requested. If unspecified or set to 0, this defaults @@ -54,6 +120,29 @@ func (s ListTagPoliciesResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type TagAssignment struct { + // The identifier of the entity to which the tag is assigned + EntityId string `json:"entity_id"` + // The type of entity to which the tag is assigned. Allowed value is + // dashboards + EntityType string `json:"entity_type"` + // The key of the tag. The characters , . : / - = and leading/trailing + // spaces are not allowed + TagKey string `json:"tag_key"` + // The value of the tag + TagValue string `json:"tag_value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *TagAssignment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s TagAssignment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type TagPolicy struct { // Timestamp when the tag policy was created CreateTime string `json:"create_time,omitempty"` @@ -79,6 +168,31 @@ func (s TagPolicy) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateTagAssignmentRequest struct { + // The identifier of the entity to which the tag is assigned + EntityId string `json:"-" url:"-"` + // The type of entity to which the tag is assigned. Allowed value is + // dashboards + EntityType string `json:"-" url:"-"` + + TagAssignment TagAssignment `json:"tag_assignment"` + // The key of the tag. The characters , . : / - = and leading/trailing + // spaces are not allowed + TagKey string `json:"-" url:"-"` + // The field mask must be a single string, with multiple fields separated by + // commas (no spaces). The field path is relative to the resource object, + // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). + // Specification of elements in sequence or map fields is not allowed, as + // only the entire collection field can be specified. Field names must + // exactly match the resource field names. + // + // A field mask of `*` indicates full replacement. It’s recommended to + // always explicitly list the fields being updated and avoid using `*` + // wildcards, as it can lead to unintended results if the API changes in the + // future. + UpdateMask string `json:"-" url:"update_mask"` +} + type UpdateTagPolicyRequest struct { TagKey string `json:"-" url:"-"` diff --git a/service/vectorsearch/api.go b/service/vectorsearch/api.go index 505de8214..f1817941b 100755 --- a/service/vectorsearch/api.go +++ b/service/vectorsearch/api.go @@ -235,6 +235,9 @@ type VectorSearchIndexesInterface interface { // Triggers a synchronization process for a specified vector index. SyncIndex(ctx context.Context, request SyncIndexRequest) error + // Update the budget policy of an index + UpdateIndexBudgetPolicy(ctx context.Context, request UpdateVectorIndexUsagePolicyRequest) (*UpdateVectorIndexUsagePolicyResponse, error) + // Handles the upserting of data into a specified vector index. UpsertDataVectorIndex(ctx context.Context, request UpsertDataVectorIndexRequest) (*UpsertDataVectorIndexResponse, error) } diff --git a/service/vectorsearch/impl.go b/service/vectorsearch/impl.go index dfbc05884..a3f36325a 100755 --- a/service/vectorsearch/impl.go +++ b/service/vectorsearch/impl.go @@ -238,6 +238,16 @@ func (a *vectorSearchIndexesImpl) SyncIndex(ctx context.Context, request SyncInd return err } +func (a *vectorSearchIndexesImpl) UpdateIndexBudgetPolicy(ctx context.Context, request UpdateVectorIndexUsagePolicyRequest) (*UpdateVectorIndexUsagePolicyResponse, error) { + var updateVectorIndexUsagePolicyResponse UpdateVectorIndexUsagePolicyResponse + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/usage-policy", request.IndexName) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, nil, &updateVectorIndexUsagePolicyResponse) + return &updateVectorIndexUsagePolicyResponse, err +} + func (a *vectorSearchIndexesImpl) UpsertDataVectorIndex(ctx context.Context, request UpsertDataVectorIndexRequest) (*UpsertDataVectorIndexResponse, error) { var upsertDataVectorIndexResponse UpsertDataVectorIndexResponse path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/upsert-data", request.IndexName) diff --git a/service/vectorsearch/interface.go b/service/vectorsearch/interface.go index a5d4569da..7595219fa 100755 --- a/service/vectorsearch/interface.go +++ b/service/vectorsearch/interface.go @@ -73,6 +73,9 @@ type VectorSearchIndexesService interface { // Triggers a synchronization process for a specified vector index. SyncIndex(ctx context.Context, request SyncIndexRequest) error + // Update the budget policy of an index + UpdateIndexBudgetPolicy(ctx context.Context, request UpdateVectorIndexUsagePolicyRequest) (*UpdateVectorIndexUsagePolicyResponse, error) + // Handles the upserting of data into a specified vector index. UpsertDataVectorIndex(ctx context.Context, request UpsertDataVectorIndexRequest) (*UpsertDataVectorIndexResponse, error) } diff --git a/service/vectorsearch/model.go b/service/vectorsearch/model.go index 2e8076edd..ca9a4861a 100755 --- a/service/vectorsearch/model.go +++ b/service/vectorsearch/model.go @@ -30,6 +30,8 @@ type CreateEndpoint struct { EndpointType EndpointType `json:"endpoint_type"` // Name of the vector search endpoint Name string `json:"name"` + // The usage policy id to be applied once we've migrated to usage policies + UsagePolicyId string `json:"usage_policy_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -164,6 +166,10 @@ type DeltaSyncVectorIndexSpecRequest struct { // index. The primary key column and embedding source column or embedding // vector column are always synced. ColumnsToSync []string `json:"columns_to_sync,omitempty"` + // The budget policy id applied to the vector search index + EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The columns that contain the embedding source. EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` // The columns that contain the embedding vectors. @@ -194,6 +200,10 @@ func (s DeltaSyncVectorIndexSpecRequest) MarshalJSON() ([]byte, error) { } type DeltaSyncVectorIndexSpecResponse struct { + // The budget policy id applied to the vector search index + EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The columns that contain the embedding source. EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` // The columns that contain the embedding vectors. @@ -838,6 +848,14 @@ func (s UpdateEndpointCustomTagsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateVectorIndexUsagePolicyRequest struct { + // Name of the vector search index + IndexName string `json:"-" url:"-"` +} + +type UpdateVectorIndexUsagePolicyResponse struct { +} + type UpsertDataResult struct { // List of primary keys for rows that failed to process. FailedPrimaryKeys []string `json:"failed_primary_keys,omitempty"` diff --git a/service/workspace/model.go b/service/workspace/model.go index e31212d0a..503605878 100755 --- a/service/workspace/model.go +++ b/service/workspace/model.go @@ -357,6 +357,43 @@ func (f *ExportFormat) Type() string { return "ExportFormat" } +type ExportOutputs string + +const ExportOutputsAll ExportOutputs = `ALL` + +const ExportOutputsNone ExportOutputs = `NONE` + +// String representation for [fmt.Print] +func (f *ExportOutputs) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ExportOutputs) Set(v string) error { + switch v { + case `ALL`, `NONE`: + *f = ExportOutputs(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ALL", "NONE"`, v) + } +} + +// Values returns all possible values for ExportOutputs. +// +// There is no guarantee on the order of the values in the slice. +func (f *ExportOutputs) Values() []ExportOutputs { + return []ExportOutputs{ + ExportOutputsAll, + ExportOutputsNone, + } +} + +// Type always returns ExportOutputs to satisfy [pflag.Value] interface +func (f *ExportOutputs) Type() string { + return "ExportOutputs" +} + type ExportRequest struct { // This specifies the format of the exported file. By default, this is // `SOURCE`. @@ -373,6 +410,12 @@ type ExportRequest struct { // on the objects type. Directory exports will include notebooks and // workspace files. Format ExportFormat `json:"-" url:"format,omitempty"` + // This specifies which cell outputs should be included in the export (if + // the export format allows it). If not specified, the behavior is + // determined by the format. For JUPYTER format, the default is to include + // all outputs. This is a public endpoint, but only ALL or NONE is + // documented publically, DATABRICKS is internal only + Outputs ExportOutputs `json:"-" url:"outputs,omitempty"` // The absolute path of the object or directory. Exporting a directory is // only supported for the `DBC`, `SOURCE`, and `AUTO` format. Path string `json:"-" url:"path"` diff --git a/workspace_client.go b/workspace_client.go index 7564f9a6e..df6525dda 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -271,6 +271,10 @@ type WorkspaceClient struct { // SQL. Database database.DatabaseInterface + // Database Projects provide access to a database via REST API or direct + // SQL. + DatabaseProject database.DatabaseProjectInterface + // DBFS API makes it simple to interact with various data sources without // having to include a users credentials every time to read a file. Dbfs files.DbfsInterface @@ -764,6 +768,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 @@ -1150,6 +1157,9 @@ type WorkspaceClient struct { // is a particular kind of table (rather than a managed or external table). Tables catalog.TablesInterface + // Manage tag assignments on workspace-scoped objects. + TagAssignments tags.TagAssignmentsInterface + // The Tag Policy API allows you to manage policies for governed tags in // Databricks. Permissions for tag policies can be managed using the // [Account Access Control Proxy API]. @@ -1408,6 +1418,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { DataQuality: dataquality.NewDataQuality(databricksClient), DataSources: sql.NewDataSources(databricksClient), Database: database.NewDatabase(databricksClient), + DatabaseProject: database.NewDatabaseProject(databricksClient), Dbfs: files.NewDbfs(databricksClient), DbsqlPermissions: sql.NewDbsqlPermissions(databricksClient), EntityTagAssignments: catalog.NewEntityTagAssignments(databricksClient), @@ -1457,6 +1468,7 @@ 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), @@ -1481,6 +1493,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { SystemSchemas: catalog.NewSystemSchemas(databricksClient), TableConstraints: catalog.NewTableConstraints(databricksClient), Tables: catalog.NewTables(databricksClient), + TagAssignments: tags.NewTagAssignments(databricksClient), TagPolicies: tags.NewTagPolicies(databricksClient), TemporaryPathCredentials: catalog.NewTemporaryPathCredentials(databricksClient), TemporaryTableCredentials: catalog.NewTemporaryTableCredentials(databricksClient),