diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 4367e53bc..82cc21f8f 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -6c7149172e35bcee9935503a1ec3f1a8fdffa686 \ No newline at end of file +universe:/home/parth.bansal/vn0/universe \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index b232fc9ec..3f53f15f5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -189,9 +189,6 @@ experimental/mocks/service/workspace/mock_workspace_interface.go linguist-genera internal/generatedtests/http_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/common/api.go linguist-generated=true -internal/testspecs/service/common/impl.go linguist-generated=true -internal/testspecs/service/common/model.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 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/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/lro_call_test.go b/internal/generatedtests/lro_call_test.go index dfa757db9..1d5e0d9ea 100755 --- a/internal/generatedtests/lro_call_test.go +++ b/internal/generatedtests/lro_call_test.go @@ -8,7 +8,6 @@ import ( "time" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/internal/testspecs/service/common" "github.com/databricks/databricks-sdk-go/internal/testspecs/service/lrotesting" "github.com/databricks/databricks-sdk-go/qa" "github.com/databricks/databricks-sdk-go/service/common/lro" @@ -29,7 +28,7 @@ func TestLRO_CreateTestResource_Wait(t *testing.T) { fixtures: qa.HTTPFixtures{{ Method: "POST", Resource: "/api/2.0/lro-testing/resources", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: false, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", @@ -37,7 +36,7 @@ func TestLRO_CreateTestResource_Wait(t *testing.T) { }, { Method: "GET", Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345?", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: false, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 75\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", @@ -45,7 +44,7 @@ func TestLRO_CreateTestResource_Wait(t *testing.T) { }, { Method: "GET", Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345?", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: true, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 100\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", @@ -64,7 +63,7 @@ func TestLRO_CreateTestResource_Wait(t *testing.T) { fixtures: qa.HTTPFixtures{{ Method: "POST", Resource: "/api/2.0/lro-testing/resources", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: false, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", @@ -72,10 +71,10 @@ func TestLRO_CreateTestResource_Wait(t *testing.T) { }, { Method: "GET", Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345?", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: true, - Error: &common.DatabricksServiceExceptionWithDetailsProto{ - ErrorCode: common.ErrorCodeInternalError, + Error: &lrotesting.DatabricksServiceExceptionWithDetailsProto{ + ErrorCode: lrotesting.ErrorCodeInternalError, Message: "Test error message", }, Name: "operations/test-resource-create-12345", @@ -122,7 +121,7 @@ func TestLRO_CancelTestResource_Cancel(t *testing.T) { fixtures: qa.HTTPFixtures{{ Method: "POST", Resource: "/api/2.0/lro-testing/resources", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: false, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", @@ -130,7 +129,7 @@ func TestLRO_CancelTestResource_Cancel(t *testing.T) { }, { Method: "POST", Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345/cancel", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: true, Name: "operations/test-resource-create-12345", }, @@ -171,7 +170,7 @@ func TestLRO_CreateTestResource_Name(t *testing.T) { fixtures: qa.HTTPFixtures{{ Method: "POST", Resource: "/api/2.0/lro-testing/resources", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: false, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", @@ -211,7 +210,7 @@ func TestLRO_CreateTestResource_Metadata(t *testing.T) { fixtures: qa.HTTPFixtures{{ Method: "POST", Resource: "/api/2.0/lro-testing/resources", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: false, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", @@ -261,7 +260,7 @@ func TestLRO_CreateTestResource_Done(t *testing.T) { fixtures: qa.HTTPFixtures{{ Method: "POST", Resource: "/api/2.0/lro-testing/resources", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: false, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", @@ -269,7 +268,7 @@ func TestLRO_CreateTestResource_Done(t *testing.T) { }, { Method: "GET", Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345?", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: true, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 100\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", @@ -285,7 +284,7 @@ func TestLRO_CreateTestResource_Done(t *testing.T) { fixtures: qa.HTTPFixtures{{ Method: "POST", Resource: "/api/2.0/lro-testing/resources", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: false, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 5\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", @@ -293,7 +292,7 @@ func TestLRO_CreateTestResource_Done(t *testing.T) { }, { Method: "GET", Resource: "/api/2.0/lro-testing/operations/operations/test-resource-create-12345?", - Response: common.Operation{ + Response: lrotesting.Operation{ Done: false, Metadata: json.RawMessage("{\n\t\t\t\t\t\"resource_id\": \"test-resource-123\",\n\t\t\t\t\t\"progress_percent\": 75\n\t\t\t\t}"), Name: "operations/test-resource-create-12345", diff --git a/internal/testspecs/service/lrotesting/api.go b/internal/testspecs/service/lrotesting/api.go index c2bf712a0..4b6fb3839 100755 --- a/internal/testspecs/service/lrotesting/api.go +++ b/internal/testspecs/service/lrotesting/api.go @@ -10,7 +10,6 @@ import ( "time" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/internal/testspecs/service/common" "github.com/databricks/databricks-sdk-go/retries" "github.com/databricks/databricks-sdk-go/service/common/lro" "github.com/databricks/databricks-sdk-go/useragent" @@ -21,7 +20,7 @@ type LroTestingInterface interface { CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (*CreateTestResourceOperation, error) - GetOperation(ctx context.Context, request GetOperationRequest) (*common.Operation, error) + GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error) // Simple method to get test resource GetTestResource(ctx context.Context, request GetTestResourceRequest) (*TestResource, error) @@ -53,7 +52,7 @@ func (a *LroTestingAPI) CreateTestResource(ctx context.Context, request CreateTe type CreateTestResourceOperation struct { impl *lroTestingImpl - operation *common.Operation + operation *Operation } // Wait blocks until the long-running operation is completed with default 20 min diff --git a/internal/testspecs/service/lrotesting/impl.go b/internal/testspecs/service/lrotesting/impl.go index c975fa3b6..28ca322d2 100755 --- a/internal/testspecs/service/lrotesting/impl.go +++ b/internal/testspecs/service/lrotesting/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/internal/testspecs/service/common" ) // unexported type that holds implementations of just LroTesting API methods @@ -25,8 +24,8 @@ func (a *lroTestingImpl) CancelOperation(ctx context.Context, request CancelOper return err } -func (a *lroTestingImpl) CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (*common.Operation, error) { - var operation common.Operation +func (a *lroTestingImpl) CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (*Operation, error) { + var operation Operation path := "/api/2.0/lro-testing/resources" queryParams := make(map[string]any) headers := make(map[string]string) @@ -36,8 +35,8 @@ func (a *lroTestingImpl) CreateTestResource(ctx context.Context, request CreateT return &operation, err } -func (a *lroTestingImpl) GetOperation(ctx context.Context, request GetOperationRequest) (*common.Operation, error) { - var operation common.Operation +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) queryParams := make(map[string]any) headers := make(map[string]string) diff --git a/internal/testspecs/service/lrotesting/model.go b/internal/testspecs/service/lrotesting/model.go index f111e7c3c..2f8fdba19 100755 --- a/internal/testspecs/service/lrotesting/model.go +++ b/internal/testspecs/service/lrotesting/model.go @@ -3,6 +3,9 @@ package lrotesting import ( + "encoding/json" + "fmt" + "github.com/databricks/databricks-sdk-go/marshal" ) @@ -16,6 +19,311 @@ type CreateTestResourceRequest struct { Resource TestResource `json:"resource"` } +// Serialization format for DatabricksServiceException with error details. This +// message doesn't work for ScalaPB-04 as google.protobuf.Any is only available +// to ScalaPB-09. Note the definition of this message should be in sync with +// DatabricksServiceExceptionProto defined in +// /api-base/proto/legacy/databricks.proto except the later one doesn't have the +// error details field defined. +type DatabricksServiceExceptionWithDetailsProto struct { + // @pbjson-skip + Details []json.RawMessage `json:"details,omitempty"` + + ErrorCode ErrorCode `json:"error_code,omitempty"` + + Message string `json:"message,omitempty"` + + StackTrace string `json:"stack_trace,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DatabricksServiceExceptionWithDetailsProto) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DatabricksServiceExceptionWithDetailsProto) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// 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 +// 0.4 cleanup. +type ErrorCode string + +const ErrorCodeAborted ErrorCode = `ABORTED` + +const ErrorCodeAlreadyExists ErrorCode = `ALREADY_EXISTS` + +const ErrorCodeBadRequest ErrorCode = `BAD_REQUEST` + +const ErrorCodeCancelled ErrorCode = `CANCELLED` + +const ErrorCodeCatalogAlreadyExists ErrorCode = `CATALOG_ALREADY_EXISTS` + +const ErrorCodeCatalogDoesNotExist ErrorCode = `CATALOG_DOES_NOT_EXIST` + +const ErrorCodeCatalogNotEmpty ErrorCode = `CATALOG_NOT_EMPTY` + +const ErrorCodeCouldNotAcquireLock ErrorCode = `COULD_NOT_ACQUIRE_LOCK` + +const ErrorCodeCustomerUnauthorized ErrorCode = `CUSTOMER_UNAUTHORIZED` + +const ErrorCodeDacAlreadyExists ErrorCode = `DAC_ALREADY_EXISTS` + +const ErrorCodeDacDoesNotExist ErrorCode = `DAC_DOES_NOT_EXIST` + +const ErrorCodeDataLoss ErrorCode = `DATA_LOSS` + +const ErrorCodeDeadlineExceeded ErrorCode = `DEADLINE_EXCEEDED` + +const ErrorCodeDeploymentTimeout ErrorCode = `DEPLOYMENT_TIMEOUT` + +const ErrorCodeDirectoryNotEmpty ErrorCode = `DIRECTORY_NOT_EMPTY` + +const ErrorCodeDirectoryProtected ErrorCode = `DIRECTORY_PROTECTED` + +const ErrorCodeDryRunFailed ErrorCode = `DRY_RUN_FAILED` + +const ErrorCodeEndpointNotFound ErrorCode = `ENDPOINT_NOT_FOUND` + +const ErrorCodeExternalLocationAlreadyExists ErrorCode = `EXTERNAL_LOCATION_ALREADY_EXISTS` + +const ErrorCodeExternalLocationDoesNotExist ErrorCode = `EXTERNAL_LOCATION_DOES_NOT_EXIST` + +const ErrorCodeFeatureDisabled ErrorCode = `FEATURE_DISABLED` + +const ErrorCodeGitConflict ErrorCode = `GIT_CONFLICT` + +const ErrorCodeGitRemoteError ErrorCode = `GIT_REMOTE_ERROR` + +const ErrorCodeGitSensitiveTokenDetected ErrorCode = `GIT_SENSITIVE_TOKEN_DETECTED` + +const ErrorCodeGitUnknownRef ErrorCode = `GIT_UNKNOWN_REF` + +const ErrorCodeGitUrlNotOnAllowList ErrorCode = `GIT_URL_NOT_ON_ALLOW_LIST` + +const ErrorCodeInsecurePartnerResponse ErrorCode = `INSECURE_PARTNER_RESPONSE` + +const ErrorCodeInternalError ErrorCode = `INTERNAL_ERROR` + +const ErrorCodeInvalidParameterValue ErrorCode = `INVALID_PARAMETER_VALUE` + +const ErrorCodeInvalidState ErrorCode = `INVALID_STATE` + +const ErrorCodeInvalidStateTransition ErrorCode = `INVALID_STATE_TRANSITION` + +const ErrorCodeIoError ErrorCode = `IO_ERROR` + +const ErrorCodeIpynbFileInRepo ErrorCode = `IPYNB_FILE_IN_REPO` + +const ErrorCodeMalformedPartnerResponse ErrorCode = `MALFORMED_PARTNER_RESPONSE` + +const ErrorCodeMalformedRequest ErrorCode = `MALFORMED_REQUEST` + +const ErrorCodeManagedResourceGroupDoesNotExist ErrorCode = `MANAGED_RESOURCE_GROUP_DOES_NOT_EXIST` + +const ErrorCodeMaxBlockSizeExceeded ErrorCode = `MAX_BLOCK_SIZE_EXCEEDED` + +const ErrorCodeMaxChildNodeSizeExceeded ErrorCode = `MAX_CHILD_NODE_SIZE_EXCEEDED` + +const ErrorCodeMaxListSizeExceeded ErrorCode = `MAX_LIST_SIZE_EXCEEDED` + +const ErrorCodeMaxNotebookSizeExceeded ErrorCode = `MAX_NOTEBOOK_SIZE_EXCEEDED` + +const ErrorCodeMaxReadSizeExceeded ErrorCode = `MAX_READ_SIZE_EXCEEDED` + +const ErrorCodeMetastoreAlreadyExists ErrorCode = `METASTORE_ALREADY_EXISTS` + +const ErrorCodeMetastoreDoesNotExist ErrorCode = `METASTORE_DOES_NOT_EXIST` + +const ErrorCodeMetastoreNotEmpty ErrorCode = `METASTORE_NOT_EMPTY` + +const ErrorCodeNotFound ErrorCode = `NOT_FOUND` + +const ErrorCodeNotImplemented ErrorCode = `NOT_IMPLEMENTED` + +const ErrorCodePartialDelete ErrorCode = `PARTIAL_DELETE` + +const ErrorCodePermissionDenied ErrorCode = `PERMISSION_DENIED` + +const ErrorCodePermissionNotPropagated ErrorCode = `PERMISSION_NOT_PROPAGATED` + +const ErrorCodePrincipalDoesNotExist ErrorCode = `PRINCIPAL_DOES_NOT_EXIST` + +const ErrorCodeProjectsOperationTimeout ErrorCode = `PROJECTS_OPERATION_TIMEOUT` + +const ErrorCodeProviderAlreadyExists ErrorCode = `PROVIDER_ALREADY_EXISTS` + +const ErrorCodeProviderDoesNotExist ErrorCode = `PROVIDER_DOES_NOT_EXIST` + +const ErrorCodeProviderShareNotAccessible ErrorCode = `PROVIDER_SHARE_NOT_ACCESSIBLE` + +const ErrorCodeQuotaExceeded ErrorCode = `QUOTA_EXCEEDED` + +const ErrorCodeRecipientAlreadyExists ErrorCode = `RECIPIENT_ALREADY_EXISTS` + +const ErrorCodeRecipientDoesNotExist ErrorCode = `RECIPIENT_DOES_NOT_EXIST` + +const ErrorCodeRequestLimitExceeded ErrorCode = `REQUEST_LIMIT_EXCEEDED` + +const ErrorCodeResourceAlreadyExists ErrorCode = `RESOURCE_ALREADY_EXISTS` + +const ErrorCodeResourceConflict ErrorCode = `RESOURCE_CONFLICT` + +const ErrorCodeResourceDoesNotExist ErrorCode = `RESOURCE_DOES_NOT_EXIST` + +const ErrorCodeResourceExhausted ErrorCode = `RESOURCE_EXHAUSTED` + +const ErrorCodeResourceLimitExceeded ErrorCode = `RESOURCE_LIMIT_EXCEEDED` + +const ErrorCodeSchemaAlreadyExists ErrorCode = `SCHEMA_ALREADY_EXISTS` + +const ErrorCodeSchemaDoesNotExist ErrorCode = `SCHEMA_DOES_NOT_EXIST` + +const ErrorCodeSchemaNotEmpty ErrorCode = `SCHEMA_NOT_EMPTY` + +const ErrorCodeSearchQueryTooLong ErrorCode = `SEARCH_QUERY_TOO_LONG` + +const ErrorCodeSearchQueryTooShort ErrorCode = `SEARCH_QUERY_TOO_SHORT` + +const ErrorCodeServiceUnderMaintenance ErrorCode = `SERVICE_UNDER_MAINTENANCE` + +const ErrorCodeShareAlreadyExists ErrorCode = `SHARE_ALREADY_EXISTS` + +const ErrorCodeShareDoesNotExist ErrorCode = `SHARE_DOES_NOT_EXIST` + +const ErrorCodeStorageCredentialAlreadyExists ErrorCode = `STORAGE_CREDENTIAL_ALREADY_EXISTS` + +const ErrorCodeStorageCredentialDoesNotExist ErrorCode = `STORAGE_CREDENTIAL_DOES_NOT_EXIST` + +const ErrorCodeTableAlreadyExists ErrorCode = `TABLE_ALREADY_EXISTS` + +const ErrorCodeTableDoesNotExist ErrorCode = `TABLE_DOES_NOT_EXIST` + +const ErrorCodeTemporarilyUnavailable ErrorCode = `TEMPORARILY_UNAVAILABLE` + +const ErrorCodeUnauthenticated ErrorCode = `UNAUTHENTICATED` + +const ErrorCodeUnavailable ErrorCode = `UNAVAILABLE` + +const ErrorCodeUnknown ErrorCode = `UNKNOWN` + +const ErrorCodeUnparseableHttpError ErrorCode = `UNPARSEABLE_HTTP_ERROR` + +const ErrorCodeWorkspaceTemporarilyUnavailable ErrorCode = `WORKSPACE_TEMPORARILY_UNAVAILABLE` + +// String representation for [fmt.Print] +func (f *ErrorCode) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ErrorCode) Set(v string) error { + switch v { + case `ABORTED`, `ALREADY_EXISTS`, `BAD_REQUEST`, `CANCELLED`, `CATALOG_ALREADY_EXISTS`, `CATALOG_DOES_NOT_EXIST`, `CATALOG_NOT_EMPTY`, `COULD_NOT_ACQUIRE_LOCK`, `CUSTOMER_UNAUTHORIZED`, `DAC_ALREADY_EXISTS`, `DAC_DOES_NOT_EXIST`, `DATA_LOSS`, `DEADLINE_EXCEEDED`, `DEPLOYMENT_TIMEOUT`, `DIRECTORY_NOT_EMPTY`, `DIRECTORY_PROTECTED`, `DRY_RUN_FAILED`, `ENDPOINT_NOT_FOUND`, `EXTERNAL_LOCATION_ALREADY_EXISTS`, `EXTERNAL_LOCATION_DOES_NOT_EXIST`, `FEATURE_DISABLED`, `GIT_CONFLICT`, `GIT_REMOTE_ERROR`, `GIT_SENSITIVE_TOKEN_DETECTED`, `GIT_UNKNOWN_REF`, `GIT_URL_NOT_ON_ALLOW_LIST`, `INSECURE_PARTNER_RESPONSE`, `INTERNAL_ERROR`, `INVALID_PARAMETER_VALUE`, `INVALID_STATE`, `INVALID_STATE_TRANSITION`, `IO_ERROR`, `IPYNB_FILE_IN_REPO`, `MALFORMED_PARTNER_RESPONSE`, `MALFORMED_REQUEST`, `MANAGED_RESOURCE_GROUP_DOES_NOT_EXIST`, `MAX_BLOCK_SIZE_EXCEEDED`, `MAX_CHILD_NODE_SIZE_EXCEEDED`, `MAX_LIST_SIZE_EXCEEDED`, `MAX_NOTEBOOK_SIZE_EXCEEDED`, `MAX_READ_SIZE_EXCEEDED`, `METASTORE_ALREADY_EXISTS`, `METASTORE_DOES_NOT_EXIST`, `METASTORE_NOT_EMPTY`, `NOT_FOUND`, `NOT_IMPLEMENTED`, `PARTIAL_DELETE`, `PERMISSION_DENIED`, `PERMISSION_NOT_PROPAGATED`, `PRINCIPAL_DOES_NOT_EXIST`, `PROJECTS_OPERATION_TIMEOUT`, `PROVIDER_ALREADY_EXISTS`, `PROVIDER_DOES_NOT_EXIST`, `PROVIDER_SHARE_NOT_ACCESSIBLE`, `QUOTA_EXCEEDED`, `RECIPIENT_ALREADY_EXISTS`, `RECIPIENT_DOES_NOT_EXIST`, `REQUEST_LIMIT_EXCEEDED`, `RESOURCE_ALREADY_EXISTS`, `RESOURCE_CONFLICT`, `RESOURCE_DOES_NOT_EXIST`, `RESOURCE_EXHAUSTED`, `RESOURCE_LIMIT_EXCEEDED`, `SCHEMA_ALREADY_EXISTS`, `SCHEMA_DOES_NOT_EXIST`, `SCHEMA_NOT_EMPTY`, `SEARCH_QUERY_TOO_LONG`, `SEARCH_QUERY_TOO_SHORT`, `SERVICE_UNDER_MAINTENANCE`, `SHARE_ALREADY_EXISTS`, `SHARE_DOES_NOT_EXIST`, `STORAGE_CREDENTIAL_ALREADY_EXISTS`, `STORAGE_CREDENTIAL_DOES_NOT_EXIST`, `TABLE_ALREADY_EXISTS`, `TABLE_DOES_NOT_EXIST`, `TEMPORARILY_UNAVAILABLE`, `UNAUTHENTICATED`, `UNAVAILABLE`, `UNKNOWN`, `UNPARSEABLE_HTTP_ERROR`, `WORKSPACE_TEMPORARILY_UNAVAILABLE`: + *f = ErrorCode(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ABORTED", "ALREADY_EXISTS", "BAD_REQUEST", "CANCELLED", "CATALOG_ALREADY_EXISTS", "CATALOG_DOES_NOT_EXIST", "CATALOG_NOT_EMPTY", "COULD_NOT_ACQUIRE_LOCK", "CUSTOMER_UNAUTHORIZED", "DAC_ALREADY_EXISTS", "DAC_DOES_NOT_EXIST", "DATA_LOSS", "DEADLINE_EXCEEDED", "DEPLOYMENT_TIMEOUT", "DIRECTORY_NOT_EMPTY", "DIRECTORY_PROTECTED", "DRY_RUN_FAILED", "ENDPOINT_NOT_FOUND", "EXTERNAL_LOCATION_ALREADY_EXISTS", "EXTERNAL_LOCATION_DOES_NOT_EXIST", "FEATURE_DISABLED", "GIT_CONFLICT", "GIT_REMOTE_ERROR", "GIT_SENSITIVE_TOKEN_DETECTED", "GIT_UNKNOWN_REF", "GIT_URL_NOT_ON_ALLOW_LIST", "INSECURE_PARTNER_RESPONSE", "INTERNAL_ERROR", "INVALID_PARAMETER_VALUE", "INVALID_STATE", "INVALID_STATE_TRANSITION", "IO_ERROR", "IPYNB_FILE_IN_REPO", "MALFORMED_PARTNER_RESPONSE", "MALFORMED_REQUEST", "MANAGED_RESOURCE_GROUP_DOES_NOT_EXIST", "MAX_BLOCK_SIZE_EXCEEDED", "MAX_CHILD_NODE_SIZE_EXCEEDED", "MAX_LIST_SIZE_EXCEEDED", "MAX_NOTEBOOK_SIZE_EXCEEDED", "MAX_READ_SIZE_EXCEEDED", "METASTORE_ALREADY_EXISTS", "METASTORE_DOES_NOT_EXIST", "METASTORE_NOT_EMPTY", "NOT_FOUND", "NOT_IMPLEMENTED", "PARTIAL_DELETE", "PERMISSION_DENIED", "PERMISSION_NOT_PROPAGATED", "PRINCIPAL_DOES_NOT_EXIST", "PROJECTS_OPERATION_TIMEOUT", "PROVIDER_ALREADY_EXISTS", "PROVIDER_DOES_NOT_EXIST", "PROVIDER_SHARE_NOT_ACCESSIBLE", "QUOTA_EXCEEDED", "RECIPIENT_ALREADY_EXISTS", "RECIPIENT_DOES_NOT_EXIST", "REQUEST_LIMIT_EXCEEDED", "RESOURCE_ALREADY_EXISTS", "RESOURCE_CONFLICT", "RESOURCE_DOES_NOT_EXIST", "RESOURCE_EXHAUSTED", "RESOURCE_LIMIT_EXCEEDED", "SCHEMA_ALREADY_EXISTS", "SCHEMA_DOES_NOT_EXIST", "SCHEMA_NOT_EMPTY", "SEARCH_QUERY_TOO_LONG", "SEARCH_QUERY_TOO_SHORT", "SERVICE_UNDER_MAINTENANCE", "SHARE_ALREADY_EXISTS", "SHARE_DOES_NOT_EXIST", "STORAGE_CREDENTIAL_ALREADY_EXISTS", "STORAGE_CREDENTIAL_DOES_NOT_EXIST", "TABLE_ALREADY_EXISTS", "TABLE_DOES_NOT_EXIST", "TEMPORARILY_UNAVAILABLE", "UNAUTHENTICATED", "UNAVAILABLE", "UNKNOWN", "UNPARSEABLE_HTTP_ERROR", "WORKSPACE_TEMPORARILY_UNAVAILABLE"`, v) + } +} + +// Values returns all possible values for ErrorCode. +// +// There is no guarantee on the order of the values in the slice. +func (f *ErrorCode) Values() []ErrorCode { + return []ErrorCode{ + ErrorCodeAborted, + ErrorCodeAlreadyExists, + ErrorCodeBadRequest, + ErrorCodeCancelled, + ErrorCodeCatalogAlreadyExists, + ErrorCodeCatalogDoesNotExist, + ErrorCodeCatalogNotEmpty, + ErrorCodeCouldNotAcquireLock, + ErrorCodeCustomerUnauthorized, + ErrorCodeDacAlreadyExists, + ErrorCodeDacDoesNotExist, + ErrorCodeDataLoss, + ErrorCodeDeadlineExceeded, + ErrorCodeDeploymentTimeout, + ErrorCodeDirectoryNotEmpty, + ErrorCodeDirectoryProtected, + ErrorCodeDryRunFailed, + ErrorCodeEndpointNotFound, + ErrorCodeExternalLocationAlreadyExists, + ErrorCodeExternalLocationDoesNotExist, + ErrorCodeFeatureDisabled, + ErrorCodeGitConflict, + ErrorCodeGitRemoteError, + ErrorCodeGitSensitiveTokenDetected, + ErrorCodeGitUnknownRef, + ErrorCodeGitUrlNotOnAllowList, + ErrorCodeInsecurePartnerResponse, + ErrorCodeInternalError, + ErrorCodeInvalidParameterValue, + ErrorCodeInvalidState, + ErrorCodeInvalidStateTransition, + ErrorCodeIoError, + ErrorCodeIpynbFileInRepo, + ErrorCodeMalformedPartnerResponse, + ErrorCodeMalformedRequest, + ErrorCodeManagedResourceGroupDoesNotExist, + ErrorCodeMaxBlockSizeExceeded, + ErrorCodeMaxChildNodeSizeExceeded, + ErrorCodeMaxListSizeExceeded, + ErrorCodeMaxNotebookSizeExceeded, + ErrorCodeMaxReadSizeExceeded, + ErrorCodeMetastoreAlreadyExists, + ErrorCodeMetastoreDoesNotExist, + ErrorCodeMetastoreNotEmpty, + ErrorCodeNotFound, + ErrorCodeNotImplemented, + ErrorCodePartialDelete, + ErrorCodePermissionDenied, + ErrorCodePermissionNotPropagated, + ErrorCodePrincipalDoesNotExist, + ErrorCodeProjectsOperationTimeout, + ErrorCodeProviderAlreadyExists, + ErrorCodeProviderDoesNotExist, + ErrorCodeProviderShareNotAccessible, + ErrorCodeQuotaExceeded, + ErrorCodeRecipientAlreadyExists, + ErrorCodeRecipientDoesNotExist, + ErrorCodeRequestLimitExceeded, + ErrorCodeResourceAlreadyExists, + ErrorCodeResourceConflict, + ErrorCodeResourceDoesNotExist, + ErrorCodeResourceExhausted, + ErrorCodeResourceLimitExceeded, + ErrorCodeSchemaAlreadyExists, + ErrorCodeSchemaDoesNotExist, + ErrorCodeSchemaNotEmpty, + ErrorCodeSearchQueryTooLong, + ErrorCodeSearchQueryTooShort, + ErrorCodeServiceUnderMaintenance, + ErrorCodeShareAlreadyExists, + ErrorCodeShareDoesNotExist, + ErrorCodeStorageCredentialAlreadyExists, + ErrorCodeStorageCredentialDoesNotExist, + ErrorCodeTableAlreadyExists, + ErrorCodeTableDoesNotExist, + ErrorCodeTemporarilyUnavailable, + ErrorCodeUnauthenticated, + ErrorCodeUnavailable, + ErrorCodeUnknown, + ErrorCodeUnparseableHttpError, + ErrorCodeWorkspaceTemporarilyUnavailable, + } +} + +// Type always returns ErrorCode to satisfy [pflag.Value] interface +func (f *ErrorCode) Type() string { + return "ErrorCode" +} + type GetOperationRequest struct { // The name of the operation resource. Name string `json:"-" url:"-"` @@ -26,6 +334,48 @@ type GetTestResourceRequest struct { ResourceId string `json:"-" url:"-"` } +// This resource represents a long-running operation that is the result of a +// network API call. +type Operation struct { + // If the value is `false`, it means the operation is still in progress. If + // `true`, the operation is completed, and either `error` or `response` is + // available. + Done bool `json:"done,omitempty"` + // The error result of the operation in case of failure or cancellation. + Error *DatabricksServiceExceptionWithDetailsProto `json:"error,omitempty"` + // Service-specific metadata associated with the operation. It typically + // contains progress information and common metadata such as create time. + // Some services might not provide such metadata. Any method that returns a + // long-running operation should document the metadata type, if any. + Metadata json.RawMessage `json:"metadata,omitempty"` + // The server-assigned name, which is only unique within the same service + // that originally returns it. If you use the default HTTP mapping, the + // `name` should be a resource name ending with `operations/{unique_id}`. + // + // Note: multi-segment resource names are not yet supported in the RPC + // framework and SDK/TF. Until that support is added, `name` must be string + // without internal `/` separators. + Name string `json:"name,omitempty"` + // The normal, successful response of the operation. If the original method + // returns no data on success, such as `Delete`, the response is + // `google.protobuf.Empty`. If the original method is standard + // `Get`/`Create`/`Update`, the response should be the resource. For other + // methods, the response should have the type `XxxResponse`, where `Xxx` is + // the original method name. For example, if the original method name is + // `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. + Response json.RawMessage `json:"response,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Operation) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Operation) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Test resource for LRO operations type TestResource struct { // Unique identifier for the resource diff --git a/service/apps/model.go b/service/apps/model.go index fa12507a9..9ddc4437c 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:"-"` 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..265a10eaa 100755 --- a/service/billing/impl.go +++ b/service/billing/impl.go @@ -10,6 +10,7 @@ import ( "github.com/databricks/databricks-sdk-go/client" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" + "golang.org/x/exp/slices" ) // unexported type that holds implementations of just BillableUsage API methods @@ -110,9 +111,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 +316,96 @@ 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 + 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/api.go b/service/catalog/api.go index 4f7d941bb..46334bf27 100755 --- a/service/catalog/api.go +++ b/service/catalog/api.go @@ -318,6 +318,15 @@ type CatalogsInterface interface { // retrieved. There is no guarantee of a specific ordering of the elements in // the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListCatalogsRequest) listing.Iterator[CatalogInfo] @@ -327,6 +336,15 @@ type CatalogsInterface interface { // retrieved. There is no guarantee of a specific ordering of the elements in // the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListCatalogsRequest) ([]CatalogInfo, error) @@ -396,11 +414,29 @@ type ConnectionsInterface interface { // List all connections. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListConnectionsRequest) listing.Iterator[ConnectionInfo] // List all connections. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListConnectionsRequest) ([]ConnectionInfo, error) @@ -743,6 +779,15 @@ type ExternalLocationsInterface interface { // location. There is no guarantee of a specific ordering of the elements in the // array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListExternalLocationsRequest) listing.Iterator[ExternalLocationInfo] @@ -752,6 +797,15 @@ type ExternalLocationsInterface interface { // location. There is no guarantee of a specific ordering of the elements in the // array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListExternalLocationsRequest) ([]ExternalLocationInfo, error) @@ -948,6 +1002,15 @@ type FunctionsInterface interface { // is the owner. There is no guarantee of a specific ordering of the elements in // the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListFunctionsRequest) listing.Iterator[FunctionInfo] @@ -959,6 +1022,15 @@ type FunctionsInterface interface { // is the owner. There is no guarantee of a specific ordering of the elements in // the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListFunctionsRequest) ([]FunctionInfo, error) @@ -1146,6 +1218,15 @@ type MetastoresInterface interface { // caller must be an admin to retrieve this info. There is no guarantee of a // specific ordering of the elements in the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListMetastoresRequest) listing.Iterator[MetastoreInfo] @@ -1153,6 +1234,15 @@ type MetastoresInterface interface { // caller must be an admin to retrieve this info. There is no guarantee of a // specific ordering of the elements in the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListMetastoresRequest) ([]MetastoreInfo, error) @@ -2160,6 +2250,15 @@ type SchemasInterface interface { // for which the caller has the **USE_SCHEMA** privilege) will be retrieved. // There is no guarantee of a specific ordering of the elements in the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListSchemasRequest) listing.Iterator[SchemaInfo] @@ -2169,6 +2268,15 @@ type SchemasInterface interface { // for which the caller has the **USE_SCHEMA** privilege) will be retrieved. // There is no guarantee of a specific ordering of the elements in the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListSchemasRequest) ([]SchemaInfo, error) @@ -2246,6 +2354,15 @@ type StorageCredentialsInterface interface { // credentials is unrestricted. There is no guarantee of a specific ordering of // the elements in the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListStorageCredentialsRequest) listing.Iterator[StorageCredentialInfo] @@ -2255,6 +2372,15 @@ type StorageCredentialsInterface interface { // credentials is unrestricted. There is no guarantee of a specific ordering of // the elements in the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListStorageCredentialsRequest) ([]StorageCredentialInfo, error) @@ -2338,17 +2464,44 @@ type SystemSchemasInterface interface { // Gets an array of system schemas for a metastore. The caller must be an // account admin or a metastore admin. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListSystemSchemasRequest) listing.Iterator[SystemSchemaInfo] // Gets an array of system schemas for a metastore. The caller must be an // account admin or a metastore admin. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListSystemSchemasRequest) ([]SystemSchemaInfo, error) // Gets an array of system schemas for a metastore. The caller must be an // account admin or a metastore admin. + // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. ListByMetastoreId(ctx context.Context, metastoreId string) (*ListSystemSchemasResponse, error) } @@ -2378,6 +2531,15 @@ func (a *SystemSchemasAPI) DisableByMetastoreIdAndSchemaName(ctx context.Context // Gets an array of system schemas for a metastore. The caller must be an // account admin or a metastore admin. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *SystemSchemasAPI) ListByMetastoreId(ctx context.Context, metastoreId string) (*ListSystemSchemasResponse, error) { return a.systemSchemasImpl.internalList(ctx, ListSystemSchemasRequest{ MetastoreId: metastoreId, @@ -2548,6 +2710,15 @@ type TablesInterface interface { // catalog and the **USE_SCHEMA** privilege on the parent schema. There is no // guarantee of a specific ordering of the elements in the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListTablesRequest) listing.Iterator[TableInfo] @@ -2558,6 +2729,15 @@ type TablesInterface interface { // catalog and the **USE_SCHEMA** privilege on the parent schema. There is no // guarantee of a specific ordering of the elements in the array. // + // NOTE: we recommend using max_results=0 to use the paginated version of this + // API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients must + // continue reading pages until next_page_token is absent, which is the only + // indication that the end of results has been reached. This behavior follows + // Google AIP-158 guidelines. + // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListTablesRequest) ([]TableInfo, error) diff --git a/service/catalog/impl.go b/service/catalog/impl.go index 461595fdd..ad298d0f2 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -330,6 +330,15 @@ func (a *catalogsImpl) Get(ctx context.Context, request GetCatalogRequest) (*Cat // caller (or for which the caller has the **USE_CATALOG** privilege) will be // retrieved. There is no guarantee of a specific ordering of the elements in // the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *catalogsImpl) List(ctx context.Context, request ListCatalogsRequest) listing.Iterator[CatalogInfo] { getNextPage := func(ctx context.Context, req ListCatalogsRequest) (*ListCatalogsResponse, error) { @@ -359,6 +368,15 @@ func (a *catalogsImpl) List(ctx context.Context, request ListCatalogsRequest) li // caller (or for which the caller has the **USE_CATALOG** privilege) will be // retrieved. There is no guarantee of a specific ordering of the elements in // the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *catalogsImpl) ListAll(ctx context.Context, request ListCatalogsRequest) ([]CatalogInfo, error) { iterator := a.List(ctx, request) return listing.ToSlice[CatalogInfo](ctx, iterator) @@ -421,6 +439,15 @@ func (a *connectionsImpl) Get(ctx context.Context, request GetConnectionRequest) } // List all connections. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *connectionsImpl) List(ctx context.Context, request ListConnectionsRequest) listing.Iterator[ConnectionInfo] { getNextPage := func(ctx context.Context, req ListConnectionsRequest) (*ListConnectionsResponse, error) { @@ -446,6 +473,15 @@ func (a *connectionsImpl) List(ctx context.Context, request ListConnectionsReque } // List all connections. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *connectionsImpl) ListAll(ctx context.Context, request ListConnectionsRequest) ([]ConnectionInfo, error) { iterator := a.List(ctx, request) return listing.ToSlice[ConnectionInfo](ctx, iterator) @@ -805,6 +841,15 @@ func (a *externalLocationsImpl) Get(ctx context.Context, request GetExternalLoca // external location, or a user that has some privilege on the external // location. There is no guarantee of a specific ordering of the elements in the // array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *externalLocationsImpl) List(ctx context.Context, request ListExternalLocationsRequest) listing.Iterator[ExternalLocationInfo] { getNextPage := func(ctx context.Context, req ListExternalLocationsRequest) (*ListExternalLocationsResponse, error) { @@ -834,6 +879,15 @@ func (a *externalLocationsImpl) List(ctx context.Context, request ListExternalLo // external location, or a user that has some privilege on the external // location. There is no guarantee of a specific ordering of the elements in the // array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *externalLocationsImpl) ListAll(ctx context.Context, request ListExternalLocationsRequest) ([]ExternalLocationInfo, error) { iterator := a.List(ctx, request) return listing.ToSlice[ExternalLocationInfo](ctx, iterator) @@ -1000,6 +1054,15 @@ func (a *functionsImpl) Get(ctx context.Context, request GetFunctionRequest) (*F // functions for which either the user has the **EXECUTE** privilege or the user // is the owner. There is no guarantee of a specific ordering of the elements in // the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *functionsImpl) List(ctx context.Context, request ListFunctionsRequest) listing.Iterator[FunctionInfo] { getNextPage := func(ctx context.Context, req ListFunctionsRequest) (*ListFunctionsResponse, error) { @@ -1031,6 +1094,15 @@ func (a *functionsImpl) List(ctx context.Context, request ListFunctionsRequest) // functions for which either the user has the **EXECUTE** privilege or the user // is the owner. There is no guarantee of a specific ordering of the elements in // the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *functionsImpl) ListAll(ctx context.Context, request ListFunctionsRequest) ([]FunctionInfo, error) { iterator := a.List(ctx, request) return listing.ToSlice[FunctionInfo](ctx, iterator) @@ -1151,6 +1223,15 @@ func (a *metastoresImpl) Get(ctx context.Context, request GetMetastoreRequest) ( // Gets an array of the available metastores (as __MetastoreInfo__ objects). The // caller must be an admin to retrieve this info. There is no guarantee of a // specific ordering of the elements in the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *metastoresImpl) List(ctx context.Context, request ListMetastoresRequest) listing.Iterator[MetastoreInfo] { getNextPage := func(ctx context.Context, req ListMetastoresRequest) (*ListMetastoresResponse, error) { @@ -1178,6 +1259,15 @@ func (a *metastoresImpl) List(ctx context.Context, request ListMetastoresRequest // Gets an array of the available metastores (as __MetastoreInfo__ objects). The // caller must be an admin to retrieve this info. There is no guarantee of a // specific ordering of the elements in the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *metastoresImpl) ListAll(ctx context.Context, request ListMetastoresRequest) ([]MetastoreInfo, error) { iterator := a.List(ctx, request) return listing.ToSlice[MetastoreInfo](ctx, iterator) @@ -1836,6 +1926,15 @@ func (a *schemasImpl) Get(ctx context.Context, request GetSchemaRequest) (*Schem // catalog will be retrieved. Otherwise, only schemas owned by the caller (or // for which the caller has the **USE_SCHEMA** privilege) will be retrieved. // There is no guarantee of a specific ordering of the elements in the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *schemasImpl) List(ctx context.Context, request ListSchemasRequest) listing.Iterator[SchemaInfo] { getNextPage := func(ctx context.Context, req ListSchemasRequest) (*ListSchemasResponse, error) { @@ -1865,6 +1964,15 @@ func (a *schemasImpl) List(ctx context.Context, request ListSchemasRequest) list // catalog will be retrieved. Otherwise, only schemas owned by the caller (or // for which the caller has the **USE_SCHEMA** privilege) will be retrieved. // There is no guarantee of a specific ordering of the elements in the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *schemasImpl) ListAll(ctx context.Context, request ListSchemasRequest) ([]SchemaInfo, error) { iterator := a.List(ctx, request) return listing.ToSlice[SchemaInfo](ctx, iterator) @@ -1931,6 +2039,15 @@ func (a *storageCredentialsImpl) Get(ctx context.Context, request GetStorageCred // permission to access. If the caller is a metastore admin, retrieval of // credentials is unrestricted. There is no guarantee of a specific ordering of // the elements in the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *storageCredentialsImpl) List(ctx context.Context, request ListStorageCredentialsRequest) listing.Iterator[StorageCredentialInfo] { getNextPage := func(ctx context.Context, req ListStorageCredentialsRequest) (*ListStorageCredentialsResponse, error) { @@ -1960,6 +2077,15 @@ func (a *storageCredentialsImpl) List(ctx context.Context, request ListStorageCr // permission to access. If the caller is a metastore admin, retrieval of // credentials is unrestricted. There is no guarantee of a specific ordering of // the elements in the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *storageCredentialsImpl) ListAll(ctx context.Context, request ListStorageCredentialsRequest) ([]StorageCredentialInfo, error) { iterator := a.List(ctx, request) return listing.ToSlice[StorageCredentialInfo](ctx, iterator) @@ -2023,6 +2149,15 @@ func (a *systemSchemasImpl) Enable(ctx context.Context, request EnableRequest) e // Gets an array of system schemas for a metastore. The caller must be an // account admin or a metastore admin. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *systemSchemasImpl) List(ctx context.Context, request ListSystemSchemasRequest) listing.Iterator[SystemSchemaInfo] { getNextPage := func(ctx context.Context, req ListSystemSchemasRequest) (*ListSystemSchemasResponse, error) { @@ -2049,6 +2184,15 @@ func (a *systemSchemasImpl) List(ctx context.Context, request ListSystemSchemasR // Gets an array of system schemas for a metastore. The caller must be an // account admin or a metastore admin. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *systemSchemasImpl) ListAll(ctx context.Context, request ListSystemSchemasRequest) ([]SystemSchemaInfo, error) { iterator := a.List(ctx, request) return listing.ToSlice[SystemSchemaInfo](ctx, iterator) @@ -2140,6 +2284,15 @@ func (a *tablesImpl) Get(ctx context.Context, request GetTableRequest) (*TableIn // must also be the owner or have the **USE_CATALOG** privilege on the parent // catalog and the **USE_SCHEMA** privilege on the parent schema. There is no // guarantee of a specific ordering of the elements in the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *tablesImpl) List(ctx context.Context, request ListTablesRequest) listing.Iterator[TableInfo] { getNextPage := func(ctx context.Context, req ListTablesRequest) (*ListTablesResponse, error) { @@ -2170,6 +2323,15 @@ func (a *tablesImpl) List(ctx context.Context, request ListTablesRequest) listin // must also be the owner or have the **USE_CATALOG** privilege on the parent // catalog and the **USE_SCHEMA** privilege on the parent schema. There is no // guarantee of a specific ordering of the elements in the array. +// +// NOTE: we recommend using max_results=0 to use the paginated version of this +// API. Unpaginated calls will be deprecated soon. +// +// PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may +// contain zero results while still providing a next_page_token. Clients must +// continue reading pages until next_page_token is absent, which is the only +// indication that the end of results has been reached. This behavior follows +// Google AIP-158 guidelines. func (a *tablesImpl) ListAll(ctx context.Context, request ListTablesRequest) ([]TableInfo, error) { iterator := a.List(ctx, request) return listing.ToSlice[TableInfo](ctx, iterator) diff --git a/service/catalog/interface.go b/service/catalog/interface.go index 83df5b7a3..6c4d1c28b 100755 --- a/service/catalog/interface.go +++ b/service/catalog/interface.go @@ -137,6 +137,15 @@ type CatalogsService interface { // owned by the caller (or for which the caller has the **USE_CATALOG** // privilege) will be retrieved. There is no guarantee of a specific // ordering of the elements in the array. + // + // NOTE: we recommend using max_results=0 to use the paginated version of + // this API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients + // must continue reading pages until next_page_token is absent, which is the + // only indication that the end of results has been reached. This behavior + // follows Google AIP-158 guidelines. List(ctx context.Context, request ListCatalogsRequest) (*ListCatalogsResponse, error) // Updates the catalog that matches the supplied name. The caller must be @@ -174,6 +183,15 @@ type ConnectionsService interface { Get(ctx context.Context, request GetConnectionRequest) (*ConnectionInfo, error) // List all connections. + // + // NOTE: we recommend using max_results=0 to use the paginated version of + // this API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients + // must continue reading pages until next_page_token is absent, which is the + // only indication that the end of results has been reached. This behavior + // follows Google AIP-158 guidelines. List(ctx context.Context, request ListConnectionsRequest) (*ListConnectionsResponse, error) // Updates the connection that matches the supplied name. @@ -371,6 +389,15 @@ type ExternalLocationsService interface { // the external location, or a user that has some privilege on the external // location. There is no guarantee of a specific ordering of the elements in // the array. + // + // NOTE: we recommend using max_results=0 to use the paginated version of + // this API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients + // must continue reading pages until next_page_token is absent, which is the + // only indication that the end of results has been reached. This behavior + // follows Google AIP-158 guidelines. List(ctx context.Context, request ListExternalLocationsRequest) (*ListExternalLocationsResponse, error) // Updates an external location in the metastore. The caller must be the @@ -466,6 +493,15 @@ type FunctionsService interface { // list contains only functions for which either the user has the // **EXECUTE** privilege or the user is the owner. There is no guarantee of // a specific ordering of the elements in the array. + // + // NOTE: we recommend using max_results=0 to use the paginated version of + // this API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients + // must continue reading pages until next_page_token is absent, which is the + // only indication that the end of results has been reached. This behavior + // follows Google AIP-158 guidelines. List(ctx context.Context, request ListFunctionsRequest) (*ListFunctionsResponse, error) // Updates the function that matches the supplied name. Only the owner of @@ -550,6 +586,15 @@ type MetastoresService interface { // Gets an array of the available metastores (as __MetastoreInfo__ objects). // The caller must be an admin to retrieve this info. There is no guarantee // of a specific ordering of the elements in the array. + // + // NOTE: we recommend using max_results=0 to use the paginated version of + // this API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients + // must continue reading pages until next_page_token is absent, which is the + // only indication that the end of results has been reached. This behavior + // follows Google AIP-158 guidelines. List(ctx context.Context, request ListMetastoresRequest) (*ListMetastoresResponse, error) // Gets information about a metastore. This summary includes the storage @@ -1018,6 +1063,15 @@ type SchemasService interface { // caller (or for which the caller has the **USE_SCHEMA** privilege) will be // retrieved. There is no guarantee of a specific ordering of the elements // in the array. + // + // NOTE: we recommend using max_results=0 to use the paginated version of + // this API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients + // must continue reading pages until next_page_token is absent, which is the + // only indication that the end of results has been reached. This behavior + // follows Google AIP-158 guidelines. List(ctx context.Context, request ListSchemasRequest) (*ListSchemasResponse, error) // Updates a schema for a catalog. The caller must be the owner of the @@ -1065,6 +1119,15 @@ type StorageCredentialsService interface { // caller has permission to access. If the caller is a metastore admin, // retrieval of credentials is unrestricted. There is no guarantee of a // specific ordering of the elements in the array. + // + // NOTE: we recommend using max_results=0 to use the paginated version of + // this API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients + // must continue reading pages until next_page_token is absent, which is the + // only indication that the end of results has been reached. This behavior + // follows Google AIP-158 guidelines. List(ctx context.Context, request ListStorageCredentialsRequest) (*ListStorageCredentialsResponse, error) // Updates a storage credential on the metastore. @@ -1107,6 +1170,15 @@ type SystemSchemasService interface { // Gets an array of system schemas for a metastore. The caller must be an // account admin or a metastore admin. + // + // NOTE: we recommend using max_results=0 to use the paginated version of + // this API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients + // must continue reading pages until next_page_token is absent, which is the + // only indication that the end of results has been reached. This behavior + // follows Google AIP-158 guidelines. List(ctx context.Context, request ListSystemSchemasRequest) (*ListSystemSchemasResponse, error) } @@ -1227,6 +1299,15 @@ type TablesService interface { // the parent catalog and the **USE_SCHEMA** privilege on the parent schema. // There is no guarantee of a specific ordering of the elements in the // array. + // + // NOTE: we recommend using max_results=0 to use the paginated version of + // this API. Unpaginated calls will be deprecated soon. + // + // PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may + // contain zero results while still providing a next_page_token. Clients + // must continue reading pages until next_page_token is absent, which is the + // only indication that the end of results has been reached. This behavior + // follows Google AIP-158 guidelines. List(ctx context.Context, request ListTablesRequest) (*ListTablesResponse, error) // Gets an array of summaries for tables for a schema and catalog within the diff --git a/service/catalog/model.go b/service/catalog/model.go index 2c3e67236..7920eb385 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. @@ -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. @@ -2515,6 +2572,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 +2822,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:"-"` @@ -3816,6 +3931,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 +6278,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 +6692,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"` @@ -7932,6 +8063,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 +8101,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. @@ -8546,9 +8684,12 @@ type UpdateWorkspaceBindings struct { } type UpdateWorkspaceBindingsParameters struct { - // List of workspace bindings. + // List of workspace bindings to add. If a binding for the workspace already + // exists with a different binding_type, adding it again with a new + // binding_type will update the existing binding (e.g., from READ_WRITE to + // READ_ONLY). Add []WorkspaceBinding `json:"add,omitempty"` - // List of workspace bindings. + // List of workspace bindings to remove. Remove []WorkspaceBinding `json:"remove,omitempty"` // The name of the securable. SecurableName string `json:"-" url:"-"` 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..dec3c151d 100755 --- a/service/compute/impl.go +++ b/service/compute/impl.go @@ -869,6 +869,36 @@ 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 + 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 +909,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 +972,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 505ba835c..927da1d38 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"` @@ -5144,9 +5449,17 @@ type Results struct { Cause string `json:"cause,omitempty"` Data any `json:"data,omitempty"` - // The image filename + // The image data in one of the following formats: + // + // 1. A Data URL with base64-encoded image data: + // `data:image/{type};base64,{base64-data}`. Example: + // `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...` + // + // 2. A FileStore file path for large images: `/plots/{filename}.png`. + // Example: `/plots/b6a7ad70-fb2c-4353-8aed-3f1e015174a4.png` FileName string `json:"fileName,omitempty"` - + // List of image data for multiple images. Each element follows the same + // format as file_name. FileNames []string `json:"fileNames,omitempty"` // true if a JSON schema is returned instead of a string representation of // the Hive type. @@ -6213,6 +6526,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..649359453 100755 --- a/service/database/impl.go +++ b/service/database/impl.go @@ -122,6 +122,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" @@ -395,6 +406,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 +435,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/model.go b/service/dataquality/model.go index e9eaf201f..96d584bb3 100755 --- a/service/dataquality/model.go +++ b/service/dataquality/model.go @@ -73,14 +73,70 @@ 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. ObjectId string `json:"-" url:"-"` - // The type of the monitored object. Can be one of the following: schema or - // table. + // The type of the monitored object. Can be one of the following: `schema` + // or `table`. ObjectType string `json:"-" url:"-"` // Unique id of the refresh operation. RefreshId int64 `json:"-" url:"-"` @@ -100,7 +156,8 @@ type CreateMonitorRequest struct { type CreateRefreshRequest struct { // The UUID of the request object. For example, table id. ObjectId string `json:"-" url:"-"` - // The type of the monitored object. Can be one of the following: table. + // The type of the monitored object. Can be one of the following: `schema`or + // `table`. ObjectType string `json:"-" url:"-"` // The refresh to create Refresh Refresh `json:"refresh"` @@ -342,16 +399,16 @@ func (f *DataProfilingStatus) Type() string { type DeleteMonitorRequest struct { // The UUID of the request object. For example, schema id. ObjectId string `json:"-" url:"-"` - // The type of the monitored object. Can be one of the following: schema or - // table. + // The type of the monitored object. Can be one of the following: `schema` + // or `table`. ObjectType string `json:"-" url:"-"` } type DeleteRefreshRequest struct { // The UUID of the request object. For example, schema id. ObjectId string `json:"-" url:"-"` - // The type of the monitored object. Can be one of the following: schema or - // table. + // The type of the monitored object. Can be one of the following: `schema` + // or `table`. ObjectType string `json:"-" url:"-"` // Unique id of the refresh operation. RefreshId int64 `json:"-" url:"-"` @@ -360,16 +417,16 @@ type DeleteRefreshRequest struct { type GetMonitorRequest struct { // The UUID of the request object. For example, schema id. ObjectId string `json:"-" url:"-"` - // The type of the monitored object. Can be one of the following: schema or - // table. + // The type of the monitored object. Can be one of the following: `schema` + // or `table`. ObjectType string `json:"-" url:"-"` } type GetRefreshRequest struct { // The UUID of the request object. For example, schema id. ObjectId string `json:"-" url:"-"` - // The type of the monitored object. Can be one of the following: schema or - // table. + // The type of the monitored object. Can be one of the following: `schema` + // or `table`. ObjectType string `json:"-" url:"-"` // Unique id of the refresh operation. RefreshId int64 `json:"-" url:"-"` @@ -478,8 +535,8 @@ func (s ListMonitorResponse) MarshalJSON() ([]byte, error) { type ListRefreshRequest struct { // The UUID of the request object. For example, schema id. ObjectId string `json:"-" url:"-"` - // The type of the monitored object. Can be one of the following: schema or - // table. + // The type of the monitored object. Can be one of the following: `schema` + // or `table`. ObjectType string `json:"-" url:"-"` PageSize int `json:"-" url:"page_size,omitempty"` @@ -523,8 +580,8 @@ type Monitor struct { DataProfilingConfig *DataProfilingConfig `json:"data_profiling_config,omitempty"` // The UUID of the request object. For example, schema id. ObjectId string `json:"object_id"` - // The type of the monitored object. Can be one of the following: schema or - // table. + // The type of the monitored object. Can be one of the following: `schema` + // or `table`. ObjectType string `json:"object_type"` } @@ -551,7 +608,8 @@ type Refresh struct { Message string `json:"message,omitempty"` // The UUID of the request object. For example, table id. ObjectId string `json:"object_id"` - // The type of the monitored object. Can be one of the following: table. + // The type of the monitored object. Can be one of the following: `schema`or + // `table`. ObjectType string `json:"object_type"` // Unique id of the refresh operation. RefreshId int64 `json:"refresh_id,omitempty"` @@ -685,18 +743,20 @@ type UpdateMonitorRequest struct { Monitor Monitor `json:"monitor"` // The UUID of the request object. For example, schema id. ObjectId string `json:"-" url:"-"` - // The type of the monitored object. Can be one of the following: schema or - // table. + // The type of the monitored object. Can be one of the following: `schema` + // or `table`. ObjectType string `json:"-" url:"-"` - // The field mask to specify which fields to update. + // The field mask to specify which fields to update as a comma-separated + // list. Example value: + // `data_profiling_config.custom_metrics,data_profiling_config.schedule.quartz_cron_expression` UpdateMask string `json:"-" url:"update_mask"` } type UpdateRefreshRequest struct { // The UUID of the request object. For example, schema id. ObjectId string `json:"-" url:"-"` - // The type of the monitored object. Can be one of the following: schema or - // table. + // The type of the monitored object. Can be one of the following: `schema` + // or `table`. ObjectType string `json:"-" url:"-"` // The refresh to update. Refresh Refresh `json:"refresh"` 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 a627fa7ab..4a70c1111 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). @@ -4225,6 +4310,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 +5102,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"` @@ -5178,8 +5269,8 @@ type TableUpdateTriggerConfiguration struct { // 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"` - // A list of Delta tables to monitor for changes. The table name must be in - // the format `catalog_name.schema_name.table_name`. + // A list of tables to monitor for changes. The table name must be in the + // format `catalog_name.schema_name.table_name`. TableNames []string `json:"table_names,omitempty"` // If set, the trigger starts a run only after no table updates have // occurred for the specified time and can be used to wait for a series of @@ -5763,6 +5854,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/ml/api.go b/service/ml/api.go index 77b61c824..bc90b60c0 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) diff --git a/service/ml/impl.go b/service/ml/impl.go index 78690920b..bcbf91b95 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) diff --git a/service/ml/interface.go b/service/ml/interface.go index 2a8499f0e..c4e11d32d 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) diff --git a/service/ml/model.go b/service/ml/model.go index a9b1f0327..aac1cac41 100755 --- a/service/ml/model.go +++ b/service/ml/model.go @@ -1522,6 +1522,16 @@ 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 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 diff --git a/service/oauth2/model.go b/service/oauth2/model.go index 6ff4d56da..15b8f6475 100755 --- a/service/oauth2/model.go +++ b/service/oauth2/model.go @@ -617,8 +617,13 @@ func (s SecretInfo) MarshalJSON() ([]byte, error) { } type TokenAccessPolicy struct { + // absolute OAuth session TTL in minutes when single-use refresh tokens are + // enabled + 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"` + // whether to enable single-use refresh tokens + EnableSingleUseRefreshTokens bool `json:"enable_single_use_refresh_tokens,omitempty"` // refresh token time to live in minutes RefreshTokenTtlInMinutes int `json:"refresh_token_ttl_in_minutes,omitempty"` 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..3a69dfb44 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:"-"` } @@ -319,6 +346,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 +491,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 +595,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 +626,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 +1073,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 +1580,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 +1817,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 +2109,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 +2194,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 +2341,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 96e82b61c..390c51bda 100644 --- 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 22fd88570..3acbbb0d1 100755 --- a/service/provisioning/model.go +++ b/service/provisioning/model.go @@ -266,6 +266,14 @@ type CreateWorkspaceRequest struct { Cloud string `json:"cloud,omitempty"` CloudResourceContainer *CloudResourceContainer `json:"cloud_resource_container,omitempty"` + // If the compute mode is `SERVERLESS`, a serverless workspace is created + // that comes pre-configured with serverless compute and default storage, + // providing a fully-managed, enterprise-ready SaaS experience. This means + // you don't need to provide any resources managed by you, such as + // credentials, storage, or network. If the compute mode is `HYBRID` (which + // is the default option), a classic workspace is created that uses + // customer-managed resources. + ComputeMode CustomerFacingComputeMode `json:"compute_mode,omitempty"` // ID of the workspace's credential configuration object. CredentialsId string `json:"credentials_id,omitempty"` // The custom tags key-value pairing that is attached to this workspace. The @@ -1310,6 +1318,10 @@ type Workspace struct { CustomTags map[string]string `json:"custom_tags,omitempty"` DeploymentName string `json:"deployment_name,omitempty"` + // A client owned field used to indicate the workspace status that the + // client expects to be in. For now this is only used to unblock Temporal + // workflow for GCP least privileged workspace. + ExpectedWorkspaceStatus WorkspaceStatus `json:"expected_workspace_status,omitempty"` GcpManagedNetworkConfig *GcpManagedNetworkConfig `json:"gcp_managed_network_config,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/settings/model.go b/service/settings/model.go index bce586b03..8e169e629 100755 --- a/service/settings/model.go +++ b/service/settings/model.go @@ -442,6 +442,8 @@ const ComplianceStandardFedrampModerate ComplianceStandard = `FEDRAMP_MODERATE` const ComplianceStandardGermanyC5 ComplianceStandard = `GERMANY_C5` +const ComplianceStandardGermanyTisax ComplianceStandard = `GERMANY_TISAX` + const ComplianceStandardHipaa ComplianceStandard = `HIPAA` const ComplianceStandardHitrust ComplianceStandard = `HITRUST` @@ -466,11 +468,11 @@ func (f *ComplianceStandard) String() string { // Set raw string value and validate it against allowed values func (f *ComplianceStandard) Set(v string) error { switch v { - case `CANADA_PROTECTED_B`, `CYBER_ESSENTIAL_PLUS`, `FEDRAMP_HIGH`, `FEDRAMP_IL5`, `FEDRAMP_MODERATE`, `GERMANY_C5`, `HIPAA`, `HITRUST`, `IRAP_PROTECTED`, `ISMAP`, `ITAR_EAR`, `K_FSI`, `NONE`, `PCI_DSS`: + case `CANADA_PROTECTED_B`, `CYBER_ESSENTIAL_PLUS`, `FEDRAMP_HIGH`, `FEDRAMP_IL5`, `FEDRAMP_MODERATE`, `GERMANY_C5`, `GERMANY_TISAX`, `HIPAA`, `HITRUST`, `IRAP_PROTECTED`, `ISMAP`, `ITAR_EAR`, `K_FSI`, `NONE`, `PCI_DSS`: *f = ComplianceStandard(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "CANADA_PROTECTED_B", "CYBER_ESSENTIAL_PLUS", "FEDRAMP_HIGH", "FEDRAMP_IL5", "FEDRAMP_MODERATE", "GERMANY_C5", "HIPAA", "HITRUST", "IRAP_PROTECTED", "ISMAP", "ITAR_EAR", "K_FSI", "NONE", "PCI_DSS"`, v) + return fmt.Errorf(`value "%s" is not one of "CANADA_PROTECTED_B", "CYBER_ESSENTIAL_PLUS", "FEDRAMP_HIGH", "FEDRAMP_IL5", "FEDRAMP_MODERATE", "GERMANY_C5", "GERMANY_TISAX", "HIPAA", "HITRUST", "IRAP_PROTECTED", "ISMAP", "ITAR_EAR", "K_FSI", "NONE", "PCI_DSS"`, v) } } @@ -485,6 +487,7 @@ func (f *ComplianceStandard) Values() []ComplianceStandard { ComplianceStandardFedrampIl5, ComplianceStandardFedrampModerate, ComplianceStandardGermanyC5, + ComplianceStandardGermanyTisax, ComplianceStandardHipaa, ComplianceStandardHitrust, ComplianceStandardIrapProtected, @@ -616,6 +619,8 @@ 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"` + + 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 @@ -2346,6 +2351,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"` @@ -3389,6 +3412,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 @@ -3441,6 +3466,8 @@ 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"` + + 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 @@ -3524,6 +3551,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 @@ -4622,6 +4656,8 @@ 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"` + + 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 9d3b9d1f9..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. @@ -1816,6 +1835,9 @@ func (s Table) MarshalJSON() ([]byte, error) { type TableInternalAttributes struct { // Managed Delta Metadata location for foreign iceberg tables. AuxiliaryManagedLocation string `json:"auxiliary_managed_location,omitempty"` + // Storage locations of all table dependencies for shared views. Used on the + // recipient side for SEG (Secure Egress Gateway) whitelisting. + DependencyStorageLocations []string `json:"dependency_storage_locations,omitempty"` // Will be populated in the reconciliation response for VIEW and // FOREIGN_TABLE, with the value of the parent UC entity's storage_location, // following the same logic as getManagedEntityPath in @@ -1992,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..576810881 100755 --- a/service/sql/model.go +++ b/service/sql/model.go @@ -468,6 +468,9 @@ type AlertV2 struct { CustomSummary string `json:"custom_summary,omitempty"` // The display name of the alert. DisplayName string `json:"display_name,omitempty"` + // 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. @@ -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 @@ -1312,6 +1321,8 @@ 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 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 e5f15db8d..503605878 100755 --- a/service/workspace/model.go +++ b/service/workspace/model.go @@ -69,18 +69,22 @@ type AzureKeyVaultSecretScopeMetadata struct { } type CreateCredentialsRequest struct { + // The authenticating email associated with your Git provider user account. + // Used for authentication with the remote repository and also sets the + // author & committer identity for commits. Required for most Git providers + // except AWS CodeCommit. Learn more at + // https://docs.databricks.com/aws/en/repos/get-access-tokens-from-git-provider + GitEmail string `json:"git_email,omitempty"` // Git provider. This field is case-insensitive. The available Git providers // are `gitHub`, `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, // `gitHubEnterprise`, `bitbucketServer`, `gitLabEnterpriseEdition` and // `awsCodeCommit`. GitProvider string `json:"git_provider"` - // The username or email provided with your Git provider account, depending - // on which provider you are using. For GitHub, GitHub Enterprise Server, or - // Azure DevOps Services, either email or username may be used. For GitLab, - // GitLab Enterprise Edition, email must be used. For AWS CodeCommit, - // BitBucket or BitBucket Server, username must be used. For all other - // providers please see your provider's Personal Access Token authentication - // documentation to see what is supported. + // The username provided with your Git provider account and associated with + // the credential. For most Git providers it is only used to set the Git + // committer & author names for commits, however it may be required for + // authentication depending on your Git provider / token requirements. + // Required for AWS CodeCommit. GitUsername string `json:"git_username,omitempty"` // if the credential is the default for the given provider IsDefaultForProvider bool `json:"is_default_for_provider,omitempty"` @@ -108,10 +112,19 @@ func (s CreateCredentialsRequest) MarshalJSON() ([]byte, error) { type CreateCredentialsResponse struct { // ID of the credential object in the workspace. CredentialId int64 `json:"credential_id"` + // The authenticating email associated with your Git provider user account. + // Used for authentication with the remote repository and also sets the + // author & committer identity for commits. Required for most Git providers + // except AWS CodeCommit. Learn more at + // https://docs.databricks.com/aws/en/repos/get-access-tokens-from-git-provider + GitEmail string `json:"git_email,omitempty"` // The Git provider associated with the credential. GitProvider string `json:"git_provider"` - // The username or email provided with your Git provider account and - // associated with the credential. + // The username provided with your Git provider account and associated with + // the credential. For most Git providers it is only used to set the Git + // committer & author names for commits, however it may be required for + // authentication depending on your Git provider / token requirements. + // Required for AWS CodeCommit. GitUsername string `json:"git_username,omitempty"` // if the credential is the default for the given provider IsDefaultForProvider bool `json:"is_default_for_provider,omitempty"` @@ -211,10 +224,19 @@ func (s CreateScope) MarshalJSON() ([]byte, error) { type CredentialInfo struct { // ID of the credential object in the workspace. CredentialId int64 `json:"credential_id"` + // The authenticating email associated with your Git provider user account. + // Used for authentication with the remote repository and also sets the + // author & committer identity for commits. Required for most Git providers + // except AWS CodeCommit. Learn more at + // https://docs.databricks.com/aws/en/repos/get-access-tokens-from-git-provider + GitEmail string `json:"git_email,omitempty"` // The Git provider associated with the credential. GitProvider string `json:"git_provider,omitempty"` - // The username or email provided with your Git provider account and - // associated with the credential. + // The username provided with your Git provider account and associated with + // the credential. For most Git providers it is only used to set the Git + // committer & author names for commits, however it may be required for + // authentication depending on your Git provider / token requirements. + // Required for AWS CodeCommit. GitUsername string `json:"git_username,omitempty"` // if the credential is the default for the given provider IsDefaultForProvider bool `json:"is_default_for_provider,omitempty"` @@ -335,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`. @@ -351,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"` @@ -391,10 +456,19 @@ type GetCredentialsRequest struct { type GetCredentialsResponse struct { // ID of the credential object in the workspace. CredentialId int64 `json:"credential_id"` + // The authenticating email associated with your Git provider user account. + // Used for authentication with the remote repository and also sets the + // author & committer identity for commits. Required for most Git providers + // except AWS CodeCommit. Learn more at + // https://docs.databricks.com/aws/en/repos/get-access-tokens-from-git-provider + GitEmail string `json:"git_email,omitempty"` // The Git provider associated with the credential. GitProvider string `json:"git_provider,omitempty"` - // The username or email provided with your Git provider account and - // associated with the credential. + // The username provided with your Git provider account and associated with + // the credential. For most Git providers it is only used to set the Git + // committer & author names for commits, however it may be required for + // authentication depending on your Git provider / token requirements. + // Required for AWS CodeCommit. GitUsername string `json:"git_username,omitempty"` // if the credential is the default for the given provider IsDefaultForProvider bool `json:"is_default_for_provider,omitempty"` @@ -1138,18 +1212,22 @@ type SparseCheckoutUpdate struct { type UpdateCredentialsRequest struct { // The ID for the corresponding credential to access. CredentialId int64 `json:"-" url:"-"` + // The authenticating email associated with your Git provider user account. + // Used for authentication with the remote repository and also sets the + // author & committer identity for commits. Required for most Git providers + // except AWS CodeCommit. Learn more at + // https://docs.databricks.com/aws/en/repos/get-access-tokens-from-git-provider + GitEmail string `json:"git_email,omitempty"` // Git provider. This field is case-insensitive. The available Git providers // are `gitHub`, `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, // `gitHubEnterprise`, `bitbucketServer`, `gitLabEnterpriseEdition` and // `awsCodeCommit`. GitProvider string `json:"git_provider"` - // The username or email provided with your Git provider account, depending - // on which provider you are using. For GitHub, GitHub Enterprise Server, or - // Azure DevOps Services, either email or username may be used. For GitLab, - // GitLab Enterprise Edition, email must be used. For AWS CodeCommit, - // BitBucket or BitBucket Server, username must be used. For all other - // providers please see your provider's Personal Access Token authentication - // documentation to see what is supported. + // The username provided with your Git provider account and associated with + // the credential. For most Git providers it is only used to set the Git + // committer & author names for commits, however it may be required for + // authentication depending on your Git provider / token requirements. + // Required for AWS CodeCommit. GitUsername string `json:"git_username,omitempty"` // if the credential is the default for the given provider IsDefaultForProvider bool `json:"is_default_for_provider,omitempty"` 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),